/* Polices de My_Assets/13_Polices : Trans800 pour l'affichage (titres, onglets, boutons, chiffres),
   Cyberbit pour le texte courant. */
@font-face {
  font-family: "Trans800";
  src: url("../fonts/Trans800.woff2") format("woff2"), url("../fonts/Trans800.otf") format("opentype");
  font-display: swap; /* texte affiché tout de suite en police de secours pendant le chargement */
}
/* Texte courant : Cyberbit réduite aux caractères latins (fonts/Cyberbit-latin.woff2, 13 Ko au lieu de 13 Mo),
   générée par tools/polices.py depuis My_Assets/13_Polices/Cyberbit.ttf */
@font-face {
  font-family: "Cyberbit";
  src: url("../fonts/Cyberbit-latin.woff2") format("woff2");
  font-display: swap;
}
:root {
  --font-title: "Trans800", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-text: "Cyberbit", Georgia, "Times New Roman", serif;
  --bg: #1d1712;
  --panel: #2b221a;
  --panel-2: #362a20;
  --border: #4a3a2b;
  --text: #f1e6d4;
  --muted: #a8977f;
  --gold: #e9b949;
  --accent: #d9822b;
  --good: #6fbf73;
  --bad: #d9584a;
  --blue: #5fa8d3;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg) radial-gradient(circle at 50% 0%, #2e2219 0%, var(--bg) 70%) fixed;
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  min-height: 100vh;
}

h1 { font-size: 20px; margin: 0; letter-spacing: .5px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 14px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
small { font-size: 13px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; text-align: center; padding: 20px 0; margin: 0; }

/* ---------- Barre du haut ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 10px 16px;
  background: #15100c;
  border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.hud { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hud-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 12px;
}
.hud-item b { color: var(--gold); font-size: 15px; }
.hud-item.level { flex-direction: column; align-items: stretch; gap: 2px; border-radius: 10px; min-width: 140px; }
.hud-item.level small { color: var(--muted); text-align: center; }

/* ---------- Grille ---------- */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); /* largeur fixe : le contenu ne la fait pas varier (icônes de catégories figées) */
  grid-template-areas:
    "counter workshop"
    "quests  workshop"
    "stock   workshop"
    "racks   workshop"
    "dungeons dungeons"
    "heroes  heroes"
    "city    city";
  grid-template-rows: auto auto auto 1fr auto auto auto;
  gap: 14px;
  padding: 14px 16px;
  max-width: 1700px; margin: 0 auto; /* même largeur pour tous les onglets et la barre d'onglets */
  align-items: start;
}
.counter { grid-area: counter; }
.workshop { grid-area: workshop; }
.racks { grid-area: racks; }
.stock { grid-area: stock; }
.city { grid-area: city; }
.heroes-panel { grid-area: heroes; }
.quests-panel { grid-area: quests; }

