/* Riposte : fonderie de nuit. Fer sombre riveté, filets de cuivre, fonte orange pour l'action principale.
   Panneaux et cadres peints par Codex (img/cadre-*), boutons en CSS dans la palette (leçon de Lamha : un bouton étiré
   en 9 parties se coupe sur les petits écrans). Police : Sofia Sans Extra Condensed (OFL), capitales serrées, comme
   des lettres frappées dans le métal. Pensé téléphone d'abord : 740 × 360 en paysage. */
@font-face { font-family: 'Sofia Condensed'; src: url(polices/sofia-condensed.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
:root {
  --fonte: #ff8a2a; --fonte-vive: #ffc66b; --cuivre: #c47a42; --laiton: #e8b630; --acier: #8fb3d9; --rouille: #d9553a;
  --texte: #f6e6d2; --doux: rgba(246, 230, 210, .64); --nuit: #0d0806; --fer: rgba(24, 18, 15, .9);
  --marge: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--nuit); color: var(--texte);
  font: 500 17px/1.2 'Sofia Condensed', system-ui, sans-serif; font-synthesis: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: none; }
img { pointer-events: none; -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; padding: 0; border: 0; background: none; }
[hidden] { display: none !important; }
#jeu, #jeu-fond { position: fixed; inset: 0; display: block; touch-action: none; }
#jeu-fond { pointer-events: none; }
body:not(.en-partie) #jeu, body:not(.en-partie) #jeu-fond { visibility: hidden; }

/* Fond des menus : la fonderie (Codex), voilée. */
#fond-menus { position: fixed; inset: 0; z-index: 1; }
#fond-menus .illustration, #titre .illustration { position: absolute; inset: 0; background: url(img/fond.webp) center / cover no-repeat; }
#fond-menus .voile { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, rgba(13, 8, 6, .35), rgba(13, 8, 6, .9) 78%); }
body.en-partie #fond-menus { display: none; }

/* ---------- Boutons ---------- */
/* Bouton principal : une plaque de fonte en fusion, filet clair à l'intérieur, ombre basse qui s'écrase à l'appui. */
.bouton-vif { position: relative; min-height: 50px; padding: 0 30px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 4px; background: linear-gradient(#ffb04a, #e86a1c 55%, #b9440f);
  box-shadow: inset 0 0 0 1px rgba(255, 236, 200, .55), inset 0 0 0 3px rgba(120, 40, 8, .55), 0 4px 0 #5e2208, 0 6px 18px rgba(255, 110, 30, .35);
  font-weight: 800; font-size: 21px; letter-spacing: .12em; text-transform: uppercase; color: #fff8ee; text-shadow: 0 1px 2px rgba(80, 20, 0, .8);
  transition: transform .06s, box-shadow .06s; }
.bouton-vif.grand { min-height: 60px; padding: 0 56px; font-size: 27px; }
.bouton-vif.petit { min-height: 40px; padding: 0 16px; font-size: 16px; }
.bouton-vif .ic { width: 24px; height: 24px; object-fit: contain; margin-left: -6px; }
.bouton-vif:disabled { filter: grayscale(1) brightness(.6); cursor: default; }
.bouton-vif.appuye, .bouton-vif:active { transform: translateY(3px); box-shadow: inset 0 0 0 1px rgba(255, 236, 200, .55), inset 0 0 0 3px rgba(120, 40, 8, .55), 0 1px 0 #5e2208, 0 2px 10px rgba(255, 110, 30, .3); }
.bouton-filet { min-height: 44px; padding: 0 18px; border: 1px solid rgba(196, 122, 66, .6); border-radius: 4px; background: rgba(24, 18, 15, .78);
  font-weight: 700; font-size: 18px; letter-spacing: .08em; text-transform: uppercase; color: var(--texte); transition: transform .06s; }
.bouton-filet.petit { min-height: 36px; font-size: 15px; padding: 0 12px; }
.bouton-filet.appuye, .bouton-filet:active { transform: scale(.97); border-color: var(--fonte); }
.lien-texte { color: var(--doux); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
.rond { position: absolute; width: 50px; height: 50px; display: grid; place-items: center; padding: 0;
  background: url(img/cadre-rond.webp) center / contain no-repeat; }
.rond .ic { width: 22px; height: 22px; object-fit: contain; }
.rond.reglages { top: var(--marge); right: var(--marge); }
.rond.appuye { transform: scale(.94); }
.ic { display: block; }

/* ---------- Panneaux : plaques de fer riveté en CSS (leçon de Lamha : un cadre peint étiré en 9 parties se coupe) ---------- */
.panneau { border: 1px solid rgba(196, 122, 66, .6); border-radius: 5px;
  background: radial-gradient(circle at 9px 9px, #d08a52 0 2.5px, #5a3418 3px, transparent 4px), radial-gradient(circle at calc(100% - 9px) 9px, #d08a52 0 2.5px, #5a3418 3px, transparent 4px),
    radial-gradient(circle at 9px calc(100% - 9px), #d08a52 0 2.5px, #5a3418 3px, transparent 4px), radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), #d08a52 0 2.5px, #5a3418 3px, transparent 4px),
    linear-gradient(#2a201b, #17110e);
  box-shadow: inset 0 0 0 4px rgba(13, 9, 7, .9), inset 0 0 0 5px rgba(232, 120, 40, .45), 0 6px 18px rgba(0, 0, 0, .55);
  padding: 18px 22px; }
.panneau h3 { margin: 0 0 8px; font-size: 15px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--fonte); }
.pile { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.centre { margin: auto; }
.texte-centre { text-align: center; }
.regle { margin: 4px 0; color: var(--doux); font-size: 17px; text-align: center; }
.ligne-boutons { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }

/* ---------- Écrans ---------- */
.ecran { position: fixed; inset: 0; z-index: 10; }
.ecran.voile { z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(8, 5, 4, .66); }
.barre-haut { position: absolute; top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 var(--marge); }
.barre-haut h2 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.sous-titre { color: var(--doux); font-size: 16px; letter-spacing: .06em; }
.retour { width: 46px; height: 46px; display: grid; place-items: center; padding: 0; background: url(img/cadre-rond.webp) center / contain no-repeat; }
.retour .ic { width: 20px; height: 20px; object-fit: contain; }
.compte-etoiles { margin-left: auto; margin-right: 64px; display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 22px; color: var(--laiton); font-variant-numeric: tabular-nums; }
.compte-etoiles::before, .etoile { content: ''; display: inline-block; width: 16px; height: 16px; background: currentColor;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.contenu { position: absolute; top: 64px; left: var(--marge); right: var(--marge); bottom: var(--marge); display: flex; gap: 14px; justify-content: center; align-items: flex-start; }
.contenu.centre-col { flex-direction: column; align-items: center; justify-content: center; gap: 16px; }

/* Titre */
#titre { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5vh; opacity: 0; transition: opacity .45s; }
#titre.ouvert { opacity: 1; }
#titre.sortie { opacity: 0; pointer-events: none; }
#titre .illustration::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(13, 8, 6, .15), rgba(13, 8, 6, .7)); }
#titre .titre-jeu { position: relative; width: min(78vw, 720px); max-height: 34vh; object-fit: contain; filter: drop-shadow(0 6px 24px rgba(255, 120, 30, .35)); }
#titre .bas { position: relative; }

/* Menu : le titre, puis les modes en lingots coulés, empilés et centrés (forme propre à Riposte). */
#menu { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.4vh; }
.titre-menu { width: min(46vw, 420px); max-height: 19vh; object-fit: contain; filter: drop-shadow(0 4px 16px rgba(255, 120, 30, .3)); }
.modes { display: flex; flex-direction: column; gap: 9px; align-items: stretch; width: min(540px, 74vw); }
.mode { position: relative; min-height: 58px; display: flex; align-items: center; gap: 14px; padding: 6px 30px; text-align: left;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 100%, 0 100%);
  background: linear-gradient(#3a2e27, #1d1612 60%, #120d0b);
  box-shadow: inset 0 1px 0 rgba(255, 220, 180, .25), inset 0 -3px 0 rgba(0, 0, 0, .55);
  transition: transform .08s, filter .08s; }
.mode::after { content: ''; position: absolute; left: 14px; right: 14px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(232, 140, 70, .7), transparent); }
.mode .ic { width: 34px; height: 34px; object-fit: contain; flex: none; }
.mode .txt { display: flex; flex-direction: column; min-width: 0; }
.mode b { font-size: 25px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #fff; line-height: 1; }
.mode small { font-size: 15px; line-height: 1.1; color: var(--doux); }
.mode em { font-style: normal; font-weight: 800; font-size: 17px; color: var(--laiton); margin-left: auto; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
/* Le mode principal : un lingot encore en fusion. */
.mode.principal { background: linear-gradient(#ffb04a, #e86a1c 55%, #a53d0d); box-shadow: inset 0 1px 0 rgba(255, 240, 210, .7), inset 0 -3px 0 rgba(90, 30, 5, .6); filter: drop-shadow(0 0 14px rgba(255, 120, 30, .5)); }
.mode.principal b { color: #fff8ee; text-shadow: 0 1px 2px rgba(80, 20, 0, .8); }
.mode.principal small { color: rgba(255, 245, 230, .9); }
.mode.principal em { color: #fff3d6; }
.mode.appuye { transform: translateY(2px) scale(.99); filter: brightness(1.15); }
#liens-plateforme { position: absolute; left: var(--marge); bottom: var(--marge); display: flex; align-items: center; gap: 10px; }
.lien { height: 22px; padding: 0 9px; border-radius: 3px; background: #000; font-size: 12px; letter-spacing: .04em; color: rgba(255, 255, 255, .8); position: relative; }
.lien::after { content: ''; position: absolute; inset: -10px -4px; }

/* Campagne : cinq rangées d'ateliers, chacune à sa couleur. */
#echelle { display: flex; flex-direction: column; gap: 6px; width: min(100%, 780px); max-height: 100%; overflow-y: auto; touch-action: pan-y; padding: 2px 64px 2px 2px; }
.atelier { display: grid; grid-template-columns: 150px repeat(8, 1fr); gap: 6px; align-items: stretch; }
.atelier-nom { display: flex; flex-direction: column; justify-content: center; padding: 0 8px; border-left: 4px solid var(--t); background: linear-gradient(90deg, color-mix(in srgb, var(--t) 26%, transparent), transparent); }
.atelier-nom b { font-size: 17px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--t); line-height: 1; }
.atelier-nom small { font-size: 13px; color: var(--doux); }
.niveau { position: relative; min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1px solid color-mix(in srgb, var(--t) 55%, transparent); border-radius: 4px; background: rgba(24, 18, 15, .84); font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.niveau .etoiles { display: flex; gap: 1px; }
.niveau .etoile { width: 9px; height: 9px; background: rgba(255, 255, 255, .2); }
.niveau .etoile.oui { background: var(--laiton); }
.niveau.courant { border-color: var(--fonte); box-shadow: 0 0 0 1px var(--fonte), 0 0 14px rgba(255, 130, 40, .5); }
.niveau.verrou { color: rgba(255, 255, 255, .28); }
.niveau.verrou img { width: 16px; height: 16px; opacity: .45; }
.niveau.tuto img { width: 22px; height: 22px; }
.niveau.appuye { transform: scale(.95); }

/* Duel : quatre rivaux côte à côte. */
#niveaux-duel { display: flex; gap: 12px; justify-content: center; }
.carte-niveau { width: 158px; min-height: 170px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 6px 4px;
  border: 1px solid rgba(196, 122, 66, .6); border-radius: 5px;
  background: radial-gradient(circle at 9px 9px, #d08a52 0 2.5px, #5a3418 3px, transparent 4px), radial-gradient(circle at calc(100% - 9px) 9px, #d08a52 0 2.5px, #5a3418 3px, transparent 4px),
    radial-gradient(circle at 9px calc(100% - 9px), #d08a52 0 2.5px, #5a3418 3px, transparent 4px), radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), #d08a52 0 2.5px, #5a3418 3px, transparent 4px),
    linear-gradient(#2a201b, #17110e);
  box-shadow: inset 0 0 0 4px rgba(13, 9, 7, .9), inset 0 0 0 5px rgba(232, 120, 40, .45), 0 6px 18px rgba(0, 0, 0, .55); padding: 16px 8px 14px; }
.carte-niveau .jauge { display: flex; gap: 3px; margin: 4px 0 2px; }
.carte-niveau .jauge i { width: 14px; height: 14px; border-radius: 2px; background: rgba(255, 255, 255, .14); }
.carte-niveau .jauge i.oui { background: linear-gradient(#ffc66b, #e86a1c); }
.carte-niveau b { font-size: 22px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.carte-niveau small { font-size: 15px; color: var(--doux); line-height: 1.15; }
.carte-niveau em { font-style: normal; margin-top: auto; color: var(--laiton); font-weight: 700; font-size: 15px; }
.carte-niveau.appuye { transform: scale(.97); }

/* Multijoueur */
.contenu.deux { align-items: stretch; }
#sans-compte { max-width: 470px; align-self: center; }
.pile-multi { display: flex; gap: 14px; align-items: stretch; width: 100%; max-width: 720px; }
.pile-multi > .panneau:first-child { flex: 0 0 250px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.pile-multi .liste { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.sous-bouton { margin: 8px 0 0; font-size: 15px; color: var(--doux); text-align: center; }
#liste-amis { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; touch-action: pan-y; padding-right: 2px; }
.ami { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 4px 8px; border: 1px solid rgba(196, 122, 66, .3); border-radius: 4px; background: rgba(10, 7, 6, .5); text-align: left; width: 100%; }
.ami.hors-ligne { opacity: .5; }
.ami-av { flex: 0 0 34px; height: 34px; border-radius: 4px; background: rgba(255, 138, 42, .14) center / cover; }
.ami-nom { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ami-nom b { font-weight: 800; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ami-nom small { color: var(--doux); font-size: 14px; }
.ami-inviter { font-weight: 800; color: var(--fonte); letter-spacing: .06em; text-transform: uppercase; font-size: 15px; }
.ami.invite .ami-inviter { color: var(--laiton); }
.vide { color: var(--doux); font-size: 15px; margin: 4px 0; }
#places { display: grid; grid-template-columns: repeat(4, 118px); gap: 8px; margin-bottom: 6px; }
.place { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border: 1px solid rgba(196, 122, 66, .4); border-radius: 4px; background: rgba(10, 7, 6, .5); }
.place.libre { opacity: .5; border-style: dashed; }
.place .ami-av { width: 38px; height: 38px; flex: none; }
.place .ami-av.machine { background: url(img/bloc-8.webp) center / cover; }
.place b { font-size: 17px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place small { font-size: 13px; color: var(--fonte); text-transform: uppercase; letter-spacing: .1em; }
.reglage { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 46px; }
.reglage > span { font-weight: 700; font-size: 19px; display: flex; flex-direction: column; }
.reglage small { font-size: 14px; color: var(--doux); font-weight: 500; }
.interrupteur { width: 58px; height: 30px; border-radius: 15px; border: 1px solid rgba(196, 122, 66, .5); background: rgba(10, 7, 6, .8); position: relative; flex: none; }
.interrupteur i { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 10px; background: rgba(255, 255, 255, .4); transition: left .15s, background .15s; }
.interrupteur[aria-checked="true"] { border-color: var(--fonte); }
.interrupteur[aria-checked="true"] i { left: 32px; background: linear-gradient(#ffc66b, #e86a1c); }
.interrupteur:disabled { opacity: .5; }
.choix-langue { display: flex; gap: 6px; }
.choix-langue button { min-width: 70px; height: 40px; padding: 0 10px; border: 1px solid rgba(196, 122, 66, .4); border-radius: 4px; background: rgba(10, 7, 6, .6); font-weight: 700; font-size: 16px; }
.choix-langue button.actif { border-color: var(--fonte); color: #fff; background: rgba(232, 106, 28, .3); }
.version-jeu { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; color: var(--doux); margin-top: 4px; }
#reglages .panneau { min-width: 380px; }
.bouton-app { min-height: 50px; padding: 0 26px; border-radius: 4px; font-weight: 800; font-size: 19px; color: #fff; }
.bouton-app.whatsapp { background: #1fa855; }
.bouton-app.telegram { background: #2a9ad6; }

/* ---------- En partie ---------- */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#hud > * { pointer-events: none; }
/* Pause : le signe seul, blanc, sans contour (porteur, 25 oct. 2026). */
#hud #b-pause { pointer-events: auto; position: absolute; top: max(6px, env(safe-area-inset-top)); left: var(--marge); width: 44px; height: 44px; display: grid; place-items: center; opacity: .8; }
#hud #b-pause .ic { width: 20px; height: 20px; }
/* Le bandeau vit dans la colonne de gauche, sous la réserve : rien ne passe sur le moule (placé par jeu.js). */
#bandeau { position: absolute; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center;
  padding: 6px 4px; line-height: 1.05; border-radius: 4px; background: rgba(10, 7, 6, .62); font-weight: 800; font-size: 18px; letter-spacing: .08em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
#bandeau:empty { display: none; }
#bandeau .camp { display: flex; gap: 4px; align-items: center; }
#bandeau .camp i { width: 16px; height: 6px; border-radius: 1px; background: currentColor; opacity: .22; }
#bandeau .camp i.oui { opacity: 1; }
#bandeau .chrono { color: var(--doux); }
#bandeau .camp { flex-wrap: wrap; justify-content: center; }
#bandeau .vague { color: var(--fonte-vive); }
#compte { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 120px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: #fff2dc; text-shadow: 0 0 30px var(--fonte), 0 4px 0 #6a2508; opacity: 0; }
#compte.on { animation: compte .9s ease-out; }
@keyframes compte { 0% { opacity: 0; transform: scale(1.4); } 15% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(.92); } }
#message { position: absolute; left: 0; right: 0; top: 38%; text-align: center; font-size: 40px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: 0; transition: opacity .2s;
  text-shadow: 0 0 18px rgba(255, 120, 30, .6), 0 2px 6px #000; }
#message.on { opacity: 1; }
#message small { display: block; font-size: 18px; letter-spacing: .08em; opacity: .8; margin-top: 4px; color: #fff; }
/* Annonce du rival (campagne) : posée pendant le compte à rebours, le jeu ne tourne pas encore. */
#annonce { position: absolute; left: 0; right: 0; top: 18%; margin: auto; width: fit-content; max-width: 90%; text-align: center; padding: 14px 30px;
  border: 1px solid rgba(196, 122, 66, .6); border-radius: 5px;
  background: radial-gradient(circle at 9px 9px, #d08a52 0 2.5px, #5a3418 3px, transparent 4px), radial-gradient(circle at calc(100% - 9px) 9px, #d08a52 0 2.5px, #5a3418 3px, transparent 4px),
    radial-gradient(circle at 9px calc(100% - 9px), #d08a52 0 2.5px, #5a3418 3px, transparent 4px), radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), #d08a52 0 2.5px, #5a3418 3px, transparent 4px),
    linear-gradient(#2a201b, #17110e);
  box-shadow: inset 0 0 0 4px rgba(13, 9, 7, .9), inset 0 0 0 5px rgba(232, 120, 40, .45), 0 6px 18px rgba(0, 0, 0, .55); display: flex; flex-direction: column; gap: 2px; }
#annonce .ic { width: 44px; height: 44px; object-fit: contain; margin: 0 auto 2px; }
#annonce button { pointer-events: auto; align-self: center; margin-top: 6px; }
#annonce small { color: var(--fonte); font-weight: 800; letter-spacing: .2em; text-transform: uppercase; font-size: 15px; }
#annonce b { font-size: 34px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
#annonce span { color: var(--doux); font-size: 17px; }
/* Petits mots d'action près du moule (riposte, enchaînement, paré) : ils montent et s'effacent. */
.envol img { width: 1em; height: 1em; vertical-align: -0.12em; margin-right: 6px; }
.envol { position: fixed; z-index: 21; pointer-events: none; font-weight: 800; font-size: 26px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  text-shadow: 0 0 12px rgba(255, 120, 30, .7), 0 2px 4px #000; transform: translate(-50%, 0); animation: envol 1.1s ease-out forwards; }
@keyframes envol { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.9); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -34px); } }
#aide { position: absolute; left: 0; right: 0; bottom: max(8px, env(safe-area-inset-bottom)); margin: 0 auto; width: fit-content; max-width: 86%; padding: 6px 14px; border-radius: 4px;
  background: rgba(10, 7, 6, .82); font-size: 17px; font-weight: 700; text-align: center; opacity: 0; transition: opacity .3s; }
#aide.on { opacity: 1; }

/* Fin */
.fin { min-width: 380px; text-align: center; }
.fin h2 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
#gros-fin { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 64px; font-size: 64px; font-weight: 800; color: #fff2dc; text-shadow: 0 0 22px var(--fonte); font-variant-numeric: tabular-nums; }
#gros-fin .etoile { width: 48px; height: 48px; background: rgba(255, 255, 255, .15); }
#gros-fin .etoile.oui { background: var(--laiton); filter: drop-shadow(0 0 10px rgba(232, 182, 48, .7)); }
#detail-fin { color: var(--doux); font-size: 17px; display: flex; flex-direction: column; gap: 3px; margin-bottom: 4px; }
#detail-fin .objectifs { display: flex; flex-direction: column; gap: 2px; font-size: 16px; }
#detail-fin .objectifs span.oui { color: var(--laiton); }
#pause .panneau, #fin .panneau { min-width: 300px; }
#pause h2 { margin: 0 0 4px; text-align: center; font-size: 30px; letter-spacing: .16em; text-transform: uppercase; }

/* Tutoriel : la bulle en haut, jamais sur le moule. */
/* La bulle vit à droite du moule (placée par jeu.js), jamais sur ce qu'on joue. */
#tuto { position: fixed; z-index: 25; top: max(8px, env(safe-area-inset-top)); left: 60%; right: 12px; padding: 8px 12px; border-radius: 4px;
  background: rgba(14, 9, 7, .95); border: 1px solid var(--fonte); box-shadow: 0 0 18px rgba(255, 120, 30, .25); display: flex; flex-direction: column; gap: 4px; align-items: stretch; transition: opacity .2s; }
#tuto.efface { opacity: .2; }
#tuto small { color: var(--fonte); font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
#tuto p { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.1; }
#tuto em { font-style: normal; color: var(--laiton); font-weight: 800; font-size: 17px; }
#tuto em.secoue { animation: secoue .3s; }
#tuto button { align-self: flex-end; margin-top: 4px; }
@keyframes secoue { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
#tuto-geste { position: fixed; z-index: 24; pointer-events: none; width: 40px; height: 40px; margin: -20px 0 0 -20px; }
#tuto-geste i { position: absolute; inset: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); box-shadow: 0 0 18px var(--fonte); animation: geste 1.4s ease-in-out infinite; }
#tuto-geste.cote i { --dx: 80px; --dy: 0px; }
#tuto-geste.tape i { --dx: 0px; --dy: 0px; animation-name: tape; }
#tuto-geste.bas i { --dx: 0px; --dy: 90px; animation-duration: .7s; }
#tuto-geste.doux i { --dx: 0px; --dy: 60px; animation-duration: 2.2s; }
@keyframes geste { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 70% { transform: translate(var(--dx), var(--dy)); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
@keyframes tape { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(.7); opacity: 1; } }

/* Tourner le téléphone (ecran.js) */
#tourner { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: var(--nuit); text-align: center; }
#tourner.on, #tourner.visible { display: flex; }
#tourner img { width: min(70vw, 320px); }
#tourner p { font-size: 22px; font-weight: 700; margin: 12px 0; }
#tourner .aide { font-size: 15px; color: var(--doux); }

/* Toasts : en haut au centre, petite icône selon le genre. */
#toasts { position: fixed; z-index: 60; top: 12px; left: 0; right: 0; margin: auto; width: fit-content; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 4px; background: rgba(14, 9, 7, .95); border: 1px solid rgba(196, 122, 66, .7); font-weight: 700; font-size: 17px; animation: toast 2.9s forwards; }
.toast i { width: 9px; height: 9px; border-radius: 2px; background: var(--acier); }
.toast.erreur { border-color: rgba(217, 85, 58, .8); } .toast.erreur i { background: var(--rouille); }
.toast.reussite { border-color: rgba(232, 182, 48, .7); } .toast.reussite i { background: var(--laiton); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* Petits écrans (téléphone en paysage) */
@media (max-height: 430px) {
  .barre-haut { height: 54px; } .contenu { top: 54px; }
  .barre-haut h2 { font-size: 24px; }
  .titre-menu { max-height: 16vh; }
  #menu { gap: 10px; }
  .mode { min-height: 50px; padding: 4px 26px; gap: 12px; }
  .mode .ic { width: 28px; height: 28px; }
  .mode b { font-size: 22px; } .mode small { font-size: 14px; }
  .modes { gap: 7px; }
  .panneau { padding: 14px 18px; }
  .atelier { grid-template-columns: 118px repeat(8, 1fr); gap: 5px; }
  .atelier-nom b { font-size: 15px; } .atelier-nom small { font-size: 12px; }
  .niveau { min-height: 46px; font-size: 18px; }
  #echelle { gap: 5px; }
  .carte-niveau { width: 146px; min-height: 150px; padding: 12px 6px 10px; }
  .carte-niveau b { font-size: 19px; }
  #places { grid-template-columns: repeat(4, 104px); }
  .bouton-vif { min-height: 44px; font-size: 19px; }
  #compte { font-size: 90px; }
  #message { font-size: 30px; }
  #annonce b { font-size: 28px; }
  #reglages .panneau { min-width: 340px; }
  #tuto p { font-size: 18px; }
}
@media (max-width: 700px) { .modes { width: 86vw; } }
