:root {
  --paper: #f1e6d2;
  --surface: #fffaf0;
  --ink: #202a3d;
  --muted: #6d6a67;
  --blue: #273c75;
  --gold: #f7d982;
  --coral: #d9674b;
  --green: #3c8062;
  color-scheme: light;
}

html, body { width: 100%; height: 100%; overflow: hidden; }
body { min-height: 100dvh; background: var(--paper); color: var(--ink); }
button { border: 0; cursor: pointer; font: inherit; }
.game-shell { width: min(100%, 760px); height: 100dvh; min-height: 0; max-width: 760px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left)); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; gap: 10px; }
.game-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.game-header h1 { margin: 0; text-align: center; font-size: clamp(1.1rem, 4vw, 1.65rem); letter-spacing: .06em; line-height: 1; white-space: nowrap; }
.home-link { justify-self: start; min-height: 48px; display: inline-grid; place-items: center; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-decoration: none; }
.level-pill { justify-self: end; padding: 7px 9px; border: 1px solid var(--ink); border-radius: 999px; font-size: .68rem; font-weight: 800; letter-spacing: .08em; }
.hud { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .72rem; font-weight: 800; letter-spacing: .08em; }
.target-readout, .score-readout, .target-readout span { display: flex; align-items: center; gap: 7px; }
.target-portrait { width: 38px; height: 38px; object-fit: contain; }
.score-readout { gap: 14px; text-align: right; }
.hud strong { color: var(--coral); }
#hearts-label { color: var(--coral); letter-spacing: .12em; white-space: nowrap; }
.playfield { position: relative; min-height: 0; overflow: hidden; isolation: isolate; border: 2px solid var(--ink); border-radius: 18px 18px 28px 28px; background: var(--blue); touch-action: none; user-select: none; }
.stage-backdrop { position: absolute; inset: 0; display: flex; justify-content: space-around; align-items: stretch; opacity: .42; pointer-events: none; }
.stage-backdrop span { width: 1px; background: var(--gold); }
.spotlight { position: absolute; z-index: 1; top: 4%; left: 50%; width: min(58vw, 330px); height: 82%; transform: translateX(-50%); border-radius: 50% 50% 18% 18%; background: var(--gold); opacity: .28; pointer-events: none; }
.stage-track { position: absolute; z-index: 2; inset: 7% 4%; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: center; gap: 3%; will-change: transform; }
.stage-slot { min-width: 0; height: 100%; display: grid; place-items: center; position: relative; }
.stage-slot img { position: relative; z-index: 1; width: 112%; max-width: none; height: 88%; object-fit: contain; object-position: center; pointer-events: none; user-select: none; }
.stage-slot.is-spotlight { transform: scale(1.06); }
.stage-slot.is-prop img { height: 58%; }
.feedback { min-height: 1.25em; margin: 0; text-align: center; color: var(--ink); font-weight: 800; letter-spacing: .02em; }
.feedback[data-state="correct"] { color: var(--green); }
.feedback[data-state="wrong"], .feedback[data-state="prop"] { color: var(--coral); }
.hint { margin: 0; text-align: center; color: var(--muted); font-size: .78rem; }
.spotlight-button { width: 100%; min-height: 64px; border: 2px solid var(--ink); border-radius: 14px; background: var(--coral); color: var(--surface); font-size: clamp(1.35rem, 5vw, 1.8rem); font-weight: 900; letter-spacing: .08em; box-shadow: 0 4px 0 var(--ink); }
.spotlight-button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.spotlight-button:focus-visible, .result-actions button:focus-visible, .result-actions a:focus-visible, .home-link:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.result-screen { min-height: 100dvh; width: 100%; padding: 22px; display: grid; place-items: center; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; background: var(--paper); }
.result-art-wrap { width: min(82vw, 460px); height: min(56dvh, 510px); display: grid; place-items: center; }
.result-art-wrap img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.result-copy { text-align: center; max-width: 34rem; }
.result-copy p { margin: 0 0 8px; }
#result-kicker { color: var(--coral); font-size: .75rem; font-weight: 800; letter-spacing: .1em; }
.result-copy h2 { margin: 0 0 8px; font-size: clamp(2rem, 9vw, 4rem); line-height: .95; letter-spacing: -.04em; }
.result-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: min(100%, 360px); margin: 18px auto 0; }
.result-actions button, .result-actions a { min-height: 48px; min-width: 0; padding: 10px 8px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .8rem; font-weight: 800; letter-spacing: .06em; }
.result-actions button:first-child { background: var(--coral); color: var(--surface); }
.result-screen[data-result="failed"] .result-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
[hidden] { display: none !important; }
@media (max-width: 667px) and (orientation: landscape) {
  .game-shell { padding: 8px 16px 10px; grid-template-rows: auto auto minmax(0, 1fr) auto auto; gap: 6px; }
  .hint { display: none; }
  .feedback { font-size: .8rem; }
  .spotlight-button { min-height: 56px; }
  .stage-track { inset: 4% 7% 1%; }
  .stage-slot img { height: 88%; }
  .result-screen { grid-template-columns: minmax(0, 1fr) minmax(240px, 1fr); grid-template-rows: 1fr; gap: 18px; padding: 12px 24px; }
  .result-art-wrap { width: 100%; height: 88dvh; max-height: 320px; }
  .result-copy { text-align: left; }
  .result-actions { justify-content: start; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
