/* ============================================================
   Registre de compagnie franche
   Palette : bleu pétrole / laiton / vert-de-gris
   Type    : Grenze (titres), Karla (texte), IBM Plex Mono (chiffres)
   ============================================================ */

:root {
  --bg:        #0b1418;
  --panel:     #101d24;
  --panel-2:   #16272f;
  --raise:     #1d323c;
  --line:      #24404c;
  --line-soft: #1a2f38;

  --ink:       #dfe7e8;
  --ink-dim:   #90a5ad;
  --ink-faint: #5f7580;

  --brass:     #c8973f;
  --brass-dim: #8a6a2e;
  --verdi:     #4aa88c;
  --blood:     #bb4a3e;

  --r0: #8a949b;   /* commun     */
  --r1: #6fa86a;   /* peu commun */
  --r2: #4b8fc7;   /* rare       */
  --r3: #9a6fc4;   /* épique     */
  --r4: #c8973f;   /* légendaire */

  --sp: 4px;
  --radius: 3px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

/* L'attribut hidden doit toujours gagner.
   Sans ça, toute règle .maclasse { display: ... } réaffiche un élément
   masqué en JS — c'est ce qui faisait apparaître la fiche d'objet vide
   par-dessus la page au chargement. */
[hidden] { display: none !important; }

html {
  /* Réserve en permanence la place de la barre de défilement.
     Sans ça, passer d'un onglet court à un onglet long décale
     toute la mise en page de quelques pixels. */
  scrollbar-gutter: stable;
  overflow-y: scroll;   /* repli pour les navigateurs sans scrollbar-gutter */
}

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Karla, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body::before {
  /* Voile atmosphérique très léger, fixe : donne de la profondeur sans coûter un repaint */
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(1100px 500px at 20% -10%, rgba(74,168,140,.07), transparent 70%),
    radial-gradient(900px 420px at 90% 0%, rgba(200,151,63,.06), transparent 70%);
}

h1, h2, h3, h4 { font-family: Grenze, Georgia, serif; font-weight: 600; margin: 0; letter-spacing: .01em; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0;
}

button { font: inherit; color: inherit; cursor: pointer; }
input  { font: inherit; }

/* ---------- Boutons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  padding: 9px 16px;
  border-radius: var(--radius);
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover  { background: var(--raise); border-color: var(--brass-dim); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.btn[disabled] { opacity: .38; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--panel-2); border-color: var(--line); }

.btn-primary { background: var(--brass); border-color: var(--brass); color: #150e02; font-weight: 700; }
.btn-primary:hover { background: #d9a749; border-color: #d9a749; }
.btn-ghost { background: transparent; }
.btn-small { padding: 5px 11px; font-size: 13px; }
.btn-danger { border-color: #52281f; color: #e0917f; }
.btn-danger:hover { background: #2a1512; border-color: var(--blood); }

/* ============================================================
   Connexion
   ============================================================ */
.gate {
  position: relative; z-index: 1;
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
}
.gate-card {
  width: 100%; max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brass);
  border-radius: var(--radius);
  padding: 34px 30px;
}
.gate-title { font-size: 40px; line-height: 1; margin: 10px 0 12px; }
.gate-lede  { color: var(--ink-dim); margin: 0 0 26px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label {
  display: block; font-family: var(--mono);
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 6px;
}
.field input {
  width: 100%; padding: 11px 13px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.field input:focus { outline: none; border-color: var(--brass); }

.gate-error {
  border-left: 2px solid var(--blood);
  background: rgba(187,74,62,.09);
  padding: 9px 12px; font-size: 14px; color: #e6a396; margin-bottom: 16px;
}
.gate-actions { display: flex; gap: 10px; }
.gate-actions .btn { flex: 1; }

/* ============================================================
   Rail d'activité — élément signature
   ============================================================ */
.game { position: relative; z-index: 1; }

.rail {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(180deg, var(--panel) 0%, #0e1a20 100%);
  border-bottom: 1px solid var(--line);
}
.rail-main {
  display: flex; align-items: center; gap: 22px;
  padding: 13px 22px 11px;
  max-width: 1460px; margin: 0 auto;
}
.rail-id { min-width: 200px; }
.rail-eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--verdi);
}
.rail-title { font-size: 21px; line-height: 1.15; }

/**
 * Rail de mission : le joueur voit où il en est, pas une animation vide.
 * Le curseur porte SON emblème et progresse jusqu'au fanion d'arrivée.
 */
.rail-track {
  position: relative; flex: 1; min-width: 90px; height: 22px;
  display: flex; align-items: center;
}
.rail-track::before {
  content: ""; position: absolute; left: 0; right: 0; height: 3px;
  background: var(--line-soft); border-radius: 2px;
}
.rail-fill {
  position: absolute; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--verdi), #7fd0b6);
  border-radius: 2px;
  transition: width 1s linear;
}
.rail-tick {
  position: absolute; width: 1px; height: 8px; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--line); opacity: .8;
}
.rail-goal {
  position: absolute; right: -2px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--ink-faint); line-height: 1;
}
.rail-track.is-live .rail-goal { color: var(--brass); }

.rail-walker {
  position: absolute; left: 0; top: 50%;
  width: 18px; height: 18px; margin-left: -9px;
  transform: translateY(-50%);
  display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--verdi); border-radius: 50%;
  transition: left 1s linear;
  opacity: 0;
}
.rail-track.is-live .rail-walker { opacity: 1; }
.rail-walker img, .rail-walker .av-ph {
  width: 12px; height: 12px; object-fit: contain;
}
.rail-walker .av-ph { font-size: 9px; color: var(--verdi); }

/* Une pulsation discrète : le mercenaire est en route. */
.rail-track.is-live .rail-walker { animation: walkPulse 2.2s ease-in-out infinite; }
@keyframes walkPulse {
  50% { box-shadow: 0 0 0 3px rgba(74,168,140,.16); }
}

.rail-meters { display: flex; align-items: center; gap: 20px; }
.meter { text-align: right; }
.meter-k {
  display: block; font-family: var(--mono); font-size: 9px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint);
}
.meter-v { font-size: 15px; }

.rail-purse {
  display: flex; align-items: center; justify-content: flex-end; gap: 22px;
  padding: 0 22px 11px; max-width: 1460px; margin: 0 auto;
}
.purse-item { display: flex; align-items: baseline; gap: 8px; }
.purse-k {
  font-family: var(--mono); font-size: 9px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
}
.purse-v { font-size: 15px; color: var(--brass); }

.rail-xp { height: 2px; background: var(--line-soft); }
.rail-xp-fill { height: 100%; width: 0; background: var(--verdi); transition: width .4s ease; }