/* ---------- Quêtes ---------- */
.quests { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.quest { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.quest.complete { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(233,185,73,.3) inset; }
.quest-head { display: flex; gap: 8px; align-items: flex-start; }
.quest-head .avatar { font-size: 30px; }
.bubble { position: relative; flex: 1; background: #efe4cf; color: #2a1f15; border-radius: 10px; padding: 6px 10px; font-size: 15px; }
.bubble::before { content: ''; position: absolute; left: -6px; top: 12px; border: 6px solid transparent; border-left: 0; border-right-color: #efe4cf; }
.bubble .muted { color: #7a6a55; }
.bubble div { font-style: italic; margin-top: 2px; }
.qsection { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.qsection::before, .qsection::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.qobjs { display: grid; gap: 4px; }
.qobj { display: flex; gap: 8px; align-items: center; padding: 3px 6px; border-radius: 6px; background: rgba(0,0,0,.15); }
.qobj.ok { background: rgba(111,191,115,.12); }
.qobj-icon { font-size: 22px; }
.qobj-body { flex: 1; min-width: 0; }
.qobj-name { font-weight: 600; font-size: 15px; }
.qobj-count { font-size: 14px; }
.qobj.ok .qobj-count { color: var(--good); }
.qrewards { display: flex; flex-wrap: wrap; gap: 5px; }
.qreward { background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: 12px; padding: 2px 8px; font-size: 14px; }
.qreward.gift { border-color: var(--q); color: var(--q); }
.quest-actions { display: flex; gap: 6px; justify-content: space-between; align-items: center; margin-top: 2px; }
.quest-actions .btn.primary { flex: 1; }

/* ---------- Héros ---------- */
.hero-class h3 { text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--text); }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.hero { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
/* Fiches hors écran non dessinées (défilement fluide avec 25 héros) ; la hauteur réelle est retenue après le 1er affichage */
.hero { content-visibility: auto; contain-intrinsic-size: auto 560px; }
.hero.is-hired { border-color: var(--good); }
.hero.locked { opacity: .55; }
.hero-head { display: flex; gap: 8px; align-items: center; }
.hero-head .avatar { font-size: 26px; }
/* Emplacements d'équipement : cartes (img/boutons/card_*.png, de My_Assets/16_Bouton) */
.hslots { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 4px; }
.hcard {
  position: relative; aspect-ratio: 65 / 75; padding: 14% 8% 0; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
  background: url("../img/boutons/card_default.png") center / 100% 100% no-repeat;
  font: inherit; color: #fff; transition: filter .15s, transform .05s;
}
.hcard:hover:not(:disabled) { filter: brightness(1.06); }
.hcard:active:not(:disabled) { transform: translateY(1px); background-image: url("../img/boutons/card_default_down.png"); }
.hcard.full { background-image: url("../img/boutons/card_yellow.png"); }
.hcard.full:active:not(:disabled) { background-image: url("../img/boutons/card_yellow_down.png"); }
.hcard.dark { background-image: url("../img/boutons/card_dark.png"); cursor: default; }
.hcard:disabled { cursor: default; }
.hcard.empty { filter: grayscale(1) brightness(.7); opacity: .75; }
.hcard-icons { display: flex; justify-content: center; align-items: center; gap: 2px; height: 24px; max-width: 100%; }
/* Icônes de types acceptés (un emplacement en liste jusqu'à 4) : grille qui reste dans la carte
   1 icône = 26 px ; 2 = 22 px côte à côte ; 3 ou 4 = 2 colonnes de 18 px (la 3e centrée) */
.hcard-icons[data-n] { display: grid; grid-template-columns: repeat(2, 18px); justify-content: center; align-content: center; justify-items: center; gap: 2px 3px; height: auto; min-height: 24px; width: 100%; }
.hcard-icons[data-n="1"] { grid-template-columns: 26px; }
.hcard-icons[data-n="2"] { grid-template-columns: repeat(2, 22px); }
.hcard-icons[data-n="3"] .htype:last-child { grid-column: 1 / -1; }
.hcard-icons[data-n="1"] .htype { width: 26px; height: 26px; }
.hcard-icons[data-n="2"] .htype { width: 22px; height: 22px; }
.hcard-icons[data-n="3"] .htype, .hcard-icons[data-n="4"] .htype { width: 16px; height: 16px; }
.hcard:has(> .hcard-icons[data-n="3"]), .hcard:has(> .hcard-icons[data-n="4"]) { padding-top: 9%; gap: 3px; }
.hcard-icons[data-n="3"], .hcard-icons[data-n="4"] { gap: 1px 3px; min-height: 0; grid-template-columns: repeat(2, 16px); }
/* Icônes de type en blanc cerné de brun (préférée en doré), comme sur la maquette */
.htype { width: 20px; height: 20px; object-fit: contain; flex-shrink: 1; min-width: 0;
  /* Couleur et contour déjà dessinés dans l'image (img/types/<id>_blanc|or|gris.png, tools/icones_types.py) : plus aucun filtre CSS,
     qui ralentissait fortement le défilement de l'écran des héros. L'image a une marge pour le contour : agrandie de 1,15. */
  transform: scale(1.15); }
.htype.dim { opacity: .35; }
.hcard.dark .htype { opacity: .8; }
.hcard-icons.is-item { height: 26px; font-size: 22px; filter: drop-shadow(0 0 2px var(--q)) drop-shadow(0 0 1px var(--q)); }
.hcard-icons.is-item img.ii { width: 26px; height: 26px; }
/* Libellé blanc à contour brun, comme sur la maquette */
.hcard-label {
  font-family: var(--font-title); font-size: 14px; line-height: 1; white-space: nowrap; letter-spacing: .3px;
  text-shadow: -1px -1px 0 #4a2a10, 1px -1px 0 #4a2a10, -1px 1px 0 #4a2a10, 1px 1px 0 #4a2a10, 0 2px 0 #4a2a10;
}
.hcard.dark .hcard-label { font-size: 11px; }
/* Pastille verte : un objet en stock convient à cet emplacement */
.hcard.can::after { content: ""; position: absolute; top: 9%; right: 12%; width: 8px; height: 8px; border-radius: 50%;
  background: var(--good); box-shadow: 0 0 0 1.5px #4a2a10; }
.hero-status { margin-top: auto; }
.hired { color: var(--good); font-size: 14px; font-weight: 600; }
.fav { color: #e05a7a; margin-left: 4px; }

/* ---------- Ville ---------- */
.hint { font-size: 14px; margin: 0 0 10px; }
.city-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.city-sec { margin: 16px 0 8px; font-size: 18px; color: var(--gold); border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.city-sec:first-child { margin-top: 0; }
.building {
  display: flex; gap: 10px; align-items: stretch;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
.building .b-icon { align-self: flex-start; }
.building.hall { border-color: var(--gold); }
.building.locked { opacity: .45; }
.b-icon { font-size: 24px; }
.building .b-icon { position: relative; flex: 0 0 64px; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.b-img { max-width: 64px; max-height: 64px; object-fit: contain; }
.building.locked .b-img { filter: grayscale(1); }
.b-lock { position: absolute; right: -2px; bottom: -2px; font-style: normal; font-size: 18px; }
.b-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.b-name { font-weight: 600; }
.b-effect { color: var(--good); }
.b-block { font-style: italic; }
.bar.invest i { background: var(--gold); }
.b-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.b-actions small { flex: 1; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }

/* ---------- Boutons ---------- */
/* Visuels de My_Assets/16_Bouton (img/boutons/), étirés en 9 zones : les bouts arrondis gardent leur forme.
   Le fond est dessiné par ::before (border-image) pour garder un padding libre.
   jaune = normal, vert = action principale (.primary), bleu = secondaire (.ghost),
   rouge = action destructrice (.danger, Congédier, Abandonner, ↺), gris = désactivé. */
.btn {
  --btn-img: url("../img/boutons/nets/yellow.png"); --btn-img-down: url("../img/boutons/nets/yellow_down.png");
  --btn-img-s: url("../img/boutons/nets/yellow_s.png"); --btn-img-s-down: url("../img/boutons/nets/yellow_down_s.png");
  --btn-ink: #3a2410;
  --btn-shadow: rgba(255, 240, 200, .5);
  position: relative; isolation: isolate;
  background: none; border: 0; color: var(--btn-ink);
  text-shadow: 0 1px 0 var(--btn-shadow);
  min-height: 36px; padding: 6px 16px 8px; font: inherit; cursor: pointer;
  transition: filter .15s, transform .05s;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-style: solid; border-width: 15px 18px 16px;
  border-image: var(--btn-img) 15 18 16 fill / 15px 18px 16px stretch;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:active:not(:disabled)::before { border-image-source: var(--btn-img-down); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 18px; }
.btn.primary {
  --btn-img: url("../img/boutons/nets/green.png"); --btn-img-down: url("../img/boutons/nets/green_down.png");
  --btn-img-s: url("../img/boutons/nets/green_s.png"); --btn-img-s-down: url("../img/boutons/nets/green_down_s.png");
  --btn-ink: #fff; --btn-shadow: #0b3d22; --btn-outline: 1; font-weight: normal;
}
.btn.ghost {
  --btn-img: url("../img/boutons/nets/blue.png"); --btn-img-down: url("../img/boutons/nets/blue_down.png");
  --btn-img-s: url("../img/boutons/nets/blue_s.png"); --btn-img-s-down: url("../img/boutons/nets/blue_down_s.png");
  --btn-ink: #fff; --btn-shadow: #0d2c5a; --btn-outline: 1;
}
.btn.danger, .btn[data-action="refuse"], .btn[data-action="abandonQuest"], .btn[data-action="reset"] {
  --btn-img: url("../img/boutons/nets/red.png"); --btn-img-down: url("../img/boutons/nets/red_down.png");
  --btn-img-s: url("../img/boutons/nets/red_s.png"); --btn-img-s-down: url("../img/boutons/nets/red_down_s.png");
  --btn-ink: #fff; --btn-shadow: #5a0f0f; --btn-outline: 1;
}
.btn.primary, .btn.ghost, .btn.danger, .btn[data-action="refuse"], .btn[data-action="abandonQuest"], .btn[data-action="reset"] {
  text-shadow: -1px -1px 0 var(--btn-shadow), 1px -1px 0 var(--btn-shadow), -1px 1px 0 var(--btn-shadow), 1px 1px 0 var(--btn-shadow), 0 2px 2px var(--btn-shadow), 0 0 4px var(--btn-shadow);
}
.btn:disabled {
  --btn-img: url("../img/boutons/nets/disabled.png"); --btn-img-down: url("../img/boutons/nets/disabled.png");
  --btn-img-s: url("../img/boutons/nets/disabled_s.png"); --btn-img-s-down: url("../img/boutons/nets/disabled_s.png");
  --btn-ink: #5c554b; --btn-shadow: rgba(255, 255, 255, .35);
  cursor: not-allowed; filter: none;
}
.btn.small { min-height: 30px; padding: 4px 12px 6px; font-size: 14px; }
.btn.small::before { border-width: 12px 15px 13px; border-image: var(--btn-img-s) 12 15 13 fill / 12px 15px 13px stretch; }
.btn.small:active:not(:disabled)::before { border-image-source: var(--btn-img-s-down); }
/* Images des boutons déjà à leur taille d'affichage (tools/boutons_nets.py) : plus de « rayures » aux jointures des
   9 morceaux. Écrans haute définition : versions @2x, tranches doublées. */
@media (min-resolution: 1.25dppx) {
  .btn { --btn-img: url("../img/boutons/nets/yellow@2x.png"); --btn-img-down: url("../img/boutons/nets/yellow_down@2x.png");
  --btn-img-s: url("../img/boutons/nets/yellow_s@2x.png"); --btn-img-s-down: url("../img/boutons/nets/yellow_down_s@2x.png"); }
  .btn.primary { --btn-img: url("../img/boutons/nets/green@2x.png"); --btn-img-down: url("../img/boutons/nets/green_down@2x.png");
  --btn-img-s: url("../img/boutons/nets/green_s@2x.png"); --btn-img-s-down: url("../img/boutons/nets/green_down_s@2x.png"); }
  .btn.ghost { --btn-img: url("../img/boutons/nets/blue@2x.png"); --btn-img-down: url("../img/boutons/nets/blue_down@2x.png");
  --btn-img-s: url("../img/boutons/nets/blue_s@2x.png"); --btn-img-s-down: url("../img/boutons/nets/blue_down_s@2x.png"); }
  .btn.danger, .btn[data-action="refuse"], .btn[data-action="abandonQuest"], .btn[data-action="reset"] { --btn-img: url("../img/boutons/nets/red@2x.png"); --btn-img-down: url("../img/boutons/nets/red_down@2x.png");
  --btn-img-s: url("../img/boutons/nets/red_s@2x.png"); --btn-img-s-down: url("../img/boutons/nets/red_down_s@2x.png"); }
  .btn:disabled { --btn-img: url("../img/boutons/nets/disabled@2x.png"); --btn-img-down: url("../img/boutons/nets/disabled@2x.png");
  --btn-img-s: url("../img/boutons/nets/disabled_s@2x.png"); --btn-img-s-down: url("../img/boutons/nets/disabled_s@2x.png"); }
  .btn::before { border-image-slice: 30 36 32 fill; }
  .btn.small::before { border-image-slice: 24 30 26 fill; }
}
/* Bouton de fermeture (croix) */
.btn.close {
  min-height: 0; width: 32px; height: 32px; padding: 0; font-size: 0; color: transparent; text-shadow: none;
  background: url("../img/boutons/close.png") center / contain no-repeat;
}
.btn.close::before { content: none; }
.btn.close:active { background-image: url("../img/boutons/close_down.png"); }
select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 7px; padding: 4px 6px; font: inherit; font-size: 14px;
}

/* ---------- Barres ---------- */
.bar { height: 6px; background: #1a140f; border-radius: 3px; overflow: hidden; margin: 4px 0 2px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.bar.xp i { background: var(--gold); }
.bar.patience i { background: var(--good); }
.bar.patience i.low { background: var(--bad); }
.bar.res-bar i { background: var(--blue); }

/* ---------- Comptoir ---------- */
.customers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1150px) { .customers { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }
.customer {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px;
}
.customer.new { animation: arrive .35s ease-out; }
.customer.can-sell { border-color: var(--good); box-shadow: 0 0 0 1px rgba(111,191,115,.3) inset; }
@keyframes arrive { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.cust-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.avatar { font-size: 30px; line-height: 1; }
/* Portraits des héros (img/heros/) */
img.av { height: 1.5em; width: 1.5em; object-fit: contain; vertical-align: -0.45em; }
.avatar img.av { width: 48px; height: 48px; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.hero-head .avatar img.av { width: 52px; height: 52px; }
.hero.locked .avatar img.av { filter: grayscale(1); }
.cust-name { font-weight: 600; }
.cust-class { color: var(--muted); font-size: 14px; }
.wish { margin: 4px 0; }
.stock-line { font-size: 14px; color: var(--good); }
.missing { color: var(--bad); }
.mod-tag { text-align: center; font-size: 14px; padding: 4px 6px; border-radius: 8px; background: rgba(0,0,0,.25); }
.mod-tag.surcharge { color: #f0b36a; }
.mod-tag.remise { color: #8fd98f; }
.cust-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; margin-top: 8px; }
.cust-actions .btn { font-size: 14px; padding: 5px 6px; white-space: nowrap; }
.customer { display: flex; flex-direction: column; container-type: inline-size; min-width: 0; }
.cust-actions .btn { min-width: 0; max-width: 100%; box-sizing: border-box; }
/* Un bouton par ligne : rien ne dépasse de la carte, quelle que soit la largeur */
.cust-actions { grid-template-columns: minmax(0, 1fr); }
.customer .cust-actions { margin-top: auto; padding-top: 8px; }

/* ---------- Atelier ---------- */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
/* Artisans : tuiles violettes, objet au centre, temps restant en bas */
.slot {
  position: relative; aspect-ratio: 0.9; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(#6b2fa8, #4a1b7c); border: 3px solid #c98a3c; border-radius: 14px;
  box-shadow: inset 0 0 0 2px #2d0f4d, 0 2px 4px rgba(0,0,0,.4);
}
/* Annuler la fabrication : petite croix rouge en haut à droite de l'artisan occupé */
.slot-cancel {
  position: absolute; top: 3px; right: 3px; z-index: 2; width: 20px; height: 20px; padding: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1; color: #fff; cursor: pointer; background: linear-gradient(#e0584a, #a8281e); border: 1.5px solid #4a120c; border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .6); opacity: .9;
}
.slot-cancel:hover { opacity: 1; filter: brightness(1.15); }
.slot-cancel:active { transform: translateY(1px); }
.slot.idle { background: var(--panel-2); border: 2px dashed var(--border); box-shadow: none; opacity: .75; }
.slot-icon { font-size: 30px; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding-bottom: 14px; box-sizing: border-box; }
.slot-icon img { max-width: 80%; max-height: 80%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.slot-icon img.ui-ico { height: 70%; max-height: none; }
.slot-time { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-family: var(--font-title); font-size: 15px; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000, 0 0 3px #000; white-space: nowrap; }
.slot .bar { position: absolute; left: 6px; right: 6px; bottom: 2px; height: 4px; margin: 0; }

.recipes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; } /* minmax(0) : une carte ne peut pas élargir la colonne */
.recipe {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,.02);
}
.recipe:hover { background: rgba(255,255,255,.05); }
.recipe.locked { opacity: .7; }
.recipe.locked .r-name { color: var(--muted); }
.unlock-req { color: var(--gold); }
.bar.unlock { max-width: 220px; }
.bar.unlock i { background: var(--gold); }
.r-icon { font-size: 22px; width: 28px; text-align: center; }
.r-body { flex: 1; min-width: 0; }
.r-name { font-weight: 600; }
.r-cost { font-size: 14px; color: var(--muted); }
.r-meta { font-size: 13px; color: var(--muted); }
.cost { color: var(--text); white-space: nowrap; }
.cost.comp { color: var(--gold); }
.cost.lack { color: var(--bad); }
.stars { color: var(--gold); font-size: 13px; letter-spacing: 1px; }


/* ---------- Qualités ---------- */
.qchips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.qchip {
  background: transparent; color: var(--q); border: 1px solid var(--q);
  border-radius: 12px; padding: 1px 8px; font: inherit; font-size: 13px; cursor: pointer; opacity: .6;
}
.qchip.sel { opacity: 1; background: rgba(255,255,255,.06); font-weight: 600; }
.alts { display: grid; gap: 4px; margin-top: 6px; }
.btn.alt { text-align: left; color: var(--text); text-shadow: none; background: var(--panel-2); border: 1px solid var(--q); border-radius: 7px; min-height: 0; }
.btn.alt::before { content: none; }
.btn.alt:disabled { opacity: .4; }
.btn.alt { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.btn.alt .alt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.alt .alt-price, .btn.alt .alt-nrg { white-space: nowrap; text-align: right; }
.alts.all { max-height: 260px; overflow-y: auto; padding-right: 4px; grid-auto-rows: max-content; align-content: start; }
.alts .btn.alt { min-height: 34px; }
.alt-more { justify-self: center; }

/* ---------- Râteliers ---------- */
.resources { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.res { display: flex; gap: 8px; align-items: center; background: var(--panel-2); border-radius: 8px; padding: 6px 8px; }
.res-icon { font-size: 22px; display: inline-flex; }
/* Image de ressource : hauteur relative au texte environnant */
img.ri { height: 1.25em; width: auto; vertical-align: -0.3em; object-fit: contain; }
.res-icon img.ri { height: 32px; vertical-align: middle; }
/* Image d'objet (img/objets) : même principe, un peu plus grande que le texte */
img.ii { height: 1.5em; width: 1.5em; vertical-align: -0.4em; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.item-icon img.ii, .slot-icon img.ii, .qobj-icon img.ii { height: 1.3em; width: 1.3em; }
/* Tuile de recette avec l'image de l'objet : fond sombre, cadre à la couleur de la qualité */
.recipe .tile.item-tile { background: radial-gradient(circle at 50% 40%, #4a3a28, #1e1710); }
.tile.item-tile .tile-img.item { object-fit: contain; padding: 4px; box-sizing: border-box; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.res-body { flex: 1; }
.res-top { display: flex; justify-content: space-between; font-size: 14px; }
.rack-list { display: grid; gap: 5px; }
.rack { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.rack-group { background: rgba(255,255,255,.02); border: 1px solid rgba(255,255,255,.05); border-radius: 8px; padding: 4px 8px; }
.rack-group-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 0 4px; border-bottom: 1px solid rgba(255,255,255,.06); }
.rack-group .rack { padding-left: 22px; }
.rack-group .rack:last-child { border-bottom: 0; }
.counter-up { flex: 1; min-width: 0; margin-left: 16px; }
.counter-up .rack { align-items: center; }
.counter-up .rack > span { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.counter-up .rack-up { align-self: center; }
.counter-up .rack { border-bottom: 0; padding: 0; }
.rack-up { min-width: 130px; text-align: right; }
.rack-up .bar i { background: var(--gold); }
.new-rack { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.new-rack-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.new-rack-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.new-rack-btn .nr-cost { white-space: nowrap; font-weight: bold; }

/* ---------- Stock ---------- */
/* Grille qui remplit toute la largeur : les cases s'étirent un peu pour que la dernière colonne touche le bord droit
   (même bord que les boutons « Coffres & plans / Salle des trésors / Roulette » en dessous) */
.inventory { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.item {
  position: relative; width: auto; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 2px solid var(--q, var(--border)); border-radius: 8px;
}
.item.wanted { box-shadow: 0 0 0 2px var(--good); }
.item-icon { font-size: 26px; }
.item-qty {
  position: absolute; bottom: -4px; right: -4px;
  background: var(--accent); color: #1d1209; font-weight: 700; font-size: 13px;
  border-radius: 10px; padding: 0 6px;
}
.stats { font-size: 14px; margin: 12px 0 0; }

/* ---------- Notifications ---------- */
/* Bannière à droite des onglets (position et taille réglées par toast() dans game.js) */
.toasts { position: fixed; top: 80px; left: 16px; right: 16px; height: 46px; z-index: 20; pointer-events: none; }
.toasts .toast:not(:last-child) { display: none; } /* seule la plus récente est affichée */
.toast {
  height: 100%; box-sizing: border-box; display: flex; align-items: center;
  background: #15100c; border: 1px solid var(--border); border-left: 4px solid var(--accent);
  padding: 2px 12px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.4);
  font-size: 14px; line-height: 1.2; overflow: hidden;
  animation: arrive .25s ease-out; transition: opacity .4s;
}
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.level { border-left-color: var(--gold); }
.toast.out { opacity: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; grid-template-rows: none;
    grid-template-areas: "counter" "quests" "stock" "workshop" "racks" "dungeons" "heroes" "city"; padding: 10px 16px; }
  h1 { font-size: 17px; }
}

/* ---------- Donjons & équipement ---------- */
.dungeons-panel { grid-area: dungeons; }
#expeditions:not(:empty) { margin-bottom: 10px; }
.zone, .expedition {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
.expedition { border-color: var(--accent); }
.zone.locked { opacity: .6; }
.zone.locked .z-img img { filter: grayscale(1); }
.zone.boss { border-color: var(--bad, #c0504d); }
.z-boss { color: var(--bad, #e07060); font-weight: 600; }
.z-img { position: relative; flex: 0 0 96px; width: 96px; height: 84px; display: flex; align-items: center; justify-content: center; }
.z-img img { max-width: 96px; max-height: 84px; object-fit: contain; }
.z-icon { flex: 0 0 40px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.z-icon img { max-width: 40px; max-height: 40px; object-fit: contain; }
.zone .b-body small { display: block; }
.zone .b-body { align-self: stretch; }
.zone .b-actions { margin-top: auto; padding-top: 4px; }
/* Choix des héros : fenêtre centrée sur fond assombri, héros en 3 colonnes */
.party-back { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, .65); }
.party { position: fixed; z-index: 901; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); font-size: 18px; overflow: auto;
  background: var(--panel, #3a2d22); border: 1px solid var(--border); border-radius: 14px; padding: 22px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6); display: grid; gap: 16px; }
.party-title { font-size: 22px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.party-title .btn.close { flex: none; }
.party-heroes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.party-heroes .pchip { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; text-align: center; font-size: 20px; border-radius: 16px; border-width: 2px; }
.party-heroes .pchip img.av { width: 72px; height: 72px; object-fit: contain; }
.party-heroes .pchip small { font-size: 18px; }
.party-foot { font-size: 20px !important; }
.party-foot .btn { font-size: 20px; padding: 10px 24px; }
@media (max-width: 700px) { .party-heroes { grid-template-columns: repeat(2, 1fr); } }
.pchip {
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  padding: 2px 8px; font: inherit; font-size: 14px; cursor: pointer;
}
.pchip.sel { border-color: var(--good); background: rgba(111,191,115,.15); }
.party-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.ok { color: var(--good); } .mid { color: var(--gold); } .ko { color: var(--bad); }
.hero-stats { display: flex; justify-content: space-between; font-size: 14px; }
.bar.hxp { position: relative; height: 18px; border-radius: 9px; margin: 6px 0 8px; border: 1px solid rgba(255,255,255,.12); }
.bar.hxp i { background: linear-gradient(#5aa0e8, #2f6fc0); }
.bar.hxp span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none; }
.equip {
  background: rgba(0,0,0,.2); color: var(--text); border: 1px solid var(--q); border-radius: 5px;
  padding: 0 5px; font: inherit; font-size: 15px; cursor: pointer;
}
.equip small { color: var(--q); }
.away { color: var(--accent); font-size: 14px; font-weight: 600; }
.cost.mat { color: #c792ea; }
.mats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; margin-bottom: 6px; }
.mat-chip { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: rgba(199,146,234,.12); border: 1px solid rgba(199,146,234,.4); border-radius: 12px; padding: 2px 8px; font-size: 14px; }
.mat-chip .mc-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.mat-chip img.ri { height: 1.5em; width: 1.5em; vertical-align: middle; flex: none; object-fit: contain; }

/* ---------- Progression des objets ---------- */
.pips { display: inline-flex; gap: 2px; margin-left: 4px; vertical-align: middle; cursor: help; }
.pip { font-size: 12px; width: 19px; height: 19px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--border); filter: grayscale(1); opacity: .45; }
.pip.on { filter: none; opacity: 1; border-color: var(--gold); background: rgba(233,185,73,.15); }
.prog { display: flex; align-items: center; gap: 8px; margin-top: 4px; cursor: help; }
.prog-bar { position: relative; flex: 1; height: 22px; border-radius: 11px; overflow: hidden;
  background: #140f0a; border: 2px solid #4a2f18; box-shadow: inset 0 2px 4px rgba(0,0,0,.7); }
.prog-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#f3cf6a, #d49a2a); border-radius: 9px; }
.prog.done { justify-content: center; }
.mastered { position: relative; display: inline-block; margin-left: 8px; vertical-align: middle; cursor: help; font-family: var(--font-title); text-transform: uppercase; font-size: 17px; line-height: 1; letter-spacing: 1px;
  color: #7a2a05; -webkit-text-stroke: 4px #7a2a05; filter: drop-shadow(0 2px 0 #3d1402); }
.mastered::after { content: attr(data-t); position: absolute; inset: 0; -webkit-text-stroke: 0;
  background: linear-gradient(#ffe45c 20%, #ff9d00 85%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.prog.done .prog-bar i { background: linear-gradient(#7fd88a, #3fa355); }
.prog-bar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title); font-size: 15px; color: #fff; letter-spacing: .5px;
  text-shadow: -1px -1px 0 #2a1808, 1px -1px 0 #2a1808, -1px 1px 0 #2a1808, 1px 1px 0 #2a1808, 0 2px 2px #000; }
.prog-ico { flex: none; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; font-size: 18px;
  border-radius: 50%; border: 3px solid #e0a82e; background: radial-gradient(circle at 35% 30%, #fff1b0, #e9b94d 55%, #b9791c);
  box-shadow: 0 2px 3px rgba(0,0,0,.6), inset 0 -2px 3px rgba(120,60,0,.5); }
.prog.done .prog-ico { border-color: #4fae5e; background: radial-gradient(circle at 35% 30%, #d6ffd9, #6fbf73 55%, #2f7a3a); color: #fff; }
.r-progress { margin-top: 2px; }
.r-progress small { color: var(--gold); font-size: 13px; }
.r-progress.done { font-size: 13px; color: var(--good); }

/* ---------- Thème des icônes de catégories ----------
   Tuiles arrondies colorées par famille, cerclées de doré, avec une icône blanche. */
:root {
  --fam-armes: #d23b33;       --fam-armes-dk: #8f1f1a;
  --fam-armures: #26a3e0;     --fam-armures-dk: #11608f;
  --fam-accessoires: #27a865; --fam-accessoires-dk: #13663b;
  --fam-valeurs: #f0b52d;     --fam-valeurs-dk: #a8700b;
  --tile-ring: #b97a2e;       --tile-ring-lt: #f2c46b;
}
/* Les 4 familles côte à côte, 2 lignes chacune (13 colonnes en tout) ; la taille des tuiles s'adapte à la largeur */
.cat-tabs { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 6px; container-type: inline-size; }
.family { display: grid; grid-template-rows: repeat(2, auto); grid-auto-flow: column; gap: 6px; }
/* même écart (6 px) que entre deux tuiles quand les familles tiennent sur une seule rangée ; sinon (colonne étroite) pas de décalage : les rangées restent alignées à gauche */
@container (min-width: 720px) { .family.fam-valeurs { margin-left: -8px; } }
.fam-armes       { --c: var(--fam-armes);       --c-dk: var(--fam-armes-dk); }
.fam-armures     { --c: var(--fam-armures);     --c-dk: var(--fam-armures-dk); }
.fam-accessoires { --c: var(--fam-accessoires); --c-dk: var(--fam-accessoires-dk); }
.fam-valeurs     { --c: var(--fam-valeurs);     --c-dk: var(--fam-valeurs-dk); }

.cat-tab, .tile {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 46px; height: 46px; border-radius: 14px; padding: 0;
  background: radial-gradient(circle at 50% 30%, var(--c) 0%, var(--c) 55%, var(--c-dk) 100%);
  border: 3px solid var(--tile-ring);
  box-shadow: inset 0 0 0 2px var(--tile-ring-lt), inset 0 -4px 0 rgba(0,0,0,.25), 0 2px 4px rgba(0,0,0,.4);
}
.cat-tab { cursor: pointer; transition: transform .1s, box-shadow .15s; }
.cat-tab:hover { transform: translateY(-2px); }
.cat-tab.sel { box-shadow: inset 0 0 0 2px var(--tile-ring-lt), inset 0 -4px 0 rgba(0,0,0,.25), 0 0 0 3px #fff3, 0 0 12px 2px var(--c); transform: translateY(-2px); }
.cat-tab.locked, .tile.locked-tile { --c: #a39b8f; --c-dk: #6b645a; }
.cat-tab.locked .glyph { opacity: .55; }
/* Icône blanche : l'emoji est transformé en silhouette */
.glyph { font-size: 24px; line-height: 1; filter: brightness(0) invert(1) drop-shadow(0 1px 0 rgba(0,0,0,.35)); }
.cat-title { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--text); margin: 6px 0 8px; }
.tile.small { width: 28px; height: 28px; border-radius: 9px; border-width: 2px; }
.tile.small .glyph { font-size: 16px; }

/* Icônes des recettes agrandies */
.recipe { gap: 12px; padding: 8px; }
.recipe .tile { width: 60px; height: 60px; border-radius: 16px; border-color: var(--qc, var(--tile-ring)); }
.recipe .tile .glyph { font-size: 32px; }
.tile-qty {
  position: absolute; bottom: -6px; right: -6px; background: #fff; color: #2a1f15; font-weight: 700; font-size: 13px;
  border-radius: 10px; padding: 0 6px; border: 2px solid var(--tile-ring);
}
/* Tuiles de catégories : bouton « pilule » de la couleur de la famille (img/boutons/), étiré en carré arrondi
   (les bouts ronds deviennent les coins), + icône de type (img/types/) passée en blanc.
   Rouge = armes, bleu = armures, vert = consommables (accessoires), jaune = accessoires (objets de valeur). */
.cat-btn { position: relative; --cb: url("../img/boutons/red.png"); --cb-down: url("../img/boutons/red_down.png"); }
.cat-btn.fam-armures { --cb: url("../img/boutons/blue.png"); --cb-down: url("../img/boutons/blue_down.png"); }
.cat-btn.fam-accessoires { --cb: url("../img/boutons/green.png"); --cb-down: url("../img/boutons/green_down.png"); }
.cat-btn.fam-valeurs { --cb: url("../img/boutons/yellow.png"); --cb-down: url("../img/boutons/yellow_down.png"); }
.cat-btn::before {
  content: ""; position: absolute; inset: 0; border: 0 solid;
  border-image: var(--cb) 30 38 32 fill / 30% 32% 31% stretch;
}
.cat-btn img {
  position: absolute; left: 22%; top: 19%; width: 56%; height: 56%; object-fit: contain;
  filter: brightness(0) invert(1) drop-shadow(0 1px 1px rgba(0, 0, 0, .45));
}
.cat-tab.sel .cat-btn::before, .cat-tab:active .cat-btn::before { border-image-source: var(--cb-down); }
.cat-tab.sel .cat-btn img { top: 21%; }
.has-img { background: none; border: none; box-shadow: none; border-radius: 28%; }
.tile-img { width: 100%; height: 100%; display: block; pointer-events: none; }
.cat-tab.has-img { width: 36px; height: 36px; /* taille fixe ; les familles passent à la ligne si besoin */ padding: 0; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.cat-tab.has-img.sel { box-shadow: none; filter: drop-shadow(0 0 6px var(--gold)) drop-shadow(0 0 2px #fff8); }
.cat-tab.locked .tile-img { filter: grayscale(1) brightness(.75); opacity: .7; }
.tile.small.has-img { width: 32px; height: 32px; }
/* Anneau de qualité minimale autour de la tuile de recette */
.recipe .tile.has-img {
  /* Cadre de qualité : vraie bordure (et non un « outline ») pour que les rayons intérieur et extérieur s'emboîtent proprement aux angles */
  width: 64px; height: 64px; box-sizing: border-box; outline: none;
  border: 3px solid var(--qc); border-radius: 17px;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .55), inset 0 0 0 1.5px rgba(0, 0, 0, .5), inset 0 -5px 8px rgba(0, 0, 0, .3);
}
.recipe .tile.has-img .tile-img.item { border-radius: 13px; }
.recipe.locked .tile { width: 60px; height: 60px; border-radius: 16px; }
.recipe.locked .tile .glyph { font-size: 26px; }

.sub-head { display: flex; justify-content: space-between; align-items: center; }
.sub-head h3 { margin: 14px 0 8px; }

/* ---------- Barre de ressources (toujours visible dans l'en-tête) ---------- */
.resbar { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.resbar:empty { display: none; }
.resbar .res {
  min-width: 0; padding: 4px 8px; gap: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
}
.resbar .res-icon { font-size: 20px; flex: 0 0 34px; justify-content: center; }
.resbar .res-top { gap: 8px; align-items: baseline; white-space: nowrap; }
.resbar .res-top span { font-weight: 600; font-variant-numeric: tabular-nums; }
.resbar .bar { margin: 3px 0 0; }

/* ---------- Onglets principaux ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; max-width: 1700px; margin: 14px auto 0; padding: 0 16px; }
.tab {
  background: var(--panel); color: var(--muted); border: 1px solid var(--border); border-radius: 10px 10px 0 0;
  padding: 9px 18px; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; border-bottom-width: 3px;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.sel { color: var(--text); background: var(--panel-2); border-bottom-color: var(--accent); }
.tab-badge { margin-left: 4px; font-size: 12px; font-weight: 600; color: #1d1209; background: var(--gold); border-radius: 10px; padding: 1px 7px; vertical-align: 2px; }

/* Échoppe : comptoir, quêtes, stock, râteliers, atelier */
main[data-tab="echoppe"] {
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); /* comptoir plus large : 3 clients par ligne ; minmax(0) = colonnes fixes, les icônes de catégories ne bougent plus */
  /* Écran moyen : à gauche comptoir, quêtes, chaudron, stock, râteliers ; à droite l'atelier puis la liste des recettes */
  /* le comptoir couvre 2 lignes : la liste commence juste sous l'atelier, la 2e ligne (1fr) absorbe la différence de hauteur */
  grid-template-areas: "counter workshop" "counter list" "quests list" "cauldron list" "stock list" "racks list";
  grid-template-rows: auto 1fr auto auto auto auto;
}
.recipes-panel { grid-area: list; min-width: 0; }
.recipes-panel .cat-title { margin-top: 0; }
main[data-tab="echoppe"] .dungeons-panel,
main[data-tab="echoppe"] .heroes-panel,
main[data-tab="echoppe"] .city,
main[data-tab="echoppe"] .orders-panel,
main[data-tab="echoppe"] .arena-panel { display: none; }
/* Autres onglets : un seul panneau, pleine largeur, toujours déplié */
main:not([data-tab="echoppe"]) { display: block; }
main:not([data-tab="echoppe"]) > .panel { display: none; }
main[data-tab="donjons"] > .dungeons-panel,
main[data-tab="heros"] > .heroes-panel,
main[data-tab="ville"] > .city,
main[data-tab="commandes"] > .orders-panel,
main[data-tab="arene"] > .arena-panel { display: block; }
#dungeons-toggle, #heroes-toggle, #city-toggle { display: none; }

@media (max-width: 860px) {
  main[data-tab="echoppe"] { grid-template-columns: 1fr; grid-template-areas: "counter" "quests" "workshop" "list" "cauldron" "stock" "racks"; grid-template-rows: none; }
  .tab { padding: 7px 12px; font-size: 15px; }
}

/* ---------- Sauvegarde ---------- */
#save-btn.warn { color: var(--bad); border-color: var(--bad); }
.save-dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 16px;
}
.save-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.save-box h2 { margin: 0; font-size: 20px; }
.save-box h3 { margin: 16px 0 6px; font-size: 16px; color: var(--gold); }
.save-box p { margin: 6px 0; }
.save-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.save-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.save-row label.btn { cursor: pointer; }
.save-warn { color: var(--bad); font-weight: 600; }
.small-text { font-size: 14px; }
#save-code { width: 100%; box-sizing: border-box; font: 13px monospace; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px; resize: vertical; }
.save-backups { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.save-backups li { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; }
.paused { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .75); display: flex; align-items: center; justify-content: center; padding: 16px; }
.paused[hidden] { display: none; }
.paused-box { max-width: 440px; background: var(--panel); border: 1px solid var(--gold); border-radius: 10px; padding: 20px; text-align: center; }
.paused-box h2 { margin-top: 0; font-size: 20px; }

/* ---------- Police d'affichage ---------- */
h1, h2, h3, .tab, .btn, .hud-item b, .hud-item.level span, .b-name, .qobj-name, .tab-badge, .paused-box h2 {
  font-family: var(--font-title);
  font-weight: normal;          /* Trans800 est déjà grasse : pas de faux gras */
  letter-spacing: .4px;
}
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h2 small { margin-left: 8px; }
.btn small, .b-name small, .tab small { font-family: var(--font-text); letter-spacing: 0; }

/* Icônes d'interface (img/ui/) à la place des emojis : onglets, titres de panneaux */
img.ui-ico { height: 1.5em; width: auto; vertical-align: -0.4em; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
img.ui-ico.nrg { height: 1.2em; vertical-align: -0.25em; margin: 0 1px; }
.hud-item img.ui-ico.nrg { height: 1.6em; vertical-align: middle; }
img.ui-ico.gold { height: 1.15em; vertical-align: -0.2em; margin: 0 1px; }
.hud-item img.ui-ico.gold { height: 1.6em; vertical-align: middle; }
img.ui-ico.time { height: 1.1em; vertical-align: -0.2em; }
img.ui-ico.anvil { height: 1.5em; vertical-align: -0.35em; }
img.ui-ico.pow { height: 1.6em; vertical-align: -0.45em; margin-right: 2px; }
.hcard-label img.ui-ico.pow { height: 17px; vertical-align: -4px; filter: none; }
/* Petite tuile d'interface (carré coloré + symbole blanc), à la taille d'une icône de texte */
.cat-btn.ui-tile { display: inline-block; width: 1.6em; height: 1.6em; vertical-align: -0.45em; }

/* Bouton avec icône à gauche (centrée en hauteur) et texte centré dans le reste */
.btn:has(> img.ui-ico.map) { display: inline-flex; align-items: center; gap: 8px; }
.btn img.ui-ico.map { height: 2em; width: 2em; flex: none; vertical-align: middle; }
.btn .btn-txt { flex: 1; text-align: center; }

/* Casse et panoplie de l'équipement des héros */
/* Pourcentage de casse : pastille sombre, police du jeu, bordure de la couleur du risque (lisible sur la carte jaune) ;
   la carte équipée descend un peu l'icône pour ne pas passer dessous */
.hcard-break { position: absolute; top: 4%; left: 6%; z-index: 2; padding: 2px 5px 3px; border-radius: 9px; border: 1.5px solid currentColor;
  background: rgba(34, 19, 8, .9); font-family: var(--font-title); font-size: 12px; font-weight: 400; line-height: 1; letter-spacing: .2px; white-space: nowrap;
  text-shadow: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .5); pointer-events: none; }
.hcard-break.low { color: #8ff08f; }
.hcard-break.mid { color: #ffcf6a; }
.hcard-break.high { color: #ff8070; }
.hcard.full { padding-top: 24%; }
.hcard.broken { filter: grayscale(.6) brightness(.85); outline: 2px solid #c0392b; outline-offset: -3px; }
.hcard.broken .hcard-icons { opacity: .6; }
.set-on { color: #8fd98f; font-size: 13px; }

/* Emplacements d'expédition (tuiles « Quête ! ») */
#expeditions:not(:empty) { margin-bottom: 14px; }
.exp-slots { display: flex; flex-wrap: nowrap; gap: 14px; overflow-x: auto; padding: 28px 28px 32px; margin: -24px -24px -24px; scrollbar-width: none; } /* une seule ligne */
.exp-slots::-webkit-scrollbar { display: none; }
.slot-tile {
  position: relative; flex: 0 1 108px; min-width: 84px; height: 118px; box-sizing: border-box; padding: 6px 4px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  border: 4px solid #f0a02d; border-radius: 20px; font-family: var(--font-title), serif; color: #fff; cursor: default;
  box-shadow: 0 0 0 3px #4a2411, 0 4px 8px rgba(0, 0, 0, .55), inset 0 0 0 2px rgba(255, 255, 255, .25);
}
.slot-tile.free {
  cursor: pointer; background: linear-gradient(#35c2ff, #1479d8);
  animation: slotPulse 1.8s ease-in-out infinite;
}
.slot-tile.free:hover { filter: brightness(1.12); transform: translateY(-2px); }
.slot-tile.free:active { transform: translateY(1px); }
.slot-ico { height: 66px; width: auto; margin-top: 2px; filter: drop-shadow(0 2px 0 rgba(8, 60, 120, .7)) drop-shadow(0 0 2px rgba(8, 60, 120, .8)); }
.slot-txt { font-size: 24px; line-height: 1; margin-bottom: 4px; color: #fff; -webkit-text-stroke: 5px #0b3a73; paint-order: stroke fill; letter-spacing: .5px; }
@keyframes slotPulse {
  0%, 100% { box-shadow: 0 0 0 3px #4a2411, 0 4px 8px rgba(0, 0, 0, .55), 0 0 6px 1px rgba(80, 200, 255, .4), inset 0 0 0 2px rgba(255, 255, 255, .25); }
  50% { box-shadow: 0 0 0 3px #4a2411, 0 4px 8px rgba(0, 0, 0, .55), 0 0 18px 6px rgba(80, 200, 255, .85), inset 0 0 0 2px rgba(255, 255, 255, .25); }
}
.slot-tile.busy { background: linear-gradient(#4b3a2a, #2c2118); border-color: #8a6a3a; gap: 2px; }
.slot-zone { width: 64px; height: 44px; object-fit: cover; border-radius: 8px; }
.slot-heroes { font-size: 15px; line-height: 1; }
.slot-tile.busy .bar { width: 86%; height: 7px; margin: 0; }
.slot-time { font-size: 15px; color: #f5e6c8; }
.slot-tile.locked { background: linear-gradient(#7b7b7b, #4b4b4b); border-color: #9a9a9a; cursor: pointer; justify-content: center; gap: 6px; }
.slot-tile.locked:disabled { cursor: default; opacity: .75; }
.slot-lock { font-size: 34px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.slot-cost { font-size: 15px; }
@media (prefers-reduced-motion: reduce) { .slot-tile.free { animation: none; } }
/* Colonne des expéditions à gauche de l'Échoppe (renderExpRail / placeExpRail : left et top calculés d'après #main) */
.exp-rail-col {
  position: fixed; z-index: 5; display: flex; flex-direction: column; gap: 14px;
  max-height: calc(100vh - 140px); overflow-y: auto; scrollbar-width: none; padding: 10px;
}
.exp-rail-col::-webkit-scrollbar { display: none; }
.exp-rail-col.off { display: none; }
.exp-rail-col .slot-tile { flex: none; width: 96px; height: 104px; }
.exp-rail-col .slot-txt { font-size: 20px; }
.exp-rail-col .slot-tile.done .slot-txt { font-size: 16px; }
.exp-rail-col .slot-ico { height: 56px; }
.exp-rail-col .slot-zone { width: 60px; height: 40px; }

/* Fenêtre « expéditions disponibles » (cartes crème, image qui déborde en haut) */
.dp-back { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, .7); }
.dp { position: fixed; z-index: 901; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(96vw, 1100px); max-height: 92vh; }
.dp-title { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-title), serif; font-size: 24px; color: #fff; margin: 0 6px 6px; text-shadow: 0 2px 3px #000; }
.dp-row { display: flex; justify-content: safe center; gap: 16px; overflow-x: auto; padding: 78px 10px 14px; align-items: flex-start; }
.dp-card {
  position: relative; flex: 0 0 168px; box-sizing: border-box; padding: 78px 6px 8px; margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
  background: linear-gradient(#fbeacb, #f3d9a8); color: #5a3a1b; font-family: var(--font-title), serif;
  border: 4px solid #e49a38; border-radius: 22px; box-shadow: 0 0 0 3px #5b3112, 0 6px 12px rgba(0, 0, 0, .6);
}
.dp-card:hover { filter: brightness(1.06); transform: translateY(-3px); }
.dp-card:active { transform: translateY(1px); }
.dp-img { position: absolute; left: 50%; top: -62px; transform: translateX(-50%); width: 150px; height: 108px; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .55)); pointer-events: none; }
.dp-name { font-size: 18px; line-height: 1.05; text-align: center; color: #fff; -webkit-text-stroke: 4px #3a2412; paint-order: stroke fill; min-height: 38px; display: flex; align-items: center; justify-content: center; }
.dp-bar { position: relative; width: 92%; height: 18px; border-radius: 9px; background: #2b2118; border: 2px solid #3a2412; overflow: hidden; }
.dp-bar i { display: block; height: 100%; background: linear-gradient(#58e06c, #1fa043); }
.dp-bar.boss i { background: linear-gradient(#ff7a6a, #c0392b); }
.dp-bar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; -webkit-text-stroke: 3px #1d150e; paint-order: stroke fill; }
.dp-done { font-size: 22px; line-height: 18px; height: 18px; color: #ffc533; -webkit-text-stroke: 4px #7a3d0b; paint-order: stroke fill; letter-spacing: .5px; }
.dp-mat { height: 76px; display: flex; align-items: center; justify-content: center; margin-top: 6px; }
.dp-mat img.ri { width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .45)); }
.dp-pow { font-size: 22px; color: #6b4a2a; display: flex; align-items: center; gap: 6px; }
.dp-time { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 6px 4px; border-radius: 14px; background: rgba(255, 255, 255, .45); font-size: 22px; color: #27a3ff; -webkit-text-stroke: 4px #0b3a73; paint-order: stroke fill; display: flex; align-items: center; justify-content: center; gap: 6px; }
.dp-time img.ui-ico { height: 1.1em; -webkit-text-stroke: 0; }
.dp-pow img.ui-ico { height: 1.2em; }

.dp-card.locked { cursor: default; background: linear-gradient(#d9d4cb, #b9b2a6); border-color: #9c9588; filter: none; }
.dp-card.locked:hover { transform: none; filter: none; }
.dp-card.locked .dp-img { filter: grayscale(1) brightness(.7) drop-shadow(0 4px 4px rgba(0, 0, 0, .55)); }
.dp-card.locked .dp-mat img.ri { filter: grayscale(.7) brightness(.8) drop-shadow(0 3px 3px rgba(0, 0, 0, .45)); }
.dp-done.lock { font-size: 17px; color: #fff; -webkit-text-stroke: 4px #4a4a4a; }
.dp-matname { font-size: 14px; line-height: 1.1; text-align: center; color: #5a4a3a; min-height: 30px; }
.dp-why { width: 100%; box-sizing: border-box; padding: 6px 4px; border-radius: 14px; background: rgba(255, 255, 255, .5); font-size: 15px; line-height: 1.15; text-align: center; color: #b3261e; display: flex; flex-direction: column; gap: 2px; min-height: 40px; justify-content: center; }

.dp-bar.lock i { background: linear-gradient(#b9b2a6, #7a7468); }
.dp-stock { font-size: 24px; color: #6b4a2a; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 30px; }
.dp-stock b.zero { color: #c0392b; }
.chest-ico { height: 30px; width: auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.45)); }

.dp-row { scrollbar-width: none; -ms-overflow-style: none; cursor: grab; user-select: none; }
.dp-row.dragging { cursor: grabbing; }
.dp-row::-webkit-scrollbar { display: none; }

.b-boost { color: var(--muted); }
.b-boost.on { color: #8fe08f; font-weight: 600; }

/* Boutons d'investissement toujours au bas de la carte, au même endroit quel que soit le bâtiment */
.b-foot { margin-top: auto; padding-top: 4px; }
.b-foot .b-actions small { flex: 1 0 100%; }
.b-foot .b-actions .btn { flex: 1 1 auto; }
.b-foot .b-actions .btn.ghost { flex: 0 0 auto; }

/* Ville : large mais avec des marges, trois colonnes (utilitaires · production · recrutement) */
/* Ville : même largeur que la barre d’onglets (règle : chaque page = largeur de la banderole) */
#city { display: grid; grid-template-columns: minmax(280px, 0.8fr) minmax(0, 2fr) minmax(0, 1.7fr); gap: 20px; align-items: start; }
#city .city-sec { margin-top: 0; }
#city .city-col .city-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
#city .city-col.util .city-grid { grid-template-columns: minmax(0, 1fr); } /* utilitaires : une seule colonne */
#city .city-col.recrut .city-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* recrutement : deux colonnes */
@media (max-width: 1100px) { #city { grid-template-columns: minmax(0, 1fr); } }

/* Liste rapide en tête de chaque colonne de la ville : nom · Investir · Max */
.city-quick { display: grid; gap: 8px; margin-bottom: 12px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; }
.city-quick { align-content: start; container: cq / inline-size; }
.city-quick.empty { background: none; border-color: transparent; }
.cq-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 110px; gap: 8px; align-items: center; }
.cq-row .btn { white-space: nowrap; width: 100%; }
.cq-name { background: none; border: 0; padding: 0; color: var(--gold); font: inherit; font-family: var(--font-title); line-height: 1.15; text-align: left; cursor: pointer; overflow-wrap: normal; word-break: normal; hyphens: none; }
.cq-name:hover { text-decoration: underline; }
.cq-name small { display: block; font-family: var(--font-text); font-size: 12px; }
.cq-row.blocked .cq-name { color: var(--muted, #9a8a70); }
/* Colonne étroite : le nom sur sa propre ligne, les deux boutons dessous à parts égales */
@container cq (max-width: 440px) {
  .cq-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 6px; }
  .cq-row .cq-name { grid-column: 1 / -1; }
  .cq-name small { display: inline; margin-left: 6px; }
  .cq-row + .cq-row { border-top: 1px solid var(--border); padding-top: 8px; }
}
.building.flash { animation: cqFlash 1.2s ease-out; }
@keyframes cqFlash { 0%, 40% { box-shadow: 0 0 0 3px var(--gold); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Investir et Max toujours sur la même ligne, sous le texte « investi / coût » */
.b-foot { container: bfoot / inline-size; }
.b-foot .b-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.b-foot .b-actions small { grid-column: 1 / -1; }
.b-foot .b-actions .btn { white-space: nowrap; width: 100%; }
/* Carte étroite : un bouton par ligne plutôt que des boutons trop serrés */
@container bfoot (max-width: 300px) { .b-foot .b-actions { grid-template-columns: minmax(0, 1fr); } }

#expeditions.city-grid { display: block; } /* les emplacements d'expédition occupent toute la largeur, sur une seule ligne */

/* Inventaire d'un emplacement de héros (mêmes cartes crème que les expéditions) */
.ep-card { padding-top: 84px; flex-basis: 178px; }
.ep-img { display: flex; align-items: center; justify-content: center; top: -66px; width: 170px; height: 120px; filter: drop-shadow(0 0 10px var(--q)) drop-shadow(0 4px 4px rgba(0, 0, 0, .55)); }
.ep-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ep-emoji { font-size: 64px; }
.ep-name { min-height: 44px; font-size: 19px; }
.ep-opt { display: flex; align-items: center; gap: 6px; font-size: 20px; color: #fff; -webkit-text-stroke: 4px #3a2412; paint-order: stroke fill; }
.flag-ico { width: 22px; height: 26px; -webkit-text-stroke: 0; }
.ep-pow { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; font-size: 34px; color: #ffc533; -webkit-text-stroke: 5px #7a3d0b; paint-order: stroke fill; }
.ep-pow b.neg { color: #ff8a7a; }
.ep-pow img.ui-ico { height: 1.1em; -webkit-text-stroke: 0; }
.ep-break { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 6px; color: #6b4a2a; }
.ep-break small { font-size: 16px; }
.ep-break span { display: flex; align-items: center; gap: 6px; font-size: 26px; color: #ffc533; -webkit-text-stroke: 4px #7a3d0b; paint-order: stroke fill; }
.shield-ico { width: 30px; height: 30px; object-fit: contain; -webkit-text-stroke: 0; }
/* Fiche du héros : « Équiper le meilleur » et « Équiper le moins risqué » côte à côte */
.equip-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.equip-btns .btn { white-space: nowrap; justify-content: center; min-width: 0; }
.equip-btns .shield-ico { width: 1.3em; height: 1.3em; vertical-align: -0.3em; }
.ep-foot { width: 100%; display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 8px; padding: 6px 8px; box-sizing: border-box; background: rgba(255, 255, 255, .45); border-radius: 14px; font-size: 22px; color: #3a2412; }
.ep-info { width: 28px; height: 28px; border-radius: 50%; background: #2a90e8; border: 3px solid #e49a38; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; }
.ep-empty { color: #fff; font-size: 18px; text-align: center; padding: 30px 10px; text-shadow: 0 2px 3px #000; width: 100%; }

.hud-item.level img.ui-ico.lvl, img.ui-ico.lvl { height: 1.7em; vertical-align: -0.45em; margin-right: 2px; }

/* Profil du joueur */
.profile-dialog { width: min(640px, calc(100vw - 32px)); padding: 0; overflow: hidden; }
.pf-head { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: linear-gradient(90deg, #1f6b3a, #174d2a); }
.pf-lvl { display: flex; align-items: center; justify-content: center; width: 52px; height: 56px; font: 26px var(--font-title); color: #fff; background: #2fa05a; border: 3px solid var(--gold); border-radius: 8px 8px 26px 26px; text-shadow: 0 2px 2px #000; }
.pf-name { flex: 1; display: flex; flex-direction: column; }
.pf-name b { font: 26px var(--font-title); color: #fff; text-shadow: 0 2px 2px #000; }
.pf-name small { color: #bfe3c9; }
.pf-xp { margin: 12px 16px 4px; height: 22px; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 12px; padding: 10px 16px 16px; }
.pf-stat { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--panel-2); border-radius: 22px; }
.pf-ico { width: 28px; text-align: center; font-size: 20px; }
.pf-ico img.ui-ico { height: 24px; }
.pf-lbl { flex: 1; color: var(--muted, #b9a98a); }
.pf-stat b { font-family: var(--font-title); color: var(--gold); }
.pf-xp { position: relative; height: 22px; border-radius: 11px; }
.pf-xp i { display: block; height: 100%; }
.pf-xp span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; text-shadow: 0 1px 2px #000; }
.pf-ico img.ui-ico { height: 28px; max-width: 28px; }
#profile-btn img.ui-ico { height: 1.3em; vertical-align: middle; }
.pf-lvl { width: 64px; height: 68px; background: url("../img/ui/profil.png") center / contain no-repeat; border: 0; border-radius: 0; font-size: 24px; padding-bottom: 4px; }
img.info-ico { flex: none; width: 26px; height: 26px; vertical-align: middle; cursor: help; margin-left: 4px; }
.r-body { position: relative; }
.r-name .nw { white-space: nowrap; }
.r-name img.info-ico { position: static; width: 24px; height: 24px; min-width: 24px; aspect-ratio: 1; object-fit: contain; margin-left: 6px; vertical-align: middle; }

/* Fenêtre des paliers de progression */
/* Cartes de même hauteur (étirées) : le texte long d'une compétence agrandit toutes les cartes, et les enclumes restent alignées en bas */
.pg-row { padding-top: 14px; align-items: stretch; }
.pg-card { flex: 0 0 168px; box-sizing: border-box; padding: 10px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: linear-gradient(#fbeacb, #f3d9a8); color: #5a3a1b; font-family: var(--font-title), serif; border: 4px solid #e49a38; border-radius: 22px;
  box-shadow: 0 0 0 3px #5b3112, 0 6px 12px rgba(0, 0, 0, .6); opacity: .7; filter: saturate(.6); }
.pg-card.done { opacity: 1; filter: none; }
.pg-card.next { opacity: 1; filter: none; border-color: #ffc533; }
.pg-ico { position: relative; width: 120px; height: 96px; display: flex; align-items: center; justify-content: center; font-size: 56px; }
.pg-ico img.ui-ico, .pg-ico img.ri, .pg-ico img.ii { height: 84px; width: 84px; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .45)); }
.pg-ico b { position: absolute; right: 0; bottom: 0; font-size: 28px; line-height: 1; color: #fff; -webkit-text-stroke: 5px #3a2412; paint-order: stroke fill; }
.pg-lbl { font-size: 18px; line-height: 1.1; text-align: center; min-height: 58px; flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
.pg-lbl small { font-size: 13px; color: #7a5a38; margin-top: 2px; }
.pg-at { display: flex; align-items: center; gap: 6px; font-size: 26px; margin-top: auto; }
.pg-at img.ui-ico { height: 1.2em; }
.pg-ok { color: #2f9a45; font-size: 22px; }
.dp-title small { font-size: 15px; margin-left: 10px; color: #e6d3a8; }
.pg-plan { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.pg-plan img { height: 52px; width: 52px; }
.pg-ico img.ui-ico[src*=plans] { height: 96px; width: 80px; }
img.info-ico { cursor: pointer; transition: transform .12s ease, filter .12s ease; }
img.info-ico:hover { transform: scale(1.18); filter: brightness(1.2) drop-shadow(0 0 5px rgba(90, 200, 255, .9)); }
img.info-ico:active { transform: scale(.95); }

/* Palier de qualité : halo, cadre et libellé à la couleur de la qualité */
.pg-card.is-q { border-color: var(--q); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--q) 45%, #fbeacb), #f3d9a8 70%); }
.pg-card.is-q .pg-ico { filter: drop-shadow(0 0 6px var(--q)) drop-shadow(0 0 14px var(--q)); }
.pg-card.is-q .pg-lbl small { color: var(--q); font-size: 15px; -webkit-text-stroke: 3px #3a2412; paint-order: stroke fill; }

/* Classement */
.board-dialog { width: min(560px, calc(100vw - 32px)); }
.board-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.board-list { max-height: 50vh; overflow: auto; }
.board-table { width: 100%; border-collapse: collapse; }
.board-table td { padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,.07); }
.board-table td:first-child { width: 44px; text-align: center; color: var(--gold); font-family: var(--font-title); }
.board-table td:last-child { text-align: right; font-family: var(--font-title); color: var(--gold); }
.board-table td small { color: var(--muted, #b9a98a); margin-left: 4px; }
.board-table tr.me { background: rgba(233, 185, 73, .15); font-weight: 700; }
.board-table tr.sep td { border-top: 2px dashed rgba(255,255,255,.2); }
.board-join { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.board-join input { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font: inherit; }

/* Niveau de boutique : à gauche, à côté du titre, sur une seule ligne de la hauteur des autres pastilles */
.brand { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hud-item.level { flex-direction: row; align-items: center; gap: 10px; border-radius: 20px; min-width: 0; }
.hud-item.level .bar.xp { position: relative; width: 190px; height: 18px; margin: 0; border-radius: 9px; }
.hud-item.level .bar.xp i { display: block; height: 100%; }
.hud-item.level .bar.xp small { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; text-shadow: 0 1px 2px #000; }
.hud-item.level .bar.xp { background: #120d09; border: 2px solid #3a2412; box-shadow: 0 0 0 1px #000, 0 2px 5px rgba(0, 0, 0, .7), inset 0 2px 4px rgba(0, 0, 0, .8); }
.hud-item.level .bar.xp i { box-shadow: inset 0 -3px 4px rgba(120, 70, 0, .45), inset 0 2px 3px rgba(255, 255, 255, .35); }
.hud-item.level .bar.xp small { color: #fff; font-weight: 700; -webkit-text-stroke: 3px #1d150e; paint-order: stroke fill; text-shadow: 0 1px 3px #000; }
.hud-item.level .bar.xp small { padding-bottom: 3px; box-sizing: border-box; } /* centre l'encre des chiffres (la police les place ~1,5 px trop bas dans sa boîte) */

/* Profil : onglets et réalisations */
.pf-tabs { display: flex; gap: 6px; padding: 8px 16px 0; border-bottom: 2px solid var(--border); }
.pf-tab { font: 16px var(--font-title); color: var(--muted, #b9a98a); background: var(--panel-2); border: 0; border-radius: 10px 10px 0 0; padding: 6px 16px; cursor: pointer; }
.pf-tab.on { color: #fff; background: #3a2d20; text-shadow: 0 2px 2px #000; }
.ach-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px 4px; color: var(--muted, #b9a98a); }
.ach-list { max-height: 55vh; overflow: auto; padding: 4px 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.ach { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; }
.ach.ready { border-color: var(--gold); box-shadow: 0 0 8px rgba(233, 185, 73, .45); }
.ach.done { opacity: .7; }
.ach.soon { opacity: .45; }
.ach-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ach-main b { font-family: var(--font-title); color: var(--gold); }
.ach-main small { color: var(--text); }
.ach-prog { display: flex; align-items: center; gap: 10px; }
/* Même design que la barre d'XP de l'en-tête (.hud-item.level .bar.xp) : à garder identiques */
.ach-prog .bar { position: relative; flex: 1; height: 18px; margin: 0; border-radius: 9px; background: #120d09; border: 2px solid #3a2412; box-shadow: 0 0 0 1px #000, 0 2px 5px rgba(0, 0, 0, .7), inset 0 2px 4px rgba(0, 0, 0, .8); }
.ach-prog .bar i { display: block; height: 100%; box-shadow: inset 0 -3px 4px rgba(120, 70, 0, .45), inset 0 2px 3px rgba(255, 255, 255, .35); }
.ach-prog .bar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-bottom: 3px; box-sizing: border-box; font-size: 12px; font-weight: 700; color: #fff; -webkit-text-stroke: 3px #1d150e; paint-order: stroke fill; text-shadow: 0 1px 3px #000; }
.ach-pips { display: flex; gap: 4px; }
.ach-pip { width: 12px; height: 12px; border-radius: 50%; background: #2b2118; border: 1px solid #5a4630; }
.ach-pip.ready { background: var(--gold); box-shadow: 0 0 5px var(--gold); }
.ach-pip.claimed { background: #4fae5e; border-color: #2f7a3a; }
.ach-side { flex: none; min-width: 90px; text-align: right; font-family: var(--font-title); }
.ach-rw { color: var(--muted, #b9a98a); }
.ach-ok { color: #6fbf73; }
#profile-btn.has-claim { box-shadow: 0 0 0 2px var(--gold), 0 0 10px var(--gold); }
.save-warn { overflow-wrap: anywhere; }

/* Sauvegarde en ligne */
.cloud-key { flex: 1; min-width: 200px; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font: 14px monospace; }
.cloud-code { font: 16px monospace; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; letter-spacing: 1px; user-select: all; }
.cloud-conflict { border: 2px solid var(--gold); border-radius: 10px; padding: 8px 12px; margin: 8px 0; background: rgba(233, 185, 73, .1); }

/* Nouvelle version disponible */
.update-banner { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2000; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
  width: min(640px, calc(100vw - 24px)); box-sizing: border-box; padding: 10px 14px; background: #2a1d10; color: var(--text); border: 2px solid var(--gold); border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .7); }
.update-banner[hidden] { display: none; }

/* Boutons de quête : même hauteur, contenu centré (icône du coffre + texte) */
.quest-actions { align-items: stretch; }
.quest-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding-top: 5px; padding-bottom: 7px; line-height: 1; }
.quest-actions .btn img.chest-ico { height: 1.5em; width: auto; flex: none; margin: 0; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }

img.ui-ico.gem { height: 1.3em; vertical-align: -0.25em; margin: 0 1px; }
.hud-item img.ui-ico.gem { height: 1.6em; vertical-align: middle; }

/* ===== Coffres et plans ===== */
.plans-dialog .save-box { max-width: 640px; }
.plan-chests { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.plan-chest { display: grid; grid-template-columns: 1fr 3rem 4.5rem 5rem auto; align-items: center; gap: 8px; padding: 4px 8px; background: rgba(0,0,0,.18); border-radius: 6px; }
.plan-chest .pc-name { display: flex; align-items: center; gap: 6px; }
.plan-chest .pc-n { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.plan-chest img.ii, .mat-chip img.ii { width: 1.4em; height: 1.4em; vertical-align: middle; }
.plans-list { max-height: 46vh; overflow-y: auto; margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.plan-row { display: grid; grid-template-columns: 2rem 1fr 3.3rem 3.1rem 26px 5.6rem; align-items: center; gap: 8px; padding: 3px 8px; background: rgba(0,0,0,.14); border-radius: 6px; }
.plan-row.done { opacity: .6; }
.plan-row.wait, .plan-row.nokeys { opacity: .5; }
.plan-row .pr-ico img.ii { width: 1.7em; height: 1.7em; }

/* ===== Compétences des héros ===== */
.hskills { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.hskills .skill { font-size: 13px; padding: 1px 7px; border-radius: 10px; background: rgba(120,180,90,.18); border: 1px solid rgba(120,180,90,.5); white-space: nowrap; }
.hskills .skill small { opacity: .75; }
.hskills .skill.off { opacity: .5; background: rgba(0,0,0,.2); border-color: rgba(255,255,255,.15); }
.hskills .skill.aside { background: rgba(150,150,150,.15); border: 1px dashed rgba(200,200,200,.4); }
.hskills.items { margin-top: 0; }
.hskills.items .skill { background: rgba(230,180,80,.16); border-color: rgba(230,180,80,.5); }
img.sk { width: 1.5em; height: 1.5em; vertical-align: middle; object-fit: contain; margin-right: 2px; }
.hskills .skill { display: inline-flex; align-items: center; gap: 4px; }
.hskills .skill.off img.sk { filter: grayscale(1); }

/* Barre d'XP du profil : même rendu que celle de l'en-tête (cadre brun, relief, chiffres cernés et centrés sur l'encre) */
.pf-xp { background: #120d09; border: 2px solid #3a2412; box-sizing: border-box; box-shadow: 0 0 0 1px #000, 0 2px 5px rgba(0, 0, 0, .7), inset 0 2px 4px rgba(0, 0, 0, .8); }
.pf-xp i { box-shadow: inset 0 -3px 4px rgba(120, 70, 0, .45), inset 0 2px 3px rgba(255, 255, 255, .35); }
.pf-xp span { font-weight: 700; -webkit-text-stroke: 3px #1d150e; paint-order: stroke fill; text-shadow: 0 1px 3px #000; padding-bottom: 3px; box-sizing: border-box; }
.slot-tile .slot-lvl { display: block; font-size: 12px; opacity: .85; margin-top: 4px; }

/* ===== Commandes spéciales ===== */
.orders { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; margin-top: 12px; }
.order-giver { background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.og-head { display: flex; align-items: center; gap: 12px; }
.og-head img.og-face { height: 64px; width: auto; flex: none; }
.og-head .og-name { font: 22px var(--font-title); color: #fff; }
.og-head small { color: var(--muted); }
.og-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; max-width: 55%; justify-content: flex-end; }
.og-step { min-width: 28px; text-align: center; font-size: 13px; padding: 2px 6px; border-radius: 8px; background: rgba(0,0,0,.3); border: 1px solid var(--border); color: var(--muted); }
.og-step.done { background: rgba(120,180,90,.25); border-color: rgba(120,180,90,.6); color: #cfe9bf; }
.og-step.cur { border-color: var(--gold); color: var(--gold); }
.order-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--border); }
.order-card.locked { opacity: .65; }
.oc-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 18px var(--font-title); }
.oc-title small { color: var(--muted); font: 14px var(--font-text); }
.oc-lines { display: flex; flex-direction: column; gap: 8px; }
.oc-line { display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 8px; background: rgba(0,0,0,.2); }
.oc-line img.ii { width: 2rem; height: 2rem; object-fit: contain; }
.oc-line.ok { background: rgba(120,180,90,.18); }
.oc-line .oc-q { font-size: 13px; }
.oc-line .oc-n { white-space: nowrap; font-weight: 700; }
.oc-rew-title { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.oc-rewards { display: flex; flex-wrap: wrap; gap: 10px; }
.oc-rew { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--border); white-space: nowrap; }
.oc-rew img.ii, .oc-rew img.ui-ico { height: 1.6em; width: 1.6em; object-fit: contain; }
.oc-foot { display: flex; justify-content: flex-end; }

/* ===== Arène (PvP) ===== */
.arena { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.ar-card { background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.ar-card h3 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ar-card h3 small { font: 14px var(--font-text); }
.ar-ico { object-fit: contain; flex: none; vertical-align: middle; }
.ar-ico.big { height: 84px; width: auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.ar-ico.sm { height: 1.6em; width: 1.6em; }
.ar-head { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; align-items: center; gap: 18px; }
.ar-rank { display: flex; align-items: center; gap: 14px; }
.ar-title { font: 26px var(--font-title); color: #fff; }
.ar-rank small { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.ar-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ar-bar { height: 14px; background: #120d09; border: 2px solid #3a2412; border-radius: 8px; overflow: hidden; box-sizing: border-box; }
.ar-bar i { display: block; height: 100%; background: linear-gradient(#f2c35a, #c98a1c); box-shadow: inset 0 2px 3px rgba(255,255,255,.35); }
.ar-stats { display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.ar-stats span { display: flex; align-items: center; gap: 6px; }
.ar-stats img.ri { height: 1.5em; width: 1.5em; object-fit: contain; }
.ar-team { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.ar-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px; text-align: center; border-radius: 12px;
  background: linear-gradient(#41332a, #2f251d); border: 2px solid #6b4a22; }
.ar-slot.empty { justify-content: center; min-height: 160px; background: rgba(0,0,0,.18); border: 2px dashed var(--border); }
.ar-slot img.av { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.ar-pos { position: absolute; left: 8px; top: 8px; width: 30px; height: auto; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.55)); }
.ar-name { font: 18px var(--font-title); color: #fff; }
.ar-slot small { display: inline-flex; align-items: center; gap: 4px; }
.ar-abs { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.ar-ab { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: rgba(0,0,0,.28); color: var(--text); font: 14px var(--font-text); cursor: pointer; }
.ar-ab:hover { border-color: var(--gold); }
.ar-ab.sel { background: rgba(233,185,73,.22); border-color: var(--gold); color: #fff; }
.ar-abdesc { margin: 0; font-size: 13px; line-height: 1.35; color: var(--muted); min-height: 5.4em; }
.dp.ae { width: min(94vw, 640px); max-height: 92vh; overflow-y: auto; box-sizing: border-box; padding: 16px; background: var(--panel); border: 2px solid #6b4a22; border-radius: 14px; display: flex; flex-direction: column; gap: 12px; }
.dp.ae .dp-title { margin: 0; }
.ae-mode { display: flex; flex-wrap: wrap; gap: 10px; }
.ae-slots { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.ae-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.ae-foot > span:first-child { display: inline-flex; align-items: center; gap: 6px; font-size: 18px; }
.ae-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.ar-slot .btn.small { margin-top: 2px; }
.ar-pending { border-color: var(--gold); background: rgba(233,185,73,.1); }
.ar-pend { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.ar-rew { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ar-rew .oc-rew img.ii, .ar-rew .oc-rew img.ui-ico, .ar-rew .oc-rew img.ar-ico { height: 1.5em; width: 1.5em; object-fit: contain; }
.ar-hists { display: flex; flex-wrap: wrap; gap: 8px; }
.ar-hist { padding: 3px 10px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--border); font-size: 14px; }
.ab-ico { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; flex: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.55)); }
.ab-ico.big { width: 46px; height: 46px; vertical-align: baseline; }
.hq-ab { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--border); }
.hq-ab-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hq-ab-name { font-size: 17px; color: #fff; }
.hq-ab-name small { color: var(--gold); font-size: 13px; }
.hq-ab p { margin: 0; font-size: 15px; line-height: 1.35; }
.hq-abs { display: flex; flex-direction: column; gap: 10px; }
.og-step.ab { position: relative; min-width: 34px; height: 34px; padding: 3px; display: inline-flex; align-items: center; justify-content: center; }
.og-step.ab .ab-ico { width: 26px; height: 26px; vertical-align: middle; }
.og-step.ab:not(.done) .ab-ico { filter: grayscale(1) brightness(.75); }
.og-step.ab.cur .ab-ico { filter: grayscale(.4); }
.og-step.ab .ab-ok { position: absolute; right: -4px; bottom: -4px; width: 15px; height: 15px; display: block; font-style: normal; }
.og-step.ab .ab-ok .ui-ico { width: 15px; height: 15px; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
/* RÈGLE : icônes et textes alignés entre eux. Chaque bouton de capacité = 3 colonnes fixes (icône · nom · repère : palier ou cadenas) */
.ar-ab { display: grid; grid-template-columns: 26px minmax(0, 1fr) 22px; align-items: center; gap: 8px; min-height: 48px; padding: 6px 10px; text-align: left; box-sizing: border-box; }
.ar-ab .ab-ico { width: 26px; height: 26px; justify-self: center; vertical-align: middle; }
.ar-ab-name { line-height: 1.15; }
.ar-ab-end { display: flex; align-items: center; justify-content: center; color: var(--gold); font-size: 13px; }
.ar-ab-end .ui-ico { width: 16px; height: 16px; }
.ar-ab.locked .ab-ico { filter: grayscale(1) brightness(.7); }
.ar-ab.locked .ar-ab-name { color: var(--muted); }
img.ui-ico.flip { transform: scaleX(-1); }
.ar-actions .btn, .ae-btns .btn, .ar-slot .btn.small { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ar-mv .btn .ui-ico { width: 18px; height: 18px; }
.ar-slot .btn.small .ui-ico { width: 1.2em; height: 1.2em; }
.hq-ico .ui-ico { width: 1.6rem; height: 1.6rem; }
.oc-n .ui-ico { width: 1.3rem; height: 1.3rem; vertical-align: middle; }
.oc-line > .hq-ico { width: 2rem; height: 2rem; }
.oc-line > :first-child { justify-self: center; display: inline-flex; align-items: center; justify-content: center; }
.hq-title { margin: 22px 0 4px; font-size: 22px; }
.hq-title small { font: 14px var(--font-text); }
.hero-quests { margin-top: 10px; }
.hq-face img.av { width: 52px; height: 52px; object-fit: contain; }
.hq-ico { display: inline-flex; align-items: center; justify-content: center; font-size: 20px; }
.hq-ico img.av { width: 2rem; height: 2rem; object-fit: contain; }
.hq-desc { margin: 0; font-size: 14px; color: var(--muted); }
.order-giver.hq-ready { border-color: var(--gold); background: rgba(233,185,73,.08); }
.order-giver.hq-done { opacity: .75; }
.ar-ab.locked { opacity: .55; cursor: not-allowed; }
.ar-ab small { margin-left: 4px; color: var(--gold); font-size: 12px; }
.ar-abdesc small { display: block; margin-top: 6px; color: var(--gold); }
.ar-mv { display: flex; gap: 8px; justify-content: center; }
.ar-q { display: inline-block; min-width: 20px; height: 20px; line-height: 20px; margin-left: 4px; text-align: center; border-radius: 10px; background: #1d150e; border: 1px solid var(--gold); color: var(--gold); font: 700 13px var(--font-title); vertical-align: 1px; }
.ar-duel i { font-style: normal; font-size: 12px; margin-left: 6px; }
.ar-duel i.up { color: var(--good); } .ar-duel i.down { color: var(--bad); }
.ar-log { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; align-items: start; }
.ar-log li { display: grid; grid-template-columns: 36px minmax(0, 1fr) 22px; align-items: center; column-gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,.22); border-left: 4px solid var(--good); }
.ar-log li.foe { border-left-color: var(--bad); }
.ar-log li.open { grid-column: 1 / -1; }
.ar-log li > .ab-ico { width: 36px; height: 36px; object-fit: contain; justify-self: center; }
.ar-log .al-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.2; }
.ar-log .al-when { color: var(--muted); font-size: 13px; }
.ar-log .al-hero { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ar-log .al-hero b { font-family: var(--font-title); }
.ar-log .al-foe { color: var(--bad); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.ar-log .al-ab { color: var(--gold, #e8c56a); overflow-wrap: anywhere; }
.ar-log li > .info-ico { width: 22px; height: 22px; cursor: pointer; justify-self: center; }
.ar-log .al-card { grid-column: 1 / -1; margin-top: 8px; }
.ar-rosterhead { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.ar-roster { display: flex; flex-wrap: wrap; gap: 10px; }
.ar-hero { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(0,0,0,.25); color: var(--text); cursor: pointer; text-align: left; }
.ar-hero:hover:not(:disabled) { border-color: var(--gold); background: rgba(233,185,73,.12); }
.ar-hero:disabled { opacity: .45; cursor: not-allowed; }
.ar-hero img.av { width: 40px; height: 40px; object-fit: contain; }
.ar-hero span { display: flex; flex-direction: column; }
.ar-hero small { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.ar-oppname { font-size: 18px; }
.ar-duels { display: flex; flex-direction: column; gap: 8px; }
.ar-duel { display: grid; grid-template-columns: 1fr 56px 1fr; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--border); }
.ar-duel.ahead { border-color: rgba(111,191,115,.55); }
.ar-duel.behind { border-color: rgba(217,88,74,.55); }
.ar-duel.win { background: rgba(120,180,90,.18); border-color: rgba(120,180,90,.6); }
.ar-duel.lose { background: rgba(217,88,74,.14); border-color: rgba(217,88,74,.5); }
.ar-last.fresh .ar-duel { animation: ar-in .45s ease both; animation-delay: calc(var(--i) * .35s); }
@keyframes ar-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ar-side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ar-side.right { justify-content: flex-end; text-align: right; }
.ar-side img.av { width: 44px; height: 44px; object-fit: contain; flex: none; }
.ar-side > span { display: flex; flex-direction: column; min-width: 0; }
.ar-side small { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.ar-side.right small { justify-content: flex-end; }
.ar-vs { text-align: center; font: 700 16px var(--font-title); color: var(--muted); }
.ar-res { height: 40px; width: auto; justify-self: center; }
.ar-res[src$="defaite.png"] { height: 26px; }
.ar-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.ar-gain { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 16px; flex-wrap: wrap; }
.ar-gain-top { display: inline-flex; margin: 0 12px; font-size: 16px; vertical-align: middle; }
.ar-gain .up { color: var(--good); } .ar-gain .down { color: var(--bad); }
.ar-last.won { border-color: rgba(120,180,90,.6); }
.ar-last.lost { border-color: rgba(217,88,74,.5); }
/* Résultat du combat d'arène en fenêtre (au-dessus de .dp-back) */
.dp.ar-fightres { width: min(96vw, 1100px); max-height: 92vh; overflow-y: auto; box-sizing: border-box; background: var(--panel); border-width: 2px; }
.ar-res-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.ar-res-foot { justify-content: center; }
.ar-tier { display: flex; flex-direction: column; gap: 8px; }
.ar-tierhead { display: flex; align-items: center; gap: 8px; font: 18px var(--font-title); }
.ar-tierhead small { font: 14px var(--font-text); }
.ar-ranks { display: flex; flex-wrap: wrap; gap: 10px; }
.ar-r { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 8px; min-width: 64px; border-radius: 10px; background: rgba(0,0,0,.22); border: 1px solid var(--border); opacity: .55; }
.ar-r img { height: 52px; width: auto; }
.ar-r small { color: var(--muted); }
.ar-r.done { opacity: 1; }
.ar-r.cur { opacity: 1; border-color: var(--gold); background: rgba(233,185,73,.16); }
@media (max-width: 860px) { .ar-head { grid-template-columns: 1fr; } .ar-duel { grid-template-columns: 1fr 44px 1fr; padding: 6px 8px; } }

/* ---------- Salle des trésors (ouverture des sacs de butin) ---------- */
/* Décor : mur sombre, deux piliers à torches (léger balancement façon caméra), piédestal, sac qui flotte.
   Ouverture (.is-open) : le sac tremble (--reveal), éclate (flash, anneaux, rayons) puis les lots jaillissent un à un
   (--step entre deux lots, --fly de vol). Les durées viennent de BAG_ANIM (game.js). */
.bags-dialog {
  width: min(920px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; overflow: hidden;
  background: #07060c; color: var(--text); border: 2px solid #6b4a22; border-radius: 12px;
}
.bags-dialog::backdrop { background: rgba(0, 0, 0, .78); }
.bags-room { position: relative; height: min(620px, calc(100vh - 28px)); min-height: 460px; overflow: hidden; isolation: isolate; user-select: none; }
.bags-room.is-open { cursor: pointer; }
.bags-room img { -webkit-user-drag: none; }
.br-wall {
  position: absolute; inset: -40px; z-index: 0;
  background:
    radial-gradient(ellipse at 50% 52%, rgba(120, 100, 200, .38) 0%, rgba(50, 40, 100, .25) 38%, transparent 72%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0) 0 46px, rgba(0, 0, 0, .28) 46px 49px),
    linear-gradient(#1b1733, #0a0814 75%);
  animation: brSway 11s ease-in-out infinite alternate;
}
.br-pillars { position: absolute; inset: 0; z-index: 1; pointer-events: none; animation: brSway 11s ease-in-out infinite alternate; --sway: 26px; }
.br-pillar { position: absolute; bottom: 70px; height: 74%; }
.br-pillar img { height: 100%; width: auto; display: block; filter: brightness(.5) saturate(.65) sepia(.3) drop-shadow(0 0 18px rgba(0, 0, 0, .8)); }
.br-pillar.l { left: 10%; }
.br-pillar.r { right: 10%; }
.br-pillar.r img { transform: scaleX(-1); }
.flame {
  position: absolute; left: 50%; top: 2px; width: 96px; height: 96px; margin: -92px 0 0 -48px;
  background: url("../img/tresor/flamme.png") 0 0 / 288px 288px no-repeat;
  mix-blend-mode: screen; filter: sepia(1) saturate(8) hue-rotate(-16deg) brightness(1.5);
  animation: brFlame .9s step-end infinite;
}
.br-pillar.r .flame { animation-delay: -.45s; }
.br-light {
  position: absolute; top: 3%; width: 380px; height: 380px; z-index: 1; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(circle, rgba(255, 150, 40, .42) 0%, rgba(255, 110, 20, .16) 38%, transparent 66%);
  animation: brFlicker 2.1s ease-in-out infinite alternate;
}
.br-light.l { left: -90px; }
.br-light.r { right: -90px; animation-delay: -1s; }
.br-floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 190px; z-index: 1;
  background: radial-gradient(ellipse at 50% 0%, rgba(130, 115, 230, .3), transparent 62%), linear-gradient(rgba(23, 19, 42, 0), #0b0914 70%);
  border-top: 1px solid rgba(160, 140, 255, .12);
}
.br-ped { position: absolute; left: 50%; bottom: 92px; width: 320px; height: 112px; margin-left: -160px; z-index: 2; }
.ped-top {
  position: absolute; left: 0; right: 0; top: 0; height: 70px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #6a5a8a 0%, #3a2f55 55%, #241c38 100%);
  border: 3px solid #b8892f; box-shadow: 0 0 0 5px rgba(0, 0, 0, .35), inset 0 -6px 12px rgba(0, 0, 0, .5), 0 0 30px rgba(190, 130, 255, .25);
}
.ped-body {
  position: absolute; left: 12px; right: 12px; top: 35px; height: 74px; z-index: -1;
  background: linear-gradient(90deg, #14101f, #3a2f55 30%, #4a3d68 50%, #3a2f55 70%, #14101f);
  border-radius: 0 0 50% 50% / 0 0 40% 40%; border-bottom: 3px solid #8a6424;
}
.br-stage { position: absolute; left: 50%; bottom: 168px; width: 0; height: 0; z-index: 3; }
.bag-bag {
  position: absolute; left: 0; bottom: 0; width: clamp(112px, 23vw, 160px); transform: translateX(-50%);
  padding: 0; border: 0; background: none; z-index: 3; cursor: pointer;
}
.bag-bag img {
  display: block; width: 100%; height: auto;
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .7)) drop-shadow(0 0 14px rgba(200, 120, 255, .5));
  animation: bagFloat 3.4s ease-in-out infinite;
}
button.bag-bag:hover img, button.bag-bag:focus-visible img { filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .7)) drop-shadow(0 0 22px rgba(255, 210, 120, .85)) brightness(1.12); }
button.bag-bag:focus-visible { outline: none; }
.bag-aura {
  position: absolute; left: -170px; bottom: -70px; width: 340px; height: 340px; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(circle, rgba(200, 130, 255, .5) 0%, rgba(140, 80, 220, .22) 40%, transparent 68%);
  animation: bagBreathe 3.4s ease-in-out infinite;
}
.bag-rays, .bag-ring { position: absolute; pointer-events: none; opacity: 0; mix-blend-mode: screen; background-repeat: no-repeat; background-position: center; background-size: contain; }
.bag-rays { left: -280px; bottom: -200px; width: 560px; height: 560px; background-image: url("../img/tresor/eclat.png"); }
.bag-ring { left: -140px; bottom: -60px; width: 280px; height: 280px; background-image: url("../img/tresor/anneau.png"); filter: sepia(1) saturate(5) brightness(1.5); }
.bag-flash {
  position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 56%, #fff 0%, rgba(255, 236, 190, .85) 30%, rgba(255, 200, 120, 0) 72%);
}
.br-loot { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); width: min(96%, 880px); z-index: 5; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; padding-top: 62px; pointer-events: none; }
.bag-reward {
  position: relative; width: 118px; padding: 8px 6px 7px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  background: linear-gradient(#43331f, #261c12); border: 2px solid var(--gold); border-radius: 12px;
  box-shadow: 0 0 16px rgba(233, 185, 73, .45), inset 0 0 12px rgba(0, 0, 0, .4);
}
.bag-reward.k-gold { border-color: #ffd34d; }
.bag-reward.k-material { border-color: #c792ea; box-shadow: 0 0 16px rgba(199, 146, 234, .5), inset 0 0 12px rgba(0, 0, 0, .4); }
.bag-reward.k-chest, .bag-reward.k-key, .bag-reward.k-fragment { border-color: #6fd0ff; box-shadow: 0 0 16px rgba(111, 208, 255, .5), inset 0 0 12px rgba(0, 0, 0, .4); }
.bag-reward .bg-ico { height: 48px; display: flex; align-items: center; justify-content: center; font-size: 38px; line-height: 1; }
.bag-reward .bg-ico img, .bag-reward .bg-ico img.ui-ico { height: 48px; width: auto; max-width: 64px; object-fit: contain; }
.bag-reward b { font-size: 20px; color: var(--gold); line-height: 1.1; }
.bag-reward small { font-size: 12px; color: var(--text); opacity: .85; line-height: 1.15; max-height: 2.3em; overflow: hidden; }
.bag-reward.k-gold::before {
  content: ""; position: absolute; top: -14px; right: -12px; width: 32px; height: 32px;
  background: url("../img/tresor/pieces.png") 0 0 / 96px 96px no-repeat; animation: brCoin .7s step-end infinite;
}
.bg-spk { position: absolute; left: 50%; top: 40%; width: 0; height: 0; pointer-events: none; }
.bg-spk i { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; background: url("../img/tresor/etoile.png") center / contain no-repeat; opacity: 0; mix-blend-mode: screen; }
.br-title {
  position: absolute; left: -6px; top: 16px; z-index: 7; padding: 6px 30px 7px 22px; text-align: left;
  background: linear-gradient(#f0b24f, #b9701f); border: 2px solid #5a3510; border-left: 0; border-radius: 0 12px 12px 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .45); color: #fff; text-shadow: 0 2px 2px rgba(60, 25, 0, .8);
}
.br-title b { display: block; font-size: 22px; line-height: 1.15; }
.br-title small { display: block; font-size: 14px; line-height: 1.2; color: #ffeccc; }
.br-close { position: absolute; right: 12px; top: 12px; z-index: 8; }
.br-hint {
  position: absolute; left: 12px; right: 12px; bottom: 62px; z-index: 4; text-align: center; font-size: 18px; line-height: 24px; color: #fff;
  text-shadow: 0 2px 3px #000, 0 0 8px rgba(0, 0, 0, .8); pointer-events: none;
}
.is-idle .br-hint { animation: brPulse 1.8s ease-in-out infinite; }
.br-actions { position: absolute; left: 50%; bottom: 62px; z-index: 7; transform: translateX(-50%); display: flex; gap: 12px; opacity: 0; pointer-events: none; }
.is-done .br-actions { opacity: 1; pointer-events: auto; transition: opacity .35s .1s; }
.br-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 56px; z-index: 7; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 12px;
  background: linear-gradient(#2e2213, #17100a); border-top: 2px solid #6b4a22;
}
.br-chip {
  display: flex; align-items: center; gap: 8px; padding: 3px 12px; min-height: 40px; cursor: pointer;
  background: rgba(255, 255, 255, .06); border: 2px solid transparent; border-radius: 10px; color: #fff;
}
.br-chip img { height: 34px; width: auto; display: block; }
.br-chip b { font-size: 18px; line-height: 1; }
.br-chip.none { opacity: .55; }
.br-chip.sel { border-color: var(--gold); background: rgba(233, 185, 73, .18); opacity: 1; }
.br-chip:disabled { cursor: not-allowed; }

/* Phase d'ouverture */
.is-open .bag-bag img { animation: bagShake var(--reveal) ease-in both, bagBurst .38s ease-out var(--reveal) forwards; }
.is-open .bag-aura { animation: auraBuild var(--reveal) ease-in both, auraFade .9s ease-out var(--reveal) forwards; }
.is-open .bag-rays { animation: brRays 1.5s ease-out var(--reveal) forwards; }
.is-open .bag-ring { animation: brRing 1s ease-out var(--reveal) forwards; }
.is-open .bag-ring.r2 { animation-delay: calc(var(--reveal) + 170ms); }
.is-open .bag-flash { animation: brFlash .75s ease-out calc(var(--reveal) - 50ms) forwards; }
.is-open .bag-reward { animation: lootFly var(--fly) cubic-bezier(.2, 1.15, .35, 1) calc(var(--reveal) + var(--i) * var(--step)) both; }
.is-open .bg-spk i { animation: brSpark .85s ease-out calc(var(--reveal) + var(--i) * var(--step) + 520ms) both; }
.is-done .bag-reward { animation: brCardIdle 3s ease-in-out calc(var(--i) * -.6s) infinite alternate; }
.is-done .bg-spk { display: none; }

@keyframes brSway { from { transform: translateX(calc(var(--sway, 12px) * -1)); } to { transform: translateX(var(--sway, 12px)); } }
@keyframes brFlicker { from { opacity: .72; transform: scale(.96); } to { opacity: 1; transform: scale(1.04); } }
@keyframes brFlame {
  0% { background-position: 0 0; } 11.1% { background-position: -96px 0; } 22.2% { background-position: -192px 0; }
  33.3% { background-position: 0 -96px; } 44.4% { background-position: -96px -96px; } 55.5% { background-position: -192px -96px; }
  66.6% { background-position: 0 -192px; } 77.7% { background-position: -96px -192px; } 88.8% { background-position: -192px -192px; }
}
@keyframes brCoin {
  0% { background-position: 0 0; } 11.1% { background-position: -32px 0; } 22.2% { background-position: -64px 0; }
  33.3% { background-position: 0 -32px; } 44.4% { background-position: -32px -32px; } 55.5% { background-position: -64px -32px; }
  66.6% { background-position: 0 -64px; } 77.7% { background-position: -32px -64px; } 88.8% { background-position: -64px -64px; }
}
@keyframes bagFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes bagBreathe { 0%, 100% { opacity: .75; transform: scale(.95); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes brPulse { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }
@keyframes bagShake {
  0% { transform: translate(0, 0) rotate(0) scale(1); } 14% { transform: translate(-2px, 0) rotate(-3deg) scale(1.02); }
  28% { transform: translate(3px, -2px) rotate(4deg) scale(1.05); } 42% { transform: translate(-4px, 0) rotate(-6deg) scale(1.08); }
  56% { transform: translate(5px, -3px) rotate(8deg) scale(1.11); } 70% { transform: translate(-6px, 0) rotate(-10deg) scale(1.15); }
  84% { transform: translate(7px, -4px) rotate(12deg) scale(1.2); } 100% { transform: translate(0, 0) rotate(0) scale(1.26); }
}
@keyframes bagBurst {
  0% { transform: scale(1.26); opacity: 1; filter: brightness(1); } 35% { transform: scale(1.6); opacity: 1; filter: brightness(3.2); }
  100% { transform: scale(.3); opacity: 0; filter: brightness(4); }
}
@keyframes auraBuild { from { opacity: .6; transform: scale(.9); } to { opacity: 1; transform: scale(1.7); } }
@keyframes auraFade { from { opacity: 1; transform: scale(1.7); } to { opacity: 0; transform: scale(2.4); } }
@keyframes brRays { 0% { opacity: 0; transform: scale(.2) rotate(0); } 18% { opacity: 1; } 100% { opacity: 0; transform: scale(2) rotate(60deg); } }
@keyframes brRing { 0% { opacity: .95; transform: scale(.2); } 100% { opacity: 0; transform: scale(3.6); } }
@keyframes brFlash { 0% { opacity: 0; } 22% { opacity: 1; } 100% { opacity: 0; } }
@keyframes lootFly {
  0% { opacity: 0; transform: translate(var(--sx), 150px) scale(.15) rotate(-28deg); }
  8% { opacity: 1; }
  55% { transform: translate(calc(var(--sx) * .2), -30px) scale(1.2) rotate(5deg); }
  78% { transform: translate(0, 6px) scale(.95) rotate(-1deg); }
  100% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
}
@keyframes brSpark {
  0% { opacity: 0; transform: rotate(var(--a)) translateX(0) scale(.2); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scale(1.3); }
}
@keyframes brCardIdle { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@media (max-width: 640px) {
  .bag-reward { width: 96px; }
  .bag-reward .bg-ico, .bag-reward .bg-ico img { height: 38px; font-size: 30px; }
  .br-pillar { height: 58%; }
  .br-title b { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .br-wall, .br-pillars, .bag-bag img, .flame, .bag-aura, .br-light { animation: none; }
}

/* ---------- Salle des trésors : coffres, clés, flèches (d'après la vidéo de l'utilisateur) ---------- */
.bag-bag.chest { width: clamp(130px, 25vw, 200px); }
.bag-bag.chest img { filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .7)) drop-shadow(0 0 16px rgba(255, 170, 60, .4)); }
.bags-room:not(.is-open) .bag-bag.chest img { animation: chestIdle 3.6s ease-in-out infinite; }
.bag-bag.chest.locked img { filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .7)) brightness(.65) saturate(.7); animation: none !important; }
.is-chest .bag-aura { background: radial-gradient(circle, rgba(255, 190, 90, .45) 0%, rgba(220, 130, 40, .2) 40%, transparent 68%); }
.br-key {
  position: absolute; left: calc(50% + clamp(92px, 17vw, 150px)); bottom: 176px; z-index: 4; display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 0; border: 0; background: none; color: #fff; cursor: pointer; text-align: left;
}
.br-key:disabled { cursor: default; }
.bk-ring {
  width: 66px; height: 66px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(20, 70, 40, .85) 0%, rgba(8, 30, 18, .9) 70%); border: 3px solid #3fe08a;
  box-shadow: 0 0 14px rgba(63, 224, 138, .8), inset 0 0 12px rgba(63, 224, 138, .5); animation: keyPulse 1.8s ease-in-out infinite;
}
.bk-ring img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .7)); }
.br-key:hover .bk-ring, .br-key:focus-visible .bk-ring { transform: scale(1.08); }
.br-key:focus-visible { outline: none; }
.bk-txt { display: flex; flex-direction: column; gap: 1px; text-shadow: 0 2px 3px #000, 0 0 8px rgba(0, 0, 0, .8); }
.bk-txt b { font-size: 16px; line-height: 1.15; }
.bk-txt small { font-size: 14px; line-height: 1.15; color: #7dffb0; }
.br-key.off .bk-ring { border-color: #6a6a6a; box-shadow: none; animation: none; background: rgba(30, 30, 30, .8); }
.br-key.off .bk-ring img { filter: grayscale(1) brightness(.7); }
.br-key.off .bk-txt small { color: #bbb; }
.br-gems {
  position: absolute; right: 62px; top: 14px; z-index: 8; display: flex; align-items: center; gap: 6px; padding: 3px 14px 3px 10px; height: 32px;
  background: linear-gradient(#17283f, #0d1625); border: 2px solid #4b6a95; border-radius: 16px; color: #fff; font-size: 16px;
}
.br-gems img.ui-ico { height: 22px; margin: 0; }
.br-arrow {
  position: absolute; top: 44%; z-index: 7; width: 52px; height: 64px; padding: 0; border: 0; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: transform .15s;
}
.br-arrow.l { left: 8px; } .br-arrow.r { right: 8px; }
.br-arrow img { width: 40px; height: auto; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .8)); }
.br-arrow:hover img { filter: drop-shadow(0 0 10px rgba(255, 210, 120, .9)); }
.br-arrow.l:hover { transform: translateX(-3px); } .br-arrow.r:hover { transform: translateX(3px); }
.br-bar { overflow-x: auto; justify-content: safe center; scrollbar-width: none; }
.br-bar::-webkit-scrollbar { display: none; }
.br-chip { flex: 0 0 auto; padding: 3px 9px; gap: 5px; }
.br-chip img.kk { height: 24px; margin-left: 4px; }
@keyframes chestIdle { 0%, 100% { filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .7)) drop-shadow(0 0 12px rgba(255, 170, 60, .3)); } 50% { filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .7)) drop-shadow(0 0 24px rgba(255, 190, 90, .7)) brightness(1.06); } }
@keyframes keyPulse { 0%, 100% { box-shadow: 0 0 10px rgba(63, 224, 138, .6), inset 0 0 10px rgba(63, 224, 138, .4); } 50% { box-shadow: 0 0 22px rgba(63, 224, 138, 1), inset 0 0 14px rgba(63, 224, 138, .7); } }
@media (max-width: 640px) { .br-key { left: calc(50% + 84px); bottom: 190px; } .bk-ring { width: 54px; height: 54px; } .bk-ring img { width: 32px; height: 32px; } .br-arrow { width: 36px; } .br-arrow img { width: 28px; } }

/* ---------- Roulette (même salle que les sacs : .bags-room, fond .br-wall) ---------- */
.rl-room .br-wall, .rl-room .br-light { animation-play-state: running; }
.rl-box { position: absolute; left: 50%; top: 82px; width: min(330px, 56vh); aspect-ratio: 1; transform: translateX(-50%); z-index: 3; }
.rl-wheel {
  position: absolute; inset: 0; border-radius: 50%; border: 8px solid #b8892f;
  box-shadow: 0 0 0 4px #5a3510, 0 10px 24px rgba(0, 0, 0, .7), 0 0 36px rgba(255, 200, 90, .28), inset 0 0 22px rgba(0, 0, 0, .55);
  will-change: transform;
}
.rl-lines { position: absolute; inset: 0; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(0, 0, 0, .55) 0 1.4deg, transparent 1.4deg 30deg); pointer-events: none; }
.rl-ico {
  position: absolute; left: 50%; top: 50%; width: 15%; aspect-ratio: 1; margin: -7.5% 0 0 -7.5%;
  transform: rotate(var(--a)) translateY(-205%) rotate(calc(var(--a) * -1));
}
.rl-ico img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .75)); }
.rl-hub {
  position: absolute; left: 50%; top: 50%; width: 21%; aspect-ratio: 1; margin: -10.5% 0 0 -10.5%; border-radius: 50%; z-index: 2;
  background: radial-gradient(circle at 40% 35%, #f6d27a, #b8892f 60%, #6d4a14); border: 3px solid #5a3510; box-shadow: 0 3px 8px rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center;
}
.rl-hub img { width: 80%; height: auto; display: block; }
.rl-arrow { position: absolute; left: 50%; top: -34px; width: 42px; height: auto; margin-left: -21px; z-index: 4; transform: scaleY(-1); filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .7)); }
.rl-streak {
  position: absolute; left: 12px; top: 84px; z-index: 6; max-width: 210px; display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: rgba(14, 11, 24, .78); border: 1px solid rgba(233, 185, 73, .5); border-radius: 12px;
}
.rl-streak img { width: 38px; height: auto; flex: none; }
.rl-streak b { display: block; font-size: 17px; color: var(--gold); line-height: 1.2; }
.rl-streak small { display: block; font-size: 12px; line-height: 1.25; color: var(--text); opacity: .9; }
.rl-result { position: absolute; left: 50%; bottom: 66px; z-index: 5; transform: translateX(-50%); width: min(96%, 760px); display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; pointer-events: none; }
.rl-room .bag-reward { animation: rlPop .55s cubic-bezier(.2, 1.3, .4, 1) calc(var(--i) * 140ms) both; }
.rl-room .br-hint { bottom: 70px; }
.rl-bar { gap: 18px; }
.rl-info { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-size: 15px; }
.rl-info b { color: var(--gold); font-size: 18px; }
.rl-info img.ui-ico { width: 30px; height: auto; }
.rl-room.is-spin { cursor: pointer; }
@keyframes rlPop { 0% { opacity: 0; transform: translateY(40px) scale(.4); } 70% { opacity: 1; transform: translateY(-6px) scale(1.08); } 100% { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .rl-streak { top: 76px; max-width: 150px; }
  .rl-streak small { display: none; }
}
img.ui-ico.frag { height: 1.3em; width: auto; vertical-align: -0.25em; margin: 0 1px; }
.plan-total { margin: 6px 0 10px; }
.plan-total b { color: var(--gold); }

/* Réserves (boutons, fragments, coffres, clés, matériaux de donjon) : dans l'atelier, sous les artisans */
.loot-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; margin-bottom: 8px; }
.loot-box .mats { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 0; }
.loot-box .qsection { margin-top: 10px; }
.stock .panel-head { margin-bottom: 8px; }
.inventory[hidden], .loot-more[hidden] { display: none; }

/* Recettes favorites */
.fav-btn { background: none; border: 0; padding: 0 6px 0 0; margin: 0; font-size: 20px; line-height: 1; color: #8a7a5a; cursor: pointer; vertical-align: -1px; }
.fav-btn:hover { color: var(--gold); }
.fav-btn.on { color: var(--gold); text-shadow: 0 0 6px rgba(233, 185, 73, .7); }
.cat-tab.fav-tab .tile-img { width: 100%; height: 100%; object-fit: contain; }
.cat-tab.fav-tab:not(.sel) .tile-img { filter: saturate(.85) brightness(.92); }
.board-table .rk-ico { height: 34px; width: auto; display: block; margin: 0 auto; }

/* Stock possédé entre parenthèses (vert si suffisant, rouge s'il manque : hérite de .cost.lack) */
.cost .have { color: var(--good, #7bd88f); font-weight: 700; }
.cost.lack .have { color: var(--bad); }

/* Boutons de l'en-tête (classement, profil, langue, sauvegarde, remise à zéro) : même hauteur que les cellules or / énergie / gemmes (36 px) */
.hud .btn.small { height: 36px; min-height: 36px; min-width: 46px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; line-height: 1; }
.hud .btn.small img.ui-ico { height: 26px; width: auto; margin: 0; vertical-align: middle; }

/* Qualité d'un objet demandé ou offert : nom de l'objet dans la couleur de la qualité (plus de pastille) */
.qname { font-weight: 700; text-shadow: 0 1px 1px rgba(0, 0, 0, .5); }

.qwant { font-size: 13px; color: var(--q, var(--text)); align-self: center; margin-right: 4px; }
.qchip small { margin-left: 4px; color: var(--good, #7bd88f); }

/* Niveau d'un héros : écusson rouge (img/ui/niveau_heros.png, de level_heroes_empty) avec le nombre au centre */
.hero-head .lvl-badge { margin-left: auto; flex: 0 0 auto; position: relative; width: 44px; height: 46px; background: url("../img/ui/niveau_heros.png") center / contain no-repeat; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.lvl-badge b { color: #fff; font-family: var(--font-title); font-size: 20px; line-height: 1; padding-bottom: 2px; text-shadow: -1px -1px 0 #3a0c0c, 1px -1px 0 #3a0c0c, -1px 1px 0 #3a0c0c, 1px 1px 0 #3a0c0c, 0 2px 0 #3a0c0c; }
.lvl-badge.d2 b { font-size: 18px; } .lvl-badge.d3 b { font-size: 14px; }

/* « NIVEAU MAX » sous le héros au niveau maximum : lettres jaune-orangé, contour brun (deux calques superposés) */
.lvl-max { text-align: center; padding: 2px 0 4px; }
.lvl-max .lm, .lm.sm { display: inline-grid; font-family: var(--font-title); font-size: 24px; line-height: 1.1; letter-spacing: .5px; filter: drop-shadow(0 2px 0 #3a1204); }
.lvl-max .lm i, .lm.sm i { grid-area: 1 / 1; font-style: normal; }
.lvl-max .lm-out, .lm.sm .lm-out { -webkit-text-stroke: 6px #6b1f0a; color: #6b1f0a; }
.lvl-max .lm-in, .lm.sm .lm-in { background: linear-gradient(#fff36b 15%, #ffc41f 55%, #ff8a14); -webkit-background-clip: text; background-clip: text; color: transparent; }

.lm.sm { font-size: 17px; }
.lm.sm .lm-out { -webkit-text-stroke: 5px #6b1f0a; }

/* Fenêtre des paliers (#prog-modal) : <dialog> plein écran, sans le style par défaut du navigateur */
dialog#prog-modal { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: none; color: inherit; overflow: visible; }
dialog#prog-modal::backdrop { background: none; }
.pr-name img.info-ico { width: 22px; height: 22px; margin-left: 6px; vertical-align: -5px; }

/* Lignes de plans : colonnes fixes (niveau, coût, info, action) alignées à droite, quel que soit le nom */
.plan-row .pr-lvl, .plan-row .pr-cost { text-align: right; white-space: nowrap; font-size: 14px; }
.plan-row .pr-lvl { color: var(--muted, #b9a98a); }
.plan-row .pr-lvl.low { color: var(--bad); }
.plan-row .pr-cost { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.plan-row .pr-cost img { height: 1.2em; width: auto; }
.plan-row .pr-info { display: flex; justify-content: center; }
.plan-row .pr-info img.info-ico { margin: 0; }
.plan-row .pr-act { display: flex; justify-content: flex-end; text-align: right; white-space: nowrap; }

/* Onglets des lignes de plans : trois colonnes égales, de bord à bord */
.plan-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0; }
.plan-tabs .btn { justify-content: center; white-space: nowrap; }
img.ui-ico.lineico { height: 1.2em; width: auto; vertical-align: -0.2em; margin-right: 2px; filter: brightness(0) invert(1) drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }

/* Blessures des héros */
.hero.injured { border-color: var(--bad); box-shadow: inset 0 0 0 1px rgba(224, 90, 90, .35); }
.hurt-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; padding: 4px 8px; background: rgba(224, 90, 90, .14); border: 1px solid rgba(224, 90, 90, .5); border-radius: 8px; }
.hurt-state { color: #ff9a8a; font-size: 14px; white-space: nowrap; }
.hurt-state b { font-family: var(--font-title); }
.hurt-box .btn img.ui-ico, .party-hurt .btn img.ui-ico { height: 1.3em; width: auto; margin: 0 4px 0 0; vertical-align: middle; }
.party-hurt { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.hurt-line { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 3px 8px; background: rgba(224, 90, 90, .12); border-radius: 8px; }

/* Héros bloqué par le niveau de son bâtiment */
.lvl-cap { margin: 6px 0; padding: 5px 8px; text-align: center; font-size: 13px; line-height: 1.3; color: #ffd9a0; background: rgba(233, 150, 49, .14); border: 1px solid rgba(233, 150, 49, .55); border-radius: 8px; }
.lvl-cap b { color: var(--gold); }

/* Effets d'un bâtiment : une ligne par effet, libellé puis valeur actuelle → valeur du niveau suivant ; texte plus grand */
.building .b-name { font-size: 18px; }
.fx-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 6px; font-size: 16px; line-height: 1.35; }
.fx-row { display: flex; flex-direction: column; gap: 1px; padding-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.fx-row:last-child { border-bottom: 0; padding-bottom: 0; }
.fx-l { font-size: 14px; color: var(--muted, #b9a98a); }
.fx-v { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.fx-now { color: var(--good); font-weight: 700; }
.fx-arrow { font-style: normal; color: var(--muted, #b9a98a); }
.fx-next { color: #ffe08a; font-weight: 700; }

/* Emplacements d'équipement des héros, d'après la maquette : icônes blanches cernées de brun (l'or reste réservé à la catégorie préférée quand
   un emplacement en accepte plusieurs), libellé plus gros et plus lisible, contour brun épais */
.hcard { container-type: inline-size; }
.hcard-icons[data-n] .htype.dim { opacity: .85; }
.hcard-icons[data-n="1"] .htype { width: 46cqw; height: 46cqw; }
.hcard-icons[data-n="2"] .htype { width: 36cqw; height: 36cqw; }
.hcard-icons[data-n="1"] { grid-template-columns: 46cqw; }
.hcard-icons[data-n="2"] { grid-template-columns: repeat(2, 36cqw); }
.hcard-label { font-size: 25cqw; letter-spacing: 0; font-weight: 400;
  text-shadow: -2px -2px 0 #4a2a10, 2px -2px 0 #4a2a10, -2px 2px 0 #4a2a10, 2px 2px 0 #4a2a10, 0 -2px 0 #4a2a10, 0 2px 0 #4a2a10, -2px 0 0 #4a2a10, 2px 0 0 #4a2a10, 0 3px 0 #4a2a10; }
.hcard.dark .hcard-label { font-size: 17cqw; }

/* Pastille de casse : petit rectangle (et non plus une pilule) pour que « 63 % » tienne sans déborder ; posé dans l'angle haut-gauche de la carte */
.hcard-break { top: 7%; left: 7%; padding: 1px 4px 2px; border-radius: 4px; border-width: 1.5px; font-size: 11.5px; line-height: 1.1; min-width: 2.6em; text-align: center;
  background: linear-gradient(rgba(52, 30, 12, .95), rgba(30, 17, 7, .95)); box-shadow: 0 1px 0 rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .08); }
.hcard-break { top: 5%; left: 8%; font-size: 11px; padding: 0 4px 1px; }
.hcard.full { padding-top: 29%; gap: 2px; }

/* ---------- Emplacement d'expédition terminé (clic = récupérer les gains) ---------- */
.slot-tile.done { cursor: pointer; background: linear-gradient(#ffd25a, #e08a12); border-color: #fff1b0; gap: 2px; animation: slotDone 1.2s ease-in-out infinite; }
.slot-tile.done:hover { filter: brightness(1.1); transform: translateY(-2px); }
.slot-tile.done:active { transform: translateY(1px); }
.slot-tile.done .slot-txt { font-size: 19px; -webkit-text-stroke: 5px #7a3a06; }
@keyframes slotDone {
  0%, 100% { box-shadow: 0 0 0 3px #4a2411, 0 4px 8px rgba(0, 0, 0, .55), 0 0 6px 1px rgba(255, 210, 90, .5), inset 0 0 0 2px rgba(255, 255, 255, .35); }
  50% { box-shadow: 0 0 0 3px #4a2411, 0 4px 8px rgba(0, 0, 0, .55), 0 0 22px 8px rgba(255, 210, 90, .95), inset 0 0 0 2px rgba(255, 255, 255, .35); }
}
@media (prefers-reduced-motion: reduce) { .slot-tile.done { animation: none; } }

/* ---------- Fin de donjon : célébration et loteries des héros (renderFete) ---------- */
/* --intro : arrivée du titre ; chaque héros (--d) lance sa loterie (--spin), puis son lot apparaît et ses bonus jaillissent (--bonus chacun).
   .skip (clic ou fin) : tout passe à l'état final. Durées : FETE_ANIM (game.js). */
.fete-dialog {
  width: min(980px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; overflow: hidden;
  background: #0b0810; color: var(--text); border: 2px solid #8a6a2a; border-radius: 12px;
}
.fete-dialog::backdrop { background: rgba(0, 0, 0, .8); }
.fete { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 22px 16px 18px; min-height: 460px; overflow: hidden auto; max-height: calc(100vh - 28px); box-sizing: border-box; isolation: isolate; }
.fete[data-action] { cursor: pointer; }
.fe-bg { position: absolute; inset: -20px; z-index: -3; background: center / cover no-repeat; filter: blur(14px) brightness(.35) saturate(1.2); transform: scale(1.1); }
.fe-rays {
  position: absolute; z-index: -2; left: 50%; top: 70px; width: 720px; height: 720px; margin: -360px 0 0 -360px;
  background: url("../img/tresor/eclat.png") center / contain no-repeat; mix-blend-mode: screen; opacity: 0;
  animation: feRaysIn var(--intro) ease-out both, feRaysTurn 24s linear infinite;
}
.fete.is-lose .fe-rays { display: none; }
.fe-coins { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.fe-coins i {
  position: absolute; left: var(--x); top: -40px; width: 30px; height: 30px; transform: scale(var(--s));
  background: url("../img/tresor/pieces.png") 0 0 / 90px 90px no-repeat; opacity: 0;
  animation: feCoin var(--f) linear calc(var(--intro) * .4 + var(--t)) 2 both, feCoinSpin .6s step-end infinite;
}
.fe-head { position: relative; display: flex; align-items: center; gap: 16px; animation: fePop var(--intro) cubic-bezier(.2, 1.4, .4, 1) both; }
.fe-zone { width: 110px; height: 110px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .8)); }
.fe-txt { display: flex; flex-direction: column; gap: 6px; }
.fe-title { font: 40px/1 var(--font-title), serif; color: #ffe08a; -webkit-text-stroke: 6px #5a2a06; paint-order: stroke fill; letter-spacing: .5px; text-shadow: 0 4px 6px rgba(0, 0, 0, .7); }
.fete.is-lose .fe-title { color: #e6d6c0; -webkit-text-stroke-color: #3a2a1c; }
.fe-txt small { font-size: 16px; color: #f5e6c8; text-shadow: 0 1px 2px #000; }
.fe-stars { position: absolute; inset: -18px -30px; pointer-events: none; }
.fe-stars i {
  position: absolute; width: 26px; height: 26px; background: url("../img/tresor/etoile.png") center / contain no-repeat; mix-blend-mode: screen; opacity: 0;
  animation: feTwinkle 1.6s ease-in-out calc(var(--intro) + var(--k) * 260ms) infinite both;
}
.fe-stars i:nth-child(1) { left: 0; top: 10%; } .fe-stars i:nth-child(2) { left: 24%; top: -6%; } .fe-stars i:nth-child(3) { right: 18%; top: -10%; }
.fe-stars i:nth-child(4) { right: 0; top: 30%; } .fe-stars i:nth-child(5) { right: 30%; bottom: -8%; } .fe-stars i:nth-child(6) { left: 12%; bottom: -4%; }

.fe-team { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 14px; width: 100%; }
.fh {
  width: 160px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px 10px; box-sizing: border-box;
  background: linear-gradient(rgba(60, 42, 24, .92), rgba(28, 19, 11, .94)); border: 2px solid #8a6a3a; border-radius: 14px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .06);
  animation: feCardIn 500ms ease-out calc(var(--d) - 350ms) both;
}
/* Loterie : fenêtre d'une case, la bande défile puis s'arrête sur la case gagnante (dernière) */
.fh-reel {
  position: relative; width: 84px; height: var(--cell); overflow: hidden; border-radius: 10px;
  background: radial-gradient(circle, #3a2a50 0%, #120c1c 75%); border: 3px solid #e9b949;
  box-shadow: 0 0 0 2px #4a2411, inset 0 0 12px rgba(0, 0, 0, .9);
}
.fh-reel::before, .fh-reel::after { content: ""; position: absolute; left: 0; right: 0; height: 14px; z-index: 2; pointer-events: none; }
.fh-reel::before { top: 0; background: linear-gradient(rgba(0, 0, 0, .75), transparent); }
.fh-reel::after { bottom: 0; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }
.fh-strip { display: flex; flex-direction: column; animation: feSpin var(--spin) cubic-bezier(.12, .62, .22, 1) var(--d) both; }
.fh-cell { flex: 0 0 var(--cell); height: var(--cell); display: flex; align-items: center; justify-content: center; }
.fh-cell img, .fh-cell img.ri, .fh-cell img.ui-ico, .fh-cell img.ii { height: 42px; width: auto; max-width: 56px; object-fit: contain; vertical-align: middle; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .7)); }
.fh-shine { position: absolute; inset: -40%; z-index: 3; pointer-events: none; background: url("../img/tresor/eclat.png") center / contain no-repeat; mix-blend-mode: screen; opacity: 0;
  animation: feShine 900ms ease-out calc(var(--d) + var(--spin)) both; }
.fh-prize { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 40px; text-align: center; animation: fePrize 450ms cubic-bezier(.2, 1.6, .4, 1) calc(var(--d) + var(--spin)) both; }
.fh-prize b { font: 22px/1 var(--font-title), serif; color: var(--gold); text-shadow: 0 2px 2px #000; }
.fh-prize small { font-size: 13px; line-height: 1.15; color: #f5e6c8; }
.fh-bonus { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.fh-b {
  display: grid; grid-template-columns: 34px auto 1fr; align-items: center; gap: 6px; height: 42px; box-sizing: border-box; padding: 0 8px; border-radius: 10px;
  background: rgba(30, 60, 90, .55); border: 2px solid #6fd0ff; box-shadow: 0 0 12px rgba(111, 208, 255, .45);
  animation: fePrize 450ms cubic-bezier(.2, 1.6, .4, 1) calc(var(--d) + var(--spin) + var(--bonus) * (var(--k) + 1)) both;
}
.fh-b.k-bag, .fh-b.k-gold { border-color: #e9b949; background: rgba(90, 60, 20, .6); box-shadow: 0 0 12px rgba(233, 185, 73, .5); }
.fh-b.k-material { border-color: #c792ea; background: rgba(60, 30, 80, .55); box-shadow: 0 0 12px rgba(199, 146, 234, .5); }
.fh-bi { display: flex; align-items: center; justify-content: center; }
.fh-bi img, .fh-bi img.ri, .fh-bi img.ui-ico, .fh-bi img.ii { height: 30px; width: auto; max-width: 34px; object-fit: contain; vertical-align: middle; }
.fh-b b { font: 16px/1 var(--font-title), serif; color: var(--gold); }
.fh-b small { font-size: 12px; line-height: 1.1; color: #f5e6c8; text-align: left; }
.fh-hero { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 2px; }
.fh-hero img.av { width: 68px; height: 68px; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .7)); animation: feHop 500ms ease-out calc(var(--d) + var(--spin)) both; }
.fh-hero b { font: 16px/1.1 var(--font-title), serif; color: #fff; }
.fh-hero small { font-size: 12px; color: var(--muted); }
.fh-xp, .fh-st { display: grid; grid-template-columns: 22px auto; align-items: center; gap: 6px; font-size: 14px; color: #f5e6c8; }
.fh-xp img, .fh-st img, .fh-st img.ii, .fh-st img.ui-ico { height: 20px; width: 20px; object-fit: contain; vertical-align: middle; }
.fh-st.bad { color: #ff9d8a; }
.fh-st.ok { color: #9fe39f; }
.fh-xp, .fh-st, .fh-lvl { animation: feFade 400ms ease-out calc(var(--d) + var(--spin) + 150ms) both; }
.fh-lvl { padding: 2px 10px 3px; border-radius: 999px; font: 14px/1.2 var(--font-title), serif; color: #1c1406; background: linear-gradient(#ffe08a, #e9a93a); box-shadow: 0 0 10px rgba(255, 210, 90, .7); }
.fe-actions { display: flex; gap: 10px; animation: feFade 400ms ease-out var(--intro) both; }
.fe-actions .btn { min-width: 160px; }

/* Passer : tout à l'état final */
.fete.skip *, .fete.skip *::before, .fete.skip *::after { animation-delay: 0s !important; animation-duration: .01s !important; }
.fete.skip .fe-rays { animation: feRaysTurn 24s linear infinite !important; opacity: .55; }
.fete.skip .fe-stars i { animation: feTwinkle 1.6s ease-in-out calc(var(--k) * 260ms) infinite both !important; }
.fete.skip .fe-coins i { display: none; }
@media (prefers-reduced-motion: reduce) {
  .fete *, .fete *::before, .fete *::after { animation-delay: 0s !important; animation-duration: .01s !important; animation-iteration-count: 1 !important; }
  .fete .fe-coins { display: none; }
}
@media (max-width: 560px) { .fe-title { font-size: 28px; } .fe-zone { width: 72px; height: 72px; } .fh { width: 138px; } }

@keyframes feRaysIn { from { opacity: 0; transform: scale(.3); } to { opacity: .55; transform: scale(1); } }
@keyframes feRaysTurn { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes fePop { 0% { opacity: 0; transform: scale(.3); } 100% { opacity: 1; transform: none; } }
@keyframes feCardIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes feSpin { 0% { transform: translateY(0); } 88% { transform: translateY(calc(var(--end) - 8px)); } 100% { transform: translateY(var(--end)); } }
@keyframes feShine { 0% { opacity: 0; transform: scale(.3) rotate(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.4) rotate(50deg); } }
@keyframes fePrize { 0% { opacity: 0; transform: scale(.3); } 100% { opacity: 1; transform: none; } }
@keyframes feHop { 0% { transform: none; } 40% { transform: translateY(-10px); } 100% { transform: none; } }
@keyframes feFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes feTwinkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(45deg); } }
@keyframes feCoin { 0% { opacity: 0; translate: 0 0; } 8% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; translate: 0 560px; } }
@keyframes feCoinSpin {
  0% { background-position: 0 0; } 11.1% { background-position: -30px 0; } 22.2% { background-position: -60px 0; }
  33.3% { background-position: 0 -30px; } 44.4% { background-position: -30px -30px; } 55.5% { background-position: -60px -30px; }
  66.6% { background-position: 0 -60px; } 77.7% { background-position: -30px -60px; } 88.8% { background-position: -60px -60px; }
}

/* ---------- Fin de donjon, v2 : rebond, gros lot, chef, barres d'XP et de progression, butin du groupe ---------- */
/* Loterie : décélère (ease-out), dépasse la case gagnante puis revient en rebondissant */
@keyframes feSpin2 {
  0% { transform: translateY(0); animation-timing-function: cubic-bezier(.1, .55, .2, 1); }
  84% { transform: translateY(calc(var(--end) - 18px)); animation-timing-function: ease-in-out; }
  93% { transform: translateY(calc(var(--end) + 6px)); animation-timing-function: ease-in-out; }
  100% { transform: translateY(var(--end)); }
}
.fh-strip { animation: feSpin2 var(--spin) linear var(--d) both; }
.fh { position: relative; isolation: isolate; }
/* Chef du groupe : cadre doré et insigne « Meneur » */
.fh.leader { border-color: #e9b949; box-shadow: 0 6px 14px rgba(0, 0, 0, .6), 0 0 0 2px rgba(233, 185, 73, .35), inset 0 0 0 1px rgba(255, 230, 150, .2); }
.fh-chef { position: absolute; top: -12px; left: -10px; width: 34px; height: 34px; object-fit: contain; z-index: 4; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .8)); }
/* Gros lot : la carte s'illumine (or ou bleu) et des rayons tournent derrière elle */
.fh.rare { animation: feCardIn 500ms ease-out calc(var(--d) - 350ms) both, feRareGlow 1.6s ease-in-out calc(var(--d) + var(--rt)) infinite; }
.fh.r-gold { --rare: rgba(255, 205, 80, .9); }
.fh.r-blue { --rare: rgba(111, 208, 255, .9); }
.fh.rare.r-gold { border-color: #ffd25a; }
.fh.rare.r-blue { border-color: #6fd0ff; }
.fh-rays { position: absolute; z-index: -1; left: 50%; top: 40px; width: 300px; height: 300px; margin: -150px 0 0 -150px; pointer-events: none;
  background: url("../img/tresor/eclat.png") center / contain no-repeat; mix-blend-mode: screen; opacity: 0;
  animation: feRareIn 600ms ease-out calc(var(--d) + var(--rt)) both, feRaysTurn 9s linear infinite; }
.fh.r-blue .fh-rays { filter: hue-rotate(170deg) saturate(1.6); }
@keyframes feRareIn { from { opacity: 0; transform: scale(.2); } to { opacity: .8; transform: scale(1); } }
@keyframes feRareGlow {
  0%, 100% { box-shadow: 0 6px 14px rgba(0, 0, 0, .6), 0 0 8px 1px var(--rare); }
  50% { box-shadow: 0 6px 14px rgba(0, 0, 0, .6), 0 0 26px 8px var(--rare); }
}
/* Barre d'XP : se remplit ; en cas de montée de niveau elle déborde, repart de zéro, puis « Niveau N ! » */
.fh-xpbar { width: 86%; height: 8px; border-radius: 99px; background: rgba(0, 0, 0, .55); border: 1px solid #6a5030; overflow: hidden; }
.fh-xpbar i { display: block; height: 100%; width: var(--f1); border-radius: 99px; background: linear-gradient(#ffe08a, #e9a93a);
  animation: feXp var(--xpd) ease-out calc(var(--d) + var(--spin) + 150ms) both; }
.fh-xpbar.up i { animation-name: feXpUp; }
@keyframes feXp { from { width: var(--f0); } to { width: var(--f1); } }
@keyframes feXpUp { 0% { width: var(--f0); } 45% { width: 100%; } 50% { width: 0; } 100% { width: var(--f1); } }
.fh-lvl-slot:empty { display: none; }
.fh-lvl { animation: fePrize 450ms cubic-bezier(.2, 1.6, .4, 1) calc(var(--d) + var(--spin) + 150ms + var(--xpd) * .5) both !important; }
/* Progression du donjon sous le titre */
.fe-prog { display: grid; grid-template-columns: auto 160px auto; align-items: center; gap: 8px; font-size: 14px; color: #f5e6c8; animation: feFade 400ms ease-out var(--intro) both; }
.fe-prog b { font: 15px/1 var(--font-title), serif; color: var(--gold); }
.fe-pbar { height: 10px; border-radius: 99px; background: rgba(0, 0, 0, .6); border: 1px solid #6a5030; overflow: hidden; }
.fe-pbar i { display: block; height: 100%; width: var(--p1); background: linear-gradient(#8fe0ff, #2f9be0); border-radius: 99px;
  animation: feProg 1100ms ease-out calc(var(--intro) + 200ms) both; }
.fe-pbar.full i { background: linear-gradient(#ffe08a, #e9a93a); box-shadow: 0 0 10px rgba(255, 210, 90, .8); }
@keyframes feProg { from { width: var(--p0); } to { width: var(--p1); } }
/* Boss et donjon terminé : plus de rayons, rayons plus chauds */
.fete.is-boss .fe-rays { width: 860px; height: 860px; margin: -430px 0 0 -430px; }
.fe-rays.r2 { animation: feRaysIn var(--intro) ease-out both, feRaysTurn 36s linear infinite reverse; filter: sepia(1) saturate(4) hue-rotate(-20deg); }
.fete.skip .fe-rays.r2 { animation: feRaysTurn 36s linear infinite reverse !important; }
.fete.is-final .fe-title { color: #fff2b0; font-size: 46px; }
.fete.is-final .fe-bg { filter: blur(14px) brightness(.45) saturate(1.6) sepia(.4); }
/* Butin du groupe et boutons de fin : seulement une fois l'animation finie */
.fe-sum { display: none; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.fete.ended .fe-sum { display: flex; animation: feFade 400ms ease-out both; }
.fe-sum-t { font: 16px var(--font-title), serif; color: #f5e6c8; }
.fe-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.fe-chip { display: grid; grid-template-columns: 28px auto auto; align-items: center; gap: 6px; height: 36px; box-sizing: border-box; padding: 0 10px; border-radius: 10px;
  background: rgba(20, 14, 8, .75); border: 1px solid #6a5030; }
.fe-chip img, .fe-chip img.ri, .fe-chip img.ui-ico, .fe-chip img.ii { height: 26px; width: auto; max-width: 28px; object-fit: contain; vertical-align: middle; justify-self: center; }
.fe-chip b { font: 15px/1 var(--font-title), serif; color: var(--gold); }
.fe-chip small { font-size: 13px; color: #f5e6c8; }
.fe-chip.k-chest, .fe-chip.k-key, .fe-chip.k-bag { border-color: #e9b949; }
.fe-chip.k-fragment { border-color: #6fd0ff; }
.fe-actions { flex-wrap: wrap; justify-content: center; gap: 10px; }
.fe-actions .btn { min-width: 0; display: inline-flex; align-items: center; gap: 8px; }
.fe-actions .btn .ui-ico { height: 22px; width: auto; }
.fe-after { display: none !important; }
.fete.ended .fe-after { display: inline-flex !important; }
.fete.ended .fe-skipbtn { display: none; }
.fe-skipbtn { min-width: 160px !important; justify-content: center; }
/* Case d'expédition : portraits superposés (3 au plus) puis « +n » */
.slot-heroes { display: flex; align-items: center; justify-content: center; }
.slot-heroes img.av { width: 24px; height: 24px; vertical-align: middle; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .7)); }
.slot-heroes img.av + img.av { margin-left: -7px; }
.slot-more { margin-left: 3px; font: 13px/1 var(--font-title), serif; color: #fff; -webkit-text-stroke: 3px #4a2411; paint-order: stroke fill; }
/* Tuile « Tout récupérer » */
.slot-tile.claim-all { cursor: pointer; background: linear-gradient(#5fe08a, #1f9a4a); border-color: #c8ffd8; justify-content: center; gap: 4px; animation: slotDone 1.2s ease-in-out infinite; }
.slot-tile.claim-all:hover { filter: brightness(1.1); transform: translateY(-2px); }
.slot-tile.claim-all .slot-ico { height: 40px; width: auto; }
.slot-tile.claim-all .slot-txt { font-size: 15px; line-height: 1.05; text-align: center; -webkit-text-stroke: 4px #0b4a22; }
.slot-n { position: absolute; top: -10px; right: -10px; min-width: 26px; height: 26px; box-sizing: border-box; padding: 0 6px; border-radius: 99px; display: flex; align-items: center; justify-content: center;
  font: 15px/1 var(--font-title), serif; color: #fff; background: #d9584a; border: 2px solid #fff; box-shadow: 0 2px 3px rgba(0, 0, 0, .5); }
.fete.skip .fh.rare { animation: feRareGlow 1.6s ease-in-out infinite !important; }
.fete.skip .fh-rays { animation: feRaysTurn 9s linear infinite !important; opacity: .8; }

/* ---------- Mécanique de vente : humeur, réputation, série, fidélité, clients spéciaux, aperçu des gains ---------- */
.counter-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -2px 0 10px; }
.cs-chip { display: inline-grid; grid-auto-flow: column; align-items: center; gap: 6px; height: 30px; box-sizing: border-box; padding: 0 10px; border-radius: 99px;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--border); font-size: 14px; white-space: nowrap; }
.cs-chip img.ui-ico { height: 22px; width: auto; vertical-align: middle; }
.cs-chip b { font: 15px/1 var(--font-title), serif; color: var(--gold); }
.cs-chip small { color: var(--muted); font-size: 13px; }
.cs-chip.streak:not(.on) { opacity: .6; }
.cs-chip.streak.on { border-color: #e9b949; }
.cs-bar { display: block; width: 64px; height: 8px; border-radius: 99px; background: rgba(0, 0, 0, .55); border: 1px solid #6a5030; overflow: hidden; }
.cs-bar i { display: block; height: 100%; background: linear-gradient(#8fe0ff, #2f9be0); border-radius: 99px; }

.cust-id { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.cust-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cust-badge { display: inline-flex; align-items: center; gap: 2px; }
.cust-badge img.ui-ico { height: 18px; width: auto; vertical-align: middle; }
.cust-badge.loyal b { font: 13px/1 var(--font-title), serif; color: #ff9db0; }
.cust-badge.spec img.ui-ico { height: 22px; }
/* Humeur : visage + barre de patience (couleur selon l'humeur) */
.cust-pat { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 6px; }
.cust-pat img.v-mood { height: 22px; width: 22px; object-fit: contain; }
.pat-bar { display: block; height: 8px; border-radius: 99px; background: rgba(0, 0, 0, .55); border: 1px solid #5a4430; overflow: hidden; }
.pat-bar i { display: block; height: 100%; border-radius: 99px; transition: width .25s linear; }
.cust-pat.m1 .pat-bar i { background: linear-gradient(#7ff0b0, #2fb36a); }
.cust-pat.m2 .pat-bar i { background: linear-gradient(#ffe08a, #e9b93a); }
.cust-pat.m3 .pat-bar i { background: linear-gradient(#ffb36a, #e07a2a); }
.cust-pat.m4 .pat-bar i { background: linear-gradient(#ff8a7a, #d9384a); animation: patWarn 1s ease-in-out infinite; }
@keyframes patWarn { 50% { opacity: .55; } }
/* Bonus actifs sur la vente */
.v-bonus { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.vb { display: inline-grid; grid-auto-flow: column; align-items: center; gap: 4px; height: 26px; box-sizing: border-box; padding: 0 8px; border-radius: 8px;
  font: 13px/1 var(--font-title), serif; background: rgba(0, 0, 0, .3); border: 1px solid var(--border); color: var(--gold); }
.vb img.ui-ico { height: 18px; width: auto; vertical-align: middle; }
.vb.prime { border-color: #8fd98f; color: #b6f0b6; box-shadow: 0 0 8px rgba(111, 191, 115, .45); }
.vb.loyal { border-color: #ff9db0; color: #ffc0cc; }
.vb.spec { border-color: #e9b949; }
/* Clients spéciaux : cadre coloré */
.customer.special { border-width: 2px; }
.customer.k-presse { border-color: #ff9d6a; box-shadow: 0 0 10px rgba(255, 140, 80, .35); }
.customer.k-collection { border-color: #c792ea; box-shadow: 0 0 10px rgba(199, 146, 234, .4); }
.customer.k-marchand { border-color: #6fd0ff; box-shadow: 0 0 10px rgba(111, 208, 255, .35); }
.cust-actions .btn small img.ui-ico { height: 14px; width: auto; vertical-align: -2px; }

/* ---------- Icônes à la place des anciens emoji ---------- */
h1 .brand-ico { height: 1.15em; width: auto; vertical-align: -0.2em; }
.slot-lock img.ui-ico { height: 34px; width: auto; }
.glyph img.ui-ico { height: 1em; width: auto; filter: none; }
.b-lock img.ui-ico { height: 18px; width: auto; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .8)); }
.slot-cancel img.ui-ico { height: 10px; width: 10px; }
.pg-ok img.ui-ico, .og-step img.ui-ico.ok, .ach-ok img.ui-ico { height: 1em; width: auto; vertical-align: -0.15em; }
.fav-btn { display: inline-flex; align-items: center; vertical-align: -3px; }
.fav-btn img.ui-ico { height: 20px; width: 20px; }
img.ui-ico.fav.off { filter: grayscale(1) brightness(.75); opacity: .65; }
.fav-btn:hover img.ui-ico.fav.off { filter: none; opacity: 1; }
.fav-btn.on img.ui-ico { filter: drop-shadow(0 0 4px rgba(233, 185, 73, .8)); }
.city-col h3 img.ui-ico, .hero-class h3 img.ui-ico { height: 1.4em; width: auto; vertical-align: -0.35em; }
.dp-bar span img.ui-ico, .z-boss img.ui-ico { height: 1.1em; width: auto; vertical-align: -0.2em; }

/* ---------- Soigner tout le monde ---------- */
.heal-all-bar { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 12px;
  border-radius: var(--radius); background: rgba(217, 88, 74, .12); border: 1px solid rgba(217, 88, 74, .5); }
.heal-all-bar > img.ui-ico { height: 22px; width: auto; justify-self: center; }
.btn.heal-all { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn.heal-all img.ui-ico { height: 18px; width: auto; }
.heal-all-row { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ---------- Filtre « Demandés » de l'atelier ---------- */
.want-tab { position: relative; }
/* Option « Voir les demandes du comptoir » sur Non : cloche estompée et barrée d'une croix */
.want-tab.off .tile-img { opacity: .55; }
.want-tab .want-bar { position: absolute; left: 50%; top: 50%; width: 70%; height: 70%; transform: translate(-50%, -50%); object-fit: contain; pointer-events: none; }
/* Menu Options */
.options-dialog .save-box { max-width: 520px; }
.opt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.opt-txt { display: flex; flex-direction: column; gap: 2px; }
.opt-txt small { font-size: 13px; }
.opt-choice { display: grid; grid-template-columns: 64px 64px; gap: 8px; }
.opt-choice .btn { width: 100%; }
.opt-choice .btn[aria-pressed="false"] { opacity: .55; }
.save-head h2 img.ui-ico { height: 1.1em; width: auto; vertical-align: -0.15em; }
.want-n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; box-sizing: border-box; padding: 0 4px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center; font: 11px/1 var(--font-title), serif; color: #fff; background: #d9584a; border: 1.5px solid #fff; }
.want-tag { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 8px; border-radius: 99px; white-space: nowrap;
  font: 12px/1 var(--font-text), serif; font-weight: normal; vertical-align: 1px; }
.want-tag img.ui-ico { height: 14px; width: auto; }
.want-tag b { font: 12px/1 var(--font-title), serif; }
.want-tag.ok { background: rgba(111, 191, 115, .15); border: 1px solid rgba(111, 191, 115, .55); color: #b6f0b6; }
.want-tag.ko { background: rgba(217, 88, 74, .16); border: 1px solid rgba(217, 88, 74, .6); color: #ffb3a8; }
/* Détail des demandes sous le nom (listes Comptoir / Commandes) */
.r-want { display: flex; flex-wrap: wrap; column-gap: 12px; row-gap: 2px; font-size: 12px; color: var(--muted); margin: 1px 0 2px; }
.r-want > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.r-want img.ui-ico { height: 14px; width: auto; }

/* ---------- Objectifs du jour (panneau Quêtes) ---------- */
.daily { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; padding: 10px 12px; border-radius: var(--radius);
  background: rgba(0, 0, 0, .22); border: 1px solid var(--border); }
.dl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 2px; }
.dl-head b { font: 17px var(--font-title), serif; color: var(--gold); }
.dl-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 76px 112px 96px; align-items: center; gap: 10px; min-height: 36px; }
.dl-ico { display: flex; justify-content: center; }
.dl-ico img.ui-ico { height: 24px; width: auto; max-width: 28px; object-fit: contain; }
.dl-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 14px; }
.dl-bar { display: block; height: 6px; border-radius: 99px; background: rgba(0, 0, 0, .5); overflow: hidden; }
.dl-bar i { display: block; height: 100%; background: linear-gradient(#8fe0ff, #2f9be0); border-radius: 99px; }
.dl-row.ready .dl-bar i, .dl-row.claimed .dl-bar i { background: linear-gradient(#a8f0a8, #4caf50); }
.dl-n { text-align: right; font-size: 14px; color: var(--muted); }
.dl-rw { display: grid; grid-template-columns: 18px auto 18px auto; align-items: center; gap: 4px; justify-content: end; font-size: 13px; }
.dl-rw img.ui-ico { height: 16px; width: auto; justify-self: center; }
.dl-rw b { font: 13px/1 var(--font-title), serif; color: var(--gold); }
.dl-act { display: flex; justify-content: flex-end; }
.dl-act > img.ui-ico { height: 22px; width: auto; margin-right: 30px; }
.dl-row.claimed { opacity: .6; }
.dl-row.bonus { border-top: 1px dashed var(--border); padding-top: 6px; }
.dl-done { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 36px; font-size: 15px; color: var(--muted); }
.dl-done > img.ui-ico { height: 22px; width: auto; }
.dl-done b { color: var(--gold); font-weight: normal; }
@media (max-width: 560px) { .dl-row { grid-template-columns: 24px minmax(0, 1fr) 60px; } .dl-rw { display: none; } .dl-act { grid-column: 2 / -1; } }

/* ---------- Listes en colonnes fixes (règle `.plan-row`) : râteliers, présentoirs ---------- */
.rack-group-head.rg-grid { display: grid; grid-template-columns: 24px minmax(0, 1fr) 128px 104px; gap: 8px; }
.rg-ico { display: flex; justify-content: center; }
.rg-ico img { height: 20px; width: auto; }
.rg-c, .rk-stat, .sh-lv { text-align: right; white-space: nowrap; }
.rack.rk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 104px minmax(0, 200px); gap: 8px; padding-left: 32px; }
.rk-act { display: flex; justify-content: flex-end; min-width: 0; }
.rack.sh-grid { display: grid; grid-template-columns: 24px minmax(0, 1fr) 52px minmax(0, 200px); gap: 8px; }
.sh-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.party-foot .warn { color: #f0b36a; }

/* Interrupteur « Jouer sans patience » (en-tête du comptoir) */
.cs-switch { display: inline-grid; grid-template-columns: 38px auto; align-items: center; gap: 8px; height: 30px; box-sizing: border-box; padding: 0 10px; border-radius: 99px;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--border); font-size: 14px; cursor: pointer; user-select: none; }
.cs-switch input { position: absolute; opacity: 0; pointer-events: none; }
.cs-switch .sw-track { position: relative; width: 38px; height: 20px; border-radius: 99px; background: #4a3a28; border: 1px solid #6a5030; transition: background .2s; }
.cs-switch .sw-track i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #d8c8a8; transition: transform .2s; }
.cs-switch.on { border-color: #8fd98f; }
.cs-switch.on .sw-track { background: #3f8f4f; }
.cs-switch.on .sw-track i { transform: translateX(18px); background: #fff; }
.cs-switch small { color: var(--muted); font-size: 13px; }
.cs-switch:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Packs premium */
#packs-dialog .save-box { max-width: 560px; }
.pk-card { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; padding: 8px; background: rgba(0,0,0,.14); border-radius: 8px; }
.pk-card.done { opacity: .75; }
.pk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.pk-head h3 { margin: 0; }
.pk-row { display: grid; grid-template-columns: 2rem 1fr 3.3rem 26px; align-items: center; gap: 8px; padding: 3px 8px; background: rgba(0,0,0,.14); border-radius: 6px; }

/* ===== « Atomisé » : perfect subi en arène (écran façon jeu de combat, #ko-dialog, koShow) ===== */
.ko-dialog { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--text); overflow: clip; }
.ko-dialog::backdrop { background: rgba(0, 0, 0, .85); }
.ko-stage { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; isolation: isolate; overflow: clip;
  background: radial-gradient(ellipse at center, #5a0a0a 0%, #1a0306 55%, #000 100%); }
.ko-dialog.go .ko-stage { animation: koShake .55s 0.55s cubic-bezier(.36,.07,.19,.97) both; }
.ko-lines { position: absolute; left: 50%; top: 50%; width: 180vmax; height: 180vmax; margin: -90vmax 0 0 -90vmax; z-index: -2; opacity: 0; mix-blend-mode: screen; filter: sepia(1) saturate(6) hue-rotate(-30deg); }
.ko-dialog.go .ko-lines { animation: koLines 1.2s .5s ease-out both, koSpin 9s linear infinite; }
.ko-smoke { position: absolute; z-index: -1; width: 60vmin; height: 60vmin; opacity: 0; filter: brightness(.5) sepia(1) hue-rotate(-30deg) saturate(3); }
.ko-smoke.s1 { left: 5%; top: 30%; } .ko-smoke.s2 { right: 5%; top: 20%; transform: scaleX(-1); }
.ko-dialog.go .ko-smoke { animation: koSmoke 3s .6s ease-out both; }
.ko-impact { position: absolute; left: 50%; top: 42%; width: 80vmin; height: 80vmin; margin: -40vmin 0 0 -40vmin; z-index: 0; opacity: 0; mix-blend-mode: screen; pointer-events: none; }
.ko-dialog.go .ko-impact { animation: koImpact .7s .5s ease-out both; }
.ko-flash { position: absolute; inset: 0; background: #fff; opacity: 0; z-index: 5; pointer-events: none; }
.ko-dialog.go .ko-flash { animation: koFlash .45s .5s ease-out both; }
.ko-word { position: relative; z-index: 2; font-family: var(--font-title); font-size: clamp(64px, 15vw, 210px); line-height: 1; font-style: italic; letter-spacing: .02em;
  color: #ffd84a; background: linear-gradient(180deg, #fff6b0 0%, #ffcf2e 45%, #e85a10 55%, #a81808 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 3px #2a0400; filter: drop-shadow(0 8px 0 #2a0400) drop-shadow(0 0 30px rgba(255, 120, 0, .7)); transform: skewX(-12deg); opacity: 0; }
.ko-dialog.go .ko-word { animation: koSlam .5s .1s cubic-bezier(.2, 1.6, .4, 1) both; }
.ko-score { z-index: 2; display: flex; align-items: center; gap: 18px; font-family: var(--font-title); font-size: clamp(36px, 6vw, 72px); color: #fff; text-shadow: 0 4px 0 #2a0400, 0 0 18px #ff3a1a; opacity: 0; }
.ko-score i { font-style: normal; color: #ff6a3a; }
.ko-dialog.go .ko-score { animation: koPop .35s 1.1s cubic-bezier(.2, 1.6, .4, 1) both; }
.ko-msg { z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 0 16px; opacity: 0; }
.ko-dialog.go .ko-msg { animation: koUp .5s 1.6s ease-out both; }
.ko-msg p { margin: 0; }
.ko-line1, .ko-line2 { font-family: var(--font-title); font-size: clamp(24px, 4.2vw, 48px); color: #fff; text-shadow: 0 3px 0 #000, 0 0 14px #ff2a1a; }
.ko-line2 { color: #ffd84a; }
.ko-dialog.go .ko-line2 { animation: koWobble 1.4s 2.2s ease-in-out infinite; }
.ko-by { color: #e9d9c0; font-size: 18px; max-width: 640px; }
.ko-by b { color: #ff8a5a; font-family: var(--font-title); }
.ko-team { display: flex; gap: 10px; margin: 6px 0; }
.ko-hero img.av { width: 56px; height: 56px; filter: drop-shadow(0 3px 3px #000); }
.ko-dialog.go .ko-hero { animation: koPop .3s calc(2s + var(--i) * .1s) cubic-bezier(.2, 1.6, .4, 1) both; }
.ko-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
@keyframes koSlam { 0% { opacity: 0; transform: skewX(-12deg) scale(4); } 70% { opacity: 1; transform: skewX(-12deg) scale(.9); } 100% { opacity: 1; transform: skewX(-12deg) scale(1); } }
@keyframes koPop { 0% { opacity: 0; transform: scale(0); } 100% { opacity: 1; transform: scale(1); } }
@keyframes koUp { 0% { opacity: 0; transform: translateY(30px); } 100% { opacity: 1; transform: none; } }
@keyframes koFlash { 0% { opacity: .95; } 100% { opacity: 0; } }
@keyframes koImpact { 0% { opacity: 1; transform: scale(.2) rotate(0); } 100% { opacity: 0; transform: scale(2.4) rotate(40deg); } }
@keyframes koLines { 0% { opacity: 0; } 30% { opacity: .9; } 100% { opacity: .35; } }
@keyframes koSpin { to { rotate: 360deg; } }
@keyframes koSmoke { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: .7; } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes koShake { 10%, 90% { transform: translate(-4px, 2px); } 20%, 80% { transform: translate(8px, -4px); } 30%, 50%, 70% { transform: translate(-14px, 6px); } 40%, 60% { transform: translate(14px, -6px); } }
@keyframes koWobble { 0%, 100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .ko-dialog.go * { animation-duration: .01s !important; animation-iteration-count: 1 !important; } }
.ar-perfect { margin: 4px 0 8px; font-family: var(--font-title); color: #ffcf2e; text-shadow: 0 0 10px rgba(255, 90, 20, .6); }

/* ===== Arène : prestige (rang + badge), journal des attaques subies, revanche, série ===== */
.ar-ico.xs { height: 1.4em; width: 1.4em; }
.pf-ico img.ar-ico.pf { height: 28px; width: 28px; }
.ar-prestige { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.ar-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-family: var(--font-title); font-size: 12px; line-height: 1.5; letter-spacing: .03em; color: #1a1008; }
.ar-badge.elite { background: linear-gradient(180deg, #d8e6f2, #8fa9c2); }
.ar-badge.champion { background: linear-gradient(180deg, #ffe58a, #e0a22a); }
.ar-revenge { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 999px; background: rgba(200, 60, 40, .25); border: 1px solid var(--bad); color: #ffb39a; font-size: 13px; }
.ar-news { border-color: var(--good); }
.ar-news h3 { display: flex; align-items: center; gap: 8px; }
.ar-streakrew { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--gold); }
.dl-atks { display: grid; gap: 8px; }
.dl-atk { display: grid; grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1.4fr) 110px minmax(0, 130px); align-items: center; column-gap: 12px; padding: 8px 12px; border-radius: 8px; background: rgba(0,0,0,.22); border-left: 4px solid var(--good); }
.dl-atk.lost { border-left-color: var(--bad); }
.dl-atk > .ar-ico { justify-self: center; }
.dl-atk > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.25; }
.dl-atk small { font-size: 13px; }
.dla-gain { align-items: flex-end; text-align: right; }
.dla-gain { flex-direction: column; }
.dla-act { align-items: flex-end; }
@media (max-width: 700px) { .dl-atk { grid-template-columns: 28px minmax(0, 1fr) 90px; row-gap: 6px; } .dla-res { grid-column: 2 / 4; grid-row: 2; } .dla-gain { display: none !important; } .dla-act { grid-column: 3; grid-row: 1; } }
.dla-h { display: inline-flex; align-items: center; gap: 4px; color: var(--good); white-space: nowrap; }

.ar-elo { margin: 8px 0; font-size: 15px; } .ar-elo .up { color: var(--good); } .ar-elo .down { color: var(--bad); }

/* Arène : saison et historique des attaques subies côte à côte */
.ar-row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.ar-hist-card h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ar-hist-card h3 .btn { margin-left: auto; }
.dh-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.dh-vd { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; font: 15px/1 var(--font-title), serif; color: #fff; padding-top: 2px; box-sizing: border-box; }
.dh-vd.won { background: #2f8f4a; } .dh-vd.lost { background: #b8402f; }
.dh-list { display: grid; gap: 8px; max-height: 260px; overflow-y: auto; padding-right: 2px; }
.dh-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 64px 40px 62px minmax(0, 96px); align-items: center; column-gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,.22); border-left: 4px solid var(--good); min-height: 40px; }
.dh-row.lost { border-left-color: var(--bad); }
.dh-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-t, .dh-d, .dh-g { text-align: right; white-space: nowrap; }
.dh-act { display: flex; justify-content: flex-end; }
@media (max-width: 1000px) { .ar-row2 { grid-template-columns: 1fr; } }

/* Classement : pseudo | rang d'arène | niveau en colonnes fixes */
.lb-who { display: grid; grid-template-columns: minmax(0, 1fr) 84px 56px; align-items: center; column-gap: 8px; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-ico { display: flex; justify-content: center; align-items: center; gap: 4px; }
.board-table .lb-who small { margin-left: 0; text-align: left; white-space: nowrap; }

/* Artisan Super : emplacement amélioré (bordure dorée) */
.slot.super { border-color: var(--gold); box-shadow: 0 0 10px rgba(233, 185, 73, .55), inset 0 0 8px rgba(233, 185, 73, .25); }
#buy-super { margin-right: 6px; }
.buy-slots { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Recettes : nom à gauche, « Maîtrisé » + « i » toujours calés à droite (même position pour tous les objets) */
.r-name { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: 8px; row-gap: 2px; } /* trop étroit : « Maîtrisé » passe à la ligne au lieu de recouvrir le nom */
.r-name .rn-l { min-width: 0; }
.r-name .nw { flex: none; display: inline-flex; align-items: center; margin-left: auto; }
.r-name .nw .mastered { margin-left: 0; }

/* Boutons d'achat d'artisans : même largeur, sur une ligne */
.workshop .panel-head { flex-wrap: wrap; }
.buy-slots { flex: 1 1 100%; display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
.buy-slots > span { display: block; min-width: 0; margin: 0 !important; }
.buy-slots .btn { width: 100%; white-space: nowrap; padding-left: 8px; padding-right: 8px; }
.buy-slots { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.buy-slots > span:empty { display: none; }

/* Artisans occupés : normaux = fond bleu, Super = fond violet (bordure dorée) */
.slot.busy:not(.super) { background: linear-gradient(#2f7fd1, #1b4f94); box-shadow: inset 0 0 0 2px #0e2d57, 0 2px 4px rgba(0,0,0,.4); }

/* Objet cassé sur la fiche d'un héros : carte « réparer » + petite croix pour le jeter */
.hc-wrap { position: relative; display: flex; }
.hc-wrap > .hcard { width: 100%; }
.hc-trash { position: absolute; top: -4px; right: -4px; z-index: 3; width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 2px solid #fff3d6; background: #c0392b; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.hc-trash img.ui-ico { height: 9px; width: 9px; }
.hc-trash:hover:not(:disabled) { filter: brightness(1.15); }
.hc-trash:disabled { opacity: .5; cursor: default; }

/* ---------- Chaudron de fusion ---------- */
.fu-cauldron { display: flex; justify-content: center; }
.fu-cauldron img { max-width: 70%; height: auto; max-height: 150px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.fu-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; }
.fu-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px; padding: 8px 6px; border-radius: 14px; border: 3px solid #c98a3c; font: 15px var(--font-title), serif; color: #fff; cursor: pointer; text-shadow: 0 1px 0 #000, 0 0 3px #000; box-sizing: border-box; }
.fu-tile img { height: 38px; width: auto; }
.fu-tile.idle { background: linear-gradient(#35b4f0, #1673c2); box-shadow: inset 0 0 0 2px #0b3a73; }
.fu-tile.idle:hover { filter: brightness(1.1); transform: translateY(-2px); }
.fu-tile.busy { background: linear-gradient(#6b2fa8, #4a1b7c); box-shadow: inset 0 0 0 2px #2d0f4d; cursor: default; }
.fu-tile.busy .bar { position: absolute; left: 8px; right: 8px; bottom: 5px; height: 5px; margin: 0; }
.fu-tile.done { background: linear-gradient(#ffd25a, #e08a12); border-color: #fff1b0; animation: slotDone 1.2s ease-in-out infinite; }
.fu-tile.done .fu-res img.ii { height: 40px; width: auto; }
.fu-tile.buy { background: rgba(0,0,0,.25); border: 2px dashed var(--border); color: var(--muted); }
.fu-tile.buy:disabled { opacity: .55; cursor: default; }
.fu-tile.buy b { font-size: 26px; line-height: 1; }
.fu-tile small { font-size: 13px; }
.fusion-dialog .fu-box { max-width: 760px; }
.fu-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; margin: 8px 0; }
.fu-sels { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.fu-sl { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 76px; border-radius: 12px; border: 2px dashed var(--border); background: rgba(0,0,0,.2); color: var(--muted); font-size: 12px; padding: 4px; box-sizing: border-box; }
.fu-sl b { font-size: 26px; line-height: 1; }
.fu-sl.full { border: 2px solid var(--q, #c98a3c); background: linear-gradient(#fbe9c6, #e6c98d); color: #3b2410; cursor: pointer; }
.fu-ico img.ii { width: 32px; height: 32px; }
.fu-ico { display: inline-flex; filter: drop-shadow(0 0 2px var(--q, transparent)); }
.fu-results { display: flex; flex-direction: column; gap: 6px; }
.fu-rt { font: 15px var(--font-title), serif; color: var(--gold); margin-top: 2px; }
.fu-out { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; background: rgba(0,0,0,.22); }
.fu-out b { font: 17px var(--font-title), serif; color: #8ff08f; text-align: right; }
.fu-out.best b { color: var(--gold); }
.fu-on { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.fu-on small { color: var(--muted); font-size: 12px; }
.fu-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.fu-foot > span { margin-right: auto; }
.fu-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-height: 34vh; overflow-y: auto; padding: 2px; }
.fu-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 4px; border-radius: 10px; border: 2px solid var(--q, #c98a3c); background: linear-gradient(#fbe9c6, #e6c98d); color: #3b2410; cursor: pointer; font-size: 12px; text-align: center; }
.fu-card:hover:not(:disabled) { filter: brightness(1.06); }
.fu-card:disabled { opacity: .5; cursor: default; }
.fu-cn { font-weight: 700; line-height: 1.1; }
.fu-n { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; border-radius: 99px; background: #fff; border: 2px solid #c98a3c; display: flex; align-items: center; justify-content: center; font: 13px var(--font-title), serif; color: #3b2410; }
@media (max-width: 700px) { .fu-main { grid-template-columns: 1fr; } }
/* Colonne du milieu (écran large) : atelier (artisans, réserves, catégories), puis chaudron, stock et râteliers.
   La liste des recettes occupe la 3e colonne. Hors écran large, le conteneur s'efface (display: contents)
   et chaque panneau reprend sa place dans la grille. */
.work-col { display: contents; }
.cauldron { grid-area: cauldron; }
main:not([data-tab="echoppe"]) > .work-col, main:not([data-tab="echoppe"]) > .recipes-panel { display: none; }
@media (min-width: 1250px) {
  main[data-tab="echoppe"] { max-width: 1700px; grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr) minmax(0, 1fr); grid-template-areas: "counter work list" "quests work list"; grid-template-rows: auto 1fr; }
  main[data-tab="echoppe"] > .work-col { grid-area: work; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  main[data-tab="echoppe"] > .work-col > .panel { margin: 0; }
}
main:not([data-tab="echoppe"]) > .cauldron { display: none; }

/* Barre d'onglets étirée sur toute la largeur du contenu (de la bordure du comptoir à celle du chaudron) */
.tabs .tab { flex: 1 1 auto; text-align: center; justify-content: center; }

/* Boutons du comptoir : si le texte est trop long pour la carte, le détail (énergie, %) passe à la ligne au lieu de sortir du bouton */
.cust-actions .btn { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 6px; row-gap: 0; white-space: normal; line-height: 1.2; }
.cust-actions .btn small { white-space: nowrap; }
