/* Flip Out — scoped under .game-lights. A charcoal plastic handheld panel. */

.game-lights { --title: var(--charcoal); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .game-lights { --title: #C9CED9; }
}
:root[data-theme="dark"] .game-lights { --title: #C9CED9; }

.game-lights main { padding-block: 8px 48px; }

.game-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 6vw, 44px);
  color: var(--title);
}
.game-lede { color: var(--ink-2); margin-top: 6px; }

.status {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin: 10px 0 4px;
  font-weight: 600;
}
.status .muted { color: var(--ink-2); font-weight: 500; }
.status b { font-family: var(--font-display); font-size: 22px; font-weight: 400; color: var(--title); }

/* The moulded panel */
.panel {
  --n: 5;
  width: min(100%, 460px);
  margin: 8px auto 0;
  padding: clamp(14px, 4vw, 24px);
  border-radius: var(--radius-toy);
  background:
    linear-gradient(160deg, #3a3e47 0%, var(--charcoal) 40%, #1f2227 100%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.12),
    inset 0 -3px 0 rgba(0,0,0,.45),
    0 24px 30px -18px rgba(29,35,51,.7),
    0 2px 4px rgba(29,35,51,.3);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.grid {
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  gap: clamp(6px, 1.8vw, 10px);
  padding: clamp(8px, 2vw, 12px);
  border-radius: 18px;
  background: #15171b;
  box-shadow: inset 0 3px 8px rgba(0,0,0,.8), inset 0 -1px 0 rgba(255,255,255,.06);
}

/* Each light is a translucent plastic lens over an LED */
.cell {
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  border-radius: 22%;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 40%, #4a4f5a 0%, #33373f 60%, #262930 100%);
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,.14),
    inset 0 -4px 6px rgba(0,0,0,.55),
    0 3px 0 #0d0e11,
    0 4px 6px rgba(0,0,0,.5);
  transform: translateY(0);
  transition: background .12s ease, box-shadow .12s ease, transform .06s ease;
}
.cell:active, .cell.pressing {
  transform: translateY(3px);
  box-shadow: inset 0 2px 2px rgba(255,255,255,.1), inset 0 -2px 4px rgba(0,0,0,.5), 0 0 0 #0d0e11, 0 1px 2px rgba(0,0,0,.5);
}
.cell.on {
  background:
    radial-gradient(circle at 50% 38%, #ffd9cf 0%, #ff7f66 22%, var(--signal) 55%, #b8231a 100%);
  box-shadow:
    inset 0 2px 3px rgba(255,255,255,.55),
    inset 0 -4px 6px rgba(120,10,0,.6),
    0 3px 0 #0d0e11,
    0 4px 6px rgba(0,0,0,.5),
    0 0 14px 3px rgba(255,58,45,.55),
    0 0 30px 8px rgba(255,58,45,.25);
}
.cell.on:active, .cell.on.pressing {
  transform: translateY(3px);
  box-shadow: inset 0 2px 3px rgba(255,255,255,.5), inset 0 -2px 4px rgba(120,10,0,.6), 0 0 0 #0d0e11, 0 0 14px 3px rgba(255,58,45,.55);
}
.cell.flip { animation: flicker .28s ease-out; }
@keyframes flicker {
  0%   { filter: brightness(1.6); }
  40%  { filter: brightness(.8); }
  100% { filter: brightness(1); }
}
.cell:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Controls and hint */
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.hint { text-align: center; color: var(--ink-2); margin: 14px auto 0; min-height: 1.5em; }

/* Level picker */
.levels { margin-top: 28px; }
.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
  max-width: 620px;
  margin: 0 auto;
}
.level-chip {
  min-height: 48px;
  border-radius: 14px;
  font-weight: 700;
  padding: 0;
}
.level-chip.done { color: var(--ok); }
.level-chip.done::after { content: ' ✓'; font-size: 12px; }
.level-chip[aria-current="true"] { background: var(--charcoal); color: #fff; box-shadow: 0 3px 0 #0d0e11; }
.level-chip small { display: block; font-weight: 500; font-size: 11px; color: var(--ink-2); line-height: 1; margin-top: 2px; }
.level-chip[aria-current="true"] small { color: rgba(255,255,255,.7); }

.verdict {
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--title);
  line-height: 1.05;
}
.verdict.win { color: var(--ok); }

@media (max-width: 480px) {
  .status b { font-size: 20px; }
  .controls .btn { flex: 1 1 40%; }
}
