:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f8f4e7;
  background: #142724;
  --ink: #172924;
  --cream: #f8f4e7;
  --yellow: #f8d36b;
  --muted: #d4ddd1;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button { font: inherit; font-weight: 700; cursor: pointer; }
button:focus-visible, input:focus-visible, canvas:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
#game { position: relative; isolation: isolate; height: 100dvh; min-height: 280px; overflow: hidden; }
#scene { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#scene:focus-visible { outline-offset: -4px; }
.top { position: absolute; z-index: 3; inset: 0 0 auto; pointer-events: none; display: flex; justify-content: space-between; align-items: center; padding: 15px clamp(14px, 3vw, 40px); background: linear-gradient(#101e20bc, transparent); }
.top button { pointer-events: auto; }
button { border: 1px solid #a1b4a47a; padding: .55rem .85rem; color: var(--cream); background: #192c27; border-radius: .55rem; min-height: 44px; }
button:hover { border-color: var(--yellow); }
.utility { background: #172924ed; }
.panel { position: absolute; z-index: 2; top: 50%; left: clamp(14px, 6vw, 114px); transform: translateY(-50%); width: min(420px, calc(100% - 28px)); max-height: calc(100% - 110px); overflow-y: auto; padding: clamp(20px, 4vw, 37px); border: 1px solid #6d8b77; border-radius: 1.3rem; background: #142a25f5; box-shadow: 0 18px 70px #0d1b224f; }
.eyebrow, .stage span, .stats span, .result span, .location-label { color: var(--yellow); font-size: .7rem; text-transform: uppercase; font-weight: 800; letter-spacing: .15em; }
.eyebrow { margin: 0 0 .8rem; }
h1 { font-family: Georgia, serif; margin: 0; font-size: clamp(2rem, 5.8vw, 3.7rem); font-weight: 500; letter-spacing: -.055em; line-height: .99; }
h1 em { color: var(--yellow); display: block; }
h1:focus { outline: none; }
#panel-copy { line-height: 1.45; color: var(--muted); margin: .9rem 0; }
.menu-stage { color: var(--cream); margin: 1.3rem 0 .6rem; font-weight: 750; font-size: .85rem; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .8rem; }
.actions button:only-child, .primary { grid-column: 1 / -1; }
.primary { background: var(--yellow); border-color: var(--yellow); color: var(--ink); font-size: 1rem; }
.primary:hover { background: #ffe49a; }
.levels { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.levels button { text-align: left; font-size: .84rem; }
.levels small { color: var(--muted); display: block; margin-top: .25rem; font-weight: 500; }
.levels button:disabled { opacity: .58; cursor: default; }
.levels button[aria-pressed="true"] { border-color: var(--yellow); }
dl { margin: .8rem 0; }
dl div { display: grid; grid-template-columns: 6rem 1fr; gap: .3rem; padding-block: .36rem; border-bottom: 1px solid #a1b4a44d; font-size: .87rem; }
dt { font-weight: 750; }
dd { margin: 0; color: var(--muted); }
.setting { display: flex; gap: .5rem; align-items: start; font-size: .84rem; }
.setting input { accent-color: var(--yellow); }
.result { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 1.1rem; border-top: 1px solid #a1b4a47a; padding-top: .7rem; }
.result strong { display: block; }
#location { position: absolute; right: clamp(14px, 3vw, 40px); bottom: 22px; display: flex; align-items: center; gap: .5rem; pointer-events: none; padding: .55rem .8rem; border: 1px solid #a1b4a47a; border-radius: 2rem; background: #172924ed; font-size: .8rem; font-weight: 750; }
.location-dot { width: .52rem; height: .52rem; border-radius: 50%; background: var(--yellow); }
#game.in-round #location { display: none; }
#hud { position: absolute; pointer-events: none; top: 70px; left: 50%; transform: translateX(-50%); width: min(480px, calc(100% - 28px)); display: grid; grid-template-columns: 1fr auto; padding: .65rem .9rem; gap: .5rem 1rem; background: #172924f2; border: 1px solid #a1b4a47a; border-radius: .85rem; }
.stage span, .stage strong, .stats span, .stats strong { display: block; }
.stage strong { line-height: 1.2; margin-top: .2rem; }
.stats { display: flex; gap: clamp(.6rem, 2.2vw, 1.5rem); text-align: center; font-variant-numeric: tabular-nums; }
.stats strong { white-space: nowrap; }
.progress { grid-column: 1 / -1; background: #577068; height: .25rem; border-radius: 1rem; overflow: hidden; }
#progress { width: 0%; height: 100%; background: var(--yellow); }
#time.urgent { color: #ffad99; }
#camera-controls { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: .4rem; white-space: nowrap; }
#camera-controls button { padding-inline: .65rem; min-width: 44px; }
#reticle, #feedback, #direction { position: absolute; pointer-events: none; }
#reticle { left: 50%; top: 50%; width: 19px; height: 19px; transform: translate(-50%, -50%); border: 1px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #22332c; }
#reticle::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: white; }
#direction { color: var(--yellow); font-size: 1.2rem; text-shadow: 0 1px 4px #142724; }
#feedback { z-index: 1; padding: .2rem .55rem; border-radius: .35rem; background: #172924; font-weight: 850; opacity: 0; white-space: nowrap; }
#feedback.hit { color: var(--yellow); }
#feedback.miss { color: var(--cream); }
#feedback.active { animation: feedback .6s ease-out both; }
@keyframes feedback { 0% { opacity: 1; transform: translate(-50%, -45%); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -140%); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 650px) {
  .panel { left: 14px; top: auto; bottom: 62px; transform: none; max-height: calc(100% - 128px); }
}
@media (max-height: 500px) {
  .top { padding-block: 7px; }
  #hud { top: 56px; }
  .panel { padding-block: 15px; }
}
@media (orientation: landscape) and (max-height: 400px) {
  .panel[data-screen="menu"] {
    top: 62px;
    bottom: auto;
    transform: none;
    max-height: calc(100% - 76px);
    padding: 14px 18px;
  }
  [data-screen="menu"] .eyebrow { margin-bottom: .4rem; }
  [data-screen="menu"] h1 em { display: inline; }
  [data-screen="menu"] #panel-copy { margin: .45rem 0; }
  [data-screen="menu"] .menu-stage { margin: .6rem 0 .45rem; }
  [data-screen="menu"] .actions { grid-template-columns: repeat(3, 1fr); margin-top: .45rem; }
  [data-screen="menu"] .actions .primary { grid-column: auto; }
  [data-screen="menu"] .actions button { padding-inline: .45rem; }
}
@media (prefers-reduced-motion: reduce) {
  #feedback.active { animation-name: reduced-feedback; transform: translate(-50%, -50%); }
  @keyframes reduced-feedback { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
}
