* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #030408; }
body { font-family: 'Nunito', sans-serif; color: #eaf6ff; display: flex; align-items: center; justify-content: center; height: 100vh; height: 100svh; touch-action: none; }

#game-root { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 10%, #0a1830 0%, #030408 70%); }

#game-canvas {
  display: block; aspect-ratio: 9 / 14;
  height: min(92svh, calc(96vw * 14 / 9)); width: auto; max-width: 96vw;
  background: #05070f; border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 3px #05070f, 0 0 0 6px #143a5a, 0 0 22px rgba(80,220,255,0.15);
  image-rendering: pixelated;
}

.hud { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: min(92svh * 9 / 14, 96vw); display: flex; flex-direction: column; gap: 6px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 0; z-index: 20; pointer-events: none; }
.hud.hidden { display: none; }
.hud-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: auto; }
.hud-chips { display: flex; align-items: center; gap: 6px; }
.hud-chip { background: rgba(5,7,15,0.78); border: 1px solid rgba(80,220,255,0.35); border-radius: 14px; padding: 5px 12px; font-size: 0.85rem; font-weight: 800; color: #8fe8ff; }
.hud-chip.combo { color: #ffd24a; border-color: rgba(255,210,74,0.4); }
.hud-chip.hidden { display: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.18); background: rgba(5,7,15,0.78); color: #fff; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.icon-btn:active { transform: scale(0.92); }

.glow-wrap { display: flex; align-items: center; gap: 6px; background: rgba(5,7,15,0.78); border: 1px solid rgba(255,210,74,0.35); border-radius: 20px; padding: 5px 12px; pointer-events: auto; }
.glow-icon { font-size: 0.9rem; }
.glow-track { flex: 1; height: 10px; border-radius: 6px; background: rgba(255,255,255,0.1); overflow: hidden; border: 1px solid rgba(255,255,255,0.15); }
.glow-fill { height: 100%; width: 100%; background: linear-gradient(90deg,#ffe58a,#ffb703); transition: width 0.2s ease, background 0.2s ease; }
.glow-fill.low { background: linear-gradient(90deg,#ff5a5a,#ff2d2d); animation: pulse-low 0.6s infinite; }
@keyframes pulse-low { 0%,100%{opacity:1;} 50%{opacity:0.5;} }

.powerup-chips { display: flex; gap: 6px; pointer-events: none; }
.pu-chip { background: rgba(5,7,15,0.78); border: 1px solid rgba(120,200,255,0.4); border-radius: 12px; padding: 3px 8px; font-size: 0.7rem; font-weight: 700; }

.touch-controls { position: absolute; inset: 0; z-index: 25; display: flex; flex-direction: column; }
.touch-controls.hidden { display: none; }
.lane-btn { flex: 1; background: transparent; border: none; color: transparent; }
.lane-up { border-bottom: 1px solid transparent; }

.screen { position: absolute; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center; padding: 16px; }
.screen.active { display: flex; }
.overlay-screen { background: rgba(3,4,8,0.85); backdrop-filter: blur(3px); }

.title-card, .panel-card { width: min(92vw, 420px); max-height: 90vh; overflow-y: auto; background: linear-gradient(180deg, #0e1e38, #06101f); border: 3px solid #2a6a9a; border-radius: 16px; padding: 26px 22px; display: flex; flex-direction: column; align-items: center; gap: 14px; box-shadow: 0 10px 40px rgba(0,0,0,0.55), 0 0 26px rgba(80,220,255,0.12); }

.title-moth { font-size: 2.6rem; filter: drop-shadow(0 0 10px #ffe58a); }
.game-title { font-family: 'Press Start 2P', monospace; font-size: 1.15rem; color: #ffe58a; text-shadow: 0 0 12px rgba(255,229,138,0.6); text-align: center; }
.subtitle { font-size: 0.9rem; opacity: 0.8; margin-top: -6px; color: #8fe8ff; }

.menu-buttons { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.btn-pixel { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 0.95rem; padding: 13px 18px; border-radius: 10px; border: none; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,0.35); letter-spacing: 0.01em; }
.btn-pixel:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.35); }
.btn-primary { background: linear-gradient(180deg,#ffe58a,#ffb703); color: #3a2400; }
.btn-secondary { background: linear-gradient(180deg,#3fa9ff,#1a5a9a); color: #eaf6ff; }
.btn-text { background: transparent; color: #9fc8e8; box-shadow: none; font-size: 0.85rem; }

.title-footer { display: flex; align-items: center; justify-content: space-between; width: 100%; font-size: 0.75rem; opacity: 0.65; margin-top: 4px; }
.howto-list { list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 0.86rem; line-height: 1.4; }
h2 { font-family: 'Press Start 2P', monospace; font-size: 0.95rem; color: #ffe58a; text-align: center; }

.results-score-val { font-family: 'Press Start 2P', monospace; font-size: 1.7rem; color: #ffe58a; }
.result-detail { font-size: 0.85rem; opacity: 0.85; }
.result-best { font-size: 0.78rem; opacity: 0.7; }

.nn-score-nudge { background: rgba(255,255,255,0.08); border-radius: 10px; padding: 10px; width: 100%; text-align: center; font-size: 0.85rem; }
.nn-nudge-btns { display: flex; gap: 8px; margin-top: 8px; justify-content: center; }
.nn-nudge-signup { background: #ffb703; color: #3a2400; padding: 8px 14px; border-radius: 8px; text-decoration: none; font-weight: 800; font-size: 0.8rem; }
.nn-nudge-later { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 0.8rem; }

@media (prefers-reduced-motion: reduce) { .glow-fill.low { animation: none; } }
