:root {
  --fond: #0b0618;
  --fond2: #1a0b3a;
  --texte: #efe9ff;
  --doux: #a99bd6;
  --rose: #ff2bd6;
  --cyan: #22e4ff;
  --jaune: #ffe14d;
  --vert: #5dff9a;
  --bord: #3b2a6b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--fond); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--texte);
  font: 22px/1.3 'VT323', ui-monospace, monospace;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 43, 214, 0.25), transparent 55%),
    radial-gradient(ellipse at 50% 120%, rgba(34, 228, 255, 0.18), transparent 50%),
    linear-gradient(180deg, var(--fond2), var(--fond) 60%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Lignes de balayage et léger scintillement façon tube cathodique. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
  animation: scintille 6s infinite steps(1);
  z-index: 10;
}

@keyframes scintille { 0%, 100% { opacity: 1; } 47% { opacity: 0.85; } 48% { opacity: 1; } }

/* Pied de page en bas de l'écran si la page est courte, en fin de page sinon. */
.ecran {
  max-width: 1200px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.ecran > main { flex: 1; }

/* ---------- Fronton ---------- */

.marquee { text-align: center; padding: 28px 0 8px; }

.credits {
  display: flex;
  justify-content: space-between;
  margin: 0 0 18px;
  font: 10px 'Press Start 2P', monospace;
  color: var(--cyan);
  letter-spacing: 1px;
}
.credits .hi { color: var(--jaune); }

.titre {
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  font-weight: normal;
  line-height: 1.15;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  /* Chaque mot est un bloc : le même écart entre tous les mots. */
  gap: 0 0.45em;
}
.titre .t1, .titre .t2 { font-size: clamp(26px, 7vw, 64px); }
.titre .t1 { color: var(--cyan); text-shadow: 0 0 6px var(--cyan), 0 0 22px rgba(34, 228, 255, 0.7), 4px 4px 0 #2b0f5e; }
.titre .t2 { color: var(--rose); text-shadow: 0 0 6px var(--rose), 0 0 22px rgba(255, 43, 214, 0.7), 4px 4px 0 #2b0f5e; }
.titre .t3 {
  font-size: clamp(30px, 8vw, 72px);
  color: var(--jaune);
  text-shadow: 0 0 8px var(--jaune), 4px 4px 0 #2b0f5e;
  display: inline-block;
  animation: saute 1.2s infinite cubic-bezier(.3, 1.6, .5, 1);
}

@keyframes saute { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px) rotate(8deg); } }

.insert {
  margin: 18px 0 6px;
  font: 12px 'Press Start 2P', monospace;
  color: var(--jaune);
  animation: clignote 1.1s infinite steps(1);
}
@keyframes clignote { 50% { opacity: 0; } }

.sous-titre { margin: 4px 0 0; color: var(--doux); }

/* ---------- Commandes ---------- */

.commandes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 26px 0 18px;
}

.filtres { display: flex; flex-wrap: wrap; gap: 8px; }

button { font: inherit; color: inherit; cursor: pointer; }

.filtres button, .bouton-hasard {
  font: 10px 'Press Start 2P', monospace;
  padding: 10px 12px;
  border-radius: 4px;
  border: 2px solid var(--bord);
  background: rgba(22, 13, 46, 0.85);
  transition: transform .1s, border-color .15s, box-shadow .15s;
}
.filtres button[aria-pressed="true"] {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 10px rgba(34, 228, 255, 0.45);
}
.filtres button:hover { border-color: var(--cyan); }

.bouton-hasard {
  border-color: var(--jaune);
  color: var(--fond);
  background: var(--jaune);
  box-shadow: 0 4px 0 #a88c00, 0 0 18px rgba(255, 225, 77, 0.45);
}
.bouton-hasard:active { transform: translateY(3px); box-shadow: 0 1px 0 #a88c00; }
.emoji-texte { font: 18px/1 system-ui, 'Segoe UI Emoji', 'Apple Color Emoji', sans-serif; vertical-align: -3px; margin-right: 4px; }

button:focus-visible, a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

/* ---------- Cartouches ---------- */

.grille {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 22px;
}

.carte { --c: var(--rose); animation: apparait .45s backwards cubic-bezier(.2, 1.4, .5, 1); }
@keyframes apparait { from { opacity: 0; transform: translateY(24px) scale(.95); } }

.cartouche {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: 14px 14px 6px 6px;
  background: linear-gradient(180deg, #2a2340, #17122a);
  border: 3px solid #0a0714;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), 0 6px 0 #07040f, 0 0 0 1px var(--bord);
  padding: 12px 12px 10px;
  transition: transform .15s, box-shadow .15s;
}
/* Encoches du haut de la cartouche. */
.cartouche::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  width: 46%;
  height: 8px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(90deg, #0a0714 0 6px, transparent 6px 12px);
  border-radius: 0 0 4px 4px;
}
.cartouche:hover, .cartouche:focus-visible {
  transform: translateY(-6px) rotate(-1deg);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), 0 12px 0 #07040f, 0 0 0 2px var(--c), 0 0 28px color-mix(in srgb, var(--c) 55%, transparent);
}
.cartouche[aria-disabled="true"] { filter: grayscale(.7); cursor: default; }

.etiquette {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 45%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0 10px, transparent 10px 20px),
    linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 40%, #12002e));
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
}
.vignette { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.emoji { font-size: 64px; line-height: 1; filter: drop-shadow(3px 4px 0 rgba(0, 0, 0, 0.35)); transition: transform .2s; }
.cartouche:hover .emoji { transform: scale(1.15) rotate(-6deg); }

.badge {
  position: absolute;
  top: 8px;
  right: -30px;
  transform: rotate(35deg);
  width: 120px;
  text-align: center;
  padding: 3px 0;
  font: 8px 'Press Start 2P', monospace;
  color: var(--fond);
  background: var(--vert);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.badge.maj { background: var(--cyan); }
.badge.bientot { background: var(--jaune); }

.infos { display: flex; flex-direction: column; gap: 6px; flex: 1; padding-top: 10px; }
.nom { font: 12px/1.4 'Press Start 2P', monospace; color: #fff; }
.description { color: var(--doux); font-size: 20px; flex: 1; }
.pied { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 19px; }
.auteur { color: var(--doux); }
.jouer { font: 9px 'Press Start 2P', monospace; color: var(--c); text-shadow: 0 0 6px var(--c); white-space: nowrap; }
.cartouche:hover .jouer { animation: clignote .6s infinite steps(1); }

/* ---------- Divers ---------- */

.vide { text-align: center; margin: 60px 0; color: var(--doux); }
.vide .gros { font: 18px 'Press Start 2P', monospace; color: var(--rose); text-shadow: 0 0 10px var(--rose); line-height: 2.4; }

footer { margin-top: 48px; text-align: center; color: var(--doux); font-size: 19px; }
footer p { margin: 0; }
footer a { color: var(--cyan); }

.secoue { animation: secoue .4s; }
@keyframes secoue { 25% { transform: translateX(-6px) rotate(-2deg); } 75% { transform: translateX(6px) rotate(2deg); } }

@media (max-width: 520px) {
  .credits { font-size: 8px; }
  .commandes { flex-direction: column; align-items: stretch; }
  .bouton-hasard { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
