:root {
  color-scheme: dark;
  --paper: #000;
  --ink: #f7f4ec;
  --muted: #a8adb5;
  --panel: #0b0d10;
  --line: #2a2e35;
  --teal: #009c9a;
  --coral: #ff6b62;
  --gold: #e4b34c;
  --green: #60c47c;
  --blue: #6c9cff;
  --shadow: rgba(255, 255, 255, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(0, 156, 154, 0.18), transparent 34%),
    linear-gradient(315deg, rgba(255, 107, 98, 0.14), transparent 38%),
    var(--paper);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.arcade-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 max(34px, env(safe-area-inset-bottom));
}

.arcade-topbar,
.play-head,
.arcade-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.arcade-topbar {
  min-height: 56px;
  border-bottom: 1px solid rgba(23, 25, 35, 0.12);
}

.arcade-brand,
.arcade-home {
  font-weight: 850;
}

.arcade-home {
  color: var(--muted);
  font-size: 14px;
}

.arcade-hero,
.play-head {
  padding: clamp(30px, 7vw, 70px) 0 24px;
}

.arcade-eyebrow {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 16px;
  font-size: clamp(46px, 14vw, 104px);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(26px, 5vw, 42px);
  line-height: 1;
}

.arcade-hero p,
.play-head p {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(16px, 2.5vw, 20px);
  line-height: 1.55;
}

.feature-game,
.game-groups article,
.play-panel {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 7px 7px 0 var(--shadow);
}

.feature-game {
  display: grid;
  gap: 8px;
  min-width: 230px;
  padding: 20px;
}

.feature-game span,
.feature-game small,
.game-links small,
.game-status small,
.board-note {
  color: var(--muted);
}

.feature-game strong {
  color: var(--teal);
  font-size: 28px;
}

.game-groups {
  display: grid;
  gap: 18px;
}

.game-groups article {
  padding: clamp(18px, 4vw, 28px);
}

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

.game-links a {
  display: grid;
  gap: 6px;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #07090c;
}

.game-links span {
  font-weight: 900;
}

.play-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.arcade-button {
  min-height: 44px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--gold);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.arcade-button.secondary {
  display: inline-flex;
  align-items: center;
  background: #07090c;
}

.play-panel {
  padding: clamp(14px, 3vw, 24px);
}

.game-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 800;
}

.game-status strong {
  color: var(--ink);
}

.how-card {
  max-width: 760px;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #07090c;
}

.how-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.how-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.grid {
  display: grid;
  gap: 8px;
  width: min(100%, 560px);
  margin: 0 auto;
  touch-action: none;
}

.cell,
.tile,
.choice-button,
.key-button,
.number-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080a0d;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.tile {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid rgba(23, 25, 35, 0.16);
  font-size: clamp(24px, 9vw, 54px);
}

.tile-2 { background: #102922; }
.tile-4 { background: #262615; }
.tile-8 { background: #4a241d; }
.tile-16 { background: #62302b; }
.tile-32 { background: #7c3932; }
.tile-64 { background: #f28578; color: #fff; }
.tile-128, .tile-256 { background: #88cfc4; }
.tile-512, .tile-1024, .tile-2048 { background: #20242f; color: #fff; }

.pad {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.pad button:nth-child(1) { grid-column: 2; }
.pad button:nth-child(2) { grid-column: 1; }

.mine-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); max-width: 600px; }
.mine-cell { aspect-ratio: 1; min-height: 0; font-size: clamp(12px, 4vw, 22px); }
.mine-cell.open { background: #1a1d23; }
.mine-cell.mine { background: var(--coral); color: #fff; }
.mine-cell.flag { color: var(--coral); }

.connect-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); max-width: 620px; }
.connect-cell,
.disc,
.stone {
  display: block;
  width: 72%;
  aspect-ratio: 1;
  border-radius: 50%;
}

.connect-cell {
  display: grid;
  place-items: center;
  background: #171b22;
}

.disc.red { background: var(--coral); }
.disc.yellow { background: var(--gold); }
.disc.black, .stone.black { background: #171923; }
.disc.white, .stone.white { background: #f7f4ec; border: 2px solid var(--ink); }

.tac-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 430px; }
.tac-cell { aspect-ratio: 1; font-size: clamp(38px, 16vw, 72px); }

.memory-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 520px; }
.memory-cell { aspect-ratio: 1; font-size: clamp(24px, 10vw, 46px); }

.lights-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 460px; }
.light-on { background: var(--gold); }
.puzzle-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 430px; }
.puzzle-cell { aspect-ratio: 1; font-size: clamp(24px, 10vw, 46px); }
.puzzle-cell.blank { opacity: .35; }
.simon-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 420px);
  margin: 0 auto;
}
.simon-button {
  min-height: 130px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  text-transform: capitalize;
}
.simon-button.teal { background: var(--teal); }
.simon-button.coral { background: var(--coral); }
.simon-button.gold { background: var(--gold); color: var(--ink); }
.simon-button.blue { background: var(--blue); }
.chance-result {
  display: grid;
  width: min(100%, 320px);
  min-height: 130px;
  margin: 0 auto;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #080a0d;
  font-size: clamp(40px, 12vw, 76px);
  font-weight: 950;
}

.reaction-pad,
.target-arena,
.color-card,
.math-problem {
  display: grid;
  width: min(100%, 560px);
  margin: 0 auto;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
}

.reaction-pad {
  min-height: 260px;
  background: #191d24;
  color: var(--ink);
  cursor: pointer;
  font-size: clamp(42px, 12vw, 88px);
  font-weight: 950;
}

.reaction-pad.wait { background: var(--coral); }
.reaction-pad.go { background: var(--green); }

.target-arena {
  position: relative;
  height: min(62vh, 520px);
  overflow: hidden;
  background: #07090c;
}

.target-dot {
  position: absolute;
  width: 54px;
  height: 54px;
  translate: -50% -50%;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
  cursor: pointer;
}

#aim-time {
  position: absolute;
  right: 14px;
  top: 12px;
  color: var(--muted);
  font-weight: 900;
}

.whack-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 480px;
}

.whack-cell {
  aspect-ratio: 1;
  font-size: clamp(28px, 10vw, 58px);
}

.whack-cell.active {
  background: var(--gold);
  color: var(--ink);
}

.maze-board {
  display: grid;
  width: min(100%, 540px);
  margin: 0 auto;
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
}

.maze-cell {
  display: grid;
  min-height: 44px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(255,255,255,.08);
  background: #10141a;
  font-weight: 950;
}

.maze-cell.wall { background: #343a46; }
.maze-cell.exit { background: var(--green); color: #06100a; }

.color-card {
  min-height: 220px;
  box-shadow: inset 0 0 0 12px rgba(0,0,0,.12);
}

.math-problem {
  min-height: 170px;
  background: #07090c;
  font-size: clamp(44px, 13vw, 92px);
  font-weight: 950;
}

.pattern-grid,
.tile-stack-grid,
.odd-grid,
.path-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 460px;
}

.odd-grid,
.path-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.pattern-cell,
.stack-tile,
.odd-cell,
.path-cell {
  aspect-ratio: 1;
  font-size: clamp(24px, 9vw, 48px);
}

.pattern-cell.active,
.pattern-cell.picked,
.path-cell.active {
  background: var(--gold);
  color: var(--ink);
}

.stack-tile.selected,
.shape-piece.selected {
  outline: 3px solid var(--coral);
  outline-offset: -3px;
}

.path-cell.start {
  background: var(--blue);
}

.path-cell.exit {
  background: var(--green);
  color: #06100a;
}

.scramble-word,
.guess-list,
.shape-row,
.shape-bins,
.piano-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px auto 0;
}

.guess-list {
  display: grid;
  width: min(100%, 420px);
}

.guess-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #080a0d;
}

