/* The game-only page (game.html): the screen fills the space between a slim header and footer. */
:root{color-scheme:dark;font-family:Consolas,"Segoe UI",sans-serif;background:#101419;color:#e9e5d8}
*{box-sizing:border-box}
body.game-page{margin:0;height:100vh;height:100dvh;display:grid;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden;
  background:radial-gradient(circle at 20% 0,#263035,#101419 50%);
  padding:env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left)}
button,select{font:inherit;font-size:13px;background:#252f32;color:#f6ecd6;border:1px solid #647267;padding:6px 10px;cursor:pointer}
button:hover{background:#3b4946}
button[hidden]{display:none}
a{color:#e8b955}

.game-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:6px 12px;border-bottom:1px solid #5a675c}
.game-header h1{margin:0;font-size:18px;letter-spacing:.2em;text-transform:uppercase;color:#e8b955}
.game-header-actions{display:flex;gap:8px}

/* The stage takes the touches; the screen keeps the arcade's 224 x 256 shape at the largest size that fits. In portrait it
   sits at the top, so the touch controls lie in the free space below it. */
.game-stage{position:relative;container-type:size;display:flex;justify-content:center;align-items:flex-start;
  touch-action:none;overflow:hidden;background:#090c0e}
@media (orientation:landscape){.game-stage{align-items:center}}
.game-frame{position:relative;width:min(100cqw,calc(100cqh * 224 / 256));aspect-ratio:224/256}
.game-frame>#screen,.game-frame>.screen-3d{position:absolute!important;inset:0;width:100%!important;max-width:none!important;height:100%;
  display:block;image-rendering:pixelated;background:#171b1d}
.game-frame>[hidden]{display:none!important}
.start-game-prompt{position:absolute;inset:0;z-index:6;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;
  padding:20px;text-align:center;background:#090c0e9e;color:#f6ecd6}
.start-game-prompt[hidden]{display:none!important}
.start-game-prompt button{font-size:clamp(16px,2.5vw,28px);font-weight:700;background:#e8b955;color:#111;border-color:#f6d889}
.start-game-prompt p{max-width:260px;margin:0;font-size:13px;line-height:1.45}
.screen-3d canvas{position:absolute;inset:0;width:100%;height:100%}

.game-footer{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;padding:6px 12px calc(6px + env(safe-area-inset-bottom));
  border-top:1px solid #5a675c;font-size:12px;color:#b7c6bd}
.game-footer label{display:flex;align-items:center;gap:6px}
.game-help{margin:0;flex-basis:100%}
.game-sound{display:flex;align-items:center;gap:6px}
.game-sound .audio-controls{flex-wrap:nowrap}
.game-sound .audio-controls p{flex-basis:auto;margin:0}
#game-audio [role="status"]{display:none}
#game-audio [role="status"][data-error="true"]{display:block}
.audio-controls{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}
.audio-controls h2,.audio-controls p{flex-basis:100%;margin:.2rem 0;font-size:13px}
.audio-controls label{display:inline-flex;align-items:center;gap:.4rem;flex-wrap:wrap}

#loading{position:fixed;bottom:15px;right:15px;z-index:20;padding:10px 14px;background:#f0b749;color:#111;font-weight:700}
#loading[hidden]{display:none}

/* Touch controls (src/input/touch-controls.ts): invisible until touched, they fade in quickly and out slowly. */
.touch-controls{position:absolute;inset:0;z-index:7;pointer-events:none;opacity:0;transition:opacity var(--touch-fade-out,.5s) ease;
  user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;touch-action:none}
.touch-controls.visible{opacity:1;transition-duration:var(--touch-fade-in,.15s)}
.touch-stick-zone{position:absolute;left:12px;bottom:12px;width:180px;height:180px;pointer-events:auto;touch-action:none}
.touch-stick-ring{position:absolute;left:50%;top:50%;width:120px;height:120px;margin:-60px 0 0 -60px;border-radius:50%;
  border:3px solid rgba(233,229,216,.55);background:rgba(16,20,25,.3)}
.touch-stick-knob{position:absolute;left:50%;top:50%;width:50px;height:50px;margin:-25px 0 0 -25px;border-radius:50%;
  background:rgba(233,229,216,.45);border:2px solid rgba(233,229,216,.7)}
.touch-stick-zone.active .touch-stick-ring{border-color:rgba(232,185,85,.85)}
.touch-stick-zone.active .touch-stick-knob{background:rgba(232,185,85,.7)}
.touch-button{position:absolute;pointer-events:auto;touch-action:none;border-radius:50%;padding:0;font-size:12px;font-weight:700;
  letter-spacing:.08em;color:#f6ecd6;background:rgba(37,47,50,.55);border:3px solid rgba(233,229,216,.6)}
.touch-button:hover{background:rgba(37,47,50,.55)}
.touch-button.pressed{background:rgba(232,185,85,.7);color:#111}
.touch-fire{right:20px;bottom:30px;width:88px;height:88px}
.touch-grenade{right:118px;bottom:100px;width:62px;height:62px;font-size:10px}
.touch-system{position:absolute;left:50%;top:12px;transform:translateX(-50%);display:flex;gap:12px}
.touch-system[hidden]{display:none}
.touch-system .touch-button{position:static;width:auto;height:auto;padding:10px 16px;border-radius:22px}
@media (max-height:420px){.touch-stick-zone{width:150px;height:150px}.touch-fire{width:72px;height:72px}.touch-grenade{right:100px;bottom:86px;width:54px;height:54px}}
