/* ASTROGYRE — « orfèvrerie nocturne » : nuit, pierre, laiton. Filets d'un pixel, coins biseautés. */
:root {
  --nuit: #070912;
  --pierre: #151a2b;
  --pierre-claire: #232a44;
  --laiton: #c9a24a;
  --laiton-clair: #f0d58a;
  --texte: #e9e6da;
  --danger: #ff3b1f;
  --voile: rgba(7, 9, 18, 0.55);
  --c0: #5dff8f;
  --c1: #4fd8ff;
  --biseau: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
  --titre: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --hud: 'Rajdhani', 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--nuit); color: var(--texte);
  font-family: var(--hud); font-size: 16px; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--laiton-clair); outline-offset: 3px; }

/* ------------------------------------------------ écrans et couches */
.ecran, .couche { position: fixed; inset: 0; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .35s; }
.ecran.actif, .couche.actif { opacity: 1; visibility: visible; transition: opacity .35s ease, visibility 0s; }
.ecran.actif { pointer-events: auto; }
.ecran { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; z-index: 10; }
.voile { position: absolute; inset: 0; background: rgba(7, 9, 18, 0.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#ecran-entree .voile { background: radial-gradient(ellipse at center, rgba(7,9,18,.35) 0%, rgba(7,9,18,.85) 75%); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); }

.cadre {
  background: var(--voile); border: 1px solid rgba(201, 162, 74, .55); clip-path: var(--biseau);
  box-shadow: inset 0 0 0 1px rgba(240, 213, 138, .08), inset 0 0 40px rgba(201, 162, 74, .05);
}

/* ------------------------------------------------ titres gravés */
.titre {
  font-family: var(--titre); font-weight: 900; margin: 0; letter-spacing: .14em; line-height: 1;
  font-size: clamp(44px, 11vw, 132px);
  background: linear-gradient(180deg, #fff6d6 0%, var(--laiton-clair) 28%, var(--laiton) 55%, #6e5320 78%, #e8c978 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.6)) drop-shadow(0 0 28px rgba(201,162,74,.25));
  padding-left: .14em;
}
.titre-moyen { font-family: var(--titre); font-weight: 900; letter-spacing: .16em; font-size: clamp(22px, 4vw, 38px); color: var(--laiton-clair); text-shadow: 0 0 18px rgba(201,162,74,.3); }
.sur-titre { font-family: var(--titre); font-weight: 500; letter-spacing: .3em; font-size: clamp(11px, 1.5vw, 14px); color: var(--laiton); margin-bottom: 14px; }
.filet { width: min(420px, 70vw); height: 1px; margin: 26px auto; background: linear-gradient(90deg, transparent, var(--laiton), transparent); position: relative; }
.filet span { position: absolute; left: 50%; top: -4px; width: 9px; height: 9px; transform: translateX(-50%) rotate(45deg); border: 1px solid var(--laiton); background: var(--nuit); }
.accroche { font-size: clamp(15px, 2vw, 18px); line-height: 1.55; max-width: 34em; margin: 0 auto 30px; color: #cfcab9; }
.petit { font-size: 13px; color: #8f8a7a; margin-top: 18px; }
.etiquette { font-family: var(--titre); font-size: 12px; letter-spacing: .12em; color: var(--laiton); }
.rouge { color: var(--danger); }

.entree-bloc, .sacre-bloc { position: relative; text-align: center; }
.sacre-bloc .titre { font-size: clamp(30px, 7.5vw, 92px); }
.entree-bloc .titre { animation: frappe 1.4s cubic-bezier(.2,.9,.2,1) both; }
@keyframes frappe { 0% { opacity: 0; letter-spacing: .5em; filter: blur(8px); } 100% { opacity: 1; letter-spacing: .14em; } }

/* ------------------------------------------------ boutons */
.btn {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 180px; padding: 13px 28px; border: 1px solid rgba(201,162,74,.7); background: rgba(7,9,18,.55);
  font-family: var(--titre); font-weight: 700; font-size: 15px; letter-spacing: .1em; color: var(--texte);
  clip-path: var(--biseau); transition: background .15s, color .15s, transform .1s;
}
.btn:hover { background: rgba(201,162,74,.16); color: var(--laiton-clair); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn small { font-family: var(--hud); font-weight: 500; font-size: 13px; letter-spacing: .02em; color: #a59f8b; margin-top: 3px; }
.btn-or { background: linear-gradient(180deg, #e6c56c, var(--laiton) 50%, #9b7a2f); color: #1a1206; border-color: var(--laiton-clair); }
.btn-or:hover { background: linear-gradient(180deg, #fbe2a0, #dcb75c 50%, #ab8838); color: #120c03; }
.btn-fin { min-width: 0; padding: 10px 18px; font-size: 13px; border-color: rgba(201,162,74,.35); }
.btn[disabled] { opacity: .35; pointer-events: none; }
#btn-entrer { font-size: 18px; padding: 16px 40px; }
.rangee-btn { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }

/* ------------------------------------------------ accueil */
#ecran-accueil { justify-content: flex-start; padding: 5vh 20px 3vh; pointer-events: none; }
#ecran-accueil.actif > * { pointer-events: auto; }
.logo-haut { display: flex; flex-direction: column; align-items: center; }
.logo-haut .sur-titre { margin-bottom: 6px; }
.menu-bas { margin-top: auto; display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.btn-menu { min-width: 210px; padding: 16px 26px; }
.btn-menu span { font-size: 18px; }
.rappel { font-size: 14px; color: #a59f8b; text-align: center; margin: 14px 0 0; text-shadow: 0 1px 2px #000; }

/* ------------------------------------------------ choix */
#ecran-choix { justify-content: space-between; padding: 18px 16px 22px; pointer-events: none; overflow-y: auto; }
.entete .btn-fin { justify-self: start; }
#ecran-choix.actif > * { pointer-events: auto; }
.entete { width: 100%; max-width: 1100px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.entete h2 { font-family: var(--titre); font-weight: 700; letter-spacing: .12em; color: var(--laiton-clair); margin: 0; font-size: clamp(18px, 3vw, 26px); text-align: center; }
.choix-corps { flex: 1; width: 100%; max-width: 1100px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fleche { width: 54px; height: 54px; border: 1px solid rgba(201,162,74,.6); background: rgba(7,9,18,.5); font-size: 30px; color: var(--laiton-clair); clip-path: var(--biseau); }
.fleche:hover { background: rgba(201,162,74,.18); }
.fiche { width: min(330px, 46vw); padding: 20px 22px; margin-left: auto; margin-right: 4vw; }
.fiche-role { font-family: var(--titre); font-size: 13px; letter-spacing: .2em; color: var(--laiton); }
.fiche-nom { font-family: var(--titre); font-weight: 900; font-size: clamp(26px, 4vw, 40px); letter-spacing: .06em; margin: 2px 0 14px; color: var(--gyre, var(--laiton-clair)); text-shadow: 0 0 24px var(--gyre, transparent); }
.barres { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; align-items: center; font-size: 14px; font-weight: 600; }
.barre { height: 6px; background: rgba(255,255,255,.08); position: relative; clip-path: polygon(0 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
.barre i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--laiton), var(--gyre, var(--laiton-clair))); transition: width .3s; }
.fiche-zenith { margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(201,162,74,.3); }
.fiche-zenith b { font-family: var(--titre); font-size: 17px; color: var(--laiton-clair); }
.fiche-zenith p { margin: 6px 0 0; font-size: 14px; line-height: 1.4; color: #cfcab9; }
.fiche-sens { margin-top: 10px; font-size: 13px; color: #a59f8b; }
.pastilles { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.pastille { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(201,162,74,.5); background: radial-gradient(circle at 50% 45%, var(--c) 0 22%, rgba(7,9,18,.7) 24%); position: relative; }
.pastille.choisie { border-color: var(--laiton-clair); box-shadow: 0 0 0 3px rgba(240,213,138,.25), 0 0 18px var(--c); }
.pastille.verrou { background: rgba(7,9,18,.7); opacity: .6; cursor: not-allowed; }
.pastille.verrou::after { content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 10px; transform: translate(-50%, -20%); border: 2px solid var(--laiton); border-radius: 2px; }
.pastille.verrou::before { content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; transform: translate(-50%, -95%); border: 2px solid var(--laiton); border-bottom: 0; border-radius: 5px 5px 0 0; }
.pastille.hasard { background: rgba(7,9,18,.7); font-family: var(--titre); font-size: 18px; color: var(--laiton-clair); }
.pastilles.petites .pastille { width: 34px; height: 34px; }
.choix-libre { padding: 12px 18px; margin-bottom: 12px; display: none; gap: 8px; flex-direction: column; }
.choix-libre.visible { display: flex; }
.ligne-choix { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.segments { display: flex; border: 1px solid rgba(201,162,74,.5); }
.segments button { padding: 8px 14px; background: transparent; border: 0; font-weight: 600; font-size: 15px; color: #cfcab9; }
.segments button + button { border-left: 1px solid rgba(201,162,74,.3); }
.segments button.choisi { background: rgba(201,162,74,.25); color: var(--laiton-clair); }

/* ------------------------------------------------ carte de l'Ascension */
#ecran-carte { justify-content: space-between; padding: 18px 16px 24px; }
.carte { display: flex; flex-direction: column-reverse; align-items: center; gap: 10px; }
.anneau-carte { width: clamp(180px, 34vw, 300px); height: 46px; border: 1px solid rgba(201,162,74,.35); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--titre); font-size: 14px; letter-spacing: .08em; color: #8f8a7a; }
.anneau-carte.fait { color: var(--laiton); border-color: rgba(201,162,74,.6); }
.anneau-carte.courant { color: #fff6d6; border-color: var(--laiton-clair); box-shadow: 0 0 22px rgba(240,213,138,.35), inset 0 0 18px rgba(240,213,138,.2); animation: lueur 2.2s ease-in-out infinite; }
@keyframes lueur { 50% { box-shadow: 0 0 34px rgba(240,213,138,.55), inset 0 0 26px rgba(240,213,138,.3); } }
.carte-adv { display: flex; flex-direction: column; align-items: center; padding: 14px 30px; gap: 4px; }
.carte-adv b { font-family: var(--titre); font-size: 22px; color: var(--laiton-clair); }

/* ------------------------------------------------ présentation */
#presentation { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 16vh; z-index: 6; }
.pres-ligne { display: flex; align-items: baseline; gap: 22px; font-family: var(--titre); font-weight: 900; font-size: clamp(26px, 5vw, 56px); letter-spacing: .06em; flex-wrap: wrap; justify-content: center; }
.pres-ligne em { font-style: normal; font-weight: 500; font-size: .45em; color: var(--laiton); letter-spacing: .2em; }
#pres-a { color: var(--c0); text-shadow: 0 0 30px var(--c1); }
#pres-b { color: var(--c1); text-shadow: 0 0 30px var(--c0); }
.pres-sous { margin-top: 8px; font-size: 16px; color: #cfcab9; }
#presentation.actif .pres-ligne { animation: entreePres .6s cubic-bezier(.2,.9,.2,1) both; }
@keyframes entreePres { from { opacity: 0; transform: scale(1.25); filter: blur(6px); } }

/* ------------------------------------------------ HUD */
#hud { z-index: 5; }
.hud-haut { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 14px; }
.hud-joueur { position: relative; width: clamp(130px, 22vw, 220px); text-align: center; --c: var(--c0); }
.hud-joueur.droite { --c: var(--c1); }
.arc-boite { position: relative; transition: transform .18s cubic-bezier(.2,.9,.2,1); }
.arc-elan { width: 100%; display: block; overflow: visible; }
.arc-fantome { fill: none; stroke: rgba(255,246,214,.75); stroke-width: 9; transition: stroke-dashoffset .5s cubic-bezier(.5,0,.8,.4) .12s; }
.arc-fond { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 9; stroke-linecap: butt; }
.arc-val { fill: none; stroke: var(--c); stroke-width: 9; filter: drop-shadow(0 0 6px var(--c)); transition: stroke .3s; }
.hud-joueur.touche .arc-boite { transform: scale(1.06); }
.hud-joueur.touche .arc-val { stroke: #fff; filter: drop-shadow(0 0 10px #fff); transition: none; }
/* Élan au-delà de 100 (lancer parfait) : la couleur de la gyre reste, auréolée d'or */
.hud-joueur.surcharge .arc-val { filter: drop-shadow(0 0 3px #fff6d6) drop-shadow(0 0 12px var(--laiton-clair)); }
.hud-joueur.bas .arc-val { stroke: var(--danger); filter: drop-shadow(0 0 8px var(--danger)); animation: clignote .5s steps(2) infinite; }
@keyframes clignote { 50% { opacity: .55; } }
.hud-chiffre { position: absolute; left: 0; right: 0; top: 38%; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.hud-chiffre b { font-weight: 700; font-size: clamp(22px, 3.4vw, 34px); font-variant-numeric: tabular-nums; text-shadow: 0 0 12px rgba(0,0,0,.8); }
.hud-chiffre small { font-size: 12px; color: #a59f8b; letter-spacing: .1em; }
.hud-nom { font-family: var(--titre); font-weight: 700; font-size: clamp(13px, 1.8vw, 17px); letter-spacing: .08em; color: var(--c); margin-top: 2px; text-shadow: 0 1px 3px #000; }
.hud-points { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
.hud-points i { width: 11px; height: 11px; transform: rotate(45deg); border: 1px solid var(--laiton); background: rgba(7,9,18,.6); transition: background .2s, box-shadow .2s; }
.hud-points i.on { background: var(--laiton-clair); box-shadow: 0 0 12px var(--laiton-clair); animation: pointFrappe .5s cubic-bezier(.2,.9,.2,1); }
@keyframes pointFrappe { 0% { transform: rotate(45deg) scale(2.2); } 100% { transform: rotate(45deg) scale(1); } }
.hud-centre { text-align: center; padding-top: 8px; }
#chrono { font-weight: 700; font-size: clamp(22px, 3.2vw, 32px); font-variant-numeric: tabular-nums; letter-spacing: .04em; text-shadow: 0 0 10px rgba(0,0,0,.8); }
#chrono.mort { color: var(--danger); text-shadow: 0 0 14px var(--danger); }
#manche { font-family: var(--titre); font-weight: 700; font-size: 13px; letter-spacing: .14em; color: var(--laiton-clair); text-shadow: 0 1px 2px #000, 0 0 10px rgba(0,0,0,.9); }
.hud-bas { position: absolute; left: 14px; bottom: 14px; display: flex; align-items: flex-end; gap: 14px; }
.jauge-zenith { position: relative; width: 104px; height: 104px; }
.jauge-zenith svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.zf { fill: rgba(7,9,18,.55); stroke: rgba(255,255,255,.1); stroke-width: 6; }
.zv { fill: none; stroke: var(--laiton-clair); stroke-width: 6; stroke-dasharray: 314.16; stroke-dashoffset: 314.16; filter: drop-shadow(0 0 4px var(--laiton)); }
.jauge-zenith.pleine .zv { stroke: #fff6d6; animation: pulse .7s ease-in-out infinite; }
@keyframes pulse { 50% { filter: drop-shadow(0 0 14px var(--laiton-clair)); stroke-width: 9; } }
.jz-texte { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; text-align: center; }
.jz-texte b { font-family: var(--titre); font-size: 14px; color: var(--laiton-clair); }
.jz-texte small { font-size: 11px; color: #cfcab9; max-width: 80px; }
.jz-texte .jz-touche { color: #8f8a7a; }
body.tactile .jz-touche { display: none; }
.recharges { display: flex; gap: 10px; padding-bottom: 6px; }
.recharge { width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; --p: 1;
  background: conic-gradient(var(--laiton) calc(var(--p) * 360deg), rgba(255,255,255,.07) 0); position: relative; }
.recharge::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: rgba(7,9,18,.85); }
.recharge span { position: relative; }
.recharge.prete { box-shadow: 0 0 12px rgba(240,213,138,.45); }
.recharge.prete span { color: var(--laiton-clair); }
.aide { position: absolute; left: 50%; bottom: 18vh; transform: translateX(-50%); padding: 12px 22px; background: var(--voile); border: 1px solid var(--laiton); clip-path: var(--biseau); font-size: 17px; font-weight: 600; opacity: 0; transition: opacity .3s; max-width: 90vw; text-align: center; }
.aide.visible { opacity: 1; }
.aide b { color: var(--laiton-clair); }

/* ------------------------------------------------ lancement */
#lancement { z-index: 6; display: flex; flex-direction: column; align-items: center; }
#rituel { margin-top: 21vh; font-family: var(--titre); font-weight: 900; font-size: clamp(34px, 7vw, 84px); letter-spacing: .2em; color: var(--laiton-clair); text-shadow: 0 0 30px rgba(201,162,74,.6), 0 3px 0 #000; padding-left: .2em; }
#rituel.frappe { animation: frappeTexte .35s cubic-bezier(.2,.9,.2,1); }
#rituel.lache { color: #fff; text-shadow: 0 0 40px #fff, 0 0 80px var(--laiton-clair); }
@keyframes frappeTexte { 0% { transform: scale(1.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
/* centrée sur la gyre suspendue par I.posTension (transform posé chaque image) */
#tension { position: absolute; left: 0; top: 0; width: clamp(180px, 26vw, 300px); height: clamp(180px, 26vw, 300px); opacity: 0; transition: opacity .2s; transform: translate(50vw, 58vh) translate(-50%, -50%); }
#tension.visible { opacity: 1; }
#tension svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.t-fond { fill: rgba(7,9,18,.12); stroke: rgba(255,255,255,.12); stroke-width: 14; }
.t-or { fill: none; stroke: #fff6d6; stroke-width: 9; stroke-dasharray: 0 653.45; filter: drop-shadow(0 0 6px var(--laiton-clair)); }
.t-val { fill: none; stroke: var(--laiton); stroke-width: 10; stroke-dasharray: 0 565.49; filter: drop-shadow(0 0 6px var(--laiton)); }
#tension.dans-or .t-val { stroke: #fff6d6; filter: drop-shadow(0 0 12px #fff); }
.t-pct { position: absolute; left: 0; right: 0; top: 100%; margin-top: 6px; text-align: center; font-weight: 700; font-size: clamp(20px, 2.6vw, 28px); font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px #000, 0 0 10px #000; }
.consigne { position: absolute; bottom: 5vh; left: 0; right: 0; text-align: center; font-size: clamp(15px, 2vw, 19px); font-weight: 600; color: #e9e6da; text-shadow: 0 1px 3px #000, 0 0 12px #000; margin: 0; padding: 0 12px; }

/* ------------------------------------------------ annonces */
#annonce { z-index: 7; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#annonce-texte { font-family: var(--titre); font-weight: 900; font-size: clamp(34px, 8vw, 104px); letter-spacing: .12em; text-align: center; color: var(--ac, var(--laiton-clair)); text-shadow: 0 0 34px var(--ac, rgba(201,162,74,.8)), 0 4px 0 rgba(0,0,0,.7); padding: 0 10px; }
#annonce-sous { font-family: var(--hud); font-weight: 700; font-size: clamp(16px, 2.4vw, 24px); letter-spacing: .1em; color: #fff6d6; margin-top: 8px; text-shadow: 0 2px 4px #000; }
#annonce.frappe #annonce-texte { animation: annonceFrappe 1.3s cubic-bezier(.2,.9,.2,1) both; }
#annonce.frappe #annonce-sous { animation: annonceFrappe 1.3s .05s cubic-bezier(.2,.9,.2,1) both; }
@keyframes annonceFrappe { 0% { transform: scale(1.6); opacity: 0; } 9% { transform: scale(1); opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: scale(1.04); } }
#annonce.petite #annonce-texte { font-size: clamp(24px, 5vw, 56px); }
#degats { z-index: 7; }
.degat { position: absolute; left: 0; top: 0; font-weight: 700; font-size: 26px; color: #fff6d6; text-shadow: 0 0 10px var(--danger), 0 2px 2px #000; opacity: 0; pointer-events: none; will-change: transform, opacity; }
.degat.anim { animation: degat .9s ease-out both; }
@keyframes degat { 0% { opacity: 1; transform: translate(-50%, 0) scale(1.4); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }

/* ------------------------------------------------ voiles plein écran */
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 4; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%); }
/* un dégradé ne s'anime pas : la vignette fermée est un second calque dont on anime l'opacité */
#vignette::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 28%, rgba(0,0,0,.85) 80%); opacity: 0; transition: opacity 1.2s ease; }
#vignette.fermee::after { opacity: 1; }
#vignette.mort { box-shadow: inset 0 0 120px rgba(255,59,31,.35); }
#assombri { position: fixed; inset: 0; pointer-events: none; z-index: 3; background: radial-gradient(ellipse at center, rgba(7,9,18,.2), rgba(7,9,18,.7)); opacity: 0; transition: opacity .25s; }
#assombri.actif { opacity: 1; }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 8; background: #fff; opacity: 0; }
#flash.eclair { animation: flash .32s ease-out; }
@keyframes flash { 0% { opacity: .9; } 25% { opacity: .75; } 100% { opacity: 0; } }

/* ------------------------------------------------ fin de duel */
#ecran-fin { justify-content: flex-end; padding-bottom: 6vh; background: linear-gradient(0deg, rgba(7,9,18,.7), transparent 60%); }
.fin-bloc { padding: 22px 30px; text-align: center; max-width: 640px; width: 100%; }
.fin-titre { font-family: var(--titre); font-weight: 900; font-size: clamp(40px, 8vw, 82px); letter-spacing: .14em; margin: 0; color: var(--laiton-clair); text-shadow: 0 0 30px rgba(201,162,74,.6); padding-left: .14em; }
.fin-titre.defaite { color: #8f97b8; text-shadow: 0 0 30px rgba(100,110,170,.5); }
.fin-score { font-weight: 700; font-size: 22px; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-size: 12px; color: #a59f8b; }
.stats dd { margin: 0; font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------ pause / options / dialogue */
.panneau { position: relative; padding: 26px 32px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; min-width: min(360px, 90vw); }
.panneau h2 { font-family: var(--titre); letter-spacing: .14em; margin: 0 0 6px; text-align: center; color: var(--laiton-clair); }
.option { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 600; }
.option input[type=range] { flex: 1; accent-color: var(--laiton); }
.option.case { cursor: pointer; flex-wrap: wrap; }
.option.case input { width: 18px; height: 18px; accent-color: var(--laiton); }
.option small { width: 100%; font-weight: 500; font-size: 13px; color: #a59f8b; padding-left: 30px; margin-top: -6px; }
#dialogue { z-index: 20; }
#dialogue p { font-size: 18px; text-align: center; margin: 0; }
#ecran-pause, #ecran-options { z-index: 15; }
#ecran-options { z-index: 16; }

/* ------------------------------------------------ tactile */
#tactile { position: fixed; right: 16px; bottom: 16px; z-index: 9; display: none; grid-template-columns: repeat(2, 72px); grid-template-rows: auto 72px 72px; gap: 12px; }
#tactile.visible { display: grid; }
.t-btn { width: 72px; height: 72px; border-radius: 50%; border: 2px solid var(--laiton); background: radial-gradient(circle at 40% 35%, rgba(240,213,138,.35), rgba(7,9,18,.75) 70%); color: var(--laiton-clair); font-family: var(--titre); font-weight: 700; font-size: 13px; touch-action: none; }
.t-btn:active, .t-btn.appui { background: radial-gradient(circle, rgba(240,213,138,.7), rgba(201,162,74,.4)); color: #1a1206; }
#t-zenith { grid-column: 1; grid-row: 2; }
#t-garde { grid-column: 1; grid-row: 3; }
#t-ruee { grid-column: 2; grid-row: 2 / span 2; height: 72px; align-self: center; width: 72px; transform: scale(1.15); }
#t-pause { grid-column: 2; grid-row: 1; width: 44px; height: 44px; justify-self: end; font-size: 14px; }
.t-btn.inactif { opacity: .35; filter: grayscale(1); }

/* ------------------------------------------------ divers */
#panneau-f2 { position: fixed; right: 10px; top: 120px; z-index: 30; margin: 0; padding: 10px 12px; font: 12px/1.45 var(--hud); background: rgba(7,9,18,.8); border: 1px solid rgba(201,162,74,.5); color: var(--texte); display: none; white-space: pre; pointer-events: none; }
#panneau-f2.visible { display: block; }
#erreur { z-index: 50; background: var(--nuit); }
#erreur p { max-width: 32em; line-height: 1.5; }

@media (max-width: 720px) {
  .choix-corps { flex-direction: row; align-items: flex-end; }
  .fiche { width: auto; flex: 1; margin: 0; padding: 14px; }
  .fiche-zenith p, .fiche-sens { display: none; }
  .choix-corps { align-items: flex-start; }
  .entete h2 { font-size: 16px; }
  .entete .btn-fin { padding: 8px 10px; font-size: 12px; }
  .fleche { width: 42px; height: 42px; font-size: 24px; }
  .btn-menu { min-width: 150px; padding: 12px 16px; }
  .rappel { display: none; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .jauge-zenith { width: 84px; height: 84px; }
  .recharges { display: none; }
  .hud-haut { padding: 6px 6px; }
}
@media (max-height: 620px) {
  #ecran-choix, #ecran-carte { padding-top: 8px; padding-bottom: 10px; }
  .fiche { padding: 10px 16px; }
  .fiche-nom { font-size: 24px; margin-bottom: 6px; }
  .barres { gap: 3px 10px; font-size: 12px; }
  .fiche-zenith { margin-top: 8px; padding-top: 6px; }
  .fiche-zenith p, .fiche-sens { display: none; }
  .pastille { width: 34px; height: 34px; }
  .pastilles.petites .pastille { width: 28px; height: 28px; }
  .choix-libre { padding: 6px 12px; margin-bottom: 6px; }
  .segments button { padding: 5px 10px; font-size: 14px; }
  .btn { padding: 9px 22px; }
  .anneau-carte { height: 32px; }
  .carte-adv { padding: 8px 20px; }
  .hud-joueur { width: 140px; }
  .jauge-zenith { width: 80px; height: 80px; }
  .recharge { width: 48px; height: 48px; font-size: 11px; }
  #rituel { margin-top: 19vh; }
}
@media (prefers-reduced-motion: reduce) {
  .entree-bloc .titre, .anneau-carte.courant { animation: none; }
}

/* ================================================ JEU EN LIGNE — « la Table des Forges » */
.btn-amis { border-color: var(--laiton-clair); box-shadow: 0 0 22px rgba(240,213,138,.18); }
.btn-amis span { color: var(--laiton-clair); }

/* ---- Jouer entre amis */
#ecran-amis { justify-content: flex-start; gap: 4vh; padding-top: 18px; }
.amis-bloc { width: min(440px, 92vw); padding: 24px 26px 20px; display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.amis-invite { margin: 0; font-family: var(--titre); font-size: clamp(18px, 3.2vw, 24px); letter-spacing: .06em; color: var(--laiton-clair); text-align: center; line-height: 1.35; }
.amis-invite:empty { display: none; }
.amis-invite b { color: #fff6d6; }
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ input, .amis-code input {
  font: 600 18px var(--hud); color: var(--texte); background: rgba(7,9,18,.7); border: 1px solid rgba(201,162,74,.55);
  padding: 10px 12px; clip-path: var(--biseau); outline: none; user-select: text; -webkit-user-select: text;
}
.champ input:focus, .amis-code input:focus { border-color: var(--laiton-clair); box-shadow: inset 0 0 0 1px rgba(240,213,138,.35); }
.amis-choix { display: flex; flex-direction: column; gap: 12px; }
.amis-ou { display: flex; align-items: center; gap: 10px; color: #8f8a7a; font-size: 13px; }
.amis-ou::before, .amis-ou::after { content: ''; flex: 1; height: 1px; background: rgba(201,162,74,.3); }
.amis-code { display: flex; gap: 10px; }
.amis-code input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .4em; font-family: var(--titre); font-weight: 700; text-align: center; }
.amis-msg { margin: 0; min-height: 1.3em; font-size: 15px; color: #f0b48a; text-align: center; }
.amis-msg.info { color: #cfcab9; }
#amis-entrer, #amis-ma-table { display: none; }
#ecran-amis.lien #amis-entrer { display: block; }
#ecran-amis.lien #amis-choix { display: none; }
#ecran-amis.erreur-lien #amis-ma-table { display: block; }
#ecran-amis.indispo .champ, #ecran-amis.indispo #amis-choix, #ecran-amis.indispo #amis-entrer { display: none; }

/* ---- Salon */
#ecran-table { justify-content: space-between; align-items: stretch; padding: 14px 16px 16px; pointer-events: none; }
#ecran-table.actif > * { pointer-events: auto; }
.table-haut { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.table-code { display: flex; flex-direction: column; align-items: center; }
.table-code b { font-family: var(--titre); font-weight: 900; font-size: clamp(26px, 5vw, 40px); letter-spacing: .3em; color: var(--laiton-clair); text-shadow: 0 0 20px rgba(201,162,74,.35); padding-left: .3em; user-select: text; -webkit-user-select: text; }
.table-panneau { align-self: flex-end; width: min(400px, 94vw); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; }
.table-joueurs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.table-joueurs li { display: grid; grid-template-columns: 14px 1fr auto auto; align-items: center; gap: 8px; padding: 5px 6px; border-bottom: 1px solid rgba(201,162,74,.15); font-size: 15px; }
.table-joueurs li.moi { background: rgba(201,162,74,.08); }
.table-joueurs .pastille-mini { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.table-joueurs .pseudo { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-joueurs .role { font-size: 12px; color: #a59f8b; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.table-joueurs .role.roi { color: var(--laiton-clair); }
.table-joueurs .badge { font-size: 11px; padding: 1px 6px; border: 1px solid rgba(201,162,74,.5); color: var(--laiton-clair); white-space: nowrap; }
.table-joueurs .badge.pret { background: rgba(93,255,143,.15); border-color: #5dff8f; color: #b9ffcf; }
.table-joueurs .badge.absent { border-color: #8f8a7a; color: #8f8a7a; }
.table-joueurs .ping { width: 8px; height: 8px; border-radius: 50%; background: #5dff8f; display: inline-block; margin-left: 6px; }
.table-joueurs .ping.moyen { background: #ffb020; } .table-joueurs .ping.lent { background: #ff3b1f; } .table-joueurs .ping.aucun { background: transparent; }
.table-joueurs button { font-size: 12px; padding: 2px 8px; background: transparent; border: 1px solid rgba(255,59,31,.6); color: #ffb3a6; }
.table-hote { display: none; flex-direction: column; gap: 8px; }
.table-hote.visible { display: flex; }
#table-gyres .pastille.prise { opacity: .3; cursor: not-allowed; }
#table-gyres .pastille.prise::after { content: attr(data-porteur); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: 10px; white-space: nowrap; color: #8f8a7a; }
#btn-pret.actif { background: rgba(93,255,143,.18); border-color: #5dff8f; color: #b9ffcf; }
.table-decompte { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: var(--titre); font-weight: 900; font-size: clamp(60px, 14vw, 150px); color: var(--laiton-clair); text-shadow: 0 0 40px rgba(201,162,74,.6); pointer-events: none !important; }
.table-lien { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.table-lien.visible { position: static; left: auto; width: min(400px, 94vw); height: auto; opacity: 1; align-self: flex-end; font: 14px var(--hud); padding: 8px; background: rgba(7,9,18,.8); color: var(--texte); border: 1px solid var(--laiton); user-select: text; -webkit-user-select: text; }

/* ---- Appel des Forges, bandeau, Instant décisif */
#appel { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 14vh; z-index: 6; }
#appel-nom { font-family: var(--titre); font-weight: 900; font-size: clamp(40px, 9vw, 104px); letter-spacing: .08em; color: var(--ac, var(--laiton-clair)); text-shadow: 0 0 40px var(--ac, transparent), 0 4px 0 rgba(0,0,0,.6); }
#appel-titre { font-family: var(--titre); font-size: clamp(14px, 2vw, 20px); letter-spacing: .2em; color: var(--laiton); margin-top: 6px; min-height: 1.2em; }
#appel.frappe #appel-nom { animation: frappeAppel .55s cubic-bezier(.2,.9,.2,1) both; }
@keyframes frappeAppel { 0% { transform: scale(2.4); opacity: 0; filter: blur(8px); } 60% { transform: scale(.96); opacity: 1; filter: blur(0); } 100% { transform: scale(1); } }
#bandeau { display: flex; align-items: baseline; justify-content: center; gap: .5em; top: 26%; bottom: auto; height: auto; font-family: var(--titre); font-weight: 900; font-size: clamp(24px, 5vw, 56px); letter-spacing: .06em; z-index: 7; flex-wrap: wrap; padding: 0 10px; }
#bandeau span:first-child { color: var(--ca, #fff); text-shadow: 0 0 26px var(--ca, transparent); }
#bandeau span:last-child { color: var(--cb, #fff); text-shadow: 0 0 26px var(--cb, transparent); }
#bandeau em { font-style: normal; font-weight: 500; font-size: .55em; color: var(--laiton-clair); letter-spacing: .2em; }
#bandeau.actif { animation: gravure .5s cubic-bezier(.2,.9,.2,1) both; }
@keyframes gravure { 0% { clip-path: inset(0 100% 0 0); } 100% { clip-path: inset(0 0 0 0); } }
#decisif { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 9vh; z-index: 7; }
.decisif-titre { font-family: var(--titre); font-weight: 900; font-size: clamp(26px, 6vw, 64px); letter-spacing: .22em; color: #fff6d6; text-shadow: 0 0 30px rgba(255,122,42,.7); padding-left: .22em; }
#decisif small { color: #a59f8b; font-size: 13px; margin-top: 6px; }
#decisif.actif .decisif-titre { animation: frappeAppel .7s cubic-bezier(.2,.9,.2,1) both; }
.fin-suite { margin: 10px 0 0; text-align: center; color: #cfcab9; font-size: 14px; min-height: 1.2em; }
#hud-ping { font-size: 12px; color: #8f8a7a; margin-top: 2px; min-height: 1em; }
#hud.gradins .hud-bas { display: none; }

/* ---- étiquettes projetées, volutes, bulles */
#etiquettes, #volutes { z-index: 4; pointer-events: none; }
.etiq { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); font-weight: 700; font-size: 14px; padding: 1px 8px; white-space: nowrap;
  background: rgba(7,9,18,.6); border: 1px solid var(--c, rgba(201,162,74,.5)); color: #fff6d6; text-shadow: 0 1px 2px #000; display: none; }
.etiq.visible { display: block; }
.etiq b { color: #ff7a2a; margin-left: 6px; font-size: 11px; letter-spacing: .12em; }
.etiq.roi::before { content: '♛ '; color: var(--laiton-clair); }
.volute { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); font-family: var(--titre); font-weight: 900; font-size: 30px; color: var(--c, #fff6d6);
  text-shadow: 0 0 16px var(--c, rgba(255,246,214,.6)); opacity: 0; white-space: nowrap; }
.volute.anim { animation: volute 2.2s ease-out forwards; }
@keyframes volute { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }
.bulle { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); font-weight: 700; font-size: 15px; padding: 6px 12px; background: rgba(255,246,214,.95); color: #1a1206;
  clip-path: polygon(0 0, 100% 0, 100% 80%, 58% 80%, 50% 100%, 42% 80%, 0 80%); padding-bottom: 14px; opacity: 0; white-space: nowrap; border-left: 4px solid var(--c, var(--laiton)); }
.bulle.anim { animation: bulle 2.4s ease-out forwards; }
@keyframes bulle { 0% { opacity: 0; margin-top: 10px; } 10% { opacity: 1; margin-top: 0; } 80% { opacity: 1; } 100% { opacity: 0; margin-top: -14px; } }

/* ---- barre de Signes : colonne fine sur le bord droit (à gauche en tactile), jamais sur l'arène */
.signes { position: fixed; right: 8px; top: 50%; transform: translateY(-50%); z-index: 8; display: none; flex-direction: row; align-items: center; gap: 6px; }
.signes.visible { display: flex; }
.signes-reactions { display: flex; flex-direction: column; gap: 4px; }
.signes-vannes { display: none; flex-direction: column; gap: 4px; align-items: flex-end; }
.signes.ouvert .signes-vannes { display: flex; }
.signes button { min-width: 36px; height: 30px; padding: 0 7px; background: rgba(7,9,18,.62); border: 1px solid rgba(201,162,74,.4); color: var(--laiton-clair); font-family: var(--titre); font-weight: 700; font-size: 13px; clip-path: var(--biseau); }
.signes button:hover { background: rgba(201,162,74,.22); }
.signes-vannes button { font-family: var(--hud); font-size: 13px; font-weight: 600; color: var(--texte); white-space: nowrap; }
body.tactile .signes { right: auto; left: 6px; flex-direction: row-reverse; }
body.tactile .signes-vannes { align-items: flex-start; }
@media (max-height: 420px) { .signes button { height: 24px; min-width: 30px; font-size: 11px; } .signes-reactions, .signes-vannes { gap: 2px; } }

/* ---- signal faible */
#signal-faible { display: flex; gap: 3px; align-items: flex-end; left: auto; right: 14px; top: 90px; bottom: auto; width: auto; height: auto; z-index: 6; }
#signal-faible i { width: 5px; background: #ff3b1f; display: block; }
#signal-faible i:nth-child(1) { height: 6px; } #signal-faible i:nth-child(2) { height: 10px; opacity: .3; } #signal-faible i:nth-child(3) { height: 14px; opacity: .3; }
#signal-faible.actif { animation: clignote .6s steps(2) infinite; }

@media (max-width: 700px) {
  .table-panneau { align-self: stretch; width: auto; max-height: 52vh; }
  .table-joueurs li { font-size: 14px; }
}
#ecran-amis.erreur-lien #amis-choix, #ecran-amis.erreur-lien #amis-entrer { display: none; }
/* salon : les Signes passent en rangée sous le code de la Table (le panneau occupe la droite) */
#ecran-table.actif ~ .signes { top: 78px; left: 50%; right: auto; transform: translateX(-50%); flex-direction: column; }
#ecran-table.actif ~ .signes .signes-reactions, #ecran-table.actif ~ .signes .signes-vannes { flex-direction: row; flex-wrap: wrap; justify-content: center; }

/* ---- Gradins : pronostic à l'Appel */
/* en bas à gauche : la place du Zénith et des recharges, cachés aux Gradins ; le bas à droite est aux Signes */
.prono { position: fixed; left: 12px; bottom: 12px; z-index: 8; display: none; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 14px; background: var(--voile); border: 1px solid rgba(201,162,74,.45); clip-path: var(--biseau); }
.prono.visible { display: flex; }
.prono-choix { display: flex; gap: 10px; }
.prono button { min-width: 110px; padding: 7px 14px; font: 700 15px var(--titre); color: var(--c, #f0d58a); background: rgba(7,9,18,.7);
  border: 1px solid var(--c, #c9a24a); clip-path: var(--biseau); cursor: pointer; }
.prono button:hover:not(:disabled) { background: rgba(201,162,74,.2); }
.prono button:disabled { opacity: .45; cursor: default; }
.prono button.choisi { opacity: 1; box-shadow: inset 0 0 0 2px var(--c, #f0d58a); }
/* ---- rappel des touches (salon, HUD) */
.table-rappel { margin: 0; font-size: 13px; color: #8f8a7a; text-align: center; }
.rappel-tactile { display: none; }
body.tactile .rappel-pc { display: none; }
body.tactile .rappel-tactile { display: inline; }
.rc-touche { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 1px; font-size: 10px; font-weight: 600; color: #8f8a7a; white-space: nowrap; }
body.tactile .rc-touche { display: none; }
/* ---- Signes en combat : en bas à droite (au milieu, ils recouvraient le HUD de l'adversaire en 800×450), réactions en grille */
.signes { top: auto; bottom: 12px; transform: none; align-items: flex-end; }
.signes-reactions { display: grid; grid-template-columns: repeat(3, auto); gap: 4px; }
body.tactile .signes { top: 50%; bottom: auto; transform: translateY(-50%); }
@media (max-height: 420px) { .signes-reactions { grid-template-columns: repeat(5, auto); gap: 2px; } }
#ecran-table.actif ~ .signes { bottom: auto; }
#ecran-table.actif ~ .signes .signes-reactions { display: flex; }
@media (max-height: 480px) { .table-rappel { display: none; } }
@media (max-width: 600px), (max-height: 420px) { .prono { padding: 5px 8px; } .prono button { min-width: 74px; padding: 5px 8px; font-size: 13px; } }
