:root { color-scheme: dark; font-family: Arial, Helvetica, sans-serif; background: #10142d; }
* { box-sizing: border-box; }
html, body, #game-shell { min-height: 100%; margin: 0; }
body { background: #10142d; color: #f8fbff; overflow: hidden; }
button { font: inherit; }
#game-shell { display: grid; min-height: 100vh; place-items: center; }
#stage { background: #10142d; height: 56.25vw; max-height: 100vh; max-width: 177.7778vh; overflow: hidden; position: relative; touch-action: none; width: 100vw; }
#game-canvas { display: block; height: 100%; outline: none; width: 100%; }
#hud { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); inset: 14px 16px auto; pointer-events: none; position: absolute; }
#hud div { background: rgba(12, 18, 48, .8); border: 1px solid rgba(130, 227, 247, .34); border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); min-width: 0; padding: 7px 9px; }
#hud span, .status-label { color: #8fcfe1; display: block; font-size: 10px; font-weight: 800; letter-spacing: 1.3px; }
#hud strong { color: #f7fbff; display: block; font-size: 18px; line-height: 1.1; margin-top: 2px; }
#action-controls { display: flex; gap: 8px; position: absolute; right: 16px; top: 79px; }
#action-controls button, .result-actions button { background: rgba(16, 22, 56, .9); border: 1px solid rgba(205, 246, 255, .54); border-radius: 8px; color: #f7fbff; cursor: pointer; font-weight: 800; min-height: 44px; min-width: 44px; }
#action-controls button:focus-visible, .valve-button:focus-visible, .panel button:focus-visible { outline: 3px solid #ffcc63; outline-offset: 2px; }
.panel { background: rgba(13, 19, 50, .94); border: 1px solid rgba(144, 226, 244, .52); border-radius: 10px; box-shadow: 0 20px 56px rgba(0, 0, 0, .44); left: 50%; padding: 26px; position: absolute; text-align: center; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100% - 32px)); }
.panel.compact { width: min(360px, calc(100% - 32px)); }
.panel h1, .panel h2 { color: #f8fbff; font-size: 30px; letter-spacing: .3px; margin: 8px 0 10px; }
.panel h2 { font-size: 25px; }
.panel p { color: #c9ddf0; font-size: 15px; line-height: 1.45; margin: 10px 0; }
.panel .controls-copy { color: #9dc5dc; font-size: 13px; }
.primary { background: #83ebbd; border: 0; border-radius: 8px; color: #071d19; cursor: pointer; font-weight: 900; min-height: 48px; padding: 0 18px; }
.result-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.result-actions button { padding: 0 14px; }
.result-actions button.primary { background: #83ebbd; border-color: transparent; color: #071d19; }
.result-actions button[hidden] { display: none; }
.best-result { color: #ffcc63 !important; font-weight: 800; }
#valve-controls { bottom: 14px; display: grid; gap: 8px; grid-template-columns: repeat(4, 1fr); left: 50%; position: absolute; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); }
.valve-button { background: rgba(13, 23, 56, .92); border: 1px solid rgba(146, 213, 238, .46); border-radius: 8px; color: #d6f0ff; cursor: pointer; font-weight: 900; letter-spacing: 1px; min-height: 54px; touch-action: manipulation; }
.valve-button[data-selected="true"] { background: #4a3f78; border-color: #d7a7ff; box-shadow: 0 0 0 2px rgba(215, 167, 255, .18); color: #fff0ff; }
.valve-button[data-hot="true"] { border-color: #ff8a78; box-shadow: 0 0 0 2px rgba(255, 122, 104, .14); }
#toast { background: rgba(4, 8, 27, .84); border-radius: 999px; bottom: 80px; color: #f7fbff; font-size: 12px; font-weight: 800; left: 50%; letter-spacing: .5px; margin: 0; padding: 7px 13px; pointer-events: none; position: absolute; transform: translateX(-50%); }
body[data-game-state="ready"] #hud, body[data-game-state="ready"] #action-controls { opacity: .42; }
body[data-game-state="ready"] #valve-controls, body[data-game-state="paused"] #valve-controls, body[data-game-state="crashed"] #valve-controls, body[data-game-state="complete"] #valve-controls { visibility: hidden; }
@media (orientation: landscape) { #stage { height: 100vh; width: 177.7778vh; } }
@media (max-width: 600px) {
  #hud { gap: 4px; inset: 8px 8px auto; }
  #hud div { border-radius: 6px; padding: 4px 5px; }
  #hud span { font-size: 7px; letter-spacing: .6px; }
  #hud strong { font-size: 13px; }
  #action-controls { gap: 5px; right: 8px; top: 58px; }
  #action-controls button { min-height: 44px; min-width: 44px; }
  #valve-controls { bottom: 7px; gap: 4px; width: calc(100% - 16px); }
  .valve-button { border-radius: 6px; font-size: 11px; min-height: 44px; }
  #toast { bottom: 60px; font-size: 9px; padding: 5px 9px; }
  .panel { padding: 16px; }
  .panel h1 { font-size: 23px; }
  .panel h2 { font-size: 20px; }
  .panel p { font-size: 12px; margin: 7px 0; }
  .panel .controls-copy { font-size: 10px; }
  .primary { font-size: 13px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; transition-duration: .01ms !important; } }
