/* Police pixel du site : Press Start 2P (licence OFL) rendue 30 % plus haute avec un pixel
   d'espace entre les lettres, renommée « Nerzo Pixel » comme l'exige la licence (fonts/OFL.txt) */
@font-face {
  font-family: "Nerzo Pixel";
  src: url("fonts/nerzo-pixel.otf") format("opentype");
  font-display: swap;
}

:root {
  --bg: #14112a;
  --bg-2: #1e1940;
  --card: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text: #ece8ff;
  --muted: #a9a2d0;
  --pink: #ff7eb6;
  --mint: #7ef0c6;
  --yellow: #ffd66b;
  --pixel: "Nerzo Pixel", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
/* « Bienvenue » (#accueil) : la section commence sous le menu collant ; cette marge
   fait remonter la page jusqu'en haut, tout en haut (le navigateur s'arrête à 0) */
#accueil { scroll-margin-top: 100vh; }

body {
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at top, var(--bg-2), var(--bg) 70%) fixed;
  line-height: 1.6;
  min-height: 100vh;
}

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

a { color: inherit; }

/* Navigation */
/* Logo à gauche, sections de l'accueil au centre, autres pages (Mini-jeu, retour) à droite */
.nav {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(20, 17, 42, 0.75);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

/* Logo façon chat de jeu vidéo : « [ESCOUADE] Pseudonyme : Nerzo_ » sur une bande sombre */
.logo {
  display: inline-block;
  padding: 10px 14px;
  font-family: var(--pixel);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
  color: var(--mint);
  background: rgba(0, 0, 0, 0.45);
  border-left: 3px solid var(--yellow);
}

.logo-channel { color: var(--yellow); }
.logo-label { color: var(--muted); }
/* Place réservée pour « Nerzo_ » : le menu ne bouge pas pendant la frappe */
.typing { display: inline-block; min-width: 6ch; }

.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.nav .logo { justify-self: start; }
.nav nav { display: flex; gap: 16px; flex-wrap: wrap; }
.nav-main { grid-column: 2; justify-content: center; }
.nav-side { grid-column: 3; justify-self: end; }
.nav nav a {
  padding: 6px 14px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color .2s, border-color .2s, box-shadow .2s, transform .1s;
}
.nav nav a:hover {
  color: var(--pink);
  border-color: var(--pink);
  box-shadow: 0 0 10px rgba(255, 126, 182, 0.35);
}
.nav nav a:active { transform: translateY(1px); }
/* Page en cours (Mini-jeu sur /snake) ou section en cours de lecture sur l'accueil */
.nav nav a[aria-current] { color: var(--mint); border-color: var(--mint); }

/* Titre d'une page secondaire (ex. /snake) */
.page-title { font-size: clamp(16px, 4vw, 24px); margin: 0 0 20px; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 70px 0 32px;
}

.tag {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--yellow);
  letter-spacing: 2px;
  animation: blink 1.4s steps(1) infinite;
}

h1 {
  font-family: var(--pixel);
  font-size: clamp(20px, 5vw, 38px);
  line-height: 1.5;
  margin: 16px 0 24px;
}

.glow {
  color: var(--pink);
  text-shadow: 0 0 12px rgba(255, 126, 182, 0.7), 0 0 30px rgba(255, 126, 182, 0.4);
}

.lead {
  max-width: 780px;
  margin: 0 auto 36px;
  color: var(--muted);
  font-size: 18px;
}

