/* ============================================================
   SPACE INVADERS Nº 03 — édition web
   Fond espace, accent cyan néon, vermillon danger
   ============================================================ */
:root {
  --bg: #02050F;
  --bg-elev: #060A18;
  --bg-card: #0A1020;
  --ink: #EBE5D6;
  --ink-soft: #6A7090;
  --accent: #00F5FF;
  --danger: #FF4444;
  --gold: #FFD700;
  --green: #B0FF3C;
  --rule: #1A2040;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button { font-family: inherit; cursor: pointer; }

/* ---- FRAME ---- */
.frame {
  max-width: 540px;
  margin: 0 auto;
  padding: clamp(8px, 2vw, 16px);
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
}

/* ---- MASTHEAD ---- */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 2px 20px rgba(0,245,255,0.15);
}

.wordmark {
  font-family: 'Unbounded', sans-serif;
  font-weight: 900;
  font-size: clamp(22px, 6vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-shadow: 0 0 20px rgba(0,245,255,0.4);
}

.dateline {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
}
.dateline__num { color: var(--accent); font-weight: 700; }
.dateline__sep { opacity: 0.4; }

.masthead__right { display: flex; align-items: center; gap: 5px; padding-top: 2px; }

.icon-btn {
  background: var(--ink);
  color: var(--bg);
  border: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-family: 'Unbounded', sans-serif;
  font-weight: 800; font-size: 13px;
}
.icon-btn:active { transform: scale(0.92); }

.icon-btn--small {
  width: 32px; height: 32px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--ink);
  border: 2px solid var(--rule);
}
.icon-btn--small[data-on="false"] { opacity: 0.3; text-decoration: line-through; }
.icon-btn--small[data-on="true"] { border-color: var(--accent); color: var(--accent); }

/* ---- STATS ---- */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2px solid var(--rule);
  background: var(--bg-card);
}
.stat {
  padding: 10px 14px;
  border-right: 2px solid var(--rule);
  display: flex; flex-direction: column; gap: 2px;
}
.stat:last-child { border-right: none; }
.stat__label {
  font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.22em; color: var(--ink-soft);
}
.stat__value {
  font-weight: 700; font-size: clamp(20px, 5.5vw, 28px);
  font-variant-numeric: tabular-nums; color: var(--accent);
  text-shadow: 0 0 12px rgba(0,245,255,0.5);
}

/* ---- PLAY ---- */
.play { display: flex; justify-content: center; }

.board-wrap {
  position: relative;
  border: 2px solid var(--accent);
  background: #02050F;
  box-shadow: 0 0 30px rgba(0,245,255,0.2), 6px 6px 0 rgba(0,245,255,0.3);
  width: 100%;
  max-width: 480px;
  aspect-ratio: 480 / 640;
}

#board {
  display: block;
  width: 100%; height: 100%;
  image-rendering: pixelated;
}

/* ---- OVERLAY ---- */
.overlay {
  position: absolute; inset: 0;
  background: rgba(2,5,15,0.93);
  display: grid; place-items: center;
  backdrop-filter: blur(6px);
}
.overlay__inner { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.overlay__title {
  font-family: 'Unbounded', sans-serif; font-weight: 900;
  font-size: clamp(28px, 8vw, 44px); color: var(--danger);
  text-shadow: 0 0 30px var(--danger); letter-spacing: 0.04em;
}
.overlay__score {
  font-family: 'JetBrains Mono', monospace; font-weight: 700;
  font-size: 22px; color: var(--accent);
  text-shadow: 0 0 12px rgba(0,245,255,0.6);
}
.overlay__wave { font-size: 13px; color: var(--ink-soft); }

.btn-primary {
  font-family: 'Unbounded', sans-serif; font-weight: 700;
  font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 14px 28px;
  border: 2px solid var(--accent);
  background: var(--accent); color: var(--bg);
  margin-top: 8px;
}
.btn-primary:active { transform: scale(0.96); }

/* ---- CONTROLS ---- */
.controls {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 8px;
}

.ctrl-btn {
  height: clamp(54px, 14vw, 68px);
  background: var(--bg-card);
  border: 2px solid var(--rule);
  color: var(--ink);
  font-family: 'Unbounded', sans-serif;
  font-weight: 800; font-size: 22px;
  transition: background 0.08s, transform 0.05s, border-color 0.08s;
}
.ctrl-btn:active {
  transform: scale(0.92);
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.ctrl-btn--fire {
  font-size: 16px; letter-spacing: 0.15em;
  background: var(--danger);
  color: var(--ink);
  border-color: var(--danger);
  box-shadow: 0 0 20px rgba(255,68,68,0.4);
}
.ctrl-btn--fire:active {
  background: #FF8888;
  border-color: #FF8888;
  box-shadow: 0 0 30px rgba(255,68,68,0.8);
}

/* ---- LEADERBOARD ---- */
.leaderboard { border-top: 3px solid var(--accent); padding-top: 12px; }
.lb__title {
  font-family: 'Unbounded', sans-serif; font-weight: 800;
  font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 10px; color: var(--accent);
}
.lb__list { list-style: none; display: flex; flex-direction: column; }
.lb__list li {
  display: grid; grid-template-columns: 30px 1fr auto;
  align-items: baseline; gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px dashed rgba(0,245,255,0.1);
  font-variant-numeric: tabular-nums;
}
.lb__rank { font-family: 'Unbounded', sans-serif; font-weight: 800; font-size: 14px; color: var(--ink-soft); }
.lb__rank--top { color: var(--accent); text-shadow: 0 0 8px rgba(0,245,255,0.6); }
.lb__meta { font-size: 11px; color: var(--ink-soft); }
.lb__score { font-weight: 700; font-size: 15px; color: var(--accent); }
.lb__empty { display: block !important; color: var(--ink-soft); font-style: italic; text-align: center; padding: 10px; border: none; }

/* ---- COLOPHON ---- */
.colophon {
  text-align: center; font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.2em; color: var(--ink-soft);
  border-top: 1px solid rgba(0,245,255,0.1); padding-top: 8px;
}

/* ---- RESPONSIVE ---- */
@media (min-width: 540px) {
  .controls { display: none; }
}
@media (hover: hover) {
  .ctrl-btn:hover { background: var(--bg-elev); border-color: var(--ink-soft); }
  .ctrl-btn--fire:hover { background: #FF6666; }
  .icon-btn--small:hover { border-color: var(--accent); }
}
