/* Jeux courts chiffrons.fr — feuille autonome.
   Mêmes jetons que /equilibrer/ et /jeu/ : fond clair, accent bleu, Geist. */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --sunk: #f1f0ed;
  --fg: #0c0a09;
  --muted: #52525b;
  --border: #e4e4e7;
  --accent: #1e40af;
  --accent-soft: #e3e9fb;
  --positif: #15803d;
  --positif-soft: #dcfce7;
  --negatif: #b91c1c;
  --negatif-soft: #fee2e2;
  --attention: #a16207;
  --attention-soft: #fef3c7;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: 'Geist', system-ui, sans-serif; font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
.mono { font-family: 'Geist Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
h1, h2 { text-wrap: balance; margin: 0; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.site-header { border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; background: var(--surface); }
.site-header nav { max-width: 1100px; margin: 0 auto; display: flex; gap: 1.25rem; align-items: center; font-family: 'Geist Mono', monospace; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a.brand { color: var(--fg); font-weight: 600; margin-right: auto; }

main { max-width: 760px; margin: 0 auto; padding: 2rem max(1rem, env(safe-area-inset-right, 0px)) 4rem max(1rem, env(safe-area-inset-left, 0px)); display: grid; gap: 1.5rem; }
.kicker { font-family: 'Geist Mono', monospace; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .4rem; display: block; }
.tete h1 { font-size: clamp(2rem, 6vw, 2.75rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.05; }
.chapo { margin: .5rem 0 0; color: var(--muted); font-size: 1.05rem; max-width: 56ch; }
.defi { margin: 0; border: 2px solid var(--fg); border-radius: 12px; padding: 12px 16px; background: var(--surface); }
.sansjs { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; background: var(--surface); margin: 0; }
.js .sansjs { display: none; }
.seuil { font-size: 13px; color: var(--muted); margin: 0; }
.th { font-family: 'Geist Mono', monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.plateau { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; display: grid; gap: 16px; min-height: 340px; align-content: start; }
.btn { border: 1px solid var(--fg); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-weight: 600; justify-self: start; }
.btn-sec { border: 1px solid var(--border); background: var(--surface); color: var(--fg); padding: 10px 18px; border-radius: 8px; font-weight: 500; text-decoration: none; }
.btn-sec:hover { border-color: var(--fg); }
.verdict { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.verdict.ok { color: var(--positif); }
.verdict.ko { color: var(--negatif); }

/* ---- Plus ou moins ---- */
.duel-tete { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.duel-tete b { color: var(--fg); font-size: 16px; }
.question { font-size: 21px; font-weight: 650; letter-spacing: -.015em; margin: 0; }
.duel { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: stretch; }
.ou { align-self: center; font-family: 'Geist Mono', monospace; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.duel-carte { text-align: left; border: 1.5px solid var(--border); background: var(--surface); color: var(--fg); border-radius: 12px; padding: 16px; display: grid; gap: 8px; align-content: space-between; min-height: 150px; transition: border-color .15s, transform .15s; }
.duel-carte:not([disabled]):hover { border-color: var(--fg); transform: translateY(-2px); }
.duel-carte[disabled] { cursor: default; }
.duel-titre { font-size: 17px; font-weight: 600; line-height: 1.3; }
.duel-cache { font-size: 22px; color: var(--muted); }
.duel-montant { font-size: 17px; font-weight: 600; }
.duel-carte.gagnante { border-color: var(--positif); background: var(--positif-soft); }
.duel-carte.perdante { opacity: .75; }
.duel-carte.choisie.perdante { border-color: var(--negatif); background: var(--negatif-soft); opacity: 1; }
.barres { display: grid; gap: 6px; }
.barre { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 76px; gap: 10px; align-items: center; font-size: 13px; }
.barre-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-t { height: 10px; background: var(--sunk); border-radius: 5px; overflow: hidden; }
.barre-t i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.barre .mono { text-align: right; }
.explique { margin: 0; font-size: 14.5px; }
.fiches { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }

/* ---- Fin de partie ---- */
.fin { display: grid; gap: 12px; border-top: 1px solid var(--border); padding-top: 14px; }
.fin-score { margin: 0; font-size: 15px; color: var(--muted); }
.fin-score .mono { font-size: 40px; font-weight: 600; color: var(--fg); letter-spacing: -.03em; margin-right: 6px; }
.fin-titre { margin: 0; font-size: 18px; font-weight: 650; }
.fin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.partage-liens { display: flex; flex-wrap: wrap; gap: .4rem; }
.partage-liens a, .partage-liens button { font-family: 'Geist Mono', monospace; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; border: 1px solid var(--border); background: var(--bg); color: var(--fg); padding: .45rem .7rem; border-radius: .375rem; text-decoration: none; }
.partage-liens a:hover, .partage-liens button:hover { border-color: var(--accent); color: var(--accent); }
.copie-msg { margin: 4px 0 0; font-size: 13px; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.copie-msg:empty { display: none; }

/* ---- Juste Milliard ---- */
.jm-tete { display: grid; gap: 4px; }
.jm-titre { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.jm-tete .question { font-size: 16px; font-weight: 500; color: var(--muted); }
.essais { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.essai { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; }
.essai .mono { font-weight: 600; font-size: 15px; }
.essai.v { background: var(--positif-soft); border-color: var(--positif); }
.essai.j { background: var(--attention-soft); border-color: var(--attention); }
.essai.r { background: var(--negatif-soft); border-color: var(--negatif); }
.essai.vide { color: var(--muted); border-style: dashed; }
.saisie { display: grid; gap: 8px; }
.saisie label { font-size: 15px; }
.saisie label b { font-size: 18px; }
.saisie input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }
.reperes { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.saisie-pied { display: flex; gap: 8px; }
.reponse { margin: 0; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats div { background: var(--sunk); border-radius: 8px; padding: 8px 10px; display: grid; }
.stats b { font-size: 20px; }
.stats span { font-size: 12px; color: var(--muted); }

/* ---- Autres jeux et méthode ---- */
.autres h2, .methode h2 { font-size: 1.1rem; margin-bottom: .75rem; }
.autres-liste { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.autre { display: grid; gap: 4px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); text-decoration: none; color: var(--fg); }
.autre:hover { border-color: var(--fg); }
.autre span { font-size: 13px; color: var(--muted); }
.methode { border-top: 1px solid var(--border); padding-top: 1.25rem; font-size: .9rem; color: var(--muted); }
.methode p { margin: 0 0 .75rem; }

@media (max-width: 560px) {
  .duel { grid-template-columns: minmax(0, 1fr); }
  .ou { justify-self: center; }
  .duel-carte { min-height: 0; }
  .barre { grid-template-columns: minmax(0, 1fr) 70px; }
  .barre-t { grid-column: 1 / -1; grid-row: 2; }
  .plateau { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- Le Débat : plateau télé sombre, seul élément « mis en scène » ---- */
.plateau-debat { gap: 14px; }
.studio { background: #101828; color: #f8fafc; border-radius: 14px; padding: 16px; display: grid; gap: 14px; position: relative; overflow: hidden; }
.studio::before { content: ""; position: absolute; inset: -40% 20% auto; height: 120%; background: radial-gradient(ellipse at top, rgba(59, 130, 246, .22), transparent 60%); pointer-events: none; }
.regie { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #94a3b8; position: relative; }
.direct { display: inline-flex; align-items: center; gap: 6px; color: #f8fafc; font-family: 'Geist Mono', monospace; text-transform: uppercase; letter-spacing: .06em; }
.direct i { width: 8px; height: 8px; border-radius: 50%; background: #e11d48; animation: direct 1.4s infinite; }
@keyframes direct { 50% { opacity: .3; } }
.jauge { display: grid; gap: 6px; position: relative; }
.jauge-l { display: flex; justify-content: space-between; font-size: 12.5px; color: #94a3b8; }
.jauge-l b { color: #f8fafc; }
.jauge-t { height: 10px; border-radius: 5px; background: rgba(225, 29, 72, .55); overflow: hidden; }
.jauge-t i { display: block; height: 100%; background: #3b82f6; transition: width .5s; }
.scene { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: start; position: relative; }
.pupitre { display: grid; justify-items: center; gap: 6px; text-align: center; font-size: 12px; color: #94a3b8; }
.pupitre svg { width: 76px; height: 76px; }
.pupitre .adv { fill: #e11d48; }
.pupitre .pup { fill: #94a3b8; opacity: .5; }
.bulle { margin: 0; background: #f8fafc; color: #0c0a09; border-radius: 14px; padding: 14px 16px; font-size: 18px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.chrono { height: 4px; border-radius: 2px; background: rgba(248, 250, 252, .15); overflow: hidden; }
.chrono i { display: block; height: 100%; background: #f8fafc; transform-origin: left; }
.ripostes { display: grid; gap: 8px; }
.riposte { text-align: left; border: 1.5px solid var(--border); background: var(--surface); color: var(--fg); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 15px; }
.riposte:not([disabled]):hover { border-color: var(--fg); }
.riposte[disabled] { cursor: default; }
.riposte .lettre { font-weight: 600; color: var(--muted); font-size: 13px; padding-top: 1px; }
.riposte.juste { border-color: var(--positif); background: var(--positif-soft); }
.riposte.fausse { border-color: var(--negatif); background: var(--negatif-soft); }
.riposte.terne { opacity: .6; }
.sans-chrono { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.verdict-debat { display: grid; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.verdict-debat p { margin: 0; }
.piege { font-family: 'Geist Mono', monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lecons { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
@media (max-width: 560px) {
  .scene { grid-template-columns: minmax(0, 1fr); }
  .pupitre { grid-auto-flow: column; justify-content: start; align-items: center; }
  .pupitre svg { width: 40px; height: 40px; }
  .bulle { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .direct i { animation: none; } }

/* ---- Page /jouer/ ---- */
main.hub { max-width: 1000px; }
.hub-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.hub-carte { display: grid; gap: 10px; align-content: start; background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px; padding: 18px; color: var(--fg); text-decoration: none; transition: border-color .15s, transform .15s; }
.hub-carte:hover { border-color: var(--fg); transform: translateY(-2px); }
.hub-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.hub-titre { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.hub-texte { color: var(--muted); font-size: 14.5px; }
.hub-pied { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.hub-record { font-family: 'Geist Mono', monospace; font-size: 12px; color: var(--attention); }
.hub-cta { background: var(--fg); color: var(--bg); padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.hub-note { line-height: 1.9; }
.tag { display: inline-flex; font-family: 'Geist Mono', monospace; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.tag.chiffre { background: var(--accent-soft); color: var(--accent); }
.tag.simule { background: #f1eafe; color: #6d28d9; }
@media (max-width: 640px) { .hub-grille { grid-template-columns: minmax(0, 1fr); } }
