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

:root {
  --bg: #080d1a;
  --bg-2: #0d1528;
  --surface: rgba(15, 23, 41, 0.92);
  --surface-2: rgba(22, 32, 53, 0.95);
  --surface-3: rgba(11, 18, 34, 0.98);
  --border: rgba(56, 189, 248, 0.16);
  --border-strong: rgba(56, 189, 248, 0.4);
  --cyan: #38bdf8;
  --cyan-dim: rgba(56, 189, 248, 0.12);
  --cyan-glow: rgba(56, 189, 248, 0.25);
  --text: #e2e8f0;
  --muted: #6c89a5;
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #f87171;
  --shadow: 0 22px 70px rgba(2, 8, 23, 0.55);
}

body {
  min-height: 100vh;
  font-family: "DM Mono", monospace;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 15%, rgba(56, 189, 248, 0.12), transparent 30%),
    radial-gradient(circle at 82% 10%, rgba(96, 165, 250, 0.08), transparent 28%),
    linear-gradient(180deg, #050915 0%, var(--bg) 50%, #050816 100%);
  padding: 2.3rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

.bg-glow {
  position: fixed;
  width: 32rem;
  height: 32rem;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-a {
  top: -10rem;
  right: -8rem;
  background: #0ea5e9;
}

.bg-glow-b {
  bottom: -14rem;
  left: -10rem;
  background: #1d4ed8;
}

.hero {
  width: min(100%, 42rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.icon {
  width: 60px;
  height: 60px;
  margin-bottom: 0.6rem;
  animation: pulse 3.2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 10px var(--cyan-glow));
  }
  50% {
    filter: drop-shadow(0 0 3px var(--cyan-glow));
    opacity: 0.72;
  }
}

.eyebrow,
.section-label,
.game-kicker {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--cyan);
}

h1,
h2,
h3 {
  font-family: var(--font-formal-serif, "Libre Baskerville", Baskerville, "Baskerville Old Face", Garamond, Georgia, "Times New Roman", Times, serif);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(1.65rem, 4vw, 2.4rem);
}

.subtitle,
.section-copy,
.stage-hint,
.mini-note {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.subtitle span {
  color: var(--cyan);
}

.arcade-shell {
  width: min(100%, 1100px);
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 1.25rem;
}

.picker-wrap,
.stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.picker-wrap {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 34rem;
}

.section-heading {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.game-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.game-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(15, 23, 41, 0.9), rgba(15, 23, 41, 0.72));
  border-radius: 14px;
  color: var(--text);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  padding: 0.75rem;
  min-height: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.game-card:hover,
.game-card:focus-visible {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  outline: none;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.1), 0 10px 28px rgba(2, 8, 23, 0.34);
}

.game-card.active {
  border-color: var(--cyan);
  background: linear-gradient(180deg, rgba(22, 32, 53, 0.98), rgba(17, 24, 39, 0.88));
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.08), 0 0 18px rgba(56, 189, 248, 0.12);
}

.game-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.game-card-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.game-card-title {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.game-card-subtitle {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.stage {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.stage-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.stage-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

#active-game-title {
  font-size: clamp(1.2rem, 2.2vw, 1.65rem);
}

.stage-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(56, 189, 248, 0.06);
  color: var(--cyan);
  font-family: inherit;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn:hover,
.btn:focus-visible,
.control-btn:hover,
.control-btn:focus-visible,
.alpha-btn:hover,
.alpha-btn:focus-visible,
.numpad-btn:hover,
.numpad-btn:focus-visible {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.46);
  outline: none;
}

.btn.btn-secondary {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.hidden {
  display: none !important;
}

.game-message {
  min-height: 1.2rem;
  font-size: 0.78rem;
  color: var(--cyan);
}

.game-message.warning {
  color: var(--yellow);
}

.game-message.error {
  color: var(--red);
}

.game-message.success {
  color: var(--green);
}

.game-surface {
  display: flex;
  min-height: 30rem;
  min-width: 0;
}

.game-root {
  display: none;
  width: 100%;
}

.game-root.active {
  display: block;
}

.game-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.canvas-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.canvas-frame {
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(10, 16, 31, 0.88), rgba(8, 13, 26, 0.98));
  border-radius: 16px;
  padding: 0.75rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 10px;
  background: rgba(5, 10, 20, 0.95);
}

.statbar,
.scorebar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.5rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.statbar b,
.scorebar b {
  color: var(--cyan);
}

.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.2), transparent);
}

