:root {
  --ink: #e8e4d8;
  --dim: #9aa3a8;
  --amber: #ffb340;
  --red: #e0392c;
  --olive: #5a6132;
  --panel: #10151c;
  --line: #2a3340;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #0a0e13;
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Malgun Gothic", sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}
#app { width: 100%; max-width: 560px; }

/* ---- Splash ---- */
#splash { position: relative; min-height: 100vh; overflow: hidden; }
.splash-bg { position: absolute; inset: 0; background: #0b141d; }
.splash-bg video, .splash-bg img#splashPoster {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.splash-bg video { display: none; }
.splash-bg.has-video video { display: block; }
.splash-bg.has-video img#splashPoster { display: none; }
#splashCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.searchlights span {
  position: absolute; bottom: -10%; width: 90px; height: 80%;
  background: rgba(255, 240, 200, 0.10);
  transform-origin: bottom center;
  clip-path: polygon(42% 100%, 58% 100%, 100% 0, 0 0);
  animation: sweep 7s ease-in-out infinite alternate;
}
.searchlights span:nth-child(1) { left: 8%; animation-delay: 0s; }
.searchlights span:nth-child(2) { left: 44%; animation-delay: -2.5s; }
.searchlights span:nth-child(3) { left: 76%; animation-delay: -5s; }
@keyframes sweep { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }

.splash-panel {
  position: relative; margin: 12vh 20px 20px; padding: 22px;
  background: rgba(10, 14, 19, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.splash-kicker { margin: 0 0 8px; letter-spacing: 3px; font-size: 12px; color: var(--amber); }
.game-title {
  margin: 0 0 8px; font-size: 52px; line-height: 1.02; letter-spacing: 2px;
  font-family: "Arial Black", "Malgun Gothic", sans-serif;
  color: var(--ink);
  text-shadow: 0 3px 0 #5c1410, 0 0 22px rgba(224, 57, 44, 0.45);
}
.splash-sub { margin: 0 0 16px; color: var(--dim); }
.splash-actions { display: flex; gap: 10px; margin-bottom: 12px; }
.splash-row { display: flex; justify-content: space-between; align-items: center; }
.howto { background: #161d26; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-size: 13px; }
.splash-note { font-size: 12px; color: var(--dim); }
.sound-toggle { font-size: 14px; display: flex; gap: 6px; align-items: center; }
.linklike { background: none; border: none; color: var(--amber); cursor: pointer; font-size: 14px; }

.btn {
  background: #1b232e; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 16px; font-size: 15px; cursor: pointer;
}
.btn.primary { background: var(--red); border-color: #8f1f16; color: #fff; font-weight: 700; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn:active { transform: translateY(1px); }

/* ---- Stage ---- */
#stage { padding: 10px 10px 18px; }
.hud { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px 10px; font-size: 15px; }
.hud-label { color: var(--amber); font-size: 11px; letter-spacing: 2px; margin-right: 6px; }
.hud .dim { color: var(--dim); }
#hi { margin-left: 4px; }
#lives { letter-spacing: 2px; color: var(--red); font-size: 16px; }
.canvas-wrap { position: relative; }
#game {
  width: 100%; height: auto; display: block;
  background: #0b1c2c; border: 1px solid var(--line); border-radius: 6px;
  touch-action: none;
}
.banner {
  position: absolute; top: 34%; left: 0; right: 0; text-align: center;
  font-size: 34px; font-weight: 800; letter-spacing: 6px; color: var(--amber);
  text-shadow: 0 2px 0 #000;
}
.gameover {
  position: absolute; inset: auto 12px 12px 12px; text-align: center;
  background: rgba(10, 14, 19, 0.94); border: 1px solid var(--line);
  border-radius: 8px; padding: 18px;
}
.gameover h2 { margin: 0 0 6px; letter-spacing: 4px; }
.gameover .dim { color: var(--dim); }
.gameover .btn { margin: 4px; }
.touch-hint { text-align: center; color: var(--dim); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .searchlights span { animation: none; }
}
@media (max-width: 420px) {
  .game-title { font-size: 40px; }
}
