* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #101525; }
body { overflow: hidden; color: #edf4ff; font-family: Arial, sans-serif; }
button { min-height: 42px; border: 1px solid #78b7ff; border-radius: 6px; background: #18253c; color: #f3f8ff; cursor: pointer; font: 800 12px Arial, sans-serif; touch-action: manipulation; }
button:hover, button:focus-visible { border-color: #f3ca70; background: #253b5d; outline: 2px solid transparent; }
button:focus-visible { outline-color: #f3ca70; }
#game-shell, #stage { position: relative; width: min(100vw, 960px); height: min(56.25vw, 540px); margin: 0 auto; }
#game-canvas { display: block; width: 100%; height: 100%; background: #101525; 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: #97b4d6; font: 800 10px ui-monospace, monospace; }
#hud strong { display: block; margin-top: 2px; color: #f1f7ff; font: 800 20px ui-monospace, monospace; }
#target-value { color: #f3ca70; }
#utility-controls { position: absolute; z-index: 5; top: 14px; right: 16px; display: flex; gap: 7px; }
#utility-controls button { min-width: 42px; padding: 0 8px; font-size: 17px; }
.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 #78b7ff; border-radius: 8px; background: rgba(16, 21, 37, .96); text-align: center; }
.panel.compact { width: min(350px, 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: #78b7ff; font: 800 11px ui-monospace, monospace; }
.muted { margin-top: 9px !important; color: #bbcee5; font-size: 14px; }
.primary { min-width: 156px; margin-top: 20px; padding: 0 16px; border-color: #f3ca70; background: #45391d; }
.result-actions { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.result-actions .primary { margin-top: 0; }
.result-actions button:first-child { min-width: 42px; padding: 0 9px; }
#node-controls { position: absolute; z-index: 6; right: 17px; bottom: 14px; display: grid; grid-template-columns: repeat(3, 47px); gap: 5px; }
#node-controls button { min-height: 42px; color: #d8e9ff; font: 800 11px ui-monospace, monospace; }
#node-controls button[data-selected="true"] { border-color: #f3ca70; background: #3c3420; }
.undo-note { position: absolute; z-index: 4; left: 18px; bottom: 18px; margin: 0; color: #b5cae2; font: 800 10px ui-monospace, monospace; }
#toast { position: absolute; z-index: 9; left: 50%; bottom: 18px; max-width: calc(100% - 24px); margin: 0; padding: 8px 12px; transform: translateX(-50%); border: 1px solid #f3ca70; border-radius: 5px; background: #283e5e; font-size: 12px; text-align: center; white-space: nowrap; }
[hidden] { display: none !important; }
@media (max-width: 640px) {
  #hud { top: 9px; left: 10px; gap: 6px; } #hud div { min-width: 54px; } #hud span { font-size: 9px; } #hud strong { font-size: 16px; }
  #utility-controls { top: 7px; right: 8px; gap: 3px; } #utility-controls button { min-width: 38px; min-height: 38px; padding: 0; font-size: 16px; }
  #node-controls { display: none !important; }
  .undo-note { display: none !important; } .panel { padding: 16px; } .panel h1, .panel h2 { font-size: 23px; } .panel p { font-size: 12px; }
  #toast { bottom: 5px; padding: 5px 8px; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