/* ---------- Reçu de progression hors-ligne ---------- */
.receipt {
  max-width: 1460px; margin: 16px auto 0; padding: 0 22px;
}
.receipt-head {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px dashed var(--line); padding-bottom: 6px; margin-bottom: 12px;
}
.receipt-close {
  background: none; border: none; color: var(--ink-faint); font-size: 22px; line-height: 1;
}
.receipt-close:hover { color: var(--ink); }
.receipt-inner {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--verdi);
  padding: 16px 20px;
  animation: slip .35s ease;
}
@keyframes slip { from { opacity: 0; transform: translateY(-6px); } }
.receipt-line {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 4px 0; border-bottom: 1px dotted var(--line-soft); font-size: 14px;
}
.receipt-line:last-child { border-bottom: none; }
.receipt-line b { font-family: var(--mono); font-weight: 500; color: var(--brass); }
.receipt-warn { color: var(--blood); font-size: 13px; margin-top: 10px; }

/* ============================================================
   Structure
   ============================================================ */
.shell {
  max-width: 1460px; margin: 0 auto; padding: 22px;
  display: grid; grid-template-columns: 152px minmax(0, 1fr) 296px; gap: 22px;
  align-items: start;
}

.nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 108px; }
.nav-b {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; border-left: 2px solid transparent;
  padding: 10px 12px; text-align: left; color: var(--ink-dim);
  font-family: Grenze, serif; font-size: 17px;
  transition: color .15s, border-color .15s, background .15s;
}
.nav-b:hover { color: var(--ink); background: var(--panel); }
.nav-b.is-on { color: var(--brass); border-left-color: var(--brass); background: var(--panel); }
.nav-i {
  font-size: 15px; line-height: 1; width: 20px; text-align: center;
  filter: grayscale(.45) opacity(.75);
  transition: filter .15s;
}
.nav-b:hover .nav-i, .nav-b.is-on .nav-i { filter: grayscale(0) opacity(1); }

.tab { display: none; }
.tab.is-on { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }

.side { position: sticky; top: 108px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Cartes ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.card-h {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.card-h h3 { font-size: 18px; }
.card-b { padding: 16px; }

.section-h { margin: 0 0 14px; }
.section-h h2 { font-size: 26px; }
.section-h p { color: var(--ink-dim); font-size: 14px; margin: 3px 0 0; }

/* ============================================================
   Zones de chasse
   ============================================================ */
.zone {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
  transition: border-color .15s;
}
.zone.is-current { border-color: var(--verdi); }
.zone.is-locked  { opacity: .5; }

.zone-h {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px;
  width: 100%; background: none; border: none; text-align: left;
}
.zone-h:hover { background: var(--panel-2); }
.zone-art {
  width: 58px; height: 58px; flex: none; border-radius: 2px;
  background: var(--raise); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden;
}
.zone-art img { width: 100%; height: 100%; object-fit: cover; }
.zone-meta { flex: 1; min-width: 0; }
.zone-meta h3 { font-size: 19px; }
.zone-meta p { margin: 2px 0 0; font-size: 13px; color: var(--ink-dim); }
.zone-req {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  color: var(--ink-faint); white-space: nowrap;
}
.zone-body { padding: 0 16px 16px; border-top: 1px solid var(--line-soft); }
.zone.is-open .zone-body { display: block; }
.zone-body { display: none; }

.mob-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px dotted var(--line-soft);
}
.mob-row:last-of-type { border-bottom: none; }
.mob-art {
  width: 40px; height: 40px; flex: none; border-radius: 2px;
  background: var(--raise); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden;
}
.mob-art img { width: 100%; height: 100%; object-fit: cover; }
.mob-name { flex: 1; font-size: 14px; }
.mob-name span { display: block; font-size: 11px; color: var(--ink-faint); font-family: var(--mono); }
.mob-stat { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); text-align: right; }

