:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: #07131e; }
body { font-family: Arial, Helvetica, sans-serif; overflow: hidden; }
button { font: inherit; }
#game-shell { display: grid; min-height: 100vh; place-items: center; background: #07131e; }
#stage { position: relative; width: min(100vw, 960px); height: min(56.25vw, 540px); min-height: 300px; overflow: hidden; background: #07131e; }
#game-canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: manipulation; }
#hud { position: absolute; z-index: 2; top: 18px; left: 20px; right: 20px; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; }
#hud div { min-width: 72px; color: #a8c8dd; font-size: 10px; letter-spacing: 1px; text-align: center; }
#hud strong { display: block; color: #f4fbff; font-size: 18px; letter-spacing: 1.5px; }
#action-controls { position: absolute; z-index: 4; top: 16px; right: 18px; display: flex; gap: 8px; }
#action-controls button { width: 38px; height: 38px; border: 1px solid #4b7e96; border-radius: 6px; background: #0c2534; color: #d6f8ff; cursor: pointer; }
#action-controls button:hover, #action-controls button:focus-visible { border-color: #70e5ac; background: #123545; outline: none; }
.panel { position: absolute; z-index: 5; top: 50%; left: 50%; width: min(84%, 510px); transform: translate(-50%, -50%); padding: 28px 32px; border: 1px solid #3a8494; border-radius: 10px; background: #0b202d; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); text-align: center; }
.panel.compact { width: min(80%, 430px); }
.panel h1, .panel h2 { margin: 4px 0 12px; color: #f4fbff; font-size: clamp(28px, 5vw, 48px); letter-spacing: 1px; }
.panel p { color: #b9d5e2; line-height: 1.5; }
.status-label { margin: 0; color: #6fe5ae !important; font-size: 12px; font-weight: 700; letter-spacing: 2px; }
.controls-copy { font-size: 13px; }
.primary, .result-actions button { min-height: 44px; margin-top: 8px; border: 1px solid #70e5ac; border-radius: 6px; background: #70e5ac; color: #06201a; cursor: pointer; font-weight: 700; padding: 10px 18px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.result-actions button:not(.primary) { border-color: #4b7e96; background: #0d2b3d; color: #e2f7ff; }
.primary:hover, .primary:focus-visible { background: #a0f3ca; outline: none; }
.result-actions button:hover, .result-actions button:focus-visible { border-color: #a0f3ca; outline: none; }
.best-result { color: #ffd678 !important; font-weight: 700; }
#touch-controls { position: absolute; z-index: 3; right: 18px; bottom: 16px; display: grid; grid-template-columns: 48px 48px 48px; grid-template-rows: 42px 42px; gap: 5px; }
.direction-button { min-height: 42px; border: 1px solid #4b7e96; border-radius: 6px; background: #0d2b3d; color: #d6f8ff; cursor: pointer; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; }
.direction-button:hover, .direction-button:focus-visible, .direction-button:active { border-color: #70e5ac; background: #164354; color: #ffffff; outline: none; }
.north { grid-column: 2; grid-row: 1; }.west { grid-column: 1; grid-row: 2; }.east { grid-column: 3; grid-row: 2; }.south { grid-column: 2; grid-row: 2; }
#toast { position: absolute; z-index: 6; bottom: 16px; left: 18px; margin: 0; color: #f4fbff; font-size: 13px; }
@media (max-width: 640px) {
  #stage { min-height: 0; }
  #hud { top: 10px; left: 10px; right: 10px; gap: 3px; }
  #hud div { min-width: 48px; font-size: 8px; }.panel { padding: 20px; }.panel p { font-size: 13px; }
  #action-controls { top: 8px; right: 8px; }.panel h1, .panel h2 { font-size: 29px; }
  #touch-controls { right: 10px; bottom: 8px; grid-template-columns: 44px 44px 44px; grid-template-rows: 38px 38px; }.direction-button { min-height: 38px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }
