/* aqueducs/aqueducs.css — « Les Aqueducs de Sylvandell » (esthétique de la maquette validée : nuit bleue, pierre, eau turquoise, or) */
:root {
  --nuit: #141a33; --nuit2: #1d2550; --pierre: #e9e2d0; --eau: #5fe3e0; --eau-fonce: #1aa6b3; --or: #f1c76a;
  --texte: #f3efe4; --doux: #b9c2e6; --rouge: #ff9a8a; --vert: #8dffc0;
  --sw: 1024px; --u: calc(var(--sw) / 1280);
  --titre: Georgia, "Times New Roman", Times, serif;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: radial-gradient(ellipse at top, #27306a 0%, var(--nuit) 70%) fixed; background-color: var(--nuit); color: var(--texte); font-family: var(--police); -webkit-tap-highlight-color: transparent; }
body { overflow-x: hidden; min-height: 100vh; }
.wrap { position: relative; z-index: 1; width: calc(100% - 16px); max-width: 1400px; margin: 0 auto; padding: 6px 0 8px; display: flex; flex-direction: column; gap: 6px; }

/* ── Bandeau ─────────────────────────────────────────────────────────────── */
.fv-header { display: flex; align-items: center; gap: 7px; padding: 6px 8px; min-height: 52px; background: rgba(20, 26, 51, .88); border: 1px solid rgba(241, 199, 106, .35); border-radius: 16px; color: var(--texte); }
.fv-header .titre { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.fv-header .nom-jeu { font: 700 1.12rem var(--titre); font-variant: small-caps; letter-spacing: .04em; color: #fff; }
.fv-header .titre small { display: block; font-size: .75rem; color: var(--doux); overflow: hidden; text-overflow: ellipsis; }
.pastille { flex: none; border-radius: 99px; padding: 6px 11px; background: rgba(95, 227, 224, .12); border: 1px solid rgba(95, 227, 224, .45); font-weight: 800; font-size: .88rem; white-space: nowrap; color: var(--texte); }
.pastille.possibles i { font-style: normal; opacity: .3; filter: grayscale(1); }
.btn-rond { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(241, 199, 106, .45); background: linear-gradient(#2a3470, #1b2250); color: var(--texte); font-size: 1.1rem; display: grid; place-items: center; padding: 0; cursor: pointer; font-family: inherit; }
.btn-rond:active { transform: scale(.94); }

/* ── Scène ───────────────────────────────────────────────────────────────── */
.scene { position: relative; width: var(--sw); max-width: 100%; margin: 0 auto; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 18px; border: 2px solid rgba(241, 199, 106, .5); box-shadow: 0 10px 40px rgba(0, 0, 0, .45); background: linear-gradient(#3b3f86, #6a5aa0 45%, #2c4a5a); user-select: none; -webkit-user-select: none; }
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }

/* ── Console ─────────────────────────────────────────────────────────────── */
.console { display: grid; grid-template-columns: minmax(200px, 24%) 1fr auto auto; grid-template-areas: "maitre outils pave actions" "pied pied pied pied"; gap: 6px 14px; align-items: center;
  background: linear-gradient(#232b5e, #1a2149); border: 1px solid rgba(241, 199, 106, .35); border-radius: 18px; padding: 8px 12px 0; }
.maitre { grid-area: maitre; display: flex; gap: 10px; align-items: center; min-width: 0; }
.portrait { width: 58px; height: 58px; border-radius: 50%; flex: none; background: radial-gradient(circle at 50% 35%, #3d9fb0, #1d3e66); border: 2px solid var(--or); overflow: hidden; }
.portrait img { width: 118%; height: 118%; margin: -2% 0 0 -9%; object-fit: cover; object-position: 50% 10%; display: block; }
.bulle { position: relative; background: var(--pierre); color: #2b2a35; border-radius: 14px; padding: 8px 11px; font-size: .9rem; line-height: 1.34; min-width: 0; }
.bulle b { color: #0f7b86; }
.bulle:before { content: ""; position: absolute; left: -8px; top: 22px; border: 8px solid transparent; border-right-color: var(--pierre); border-left: 0; }
.outils { grid-area: outils; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; min-width: 0; }
.bloc { display: flex; flex-direction: column; gap: 6px; }
.bloc h3 { margin: 0; font-size: .74rem; text-transform: uppercase; letter-spacing: 1px; color: var(--or); }
.rangee { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lettre { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--or); color: #2a1a04; font: 800 .9rem var(--titre); flex: none; }
.choix { display: flex; gap: 6px; flex-wrap: wrap; }
.choix button { white-space: nowrap; font: 800 .95rem var(--police); color: var(--texte); background: #2b367a; border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px; padding: 3px 8px; min-height: 46px; min-width: 58px; cursor: pointer; }
.choix button.actif { background: linear-gradient(#24b8c2, #147d8f); border-color: var(--eau); box-shadow: 0 0 0 3px rgba(95, 227, 224, .25); }
.choix button.bassin { font-size: .92rem; min-width: 100px; }
.choix button:active { transform: scale(.95); }
.prevision { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .95rem; }
.prevision .apres { color: var(--doux); }
.frac-saisie { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.frac-saisie i { display: block; width: 62px; height: 3px; background: var(--texte); border-radius: 2px; }
.case { display: block; min-width: 56px; min-height: 34px; text-align: center; font: 800 1.2rem/30px var(--police); border-radius: 10px; border: 2px solid rgba(95, 227, 224, .5); background: #10163a; color: var(--texte); padding: 0 6px; cursor: pointer; font-variant-numeric: tabular-nums; }
.case.vide { color: rgba(255, 255, 255, .28); }
.case.actif { border-color: var(--or); box-shadow: 0 0 0 3px rgba(241, 199, 106, .25); }
.autre-sortie { color: var(--doux); font-size: .8rem; line-height: 1.25; }
.autre-sortie b { color: var(--texte); }
.rangees { display: flex; flex-direction: column; gap: 6px; }
.rangees-ligne { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.pave-zone { grid-area: pave; }
.pave-zone:empty { display: none; }
.pave { display: grid; grid-template-columns: repeat(4, 42px); gap: 4px; }
.touche { height: 38px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, .18); background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .03)); color: var(--texte); font: 800 1.15rem var(--police); cursor: pointer; padding: 0; }
.touche:active { transform: scale(.94); }
.touche.efface { color: var(--rouge); }
.touche.alt { color: var(--or); }
.actions { grid-area: actions; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.lacher { font: 800 1.1rem var(--police); color: #062a30; background: linear-gradient(#9ff6f1, #3fd0d3); border: 0; border-radius: 16px; padding: 13px 18px; cursor: pointer; box-shadow: 0 6px 0 #168d96, 0 10px 24px rgba(95, 227, 224, .35); animation: appel 2.4s ease-in-out infinite; white-space: nowrap; }
.lacher:active { transform: translateY(3px); box-shadow: 0 3px 0 #168d96; }
.lacher:disabled { opacity: .45; animation: none; cursor: default; }
@keyframes appel { 50% { box-shadow: 0 6px 0 #168d96, 0 10px 34px rgba(95, 227, 224, .75); } }
.secondaire { font: 700 .88rem var(--police); color: var(--doux); background: transparent; border: 1px dashed rgba(185, 194, 230, .5); border-radius: 12px; padding: 8px; cursor: pointer; min-height: 40px; }
.pied { grid-area: pied; display: flex; align-items: center; justify-content: center; min-height: 28px; padding: 0 120px 0 56px; }
.pied .msg { flex: 1; text-align: center; font-size: .9rem; color: var(--doux); }
.pied .msg.ok { color: var(--vert); } .pied .msg.ko { color: var(--rouge); }

/* Fractions empilées dans les textes */
.fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.02; font-weight: 800; margin: 0 2px; font-size: .9em; }
.fr .n { padding: 0 3px 1px; border-bottom: 2px solid currentColor; }
.fr .d { padding: 1px 3px 0; }

/* ── Dialogues (récit, explications, carte, grimoire) ───────────────────── */
.voile { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 12px; background: rgba(6, 8, 24, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.voile.ouvert { display: flex; }
.voile.bas { align-items: flex-end; background: linear-gradient(180deg, transparent 35%, rgba(6, 8, 24, .72)); backdrop-filter: none; -webkit-backdrop-filter: none; }
.voile.bas .dialogue { margin-bottom: 64px; max-height: 52dvh; }
.voile.haut { align-items: flex-start; background: linear-gradient(0deg, transparent 35%, rgba(6, 8, 24, .72)); backdrop-filter: none; -webkit-backdrop-filter: none; }
.voile.haut .dialogue { margin-top: 4px; max-height: 64dvh; }
.dialogue { width: min(100%, 700px); max-height: calc(100dvh - 24px); overflow: auto; -webkit-overflow-scrolling: touch; background: linear-gradient(180deg, #26306a, #151b3e); border: 1px solid rgba(241, 199, 106, .45); border-radius: 20px;
  padding: 16px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .75), 0 0 40px rgba(95, 227, 224, .12); animation: monte .35s ease-out; color: var(--texte); }
@keyframes monte { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialogue .qui { font: 700 1.05rem var(--titre); font-variant: small-caps; color: var(--or); margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.dialogue .qui img { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--or); object-fit: cover; object-position: 50% 10%; background: #1d3e66; }
.dialogue .qui span.ico { 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 .note-dessin { display: inline-block; margin-top: 6px; font-size: .9rem; color: var(--doux); }
.dialogue .avertit { color: var(--rouge); font-size: .92rem; }
.dialogue .actions { display: flex; flex-direction: row; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.dialogue b { color: #9ff6f1; }
.bouton { cursor: pointer; font: 800 1rem var(--police); padding: 11px 18px; border-radius: 12px; border: 0; color: #062a30; background: linear-gradient(#9ff6f1, #3fd0d3); box-shadow: 0 4px 0 #168d96; min-height: 46px; }
.bouton:active { transform: translateY(2px); box-shadow: 0 2px 0 #168d96; }
.bouton.or { color: #2a1a04; background: linear-gradient(#ffe6a0, #f1c76a); box-shadow: 0 4px 0 #a07a20; }
.bouton.discret { color: var(--texte); background: rgba(255, 255, 255, .08); box-shadow: none; border: 1px solid rgba(241, 199, 106, .35); }
.grosses-gouttes { font-size: 2.6rem; text-align: center; letter-spacing: 10px; margin: 4px 0 2px; }
.grosses-gouttes i { font-style: normal; display: inline-block; animation: goutte .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.grosses-gouttes i.vide { opacity: .25; filter: grayscale(1); }
@keyframes goutte { from { transform: scale(0) translateY(-30px); opacity: 0; } }
.points { text-align: center; font-weight: 800; color: var(--or); margin: 0 0 8px; }

/* Carte des chapitres */
.carte h2 { margin: 0 0 4px; text-align: center; font: 700 1.6rem var(--titre); font-variant: small-caps; letter-spacing: .04em; color: #fff; text-shadow: 0 0 18px rgba(95, 227, 224, .5); }
.carte .sous { text-align: center; color: var(--doux); margin: 0 0 14px; font-size: .92rem; }
.carte .legende { text-align: center; color: var(--doux); font-size: .82rem; margin: 10px 0 0; }
.chapitres { display: grid; gap: 10px; }
.chap { --c: #5fe3e0; 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(--texte);
  background: linear-gradient(90deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .02)); min-height: 64px; }
.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 var(--titre); color: #062a30; 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(--doux); font-size: .8rem; }
.chap .barre { display: block; 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 { font-size: .9rem; white-space: nowrap; }
.niveaux-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 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 rgba(241, 199, 106, .3); background: rgba(255, 255, 255, .05); color: var(--texte); min-height: 52px; }
.niveaux-liste button:disabled { opacity: .4; cursor: default; }
.niveaux-liste .et { display: block; font-size: .8rem; letter-spacing: 1px; margin-top: 2px; }
.niveaux-liste .et i { font-style: normal; opacity: .25; filter: grayscale(1); }
.niveaux-liste .boss { border-color: rgba(255, 210, 120, .75); background: rgba(241, 199, 106, .08); }

/* Grimoire des eaux (fiche de révision) */
.grimoire { background: linear-gradient(180deg, #f1e7cc, #e2d3aa); color: #2a1a04; border-radius: 14px; padding: 14px 16px; box-shadow: inset 0 0 40px rgba(120, 80, 30, .3); }
.grimoire h3 { margin: 12px 0 6px; font: 700 1.12rem var(--titre); color: #0f5a63; border-bottom: 1px solid rgba(15, 90, 99, .3); padding-bottom: 3px; }
.grimoire h3:first-child { margin-top: 0; }
.grimoire .regle { margin: 0 0 8px; line-height: 1.5; font-size: .98rem; }
.grimoire .regle b { color: #7a4a10; }
.grimoire .ex { display: block; font-family: var(--titre); color: #1a3a6a; margin-top: 2px; }
.grimoire .scelle { color: #8a6a40; font-style: italic; }

/* À propos (SEO) */
.seo-about { max-width: 840px; margin: 26px auto 16px; padding: 16px 22px; border-radius: 14px; background: rgba(20, 26, 51, .8); border: 1px solid rgba(241, 199, 106, .3); color: var(--doux); 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(--eau); }

/* ── Écrans moyens et petits ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .console { grid-template-columns: 1fr auto auto; grid-template-areas: "maitre maitre maitre" "outils pave actions" "pied pied pied"; }
  .pied { padding: 0 96px 0 50px; }
}
@media (max-width: 600px) {
  .wrap { width: 100%; padding: 4px 4px 8px; }
  .fv-header { gap: 5px; padding: 5px 6px; border-radius: 12px; }
  .fv-header .nom-jeu { font-size: .95rem; }
  .btn-rond { width: 34px; height: 34px; font-size: .95rem; }
  .pastille { padding: 4px 7px; font-size: .78rem; }
  .pastille.total { display: none; }
  .scene { border-radius: 12px; }
  .console { grid-template-columns: 1fr; grid-template-areas: "maitre" "outils" "pave" "actions" "pied"; padding: 8px; }
  .portrait { width: 56px; height: 56px; }
  .bulle { font-size: .88rem; }
  .actions { flex-direction: row; }
  .lacher { flex: 1; padding: 12px; }
  .pave { grid-template-columns: repeat(6, 1fr); width: 100%; }
  .pave .touche { order: var(--o-tel, 0); }
  .outils { justify-content: center; }
  .pied { padding: 0 50px; }
}
/* Garde-fous thèmes du site : bandeau ET jeu gardent leur fond sombre → texte clair obligatoire */
html body[class*="theme-"] .fv-header, html body[class*="theme-"] .fv-header * { color: #fff !important; -webkit-text-fill-color: #fff !important; text-shadow: none !important; }
html body[class*="theme-"] .wrap, html body[class*="theme-"] .wrap * { color: #f3efe4 !important; -webkit-text-fill-color: #f3efe4 !important; text-shadow: none !important; }
html body[class*="theme-"] .wrap .fv-header small { color: #b9c2e6 !important; -webkit-text-fill-color: #b9c2e6 !important; }
html body[class*="theme-"] .wrap .bulle, html body[class*="theme-"] .wrap .bulle * { color: #2b2a35 !important; -webkit-text-fill-color: #2b2a35 !important; }
html body[class*="theme-"] .wrap .bulle b, html body[class*="theme-"] .wrap .bulle b * { color: #0f7b86 !important; -webkit-text-fill-color: #0f7b86 !important; }
html body[class*="theme-"] .wrap .lacher { color: #062a30 !important; -webkit-text-fill-color: #062a30 !important; }
html body[class*="theme-"] .wrap .lettre, html body[class*="theme-"] .wrap .bloc h3 { color: #f1c76a !important; -webkit-text-fill-color: #f1c76a !important; }
html body[class*="theme-"] .wrap .lettre { color: #2a1a04 !important; -webkit-text-fill-color: #2a1a04 !important; }
html body[class*="theme-"] .wrap .msg.ok { color: #8dffc0 !important; -webkit-text-fill-color: #8dffc0 !important; }
html body[class*="theme-"] .wrap .msg.ko, html body[class*="theme-"] .wrap .touche.efface { color: #ff9a8a !important; -webkit-text-fill-color: #ff9a8a !important; }
html body[class*="theme-"] .voile .dialogue, html body[class*="theme-"] .voile .dialogue * { color: #f3efe4 !important; -webkit-text-fill-color: #f3efe4 !important; }
html body[class*="theme-"] .voile .bouton:not(.discret) { color: #062a30 !important; -webkit-text-fill-color: #062a30 !important; }
html body[class*="theme-"] .voile .bouton.or { color: #2a1a04 !important; -webkit-text-fill-color: #2a1a04 !important; }
html body[class*="theme-"] .voile .grimoire, html body[class*="theme-"] .voile .grimoire * { color: #2a1a04 !important; -webkit-text-fill-color: #2a1a04 !important; }
html body[class*="theme-"] .voile .dialogue .qui { color: #f1c76a !important; -webkit-text-fill-color: #f1c76a !important; }
.num-etape { display: inline-block; font-size: .74rem; font-weight: 800; color: #2a1a04; background: var(--or); border-radius: 99px; padding: 1px 8px; margin-right: 4px; vertical-align: 1px; }
html body[class*="theme-"] .wrap .num-etape { color: #2a1a04 !important; -webkit-text-fill-color: #2a1a04 !important; }