.modes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mode {
  flex: 1 1 130px; text-align: left; padding: 9px 12px;
  border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--radius);
}
.mode:hover { border-color: var(--brass-dim); background: var(--raise); }
.mode b { display: block; font-family: Grenze, serif; font-size: 15px; font-weight: 600; }
.mode small { color: var(--ink-faint); font-size: 11px; line-height: 1.35; display: block; margin-top: 2px; }
.mode.is-risky { border-color: #4a2620; }
.mode.is-risky b { color: #e0917f; }

/* ---------- Placeholder d'image absente ---------- */
.ph {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; color: var(--ink-faint);
  background: repeating-linear-gradient(45deg, var(--raise) 0 6px, var(--panel-2) 6px 12px);
}

/* ============================================================
   Inventaire
   ============================================================ */
.grid-items {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px;
}
.slotbox {
  position: relative; aspect-ratio: 1; border-radius: 2px;
  border: 1px solid var(--line); background: var(--panel-2);
  display: grid; place-items: center; padding: 0; overflow: hidden;
  transition: border-color .12s, transform .06s;
}
.slotbox:hover { border-color: var(--brass-dim); transform: translateY(-1px); }
.slotbox img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.slotbox .qty {
  position: absolute; right: 3px; bottom: 2px;
  font-family: var(--mono); font-size: 10px; color: var(--ink);
  background: rgba(0,0,0,.72); padding: 0 3px; border-radius: 2px;
}
.slotbox .enh {
  position: absolute; left: 3px; top: 2px;
  font-family: var(--mono); font-size: 10px; color: var(--brass); font-weight: 600;
}
/* ------------------------------------------------------------
   Raretés : l'intensité doit monter par paliers nets. Un objet
   légendaire doit se repérer dans une grille pleine sans lire
   son nom — d'où l'aura pulsante réservée au dernier palier.
   ------------------------------------------------------------ */
.slotbox { position: relative; }

/* Peu commun : liseré franc, fond légèrement teinté */
.slotbox.r1 {
  border-color: var(--r1);
  background: linear-gradient(160deg, rgba(111,168,106,.16), var(--panel-2) 65%);
}

/* Rare : dégradé de bordure + halo intérieur */
.slotbox.r2 {
  border-color: transparent;
  background:
    linear-gradient(160deg, rgba(75,143,199,.20), var(--panel-2) 65%) padding-box,
    linear-gradient(140deg, #7fc4f2, #2f6f9e 55%, #7fc4f2) border-box;
  box-shadow: inset 0 0 12px rgba(75,143,199,.28);
}

/* Épique : dégradé plus contrasté, halo intérieur et extérieur */
.slotbox.r3 {
  border-color: transparent;
  background:
    linear-gradient(160deg, rgba(154,111,196,.24), var(--panel-2) 62%) padding-box,
    linear-gradient(140deg, #cfa6ff, #6b3fa0 50%, #cfa6ff) border-box;
  box-shadow: inset 0 0 14px rgba(154,111,196,.34), 0 0 9px rgba(154,111,196,.30);
}

/* Légendaire : bordure animée, aura pulsante et coins marqués */
.slotbox.r4 {
  border-color: transparent;
  background:
    linear-gradient(160deg, rgba(200,151,63,.28), var(--panel-2) 58%) padding-box,
    conic-gradient(from var(--lg, 0deg),
      #8a6a2e, #ffdf9b 20%, #c8973f 40%, #fff3cf 55%, #c8973f 72%, #8a6a2e) border-box;
  box-shadow: inset 0 0 16px rgba(255,215,140,.30);
  animation: legendSpin 6s linear infinite, legendGlow 2.4s ease-in-out infinite;
}
.slotbox.r4::before {
  content: ""; position: absolute; inset: -1px; border-radius: 2px;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255,232,180,.85) 0 6px, transparent 6px) top left / 10px 10px no-repeat,
    linear-gradient(225deg, rgba(255,232,180,.85) 0 6px, transparent 6px) top right / 10px 10px no-repeat,
    linear-gradient(45deg,  rgba(255,232,180,.85) 0 6px, transparent 6px) bottom left / 10px 10px no-repeat,
    linear-gradient(315deg, rgba(255,232,180,.85) 0 6px, transparent 6px) bottom right / 10px 10px no-repeat;
  opacity: .8;
}
@property --lg { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes legendSpin { to { --lg: 360deg; } }
@keyframes legendGlow {
  50% { box-shadow: inset 0 0 16px rgba(255,215,140,.34), 0 0 16px rgba(200,151,63,.55); }
}

/* Repli sans @property : l'or reste, l'animation tombe */
@supports not (background: conic-gradient(from var(--x, 0deg), red, blue)) {
  .slotbox.r4 { border: 2px solid var(--r4); animation: legendGlow 2.4s ease-in-out infinite; }
}
.slotbox.is-equipped::after {
  content: ""; position: absolute; inset: 0;
  border: 2px solid var(--verdi); border-radius: 2px; pointer-events: none;
}
.slotbox.is-empty { border-style: dashed; border-color: var(--line-soft); }
.slotbox.is-empty .lbl {
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* ---------- Équipement porté ---------- */
.gear { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }

/* ============================================================
   Fiche d'objet
   ============================================================ */
.sheet {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4,10,13,.76);
  display: grid; place-items: center; padding: 20px;
  animation: fade .15s ease;
}
.sheet-card {
  width: 100%; max-width: 380px;
  background: var(--panel); border: 1px solid var(--line);
  border-top: 3px solid var(--brass); border-radius: var(--radius);
  padding: 20px; max-height: 86dvh; overflow-y: auto;
}
.sheet-top { display: flex; gap: 14px; margin-bottom: 14px; }
.sheet-art {
  width: 74px; height: 74px; flex: none; border: 1px solid var(--line);
  background: var(--panel-2); border-radius: 2px; overflow: hidden;
}
.sheet-art img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.sheet-name { font-size: 21px; line-height: 1.15; }
.sheet-sub { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }

.stat-line {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0; font-size: 14px; border-bottom: 1px dotted var(--line-soft);
}
.stat-line span:last-child { font-family: var(--mono); color: var(--ink); }
.stat-line.affix span:last-child { color: var(--verdi); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.sheet-actions .btn { flex: 1 1 100px; }

.risk {
  margin-top: 14px; padding: 11px 13px; border-radius: var(--radius);
  background: var(--panel-2); border: 1px solid var(--line); font-size: 13px;
}
.risk-bar { height: 5px; background: var(--line-soft); border-radius: 3px; margin: 8px 0; overflow: hidden; }
.risk-bar i { display: block; height: 100%; background: var(--verdi); }
.risk.is-danger { border-color: #4a2620; }
.risk.is-danger .risk-bar i { background: var(--blood); }
.risk-cost { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; padding: 2px 0; }
.risk-cost.lack { color: var(--blood); }

/* ============================================================
   Personnage / métiers / atelier
   ============================================================ */
.stat-rows { display: flex; flex-direction: column; gap: 2px; }
.stat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px dotted var(--line-soft);
}
.stat-row .k { flex: 1; font-size: 14px; }
.stat-row .v { font-family: var(--mono); font-size: 15px; min-width: 62px; text-align: right; }
.stat-row .v em { font-style: normal; color: var(--verdi); font-size: 12px; }

.bar { height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--brass); }
.bar.verdi i { background: var(--verdi); }

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px dotted var(--line-soft);
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row h4 { font-size: 16px; }
.list-row p { margin: 2px 0 0; font-size: 12px; color: var(--ink-dim); font-family: var(--mono); }

.pill {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 2px 7px; border: 1px solid var(--line); border-radius: 2px; color: var(--ink-faint);
}
.pill.on { border-color: var(--verdi); color: var(--verdi); }

.empty {
  text-align: center; padding: 34px 18px; color: var(--ink-faint);
  border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px;
}

/* ============================================================
   Notifications
   ============================================================ */
.toasts {
  position: fixed; right: 18px; z-index: 90;
  /* Au-dessus du bouton rond du tchat (42 px + marges), sinon les bulles
     le recouvrent et le rendent incliquable. */
  bottom: calc(18px + 46px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast { pointer-events: auto; }
body.has-chat .toasts { right: 18px; }
.toast {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--verdi);
  padding: 10px 15px; border-radius: var(--radius); font-size: 14px; max-width: 330px;
  animation: rise .25s ease;
}
.toast.bad  { border-left-color: var(--blood); }
.toast.gain { border-left-color: var(--brass); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ============================================================
   Adaptatif
   ============================================================ */
@media (max-width: 1080px) {
  .shell { grid-template-columns: 1fr; }
  .nav {
    flex-direction: row; position: static;
    border-bottom: 1px solid var(--line); padding-bottom: 2px;

    /* min-width: 0 est INDISPENSABLE : un enfant de grille a
       min-width: auto par défaut, donc la barre s'élargit au lieu de
       défiler, et les derniers onglets deviennent inatteignables. */
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
  }
  /* Barre de défilement discrète sous les onglets */
  .nav::-webkit-scrollbar { height: 3px; }
  .nav::-webkit-scrollbar-thumb { border: none; background: var(--line); }

  .nav-b {
    border-left: none; border-bottom: 2px solid transparent;
    white-space: nowrap; flex-direction: column; gap: 2px; align-items: center;
    padding: 8px 14px;
    flex: 0 0 auto;            /* ne jamais compresser : on préfère défiler */
    scroll-snap-align: center;
  }
  .nav-b.is-on { border-bottom-color: var(--brass); }
  .side { position: static; order: 3; }
}

@media (max-width: 620px) {
  .rail-main { flex-wrap: wrap; gap: 12px; padding: 11px 16px 9px; }
  .rail-id { min-width: 0; flex: 1 1 100%; }
  .rail-track { order: 3; flex: 1 1 100%; }
  .rail-meters { width: 100%; justify-content: space-between; }
  .rail-purse { padding: 0 16px 10px; gap: 14px; }
  .shell, .receipt { padding: 16px; }
  .gate-title { font-size: 32px; }
  .gear { grid-template-columns: repeat(4, 1fr); }
  .toasts { left: 14px; right: 14px; align-items: stretch; }
  .toast { max-width: none; }
  body.has-chat .toasts { right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ============================================================
   Bandeau d'activité en cours
   ============================================================ */
.now {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--verdi); border-radius: var(--radius);
  font-size: 14px;
}
.now-idle { border-left-color: var(--line); color: var(--ink-dim); }
.now b { font-weight: 500; }
.now .btn { margin-left: auto; }
.now-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--ink-faint);
}
.now-dot.is-live { background: var(--verdi); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ============================================================
   Atelier compact
   ============================================================ */
.bench-list { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; }
.bench {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 11px; border-radius: 2px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  font-size: 13px;
}
.bench-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bench-t { color: var(--ink-dim); font-size: 12px; }
.bench.is-ready { border-color: var(--verdi); }
.bench.is-ready .bench-t { color: var(--verdi); }
.bench.is-free {
  border-style: dashed; background: none; color: var(--ink-faint);
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
}

.rcp-group { margin-bottom: 14px; }
.rcp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px 7px; border-bottom: 1px solid var(--line-soft); margin-bottom: 9px;
}
.rcp-head h4 { font-family: Grenze, serif; font-size: 17px; }

.rcp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 6px; }
.rcp {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 8px 10px; border: 1px solid var(--line); background: var(--panel);
  border-radius: var(--radius); transition: border-color .12s, background .12s;
}
.rcp:hover:not([disabled]) { border-color: var(--brass-dim); background: var(--panel-2); }
.rcp[disabled] { opacity: 1; cursor: not-allowed; }
.rcp.is-locked { opacity: .42; }
.rcp.is-short  { border-style: dashed; }

.rcp-art {
  width: 34px; height: 34px; flex: none; border-radius: 2px; overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--line-soft);
}
.rcp-art img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.rcp-body { flex: 1; min-width: 0; }
.rcp-n {
  display: block; font-size: 13px; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rcp-ing { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.ing { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }
.ing b { color: var(--ink-dim); font-weight: 500; margin-left: 3px; }
.ing.lack, .ing.lack b { color: var(--blood); }
.rcp-meta { font-size: 11px; color: var(--ink-faint); flex: none; }

/* ============================================================
   Bouton icône
   ============================================================ */
.icon-btn {
  display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  background: transparent; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--brass-dim); background: var(--panel-2); }
.icon-btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

@media (max-width: 620px) {
  .rcp-grid { grid-template-columns: 1fr; }
  .now { flex-wrap: wrap; }
}

/* ============================================================
   Personnage — deux colonnes denses
   ============================================================ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }

.cstat {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; border-bottom: 1px dotted var(--line-soft);
}
.cstat:last-child { border-bottom: none; }
.cstat-k { flex: 1; font-size: 14px; }
.cstat-v { font-size: 15px; min-width: 54px; text-align: right; }
.cstat-v em { font-style: normal; color: var(--verdi); font-size: 12px; margin-left: 3px; }
.cstat-plus { position: relative; display: flex; }
.cstat-plus .btn { width: 28px; padding: 3px 0; text-align: center; }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.kv {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 4px 0; font-size: 13px; border-bottom: 1px dotted var(--line-soft);
}
.kv b { font-weight: 500; color: var(--ink); }

/* ---------- Infobulle d'attribution ---------- */
.tip {
  position: absolute; right: 0; bottom: calc(100% + 7px); z-index: 20;
  display: none; flex-direction: column; gap: 2px;
  min-width: 152px; padding: 9px 11px;
  background: var(--raise); border: 1px solid var(--brass-dim);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(0,0,0,.5);
  pointer-events: none;
}
.cstat-plus:hover .tip,
.cstat-plus:focus-within .tip { display: flex; }
.tip::after {
  content: ""; position: absolute; right: 11px; top: 100%;
  border: 5px solid transparent; border-top-color: var(--brass-dim);
}
.tip-h {
  font-family: var(--mono); font-size: 9px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--brass);
  padding-bottom: 4px; margin-bottom: 3px; border-bottom: 1px solid var(--line);
}
.tip-r { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; }
.tip-r b { font-family: var(--mono); font-weight: 500; }
.tip-r b.up   { color: var(--verdi); }
.tip-r b.down { color: var(--blood); }

/* ============================================================
   Métiers — le niveau est l'information principale
   ============================================================ */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 8px; }
.skill {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.skill-lvl {
  font-family: Grenze, serif; font-size: 30px; line-height: 1;
  color: var(--brass); min-width: 38px; text-align: center; flex: none;
}
.skill-body { flex: 1; min-width: 0; }
.skill-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.skill-top h4 { font-family: Grenze, serif; font-size: 16px; }
.skill-kind {
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint);
}
.skill-xp { font-size: 10.5px; color: var(--ink-faint); margin-top: 3px; }

.node-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 6px; }
.node {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 8px 10px; border: 1px solid var(--line);
  background: var(--panel-2); border-radius: var(--radius);
  transition: border-color .12s, background .12s;
}
.node:hover:not([disabled]) { border-color: var(--brass-dim); background: var(--raise); }
.node[disabled] { cursor: not-allowed; }
.node.is-locked { opacity: .42; }
.node.is-on { border-color: var(--verdi); }
.node-art {
  width: 30px; height: 30px; flex: none; border-radius: 2px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line-soft);
}
.node-art img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.node-body { flex: 1; min-width: 0; }
.node-n { display: block; font-size: 13px; }
.node-m { display: block; font-size: 10.5px; color: var(--ink-faint); }
.node-cta {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-dim); flex: none; text-align: right;
}
.node.is-on .node-cta { color: var(--verdi); }