.btn {
  display: inline-block;
  font-family: var(--pixel);
  font-size: 12px;
  padding: 14px 22px;
  color: var(--bg);
  background: var(--mint);
  border: none;
  border-radius: 6px;
  box-shadow: 0 4px 0 #3fae88;
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #3fae88; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #3fae88; }

/* Sections */
.block { padding: 60px 0; }

h2 {
  font-family: var(--pixel);
  font-size: clamp(13px, 3vw, 18px);
  line-height: 1.6;
  margin: 0 0 20px;
}
h2 span { color: var(--pink); margin-right: 10px; }

h3 { margin: 0 0 6px; font-size: 20px; }

/* Jeu le plus attendu */
.hype-card {
  position: relative;
  min-height: 460px;
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #3a1f4f, #ff7eb6);
}
.hype-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
.hype-content {
  position: relative;
  width: 100%;
  padding: 40px 24px 24px;
  background: linear-gradient(transparent, rgba(13, 11, 31, 0.92) 40%);
}
.hype-content h3 { font-size: 26px; }
.hype-date { color: var(--yellow); font-weight: 800; margin: 0 0 18px; }

.countdown {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.countdown div {
  min-width: 76px;
  padding: 12px 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.countdown b {
  display: block;
  font-family: var(--pixel);
  font-size: 22px;
  color: var(--pink);
  text-shadow: 0 0 10px rgba(255, 126, 182, 0.6);
}
.countdown small { color: var(--muted); font-size: 13px; }
.released {
  font-family: var(--pixel);
  font-size: 18px;
  color: var(--mint);
  margin: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
/* Même largeur qu'une carte « coups de cœur » (4 colonnes), mais centrées */
.now-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.now-grid .card {
  width: calc((100% - 3 * 18px) / 4);
  min-width: 200px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 22px 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-6px) rotate(-1deg); border-color: var(--pink); }
.cover {
  display: block;
  width: calc(100% + 44px);
  margin: 0 -22px 16px;
  aspect-ratio: 460 / 215;
  object-fit: cover;
  background: linear-gradient(135deg, var(--bg-2), #3a2f6e);
}
.rank {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 7px;
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--pink);
  background: rgba(13, 11, 31, 0.85);
  border-radius: 6px;
  z-index: 1;
}
.rank.live { color: var(--mint); }
.card p { color: var(--muted); font-size: 15px; margin: 0 0 14px; }

.pill {
  margin-top: auto;
  align-self: flex-start;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  color: var(--yellow);
  border: 1px solid var(--yellow);
  border-radius: 999px;
}

/* Mini-jeu */
.hint { color: var(--muted); margin-top: -12px; }

.arcade {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  margin-top: 20px;
}
.game-col { width: 100%; max-width: 540px; }

.game-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

#snake {
  width: 100%;
  height: 100%;
  background: #0d0b1f;
  border: 3px solid var(--mint);
  border-radius: 10px;
  image-rendering: pixelated;
  touch-action: none;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(13, 11, 31, 0.85);
  border-radius: 10px;
}
.game-overlay.hidden { display: none; }
.game-overlay p {
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--yellow);
  text-align: center;
  line-height: 1.8;
  margin: 0;
  padding: 0 12px;
}

.scores {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 16px;
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--muted);
}
.scores b { color: var(--mint); }

/* Enregistrement du score */
.btn-small { font-size: 10px; padding: 10px 14px; }
.save {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 80%;
}
.save.hidden { display: none; }
.save label { color: var(--muted); font-size: 14px; }
.save input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  text-align: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.save input:focus { outline: 2px solid var(--mint); border-color: transparent; }
.game-overlay .save-msg {
  font-family: inherit;
  font-size: 14px;
  color: var(--mint);
  min-height: 1em;
}
.game-overlay .save-msg.error { color: var(--pink); }

