/* astromancien/astromancien.css — « Le Voyage de l'Astromancien » */
:root {
  --ink: #f2efff; --dim: #b9b3dc; --or: #ffd36a; --vert: #8dffc0; --cyan: #8fe8ff; --rouge: #ff9a8a; --violet: #c4a2ff;
  --panel: rgba(14, 10, 34, .92); --bord: rgba(180, 160, 255, .3); --sw: 1024px; --sh: 576px;
  --serif: Georgia, "Times New Roman", Times, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: #05040f; 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; }

/* ── Bandeau ─────────────────────────────────────────────────────────────── */
.fv-header { display: flex; align-items: center; gap: 7px; padding: 6px 8px; min-height: 50px; background: linear-gradient(180deg, #1d1546, #0c0820); 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(--ink); }
.pastille.possibles { color: var(--or); letter-spacing: 1px; }
.pastille.possibles i { font-style: normal; opacity: .45; }
.btn-rond { flex: none; width: 42px; height: 42px; 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; }
.btn-rond:active { transform: scale(.94); }

/* ── Scène ───────────────────────────────────────────────────────────────── */
.scene { position: relative; width: 100%; height: var(--sh); overflow: hidden; user-select: none; -webkit-user-select: none; background: #060a1f; }
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
.destination { position: absolute; right: 10px; top: 10px; max-width: min(46%, 330px); padding: 7px 12px; border-radius: 14px; background: rgba(10, 8, 30, .78); border: 1px solid var(--bord);
  font-size: .86rem; line-height: 1.3; pointer-events: none; display: flex; align-items: center; gap: 9px; opacity: 0; transition: opacity .4s; }
.destination.vue { opacity: 1; }
.destination .orbe { flex: none; width: 26px; height: 26px; border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.destination small { display: block; color: var(--dim); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.destination b { color: #fff; }
.bulle { position: absolute; left: 10px; top: 10px; width: min(440px, 62%); max-height: 70%; overflow: auto; padding: 10px 14px; border-radius: 16px; pointer-events: none;
  background: rgba(16, 10, 40, .93); border: 1px solid var(--bord); box-shadow: 0 8px 30px rgba(0,0,0,.6); font-size: .95rem; line-height: 1.4; opacity: 0; transform: translateY(-10px); transition: opacity .3s, transform .3s; }
.bulle.vue { opacity: 1; transform: none; }
.bulle .qui { color: var(--or); font-weight: 700; margin-bottom: 2px; }
.orbe.lune { background: radial-gradient(circle at 35% 30%, #fff, #c9d2e6 55%, #5d6784); color: #c9d2e6; }
.orbe.etoile { background: radial-gradient(circle, #fff, #fff2c0 45%, #ffb347); color: #ffd36a; }
.orbe.nebuleuse { background: radial-gradient(circle at 30% 40%, #ff8ad8, #8c78ff 55%, #2a1a6a); color: #c4a2ff; }
.orbe.fee { background: radial-gradient(circle, #fff, #ffe0ff 40%, #c58cff); color: #ffb3f0; }
.orbe.givre { background: radial-gradient(circle at 35% 30%, #fff, #bfefff 55%, #3e7fb8); color: #8fe8ff; }
.orbe.ambre { background: radial-gradient(circle at 35% 30%, #fff3c4, #f0a33a 55%, #7a3b0c); color: #ffbf6a; }
.orbe.forge { background: radial-gradient(circle at 35% 30%, #ffd2a0, #e2502a 55%, #3a0d06); color: #ff8a5a; }
.orbe.jardin { background: radial-gradient(circle at 35% 30%, #eaffd8, #4fc28a 55%, #0e4a3a); color: #8dffc0; }
.orbe.opale { background: conic-gradient(#ffb3d9, #b3f0ff, #fff3a0, #d7c9ff, #ffb3d9); color: #e0d0ff; }
.orbe.puits { background: radial-gradient(circle, #05030c 45%, #ffdca0 50%, #8c78ff 70%, transparent 72%); color: #c4a2ff; }
.orbe.tour { background: radial-gradient(circle at 50% 35%, #ffd36a 10%, #8f8bb8 30%, #2b2a48 70%); color: #b9b3dc; }
.orbe.ultime { background: radial-gradient(circle at 35% 30%, #fff, #ffe08a 25%, #ff7ad9 50%, #7a8bff 75%, #2a1a6a); color: #fff0b0; }

/* ── Console ─────────────────────────────────────────────────────────────── */
.console { position: relative; background: linear-gradient(180deg, #160f38, #0a0720); border-top: 1px solid var(--bord); padding: 8px 10px 4px; }
.consigne { text-align: center; color: var(--ink); font-size: 1rem; line-height: 1.45; min-height: 1.4em; margin: 0 auto 8px; max-width: 920px; }
.consigne b { color: var(--or); }
.consigne sup, .dialogue sup, .grimoire sup, .option sup, .saisie sup, .bulle sup { font-size: .68em; line-height: 0; }
.num-etape { display: inline-block; font-size: .78rem; font-weight: 800; color: #160c30; background: var(--or); border-radius: 99px; padding: 1px 8px; margin-right: 4px; vertical-align: 1px; }
.commandes { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; }
.commandes.nombre { flex-wrap: nowrap; }
.saisie { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 190px; max-width: 300px; justify-content: center; padding: 6px 14px; border-radius: 14px; background: rgba(0,0,0,.4); border: 1px solid rgba(255,211,106,.4); }
.champ { min-width: 2.2em; text-align: center; font: 700 1.6rem var(--serif); color: #fff; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.champ.vide { color: rgba(255,255,255,.35); }
.champ sup { font-size: .62em; vertical-align: 0; position: relative; top: -.75em; padding: 0 2px; border-radius: 4px; }
.champ sup.actif { background: rgba(143, 232, 255, .16); outline: 1.5px solid rgba(143, 232, 255, .7); }
.champ .caret, .champ sup.actif::after { content: ''; display: inline-block; width: 2px; height: .9em; margin-left: 2px; background: var(--cyan); vertical-align: -.1em; animation: clignote 1s steps(2) infinite; }
@keyframes clignote { 50% { opacity: 0; } }
.unite { font: 700 .9rem system-ui, sans-serif; color: var(--or); }
.pave { display: grid; grid-template-columns: repeat(8, 46px); gap: 6px; }
.touche { height: 50px; border-radius: 12px; border: 1px solid var(--bord); background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.03)); color: var(--ink); font: 700 1.25rem system-ui, sans-serif; cursor: pointer; padding: 0; touch-action: manipulation; }
.touche.puiss { grid-column: span 2; font-size: 1.05rem; color: var(--cyan); }
.touche.puiss sup { font-size: .7em; }
.touche.puiss.actif { background: linear-gradient(180deg, rgba(143,232,255,.35), rgba(143,232,255,.12)); color: #fff; }
.touche.efface { color: var(--rouge); grid-column: span 2; }
.calc .touche.efface { grid-column: auto; }
.touche:disabled { opacity: .25; cursor: default; }
.touche:active:not(:disabled), .option:active, .bouton:active { transform: scale(.95); }
.options { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 820px; }
.option { position: relative; min-height: 52px; min-width: 120px; padding: 8px 16px; border-radius: 14px; border: 1px solid var(--bord); background: rgba(255,255,255,.06); color: var(--ink); font: 700 1.1rem var(--serif); cursor: pointer; touch-action: manipulation; }
.option small { display: block; font: 600 .82rem system-ui, sans-serif; color: var(--dim); }
.option.choisie { background: linear-gradient(135deg, rgba(255,211,106,.32), rgba(255,211,106,.1)); border-color: var(--or); box-shadow: 0 0 16px rgba(255,211,106,.35); }
.option .rang { position: absolute; top: -9px; left: -9px; width: 26px; height: 26px; border-radius: 50%; background: var(--or); color: #160c30; font: 800 .9rem system-ui, sans-serif; display: grid; place-items: center; }
.pied { display: flex; align-items: center; justify-content: center; min-height: 38px; margin-top: 4px; padding: 0 130px 0 60px; }
body.pleine .pied { min-height: 104px; align-items: flex-start; padding-top: 6px; }
.pied .msg { flex: 1; text-align: center; font-size: .9rem; color: var(--dim); min-height: 1.2em; }
.pied .msg.ok { color: var(--vert); } .pied .msg.ko { color: var(--rouge); }
.bouton { cursor: pointer; font: 800 1rem system-ui, sans-serif; padding: 11px 18px; border-radius: 12px; border: 0; color: #1d0f3a; background: linear-gradient(135deg, #fff1b8, #ffc94d); box-shadow: 0 0 20px rgba(255, 201, 77, .45); touch-action: manipulation; }
.commandes.nombre .bouton.lancer { width: 132px; min-height: 106px; line-height: 1.25; }
.bouton.lancer { min-height: 56px; padding: 10px 18px; font-size: 1.05rem; animation: appel 2.4s ease-in-out infinite; }
.bouton.lancer:disabled { opacity: .4; animation: none; cursor: default; }
@keyframes appel { 50% { box-shadow: 0 0 34px rgba(255, 210, 100, .85); } }
.bouton.violet { color: #fff; background: linear-gradient(135deg, #8e6bff, #5a3fd0); box-shadow: 0 0 18px rgba(142, 107, 255, .4); }
.bouton.discret { color: var(--ink); background: rgba(255,255,255,.08); box-shadow: none; border: 1px solid var(--bord); }
.bouton.petit { padding: 8px 12px; font-size: .9rem; }

/* ── Dialogues ───────────────────────────────────────────────────────────── */
.voile { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 12px; background: rgba(3, 2, 12, .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 40%, rgba(3, 2, 12, .75)); backdrop-filter: none; -webkit-backdrop-filter: none; }
.voile.bas .dialogue { margin-bottom: 64px; max-height: 44dvh; }
@media (min-width: 900px) { .voile.bas .dialogue { margin-bottom: 8px; } }
.dialogue { width: min(100%, 700px); max-height: calc(100dvh - 24px); overflow: auto; -webkit-overflow-scrolling: touch; background: linear-gradient(180deg, #1f1650, #0d0824); border: 1px solid var(--bord); border-radius: 20px;
  padding: 16px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.75), 0 0 40px rgba(140, 110, 255, .18); 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.dragon { color: var(--cyan); }
.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 .avertit { color: var(--rouge); font-size: .92rem; }
.dialogue .actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.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(-120deg); opacity: 0; } }

/* Carte des chapitres */
.carte h2 { margin: 0 0 4px; text-align: center; font: 700 1.6rem var(--serif); color: #fff; text-shadow: 0 0 18px rgba(160, 130, 255, .6); }
.carte .sous { text-align: center; color: var(--dim); margin: 0 0 14px; font-size: .92rem; }
.chapitres { display: grid; gap: 10px; }
.chap { --c: #ffd36a; 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: linear-gradient(90deg, rgba(255,255,255,.08), 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(--serif); color: #160c30; 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 { 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 { color: var(--or); font-size: .9rem; white-space: nowrap; }
.niveaux-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 12px; }
.niveaux-liste button { font: inherit; text-align: left; cursor: pointer; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--bord); background: rgba(255,255,255,.05); color: var(--ink); min-height: 52px; }
.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, 138, 190, .6); }

/* Grimoire (fiche de révision) */
.grimoire { background: linear-gradient(180deg, #efe6cf, #ddd0ad); color: #22163e; border-radius: 14px; padding: 14px 16px; box-shadow: inset 0 0 40px rgba(90, 60, 140, .3); }
.grimoire h3 { margin: 12px 0 6px; font: 700 1.15rem var(--serif); color: #3e2470; border-bottom: 1px solid rgba(62,36,112,.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: #6a1f5a; }
.grimoire .ex { display: block; font-family: var(--serif); color: #1f3d7a; margin-top: 2px; }
.grimoire .scelle { color: #7a6a90; font-style: italic; }

/* Calculatrice runique */
.calc .ecran { background: rgba(0,0,0,.45); border: 1px solid rgba(143,232,255,.4); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; text-align: right; min-height: 76px; }
.calc .ligne { font: 700 1.25rem var(--serif); color: #fff; min-height: 1.5em; white-space: nowrap; overflow-x: auto; }
.calc .ligne sup { font-size: .65em; }
.calc .res { font: 700 1.1rem var(--serif); color: var(--or); min-height: 1.4em; }
.calc .res small { color: var(--dim); font: 400 .85rem system-ui, sans-serif; }
.calc .pave { grid-template-columns: repeat(5, 1fr); }
.calc .touche.op { color: var(--or); }

/* À propos (SEO) */
.seo-about { max-width: 840px; margin: 26px auto 16px; padding: 16px 22px; border-radius: 14px; background: rgba(20, 14, 44, .85); 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); }

@media (max-width: 820px) {
  .commandes.nombre { flex-wrap: wrap; }
  .commandes.nombre .bouton.lancer { width: auto; min-height: 56px; }
  .pied { padding: 0 96px 0 50px; }
  .consigne { font-size: .95rem; }
}
@media (max-width: 560px) {
  #etoilesTotal { display: none; }
  .pastille { padding: 5px 8px; font-size: .8rem; }
  .fv-header { gap: 4px; padding: 5px 4px; }
  .btn-rond { width: 38px; height: 38px; font-size: .95rem; }
  .fv-header .titre { font-size: .82rem; }
  .fv-header .titre small { display: none; }
  .commandes.nombre { flex-wrap: wrap; }
  .commandes.nombre .bouton.lancer { width: 100%; min-height: 56px; }
  .pave { grid-template-columns: repeat(5, 1fr); width: 100%; }
  .touche.efface { grid-column: auto; }
  .touche { height: 48px; }
  .saisie { min-width: 0; width: 100%; }
  .commandes > .bouton.lancer { width: 100%; }
  .pied { padding: 0 60px 0 46px; }
  .destination { font-size: .76rem; max-width: 60%; }
  .bulle { width: 88%; font-size: .85rem; }
  .option { min-width: 0; flex: 1 1 40%; }
}
/* Garde-fous thèmes du site (le jeu garde son fond sombre : texte clair 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: #f2efff !important; -webkit-text-fill-color: #f2efff !important; }
body[class*="theme-"] .wrap .consigne b, body[class*="theme-"] .wrap .unite, body[class*="theme-"] .wrap .pastille.possibles { color: #ffd36a !important; -webkit-text-fill-color: #ffd36a !important; }
body[class*="theme-"] .wrap .bouton:not(.discret):not(.violet), body[class*="theme-"] .wrap .bouton:not(.discret):not(.violet) *, body[class*="theme-"] .wrap .num-etape, body[class*="theme-"] .wrap .option .rang { color: #1d0f3a !important; -webkit-text-fill-color: #1d0f3a !important; }
body[class*="theme-"] .voile .dialogue, body[class*="theme-"] .voile .dialogue * { color: #f2efff !important; -webkit-text-fill-color: #f2efff !important; }
body[class*="theme-"] .voile .bouton:not(.discret):not(.violet), body[class*="theme-"] .voile .chap .num { color: #1d0f3a !important; -webkit-text-fill-color: #1d0f3a !important; }
body[class*="theme-"] .voile .grimoire, body[class*="theme-"] .voile .grimoire * { color: #22163e !important; -webkit-text-fill-color: #22163e !important; }
body[class*="theme-"] .scene, body[class*="theme-"] .console { background-color: #0a0720 !important; }
