:root {
  --bg: #0b0e11;
  --panel: #1e2329;
  --panel-2: #181a20;
  --line: #2b3139;
  --gold: #f0b90b;
  --gold-2: #ffa500;
  --text: #eaecef;
  --muted: #848e9c;
  --danger: #ff5959;
  --success: #32cd32;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button { font: inherit; cursor: pointer; }

.hidden { display: none !important; }

.background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--bg);
}

.bg-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0b0e11 0%, #181a20 50%, #0b0e11 100%);
}

.glow {
  position: absolute;
  width: min(70vw, 800px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240,185,11,0.7), transparent 70%);
  filter: blur(64px);
  opacity: 0.1;
  animation: glowPulse 8s ease-in-out infinite;
}

.glow-one { top: -20%; right: 10%; }
.glow-two { bottom: -20%; left: 10%; animation-delay: 3s; }

.grid-lines::before,
.grid-lines::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
}

.grid-lines.vertical::before {
  background-image: linear-gradient(90deg, transparent calc(12.5% - 1px), rgba(43,49,57,0.8) 12.5%, transparent calc(12.5% + 1px));
  background-size: 12.5% 100%;
}

.grid-lines.horizontal::after {
  background-image: linear-gradient(0deg, transparent calc(12.5% - 1px), rgba(43,49,57,0.8) 12.5%, transparent calc(12.5% + 1px));
  background-size: 100% 12.5%;
}

.background::before,
.background::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240,185,11,0.45), transparent);
}

.background::before { top: 0; }
.background::after { bottom: 0; }

.corner {
  position: absolute;
  width: 128px;
  height: 128px;
  border-color: rgba(240,185,11,0.22);
}
.corner-tl { top: 0; left: 0; border-left: 2px solid; border-top: 2px solid; border-top-left-radius: 8px; }
.corner-tr { top: 0; right: 0; border-right: 2px solid; border-top: 2px solid; border-top-right-radius: 8px; }
.corner-bl { bottom: 0; left: 0; border-left: 2px solid; border-bottom: 2px solid; border-bottom-left-radius: 8px; }
.corner-br { bottom: 0; right: 0; border-right: 2px solid; border-bottom: 2px solid; border-bottom-right-radius: 8px; }

.orbital {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(76vw, 600px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240,185,11,0.08), transparent 60%);
}

.symbol {
  position: absolute;
  left: var(--x);
  top: var(--y);
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(38px, 5vw, 48px);
  font-weight: 900;
  opacity: 0.04;
  animation: float 22s ease-in-out infinite;
  animation-delay: var(--delay);
}

.star-dot {
  position: absolute;
  width: var(--size);
  height: var(--size);
  left: var(--x);
  top: var(--y);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
  animation: twinkle var(--duration) ease-in-out infinite;
  animation-delay: var(--delay);
}

.site-shell { position: relative; z-index: 1; }
.admin-shell { min-height: 100vh; }
.admin-panel { width: min(980px, 100%); }
.admin-tools { margin: 18px auto; }

