/* Le Néant™ : identité visuelle du hub OhDjiGames. Polices auto-hébergées (OFL), aucun appel tiers. */
@font-face { font-family: 'Rajdhani'; font-weight: 500; font-display: swap; src: url('/fonts/rajdhani-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 600; font-display: swap; src: url('/fonts/rajdhani-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 700; font-display: swap; src: url('/fonts/rajdhani-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Press Start 2P'; font-weight: 400; font-display: swap; src: url('/fonts/press-start-2p-latin-400-normal.woff2') format('woff2'); }

:root {
  --bg: #05060a;
  --fg: #f2f2f2;
  --muted: rgba(255, 255, 255, .75);
  --accent: #FFE81F;
  --cyan: #4bd5ee;
  --line: rgba(255, 255, 255, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Rajdhani', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--fg); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Lien HUB, au-dessus de tout ---------- */
.hub {
  position: fixed; top: 16px; left: 16px; z-index: 50;
  font-weight: 600; font-size: 13px; letter-spacing: .18em; text-decoration: none;
  color: var(--muted); padding: 6px 0;
}
.hub:hover, .hub:focus-visible { color: var(--accent); }
.hub:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 2px solid #fff; outline-offset: 2px;
}

/* ---------- Scène centrée ---------- */
.stage { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.core {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 72px 16px 32px; text-align: center;
}
.brand {
  margin: 0; font-size: clamp(13px, 1.6vw, 17px); font-weight: 600;
  letter-spacing: .5em; color: var(--muted); text-indent: .5em;
}
.counter-label {
  margin: 18px 0 0; font-family: 'Press Start 2P', monospace; font-size: clamp(8px, 1vw, 11px);
  letter-spacing: .22em; color: var(--muted);
}
.counter {
  margin: 0; font-family: 'Press Start 2P', monospace; font-size: clamp(16px, 12vw, 56px);
  line-height: 1.1; color: var(--fg); white-space: nowrap;
  animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .92 } 50% { opacity: 1 } }
.grade {
  margin: 6px 0 0; max-width: min(94vw, 680px);
  font-family: 'Press Start 2P', monospace; font-size: clamp(8px, 1.3vw, 12px);
  line-height: 1.9; letter-spacing: .08em; color: var(--cyan);
}
.percent { margin: 4px 0 0; font-size: 15px; font-weight: 500; letter-spacing: .04em; color: var(--muted); }

.noscript { margin: 0 16px 32px; text-align: center; font-size: 16px; color: var(--muted); }

/* ---------- Messages progressifs ---------- */
.messages {
  display: flex; flex-direction: column; gap: 10px;
  margin: 0 16px 28px; max-width: min(92vw, 420px);
}
.msg {
  margin: 0; font-size: clamp(15px, 1.6vw, 17px); font-weight: 500; line-height: 1.5;
  color: var(--muted); animation: msg-in 600ms ease-out; transition: opacity 600ms ease;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
@media (min-width: 900px) {
  .messages {
    position: fixed; right: 32px; top: 50%; transform: translateY(-50%);
    width: 320px; max-width: none; margin: 0; align-items: flex-end; text-align: right;
  }
}

/* ---------- Étoiles filantes ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.shooting-star {
  position: fixed; left: 0; top: 0; width: 1px; height: 1px;
  pointer-events: none; will-change: transform;
}
.shooting-star::before {
  content: ''; position: absolute; left: -1px; top: -1px; width: 3px; height: 3px;
  border-radius: 50%; background: #fff; opacity: .85;
}
.shooting-star::after {
  content: ''; position: absolute; top: 0; left: -140px; width: 140px; height: 1px;
  background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,.55));
}
.star-msg {
  position: fixed; z-index: 3; pointer-events: none; max-width: 260px;
  font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--muted);
  animation: msg-in 600ms ease-out; transition: opacity 600ms ease;
}

/* ---------- Bouton fuyard ---------- */
.flee {
  position: fixed; z-index: 6; min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--line); border-radius: 2px; background: rgba(255,255,255,.05);
  color: var(--fg); font-family: 'Rajdhani', sans-serif; font-weight: 600;
  font-size: 15px; letter-spacing: .04em; cursor: pointer; white-space: nowrap;
}
.flee:hover { color: #fff; border-color: rgba(255,255,255,.7); background: rgba(255,255,255,.1); }

/* ---------- Tableau des scores ---------- */
.scores { border-top: 1px solid rgba(255,255,255,.15); }
.scores-toggle {
  display: block; width: 100%; padding: 14px 16px; cursor: pointer; list-style: none;
  text-align: center; font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 14px;
  letter-spacing: .28em; color: var(--muted);
}
.scores-toggle::-webkit-details-marker { display: none; }
.scores-toggle:hover, .scores[open] .scores-toggle { color: var(--accent); }
.scores-body {
  max-width: 640px; margin: 0 auto; padding: 8px 16px 40px;
  display: flex; flex-direction: column; gap: 36px;
}
.scores-heading {
  margin: 0 0 14px; font-family: 'Press Start 2P', monospace; font-size: 10px;
  letter-spacing: .18em; color: var(--accent);
}
.scores-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.scores-list li {
  display: flex; align-items: baseline; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.12); font-size: 16px;
}
.scores-list li:last-child { border-bottom: 0; }
.score-name { font-weight: 600; color: var(--fg); flex: 1 1 auto; min-width: 0; }
.score-grade { font-family: 'Press Start 2P', monospace; font-size: 8px; line-height: 1.8; color: var(--cyan); text-align: right; }
.score-time { font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.scores-empty { color: var(--muted); font-style: normal; }
.official-note { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

.save-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.save-label { font-size: 14px; font-weight: 600; letter-spacing: .12em; color: var(--muted); }
.save-input {
  flex: 1 1 140px; min-width: 0; height: 44px; padding: 0 12px;
  background: transparent; border: 1px solid var(--line); border-radius: 2px;
  color: var(--fg); font-family: 'Rajdhani', sans-serif; font-size: 16px;
}
.save-input::placeholder { color: rgba(255,255,255,.4); }
.save-btn {
  min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 2px;
  background: transparent; color: var(--fg); font-family: 'Rajdhani', sans-serif;
  font-weight: 600; font-size: 13px; letter-spacing: .18em; cursor: pointer;
}
.save-btn:hover { color: var(--accent); border-color: var(--accent); }
.save-note { margin: 14px 0 0; font-size: 15px; color: var(--muted); }

/* ---------- Pied de page ---------- */
.footer { border-top: 1px solid rgba(255,255,255,.15); padding: 18px 16px 24px; text-align: center; }
.contact { margin: 0; font-size: 14px; font-weight: 500; letter-spacing: .03em; color: var(--muted); }
.contact-link { color: var(--cyan); text-decoration: none; border-bottom: 1px solid rgba(75,213,238,.4); }
.contact-link:hover, .contact-link:focus-visible { color: #fff; border-color: #fff; }

/* ---------- Mobile étroit : jamais de défilement horizontal ---------- */
@media (max-width: 560px) {
  .core { gap: 10px; padding-top: 64px; }
  .score-grade { max-width: 40%; }
}

/* ---------- Accessibilité : mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  .counter { animation: none; }
  .shooting-star, .star-msg { display: none; }
}