@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr 1fr; }
  .tip { right: auto; left: 50%; transform: translateX(-50%); }
  .tip::after { right: auto; left: 50%; margin-left: -5px; }
}

/* ============================================================
   Panneau d'administration — dense, deux colonnes
   ============================================================ */
.adm { position: relative; z-index: 1; }

.adm-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.adm-bar .eyebrow { color: var(--brass); white-space: nowrap; }
.adm-bar input[type="search"] {
  flex: 1; max-width: 420px; padding: 7px 11px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.adm-bar input:focus { outline: none; border-color: var(--brass); }
.adm-me { margin-left: auto; font-size: 12px; color: var(--ink-faint); }

.adm-main {
  display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 16px;
  max-width: 1240px; margin: 0 auto; padding: 16px 18px;
  align-items: start;
}

.adm-list {
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 64px; max-height: calc(100dvh - 84px); overflow-y: auto;
}
.prow {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 7px 10px; text-align: left;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-left: 2px solid transparent; border-radius: var(--radius);
}
.prow:hover { background: var(--panel-2); }
.prow.is-on { border-left-color: var(--brass); background: var(--panel-2); }
.prow-n { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.prow-m { font-size: 11px; color: var(--ink-faint); }

.tag {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase;
  padding: 1px 5px; border-radius: 2px; border: 1px solid var(--line); color: var(--ink-faint);
}
.tag.bad { border-color: #52281f; color: #e0917f; }
.tag.ok  { border-color: #24503f; color: var(--verdi); }
.tag.adm { border-color: var(--brass-dim); color: var(--brass); }

.adm-detail {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.adm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.adm-head h2 { font-size: 24px; }
.adm-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-dim); }
.adm-head p.dim { color: var(--ink-faint); }
.adm-badges { display: flex; gap: 5px; flex: none; }

.adm-note {
  margin-top: 10px; padding: 7px 11px; font-size: 13px;
  border-left: 2px solid var(--blood); background: rgba(187,74,62,.09);
}

.adm-block { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.adm-block h3 {
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 9px;
}
.adm-block.danger h3 { color: var(--blood); }

.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 7px; }
.fset { display: flex; flex-direction: column; gap: 3px; }
.fset span {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
}
.fset input {
  width: 100%; padding: 6px 9px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--mono); font-size: 14px;
}
.fset input:focus { outline: none; border-color: var(--brass); }

.hint { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-faint); }
.arow { display: flex; flex-wrap: wrap; gap: 7px; }

.log { display: flex; flex-direction: column; gap: 1px; max-height: 300px; overflow-y: auto; }
.log-r {
  display: grid; grid-template-columns: 92px 150px minmax(0, 1fr); gap: 10px;
  padding: 4px 0; font-size: 11.5px; border-bottom: 1px dotted var(--line-soft);
}
.log-a { color: var(--brass); }
.log-d { color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dim { color: var(--ink-faint); }

@media (max-width: 860px) {
  .adm-main { grid-template-columns: 1fr; }
  .adm-list { position: static; max-height: 240px; }
  .log-r { grid-template-columns: 1fr; gap: 0; }
}

/* ============================================================
   Tchat — colonne pleine hauteur, sous le rail
   ============================================================ */
:root { --chat-w: 288px; }

/* Le tchat monte jusqu'en haut de la page. Caler son sommet sur une
   hauteur de rail supposée était fragile : cette hauteur varie avec le
   texte, la taille d'écran et le retour à la ligne du rail. */
.chat {
  position: fixed; right: 0; top: 0; bottom: 0; width: var(--chat-w);
  z-index: 35;                       /* au-dessus du rail (30) */
  display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--line);

  /* Glissement : le panneau existe toujours, il est simplement poussé
     hors du cadre. visibility évite qu'il reste focusable une fois sorti. */
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .26s cubic-bezier(.22, .61, .36, 1), visibility 0s .26s;
}
.chat.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .26s cubic-bezier(.22, .61, .36, 1), visibility 0s 0s;
}

