:root {
  --bg: #0d1220;
  --bg2: #141b2e;
  --panel: #1a2238;
  --panel2: #222c47;
  --line: #2f3b5c;
  --text: #e8ecf5;
  --muted: #9aa6c3;
  --text2: #b9c2d8;
  --line2: #3c4870;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --gold: #d9b25f;
  --gold2: #f2d58f;
  --ok: #4cc38a;
  --bad: #e5604f;
  --fury: #d6453d;
  --calm: #3fae68;
  --mind: #3d8ee0;
  --body: #e8892f;
  --chaos: #9b59d0;
  --order: #d9b93a;
  --neutral: #7d8597;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--gold2); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; font-weight: 500; }
h1 { font-size: 2rem; letter-spacing: -.01em; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; }
h4 { font-weight: 500; }
.ic { flex: none; vertical-align: -3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }
p { margin: 0 0 .9em; }
button { font: inherit; cursor: pointer; }

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 24px;
  background: rgba(13, 18, 32, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); text-decoration: none; font-size: 1.0625rem; }
.logo span { color: var(--muted); font-weight: 400; }
.logo::before { content: ""; width: 10px; height: 10px; transform: rotate(45deg); background: var(--gold); border-radius: 2px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: .9375rem;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.actif { color: var(--gold2); background: var(--panel2); }

main { max-width: 1100px; margin: 0 auto; padding: 32px 24px 80px; }

/* ---------- Éléments communs ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tile {
  display: block; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.tile:hover { border-color: var(--line2); background: var(--panel2); }
.tile .ico-big { display: flex; color: var(--muted); }
.tile:hover .ico-big { color: var(--gold2); }
.tile h3 { margin: 12px 0 4px; }
.tile p { color: var(--muted); font-size: .92rem; margin: 0; }
.tile.bientot { opacity: .55; pointer-events: none; }
.badge {
  display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line);
}
.badge.ok { color: var(--ok); border-color: var(--ok); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px;
  background: var(--gold); color: #1b1406; border: 0; border-radius: 8px; padding: 8px 16px; font-weight: 500;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--gold2); }
.btn:active { transform: scale(.98); }
.btn.sec { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.btn.sec:hover { border-color: var(--line2); }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.note {
  border: 1px solid rgba(217, 178, 95, .35); background: rgba(217, 178, 95, .08);
  padding: 12px 16px; border-radius: 8px; margin: 0 0 1em;
}
.note.astuce { border-color: var(--mind); background: rgba(61, 142, 224, .08); }
.note.attention { border-color: var(--bad); background: rgba(229, 96, 79, .08); }
.progress { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--gold); }
kbd, .chip {
  display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px;
  padding: 0 6px; font-size: .9em;
}
table.simple { border-collapse: collapse; width: 100%; margin-bottom: 1em; }
table.simple th, table.simple td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
table.simple th { color: var(--muted); font-weight: 500; }

/* ---------- Tutoriel ---------- */
.tuto-layout { display: grid; grid-template-columns: 250px 1fr; gap: 24px; }
.tuto-side { position: sticky; top: 70px; align-self: start; }
.tuto-side ol { list-style: none; padding: 0; margin: 0; }
.tuto-side li a {
  display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: .93rem;
}
.tuto-side li a:hover { background: var(--panel); color: var(--text); }
.tuto-side li a.actif { background: var(--panel2); color: var(--gold2); }
.tuto-side .num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--panel2); font-size: .75rem; border: 1px solid var(--line);
}
.tuto-side .fait .num { background: var(--ok); color: #062; border-color: var(--ok); }
.lecon h1 { margin-bottom: .2em; }
.lecon .intro { color: var(--muted); font-size: 1.05rem; margin-bottom: 1.4em; }
.lecon section { margin-bottom: 24px; }
.lecon-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; }
.cartes-ligne { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0 16px; align-items: flex-start; }
.legende-carte { font-size: .85rem; color: var(--muted); max-width: 190px; margin-top: 6px; }

/* Quiz */
.quiz .question { margin-bottom: 18px; }
.quiz .question p { font-weight: 600; }
.quiz .choix { display: grid; gap: 8px; }
.quiz .choix button {
  text-align: left; background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; transition: border-color .15s var(--ease);
}
.quiz .choix button:hover:not(:disabled) { border-color: var(--line2); }
.quiz .choix button.bonne { border-color: var(--ok); background: rgba(76, 195, 138, .15); }
.quiz .choix button.fausse { border-color: var(--bad); background: rgba(229, 96, 79, .15); }
.quiz .explication { margin-top: 8px; font-size: .93rem; color: var(--muted); }
.quiz .score { font-size: 1.1rem; font-weight: 600; }

