/* volcan/volcan.css — « La Course contre la Lave » */
:root {
  --ink: #fbeee6; --dim: #c9b2a6; --or: #ffd36a; --lave: #ff7a2a; --rouge: #ff9a8a; --vert: #8dffc0; --cyan: #8fd8ff;
  --panel: rgba(24, 10, 8, .9); --bord: rgba(255, 150, 80, .3); --sw: 1024px;
  --u: calc(var(--sw) / 1280);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: #0b0605; color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-tap-highlight-color: transparent; }
body { overflow-x: hidden; }
.wrap { position: relative; z-index: 1; width: var(--sw); max-width: 100%; margin: 0 auto; }
sup { font-size: .62em; vertical-align: .6em; line-height: 0; }

/* ── Bandeau ─────────────────────────────────────────────────────────────── */
.fv-header { display: flex; align-items: center; gap: 8px; padding: 6px 8px; min-height: 52px; background: linear-gradient(180deg, #2a0f08, #170806); border-bottom: 1px solid var(--bord); }
.fv-header .titre { flex: 1; min-width: 0; font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-header .titre small { color: var(--dim); font-weight: 400; }
.pastille { flex: none; display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,.06); border: 1px solid var(--bord); border-radius: 99px; padding: 6px 11px; font-size: .88rem; color: var(--or); }
.btn-rond { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--bord); background: rgba(255,255,255,.06); color: var(--ink); font-size: 1.05rem; padding: 0; cursor: pointer; font-family: inherit; touch-action: manipulation; }
.btn-rond:active { transform: scale(.94); }
.btn-rond.actif { background: rgba(255, 150, 60, .3); box-shadow: 0 0 12px rgba(255, 140, 50, .5); }

/* ── Scène ───────────────────────────────────────────────────────────────── */
.scene { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; background: #120605; }
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.calque { position: absolute; pointer-events: none; }
/* Bulle d'Ignis (conseils courts, au-dessus du ciel à gauche) */
.bulle { left: calc(16 * var(--u)); top: calc(16 * var(--u)); width: calc(330 * var(--u)); min-width: 200px; max-height: calc(170 * var(--u)); overflow: hidden; padding: 8px 12px; border-radius: 14px;
  background: rgba(26, 10, 8, .9); border: 1px solid var(--bord); box-shadow: 0 8px 26px rgba(0,0,0,.6); font-size: max(12px, calc(17 * var(--u))); line-height: 1.35; opacity: 0; transform: translateY(-8px); transition: opacity .3s, transform .3s; }
.bulle.vue { opacity: 1; transform: none; }
.bulle .qui { color: var(--or); font-weight: 700; }

/* Calculatrice (chapitres avec π) */
.calc { position: absolute; left: 8px; top: 8px; width: min(250px, 42%); padding: 8px; border-radius: 16px; background: rgba(20, 8, 6, .95); border: 1px solid var(--bord); box-shadow: 0 10px 30px rgba(0,0,0,.7); z-index: 5; }
.calc-ecran { background: #0c0403; border-radius: 10px; padding: 6px 10px; text-align: right; margin-bottom: 6px; min-height: 52px; }
.calc-ecran span { display: block; color: var(--dim); font-size: .8rem; min-height: 1.1em; word-break: break-all; }
.calc-ecran b { display: block; color: var(--or); font-size: 1.25rem; font-variant-numeric: tabular-nums; word-break: break-all; }
.calc-touches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.calc-touches button { font: 700 1rem system-ui, sans-serif; padding: 8px 0; border-radius: 9px; border: 1px solid rgba(255,255,255,.12); background: #2a1410; color: var(--ink); cursor: pointer; touch-action: manipulation; }
.calc-touches button.op { background: #3a1c12; color: var(--or); }
.calc-touches button.eg { background: linear-gradient(180deg, #ff9a3c, #d9480f); color: #fff; }
.calc-touches button.vers { grid-column: span 2; background: #1e3a2a; color: var(--vert); font-size: .85rem; }
.calc-touches button:active { transform: scale(.94); }

/* ── Console ─────────────────────────────────────────────────────────────── */
/* bande libre en bas (64 px) : les boutons flottants du site (Ardoise à droite, loupe et bug à gauche) s'y posent sans rien cacher */
.console { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; padding: 10px 12px 64px; background: linear-gradient(180deg, #1c0a07, #0e0504); border-top: 1px solid var(--bord); min-height: 290px; }
.gauche { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.etape { font-size: .8rem; color: var(--dim); letter-spacing: .04em; text-transform: uppercase; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.etape .pas { display: inline-flex; gap: 4px; }
.etape .pas i { width: 18px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); }
.etape .pas i.fait { background: var(--vert); box-shadow: 0 0 6px var(--vert); }
.etape .pas i.ici { background: var(--lave); box-shadow: 0 0 8px var(--lave); }
.enonce { font-size: 1.04rem; line-height: 1.45; }
.enonce b { color: #ffe0b0; }
.enonce i { color: var(--dim); font-size: .92em; }
.saisie { display: flex; align-items: center; gap: 8px; }
.saisie input { width: min(220px, 60%); font: 700 1.35rem system-ui, sans-serif; padding: 8px 12px; border-radius: 12px; border: 2px solid rgba(255, 150, 80, .55); background: #0c0403; color: #fff; text-align: right; font-variant-numeric: tabular-nums; outline: none; }
.saisie input:focus { border-color: var(--or); box-shadow: 0 0 14px rgba(255, 200, 90, .35); }
.saisie input.faux { border-color: #ff6a5a; animation: secoue .4s; }
.saisie .unite { font-size: 1.15rem; font-weight: 700; color: var(--or); }
@keyframes secoue { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.msg { font-size: .96rem; line-height: 1.4; max-height: 8.4em; overflow: auto; -webkit-overflow-scrolling: touch; }
.msg:empty { display: none; }
.msg .ok { color: var(--vert); font-weight: 700; }
.msg .ko { color: var(--rouge); font-weight: 700; }
.msg .expl { display: block; margin-top: 4px; padding: 6px 10px; border-left: 3px solid var(--lave); background: rgba(255, 120, 40, .08); border-radius: 0 10px 10px 0; }
.droite { display: flex; align-items: flex-start; }

/* Pavé numérique du jeu (sombre, intégré) */
.pave { display: grid; grid-template-columns: repeat(4, 54px); grid-auto-rows: 42px; gap: 6px; }
.pave button { font: 800 1.25rem system-ui, sans-serif; border-radius: 11px; border: 1px solid rgba(255,255,255,.14); background: linear-gradient(180deg, #3a1c14, #24100b); color: var(--ink); box-shadow: 0 3px 0 #120604; cursor: pointer; touch-action: manipulation; padding: 0; }
.pave button:active { transform: translateY(2px); box-shadow: 0 1px 0 #120604; }
.pave .eff { color: #ffb0a0; }
.pave .ok { grid-row: span 2; background: linear-gradient(180deg, #ff9a3c, #c2410c); color: #fff; font-size: 1.1rem; }
.pave .zero { grid-column: span 3; }
.pave button:disabled { opacity: .4; }

/* Choix de bassins */
.choix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: min(380px, 44vw); }
.choix button { text-align: left; font: inherit; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--bord); background: rgba(255,255,255,.05); color: var(--ink); cursor: pointer; touch-action: manipulation; line-height: 1.25; }
.choix button b { color: var(--or); display: block; }
.choix button small { color: var(--dim); font-size: .82rem; }
.choix button.sel { border-color: var(--or); background: rgba(255, 180, 70, .16); box-shadow: 0 0 14px rgba(255, 180, 70, .35); }
.choix button.barre { opacity: .45; text-decoration: line-through; }
.choix .valider { grid-column: span 2; text-align: center; font-weight: 800; background: linear-gradient(135deg, #ff9a3c, #c2410c); color: #fff; border: 0; }
.choix .valider:disabled { opacity: .45; }

/* ── Dialogues ───────────────────────────────────────────────────────────── */
.voile { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 12px; background: rgba(8, 2, 2, .6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.voile.ouvert { display: flex; }
.voile.bas { padding-bottom: 76px; align-items: flex-end; background: linear-gradient(180deg, transparent 35%, rgba(8, 2, 2, .72)); backdrop-filter: none; -webkit-backdrop-filter: none; }
.dialogue { width: min(100%, 660px); max-height: calc(100dvh - 24px); overflow: auto; -webkit-overflow-scrolling: touch; background: linear-gradient(180deg, #2a100a, #120605); border: 1px solid var(--bord); border-radius: 20px;
  padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.75), 0 0 40px rgba(255, 120, 40, .15); animation: monte .35s ease-out; color: var(--ink); }
@keyframes monte { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialogue .qui { font-weight: 800; color: var(--or); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.dialogue .qui span { font-size: 1.7rem; }
.dialogue p { margin: 0 0 12px; line-height: 1.6; font-size: 1.04rem; }
.dialogue p.tt { min-height: 3.2em; }
.dialogue .actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.dialogue .solution { padding: 10px 14px; border-radius: 12px; background: rgba(255, 150, 60, .1); border: 1px solid var(--bord); line-height: 1.7; }
.bouton { cursor: pointer; font: 800 1rem system-ui, sans-serif; padding: 11px 18px; border-radius: 12px; border: 0; color: #2a0e04; background: linear-gradient(135deg, #ffe0a0, #ff9a3c); box-shadow: 0 0 20px rgba(255, 140, 50, .45); touch-action: manipulation; }
.bouton.discret { color: var(--ink); background: rgba(255,255,255,.08); box-shadow: none; border: 1px solid var(--bord); }
.grosse-etoiles { font-size: 2.6rem; text-align: center; color: var(--or); letter-spacing: 8px; text-shadow: 0 0 18px rgba(255,211,106,.7); margin: 4px 0 6px; }
.grosse-etoiles i { font-style: normal; display: inline-block; animation: etoile .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes etoile { from { transform: scale(0) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
.carte h2 { margin: 0 0 4px; text-align: center; font-size: 1.5rem; color: #fff; text-shadow: 0 0 18px rgba(255, 120, 40, .6); }
.carte .sous { text-align: center; color: var(--dim); margin: 0 0 14px; font-size: .92rem; }
.chapitres { display: grid; gap: 10px; }
.chap { --c: #ff9a3c; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid rgba(255,255,255,.18); cursor: pointer; text-align: left; font: inherit; color: var(--ink); background: rgba(255,255,255,.04); }
.chap:disabled { opacity: .45; cursor: default; }
.chap .num { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; font: 800 1.3rem system-ui, sans-serif; color: #2a0e04; background: radial-gradient(circle at 35% 30%, #fff, var(--c) 60%); box-shadow: 0 0 16px var(--c); }
.chap .t { flex: 1; font-weight: 700; }
.chap .t small { display: block; font-weight: 400; color: var(--dim); font-size: .8rem; }
.chap .barre { height: 5px; border-radius: 3px; background: rgba(255,255,255,.08); margin-top: 6px; overflow: hidden; }
.chap .barre i { display: block; height: 100%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.chap .et { color: var(--or); font-size: .9rem; white-space: nowrap; }
.niveaux-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.niveaux-liste button { font: inherit; text-align: left; cursor: pointer; padding: 9px 11px; border-radius: 12px; border: 1px solid var(--bord); background: rgba(255,255,255,.05); color: var(--ink); }
.niveaux-liste button:disabled { opacity: .4; cursor: default; }
.niveaux-liste .et { color: var(--or); font-size: .85rem; display: block; letter-spacing: 2px; }
.niveaux-liste .boss { border-color: rgba(255, 90, 40, .7); }
.memo h3 { margin: 12px 0 6px; color: var(--or); font-size: 1.02rem; }
.memo p { margin: 0 0 6px; line-height: 1.5; }
.memo .scelle { color: var(--dim); font-style: italic; }

.seo-about { max-width: 840px; margin: 26px auto 16px; padding: 16px 22px; border-radius: 14px; background: rgba(30, 12, 8, .8); border: 1px solid var(--bord); color: var(--dim); font-size: .92rem; line-height: 1.55; }
.seo-about h2 { color: var(--or); font-size: 1.05rem; margin: 0 0 8px; }
.seo-about a { color: var(--cyan); }

/* ── Petits écrans : la console passe en colonne ─────────────────────────── */
@media (max-width: 600px) { #etoilesTotal { display: none; } }
@media (max-width: 640px) {
  .console { grid-template-columns: 1fr; }
  .droite { justify-content: center; }
  .choix { width: 100%; }
  .pave { grid-template-columns: repeat(4, minmax(48px, 1fr)); width: 100%; max-width: 340px; }
}

/* Garde-fous thèmes du site (le bandeau garde son fond sombre : texte blanc obligatoire) */
body[class*="theme-"] .fv-header, body[class*="theme-"] .fv-header * { color: #fff !important; -webkit-text-fill-color: #fff !important; text-shadow: none !important; }
body[class*="theme-"] .wrap, body[class*="theme-"] .wrap * { color: #fbeee6 !important; -webkit-text-fill-color: #fbeee6 !important; }
body[class*="theme-"] .wrap .msg .ok { color: #8dffc0 !important; -webkit-text-fill-color: #8dffc0 !important; }
body[class*="theme-"] .wrap .msg .ko { color: #ff9a8a !important; -webkit-text-fill-color: #ff9a8a !important; }
body[class*="theme-"] .wrap .unite, body[class*="theme-"] .wrap .calc-ecran b { color: #ffd36a !important; -webkit-text-fill-color: #ffd36a !important; }
body[class*="theme-"] .voile .dialogue, body[class*="theme-"] .voile .dialogue * { color: #fbeee6 !important; -webkit-text-fill-color: #fbeee6 !important; }
body[class*="theme-"] .voile .bouton:not(.discret) { color: #2a0e04 !important; -webkit-text-fill-color: #2a0e04 !important; }