/* Le contenu se décale en même temps que le panneau glisse. */
.shell, .receipt, .rail-main, .rail-purse { transition: padding-right .26s cubic-bezier(.22,.61,.36,1); }
.chat-h {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px 10px 14px;
  border-bottom: 1px solid var(--line-soft); flex: none;
  /* Respecte l'encoche des téléphones */
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.chat-count { font-size: 10px; color: var(--ink-faint); margin-left: auto; }
.chat-x {
  display: grid; place-items: center; width: 26px; height: 26px; padding: 0;
  background: transparent; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: var(--radius); flex: none;
}
.chat-x:hover { color: var(--ink); border-color: var(--brass-dim); background: var(--panel-2); }
.chat-x:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.chat-log {
  flex: 1; overflow-y: auto; padding: 10px 13px;
  display: flex; flex-direction: column; gap: 7px;
}
.msg { font-size: 13px; line-height: 1.35; }
.msg-n {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  color: var(--brass); display: block;
}
.msg.is-mine .msg-n { color: var(--verdi); }
.msg-b { color: var(--ink); overflow-wrap: anywhere; }

.chat-form {
  display: flex; gap: 6px; padding: 9px 11px;
  border-top: 1px solid var(--line-soft); flex: none;
  /* Respecte la barre système sur mobile */
  padding-bottom: calc(9px + env(safe-area-inset-bottom, 0px));
}
.chat-form input {
  flex: 1; min-width: 0; padding: 7px 10px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px;
}
.chat-form input:focus { outline: none; border-color: var(--brass); }

/* Bouton bascule, ancré en bas à droite */
.chat-toggle {
  position: fixed; right: 14px; bottom: 14px; z-index: 40;
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--panel-2); color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
  transition: color .15s, border-color .15s, background .15s;
}
.chat-toggle:hover { color: var(--ink); border-color: var(--brass-dim); background: var(--raise); }
.chat-toggle[hidden] { display: grid !important; opacity: 0; pointer-events: none; transform: scale(.8); }
.chat-toggle { transition: opacity .2s, transform .2s, color .15s, border-color .15s, background .15s; }
.chat-toggle:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.chat-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brass); border: 1px solid var(--panel-2);
}

/**
 * Chatbox ouverte : on réduit la LARGEUR DISPONIBLE du corps de page,
 * au lieu d'ajouter un remplissage interne. Le remplissage laissait un
 * vide entre le contenu centré et la chatbox ; ici, le contenu se
 * recentre sur l'espace restant et occupe toute la place.
 */
body.has-chat { padding-right: var(--chat-w); }
body.has-chat .chat-toggle { right: calc(var(--chat-w) + 14px); }


/* ---------- Aperçu d'équipement ---------- */
.eq-wrap { position: relative; flex: 1 1 100px; display: flex; }
.eq-wrap .btn { width: 100%; }
.eq-tip {
  right: 0; bottom: calc(100% + 8px);
  min-width: 178px; max-width: 240px;
}
.eq-wrap:hover .eq-tip, .eq-wrap:focus-within .eq-tip { display: flex; }

.now-left { font-size: 12px; color: var(--ink-dim); margin-left: auto; }
.now .btn { margin-left: 8px; }

/* Sous cette largeur, la chatbox recouvre au lieu de pousser :
   réduire encore un écran étroit rendrait le jeu illisible. */
@media (max-width: 1180px) {
  body.has-chat { padding-right: 0; }
  body.has-chat .chat-toggle { right: 14px; }
  .chat { box-shadow: -10px 0 30px rgba(0,0,0,.5); }
}

@media (max-width: 620px) {
  :root { --chat-w: 100vw; }
  .chat { border-left: none; }
}

/* ============================================================
   Barres de progression dans les blocs d'action
   ============================================================ */
.prog {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px; background: var(--line-soft);
  border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
  overflow: hidden;
}
.prog > i {
  display: block; height: 100%; width: 0;
  background: var(--verdi);
  transition: width 1s linear;   /* avance en continu, sans à-coups */
}
.node, .mode, .bench { position: relative; }
.node.is-on, .mode.is-on { border-color: var(--verdi); }
.mode.is-on b { color: var(--verdi); }
.bench .prog { height: 2px; }

