* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #07101e; }
body { color: #edf7ff; font-family: Arial, sans-serif; overflow: hidden; }
button { border: 1px solid #5bd4ff; border-radius: 6px; background: #10233b; color: #f5fbff; cursor: pointer; font: inherit; font-weight: 800; min-height: 42px; touch-action: manipulation; }
button:hover, button:focus-visible { border-color: #ffe27a; background: #173454; outline: 2px solid transparent; }
button:focus-visible { outline-color: #ffe27a; }
/* Keep this 16:9 Canvas proportional on narrow phones. A 300px floor made a
   390px-wide portrait viewport taller than the game and distorted touch play. */
#game-shell, #stage { width: min(100vw, 960px); height: min(56.25vw, 540px); margin: 0 auto; position: relative; }
#game-canvas { display: block; width: 100%; height: 100%; background: #07101e; touch-action: manipulation; }
#hud { position: absolute; z-index: 3; top: 16px; left: 18px; display: flex; gap: 16px; pointer-events: none; }
#hud div { min-width: 74px; }
#hud span { display: block; color: #8fb2cc; font: 800 10px ui-monospace, monospace; }
#hud strong { display: block; margin-top: 2px; font: 800 20px ui-monospace, monospace; }
#light-value { color: #ffe27a; }
#actions { position: absolute; z-index: 4; top: 14px; right: 16px; display: flex; gap: 7px; }
#actions button, .result-actions button:first-child { min-width: 42px; padding: 0 9px; }
.panel { position: absolute; z-index: 8; top: 50%; left: 50%; width: min(440px, calc(100% - 32px)); padding: 24px; transform: translate(-50%, -50%); border: 1px solid #5bd4ff; border-radius: 8px; background: rgba(7, 16, 30, .96); text-align: center; }
.compact { width: min(340px, calc(100% - 32px)); }
.panel h1, .panel h2 { margin: 8px 0; font-size: 30px; line-height: 1.1; }
.panel p { margin: 0; line-height: 1.5; }
.kicker { color: #5bd4ff; font: 800 11px ui-monospace, monospace; }
.muted { margin-top: 9px !important; color: #b7cde1; font-size: 14px; }
.primary { min-width: 156px; margin-top: 20px; padding: 0 16px; border-color: #ffe27a; background: #3c3420; }
.result-actions { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.result-actions .primary { margin-top: 0; }
#touch-controls { position: absolute; z-index: 5; right: 16px; bottom: 14px; display: grid; justify-items: center; gap: 5px; }
#touch-controls > div { display: grid; grid-template-columns: repeat(3, 48px); gap: 5px; }
#touch-controls button { width: 48px; padding: 0 3px; font: 800 8px ui-monospace, monospace; }
#toast { position: absolute; z-index: 9; left: 50%; bottom: 18px; transform: translateX(-50%); margin: 0; padding: 8px 12px; border: 1px solid #ffe27a; border-radius: 5px; background: #253d59; font-size: 12px; white-space: nowrap; }
[hidden] { display: none !important; }
@media (max-width: 640px) { #hud { top: 9px; left: 10px; gap: 8px; } #hud div { min-width: 50px; } #hud span { font-size: 7px; } #hud strong { font-size: 14px; } #actions { top: 7px; right: 8px; gap: 4px; } #actions button { min-width: 34px; min-height: 34px; } #touch-controls { right: 7px; bottom: 7px; gap: 3px; } #touch-controls > div { grid-template-columns: repeat(3, 34px); gap: 3px; } #touch-controls button { width: 34px; min-height: 32px; font-size: 6px; } .panel { padding: 16px; } .panel h1, .panel h2 { font-size: 23px; } .panel p { font-size: 12px; } #toast { bottom: 6px; max-width: calc(100% - 12px); font-size: 10px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
