:root {
  background: #071523;
  color: #effffb;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: #071523; }

body { overflow: hidden; touch-action: manipulation; }

button { font: inherit; }

#game-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 10px;
}

#stage {
  position: relative;
  width: min(100vw, 960px);
  height: min(56.25vw, 540px);
  min-height: 260px;
  overflow: hidden;
  border: 1px solid rgba(119, 255, 222, 0.4);
  background: #071523;
  box-shadow: 0 0 34px rgba(14, 212, 180, 0.2);
}

#game-canvas { display: block; width: 100%; height: 100%; outline: none; }

#hud {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 7px;
  pointer-events: none;
}

#hud > div {
  min-width: 58px;
  padding: 6px 8px;
  border: 1px solid rgba(208, 255, 244, 0.22);
  background: rgba(2, 20, 31, 0.76);
}

#hud span { display: block; color: #8abcb5; font-size: 8px; font-weight: 700; letter-spacing: 0.9px; }
#hud strong { display: block; color: #dffff7; font-size: 15px; letter-spacing: 0.5px; }

#action-controls { position: absolute; top: 12px; right: 12px; display: flex; gap: 7px; }

#action-controls button, .direction-button, .launch-button, .result-actions button, .primary {
  min-height: 38px;
  border: 1px solid rgba(186, 255, 237, 0.45);
  border-radius: 4px;
  background: rgba(3, 35, 48, 0.88);
  color: #effffb;
  cursor: pointer;
}

#action-controls button { width: 38px; padding: 0; font-weight: 700; }

#touch-controls {
  position: absolute;
  bottom: 12px;
  left: 50%;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}

.direction-button, .launch-button { min-width: 72px; padding: 0 12px; font-size: 11px; font-weight: 800; letter-spacing: 0.9px; }
.launch-button { border-color: #7affd5; background: #0e8c76; color: #041b22; }

.panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(430px, calc(100% - 36px));
  padding: 25px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(141, 255, 226, 0.46);
  background: rgba(4, 25, 39, 0.94);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.panel.compact { width: min(290px, calc(100% - 36px)); }
.panel h1, .panel h2 { margin: 5px 0 10px; color: #c7fff0; font-size: clamp(24px, 4vw, 38px); }
.panel p { margin: 8px 0; color: #cae8e1; line-height: 1.45; }
.status-label { color: #74eacb !important; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; }
.controls-copy { color: #8ebcb5 !important; font-size: 13px; }
.primary { margin-top: 10px; padding: 0 18px; background: #7affd5; color: #04252b; font-weight: 800; }
.best-result { color: #91d8c8 !important; font-weight: 700; }
.result-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.result-actions button { padding: 0 13px; }

#toast {
  position: absolute;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  border: 1px solid rgba(146, 255, 222, 0.5);
  background: rgba(4, 31, 40, 0.9);
  color: #d8fff5;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

button:focus-visible { outline: 2px solid #fff6b7; outline-offset: 2px; }
button:active { transform: translateY(1px); }

@media (max-width: 600px) {
  #game-shell { padding: 0; }
  #stage { width: 100vw; height: 56.25vw; min-height: 0; border-left: 0; border-right: 0; }
  #hud { top: 8px; left: 8px; gap: 4px; }
  #hud > div { min-width: 48px; padding: 4px 5px; }
  #hud span { font-size: 7px; }
  #hud strong { font-size: 12px; }
  #action-controls { top: 8px; right: 8px; }
  #action-controls button { width: 34px; min-height: 34px; }
  #touch-controls { bottom: 8px; gap: 6px; }
  .direction-button, .launch-button { min-width: 64px; min-height: 42px; font-size: 10px; }
  .panel { padding: 18px; }
  #toast { top: 68px; max-width: calc(100% - 30px); text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  #stage { box-shadow: none; }
}