.emoji-display,
.piano-display,
.scale {
  display: grid;
  width: min(100%, 520px);
  min-height: 120px;
  margin: 0 auto;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #07090c;
  font-size: clamp(34px, 10vw, 70px);
  font-weight: 950;
}

.scale {
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.scale div {
  display: grid;
  height: 100%;
  place-items: center;
  background: #07090c;
}

.scale span {
  color: var(--muted);
  font-size: 14px;
}

.emoji-button {
  min-width: 58px;
  font-size: 28px;
}

.piano-key,
.shape-piece,
.shape-bin {
  min-height: 84px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0 18px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font: inherit;
  font-size: clamp(28px, 8vw, 48px);
  font-weight: 950;
}

.piano-key {
  min-width: 70px;
  background: #f7f4ec;
  color: #050505;
}

.shape-piece,
.shape-bin {
  min-width: 84px;
  background: #080a0d;
  color: var(--ink);
}

.word-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: min(100%, 420px);
  margin: 0 auto 6px;
}

.letter-box {
  display: grid;
  min-height: 56px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #080a0d;
  font-size: 24px;
  font-weight: 950;
}

.letter-box.hit { background: var(--green); color: #fff; }
.letter-box.near { background: var(--gold); }
.letter-box.miss { background: #2d323a; }

.keyboard,
.choices,
.numbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.key-button {
  min-width: 38px;
  padding: 0 10px;
}

.word-input {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.word-input input {
  width: min(220px, 100%);
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  text-transform: uppercase;
}

.board {
  display: grid;
  width: min(100%, 620px);
  margin: 0 auto;
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
}

.board-cell {
  position: relative;
  display: grid;
  min-height: 36px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(23, 25, 35, 0.12);
  background: #080a0d;
  font-size: clamp(14px, 5vw, 32px);
  font-weight: 900;
}

.board-cell.dark { background: #8ac3ba; }
.board-cell.light { background: #31271a; }
.board-cell.selected { outline: 3px solid var(--coral); outline-offset: -3px; }

.go-board { grid-template-columns: repeat(9, minmax(0, 1fr)); max-width: 540px; background: #3a2913; }
.sea-board { grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 420px; }
.sudoku-board { grid-template-columns: repeat(9, minmax(0, 1fr)); max-width: 520px; }
.sudoku-board .board-cell:nth-child(3n) { border-right-color: var(--ink); }
.sudoku-board .board-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-board .board-cell:nth-child(n+46):nth-child(-n+54) { border-bottom-color: var(--ink); }

.blackjack-hand,
.hangman-word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 18px auto;
}

.card {
  display: grid;
  min-width: 58px;
  min-height: 78px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #080a0d;
  font-size: 28px;
  font-weight: 950;
}

.board-note {
  max-width: 620px;
  margin: 16px auto 0;
  text-align: center;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .arcade-topbar,
  .play-head,
  .arcade-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .play-actions {
    justify-content: stretch;
  }

  .play-actions > * {
    flex: 1;
    justify-content: center;
  }

  .game-links {
    grid-template-columns: 1fr;
  }

  .feature-game {
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .arcade-shell {
    width: min(100% - 18px, 1120px);
  }

  .play-panel {
    padding: 10px;
  }

  .grid,
  .board {
    gap: 5px;
  }

  .cell,
  .tile,
  .choice-button,
  .key-button,
  .number-button {
    min-height: 40px;
  }
}