/* ---------- Widgets ---------- */
.widget {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0 24px;
}
.widget-titre { font-weight: 500; color: var(--text); margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.retour { margin-top: 12px; min-height: 1.5em; }
.retour.ok { color: var(--ok); }
.retour.bad { color: var(--bad); }

/* Plateau */
.plateau { display: grid; gap: 8px; grid-template-columns: 1fr 1fr 1fr 1fr; }
.zone {
  border: 1px dashed var(--line); border-radius: 10px; padding: 10px; min-height: 64px;
  background: var(--panel); color: var(--text); text-align: center; font-size: .9rem;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
button.zone:hover, button.zone.sel { border: 1px solid var(--gold); background: var(--panel2); }
.zone small { color: var(--muted); font-size: .75rem; }
.zone.adv { opacity: .75; }
.zone.bf { min-height: 110px; border-style: solid; border-color: #4a5a85; background: linear-gradient(180deg, #1f2a46, #18203a); }
.zone.base { min-height: 74px; }
.plateau .sep { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: .8rem; }
.zone-info { margin-top: 12px; }

/* Anatomie */
.anatomie { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.anatomie .rb-card { transform: scale(1.25); transform-origin: top left; margin: 0 60px 70px 0; }
.anatomie .rb-card [data-part] { cursor: pointer; }
.anatomie .rb-card [data-part]:hover, .anatomie .rb-card .sel { outline: 2px solid var(--gold2); outline-offset: 1px; }
.anatomie .liste-parts { flex: 1; min-width: 240px; }
.anatomie .liste-parts button { display: block; width: 100%; text-align: left; margin-bottom: 6px; }

/* Paiement */
.cible { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.runes { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.rune {
  width: 74px; height: 96px; border-radius: 10px; border: 2px solid var(--d); background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--text); font-size: .8rem; transition: transform .2s, opacity .2s;
}
.rune .gem { width: 26px; height: 26px; transform: rotate(45deg); background: var(--d); border-radius: 4px; }
.rune.epuisee { transform: rotate(90deg) scale(.85); opacity: .6; }
.rune.recyclee { opacity: .15; pointer-events: none; }
.rune-actions { display: flex; flex-direction: column; gap: 4px; }
.rune-actions button { font-size: .75rem; padding: 3px 6px; }
.rune-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.reserve { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.reserve .pill { background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; }

/* Étapes du tour */
.phases { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.phase {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 6px 10px; font-size: .88rem;
}
.phase.actif { background: var(--gold); color: #1b1406; border-color: var(--gold); font-weight: 600; }
.phase.passe { color: var(--text); border-color: var(--ok); }

/* Combat */
.combat { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: start; }
.camp h4 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.camp h4 .ic { color: var(--muted); }
.unite {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px;
}
.unite .nom { font-weight: 600; }
.unite .stats { font-size: .85rem; color: var(--muted); }
.unite.morte { opacity: .4; text-decoration: line-through; }
.unite .assign { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.unite .assign button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); }
.vs { align-self: center; font-size: 1.25rem; color: var(--muted); font-weight: 500; }
.combat-total input { width: 64px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; }

/* ---------- Cartes (rendu CSS) ---------- */
.rb-card {
  --w: 190px;
  width: var(--w); height: calc(var(--w) * 1.4);
  padding: 4px; border-radius: 12px; background: var(--bg);
  background-image: var(--bg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
  flex: none; position: relative; font-size: 11px;
}
.rb-card.rb-landscape { width: calc(var(--w) * 1.4); height: var(--w); }
.rb-card.rb-mini { --w: 130px; font-size: 9.5px; }
.rb-frame {
  height: 100%; border-radius: 9px; background: linear-gradient(180deg, #232c46 0%, #151b2d 100%);
  display: flex; flex-direction: column; position: relative; overflow: hidden; padding: 6px;
}
.rb-art {
  flex: 0 0 34%; border-radius: 6px; margin: 2px 0 4px;
  background: var(--bg); opacity: .85;
  display: grid; place-items: center; position: relative; overflow: hidden;
}
.rb-art::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, transparent 20%, rgba(0,0,0,.55) 100%); }
.rb-art span { font-size: 3.2em; font-weight: 800; color: rgba(255,255,255,.85); text-shadow: 0 2px 6px rgba(0,0,0,.5); z-index: 1; }
.rb-landscape .rb-art { flex-basis: 22%; }
.rb-cost { position: absolute; top: 5px; left: 5px; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rb-energy {
  width: 2.5em; height: 2.5em; border-radius: 50%; background: #f4f1e8; color: #111; font-weight: 800; font-size: 1.15em;
  display: grid; place-items: center; border: 2px solid #111; box-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.rb-power { width: 1.3em; height: 1.3em; transform: rotate(45deg); background: var(--d); border: 1.5px solid #111; border-radius: 2px; margin-top: 3px; }
.rb-might {
  position: absolute; top: 5px; right: 5px; z-index: 2; min-width: 2.4em; height: 2.4em; border-radius: 8px;
  background: #1b1406; border: 2px solid var(--gold); color: var(--gold2); font-weight: 800; font-size: 1.15em;
  display: flex; align-items: center; justify-content: center; gap: 2px; padding: 0 4px; white-space: nowrap;
}
.rb-might::before { content: "⚔"; font-size: .65em; }
.rb-mb { background: #20160a; }
.rb-names { text-align: center; }
.rb-name { font-weight: 800; font-size: 1.15em; line-height: 1.1; }
.rb-sub { font-size: .9em; color: var(--gold2); font-style: italic; }
.rb-typeline { text-align: center; font-size: .82em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 3px; margin-bottom: 3px; }
.rb-text { flex: 1; overflow: auto; font-size: .95em; line-height: 1.35; padding: 2px; scrollbar-width: thin; }
.rb-foot { display: flex; justify-content: space-between; font-size: .75em; color: var(--muted); border-top: 1px solid var(--line); padding-top: 2px; }
.rb-mini .rb-text { display: none; }
.rb-mini .rb-art { flex-basis: 46%; }
.rb-card-missing { display: grid; place-items: center; color: var(--muted); }
.ico { display: inline-grid; place-items: center; vertical-align: -2px; }
.ico-energy { width: 1.35em; height: 1.35em; border-radius: 50%; background: #f4f1e8; color: #111; font-weight: 800; font-size: .9em; }
.ico-rune { width: .9em; height: .9em; transform: rotate(45deg); background: var(--d, #aaa); border-radius: 1px; margin: 0 2px; color: transparent; overflow: hidden; }
.ico-rune.rune-any { background: conic-gradient(var(--fury), var(--body), var(--order), var(--calm), var(--mind), var(--chaos), var(--fury)); }
.ico-might { color: var(--gold2); }
.ico-exhaust { color: var(--gold2); font-weight: 800; }
.kw {
  display: inline-block; background: rgba(217, 178, 95, .14); color: var(--gold2); border-radius: 4px; padding: 0 4px;
  font-weight: 600; cursor: help;
}
.rb-card:focus { outline: 2px solid var(--gold2); outline-offset: 2px; }

/* Bulle d'aide des mots-clés */
.bulle {
  position: fixed; z-index: 100; max-width: 320px; background: #0b0f1a; border: 1px solid var(--gold);
  border-radius: 10px; padding: 10px 12px; font-size: .88rem; box-shadow: 0 8px 24px rgba(0,0,0,.6);
}
.bulle b { color: var(--text); font-weight: 600; }

/* Vue agrandie d'une carte */
.zoom {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 90; display: grid; place-items: center;
}
.zoom .rb-card { --w: 300px; font-size: 16px; }

/* ---------- Explorateur ---------- */
.filtres { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filtres input, .filtres select {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit;
}
.filtres input { flex: 1; min-width: 200px; }
.galerie { display: flex; flex-wrap: wrap; gap: 14px; }

/* Decks */
.deck-liste { columns: 2 260px; column-gap: 24px; }
.deck-liste div { break-inside: avoid; padding: 2px 0; cursor: pointer; }
.deck-liste div:hover { color: var(--gold2); }
.deck-section { margin-bottom: 14px; }
.deck-section h4 { color: var(--text2); margin: 12px 0 8px; }

@media (max-width: 820px) {
  .tuto-layout { grid-template-columns: 1fr; }
  .tuto-side { position: static; }
  .combat { grid-template-columns: 1fr; }
  .vs { justify-self: center; }
  .plateau { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 10px 16px; }
  main { padding: 20px 16px 60px; }
  .anatomie .rb-card { transform: none; margin: 0; }
}

/* ---------- Partie guidée ---------- */
.partie { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.guide {
  position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.guide-tete { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.guide-tour { font-weight: 800; color: var(--gold2); }
.guide-avancement { font-size: .8rem; }
.guide-texte h3 { color: var(--gold2); margin-bottom: .4em; }
.guide-texte h4 { margin: .8em 0 .3em; }
.guide-texte p, .guide-texte li { font-size: .95rem; }
.guide-texte ul { padding-left: 20px; }
.guide-actions { margin-top: 10px; }
.guide-pied { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.guide-pied .btn { font-size: .82rem; padding: 6px 10px; }
.phases.mini .phase { font-size: .72rem; padding: 3px 6px; }

.p-table { display: flex; flex-direction: column; gap: 8px; }
.p-joueur {
  display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px;
}
.p-joueur.actif { border-color: var(--gold); }
.p-score { font-size: 1.8rem; font-weight: 800; color: var(--gold2); min-width: 58px; text-align: center; }
.p-score small { font-size: .9rem; color: var(--muted); }
.p-infos { flex: 1; min-width: 0; }
.p-nom { font-weight: 700; }
.p-compteurs { font-size: .78rem; }
.p-runes { display: flex; gap: 5px; flex-wrap: wrap; margin: 4px 0; min-height: 16px; }
.p-rune { width: 14px; height: 14px; transform: rotate(45deg); background: var(--d); border: 1px solid #0008; border-radius: 2px; transition: .2s; }
.p-rune.ep { opacity: .3; transform: rotate(0deg) scale(.8); }
.p-slot {
  width: 96px; min-height: 58px; font-size: .72rem; line-height: 1.2; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 4px; text-align: center;
}
.p-slot small { display: block; color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .04em; }
.p-slot.vide { opacity: .45; }
.p-base {
  border: 1px dashed var(--line); border-radius: 10px; padding: 6px 8px; min-height: 92px; background: rgba(255,255,255,.02);
}
.p-lbl { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.p-pions { display: flex; gap: 6px; flex-wrap: wrap; min-height: 74px; align-items: center; }
.p-champs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.p-champ {
  border: 2px solid #4a5a85; border-radius: 12px; padding: 8px; background: linear-gradient(180deg, #1f2a46, #18203a);
  cursor: pointer;
}
.p-champ.moi { border-color: var(--ok); }
.p-champ.lui { border-color: var(--bad); }
.p-champ-tete { display: flex; justify-content: space-between; gap: 6px; align-items: center; flex-wrap: wrap; }
.p-champ-texte { font-size: .75rem; color: var(--muted); margin: 3px 0 4px; line-height: 1.3; }
.p-sep { border-top: 1px dashed var(--line); margin: 4px 0; }
.p-champ .p-pions { min-height: 70px; }
/* Pion d'unité : une petite carte (image officielle), tournée de côté quand elle est épuisée. */
.pion {
  position: relative; flex: none; width: 64px; height: 90px; padding: 0; border: 0; background: none; color: var(--text);
  font-size: .62rem; line-height: 1.1; cursor: pointer;
}
.pion-carte {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 90px; transform: translate(-50%, -50%);
  border-radius: 5px; overflow: hidden; background: var(--bg); padding: 3px; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  box-shadow: 0 3px 8px #000a; transition: transform .35s cubic-bezier(.2, .8, .2, 1), filter .35s, box-shadow .2s;
}
.pion-carte:not(.avec-img)::before { content: ""; position: absolute; inset: 3px; border-radius: 4px; background: #1a2238; }
.pion-carte > span { position: relative; }
.pion-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.pion-carte.avec-img .pion-art, .pion-carte.avec-img .pion-nom { display: none; }
.pion > span:not(.pion-carte) { z-index: 2; }
.pion:hover .pion-carte { box-shadow: 0 0 0 2px var(--gold2), 0 6px 14px #000c; }
.pion-art { position: absolute !important; top: 14px; font-size: 1.5rem; font-weight: 800; color: rgba(255,255,255,.75); }
.pion-nom { text-align: center; padding: 0 2px 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.pion-might {
  position: absolute; top: -6px; right: -6px; background: #1b1406; border: 1px solid var(--gold); color: var(--gold2);
  border-radius: 6px; padding: 0 4px; font-weight: 800; font-size: .72rem;
}
.pion-might.bonus { background: var(--gold); color: #1b1406; }
.pion-deg { position: absolute; top: -6px; left: -6px; background: var(--bad); color: #fff; border-radius: 6px; padding: 0 4px; font-weight: 800; font-size: .72rem; }
.pion-etat { position: absolute; bottom: -8px; font-size: .55rem; background: #000a; color: var(--muted); padding: 0 4px; border-radius: 4px; }
.pion.ep { width: 90px; height: 64px; }
.pion.ep .pion-carte { transform: translate(-50%, -50%) rotate(90deg); filter: brightness(.72); }
.p-main { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.p-main-cartes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.p-carte-main { cursor: pointer; transition: transform .15s; border-radius: 12px; }
.p-carte-main:hover { transform: translateY(-4px); }
.p-carte-main .rb-card { --w: 104px; font-size: 8px; }

/* Élément attendu : pulsation dorée */
.attendu { outline: 3px solid var(--gold2); outline-offset: 2px; animation: pulse 1.3s ease-in-out infinite; }
.p-carte-main.attendu, .p-champ.attendu, .p-base.attendu { border-radius: 12px; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(242, 213, 143, .7); } 50% { box-shadow: 0 0 0 8px rgba(242, 213, 143, 0); } }

@media (max-width: 980px) {
  .partie { grid-template-columns: 1fr; }
  .guide { position: static; max-height: none; order: -1; }
}
@media (max-width: 560px) {
  .p-joueur { flex-wrap: wrap; }
  .p-slot { width: 80px; }
  .p-champs { grid-template-columns: 1fr; }
}
main.large { max-width: 1400px; }
/* Plateau plus compact */
.p-base { min-height: 0; padding: 4px 8px; }
.p-base .p-pions { min-height: 74px; }
.p-champ .p-pions { min-height: 74px; }
.p-joueur { padding: 6px 10px; }
.p-slot { min-height: 48px; }

/* ---------- Éditeur de decks ---------- */
.ed-tete { margin-bottom: 14px; }
.ed-nom {
  font: inherit; font-size: 1.25rem; font-weight: 500; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-width: 220px; flex: 1; max-width: 420px;
}
.ed { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.ed-pool { min-width: 0; }
.ed-onglets { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.ed-onglet {
  background: none; border: 0; color: var(--muted); padding: 8px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ed-onglet:hover { color: var(--text); }
.ed-onglet.actif { color: var(--gold2); border-bottom-color: var(--gold); }
.ed-aide { font-size: .88rem; }
.ed-choix { position: relative; cursor: pointer; border-radius: 12px; }
.ed-choix:hover { outline: 2px solid var(--line2); outline-offset: 2px; }
.ed-choix.sel { outline: 3px solid var(--ok); outline-offset: 2px; }
.ed-galerie .rb-card { --w: 160px; font-size: 9.5px; }
.ed-qte {
  position: absolute; top: -8px; left: -8px; background: var(--gold); color: #1b1406; font-weight: 600;
  border-radius: 6px; padding: 2px 8px; font-size: .8125rem; font-variant-numeric: tabular-nums; z-index: 3;
}
.ed-deck {
  position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
.ed-resume { margin-bottom: 10px; }
.ed-compte { font-size: 1.1rem; margin-bottom: 6px; }
.ed-compte.ok b { color: var(--ok); }
.ed-statut { font-size: .88rem; }
.ed-statut ul { margin: 4px 0 0; padding-left: 18px; }
.ed-bloc { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 10px; }
.ed-bloc h4 { margin: 0 0 8px; color: var(--text2); font-size: .9375rem; }
.ed-ligne { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .875rem; }
.ed-ligne .ic { color: var(--muted); }
.ed-ligne [data-zoom] { cursor: pointer; }
.ed-ligne [data-zoom]:hover { color: var(--gold2); }
.ed-cout {
  width: 22px; height: 22px; border-radius: 50%; background: #f4f1e8; color: #111; font-weight: 600; font-size: .75rem;
  display: grid; place-items: center; flex: none;
}
.ed-nomc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid var(--d); padding-left: 6px; }
.ed-qtes { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.ed-qtes button {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); padding: 0; line-height: 1;
}
.ed-qtes button:hover { border-color: var(--line2); }
.ed-courbe { display: flex; gap: 4px; align-items: flex-end; height: 90px; }
.ed-barre { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.ed-barre span { width: 100%; background: var(--gold); border-radius: 4px 4px 0 0; min-height: 2px; }
.ed-barre small { color: var(--muted); font-size: .72rem; }
.ed-barre b { position: absolute; top: 0; font-size: .72rem; color: var(--text); }
.ed-toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(8px); opacity: 0; pointer-events: none;
  background: #0b0f1a; border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; z-index: 120; transition: opacity .2s var(--ease), transform .2s var(--ease); max-width: 90vw;
}
.ed-toast.visible { opacity: 1; transform: translateX(-50%); }
.ed-toast.ok { border-color: var(--ok); }
.ed-toast.bad { border-color: var(--bad); }
.fenetre-fond { place-items: center; padding: 16px; }
.fenetre { width: min(640px, 100%); max-height: 90vh; overflow: auto; margin: 0; }
.ed-texte {
  width: 100%; min-height: 280px; background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; font: .88rem/1.4 Consolas, monospace; resize: vertical;
}
.tile .row .btn { font-size: .85rem; padding: 6px 12px; }
@media (max-width: 980px) {
  .ed { grid-template-columns: 1fr; }
  .ed-deck { position: static; max-height: none; order: -1; }
}

/* ---------- Partie libre ---------- */
.pion.choisi { outline: 3px solid var(--ok); outline-offset: 2px; }
.pion-buff { position: absolute; bottom: 14px; right: -5px; background: var(--ok); color: #062; border-radius: 50%; width: 16px; height: 16px; font-weight: 800; font-size: .7rem; display: grid; place-items: center; }
.pion-kw { position: absolute; bottom: -8px; font-size: .55rem; background: #000c; color: var(--gold2); padding: 0 4px; border-radius: 4px; white-space: nowrap; }
.p-equip { font-size: .72rem; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; cursor: help; }
.p-equip.ep { opacity: .5; }
.p-champ.combat { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(217, 178, 95, .35) inset; }
.p-runes-txt { font-size: .72rem; margin-left: 4px; transform: none; }
.p-carte-main { opacity: .55; }
.p-carte-main.jouable { opacity: 1; }
.p-carte-main.jouable .rb-card { box-shadow: 0 0 0 2px var(--ok), 0 6px 18px rgba(0,0,0,.4); }
.p-carte-main.choisi { transform: translateY(-8px); outline: 3px solid var(--gold2); outline-offset: 2px; opacity: 1; }
.pl-journal {
  margin-top: 12px; max-height: 260px; overflow: auto; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; font-size: .8rem; line-height: 1.35;
}
.pl-ligne { padding: 1px 0; color: var(--muted); }
.pl-ligne.moi { color: #b9d7ff; }
.pl-ligne.ia { color: #ffc9c0; }
.pl-ligne.tour { color: var(--gold2); font-weight: 700; margin-top: 4px; }
.pl-aide { padding-left: 18px; font-size: .9rem; }
.pl-partiels { font-size: .85rem; margin: 6px 0 0; padding-left: 18px; }
select.pl-moi, select.pl-ia { width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; }
@media (max-width: 560px) {
  .p-joueur .p-infos { flex: 1 1 calc(100% - 80px); }
  .p-joueur .p-slot { flex: 1 1 40%; width: auto; }
}
.pion-equip { position: absolute; bottom: 14px; left: -5px; background: var(--panel2); border: 1px solid var(--gold); color: var(--gold2); border-radius: 6px; padding: 0 3px; font-size: .6rem; }
.pion-etourdi { position: absolute; top: 18px; left: -6px; font-size: .8rem; }
button.p-equip { color: var(--text); font: inherit; font-size: .72rem; cursor: pointer; }
button.p-equip.adv { border-color: #6b3a3a; }
.p-slot.renforcee { border-color: var(--gold); box-shadow: 0 0 8px rgba(217,178,95,.5); }

/* ---------- Images officielles ---------- */
.bascule-images {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px; background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: .875rem; text-decoration: none;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.bascule-images:hover { color: var(--text); border-color: var(--line2); }
.rb-card.rb-img { padding: 0; background: var(--panel2); background-image: none; border-radius: 4.5% / 3.3%; overflow: hidden; }
.rb-card.rb-img .rb-photo { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.rb-card.rb-img .rb-frame { display: none; }
.rb-card.rb-img.rb-img-ko { padding: 4px; background-image: var(--bg); }
.rb-card.rb-img.rb-img-ko .rb-photo { display: none; }
.rb-card.rb-img.rb-img-ko .rb-frame { display: flex; }
.zoom-contenu { display: flex; gap: 20px; align-items: flex-start; max-width: 95vw; max-height: 92vh; overflow: auto; flex-wrap: wrap; justify-content: center; }
.zoom .zoom-contenu .rb-card { --w: min(340px, 80vw); font-size: 16px; }
.zoom .zoom-contenu .rb-card.rb-landscape { --w: min(340px, 60vw); }
.zoom-texte { max-width: 380px; margin: 0; cursor: default; }
.zoom-texte h3 { color: var(--text); }
.p-cache { display: inline-block; margin: 2px 0 4px; font-size: .75rem; background: #241a33; border: 1px dashed var(--chaos); color: var(--text); border-radius: 6px; padding: 3px 8px; }
button.p-cache.moi { cursor: pointer; }
button.p-cache.jouable { border-style: solid; border-color: var(--ok); box-shadow: 0 0 6px rgba(76,195,138,.5); }

/* ---------- Aperçu au survol ---------- */
.apercu {
  position: fixed; top: 50%; z-index: 150; display: flex; gap: 14px; align-items: flex-start;
  background: rgba(11, 15, 26, .96); border: 1px solid var(--gold); border-radius: 14px; padding: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .7); max-width: min(640px, 94vw); pointer-events: none;
  opacity: 0; transform: translateY(-50%) scale(.96); transition: opacity .15s, transform .15s;
}
.apercu.visible { opacity: 1; transform: translateY(-50%) scale(1); }
.apercu.droite { right: 16px; }
.apercu.gauche { left: 16px; }
.apercu .rb-card { --w: 260px; font-size: 13px; flex: none; }
.apercu .rb-card.rb-landscape { --w: 220px; }
.apercu-texte { min-width: 0; flex: 1; max-width: 300px; font-size: .9rem; }
.apercu-nom { font-weight: 800; color: var(--gold2); font-size: 1.05rem; margin-bottom: 2px; }
.apercu-etat { margin: 8px 0; padding: 6px 8px; border-radius: 8px; background: rgba(76, 195, 138, .12); border: 1px solid rgba(76, 195, 138, .4); font-size: .85rem; }
.apercu-regles { margin-top: 8px; line-height: 1.4; }
@media (max-width: 560px) {
  .apercu { flex-direction: column; align-items: center; left: 50% !important; right: auto !important; transform: translate(-50%, -50%) scale(.96); }
  .apercu.visible { transform: translate(-50%, -50%) scale(1); }
  .apercu .rb-card { --w: 200px; }
}

/* ---------- Niveaux de l'IA ---------- */
.pl-niveaux { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-top: 8px; }
.pl-niveau { display: flex; flex-direction: column; gap: 2px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--panel2); }
.pl-niveau:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.pl-niveau input { margin: 0 0 4px; }
.pl-niveau span { font-size: .82rem; }

/* ---------- Animations ---------- */
@keyframes anim-apparition { from { transform: scale(.3) translateY(-20px); opacity: 0; } 70% { transform: scale(1.1); opacity: 1; } to { transform: scale(1); } }
.anim-apparition { animation: anim-apparition .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes anim-pioche { from { transform: translateY(40px) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
.anim-pioche { animation: anim-pioche .45s ease-out; }
@keyframes anim-degats { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.anim-degats { animation: anim-degats .45s; box-shadow: 0 0 0 3px rgba(229, 96, 79, .8) !important; }
@keyframes anim-pulse { 50% { transform: scale(1.5); } }
.anim-pulse { animation: anim-pulse .5s; }
@keyframes anim-score { 0% { transform: scale(1); } 40% { transform: scale(1.6); color: #fff; text-shadow: 0 0 12px var(--gold); } 100% { transform: scale(1); } }
.anim-score { animation: anim-score .8s; }
@keyframes anim-controle { 0% { box-shadow: 0 0 0 0 rgba(242, 213, 143, .9); } 100% { box-shadow: 0 0 0 18px rgba(242, 213, 143, 0); } }
.anim-controle { animation: anim-controle .8s ease-out; }
@keyframes anim-combat { 0%, 100% { background-color: transparent; } 30% { background-color: rgba(229, 96, 79, .25); } }
.anim-combat { animation: anim-combat .8s; }
.anim-flottant {
  position: fixed; z-index: 160; transform: translate(-50%, 0); font-weight: 900; font-size: 1.05rem; pointer-events: none;
  text-shadow: 0 2px 6px #000; animation: anim-flottant 1.1s ease-out forwards; white-space: nowrap;
}
.anim-flottant.degats, .anim-flottant.malus { color: #ff8a7a; }
.anim-flottant.bonus { color: #8ff0bd; }
.anim-flottant.point { color: var(--gold2); font-size: 1.25rem; }
@keyframes anim-flottant { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -48px); } }
.anim-fantome { position: fixed; z-index: 140; pointer-events: none; animation: anim-fantome .65s ease-in forwards; }
.anim-fantome > * { width: 100%; height: 100%; }
@keyframes anim-fantome { 0% { opacity: 1; filter: none; } 30% { filter: brightness(2) sepia(1) hue-rotate(-30deg); } 100% { opacity: 0; transform: scale(.4) rotate(8deg); } }
.anim-banniere {
  position: fixed; left: 50%; top: 42%; z-index: 170; transform: translate(-50%, -50%); pointer-events: none;
  font-size: clamp(1.6rem, 5vw, 3rem); font-weight: 900; letter-spacing: .04em; padding: 14px 40px; border-radius: 14px;
  background: rgba(11, 15, 26, .88); border: 2px solid var(--gold); color: var(--gold2); box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
  animation: anim-banniere 1.4s ease forwards;
}
.anim-banniere.ia { border-color: var(--bad); color: #ffc9c0; }
.anim-banniere.victoire { border-color: var(--ok); color: #8ff0bd; }
.anim-banniere.defaite { border-color: var(--bad); color: #ffc9c0; }
@keyframes anim-banniere { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%); } }
.p-carte-main, .p-rune { transition: transform .25s, opacity .25s; }
@media (prefers-reduced-motion: reduce) {
  .apercu, .pion, .p-carte-main, .p-rune { transition: none; }
}
@media (min-width: 561px) {
  .apercu { max-width: calc(50vw - 24px); }
  .apercu .rb-card { --w: min(250px, 22vw); }
}

/* ---------- Tapis de jeu (partie libre) ---------- */
.tapis-table { gap: 10px; }
.p-tapis {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 12px; padding: 10px 12px;
  grid-template-areas: "entete entete entete" "gauche centre droite";
  border: 1px solid var(--line); border-radius: 14px;
  background: radial-gradient(ellipse at 50% 0%, rgba(90, 120, 190, .16), transparent 70%), linear-gradient(180deg, #151c31, #10162a);
}
.p-tapis.moi { grid-template-areas: "gauche centre droite" "entete entete entete"; background: radial-gradient(ellipse at 50% 100%, rgba(90, 120, 190, .16), transparent 70%), linear-gradient(180deg, #10162a, #151c31); }
.p-tapis.actif { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(217, 178, 95, .5) inset; }
.tapis-entete { grid-area: entete; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tapis-entete .p-score { min-width: 0; font-size: 1.5rem; line-height: 1; }
.t-infos { font-size: .8rem; }
.t-piste { display: flex; gap: 3px; }
.t-piste span { width: 19px; height: 19px; border-radius: 50%; font-size: .62rem; display: grid; place-items: center; background: #0007; color: var(--muted); border: 1px solid var(--line); }
.t-piste span.ok { background: rgba(217, 178, 95, .22); color: var(--gold2); border-color: rgba(217, 178, 95, .5); }
.t-piste span.ici { background: var(--gold); color: #1b1406; font-weight: 800; }
.t-main-ia { display: inline-flex; margin-left: 8px; vertical-align: middle; }
.dos-mini { width: 11px; height: 15px; border-radius: 2px; background: #2a3560; border: 1px solid #c9a75a; margin-left: -4px; box-shadow: 1px 0 2px #000a; }
.tapis-gauche { grid-area: gauche; display: flex; gap: 8px; align-items: flex-start; }
.tapis-centre { grid-area: centre; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.p-tapis.adv .tapis-centre { flex-direction: column-reverse; }
.tapis-droite { grid-area: droite; display: flex; gap: 10px; align-items: flex-start; }
.tapis-carte, .tapis-pile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tapis-carte .rb-card { --w: 72px; font-size: 5.5px; transition: transform .35s, filter .35s, box-shadow .2s; }
.tapis-carte.ep .rb-card { transform: rotate(90deg) scale(.7); filter: brightness(.6); }
.tapis-carte.renforcee .rb-card { box-shadow: 0 0 12px var(--gold); }
.tapis-carte.jouable .rb-card { box-shadow: 0 0 0 2px var(--ok), 0 0 12px rgba(76, 195, 138, .6); cursor: pointer; }
.tapis-carte.attendu, .tapis-pile.attendu { border-radius: 8px; }
.tapis-lbl { font-size: .6rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.emplacement { width: 72px; height: 101px; border: 1px dashed var(--line); border-radius: 6px; display: grid; place-items: center; color: var(--muted); font-size: .7rem; }
.tapis-pile .rb-card { --w: 60px; font-size: 4.5px; }
.tapis-pile .emplacement { width: 60px; height: 84px; }
.dos {
  width: 60px; height: 84px; border-radius: 6px; display: grid; place-items: center; border: 2px solid #c9a75a;
  background: radial-gradient(circle, rgba(233, 207, 138, .25) 0 30%, transparent 31%), repeating-linear-gradient(45deg, #2a3560 0 6px, #232d55 6px 12px);
  box-shadow: 2px 2px 0 #0b1122, 4px 4px 0 #070b16, 0 4px 10px #0008;
}
.dos.vide { opacity: .25; box-shadow: none; }
.dos-runes { border-color: #a58ad8; background: radial-gradient(circle, rgba(200, 170, 255, .25) 0 30%, transparent 31%), repeating-linear-gradient(-45deg, #3b2a55 0 6px, #31234a 6px 12px); }
.dos-logo { font-weight: 900; font-size: 1.3rem; color: #f0d690; text-shadow: 0 0 6px #000; }
.pile-n { position: absolute; top: -7px; right: -7px; z-index: 2; background: #000d; border: 1px solid var(--gold); color: var(--gold2); border-radius: 10px; padding: 0 5px; font-size: .7rem; font-weight: 800; }
.tapis-pile.defausse { cursor: pointer; }
.tapis-pile.defausse:hover .rb-card, .tapis-pile.defausse:hover .emplacement { outline: 2px solid var(--gold2); outline-offset: 2px; }
.t-runes { display: flex; align-items: center; gap: 8px; }
.t-runes .p-lbl { min-width: 72px; }
.t-runes-cartes { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; min-height: 50px; }
.t-rune { width: 34px; height: 48px; border-radius: 4px; background: var(--d); overflow: hidden; border: 1px solid #0008; box-shadow: 0 2px 4px #0008; transition: transform .35s, filter .35s, margin .35s; flex: none; }
.t-rune img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-rune.ep { transform: rotate(90deg) scale(.82); filter: brightness(.5) saturate(.5); margin: 0 6px; }
.t-rune[data-cible] { cursor: pointer; }
.t-rune.attendu { border-radius: 4px; outline-offset: 1px; }
.t-rune.choisie { outline: 3px solid #e05050; outline-offset: 1px; animation: none; transform: translateY(-6px); }
.t-rune.ep.choisie { transform: rotate(90deg) scale(.82) translateX(6px); }
.p-tapis .p-base { background: rgba(0, 0, 0, .18); border-color: rgba(255, 255, 255, .12); }
.p-tapis .p-base .p-pions { min-height: 92px; }
.t-defausse-vue { margin-top: 10px; background: var(--panel); border: 1px solid var(--gold); border-radius: 12px; padding: 10px; }
.t-defausse-cartes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.t-defausse-cartes .rb-card { --w: 84px; font-size: 6.5px; }

/* Équipements posés : petite carte */
button.p-equip { position: relative; flex: none; width: 48px; height: 67px; padding: 0; border: 0; background: none; cursor: pointer; }
.p-equip .pion-carte { width: 48px; height: 67px; }
.p-equip.ep { opacity: 1; width: 67px; height: 48px; }
.p-equip.ep .pion-carte { transform: translate(-50%, -50%) rotate(90deg); filter: brightness(.72); }
.p-equip:hover .pion-carte { box-shadow: 0 0 0 2px var(--gold2); }

/* Champs de bataille : illustration en fond et carte au milieu */
.pl .p-champ { position: relative; isolation: isolate; }
/* Illustration du champ (zoomée au centre pour cacher le texte de la carte) */
.pl .p-champ::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: var(--fond, none) center / 190% auto no-repeat; opacity: .32; filter: saturate(1.2);
  -webkit-mask-image: radial-gradient(ellipse 60% 45% at center, #000 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 60% 45% at center, #000 55%, transparent 100%);
}
@media (max-width: 700px) { .pl .p-champ::before { background-size: auto 240%; } }
.pl .p-champ .p-pions { min-height: 92px; }
.p-champ-milieu { display: flex; align-items: center; gap: 10px; margin: 6px 0; padding: 6px 0; border-top: 1px dashed rgba(255, 255, 255, .15); border-bottom: 1px dashed rgba(255, 255, 255, .15); }
.p-champ-carte .rb-card { --w: 64px; font-size: 4.5px; box-shadow: 0 3px 8px #000a; }
.pl .p-champ-tete { flex: 1; justify-content: flex-start; }
.pl .p-champ-tete b { flex-basis: 100%; }

/* Animation de déplacement : la carte se soulève pendant le trajet */
.anim-vol .pion-carte { box-shadow: 0 0 0 2px var(--gold2), 0 14px 26px #000c; }

@media (max-width: 1180px) {
  .tapis-carte .rb-card { --w: 60px; font-size: 4.5px; }
  .emplacement { width: 60px; height: 84px; }
  .tapis-pile .rb-card { --w: 50px; font-size: 3.8px; }
  .dos, .tapis-pile .emplacement { width: 50px; height: 70px; }
}
@media (max-width: 700px) {
  .p-tapis, .p-tapis.moi { grid-template-columns: auto auto; grid-template-areas: "entete entete" "gauche droite" "centre centre"; padding: 8px; }
  .tapis-droite { justify-self: end; gap: 8px; }
  .tapis-carte .rb-card { --w: 50px; font-size: 3.8px; }
  .emplacement { width: 50px; height: 70px; }
  .tapis-pile .rb-card { --w: 44px; }
  .dos, .tapis-pile .emplacement { width: 44px; height: 62px; }
  .t-piste span { width: 15px; height: 15px; font-size: .5rem; }
  .t-runes .p-lbl { min-width: 0; }
}

/* ---------- Sort joué par l'IA ---------- */
.carte-jouee {
  position: fixed; top: 46%; z-index: 145; pointer-events: none; display: flex; align-items: center; gap: 14px;
  transform: translate(-50%, -50%); background: rgba(11, 15, 26, .94); border: 2px solid var(--bad); border-radius: 16px;
  padding: 14px 18px; box-shadow: 0 0 40px rgba(229, 96, 79, .45), 0 16px 40px #000c; max-width: min(560px, 92vw);
  animation: carte-jouee var(--duree, 2.2s) ease forwards;
}
.carte-jouee.sans-anim { animation: none; }
.carte-jouee .rb-card { --w: 190px; font-size: 9.5px; flex: none; }
.carte-jouee-texte { display: flex; flex-direction: column; gap: 6px; font-size: .95rem; }
.carte-jouee-texte b { color: #ffc9c0; font-size: 1.15rem; }
@keyframes carte-jouee {
  0% { opacity: 0; transform: translate(-50%, -80%) scale(.6) rotate(-6deg); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  20% { transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -45%) scale(.9); }
}
.cible-ia .pion-carte, .p-champ.cible-ia, .cible-ia.p-equip .pion-carte { box-shadow: 0 0 0 3px var(--bad), 0 0 18px rgba(229, 96, 79, .9); }
.cible-ia { animation: cible-ia .8s ease-in-out 3; }
@keyframes cible-ia { 50% { filter: brightness(1.5); } }
@media (max-width: 560px) {
  .carte-jouee { flex-direction: column; text-align: center; left: 50% !important; }
  .carte-jouee .rb-card { --w: 150px; font-size: 7.5px; }
}

/* ---------- Might par champ de bataille ---------- */
.p-force { display: flex; flex-direction: column; gap: 4px; margin-left: auto; text-align: right; min-width: 0; }
.force { display: flex; flex-direction: column; padding: 3px 8px; border-radius: 8px; background: #0009; border: 1px solid var(--line); cursor: help; }
.force b { font-size: .85rem; white-space: nowrap; }
.force small { font-size: .68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.force.adv { border-color: rgba(229, 96, 79, .6); }
.force.adv b { color: #ffc9c0; }
.force.moi { border-color: rgba(76, 195, 138, .6); }
.force.moi b { color: #8ff0bd; }

/* ---------- Équipements attachés : glissés sous l'unité, la partie visible se survole ---------- */
.pion.a-equip { margin-right: 22px; }
.pion-attache {
  position: absolute; z-index: 0 !important; left: 50%; top: 50%; width: 44px; height: 62px;
  transform: translate(calc(-50% + 30px + var(--k) * 10px), calc(-50% + 16px + var(--k) * 8px)) rotate(8deg);
  filter: drop-shadow(0 2px 4px #000c);
}
.pion-attache .pion-carte { width: 44px; height: 62px; padding: 2px; box-shadow: none; font-size: .5rem; }
.pion-attache:hover { z-index: 3 !important; }
.pion-attache:hover .pion-carte { box-shadow: 0 0 0 2px var(--gold2); }
.pion.ep .pion-attache { transform: translate(calc(-50% + 40px + var(--k) * 10px), calc(-50% + 6px + var(--k) * 8px)) rotate(8deg); }
.pion-attache.attendu { outline: none; animation: none; }
.pion-attache.attendu .pion-carte { box-shadow: 0 0 0 3px var(--gold2); animation: pulse 1.3s ease-in-out infinite; }

/* ---------- Choix des cartes regardées (style augments) ---------- */
.choix-cartes {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 50% 40%, rgba(40, 30, 70, .72), rgba(5, 8, 16, .9));
  backdrop-filter: blur(3px); animation: choix-fond .3s ease-out both;
}
.choix-cartes.deja-ouvert, .choix-cartes.deja-ouvert * { animation: none !important; }
@keyframes choix-fond { from { opacity: 0; } }
.choix-boite { max-width: 1100px; max-height: 100%; overflow: auto; text-align: center; }
.choix-titre { font-size: 1.6rem; font-weight: 800; color: var(--gold2); text-shadow: 0 2px 12px rgba(217, 178, 95, .45); }
.choix-titre .muted { font-size: 1rem; font-weight: 400; }
.choix-aide { color: var(--muted); max-width: 640px; margin: 6px auto 18px; }
.choix-liste { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.choix-carte {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: choix-entree .55s cubic-bezier(.2, .9, .3, 1.25) both; animation-delay: calc(var(--i) * 120ms);
}
@keyframes choix-entree { from { opacity: 0; transform: translateY(60px) rotateY(80deg) scale(.8); } }
.choix-visuel {
  position: relative; padding: 0; border: 0; background: none; border-radius: 14px; cursor: pointer;
  transition: transform .2s, box-shadow .2s, filter .2s; box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}
.choix-visuel .rb-card { --w: 220px; font-size: 13px; }
.choix-visuel:hover:not([disabled]) { transform: translateY(-8px) scale(1.03); }
.choix-carte.eligible .choix-visuel { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(217, 178, 95, .45), 0 10px 30px rgba(0, 0, 0, .55); }
.choix-carte.prise .choix-visuel { transform: translateY(-10px) scale(1.05); box-shadow: 0 0 0 3px var(--gold2), 0 0 40px rgba(242, 213, 143, .8); }
.choix-carte.non-eligible .choix-visuel { filter: grayscale(.85) brightness(.55); cursor: not-allowed; }
.choix-carte.recyclee .choix-visuel { filter: grayscale(.6) brightness(.6); transform: translateY(14px) scale(.95); }
.choix-ruban {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-12deg); white-space: nowrap;
  background: rgba(13, 18, 32, .9); color: var(--gold2); border: 1px solid var(--gold); padding: 4px 14px; border-radius: 6px; font-weight: 700;
}
.choix-boutons { display: flex; gap: 6px; }
.choix-pied { margin-top: 22px; }
.choix-pied .btn { font-size: 1.05rem; padding: 10px 22px; }
@media (max-width: 700px) {
  .choix-visuel .rb-card { --w: 140px; font-size: 8.5px; }
  .choix-liste { gap: 12px; }
  .choix-titre { font-size: 1.25rem; }
}

/* ---------- Choix du champ de bataille ---------- */
.pl-champ-choix { margin-top: 12px; }
.pl-champ-titre { margin-bottom: 6px; }
.pl-champs { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-champ {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; width: 150px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: .78rem;
}
.pl-champ .rb-card { --w: 92px; font-size: 6.5px; pointer-events: none; }
.pl-champ:hover { border-color: var(--gold); }
.pl-champ.choisi { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, 0 0 14px rgba(217, 178, 95, .35); }
.pl-champ.hasard { justify-content: center; min-height: 100px; }
.pl-de { font-size: 2rem; }

/* ---------- Questions pendant une partie ---------- */
.pl-questions { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.pl-questions-boite { background: var(--panel, #1b2333); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; width: min(720px, 100%); box-shadow: 0 10px 40px #000a; }
.pl-questions-boite h3 { margin: 0; }
.pl-questions-boite h4 { margin: 16px 0 6px; color: var(--gold2, #e6c36a); }
.q-recherche { display: flex; gap: 8px; margin: 12px 0 4px; }
.q-champ { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #0003; color: inherit; font: inherit; }
.q-rep { padding: 8px 10px; margin: 6px 0; border-left: 3px solid var(--gold2, #e6c36a); background: #ffffff0a; border-radius: 6px; }
.q-journal { max-height: 280px; overflow-y: auto; }
.q-ligne { border-top: 1px solid var(--line); padding: 4px 0; }
.q-ligne summary { cursor: pointer; padding: 3px 2px; }
.q-ligne.ia summary { color: #f0a0a0; }
.q-ligne.moi summary { color: #a0d0f0; }
.q-exp { padding: 6px 10px 8px 18px; font-size: .93rem; }
.q-exp p { margin: 4px 0; }
.q-carte { margin-top: 6px; padding: 6px 8px; background: #0003; border-radius: 6px; font-size: .9rem; }

/* ---------- Paramètres ---------- */
.param-ligne {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer;
}
.param-ligne > span { display: flex; flex-direction: column; }
.param-ligne .muted { font-size: .88rem; }
.param-nom { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0; }
.param-nom-champ { flex: 1; min-width: 160px; max-width: 320px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2, #0003); color: inherit; font: inherit; }
.interrupteur {
  appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 26px; margin: 0; border-radius: 13px;
  background: var(--panel2); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background .2s;
}
.interrupteur::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--muted); transition: transform .2s, background .2s;
}
.interrupteur:checked { background: var(--gold); border-color: var(--gold); }
.interrupteur:checked::after { transform: translateX(20px); background: var(--bg); }
.interrupteur:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }
.param-langues { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.param-langue { padding: 8px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); cursor: pointer; }
.param-langue input { margin-right: 4px; }
.param-langue.choisie, .param-langue:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }

/* ---------- Fond animé pendant une partie ---------- */
body.en-partie::before, body.en-partie::after {
  content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
}
body.en-partie::before {
  background:
    radial-gradient(40% 35% at 20% 30%, rgba(61, 142, 224, .16), transparent 70%),
    radial-gradient(35% 30% at 80% 70%, rgba(155, 89, 208, .14), transparent 70%),
    radial-gradient(30% 30% at 60% 20%, rgba(217, 178, 95, .10), transparent 70%);
  animation: fond-derive 38s ease-in-out infinite alternate;
}
body.en-partie::after {
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, rgba(242, 213, 143, .55), transparent),
    radial-gradient(1.5px 1.5px at 30% 80%, rgba(185, 215, 255, .45), transparent),
    radial-gradient(1px 1px at 55% 40%, rgba(242, 213, 143, .5), transparent),
    radial-gradient(1.5px 1.5px at 75% 15%, rgba(185, 215, 255, .4), transparent),
    radial-gradient(1px 1px at 90% 60%, rgba(242, 213, 143, .45), transparent);
  background-size: 420px 420px;
  animation: fond-poussiere 70s linear infinite;
  opacity: .7;
}
@keyframes fond-derive { to { transform: translate(6%, -5%) rotate(8deg) scale(1.08); } }
@keyframes fond-poussiere { to { background-position: 0 -420px; } }
@media (prefers-reduced-motion: reduce) { body.en-partie::before, body.en-partie::after { animation: none; } }

/* ---------- Partie libre ajustée à l'écran ---------- */
main.large:has(.pl) { padding-top: 12px; padding-bottom: 12px; max-width: 1600px; }
.pl .guide { top: 62px; max-height: calc(100vh - 74px); }
.pl .partie-plateau { min-width: 0; }

/* ---------- Écran de lancement de la partie libre (compact) ---------- */
main.large:has(.pl-config) { padding-top: 14px; padding-bottom: 14px; }
.pl-config-tete { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.pl-config-tete h1 { margin: 0; font-size: 1.6rem; }
.pl-config-tete p { margin: 0; }
.pl-config { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.pl-config .panel, .pl-config-pied, .pl-config-details { padding: 12px 16px; margin: 0 0 12px; }
.pl-config .panel { margin: 0; }
.pl-config h3 { margin-bottom: 8px; }
.pl-config select { padding: 6px 8px; }
.pl-cov-moi, .pl-cov-ia { margin-top: 8px; }
.pl-cov-moi .muted, .pl-cov-ia .muted { font-size: .85rem; }
.pl-partiels-boite { display: inline-block; margin-left: 6px; }
.pl-config-sous { display: block; margin: 12px 0 6px; }
.pl-config .pl-niveaux { grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 0; }
.pl-config .pl-niveau { padding: 6px 10px; gap: 0; }
.pl-config .pl-niveau span { font-size: .76rem; line-height: 1.3; }
.pl-config .pl-champ-choix { margin-top: 10px; }
.pl-config .pl-champ { width: 118px; padding: 5px; font-size: .72rem; line-height: 1.2; }
.pl-config .pl-champ .rb-card { --w: 76px; font-size: 5.5px; }
.pl-config .pl-champ.hasard { min-height: 0; align-self: stretch; }
.pl-config .pl-de { font-size: 1.6rem; }
.pl-config-details summary { cursor: pointer; }
@media (max-width: 800px) { .pl-config { grid-template-columns: 1fr; } }

/* ---------- Statistiques ---------- */
.pl-lien-stats { margin-left: auto; font-size: .9rem; }
.pl-reprise { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 12px; border-color: var(--gold); }
.st-resume { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.st-resume .panel { display: flex; flex-direction: column; align-items: center; padding: 12px; margin: 0; }
.st-resume b { font-size: 1.75rem; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.st-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.st-grille .panel { margin: 0 0 12px; }
.st-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.st-table th, .st-table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.st-table th { color: var(--muted); font-weight: 500; }
.st-table td, .ed-proba td { font-variant-numeric: tabular-nums; }
.st-barre { display: inline-block; width: 60px; height: 6px; background: var(--panel2); border-radius: 3px; vertical-align: middle; overflow: hidden; }
.st-barre span { display: block; height: 100%; background: var(--ok); }
@media (max-width: 700px) { .st-resume { grid-template-columns: repeat(2, 1fr); } .st-table { font-size: .78rem; } }
.ed-proba { width: 100%; border-collapse: collapse; font-size: .8rem; margin-top: 6px; }
.ed-proba th, .ed-proba td { padding: 3px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.ed-proba th:first-child, .ed-proba td:first-child { text-align: left; }
.ed-proba th { color: var(--muted); font-weight: 500; }

/* ---------- Conseil et explications ---------- */
.pl-ligne.pourquoi { padding-left: 14px; font-size: .82em; font-style: italic; opacity: .85; }
.conseil { outline: 3px solid #7fe0ff !important; outline-offset: 2px; box-shadow: 0 0 18px rgba(127, 224, 255, .6) !important; animation: conseil-pulse 1.2s ease-in-out infinite; border-radius: 8px; }
@keyframes conseil-pulse { 50% { outline-color: rgba(127, 224, 255, .35); } }
.pl-repartition { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.pl-rep-ligne { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); font-size: .9rem; position: relative; }
.pl-rep-ligne.mortel { border-color: var(--bad); }
.pl-rep-mort { position: absolute; right: -6px; top: -8px; font-size: 1rem; }
.pl-chaine { margin: 0 0 6px; padding-left: 22px; font-size: .88rem; }
.pl-chaine li.moi { color: #b9d7ff; }
.pl-chaine li.ia { color: #ffc9c0; }

/* ---------- Quiz de règles ---------- */
.qz { max-width: 760px; }
.qz-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.qz-plateau { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0; padding: 12px; border-radius: 10px; background: var(--panel2); flex-wrap: wrap; }
.qz-camp { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qz-camp-nom { font-size: .75rem; color: var(--muted); width: 100%; text-align: center; }
.qz-unite { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.qz-camp.att .qz-unite { border-color: #6aa8ff; }
.qz-camp.def .qz-unite { border-color: #ff8c7a; }
.qz-might { font-size: 1.25rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.qz-kw { font-size: .7rem; color: var(--muted); }
.qz-vs { display: flex; color: var(--muted); }
.qz-question { font-size: 1.0625rem; font-weight: 500; }
.qz-choix { display: grid; gap: 8px; margin-bottom: 12px; }
.qz-option { text-align: left; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); transition: border-color .15s var(--ease); }
.qz-option:hover:not([disabled]) { border-color: var(--line2); }
.qz-option.bonne { border-color: var(--ok); background: rgba(76, 195, 138, .15); }
.qz-option.fausse { border-color: var(--bad); background: rgba(229, 96, 79, .15); }
.qz-expl { margin-bottom: 10px; }
.qz-fin { text-align: center; }
.qz-score { font-size: 2.5rem; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }

/* Journal cliquable : chaque ligne ouvre son explication */
.pl-ligne[data-ligne] { cursor: pointer; border-radius: 4px; }
.pl-ligne[data-ligne]:hover, .pl-ligne[data-ligne]:focus-visible { background: rgba(255, 255, 255, .07); outline: none; }
.q-focus { border: 1px solid var(--gold2); border-radius: 8px; padding: 8px 10px; margin: 8px 0 12px; background: rgba(240, 200, 100, .06); }
.q-focus-ligne { font-weight: 700; margin-bottom: 4px; }
.q-focus-ligne.moi { color: #b9d7ff; }
.q-focus-ligne.ia { color: #ffc9c0; }

/* Mode coach : remarque sur le dernier coup du joueur */
.pl-coach:empty { display: none; }
.pl-coach { border-radius: 8px; padding: 7px 10px; margin: 6px 0; font-size: .9em; line-height: 1.4; border: 1px solid var(--line); }
.pl-coach.mieux { border-color: #e0a040; background: rgba(224, 160, 64, .10); }
.pl-coach.bien { border-color: #4caf7a; background: rgba(76, 175, 122, .10); }
.btn.sec.actif { border-color: var(--gold2); }
