/* COLOR RULES: HUD色は意図的なゲーム専用パレットとして :root 変数に集約し、以下は var() のみ使う */
:root {
  --game-bg: #040812;
  --game-ink: #eef6ff;
  --game-accent: #ffb454;
  --game-teal: #35e0d0;
  --game-danger: #ff4d5e;
  --game-panel: rgba(6, 16, 32, 0.72);
  --game-line: rgba(140, 210, 255, 0.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--game-bg); color: var(--game-ink); font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif; }
#game-root { position: fixed; inset: 0; }
#game-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#hud { position: absolute; inset: 0; pointer-events: none; }
.hud-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 10px; }
.hud-box { background: var(--game-panel); border: 1px solid var(--game-line); padding: 8px 14px; min-width: 104px; }
.hud-box:last-child { margin-left: auto; }
.hud-label { display: block; font-size: 10px; letter-spacing: .18em; opacity: .75; }
.hud-box strong { font-size: 22px; color: var(--game-teal); }
#hull { color: var(--game-danger); letter-spacing: .1em; }
.hud-help { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; font-size: 12px; opacity: .8; margin: 0; }
#crosshair { position: absolute; left: 50%; top: 46%; width: 22px; height: 22px; margin: -11px; border: 1px solid var(--game-teal); border-radius: 50%; opacity: .7; }
#crosshair::after { content: ""; position: absolute; inset: 9px; background: var(--game-teal); border-radius: 50%; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 24px; background: radial-gradient(ellipse at center, transparent 30%, var(--game-bg) 100%); }
.overlay[hidden] { display: none; }
.overlay h1 { margin: 0; font-size: clamp(30px, 6vw, 58px); line-height: 1.15; }
.overlay-kicker { margin: 0; letter-spacing: .35em; font-size: 12px; color: var(--game-accent); }
.overlay-desc { margin: 0; max-width: 520px; line-height: 1.7; opacity: .88; }
#start-btn, #restart-btn { font-size: 17px; padding: 12px 28px; pointer-events: auto; }
.ctl-list { text-align: left; line-height: 2; font-size: 14px; }
.ctl-list p { margin: 0; }
.ctl-key { display: inline-block; min-width: 150px; color: var(--game-teal); font-weight: 700; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#boss-bar { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); width: min(520px, 80vw); text-align: center; }
#boss-bar[hidden] { display: none; }
.boss-track { height: 10px; border: 1px solid var(--game-danger); background: var(--game-panel); }
#boss-fill { height: 100%; width: 100%; background: var(--game-danger); transition: width .15s; }
#boss-warning { position: absolute; top: 22%; left: 0; right: 0; text-align: center; font-size: clamp(22px, 5vw, 44px); letter-spacing: .3em; color: var(--game-danger); animation: blink .5s steps(2) 6; pointer-events: none; }
#boss-warning[hidden] { display: none; }
@keyframes blink { 50% { opacity: .15; } }
#dialog { position: absolute; left: 50%; transform: translateX(-50%); bottom: 18px; width: min(760px, calc(100vw - 24px)); display: flex; gap: 14px; align-items: flex-start; background: var(--game-panel); border: 1px solid var(--game-line); padding: 16px 18px; cursor: pointer; z-index: 5; }
#dialog[hidden] { display: none; }
#dialog-avatar { flex: 0 0 auto; width: 76px; height: 76px; overflow: hidden; border: 2px solid var(--game-teal); }
#dialog-avatar.pilot { border-color: var(--game-accent); }
#dialog-avatar-img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; display: block; }
.dialog-main { flex: 1; min-width: 0; }
#dialog-name { margin: 0 0 6px; font-weight: 700; color: var(--game-teal); }
#dialog-text { margin: 0; line-height: 1.8; font-size: 16px; }
.dialog-hint { margin: 8px 0 0; font-size: 11px; opacity: .7; text-align: right; }
#damage-flash { position: absolute; inset: 0; pointer-events: none; background: var(--game-danger); opacity: 0; }
#damage-flash.on { animation: dmg .28s ease-out; }
@keyframes dmg { 0% { opacity: .38; } 100% { opacity: 0; } }
#error-box { position: absolute; left: 12px; right: 12px; bottom: 44px; background: var(--game-panel); border: 1px solid var(--game-danger); padding: 10px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { #damage-flash.on { animation: none; } }
