/* ===== Neon Nova — design tokens ===== */
:root {
  --bg: #070b1c;
  --panel: rgba(15, 23, 42, 0.78);
  --panel-2: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --fg: #e8eeff;
  --muted: #94a3b8;
  --red: #dc2626;
  --blue: #2563eb;
  --cyan: #38bdf8;
  --green: #22c55e;
  --radius: 16px;
  --font-display: "Press Start 2P", system-ui, sans-serif;
  --font-body: "VT323", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background:
    radial-gradient(1200px 700px at 50% -12%, #16204a 0%, transparent 60%),
    radial-gradient(900px 520px at 100% 108%, #241136 0%, transparent 55%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.35;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== ambient screen effects ===== */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.fx--scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.55;
}
.fx--vignette {
  background: radial-gradient(125% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.65) 100%);
}

#app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
}

/* ===== HUD ===== */
.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(7, 11, 28, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.hud__cell { display: flex; align-items: center; gap: 10px; }
.hud__cell--mid { justify-content: center; }
.hud__cell--end { justify-content: flex-end; }
.hud__label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hud__value {
  font-family: var(--font-display);
  font-size: 14px;
  color: #eaf4ff;
  text-shadow: 0 0 14px rgba(56, 189, 248, 0.65);
}
.lives { display: flex; gap: 5px; color: var(--cyan); filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.7)); }
.lives svg { display: block; }

.chip {
  font-family: var(--font-display);
  font-size: 9px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #052e16;
  background: var(--green);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.6);
}

/* ===== stage ===== */
#stage { position: relative; overflow: hidden; background: #05081a; }
#game { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

.banner {
  position: absolute;
  top: 16%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: clamp(11px, 2.4vw, 20px);
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 0 0 18px var(--cyan), 0 0 40px var(--blue);
}
.banner.is-on { animation: bannerIn 1.6s ease-out forwards; }
@keyframes bannerIn {
  0% { opacity: 0; transform: translateX(-50%) scale(0.75); }
  18% { opacity: 1; transform: translateX(-50%) scale(1.06); }
  30% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(1.02); }
}

/* ===== overlay + panels ===== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(90% 70% at 50% 50%, rgba(7, 11, 28, 0.55), rgba(7, 11, 28, 0.88));
  animation: fadeUp 0.35s ease-out both;
}
.overlay[hidden] { display: none; }

.panel {
  width: min(520px, 100%);
  max-height: 100%;
  overflow: auto;
  text-align: center;
  padding: 26px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.panel[hidden] { display: none; }

.kicker {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
}
.logo {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(20px, 5.6vw, 34px);
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 0 12px var(--blue), 0 0 34px rgba(37, 99, 235, 0.75);
}
.logo span { display: block; color: var(--red); text-shadow: 0 0 12px var(--red), 0 0 34px rgba(220, 38, 38, 0.7); }
.panel__title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(14px, 3.4vw, 20px);
  color: #fff;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.6);
}
.lead { margin: 0 0 16px; color: #cbd5e1; font-size: 21px; }
.lead b { color: var(--red); }
.best { margin: 16px 0 0; color: var(--muted); font-size: 18px; }
.best strong { color: var(--green); }

.keys {
  list-style: none;
  margin: 0 0 20px;
  padding: 12px 14px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: #cbd5e1;
  font-size: 19px;
}
.keys li + li { margin-top: 6px; }
kbd {
  font-family: var(--font-display);
  font-size: 9px;
  padding: 4px 6px;
  margin: 0 1px;
  border-radius: 6px;
  color: #dbeafe;
  background: rgba(37, 99, 235, 0.22);
  border: 1px solid rgba(96, 165, 250, 0.35);
}

/* ===== buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(37, 99, 235, 0.18);
  color: #eaf4ff;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35); background: rgba(37, 99, 235, 0.3); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.btn svg { width: 16px; height: 16px; }
.btn--primary {
  border-color: rgba(34, 197, 94, 0.45);
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.28), rgba(22, 163, 74, 0.18));
  box-shadow: 0 10px 30px rgba(34, 197, 94, 0.28);
}
.btn--primary:hover { background: linear-gradient(180deg, rgba(34, 197, 94, 0.42), rgba(22, 163, 74, 0.26)); box-shadow: 0 14px 36px rgba(34, 197, 94, 0.42); }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ===== stats (game over) ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 20px;
}
.stats > div {
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.stats span {
  display: block;
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.stats strong {
  display: block;
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 13px;
  color: #eaf4ff;
  text-shadow: 0 0 14px rgba(56, 189, 248, 0.6);
}

/* ===== footer bar ===== */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(7, 11, 28, 0.72);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  font-size: 17px;
  color: var(--muted);
}
.bar__hint--best strong { color: var(--green); }

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: #dbeafe;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.iconbtn:hover { transform: translateY(-2px); background: rgba(37, 99, 235, 0.28); box-shadow: 0 10px 24px rgba(37, 99, 235, 0.3); }
.iconbtn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.iconbtn svg { width: 18px; height: 18px; }
.ico-off { display: none; }
body.is-muted .ico-off { display: block; }
body.is-muted .ico-on { display: none; }
.ico-placeholder { display: none; }

/* ===== animations ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== responsive ===== */
@media (max-width: 720px) {
  body { font-size: 19px; }
  .hud { padding: 8px 12px; gap: 8px; }
  .hud__label { font-size: 8px; }
  .hud__value { font-size: 12px; }
  .bar { padding: 6px 12px; font-size: 15px; }
  .keys { font-size: 18px; }
  .panel { padding: 20px 16px; }
}

@media (max-width: 420px) {
  .bar__hint:first-child { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats > div:last-child { grid-column: span 2; }
}

@media (min-width: 1440px) {
  .hud { padding: 12px 26px; }
  .bar { padding: 10px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .banner.is-on { animation: none; opacity: 1; }
  .overlay { animation: none; }
  .btn, .iconbtn { transition: none; }
  .fx--scanlines { display: none; }
}
