/* PAC-MAN Nº 04 — néo-noir bleu cyberpunk */
:root {
  --bg: #000510;
  --bg-elev: #060A18;
  --bg-card: #0A1020;
  --ink: #EBE5D6;
  --ink-soft: #5A6080;
  --accent: #FFE000;    /* jaune Pac-Man */
  --accent2: #1A1AFF;   /* bleu mur */
  --danger: #FF4444;
  --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 {
  max-width: 500px;
  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(255,224,0,0.2);
}
.wordmark {
  font-family: 'Unbounded', sans-serif;
  font-weight: 900;
  font-size: clamp(24px, 7vw, 40px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(255,224,0,0.5);
}
.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(255,224,0,0.4);
}

/* ---- PLAY ---- */
.play { display: flex; justify-content: center; }
.board-wrap {
  position: relative;
  border: 2px solid var(--accent2);
  background: #000510;
  box-shadow: 0 0 30px rgba(26,26,255,0.3), 6px 6px 0 rgba(255,224,0,0.2);
  width: 100%;
  max-width: 448px;
  aspect-ratio: 448 / 496;
}
#board { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

/* ---- OVERLAY ---- */
.overlay {
  position: absolute; inset: 0;
  background: rgba(0,5,16,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, 42px); color: var(--danger);
  text-shadow: 0 0 30px var(--danger);
}
.overlay__score {
  font-family: 'JetBrains Mono', monospace; font-weight: 700;
  font-size: 22px; color: var(--accent);
}
.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); }

/* ---- D-PAD ---- */
.dpad {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0;
}
.dpad__row { display: flex; gap: 6px; justify-content: center; }
.dpad__btn {
  width: clamp(60px, 15vw, 75px);
  height: clamp(60px, 15vw, 75px);
  background: var(--bg-card);
  border: 2px solid var(--rule);
  color: var(--ink);
  font-family: 'Unbounded', sans-serif;
  font-weight: 800; font-size: 24px;
  transition: background 0.08s, transform 0.05s;
}
.dpad__btn:active {
  transform: scale(0.9);
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(255,224,0,0.6);
}
.dpad__btn--center {
  background: transparent;
  color: var(--accent2);
  border-color: var(--accent2);
  font-size: 16px;
}
.dpad__btn--center:active { background: var(--accent2); color: var(--ink); }

/* ---- 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(255,224,0,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(255,224,0,0.5); }
.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(255,224,0,0.1); padding-top: 8px;
}

@media (hover: hover) {
  .dpad__btn:hover { background: var(--bg-elev); }
  .icon-btn--small:hover { border-color: var(--accent); color: var(--accent); }
}