.control-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.control-btn,
.alpha-btn,
.numpad-btn {
  border: 1px solid rgba(56, 189, 248, 0.16);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  min-width: 2.5rem;
}

.control-btn {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mobile-controls {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mobile-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.board-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.grid-board {
  display: grid;
  gap: 0.3rem;
  width: fit-content;
  max-width: 100%;
}

.cell,
.tile,
.letter-cell,
.sudoku-cell,
.picross-cell,
.fifteen-tile {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.card-cell {
  aspect-ratio: 1;
  min-width: 3.8rem;
  perspective: 600px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.35s ease;
}

.card-face,
.card-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-back {
  background: var(--surface-2);
  border: 1px solid rgba(56, 189, 248, 0.14);
  color: var(--muted);
}

.card-face {
  transform: rotateY(180deg);
  background: var(--surface);
  border: 1px solid rgba(56, 189, 248, 0.22);
  font-size: 1.45rem;
}

.card-cell.flipped .card-inner,
.card-cell.matched .card-inner {
  transform: rotateY(180deg);
}

.card-cell.matched .card-face {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.1), 0 0 18px rgba(56, 189, 248, 0.12);
}

.wordle-grid,
.letter-grid {
  display: grid;
  gap: 0.35rem;
  width: fit-content;
  max-width: 100%;
}

.wordle-grid {
  grid-template-columns: repeat(5, minmax(0, 3rem));
}

.wordle-cell {
  width: 3rem;
  height: 3rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  text-transform: uppercase;
}

.wordle-cell.correct {
  background: rgba(22, 101, 52, 0.35);
  border-color: rgba(74, 222, 128, 0.45);
  color: var(--green);
}

.wordle-cell.present {
  background: rgba(120, 53, 15, 0.35);
  border-color: rgba(251, 191, 36, 0.45);
  color: var(--yellow);
}

.wordle-cell.absent {
  color: #64748b;
}

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.keyboard-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.alpha-btn {
  min-width: 2.1rem;
  padding: 0.45rem 0.5rem;
  font-size: 0.72rem;
}

.alpha-btn.wide {
  min-width: 3.8rem;
}

.alpha-btn.correct {
  background: rgba(22, 101, 52, 0.35);
  border-color: rgba(74, 222, 128, 0.45);
}

.alpha-btn.present {
  background: rgba(120, 53, 15, 0.35);
  border-color: rgba(251, 191, 36, 0.45);
}

.alpha-btn.absent {
  color: #64748b;
}

.mine-grid {
  display: grid;
  gap: 0.2rem;
  width: fit-content;
}

.mine-cell {
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.82rem;
}

.mine-cell:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

.mine-cell.revealed {
  background: rgba(5, 10, 20, 0.8);
  cursor: default;
}

.mine-cell.hit {
  background: rgba(127, 29, 29, 0.5);
}

.n1 { color: #38bdf8; }
.n2 { color: #4ade80; }
.n3 { color: #f87171; }
.n4 { color: #818cf8; }
.n5 { color: #fb923c; }
.n6 { color: #2dd4bf; }
.n7 { color: #cbd5e1; }
.n8 { color: #94a3b8; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.game-grid {
  display: grid;
  gap: 0.45rem;
}

.tile-2048 {
  width: 4.5rem;
  height: 4.5rem;
  font-size: 1.1rem;
  font-weight: 500;
}

.tile-0 {
  color: transparent;
}

.tile-2 { background: #172554; }
.tile-4 { background: #1d4ed8; }
.tile-8 { background: #0ea5e9; }
.tile-16 { background: #0284c7; }
.tile-32 { background: #0891b2; }
.tile-64 { background: #0f766e; }
.tile-128 { background: #15803d; }
.tile-256 { background: #65a30d; }
.tile-512 { background: #ca8a04; }
.tile-1024 { background: #c2410c; }
.tile-2048 { background: #be123c; }

.hangman-word {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.hangman-slot {
  width: 2.1rem;
  height: 2.8rem;
  border-bottom: 2px solid rgba(56, 189, 248, 0.26);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.alpha-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.alpha-grid .alpha-btn {
  width: 100%;
  min-width: 0;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1rem;
}

.clue-panel {
  border: 1px solid rgba(56, 189, 248, 0.1);
  background: rgba(11, 18, 34, 0.8);
  border-radius: 14px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.clue-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.clue-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.73rem;
  color: var(--muted);
}

.clue-list b {
  color: var(--text);
}

.crossword-grid {
  display: grid;
  grid-template-columns: repeat(5, 3.2rem);
  gap: 0.18rem;
  width: fit-content;
}

.cross-cell {
  position: relative;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.cross-cell.block {
  background: rgba(5, 10, 20, 0.96);
}

.cross-cell input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-transform: uppercase;
  text-align: center;
  font-size: 1rem;
}

.cross-cell.active {
  border-color: rgba(56, 189, 248, 0.48);
}

.cross-cell.revealed input {
  color: var(--green);
}

.cross-num {
  position: absolute;
  top: 0.15rem;
  left: 0.2rem;
  font-size: 0.5rem;
  color: var(--muted);
  pointer-events: none;
}

.sudoku-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: flex-start;
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 2.5rem);
  gap: 0;
  border: 2px solid rgba(56, 189, 248, 0.18);
  border-radius: 14px;
  overflow: hidden;
}

.sudoku-cell {
  width: 2.5rem;
  height: 2.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0;
  cursor: pointer;
  font-size: 0.95rem;
}

.sudoku-cell:nth-child(3n) {
  border-right-color: rgba(56, 189, 248, 0.18);
}

.sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom-color: rgba(56, 189, 248, 0.18);
}

.sudoku-cell.given {
  background: rgba(5, 10, 20, 0.9);
  color: var(--cyan);
}

.sudoku-cell.selected {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.28);
}

.sudoku-cell.conflict {
  background: rgba(127, 29, 29, 0.32);
  color: #fecaca;
}

.numpad {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  width: min(100%, 22rem);
}

.numpad-btn {
  padding: 0.55rem;
}

.picross-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.picross-col-clues,
.picross-row-clues {
  display: grid;
  gap: 0.2rem;
  font-size: 0.68rem;
  color: var(--muted);
}

.picross-col-clues {
  grid-template-columns: repeat(10, 2rem);
  margin-left: 5rem;
}

.picross-col-clue,
.picross-row-clue {
  min-height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.picross-row-wrap {
  display: grid;
  grid-template-columns: 5rem auto;
  gap: 0.3rem;
  align-items: center;
}

.picross-grid {
  display: grid;
  grid-template-columns: repeat(10, 2rem);
  gap: 0.15rem;
}

.picross-cell {
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  cursor: pointer;
}

.picross-cell.marked {
  color: var(--red);
}

.picross-cell.filled {
  background: rgba(14, 116, 144, 0.85);
}

.fifteen-grid {
  display: grid;
  grid-template-columns: repeat(4, 4.1rem);
  gap: 0.35rem;
}

.fifteen-tile {
  width: 4.1rem;
  height: 4.1rem;
  font-size: 1.2rem;
  cursor: pointer;
}

.fifteen-tile.empty {
  background: rgba(5, 10, 20, 0.92);
  border-color: rgba(255, 255, 255, 0.03);
  cursor: default;
}

.crossword-wrap,
.status-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-box {
  padding: 0.8rem;
  border: 1px solid rgba(56, 189, 248, 0.08);
  background: rgba(11, 18, 34, 0.78);
  border-radius: 14px;
}

@media (max-width: 980px) {
  .arcade-shell {
    grid-template-columns: 1fr;
  }

  .picker-wrap {
    min-height: 0;
  }

  .game-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stage {
    min-height: 36rem;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    padding-top: 1.6rem;
  }

  .game-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .stage-actions {
    justify-content: flex-start;
  }

  .wordle-cell {
    width: 2.6rem;
    height: 2.6rem;
  }

  .crossword-grid {
    grid-template-columns: repeat(5, 2.8rem);
  }

  .cross-cell {
    width: 2.8rem;
    height: 2.8rem;
  }

  .sudoku-grid {
    grid-template-columns: repeat(9, 2.15rem);
  }

  .sudoku-cell {
    width: 2.15rem;
    height: 2.15rem;
  }

  .picross-col-clues {
    grid-template-columns: repeat(10, 1.7rem);
    margin-left: 4.2rem;
  }

  .picross-grid {
    grid-template-columns: repeat(10, 1.7rem);
  }

  .picross-cell {
    width: 1.7rem;
    height: 1.7rem;
  }

  .picross-row-wrap {
    grid-template-columns: 4.2rem auto;
  }

  .fifteen-grid {
    grid-template-columns: repeat(4, 3.45rem);
  }

  .fifteen-tile {
    width: 3.45rem;
    height: 3.45rem;
  }
}

/* Original arcade styling rollback */
:root {
  --font-formal-serif: "Libre Baskerville", Baskerville, "Baskerville Old Face", Garamond, Georgia, "Times New Roman", Times, serif;
  --bg: #080d1a;
  --surface: #0f1729;
  --surface2: #162035;
  --surface-2: #162035;
  --border: rgba(56, 189, 248, 0.14);
  --cyan: #38bdf8;
  --cyan-dim: rgba(56, 189, 248, 0.12);
  --cyan-glow: rgba(56, 189, 248, 0.3);
  --text: #e2e8f0;
  --muted: #4e6a85;
  --shadow: none;
}

body {
  background: var(--bg);
  padding: 2.5rem 1rem 3rem;
  gap: 2.4rem;
}

body::before {
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.025) 1px, transparent 1px);
}

.hero {
  width: 100%;
  max-width: 760px;
  text-align: center;
  gap: 0;
}

.icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  display: block;
  animation: pulse 3s ease-in-out infinite;
}

h1 {
  font-family: var(--font-formal-serif, "Libre Baskerville", Baskerville, "Baskerville Old Face", Garamond, Georgia, "Times New Roman", Times, serif);
  font-weight: 700;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.3rem;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.arcade {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1rem;
  min-height: calc(100vh - 11.5rem);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.3rem;
  cursor: pointer;
  text-align: center;
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.tab .tab-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.tab:hover,
.tab:focus-visible {
  border-color: var(--cyan);
  color: var(--text);
  background: var(--surface2);
  outline: none;
}

.tab.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-dim);
  box-shadow: 0 0 14px var(--cyan-glow);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  min-height: 0;
}

.shell-panel {
  flex: 1;
  min-height: clamp(30rem, calc(100vh - 14rem), 48rem);
}

.shell-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.shell-copy {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

#active-game-title {
  font-family: var(--font-formal-serif, "Libre Baskerville", Baskerville, "Baskerville Old Face", Garamond, Georgia, "Times New Roman", Times, serif);
  font-weight: 700;
  font-size: clamp(1.1rem, 2.8vw, 1.45rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.shell-hint {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.4;
}

.shell-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  padding: 0.45rem 1.4rem;
  background: transparent;
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--cyan);
  font-family: "DM Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn:hover,
.btn:focus-visible {
  background: var(--cyan-dim);
  box-shadow: 0 0 10px var(--cyan-glow);
  border-color: rgba(56, 189, 248, 0.35);
}

.btn.btn-secondary {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.08);
  background: transparent;
}

.game-message {
  min-height: 1.2em;
  width: 100%;
  font-size: 0.75rem;
  color: var(--cyan);
  text-align: center;
}

.game-surface {
  display: flex;
  flex: 1;
  width: 100%;
  min-height: 0;
  min-width: 0;
}

.game-root {
  display: none;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.game-root.active {
  display: flex;
}

.game-panel {
  display: flex;
  flex: 1;
  min-height: 100%;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.game-title {
  font-family: var(--font-formal-serif, "Libre Baskerville", Baskerville, "Baskerville Old Face", Garamond, Georgia, "Times New Roman", Times, serif);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}

.canvas-frame {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

canvas {
  background: #080d1a;
}

.statbar,
.scorebar {
  font-size: 0.72rem;
  color: var(--muted);
}

.statbar b,
.scorebar b {
  color: var(--cyan);
}

.control-btn,
.alpha-btn,
.numpad-btn {
  border-radius: 6px;
  background: var(--surface2);
  border-color: rgba(255, 255, 255, 0.06);
}

#game-memory .game-panel {
  gap: 0.8rem;
}

#game-wordle .game-panel,
#game-mine .game-panel,
#game-15 .game-panel {
  align-items: center;
}

#game-sudoku {
  justify-content: center;
}

#game-sudoku .sudoku-wrap {
  align-items: center;
}

.mem-scorebar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.8rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.mem-scorebar b {
  color: var(--cyan);
}

.mem-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  flex: 1;
  align-content: stretch;
}

.mem-card {
  aspect-ratio: 1;
  width: 100%;
  min-width: 0;
  cursor: pointer;
  perspective: 600px;
  border-radius: 10px;
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  color: inherit;
}

.mem-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(.4, 0, .2, 1);
  border-radius: 10px;
}

.mem-card.flipped .mem-card-inner,
.mem-card.matched .mem-card-inner {
  transform: rotateY(180deg);
}

.mem-front,
.mem-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mem-back {
  background: var(--surface2);
  border: 1px solid rgba(56, 189, 248, 0.12);
  font-size: 1.1rem;
  color: var(--muted);
  transition: border-color 0.2s;
}

.mem-card:hover:not(.matched) .mem-back {
  border-color: rgba(56, 189, 248, 0.4);
}

.mem-front {
  background: var(--surface);
  border: 1px solid rgba(56, 189, 248, 0.25);
  transform: rotateY(180deg);
  font-size: 1.5rem;
}

.mem-card.matched .mem-front {
  border-color: var(--cyan);
  box-shadow: 0 0 14px var(--cyan-glow), inset 0 0 10px var(--cyan-dim);
}

#game-snake .game-panel {
  gap: 0.8rem;
  align-items: center;
}

#snake-canvas {
  border: 1px solid var(--border);
  border-radius: 8px;
  image-rendering: pixelated;
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
}

.snake-score {
  font-size: 0.72rem;
  color: var(--muted);
}

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

.snake-hint {
  font-size: 0.65rem;
  color: var(--muted);
}

@media (max-width: 760px) {
  body {
    padding: 1.8rem 0.8rem 2.4rem;
  }

  .arcade {
    min-height: calc(100vh - 9.5rem);
  }

  .tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .shell-panel {
    min-height: calc(100vh - 11rem);
    padding: 1rem;
  }

  .shell-head {
    flex-direction: column;
    align-items: stretch;
  }

  .shell-actions {
    justify-content: flex-start;
  }

  .mem-scorebar {
    gap: 0.7rem 1rem;
  }
}