/* ============================================================
   Infobulle de caractéristique
   ============================================================ */
.cstat { position: relative; }
.cstat .tip {
  right: auto; left: 0; bottom: calc(100% + 6px);
  min-width: 214px; max-width: 268px;
}
.cstat:hover > .tip, .cstat:focus-within > .tip { display: flex; }
.cstat .tip::after { right: auto; left: 22px; }

.tip-blurb {
  font-size: 11.5px; line-height: 1.4; color: var(--ink-dim);
  padding-bottom: 6px; margin-bottom: 2px;
}
.tip-sep {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
  margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line);
}
.tip-sep:first-of-type { border-top: none; padding-top: 0; margin-top: 2px; }

/* ============================================================
   Classement
   ============================================================ */
.rk-tabs {
  display: flex; gap: 2px; margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.rk-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 7px 14px; color: var(--ink-dim);
  font-family: Grenze, serif; font-size: 16px;
  transition: color .15s, border-color .15s;
}
.rk-tab:hover { color: var(--ink); }
.rk-tab.is-on { color: var(--brass); border-bottom-color: var(--brass); }

.rk-filter { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.rk-chip {
  padding: 4px 11px; font-size: 12px;
  background: var(--panel-2); color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 999px;
  transition: color .15s, border-color .15s, background .15s;
}
.rk-chip:hover { color: var(--ink); border-color: var(--brass-dim); }
.rk-chip.is-on { color: #150e02; background: var(--brass); border-color: var(--brass); font-weight: 700; }

.rk-row {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 6px; border-bottom: 1px dotted var(--line-soft);
}
.rk-row:last-child { border-bottom: none; }
.rk-n {
  width: 34px; flex: none; text-align: right;
  font-size: 13px; color: var(--ink-faint);
}
.rk-name {
  flex: 1; min-width: 0; font-size: 14px;
  display: flex; align-items: center; gap: 10px;
  /* Pas d'overflow:hidden ici : il rognait l'anneau d'encadrement, qui
     déborde volontairement de l'avatar. On tronque le TEXTE seulement. */
}
.rk-name .lnk-profile {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rk-row { overflow: visible; }
.rk-v {
  flex: none; text-align: right; font-size: 14px; color: var(--ink);
}
.rk-v em {
  display: block; font-style: normal; font-size: 10.5px; color: var(--ink-faint);
}

/* Les trois premiers se distinguent par la couleur du rang, pas par un fond :
   un fond plein sur trois lignes écrase la lecture du reste du tableau. */
.rk-m1 .rk-n { color: var(--brass); font-size: 15px; font-weight: 600; }
.rk-m2 .rk-n { color: #b8c2c7; font-size: 14px; font-weight: 600; }
.rk-m3 .rk-n { color: #b07d4e; font-size: 14px; font-weight: 600; }

.rk-row.is-me {
  background: var(--panel-2);
  border-left: 2px solid var(--verdi); padding-left: 8px;
  border-radius: 2px;
}
.rk-row.is-outside {
  margin-top: 8px; border-top: 1px dashed var(--line); border-bottom: none;
}
.rk-you {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--verdi);
  border: 1px solid var(--verdi); border-radius: 2px; padding: 0 4px; flex: none;
}

@media (max-width: 620px) {
  .rk-tab { flex: 1; padding: 7px 4px; font-size: 14px; }
  .rk-n { width: 26px; }
}

/* ============================================================
   Succès
   ============================================================ */
.ach-group { margin-bottom: 16px; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 6px; }
.ach {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 11px;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.ach.is-done { border-color: var(--brass-dim); background: var(--panel-2); }
.ach-mark {
  width: 16px; flex: none; text-align: center; color: var(--brass);
  font-size: 14px; line-height: 1.3;
}
.ach-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ach-n { font-family: Grenze, serif; font-size: 15px; color: var(--ink-dim); }
.ach.is-done .ach-n { color: var(--brass); }
.ach-d { font-size: 11.5px; color: var(--ink-faint); line-height: 1.35; }
.ach-at { font-size: 10px; color: var(--ink-faint); }
.ach-pts {
  flex: none; font-size: 12px; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 2px; padding: 1px 6px;
}
.ach.is-done .ach-pts { color: var(--brass); border-color: var(--brass-dim); }

/* Message de contenu encore masqué */
.veil {
  margin: 10px 2px 0; font-size: 11.5px; color: var(--ink-faint);
  font-style: italic; text-align: center;
}

/* ============================================================
   Infobulles : rester dans l'écran sur petits écrans
   ============================================================ */
@media (max-width: 620px) {
  /* En dessous de cette largeur, une bulle ancrée sur un bouton déborde
     forcément. On la sort du flux et on la cale sur la fenêtre entière. */
  .cstat .tip, .eq-tip {
    position: fixed;
    left: 12px; right: 12px; bottom: auto; top: auto;
    width: auto; min-width: 0; max-width: none;
    transform: none;
  }
  .cstat .tip::after, .eq-tip::after { display: none; }

  .cstat:hover > .tip, .cstat:focus-within > .tip,
  .eq-wrap:hover .eq-tip, .eq-wrap:focus-within .eq-tip {
    display: flex;
    /* Ancrée bas d'écran, au-dessus du bouton de tchat */
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .ach-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Avatars et encadrements
   ============================================================ */
.av {
  position: relative; flex: none; display: inline-grid; place-items: center;
  border-radius: 50%;
}
.av-in {
  display: grid; place-items: center;
  width: 100%; height: 100%; border-radius: 50%;
  font-family: Grenze, serif; font-weight: 600; color: #e6eef0;
  letter-spacing: .02em; user-select: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10);
}
.av-sm { width: 28px; height: 28px; }  .av-sm .av-in { font-size: 12px; }
.av-md { width: 38px; height: 38px; }  .av-md .av-in { font-size: 15px; }
.av-lg { width: 76px; height: 76px; }  .av-lg .av-in { font-size: 29px; }

/* L'anneau est un pseudo-élément : il déborde de l'avatar sans changer
   sa taille, donc sans décaler les mises en page qui l'entourent. */
.av::after {
  content: ""; position: absolute; inset: -3px;
  border-radius: 50%; pointer-events: none;
}
.av-lg::after { inset: -5px; }

/* — Aucun : un simple liseré, pour que l'avatar ne flotte pas — */
.fr-none::after { border: 1px solid var(--line); }

/* — Laiton martelé : double anneau, éclat en haut à gauche — */
.fr-brass::after {
  border: 2px solid var(--brass);
  box-shadow: 0 0 0 1px rgba(0,0,0,.55),
              inset 0 0 4px rgba(255,215,140,.30),
              -1px -1px 5px rgba(200,151,63,.35);
}

/**
 * Anneaux en dégradé.
 *
 * La méthode courante (deux fonds, l'un en padding-box, l'autre en
 * border-box) peint un aplat opaque au centre et masquait donc l'icône
 * et la couleur de l'avatar. On découpe l'intérieur au masque : seul
 * l'anneau reste peint, le centre est réellement transparent.
 */
.fr-verdi::after,
.fr-obsidian::after,
.fr-ember::after {
  border: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
}

/* — Vert-de-gris : bronze piqué — */
.fr-verdi::after {
  padding: 2px;
  background: conic-gradient(from 210deg, #4aa88c, #2f6d5c 25%, #7fc2ac 45%,
                             #2a5f50 65%, #4aa88c 100%);
  filter: drop-shadow(0 0 4px rgba(74,168,140,.35));
}

/* — Obsidienne : noir profond, un seul reflet oblique — */
.fr-obsidian::after {
  padding: 3px;
  background: linear-gradient(135deg, #05080a 0%, #2b3a44 42%, #dfe7e8 50%,
                              #2b3a44 58%, #05080a 100%);
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.7));
}

/* — Braise : anneau chaud qui tourne lentement — */
.fr-ember::after {
  padding: 3px;
  background: conic-gradient(from var(--emb, 0deg),
    #7a2410, #d4571c 18%, #ffc043 32%, #d4571c 48%,
    #7a2410 62%, #d4571c 80%, #ffc043 92%, #7a2410 100%);
  filter: drop-shadow(0 0 6px rgba(212,87,28,.5));
  animation: emberSpin 5.5s linear infinite;
}
@property --emb { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes emberSpin { to { --emb: 360deg; } }

@supports not (background: conic-gradient(from var(--x, 0deg), red, blue)) {
  .fr-ember::after { animation: none; }
}

/* ============================================================
   Identité dans le rail
   ============================================================ */
.hud-me {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; padding: 0 4px 0 0; margin-right: auto;
  color: var(--ink);
}
.hud-me:hover .hud-name { color: var(--brass); }
.hud-name { font-family: Grenze, serif; font-size: 16px; transition: color .15s; }

/* Pseudo cliquable, partout */
.lnk-profile {
  background: none; border: none; padding: 0; text-align: left;
  color: inherit; font: inherit; cursor: pointer;
  border-bottom: 1px solid transparent;
}
.lnk-profile:hover { color: var(--brass); border-bottom-color: var(--brass-dim); }

/* ============================================================
   Tchat avec avatars
   ============================================================ */
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg-c { flex: 1; min-width: 0; }

/* ============================================================
   Boutique
   ============================================================ */
.sh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 10px; }
.sh {
  display: flex; gap: 14px; padding: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.sh.is-owned { border-color: var(--line); }
.sh.is-worn  { border-color: var(--brass-dim); background: var(--panel-2); }
.sh-prev { flex: none; display: grid; place-items: center; padding: 4px 6px; }
.sh-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sh-body h4 { font-family: Grenze, serif; font-size: 17px; }
.sh-body p { margin: 3px 0 0; font-size: 12px; color: var(--ink-faint); line-height: 1.4; }
.sh-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: auto; padding-top: 10px;
}
.sh-price { font-size: 13px; color: var(--brass); }
.sh-price.lack { color: var(--blood); }

/* ============================================================
   Profil
   ============================================================ */
.pf-head { display: flex; align-items: center; gap: 18px; }
.pf-head h2 { font-size: 27px; }
.pf-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-dim); }
.pf-head p.dim { color: var(--ink-faint); }

.pf-frames { display: flex; flex-wrap: wrap; gap: 10px; }
.pf-fr {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 9px 12px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 11px; color: var(--ink-dim); min-width: 92px;
}
.pf-fr:hover { border-color: var(--brass-dim); color: var(--ink); }
.pf-fr.is-on { border-color: var(--brass); color: var(--brass); background: var(--raise); }

@media (max-width: 620px) {
  .sh-grid { grid-template-columns: 1fr; }
  .hud-name { display: none; }
  .pf-head { gap: 12px; }
}

/* ============================================================
   Emblèmes et sélecteur d'apparence
   ============================================================ */
.av-sym {
  /* 72 % : les emblèmes larges (enclume, ailes) touchent le bord au-delà,
     ce qui écrase visuellement l'encadrement. */
  width: 72%; height: 72%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.55));
}


/* Repli quand le PNG de l'emblème n'est pas encore fourni */
.av-ph {
  display: grid; place-items: center; width: 72%; height: 72%;
  font-family: Grenze, serif; font-size: 1em; color: rgba(233,240,242,.9);
}
.av-sm .av-ph { font-size: 13px; }
.av-md .av-ph { font-size: 17px; }
.av-lg .av-ph { font-size: 32px; }

.lk-h {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
  margin: 14px 0 8px;
}
.lk-h:first-child { margin-top: 0; }

.lk-row { display: flex; flex-wrap: wrap; gap: 7px; }
.lk-o {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 6px; min-width: 74px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 10px; color: var(--ink-faint);
  transition: border-color .12s, color .12s, background .12s;
}
.lk-o:hover { border-color: var(--brass-dim); color: var(--ink); }
.lk-o.is-on { border-color: var(--brass); color: var(--brass); background: var(--raise); }

@media (max-width: 620px) {
  .lk-o { min-width: 62px; padding: 7px 4px; }
}

/* ============================================================
   Sélecteur d'apparence
   ============================================================ */
.lk-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.lk-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 10px 13px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.lk-btn:hover { border-color: var(--brass-dim); background: var(--raise); }
.lk-btn-k {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
}
.lk-btn-v { font-family: Grenze, serif; font-size: 16px; color: var(--ink); }

.pk-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-bottom: 10px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.pk-h h3 { font-size: 20px; }

.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 7px; }
.pk-o {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 5px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 10.5px; color: var(--ink-faint);
  transition: border-color .12s, color .12s, background .12s;
}
.pk-o:hover { border-color: var(--brass-dim); color: var(--ink); }
.pk-o.is-on { border-color: var(--brass); color: var(--brass); background: var(--raise); }

/* Sous-titre de section (Atelier dans Métiers) */
.sub-h {
  font-family: Grenze, serif; font-size: 21px; margin: 22px 0 12px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.sub-h small {
  display: block; font-family: Karla, sans-serif; font-size: 12.5px;
  font-weight: 400; color: var(--ink-dim); margin-top: 2px;
}

@media (max-width: 620px) {
  .pk-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .nav-b { gap: 6px; }
  .nav-i { font-size: 17px; }
}

/* Article de la mosaïque non possédé */
.pk-o.is-locked { opacity: .38; }
.pk-o.is-locked:hover { opacity: .6; border-color: var(--line); color: var(--ink-faint); }
.pk-lock {
  font-size: 9.5px; color: var(--brass); letter-spacing: .04em;
}
.pk-o.is-locked .av { filter: grayscale(.7); }

/* ============================================================
   Chatbox élargie
   ============================================================ */
:root { --chat-w: 340px; }

.chat-online {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto; padding: 3px 9px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink-dim); font-size: 12px;
}
.chat-online:hover { border-color: var(--verdi); color: var(--ink); }
.online-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--verdi);
  box-shadow: 0 0 5px rgba(74,168,140,.7);
}

