/* Guess What — style « Plateau TV » (FAIL Studio) */
:root {
  --nuit: #10173A;
  --nuit2: #172150;
  --carte: #1E2A5A;
  --jaune: #FFD23F;
  --jaune-ombre: #B8901F;
  --orange: #FF7A3D;
  --creme: #FFF4E6;
  --rouge: #E8412C;
  --doux: rgba(255, 244, 230, .7);
  --discret: rgba(255, 244, 230, .5);
  --trait: rgba(255, 244, 230, .15);
  --titre: 'Bricolage Grotesque', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--nuit); color: var(--creme); }
body { font-family: var(--titre); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.jaune { color: var(--jaune); }
.orange { color: var(--orange); }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }
.ecran { display: none; padding: 20px 18px calc(28px + env(safe-area-inset-bottom)); flex-direction: column; gap: 18px; min-height: 100vh; min-height: 100dvh; }
.ecran.actif { display: flex; animation: entree .35s ease both; }
@keyframes entree { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .ecran.actif { animation: none; } }

.etiquette { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .14em; margin: 0; }

/* ---------- Menu ---------- */
.logo-bloc { padding: 10px 4px 0; display: flex; flex-direction: column; gap: 6px; }
.logo { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 40px; line-height: 1; }
.logo-q { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: var(--jaune); color: var(--nuit); font-size: 34px; box-shadow: 4px 4px 0 var(--orange); animation: hoche 3.2s ease-in-out infinite; }
@keyframes hoche { 0%, 86%, 100% { transform: rotate(0); } 90% { transform: rotate(-12deg); } 95% { transform: rotate(9deg); } }
.devise { margin: 0; font-size: 16px; color: var(--doux); }

