/* Concept : une étagère de cartouches. L'en-tête est l'enseigne de l'arcade,
   chaque jeu est une cartouche avec son étiquette, et on joue dans une console. */
:root {
  --fond: #edf0f8;
  --surface: #ffffff;
  --encre: #151935;
  --doux: #586083;
  --ligne: #d4d9ea;
  --accent: #ff6a2b;
  --accent-encre: #210d02;
  --accent-ombre: #b8410f;
  --boitier: #1b1f3b;
  --ombre: rgba(21, 25, 53, 0.10);
  --ombre-douce: rgba(21, 25, 53, 0.12);

  --f-titre: "Bungee", "Arial Black", Impact, sans-serif;
  --f-texte: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0f1229;
    --surface: #1a1e3d;
    --encre: #eceefe;
    --doux: #9ba2c9;
    --ligne: #2b3162;
    --accent: #ff7a3d;
    --accent-encre: #210d02;
    --accent-ombre: #a83c0c;
    --boitier: #070918;
    --ombre: rgba(0, 0, 0, 0.35);
    --ombre-douce: rgba(0, 0, 0, 0.40);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0f1229;
  --surface: #1a1e3d;
  --encre: #eceefe;
  --doux: #9ba2c9;
  --ligne: #2b3162;
  --accent: #ff7a3d;
  --accent-encre: #210d02;
  --accent-ombre: #a83c0c;
  --boitier: #070918;
  --ombre: rgba(0, 0, 0, 0.35);
  --ombre-douce: rgba(0, 0, 0, 0.40);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background-color: var(--fond);
  background-image: radial-gradient(var(--ligne) 1px, transparent 1.5px);
  background-size: 22px 22px;
  color: var(--encre);
  font-family: var(--f-texte);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding-block: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Boutons ---------- */
.bouton {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 0.95rem/1 var(--f-texte);
  padding: 11px 16px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background-color .15s ease;
}
.bouton svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.bouton-piece {
  background: var(--accent);
  color: var(--accent-encre);
  box-shadow: 0 3px 0 var(--accent-ombre);
}
.bouton-piece:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--accent-ombre); }
.bouton-piece:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-ombre); }
.bouton-discret {
  background: var(--surface);
  color: var(--encre);
  border-color: var(--ligne);
}
.bouton-discret:hover { border-color: var(--doux); }
.bouton .fente { width: 13px; height: 18px; stroke-width: 2; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- En-tête ---------- */
.entete {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 20px 32px;
  padding-block: 52px 30px;
}
.marque { min-width: 0; display: grid; gap: 12px; }
.surtitre {
  margin: 0;
  font: 600 0.75rem/1.2 var(--f-mono);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--doux);
}
.nom {
  margin: 0;
  font-family: var(--f-titre);
  font-weight: 400;
  font-size: clamp(2.3rem, 7vw, 4.4rem);
  line-height: 1;
  letter-spacing: .01em;
  text-shadow: .055em .055em 0 var(--accent);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.slogan { margin: 4px 0 0; max-width: 54ch; font-size: 1.08rem; color: var(--doux); }

/* ---------- Outils ---------- */
.outils {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding-block: 0 24px;
}
.recherche {
  flex: 1 1 240px; min-width: 0;
  display: flex; align-items: center; gap: 4px;
  background: var(--surface);
  border: 1.5px solid var(--ligne);
  border-radius: 10px;
  padding: 0 12px;
}
.recherche:focus-within { border-color: var(--accent); }
.recherche svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--doux); stroke-width: 2; stroke-linecap: round; }
.recherche input {
  flex: 1; min-width: 0;
  border: 0; outline: none; background: transparent;
  font: 500 1rem var(--f-texte); color: var(--encre);
  padding: 11px 6px;
}
.recherche input::placeholder { color: var(--doux); }
.filtres { display: flex; flex-wrap: wrap; gap: 6px; }
.puce {
  font: 600 0.72rem/1 var(--f-mono);
  letter-spacing: .08em; text-transform: uppercase;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--ligne);
  background: var(--surface);
  color: var(--doux);
  cursor: pointer;
}
.puce:hover { color: var(--encre); }
.puce[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: var(--fond); }
.tri select {
  font: 600 0.92rem var(--f-texte);
  color: var(--encre);
  background: var(--surface);
  border: 1.5px solid var(--ligne);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

/* ---------- Cartouches ---------- */
.grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 28px 22px;
}
.carte {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
  filter: drop-shadow(0 1px 0 var(--ombre)) drop-shadow(0 10px 14px var(--ombre-douce));
  transition: transform .18s ease;
}
.carte:hover { transform: translateY(-4px); }
.carte:focus-visible { outline-offset: 5px; }
.cartouche {
  height: 100%;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface);
  padding: 8px 12px 16px;
  border-radius: 0 0 12px 12px;
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%, 0 16px);
}
.stries {
  align-self: center;
  width: 44%; height: 10px;
  background: repeating-linear-gradient(90deg, var(--ligne) 0 2px, transparent 2px 7px);
  border-radius: 2px;
}
.etiquette {
  position: relative;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  border-radius: 6px;
  overflow: hidden;
  background: var(--c, #586083);
}
.etiquette img { display: block; width: 100%; height: 100%; object-fit: cover; }
.couv-auto {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 400 clamp(2.6rem, 7vw, 3.6rem)/1 var(--f-titre);
  color: rgba(255, 255, 255, .94);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .22);
  background:
    radial-gradient(120% 80% at 20% 10%, rgba(255,255,255,.28), transparent 60%),
    var(--c, #586083);
}
.couv-auto::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.10) 0 2px, transparent 2px 5px);
}
.badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 1; }
.badge {
  font: 600 0.66rem/1 var(--f-mono);
  letter-spacing: .1em; text-transform: uppercase;
  padding: 6px 8px; border-radius: 4px;
  background: rgba(255, 255, 255, .92); color: #151935;
}
.badge-nouveau { background: var(--accent); color: var(--accent-encre); }
.carte-texte { display: grid; gap: 6px; padding-inline: 2px; min-width: 0; }
.carte-titre { margin: 0; font-weight: 700; font-size: 1.22rem; line-height: 1.2; }
.carte-desc {
  margin: 0; font-size: .94rem; color: var(--doux);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.carte-pied {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 4px;
  font: 600 0.68rem/1.3 var(--f-mono);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--doux);
  font-variant-numeric: tabular-nums;
}
.vide { text-align: center; color: var(--doux); padding-block: 56px; font-size: 1.05rem; }