.msg-top { display: flex; align-items: center; gap: 6px; }
.msg-mod {
  margin-left: auto; padding: 0 5px; line-height: 1;
  background: none; border: none; color: var(--ink-faint); font-size: 15px;
}
.msg-mod:hover { color: var(--brass); }
.tag.mod { border-color: #3d6b5e; color: var(--verdi); }

.ol-list { display: flex; flex-direction: column; gap: 3px; max-height: 60dvh; overflow-y: auto; }
.ol-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; background: var(--panel-2);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.ol-row:hover { border-color: var(--brass-dim); }
.ol-n { flex: 1; min-width: 0; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.ol-l { font-size: 11px; color: var(--ink-faint); }

/* Cumul d'affixes de même nature : « +12 » avec le détail « +6 +6 » */
.parts {
  font-style: normal; font-size: 10.5px; color: var(--ink-faint);
  margin-left: 6px; letter-spacing: .04em;
}

/* Infobulle des filons */
.node-wrap { position: relative; display: block; }
.node-wrap .node { width: 100%; }
.node-tip { left: 0; right: auto; bottom: calc(100% + 7px); min-width: 190px; }
.node-wrap:hover .node-tip, .node-wrap:focus-within .node-tip { display: flex; }
.node-tip::after { left: 26px; right: auto; }

/* ============================================================
   Barres de défilement au thème du site
   ============================================================ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--raise) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--raise);
  border: 2px solid var(--bg);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--line); }
*::-webkit-scrollbar-corner { background: transparent; }

/* Dans les panneaux, la piste s'aligne sur leur fond */
.chat-log::-webkit-scrollbar-thumb,
.adm-list::-webkit-scrollbar-thumb,
.ol-list::-webkit-scrollbar-thumb,
.log::-webkit-scrollbar-thumb { border-color: var(--panel); }

@media (max-width: 620px) { :root { --chat-w: 100vw; } }

/* ============================================================
   Couleur par caractéristique — lisibilité du profil
   ============================================================ */
:root {
  --c-str:  #d9884f;   /* Force        — constance   */
  --c-int:  #8f7fd8;   /* Intelligence — variance    */
  --c-agi:  #58b8a4;   /* Agilité      — cadence     */
  --c-end:  #d0a63f;   /* Endurance    — survie      */
  --c-luck: #59a0d8;   /* Chance       — butin       */
}
.st-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 2px;
  margin-right: 8px; transform: rotate(45deg); vertical-align: middle;
}
.st-str  .st-dot { background: var(--c-str); }
.st-int  .st-dot { background: var(--c-int); }
.st-agi  .st-dot { background: var(--c-agi); }
.st-end  .st-dot { background: var(--c-end); }
.st-luck .st-dot { background: var(--c-luck); }

.st-str  .cstat-v { color: var(--c-str); }
.st-int  .cstat-v { color: var(--c-int); }
.st-agi  .cstat-v { color: var(--c-agi); }
.st-end  .cstat-v { color: var(--c-end); }
.st-luck .cstat-v { color: var(--c-luck); }
.cstat-v em { color: var(--verdi) !important; }

.v-str  { color: var(--c-str)  !important; }
.v-int  { color: var(--c-int)  !important; }
.v-agi  { color: var(--c-agi)  !important; }
.v-end  { color: var(--c-end)  !important; }
.v-luck { color: var(--c-luck) !important; }

/* Pastille de notification sur un onglet */
.nav-b { position: relative; }
.nav-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blood); margin-left: 6px; flex: none;
  box-shadow: 0 0 0 2px var(--panel), 0 0 7px rgba(187,74,62,.8);
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse { 50% { opacity: .45; } }