/* Classement */
.leaderboard {
  width: 100%;
  max-width: 280px;
  padding: 20px 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.leaderboard h3 { font-family: var(--pixel); font-size: 13px; margin-bottom: 14px; }
.leaderboard ol { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.leaderboard li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  counter-increment: rank;
}
.leaderboard li:last-child { border-bottom: none; }
.leaderboard li::before {
  content: counter(rank);
  width: 22px;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--muted);
}
.leaderboard li:nth-child(1)::before { color: var(--yellow); }
.leaderboard li:nth-child(2)::before { color: #d6d3e8; }
.leaderboard li:nth-child(3)::before { color: #e0a070; }
.leaderboard li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard li b { font-family: var(--pixel); font-size: 11px; color: var(--mint); }
.leaderboard li.empty { color: var(--muted); font-size: 14px; }
.leaderboard li.empty::before { content: none; }

/* Onglets Toujours / Semaine / Jour */
.lb-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.lb-tabs button {
  flex: 1;
  padding: 6px 4px;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.lb-tabs button:hover { color: var(--pink); border-color: var(--pink); }
.lb-tabs button[aria-pressed="true"] { color: var(--bg); background: var(--mint); border-color: var(--mint); }

.lb-count { margin: 12px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.lb-me { margin: 6px 0 0; font-size: 13px; color: var(--yellow); text-align: center; }
.lb-me.hidden { display: none; }

/* Dernières parties */
.leaderboard h4 { margin: 18px 0 6px; font-family: var(--pixel); font-size: 10px; color: var(--pink); }
.lb-recent { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.lb-recent li { counter-increment: none; padding: 4px 0; }
.lb-recent li::before { content: none; }
.lb-recent li small { color: var(--muted); font-size: 11px; }

footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
  margin-top: 28px;
}
footer a {
  color: var(--mint);
  font-weight: 700;
  text-decoration: none;
}
footer a:hover { color: var(--pink); }
footer .legal-link { margin: 0; font-size: 12px; }
footer .legal-link a { color: var(--muted); font-weight: 400; }

/* Page d'erreur (404 / 403) */
.error-page {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 16px;
}
/* Phrase sur une seule ligne sur grand écran ; sinon lignes équilibrées (pas de mot tout seul) */
.error-page { max-width: 1100px; }
.error-page .lead { max-width: 1040px; text-wrap: balance; }
.error-code {
  position: relative;
  margin: 10px 0 0;
  font-size: clamp(64px, 18vw, 140px);
  line-height: 1.1;
  color: var(--pink);
  text-shadow: 0 0 14px rgba(255, 126, 182, 0.7), 0 0 40px rgba(255, 126, 182, 0.35);
}
/* Petit effet « bug d'écran » : deux copies décalées qui tremblent */
.error-code::before,
.error-code::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0.6;
}
.error-code::before { color: var(--mint); animation: glitch 2.5s steps(1) infinite; }
.error-code::after { color: var(--yellow); animation: glitch 3.1s steps(1) infinite reverse; }
@keyframes glitch {
  0%, 88%, 100% { transform: translate(0, 0); opacity: 0; }
  90% { transform: translate(-4px, 2px); opacity: 0.6; }
  93% { transform: translate(4px, -2px); opacity: 0.6; }
  96% { transform: translate(-2px, -1px); opacity: 0.6; }
}
.error-title {
  font-size: clamp(16px, 4vw, 24px);
  color: var(--yellow);
  margin: 10px 0 20px;
}
.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}
.btn-alt {
  background: var(--pink);
  box-shadow: 0 4px 0 #c2457f;
}
.btn-alt:hover { box-shadow: 0 6px 0 #c2457f; }
.btn-alt:active { box-shadow: 0 1px 0 #c2457f; }

/* Page mentions légales */
.legal { max-width: 720px; padding: 60px 16px; }
.legal h1 { font-size: clamp(16px, 4vw, 24px); }
.legal h2 { margin: 40px 0 12px; font-size: 13px; color: var(--pink); }
.legal p, .legal li { color: var(--muted); }
.legal strong { color: var(--text); }
.legal a { color: var(--mint); }

.back-link { text-align: center; margin: 28px 0 0; }

/* Bas d'une carte de jeu : le genre à gauche, un petit bouton à droite (ex. « Mes stats ») */
.card-foot {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-foot .pill { margin-top: 0; }
.btn-tiny { font-size: 8px; padding: 7px 10px; border-radius: 5px; box-shadow: 0 3px 0 #3fae88; }
.btn-tiny:hover { transform: translateY(-1px); box-shadow: 0 4px 0 #3fae88; }
.btn-tiny:active { transform: translateY(2px); box-shadow: 0 1px 0 #3fae88; }

/* Page « Mes stats Battlefield 6 » (remplie par bf6.js) */
.bf-stats { margin-top: 0; }
.bf-stats .hidden { display: none; }
.bf-msg { text-align: center; color: var(--muted); padding: 40px 0; }

.bf-big {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
@media (max-width: 600px) {
  .bf-big { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bf-tile { padding: 14px; }
  .bf-tile b { font-size: min(16px, 4.4vw); }
}
.bf-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.bf-tile b {
  font-family: var(--pixel);
  font-size: clamp(18px, 2.6vw, 24px);
  font-weight: normal;
  white-space: nowrap;
  color: var(--mint);
}
.bf-tile:first-child b { color: var(--pink); }
.bf-tile span { font-weight: 800; }

/* Recherche des stats d'un visiteur */
.bf-search { margin-top: 48px; }
.bf-search h2 { margin-bottom: 12px; }
.bf-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.bf-form input,
.bf-form select {
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.bf-form input { flex: 1 1 200px; min-width: 0; }
.bf-form select { flex: 0 1 auto; }
.bf-form select option { color: var(--text); background: var(--bg-2); }
.bf-form input:focus,
.bf-form select:focus { outline: 2px solid var(--mint); border-color: transparent; }
.bf-form :disabled { opacity: 0.45; cursor: not-allowed; }
.bf-form .btn:disabled { color: var(--muted); background: rgba(255, 255, 255, 0.12); box-shadow: none; transform: none; }
.bf-search-msg { min-height: 1.6em; margin: 14px 0; color: var(--muted); }
.bf-updated { margin: 12px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

/* Écran moyen : plus la place de centrer, le menu reprend sa disposition en ligne */
@media (max-width: 1520px) {
  .nav { display: flex; flex-wrap: wrap; justify-content: space-between; }
}

@media (max-width: 600px) {
  .nav { justify-content: center; }
  .logo { font-size: min(10px, 2.2vw); padding: 8px 12px; }
  .hero { padding: 48px 0 24px; }
  .now-grid .card { width: 100%; }
  .leaderboard { max-width: 540px; }
  .countdown div { min-width: 0; flex: 1; }
  .countdown b { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .blink, .tag, .error-code::before, .error-code::after { animation: none; }
  html { scroll-behavior: auto; }
}