.carte-defi { text-align: left; border: 0; cursor: pointer; color: var(--nuit); background: var(--jaune); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: 6px 6px 0 var(--orange); margin-right: 6px; transition: transform .15s; }
.carte-defi:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--orange); }
.defi-haut { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .14em; }
.defi-titre { font-size: 26px; font-weight: 800; line-height: 1.05; }
.defi-bas { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.fleche { font-weight: 800; font-size: 20px; }
.mini-cases { display: flex; gap: 4px; margin-top: 8px; }
.mini-cases i { width: 16px; height: 16px; display: inline-block; }
.carte-defi .c-top { background: var(--nuit); }
.carte-defi .c-bof { background: rgba(16, 23, 58, .22); }

.carte-shuffle { text-align: left; cursor: pointer; background: var(--carte); border: 2px solid var(--orange); padding: 14px 16px; display: flex; align-items: center; gap: 14px; transition: transform .15s; }
.carte-shuffle:active { transform: scale(.98); }
.shuffle-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.shuffle-titre { font-size: 18px; font-weight: 800; line-height: 1.1; }
.shuffle-sous { font-size: 13px; color: var(--doux); }

.famille { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.famille h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: .16em; font-weight: 700; }
.famille h2::before { content: ""; width: 10px; height: 10px; background: currentColor; }
.famille h2::after { content: ""; flex: 1; height: 1px; background: var(--trait); }
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tuile { position: relative; text-align: left; cursor: pointer; background: var(--carte); border: 0; border-bottom: 4px solid var(--c); padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 6px; min-height: 120px; transition: transform .15s, background .15s; }
.tuile:hover { background: #24326A; }
.tuile:active { transform: scale(.97); }
.tuile svg { width: 32px; height: 32px; fill: var(--c); }
.tuile .pre { font-size: 11px; color: var(--discret); }
.tuile .nom { color: var(--creme); font-size: 21px; font-weight: 800; line-height: 1; text-transform: uppercase; }
.tuile .bas { font-family: var(--mono); font-size: 10px; color: var(--discret); margin-top: auto; }
.tuile .bas.rec { color: var(--c); }
.badge { position: absolute; top: 10px; right: 10px; font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .1em; padding: 3px 5px; background: var(--c); color: var(--nuit); }
.badge.live { background: var(--rouge); color: var(--creme); }
.pied { margin: 10px 0 0; text-align: center; font-family: var(--mono); font-size: 11px; color: var(--discret); }
.pied a { text-decoration: none; border-bottom: 1px solid var(--discret); }

/* ---------- Partie ---------- */
.barre { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn-retour { width: 44px; height: 44px; margin-left: -10px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; cursor: pointer; color: var(--doux); }
.barre-titre { flex: 1; font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 6px; text-transform: uppercase; }
.barre-titre .mini-q { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; background: var(--jaune); color: var(--nuit); font-size: 15px; }
.barre-score { font-family: var(--mono); font-size: 12px; display: flex; gap: 12px; color: var(--doux); }
.barre-score .jaune { font-weight: 700; }
.vies { display: inline-flex; gap: 4px; align-items: center; }
.vies i { width: 10px; height: 10px; background: var(--orange); display: inline-block; }
.vies i.perdue { background: var(--trait); }

.progression { display: flex; gap: 4px; margin-top: -6px; }
.progression span { flex: 1; height: 6px; background: var(--trait); transition: background .3s; }
.progression span.fait { background: var(--jaune); }
.progression span.rate { background: var(--orange); }
.progression span.encours { background: var(--creme); }

.q-entete { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.puce { align-self: flex-start; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; border: 1px solid rgba(255, 244, 230, .35); padding: 4px 8px; text-transform: uppercase; }
.q-titre { margin: 0; font-size: 36px; line-height: 1.02; font-weight: 800; overflow-wrap: anywhere; }
.q-titre.long { font-size: 28px; }
.q-precision { margin: 0; font-size: 14px; color: var(--discret); }
.q-precision:empty { display: none; }
.q-question { margin: 0; font-size: 17px; color: var(--doux); }

.saisie { display: flex; flex-direction: column; gap: 14px; margin-top: auto; }
.saisie-valeur { display: flex; align-items: center; gap: 8px; }
.pas { width: 52px; height: 52px; flex: none; border: 2px solid var(--trait); background: var(--carte); color: var(--creme); font-size: 26px; font-weight: 800; cursor: pointer; }
.pas:active { background: var(--nuit2); }
.valeur-champ { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 8px; min-width: 0; border-bottom: 3px solid var(--jaune); padding-bottom: 4px; cursor: text; }
#champ { width: 100%; min-width: 0; background: none; border: 0; color: var(--jaune); font-family: var(--titre); font-weight: 800; font-size: 64px; line-height: 1; text-align: right; padding: 0; }
#champ:focus { outline: none; }
.unite { font-size: 20px; font-weight: 500; flex: none; max-width: 45%; }
.valeur-champ.sans-unite #champ { text-align: center; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; background: linear-gradient(90deg, var(--orange) 0 var(--p, 50%), var(--trait) var(--p, 50%)); }
input[type=range]::-moz-range-track { height: 8px; background: var(--trait); }
input[type=range]::-moz-range-progress { height: 8px; background: var(--orange); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -11px; background: var(--jaune); border: 0; box-shadow: 3px 3px 0 var(--orange); }
input[type=range]::-moz-range-thumb { width: 30px; height: 30px; background: var(--jaune); border: 0; border-radius: 0; box-shadow: 3px 3px 0 var(--orange); }
input[type=range]:focus-visible { outline: 2px solid var(--creme); outline-offset: 4px; }
.curseur-bornes, .j-bornes { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--discret); margin-top: -8px; }

.btn-principal { height: 56px; border: 0; background: var(--jaune); color: var(--nuit); font-family: var(--titre); font-weight: 800; font-size: 18px; box-shadow: 0 6px 0 var(--jaune-ombre); cursor: pointer; margin-bottom: 6px; transition: transform .1s, box-shadow .1s; }
.btn-principal:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--jaune-ombre); }
.btn-principal:disabled { opacity: .5; cursor: wait; }
.btn-indice { align-self: center; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; background: none; border: 1px dashed rgba(255, 244, 230, .35); color: var(--doux); font-family: var(--titre); font-weight: 800; font-size: 15px; cursor: pointer; margin-top: -4px; }
.btn-indice svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-indice small { font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--orange); }
.btn-indice:hover { border-color: var(--jaune); color: var(--creme); }
.btn-indice:disabled { display: none; }
.indice { margin-top: 6px; border: 1px dashed var(--jaune); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; animation: entree .3s ease both; }
.indice[hidden] { display: none; }
.indice .etiquette { color: var(--jaune); }
.indice p { margin: 0; font-size: 15px; line-height: 1.35; }
.btn-second { height: 50px; border: 2px solid var(--trait); background: none; font-weight: 800; font-size: 16px; cursor: pointer; }