/* ============================================================
   Navigateur d'images (panneau admin)
   ============================================================ */
.as-group { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.as-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; padding: 4px 2px; text-align: left;
}
.as-head:hover .as-label { color: var(--ink); }
.as-caret { color: var(--brass); font-size: 11px; width: 12px; }
.as-label { flex: 1; font-family: Grenze, serif; font-size: 17px; color: var(--ink-dim); }
.as-count {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--line);
}
.as-count.ok   { color: var(--verdi); border-color: #2c5a4c; }
.as-count.lack { color: var(--blood); border-color: #52281f; }

.as-grid { display: none; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; margin-top: 10px; }
.as-group.is-open .as-grid { display: grid; }

.as-cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 4px; border: 1px solid var(--line-soft);
  background: var(--panel-2); border-radius: var(--radius);
}
.as-cell:hover { border-color: var(--brass-dim); }
.as-cell img { width: 38px; height: 38px; object-fit: contain; }
.as-cell.is-missing { border-style: dashed; border-color: #52281f; background: rgba(187,74,62,.06); }
.as-ph {
  width: 38px; height: 38px; display: grid; place-items: center;
  color: var(--blood); font-family: var(--mono); font-size: 17px;
}
.as-id {
  font-family: var(--mono); font-size: 8.5px; color: var(--ink-faint);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Couche de particules : purement décorative, jamais cliquable */
.fx-layer {
  position: fixed; inset: 0; z-index: 28;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .fx-layer { display: none; } }

/* Drapeau du sélecteur de langue */
.flag { font-size: 15px; margin-right: 5px; }

/* Choix de langue : deux drapeaux côte à côte, l'actif mis en avant */
.lang-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 15px; font-size: 14px;
  background: var(--panel-2); color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, color .15s, background .15s;
}
.lang-btn:hover { border-color: var(--brass-dim); color: var(--ink); }
.lang-btn.is-on {
  border-color: var(--brass); color: var(--brass);
  background: var(--raise); font-weight: 700;
}
.lang-btn .flag { font-size: 18px; margin: 0; }

/* ============================================================
   Indicateur de dangerosité
   ============================================================ */
.diff {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase; font-weight: 500;
  padding: 2px 8px 2px 6px; border-radius: 999px;
  border: 1px solid currentColor; vertical-align: middle;
  margin-left: 8px; cursor: help;
}
.diff i {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 5px currentColor;
}
.diff-easy   { color: #5fbf85; }
.diff-medium { color: #d2a13c; }
.diff-hard   { color: #d97a33; }
.diff-deadly { color: #d1493c; }
.diff-deadly i { animation: dotPulse 1.4s ease-in-out infinite; }

/* Nom d'objet dans la fiche : la rareté se lit aussi dans le titre */
.sheet-name { text-shadow: 0 0 14px currentColor; }
.sheet-card { position: relative; }

/* En-tête des caractéristiques : compteur et bouton de remise à zéro */
.ch-head { display: flex; align-items: center; gap: 8px; }

/* Les vignettes légendaires ne doivent pas être rognées par leur grille */
.grid-items, .gear { overflow: visible; }
