:root {
  --bg: #0f1419;
  --bg-soft: #161d26;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --text: #f2f5f8;
  --muted: #9aa8b6;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #5eead4;
  --accent-2: #fbbf24;
  --accent-soft: rgba(94, 234, 212, 0.12);
  --danger: #f87171;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --max: 1080px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Instrument Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(94, 234, 212, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(251, 191, 36, 0.12), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(96, 165, 250, 0.08), transparent 60%);
  z-index: 0;
}

.header,
main,
.footer {
  position: relative;
  z-index: 1;
}

.header {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--accent), #38bdf8);
  color: #0b1220;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 1rem;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: 0.15s;
}

.nav a:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface);
}

.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 48px 24px 28px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: start;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.hero h1 {
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

.lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 560px;
}

.lead strong {
  color: var(--text);
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 28px;
}

.badge {
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.stat strong {
  display: block;
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.stat span {
  font-size: 0.8rem;
  color: var(--muted);
}

.hero-card {
  padding: 24px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--surface-strong), transparent);
  box-shadow: var(--shadow);
}

.hero-card h2 {
  font-size: 1.1rem;
  margin-bottom: 14px;
}

.hero-card ul {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.hero-card li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-note {
  font-size: 0.88rem;
  color: var(--muted);
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.hero-note em {
  color: var(--accent-2);
  font-style: normal;
}

.play {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.section-head {
  margin-bottom: 18px;
}

.section-head h2,
.data-copy h2,
.legal h2 {
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.section-head p,
.section-lead {
  color: var(--muted);
  max-width: 620px;
}

.game-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.game-picker::-webkit-scrollbar {
  display: none;
}

.pick {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}

.pick:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
}

.pick.active {
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.25), rgba(56, 189, 248, 0.2));
  border-color: rgba(94, 234, 212, 0.45);
  color: var(--text);
}

.board {
  display: none;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.board.active {
  display: block;
}

.board-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.board-head h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.board-head p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 2px;
}

.score {
  font-size: 0.86rem;
  color: var(--muted);
  white-space: nowrap;
}

.score b {
  color: var(--accent);
}

canvas {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  border-radius: 16px;
  background: #0b1016;
  border: 1px solid var(--line);
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #38bdf8);
  color: #071018;
  transition: transform 0.15s, opacity 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.25);
}

.dpad {
  display: none;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
  gap: 6px;
  justify-content: center;
  margin-top: 14px;
}

.dpad button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

.dpad button:nth-child(1) { grid-column: 2; }
.dpad button:nth-child(2) { grid-column: 1; grid-row: 2; }
.dpad button:nth-child(3) { grid-column: 3; grid-row: 2; }
.dpad button:nth-child(4) { grid-column: 2; grid-row: 3; }

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 360px;
  margin: 0 auto 16px;
}

.memory-card {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  transition: 0.15s;
}

.memory-card.open,
.memory-card.matched {
  color: var(--text);
  background: var(--accent-soft);
}

.memory-card.matched {
  border-color: rgba(94, 234, 212, 0.5);
}

.ttt-grid {
  display: grid;
  grid-template-columns: repeat(3, 80px);
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.ttt-cell {
  width: 80px;
  height: 80px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.ttt-cell:disabled {
  cursor: default;
}

.reaction {
  width: 100%;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 16px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.12s;
}

.reaction.idle {
  background: var(--surface);
  color: var(--muted);
}

.reaction.waiting {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.reaction.go {
  background: rgba(94, 234, 212, 0.18);
  color: var(--accent);
}

.hint {
  text-align: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.grid2048 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 320px;
  margin: 0 auto 16px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
}

.tile2048 {
  aspect-ratio: 1;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.06);
  color: transparent;
}

.tile2048.v2 { background: #1e3a5f; color: #cbd5e1; }
.tile2048.v4 { background: #1d4ed8; color: #e2e8f0; }
.tile2048.v8 { background: #7c3aed; color: #fff; }
.tile2048.v16 { background: #a855f7; color: #fff; }
.tile2048.v32 { background: #db2777; color: #fff; }
.tile2048.v64 { background: #e11d48; color: #fff; }
.tile2048.v128 { background: #ea580c; color: #fff; font-size: 0.95rem; }
.tile2048.v256 { background: #d97706; color: #fff; font-size: 0.95rem; }
.tile2048.v512 { background: #ca8a04; color: #fff; font-size: 0.95rem; }
.tile2048.v1024 { background: #65a30d; color: #fff; font-size: 0.8rem; }
.tile2048.v2048 { background: var(--accent); color: #071018; font-size: 0.8rem; }

.simon-grid {
  display: grid;
  grid-template-columns: repeat(2, 100px);
  gap: 12px;
  justify-content: center;
  margin-bottom: 14px;
}

.simon-btn {
  width: 100px;
  height: 100px;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.1s, transform 0.1s;
}

.simon-btn[data-i="0"] { background: #f472b6; }
.simon-btn[data-i="1"] { background: #34d399; }
.simon-btn[data-i="2"] { background: #60a5fa; }
.simon-btn[data-i="3"] { background: #fbbf24; }

.simon-btn.lit {
  opacity: 1;
  transform: scale(1.04);
}

.info-grid {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 24px 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.info-card {
  padding: 24px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.info-icon {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 12px;
}

.info-card h2 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.info-card p {
  color: var(--muted);
  font-size: 0.92rem;
}

.data-section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px 48px;
}

.data-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-strong), transparent);
}

.data-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.data-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.92rem;
}

.data-list li span {
  flex: 0 0 72px;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-note {
  font-size: 0.9rem;
  color: var(--muted);
  padding: 14px;
  border-radius: 14px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.data-panel {
  padding: 22px;
  border-radius: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.data-panel h3 {
  margin-bottom: 18px;
  font-size: 1rem;
}

.meter {
  margin-bottom: 14px;
}

.meter label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
}

.panel-foot {
  margin-top: 16px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.55;
}

.legal {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px 56px;
}

.legal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.legal-block {
  padding: 22px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.legal-block h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--accent);
}

.legal-block p {
  color: var(--muted);
  font-size: 0.9rem;
}

.legal-block a {
  color: var(--accent);
}

.footer {
  text-align: center;
  padding: 28px 24px 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.footer-sub {
  margin-top: 6px;
  font-size: 0.78rem;
  opacity: 0.75;
}

@media (max-width: 900px) {
  .hero,
  .data-inner,
  .info-grid,
  .legal-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .header {
    padding-top: 16px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .hero {
    padding-top: 28px;
  }

  .dpad { display: grid; }
  .ttt-grid { grid-template-columns: repeat(3, 72px); }
  .ttt-cell { width: 72px; height: 72px; }
  .simon-grid { grid-template-columns: repeat(2, 88px); }
  .simon-btn { width: 88px; height: 88px; }
}