/* Réponse */
.revelation { display: flex; flex-direction: column; gap: 14px; }
.revelation[hidden], .carte-monde[hidden], .saisie[hidden] { display: none; }
.carte-monde { background: var(--nuit2); border: 1px solid var(--trait); }
.carte-monde canvas { display: block; width: 100%; height: auto; }
.rev-ligne { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.rev-nombre { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.grand { font-size: 96px; line-height: .85; font-weight: 800; letter-spacing: -.02em; }
.grand.moyen { font-size: 68px; }
.grand.petit { font-size: 52px; }
.rev-unite { font-size: 22px; font-weight: 500; }
.tampon { flex: none; transform: rotate(-6deg) scale(.4); opacity: 0; border: 3px solid var(--orange); color: var(--orange); font-family: var(--mono); font-weight: 700; font-size: 19px; padding: 6px 10px; margin-bottom: 8px; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1), opacity .2s; }
.tampon.on { transform: rotate(-6deg) scale(1); opacity: 1; }
.tampon.top { border-color: var(--jaune); color: var(--jaune); }

.jauge { position: relative; height: 66px; margin-top: 4px; }
.j-axe { position: absolute; left: 0; right: 0; top: 50px; height: 2px; background: rgba(255, 244, 230, .3); }
.j-graduations { position: absolute; left: 0; right: 0; top: 52px; height: 8px; }
.j-graduations i { position: absolute; top: 0; width: 2px; height: 8px; background: rgba(255, 244, 230, .3); }
.j-mark { position: absolute; top: 18px; width: 4px; height: 32px; margin-left: -2px; transition: left .9s cubic-bezier(.2, .8, .2, 1); }
.j-mark-toi { background: var(--orange); }
.j-mark-rep { background: var(--jaune); }
.j-etiq { position: absolute; top: 0; transform: translateX(-50%); font-family: var(--mono); font-size: 11px; white-space: nowrap; transition: left .9s cubic-bezier(.2, .8, .2, 1); }
.j-toi { color: var(--orange); }
.j-rep { color: var(--jaune); font-weight: 700; }
.j-ecart { position: absolute; top: 31px; height: 6px; background: repeating-linear-gradient(90deg, rgba(255, 244, 230, .5) 0 4px, transparent 4px 8px); transition: left .9s cubic-bezier(.2, .8, .2, 1), width .9s cubic-bezier(.2, .8, .2, 1); }
.verdict { margin: 0; font-size: 16px; }
.verdict strong { color: var(--jaune); }

.info { background: var(--carte); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: 6px 6px 0 var(--orange); margin: 0 6px 10px 0; }
.info + .info { margin-top: 8px; box-shadow: 6px 6px 0 rgba(255, 244, 230, .18); }
.info .etiquette { color: var(--jaune); }
.info p { margin: 0; font-size: 16px; line-height: 1.35; }
.note { font-family: var(--mono); font-size: 10px; color: var(--discret); margin: 0; }

/* ---------- Fin ---------- */
.fin-titre { margin: 0; font-size: 34px; line-height: 1.05; font-weight: 800; }
.fin-score { display: flex; align-items: baseline; gap: 8px; }
.fin-cases { display: flex; flex-wrap: wrap; gap: 5px; }
.fin-cases i { width: 24px; height: 24px; display: inline-block; }
.c-top { background: var(--jaune); }
.c-moy { background: var(--orange); }
.c-bof { background: rgba(255, 244, 230, .18); }
.fin-record { margin: 0; font-size: 16px; color: var(--doux); }
.fin-boutons { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.fin-copie { margin: 0; text-align: center; font-size: 14px; color: var(--jaune); min-height: 20px; }

.confetti { position: fixed; top: -10px; width: 9px; height: 9px; pointer-events: none; z-index: 9; animation: tombe linear forwards; }
@keyframes tombe { to { transform: translateY(105vh) rotate(540deg); } }

@media (min-width: 520px) {
  .ecran { padding-top: 32px; }
}
