:root {
  --bg: #0a0a12;
  --panel: #14142a;
  --neon: #39ff88;
  --neon-dim: #1a7a44;
  --text: #d8d8e8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", ui-monospace, monospace;
  min-height: 100vh;
}

#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

.view { display: none; }
.view.active { display: block; }

h1, h2 {
  color: var(--neon);
  text-transform: uppercase;
  letter-spacing: 3px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 2px solid var(--neon-dim);
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover, .card:focus-visible {
  border-color: var(--neon);
  transform: translateY(-2px);
  outline: none;
}

.card .icon { font-size: 48px; }
.card .name { color: var(--neon); font-size: 20px; margin-top: 8px; }
.card .blurb { color: var(--text); opacity: 0.7; font-size: 14px; margin-top: 6px; }

.level-list { list-style: none; padding: 0; max-width: 480px; }

.level-list li button {
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 2px solid var(--neon-dim);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  padding: 14px 18px;
  margin-bottom: 10px;
  cursor: pointer;
}

.level-list li button:hover:not(:disabled) { border-color: var(--neon); }
.level-list li button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn {
  background: var(--panel);
  border: 2px solid var(--neon-dim);
  border-radius: 6px;
  color: var(--neon);
  font: inherit;
  padding: 8px 16px;
  cursor: pointer;
}

.btn:hover { border-color: var(--neon); }

.hud {
  display: flex;
  gap: 24px;
  margin-bottom: 12px;
  color: var(--neon);
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 42px);
  border: 2px solid var(--neon);
  width: max-content;
  margin-bottom: 12px;
}

.sudoku-cell {
  width: 42px;
  height: 42px;
  background: var(--panel);
  border: 1px solid #2a2a4a;
  color: var(--text);
  font: 18px/1 "Courier New", monospace;
  cursor: pointer;
  padding: 0;
}

.sudoku-cell.band-top { border-top: 2px solid var(--neon-dim); }
.sudoku-cell.band-left { border-left: 2px solid var(--neon-dim); }
.sudoku-cell.selected { outline: 2px solid var(--neon); outline-offset: -2px; }
.sudoku-cell.given { color: var(--neon); font-weight: bold; }
.sudoku-cell.conflict { color: #ff5566; background: #2a1020; }

.sudoku-pad { display: flex; gap: 6px; flex-wrap: wrap; max-width: 420px; }
.sudoku-pad .btn { font-size: 18px; min-width: 42px; }

.snake-grid {
  display: grid;
  gap: 1px;
  background: #000;
  border: 2px solid var(--neon-dim);
  width: max-content;
  touch-action: none; /* swipes steer, not scroll */
}

.game canvas {
  touch-action: none; /* finger drag moves the paddle, not the page */
  max-width: 100%;
}

.cell { background: #101024; }
.cell.wall { background: #3a3a5c; }
.cell.snake { background: var(--neon-dim); }
.cell.head { background: var(--neon); }
.cell.food { background: #ff5566; border-radius: 50%; }

.overlay[hidden] { display: none; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 18, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
}