/* ---------- Lecteur ---------- */
.barre-lecteur {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  padding-block: 28px 18px;
}
.titre-jeu {
  flex: 1 1 200px; min-width: 0;
  margin: 0;
  font: 400 clamp(1.4rem, 3.6vw, 2.1rem)/1.1 var(--f-titre);
  text-wrap: balance;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.console {
  position: relative;
  background: var(--boitier);
  border-radius: 18px;
  padding: clamp(10px, 2vw, 22px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 18px 40px var(--ombre-douce);
}
.ecran {
  aspect-ratio: var(--ratio, 16 / 10);
  width: min(100%, max(260px, calc((100vh - 240px) * var(--rn, 1.6))));
  width: min(100%, max(260px, calc((100dvh - 240px) * var(--rn, 1.6))));
  max-width: 100%;
  margin-inline: auto;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.ecran iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.astuce {
  margin: 10px 0 0; text-align: center;
  font: 500 0.72rem/1.4 var(--f-mono); letter-spacing: .04em; color: var(--doux);
}

.console:fullscreen { border-radius: 0; padding: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.console:fullscreen .ecran { width: min(100vw, calc(100vh * var(--rn, 1.6))); border-radius: 0; }
.console:-webkit-full-screen { border-radius: 0; padding: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.console:-webkit-full-screen .ecran { width: min(100vw, calc(100vh * var(--rn, 1.6))); border-radius: 0; }

.console.faux-plein {
  position: fixed; inset: 0; z-index: 50;
  border-radius: 0;
  background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) calc(12px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px);
}
.console.faux-plein .ecran { width: min(100%, calc((100dvh - 90px) * var(--rn, 1.6))); border-radius: 0; }
.fermer-plein { background: rgba(255,255,255,.14); color: #fff; }
.fermer-plein:hover { background: rgba(255,255,255,.22); }

.fiche {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 28px 40px;
  padding-block: 30px 0;
}
.fiche-texte { min-width: 0; }
.fiche-description { margin: 0 0 16px; max-width: 62ch; font-size: 1.08rem; line-height: 1.6; }
.prompt {
  border: 1.5px dashed var(--ligne);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  max-width: 62ch;
}
.prompt summary { cursor: pointer; font-weight: 600; }
.prompt p { margin: 10px 0 2px; font: 500 .84rem/1.6 var(--f-mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--doux); }
.lien-seul {
  color: var(--encre); font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.fiche-infos { margin: 0; border-top: 1.5px solid var(--ligne); min-width: 0; }
.fiche-infos div {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px;
  padding-block: 11px;
  border-bottom: 1px solid var(--ligne);
}
.fiche-infos dt {
  font: 600 0.7rem/1.6 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--doux);
}
.fiche-infos dd { margin: 0; font-size: .95rem; }

/* ---------- Pied ---------- */
.pied {
  margin-top: 64px;
  padding-block: 22px 32px;
  border-top: 1.5px solid var(--ligne);
  font: 600 0.7rem/1.6 var(--f-mono);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--doux);
}

@media (max-width: 720px) {
  .entete { padding-block: 32px 24px; }
  .fiche { grid-template-columns: minmax(0, 1fr); }
  .barre-lecteur { padding-block: 18px 14px; }
  .titre-jeu { order: 3; flex-basis: 100%; }
  .barre-lecteur .bouton { padding: 10px 12px; font-size: .88rem; }
  .actions { margin-left: auto; }
}
@media (max-width: 480px) {
  .libelle { display: none; }
}

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