.section-screen {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.hero-content {
  width: min(100%, 720px);
  text-align: center;
}

.wide-content { width: min(100%, 1120px); }

.logo {
  width: clamp(96px, 16vw, 160px);
  height: clamp(96px, 16vw, 160px);
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.brand-emblem {
  position: relative;
  width: clamp(150px, 20vw, 190px);
  height: clamp(150px, 20vw, 190px);
  margin: 0 auto;
  border: 5px solid var(--gold);
  border-radius: 30px;
  background: radial-gradient(circle at center, rgba(240,185,11,0.18), rgba(11,14,17,0.96) 62%);
  box-shadow: 0 22px 56px rgba(0,0,0,0.48), 0 0 34px rgba(240,185,11,0.2);
}

.emblem-line {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 50%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #00e0ff, var(--gold), #ff4d6d);
  opacity: 0.9;
  box-shadow: 0 0 16px rgba(240,185,11,0.5);
}
.line-a { transform: translateY(-50%) rotate(24deg); }
.line-b { transform: translateY(-50%) rotate(-24deg); }

.emblem-avatar {
  position: absolute;
  z-index: 2;
  width: 30%;
  height: 30%;
  object-fit: cover;
  border: 3px solid #2b3139;
  border-radius: 14px;
  background: #111820;
  box-shadow: 0 8px 18px rgba(0,0,0,0.34);
}
.emblem-avatar.cz { top: 9%; left: 9%; border-color: var(--gold); }
.emblem-avatar.heyi { top: 7%; left: 35%; border-color: #eaecef; }
.emblem-avatar.star { top: 9%; right: 9%; border-color: #1e90ff; }
.emblem-avatar.sun { bottom: 9%; left: 9%; border-color: #ff4500; }
.emblem-avatar.vitalik { bottom: 7%; left: 35%; border-color: #9370db; }
.emblem-avatar.sbf { bottom: 9%; right: 9%; border-color: #32cd32; }

.emblem-coin {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34%;
  height: 34%;
  transform: translate(-50%, -50%);
  border: 4px solid #0b0e11;
  border-radius: 50%;
  color: #0b0e11;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(240,185,11,0.25), 0 12px 28px rgba(0,0,0,0.42);
}

.emblem-coin::before,
.emblem-coin::after,
.emblem-coin span::before,
.emblem-coin span::after {
  content: "";
  position: absolute;
  width: 22%;
  height: 22%;
  background: #0b0e11;
  transform: rotate(45deg);
}
.emblem-coin::before { top: 18%; left: 39%; }
.emblem-coin::after { bottom: 18%; left: 39%; }
.emblem-coin span::before { top: 39%; left: 18%; }
.emblem-coin span::after { top: 39%; right: 18%; }
.emblem-coin span {
  position: absolute;
  inset: 0;
}

.hero h1,
.game-header h1 {
  margin: 20px 0 8px;
  font-size: clamp(52px, 9vw, 96px);
  line-height: 0.95;
  font-weight: 950;
  letter-spacing: 0;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(240,185,11,0.24);
}

.subtitle { margin: 0; font-size: clamp(22px, 3vw, 32px); font-weight: 800; }

.taglines { margin: 34px 0; display: grid; gap: 10px; }
.taglines p { margin: 0; font-size: clamp(16px, 2.6vw, 24px); font-weight: 760; }
.taglines .gold { color: var(--gold); font-weight: 900; }
.ca-banner {
  width: min(720px, 100%);
  margin: -16px auto 22px;
  padding: 13px 16px;
  border: 1px solid rgba(240,185,11,0.35);
  border-radius: 12px;
  color: var(--gold);
  background: rgba(11,14,17,0.55);
  font-weight: 900;
  word-break: break-all;
}
.ca-banner.good { color: #9dff6f; border-color: rgba(157,255,111,0.35); }
.muted, .section-note { color: var(--muted); }

[data-icon] { display: inline-flex; width: 1.15em; height: 1.15em; vertical-align: -0.18em; }
[data-icon] svg { width: 100%; height: 100%; stroke: currentColor; }

.primary-btn,
.secondary-btn,
.ghost-btn,
.wallet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.primary-btn {
  padding: 18px 34px;
  color: #0b0e11;
  background: var(--gold);
  border: 4px solid var(--gold);
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 950;
  box-shadow: var(--shadow), 0 0 24px rgba(240,185,11,0.35);
}
.primary-btn:hover { transform: scale(1.06); background: #f7c629; }
.primary-btn.large { padding: 24px 48px; font-size: clamp(26px, 3.4vw, 36px); }
.primary-btn.compact { padding: 12px 18px; border-width: 2px; font-size: 16px; }

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.top-wallet {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 8;
}

.wallet-btn {
  padding: 14px 22px;
  color: var(--gold);
  background: rgba(30,35,41,0.9);
  border: 2px solid rgba(240,185,11,0.46);
  font-size: clamp(17px, 2.1vw, 21px);
  font-weight: 900;
  box-shadow: 0 18px 50px rgba(0,0,0,0.32);
}
.wallet-btn:hover { transform: translateY(-2px); border-color: var(--gold); background: rgba(240,185,11,0.12); }
.wallet-btn.large { padding: 20px 30px; font-size: clamp(20px, 2.8vw, 28px); }
.wallet-btn.compact { min-height: 42px; padding: 10px 14px; font-size: 14px; }
.wallet-btn.connected { color: #0b0e11; background: var(--gold); border-color: var(--gold); }

.wallet-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 34px 108px 24px 24px;
  background: rgba(11,14,17,0.56);
  backdrop-filter: blur(2px);
}

.wallet-popover {
  position: relative;
  width: min(100%, 300px);
  padding: 20px 14px 14px;
  border: 1px solid rgba(240,185,11,0.24);
  border-radius: 16px;
  background: #e8e1d6;
  color: #1f1d1a;
  text-align: center;
  box-shadow: 0 28px 80px rgba(0,0,0,0.42);
}

.wallet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(31,29,26,0.08);
  color: #1f1d1a;
  font-size: 20px;
  line-height: 1;
}

.wallet-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, #ff6b8a, #ff465f);
  box-shadow: 0 16px 34px rgba(255,70,95,0.28);
  font-size: 28px;
}

.wallet-popover h2 {
  margin: 0;
  color: #1f1d1a;
  font-size: 18px;
  font-weight: 950;
}

.wallet-popover p { margin: 3px 0; color: rgba(31,29,26,0.78); font-size: 13px; }
.wallet-modal-network { font-size: 12px; font-weight: 800; }
.wallet-modal-message { min-height: 16px; font-size: 11px; font-weight: 760; }
.wallet-modal-message.bad { color: #b42525; }
.wallet-modal-message.good { color: #167a28; }

.wallet-modal-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 14px 0 8px;
}

.wallet-action {
  display: flex;
  min-height: 50px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  background: #fff;
  color: #1f1d1a;
  font-size: 12px;
}

.wallet-action:hover { background: #f8f4ee; }
.wallet-action [data-icon] { width: 18px; height: 18px; }

.secondary-btn {
  padding: 10px 14px;
  color: var(--gold);
  background: rgba(240,185,11,0.1);
  border: 1px solid rgba(240,185,11,0.36);
  font-weight: 800;
}
.secondary-btn:hover { background: rgba(240,185,11,0.18); }

.ghost-btn {
  padding: 10px 14px;
  color: var(--text);
  background: rgba(30,35,41,0.75);
  border: 1px solid var(--line);
  font-weight: 800;
}
.ghost-btn:hover { border-color: var(--gold); }
.ghost-btn.compact { width: fit-content; }
.secondary-btn.compact { min-height: 42px; padding: 10px 12px; font-size: 14px; }
.hero-rank-btn { min-height: 56px; }

.scroll-hint { margin-top: 38px; color: var(--muted); animation: bounce 1.5s infinite; }
.start-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--gold);
  font-size: 14px;
  font-weight: 800;
}
.start-status.bad { color: #ff8b8b; }
.start-status.good { color: #8df08d; }

.cast-section { align-items: flex-start; padding-top: 54px; }
.flap-panel {
  margin: 0 auto 38px;
  padding: 22px;
  border: 1px solid rgba(240,185,11,0.36);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(240,185,11,0.14), rgba(30,35,41,0.86));
  box-shadow: 0 20px 70px rgba(0,0,0,0.32);
}
.flap-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
  text-align: left;
}
.flap-heading [data-icon] { width: 44px; height: 44px; color: var(--gold); }
.flap-heading h2 { margin: 0 0 4px; text-align: left; font-size: clamp(28px, 4vw, 42px); }
.flap-heading p { margin: 0; color: var(--muted); font-weight: 700; }
.flap-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.flap-grid div {
  min-height: 104px;
  padding: 14px;
  border: 1px solid rgba(132,142,156,0.2);
  border-radius: 12px;
  background: rgba(11,14,17,0.44);
}
.flap-grid strong { display: block; margin-bottom: 7px; color: var(--gold); font-size: 16px; }
.flap-grid span { color: var(--text); font-size: 13px; line-height: 1.45; }
.flap-disclaimer {
  margin: 14px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 760;
}
.cast-section h2,
.ready-section h2,
.level-select h2 {
  margin: 0 0 12px;
  color: var(--gold);
  text-align: center;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 950;
}
.section-lead { margin: 0 0 8px; text-align: center; font-size: clamp(16px, 2vw, 20px); font-weight: 760; }
.section-note { margin: 0 0 28px; text-align: center; }

.character-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.character-card {
  min-height: 284px;
  padding: 22px;
  border-radius: 18px;
  border: 2px solid var(--line);
  background: var(--panel);
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.character-card:hover { transform: scale(1.04); border-color: var(--gold); }
.character-card img {
  width: 132px;
  height: 132px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 16px 34px rgba(0,0,0,0.34);
}
.character-card h3 { margin: 12px 0 4px; font-size: 22px; }
.character-card .skill-name { margin: 0; font-weight: 850; }
.character-card .desc { min-height: 34px; margin: 8px 0; color: var(--muted); font-size: 14px; }
.trigger-pill { display: inline-block; padding: 4px 8px; border-radius: 6px; color: var(--gold); background: rgba(240,185,11,0.1); font-size: 12px; font-weight: 850; }

.rocket-badge { color: var(--gold); font-size: clamp(100px, 15vw, 160px); }
.flow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin: 24px 0 8px; color: var(--muted); }

.game-shell { position: relative; z-index: 1; min-height: 100dvh; padding: 20px; }
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(100%, 1280px);
  margin: 0 auto 20px;
}
.game-header h1 { margin: 10px 0 0; font-size: clamp(38px, 5vw, 64px); }
.stats-strip { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.stats-strip div,
.meter-row div {
  min-width: 104px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(30,35,41,0.78);
}
.stats-strip span,
.meter-row span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stats-strip strong,
.meter-row strong { color: var(--gold); font-size: 22px; }

.level-select,
.play-area { width: min(100%, 1280px); margin: 0 auto; }
.panel-title { margin-bottom: 18px; text-align: center; }
.panel-title p { margin: 0; color: var(--muted); }
.panel-title .secondary-btn { margin-top: 14px; }
.eligibility-status {
  width: min(100%, 620px);
  margin: 12px auto 0;
  padding: 10px 12px;
  border: 1px solid rgba(240,185,11,0.26);
  border-radius: 10px;
  color: var(--gold);
  background: rgba(240,185,11,0.08);
  font-size: 13px;
  font-weight: 800;
}
.eligibility-status.bad { border-color: rgba(255,89,89,0.38); color: #ff8b8b; background: rgba(255,89,89,0.1); }
.eligibility-status.good { border-color: rgba(50,205,50,0.38); color: #8df08d; background: rgba(50,205,50,0.1); }
.chapters { display: flex; justify-content: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.chapter-tab { padding: 10px 16px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; font-weight: 850; }
.chapter-tab.active { color: #0b0e11; background: var(--gold); border-color: var(--gold); }
.level-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.level-card {
  min-height: 144px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(30,35,41,0.88);
  color: var(--text);
  text-align: left;
  box-shadow: 0 12px 34px rgba(0,0,0,0.25);
}
.level-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.level-card.locked { opacity: 0.46; cursor: not-allowed; }
.level-card .num { color: var(--gold); font-weight: 950; }
.level-card h3 { margin: 6px 0; font-size: 16px; }
.level-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.level-card .stars { margin-top: 8px; color: var(--gold); letter-spacing: 2px; }

.play-area {
  display: grid;
  grid-template-columns: 280px minmax(320px, 1fr) 280px;
  align-items: start;
  gap: 18px;
}
.game-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(30,35,41,0.9);
  box-shadow: var(--shadow);
}
.level-heading span { color: var(--gold); font-weight: 900; }
.level-heading h2 { margin: 4px 0 14px; font-size: 24px; }
.meter-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.meter-row div { min-width: 0; padding: 8px; }
.meter-row strong { font-size: 19px; }
.meter-row .time-low strong { color: #ff8b8b; animation: pulse 1s ease-in-out infinite; }
.stars-row { margin: 12px 0 18px; color: var(--gold); font-size: 28px; letter-spacing: 4px; }
.game-panel h3 { margin: 18px 0 10px; color: var(--gold); }
.objectives { display: grid; gap: 8px; }
.objective {
  padding: 10px;
  border: 1px solid rgba(132,142,156,0.22);
  border-radius: 10px;
  background: rgba(11,14,17,0.45);
}
.objective.complete { border-color: rgba(50,205,50,0.55); }
.objective strong { display: block; font-size: 14px; }
.objective span { color: var(--muted); font-size: 12px; }
.message { min-height: 48px; margin-top: 14px; padding: 10px; border-radius: 10px; background: rgba(240,185,11,0.1); color: var(--gold); font-weight: 780; }
.message.bad { background: rgba(255,89,89,0.12); color: #ff8b8b; }
.message.good { background: rgba(50,205,50,0.12); color: #8df08d; }
.panel-actions { display: flex; gap: 10px; margin-top: 14px; }
.play-economy { margin-top: 10px; color: var(--muted); font-size: 12px; font-weight: 750; }

.board-wrap {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(24,26,32,0.9);
  box-shadow: var(--shadow);
}
.board-topline { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; color: var(--muted); font-weight: 800; }
.board-topline strong { color: var(--gold); font-size: 13px; }
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: clamp(5px, 0.8vw, 8px);
  width: min(100%, 640px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: clamp(8px, 1.4vw, 14px);
  border-radius: 18px;
  border: 2px solid rgba(240,185,11,0.28);
  background: linear-gradient(135deg, rgba(240,185,11,0.16), rgba(43,49,57,0.72));
}
.tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border: 2px solid rgba(234,236,239,0.08);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  box-shadow: inset 0 -8px 18px rgba(0,0,0,0.28), 0 6px 12px rgba(0,0,0,0.25);
  overflow: hidden;
  transition: transform 0.14s ease, border-color 0.14s ease, filter 0.14s ease;
}
.tile:hover { transform: translateY(-2px); }
.tile.selected { border-color: var(--gold); transform: scale(1.06); box-shadow: 0 0 22px rgba(240,185,11,0.6); }
.tile.hint { animation: hintPulse 0.8s ease-in-out 3; }
.tile.matched { animation: pop 0.22s ease forwards; }
.tile img { width: 86%; height: 86%; object-fit: cover; border-radius: 10px; pointer-events: none; }
.tile .power {
  position: absolute;
  right: 3px;
  bottom: 2px;
  padding: 2px 4px;
  border-radius: 6px;
  background: rgba(11,14,17,0.76);
  color: var(--gold);
  font-size: clamp(10px, 1.6vw, 16px);
  font-weight: 950;
}
.tile .obstacle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 950;
  text-shadow: 0 2px 8px #000;
  pointer-events: none;
}
.tile .obstacle.ice { background: rgba(80,180,255,0.38); border: 2px solid rgba(130,215,255,0.85); }
.tile .obstacle.box { background: rgba(132,82,38,0.52); border: 2px solid rgba(210,135,60,0.9); }

.skill-list { display: grid; gap: 10px; }
.skill-row { display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center; }
.skill-row img { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; }
.skill-row strong { display: block; font-size: 13px; }
.skill-row span { color: var(--muted); font-size: 12px; }
.obstacle-guide { display: grid; gap: 10px; }
.obstacle-guide div { display: grid; grid-template-columns: 28px 1fr; column-gap: 10px; align-items: center; }
.obstacle-guide small { grid-column: 2; color: var(--muted); }
.obstacle-chip { width: 28px; height: 28px; border-radius: 8px; }
.obstacle-chip.ice { background: rgba(80,180,255,0.5); border: 2px solid #82d7ff; }
.obstacle-chip.box { background: rgba(132,82,38,0.65); border: 2px solid #d2873c; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.72);
}
.modal-card {
  width: min(100%, 440px);
  padding: 28px;
  border: 1px solid rgba(240,185,11,0.4);
  border-radius: 20px;
  background: var(--panel);
  text-align: center;
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 10px; color: var(--gold); font-size: 34px; }
.modal-stars { color: var(--gold); font-size: 36px; letter-spacing: 4px; }
.modal-card p { color: var(--muted); }
.modal-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

.profile-card { text-align: left; }
.profile-card h2,
.leaderboard-card h2 { text-align: center; }
.profile-note { margin: 0 0 16px; color: var(--muted); text-align: center; }
.profile-field { display: grid; gap: 8px; margin: 14px 0 6px; color: var(--text); font-weight: 850; }
.profile-field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: rgba(11,14,17,0.65);
  outline: none;
}
.profile-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240,185,11,0.14); }
.profile-error { min-height: 20px; margin: 6px 0 12px; color: #ff8b8b; font-size: 13px; }
.leaderboard-card,
.history-card { position: relative; width: min(100%, 620px); }
.leaderboard-close { background: rgba(255,255,255,0.08); color: var(--text); }
.reward-tools {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid rgba(132,142,156,0.2);
  border-radius: 12px;
  background: rgba(11,14,17,0.42);
  text-align: left;
}
.reward-tools strong { display: block; color: var(--text); font-size: 15px; }
.reward-tools span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; word-break: break-all; }
.reward-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.reward-actions .primary-btn,
.reward-actions .secondary-btn { flex: 1; min-width: 160px; }
.reward-tools .profile-note { margin: 0; text-align: left; font-size: 12px; }
.leaderboard-list { display: grid; gap: 8px; max-height: min(62vh, 520px); overflow: auto; padding-right: 4px; }
.leaderboard-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 112px 86px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(132,142,156,0.18);
  border-radius: 10px;
  background: rgba(11,14,17,0.42);
}
.leaderboard-row.current { border-color: rgba(240,185,11,0.6); background: rgba(240,185,11,0.1); }
.leaderboard-rank { color: var(--gold); font-weight: 950; }
.leaderboard-name { min-width: 0; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-wallet { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.leaderboard-score { color: var(--gold); font-weight: 950; text-align: right; }
.leaderboard-meta { color: var(--muted); font-size: 12px; text-align: right; }
.leaderboard-empty { padding: 20px; color: var(--muted); text-align: center; }
.history-list { display: grid; gap: 8px; max-height: min(62vh, 520px); overflow: auto; padding-right: 4px; }
.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(132,142,156,0.18);
  border-radius: 10px;
  background: rgba(11,14,17,0.42);
  text-align: left;
}
.history-row strong { display: block; color: var(--text); font-size: 14px; }
.history-row span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; word-break: break-all; }
.history-amount { color: var(--gold); font-weight: 950; text-align: right; white-space: nowrap; }
.history-link { color: var(--gold); text-decoration: none; }
.history-link:hover { text-decoration: underline; }

.rise-in { animation: riseIn 0.7s ease both; }
.float { animation: float 4s ease-in-out infinite; }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
.pulse-strong { animation: pulseStrong 1.5s ease-in-out infinite; }
.bounce { animation: bounce 1.5s ease-in-out infinite; }

@keyframes riseIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.62; } }
@keyframes pulseStrong { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes twinkle { 0%, 100% { opacity: 0.2; transform: scale(0.7); } 50% { opacity: 1; transform: scale(1.25); } }
@keyframes glowPulse { 0%, 100% { opacity: 0.08; transform: scale(1); } 50% { opacity: 0.14; transform: scale(1.08); } }
@keyframes pop { to { transform: scale(0); opacity: 0.2; } }
@keyframes hintPulse { 0%, 100% { border-color: rgba(234,236,239,0.08); } 50% { border-color: var(--gold); transform: scale(1.05); } }

@media (max-width: 1080px) {
  .play-area { grid-template-columns: 1fr; }
  .guide-panel { order: 3; }
  .objective-panel { order: 2; }
  .board-wrap { order: 1; }
  .skill-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .section-screen { padding: 24px 14px; }
  .character-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .flap-heading { align-items: flex-start; justify-content: flex-start; }
  .flap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .character-card { padding: 12px; min-height: 236px; border-radius: 14px; }
  .character-card img { width: 96px; height: 96px; }
  .character-card h3 { font-size: 19px; }
  .game-shell { padding: 12px; }
  .game-header { align-items: flex-start; flex-direction: column; }
  .stats-strip { width: 100%; justify-content: stretch; }
  .stats-strip div { flex: 1; min-width: 0; }
  .level-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-wrap { padding: 10px; border-radius: 16px; }
  .board { gap: 4px; padding: 7px; border-radius: 14px; }
  .tile { border-radius: 9px; }
  .tile img { border-radius: 7px; }
  .board-topline { flex-direction: column; }
  .meter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill-list { grid-template-columns: 1fr; }
  .leaderboard-row { grid-template-columns: 34px minmax(0, 1fr) 86px; }
  .leaderboard-meta { display: none; }
}

@media (max-width: 430px) {
  .primary-btn { width: 100%; padding-left: 18px; padding-right: 18px; }
  .top-wallet { top: 10px; right: 10px; }
  .wallet-modal { align-items: flex-start; justify-content: center; padding: 72px 12px 12px; }
  .wallet-modal-actions { grid-template-columns: 1fr; }
  .character-grid { grid-template-columns: 1fr; }
  .flap-grid { grid-template-columns: 1fr; }
  .level-grid { grid-template-columns: 1fr; }
}
