/* ==========================================================================
   GW2 Achievement Tracker - design original
   Palette "forge de la Brume" : ardoise profonde, or de laiton, braise.
   ========================================================================== */

:root {
  --bg:        #14161c;   /* ardoise nuit */
  --bg-raise:  #1c1f27;   /* panneaux */
  --bg-hover:  #232733;
  --line:      #2c3140;
  --text:      #e8e4d8;   /* parchemin clair */
  --text-dim:  #9a96a8;
  --gold:      #d4a843;   /* or de laiton : progression, accents */
  --gold-soft: #d4a84326;
  --ember:     #d96540;   /* braise : actions, festival */
  --green:     #6fae6a;   /* terminé */
  --blue:      #5e8fc9;   /* marquage manuel */
  --red:       #cf4b4b;   /* récurrent */
  --danger:    #c75454;
  --radius: 10px;
  --font-display: "Cinzel", serif;
  --font-body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* Pas de curseur texte (barre en I) ni de caret clignotant hors des champs
   de saisie : flèche par défaut partout, les liens/boutons gardent leur main. */
html { cursor: default; caret-color: transparent; }
input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
textarea, select, [contenteditable="true"] { cursor: text; caret-color: auto; }
select { cursor: pointer; }

/* L'application occupe exactement la hauteur de la fenêtre : pas de scroll de
   page superflu. Le contenu et la sidebar défilent en interne si besoin. */
.app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  overflow: hidden;
}
body {
  background:
    radial-gradient(1200px 500px at 80% -10%, #2a2333 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--gold); }
.hidden { display: none !important; }

/* Barres de défilement assorties au thème (ardoise + or) */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--gold) 20%, var(--line)) transparent;
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--gold) 20%, var(--line));
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--gold) 55%, var(--line));
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }

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

.btn {
  border: 1px solid var(--line);
  background: var(--bg-raise);
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius);
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--gold); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #1a1408; font-weight: 600; }
.btn-primary:hover { background: #e2ba59; }
.btn-ghost { background: transparent; }

/* --------------------------------------------------------------------------
   Écran de configuration
   -------------------------------------------------------------------------- */
.setup {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.setup-card {
  width: min(560px, 100%);
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 32px;
}
.setup-card h1 {
  font-family: var(--font-display);
  font-size: 26px; margin: 0 0 12px;
  letter-spacing: .04em;
}
.setup-row { display: flex; gap: 10px; margin-top: 16px; }
.setup-row input {
  flex: 1;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius);
  padding: 9px 12px;
}
.setup-row input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.setup-error { color: var(--danger); min-height: 1.4em; margin: 10px 0 0; }
code { background: var(--bg); padding: 1px 6px; border-radius: 5px; }

/* --------------------------------------------------------------------------
   Barre supérieure
   -------------------------------------------------------------------------- */
.topbar {
  flex-shrink: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; margin-left: -10px;}
.brand-mark { color: var(--gold); font-size: 18px; }
.brand-name {
  font-family: var(--font-display);
  font-size: 18px; letter-spacing: .05em;
}

.summary { display: flex; gap: 22px; flex: 1; flex-wrap: wrap; }
.summary-item { display: flex; flex-direction: column; }
.summary-item .val { font-weight: 600; color: var(--gold); }
.summary-item .lbl { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.festival-banner {
  font-size: 12px; color: var(--ember);
  border: 1px solid color-mix(in srgb, var(--ember) 45%, transparent);
  background: color-mix(in srgb, var(--ember) 12%, transparent);
  padding: 4px 10px; border-radius: 999px;
}

/* --------------------------------------------------------------------------
   Mise en page
   -------------------------------------------------------------------------- */
.layout { display: flex; flex: 1; min-height: 0; overflow: hidden; }

.sidebar {
  width: 290px; flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding: 14px 10px 40px;
  overflow-y: auto;
}

.group-title {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: none; border: 0; color: var(--text);
  font-family: var(--font-display);
  font-size: 13px; letter-spacing: .06em;
  padding: 9px 10px; border-radius: 8px;
  text-align: left;
}
.group-title:hover { background: var(--bg-hover); }
.group-title .chev { color: var(--text-dim); transition: transform .15s; }
.group-title.open .chev { transform: rotate(90deg); }

.cat-list { margin: 2px 0 8px; }
.cat-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  background: none; border: 0; color: var(--text-dim);
  padding: 6px 10px 6px 18px; border-radius: 8px;
  text-align: left;
}
.cat-item:hover { background: var(--bg-hover); color: var(--text); }
.cat-item.active { background: var(--gold-soft); color: var(--gold); }
.cat-item img { width: 22px; height: 22px; border-radius: 5px; }
.cat-item .cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .cat-count { font-size: 11px; }
.cat-item .cat-count.complete { color: var(--green); font-weight: 700; }
.cat-item .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ember); flex-shrink: 0;
}
.cat-item.dimmed { opacity: .42; }

/* --------------------------------------------------------------------------
   Contenu / barre d'outils
   -------------------------------------------------------------------------- */
.content { flex: 1; padding: 18px; min-width: 0; min-height: 0; overflow-y: auto; }

.toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 18px;
}
#search {
  flex: 1; min-width: 220px;
  background: var(--bg-raise); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius);
  padding: 8px 13px;
}
#search:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.sort-wrap { position: relative; flex-shrink: 0; }
.sort-btn {
  width: 38px; height: 38px; display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text-dim);
  cursor: pointer; transition: color .15s, border-color .15s;
}
.sort-btn:hover, .sort-btn.open { color: var(--gold); border-color: var(--gold); }
.sort-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  padding: 5px; min-width: 220px;
}
.sort-menu.hidden { display: none; }
.sort-opt {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--text);
  padding: 8px 11px 8px 28px; border-radius: 6px;
  cursor: pointer; white-space: nowrap; position: relative;
  font-size: 14px;
}
.sort-opt:hover { background: var(--gold-soft); }
.sort-opt.active { color: var(--gold); font-weight: 600; }
.sort-opt.active::before {
  content: "✓"; position: absolute; left: 10px; color: var(--gold);
}

.filter-group {
  display: flex; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.filter-tab {
  background: var(--bg-raise); border: 0; color: var(--text-dim);
  padding: 8px 13px;
}
.filter-tab + .filter-tab { border-left: 1px solid var(--line); }
.filter-tab.active { background: var(--gold-soft); color: var(--gold); font-weight: 600; }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; }
.toggle-track {
  width: 36px; height: 20px; border-radius: 999px;
  background: var(--line); position: relative; transition: background .15s;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-dim); transition: transform .15s, background .15s;
}
.toggle input:checked + .toggle-track { background: var(--ember); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); background: #fff; }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--gold); }
.toggle-label { color: var(--text-dim); }
.toggle input:checked ~ .toggle-label { color: var(--text); }

.category-header { margin: 6px 0 14px; }
.category-header h2 {
  font-family: var(--font-display);
  font-size: 21px; margin: 0 0 4px; letter-spacing: .03em;
}
.category-header .sub { color: var(--text-dim); font-size: 13px; }
.category-header .warn { color: var(--ember); font-size: 13px; margin-top: 4px; }
.category-header .warn .btn-small {
  padding: 3px 10px; font-size: 12px; margin-left: 8px;
  border-color: color-mix(in srgb, var(--ember) 45%, transparent);
  color: var(--ember);
}
.category-header .warn .btn-small:hover {
  border-color: var(--ember);
  background: color-mix(in srgb, var(--ember) 12%, transparent);
}

/* --------------------------------------------------------------------------
   Cartes de succès
   -------------------------------------------------------------------------- */
.achievement-list { display: flex; flex-direction: column; gap: 10px; }

.ach {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 220px;
  gap: 8px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 16px;
  position: relative;
  overflow: hidden;
}
.ach::before { /* liseré d'état à gauche */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: transparent;
}
.ach.is-done::before   { background: var(--green); }
.ach.is-manual::before { background: var(--blue); }
.ach.is-recurring::before { background: var(--red); }
.ach.is-blocked { opacity: .55; }

.ach-icon { width: 52px; height: 52px; border-radius: 8px; background: var(--bg); object-fit: cover; }

.ach-main { min-width: 0; }
.ach-name {
  font-weight: 600; font-size: 15px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0;
}
.ach-name .ap {
  font-size: 12px; color: var(--gold); font-weight: 600;
  margin-left: 8px; white-space: nowrap;
}
.ach-name .ap-cap {
  font-size: 12px; color: var(--text-dim); font-weight: 500;
  margin-left: 6px; white-space: nowrap;
}
.ach-name .ap-progress { color: var(--text-dim); font-weight: 500; }
.ach-name .ap-progress b { color: var(--gold); font-weight: 700; }
.wiki-link {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 8px; color: var(--text-dim);
  transition: color .15s; flex-shrink: 0;
  line-height: 1;
}
.wiki-link:hover { color: var(--gold); }
.wiki-link svg { display: block; }
.ach-desc { color: var(--text-dim); margin-top: 2px; }
.ach-req  { color: var(--text); margin-top: 2px; font-size: 13px; }

.ach-tags { display: flex; flex-wrap: wrap; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 8px;
  border: 1px solid var(--line); color: var(--text-dim);
}
.tag.festival { color: var(--ember); border-color: color-mix(in srgb, var(--ember) 45%, transparent); }
.tag.blocked  { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }

/* Récompenses de succès (colonne de droite, à gauche du statut) */
.ach-side-top {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; flex-wrap: wrap;
}
.ach-rewards {
  display: flex; align-items: center; gap: 7px;
  flex-wrap: wrap; justify-content: flex-end;
  max-width: 210px;
}
.reward {
  display: inline-flex; align-items: center; gap: 3px;
  text-decoration: none; color: var(--text);
}
.rw-svg, .rw-coin { display: block; }

/* Objet : icône en grand, nom au survol */
.reward.item { position: relative; }
.reward-item-icon {
  width: 40px; height: 40px; border-radius: 6px;
  object-fit: cover; background: var(--bg);
  border: 1px solid var(--line);
  transition: border-color .15s, transform .15s;
}
a.reward.item:hover .reward-item-icon { border-color: var(--gold); transform: scale(1.05); }
.reward-item-icon.ph {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-weight: 700; font-size: 18px;
  background: var(--bg-hover);
}
.reward-count {
  position: absolute; right: -3px; bottom: -3px;
  font-size: 10px; font-weight: 700; color: var(--text);
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: 6px; padding: 0 3px; line-height: 1.3;
}

/* Titre : couronne officielle (image) ou repli SVG, titre au survol */
.reward.title { gap: 0; }
.title-crown { width: 22px; height: 18px; object-fit: contain; display: block; }
.title-crown-fb { line-height: 0; }

/* Maîtrise : vraie image du point (repli fond coloré si l'image échoue) */
.reward.mastery { padding: 0; }
.mastery-icon {
  width: 26px; height: 26px; object-fit: contain;
  background: radial-gradient(circle at 50% 45%, var(--mp-bg, transparent) 0%, transparent 62%);
  border-radius: 50%;
}

/* Pièces : nombre + petite pièce colorée */
/* Coffre : récompenses débloquées palier par palier (détail au survol) */
/* Même cadre que l'icône d'un objet de récompense (.reward-item-icon, 40×40) */
.reward.tier-chest {
  cursor: help; width: 40px; height: 40px; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid var(--line); background: var(--bg);
  overflow: hidden; transition: border-color .15s, transform .15s;
}
.reward.tier-chest:hover, .reward.tier-chest:focus-visible {
  border-color: var(--gold); transform: scale(1.05); outline: none;
}
.chest-icon { width: 100%; height: 100%; object-fit: cover; display: block; }
.chest-svg { display: block; width: 30px; height: 26px; }

.tier-pop {
  position: fixed; z-index: 1000; display: none;
  width: 380px; max-width: calc(100vw - 16px); max-height: min(70vh, 520px);
  flex-direction: column;
  background: var(--bg-raise); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  font-size: 13px;
}
.tier-pop.open { display: flex; }
.tp-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 12px 8px; border-bottom: 1px solid var(--line);
  /* même police que le nom des succès (.ach-name) */
  font-family: var(--font-body); font-weight: 600; font-size: 15px; color: var(--gold);
}
.tp-sum { font-family: var(--font-body); font-size: 12px; color: var(--text-dim); }
.tp-list { position: relative; list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; }
/* Grille commune à l'en-tête et aux lignes : N° | objectif | récompense | PA */
.tp-cols, .tp-list li {
  display: grid; grid-template-columns: 22px 54px minmax(0, 1fr) 40px;
  gap: 10px; column-gap: 8px; align-items: center;
  padding: 5px 12px; border-left: 2px solid transparent;
}
.tp-cols {
  padding-top: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim);
}
.tp-cols span:nth-child(2), .tp-count { text-align: right; }
.tp-cols span:first-child { text-align: center; }
.tp-cols span:nth-child(3), .tp-items { padding-left: 6px; }
.tp-cols span:last-child, .tp-ap { text-align: right; }
.tp-list li.is-done { opacity: .55; }
.tp-list li.is-current { background: var(--gold-soft); border-left-color: var(--gold); }
.tp-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line); font-size: 11px; font-weight: 600; color: var(--text);
}
.tp-list li.is-done .tp-mark { background: var(--green); border-color: var(--green); color: #10140f; }
.tp-list li.is-current .tp-mark { border-color: var(--gold); color: var(--gold); }
.tp-count { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.tp-ap { font-size: 12px; font-weight: 600; color: var(--gold); white-space: nowrap; }
.tp-ap.is-zero { color: var(--text-dim); font-weight: 400; }
.tp-items { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tp-item {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  color: var(--text); text-decoration: none;
}
a.tp-item:hover .nm { color: var(--gold); text-decoration: underline; }
.tp-item img, .tp-item .ph {
  flex: none; width: 22px; height: 22px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--bg); object-fit: cover;
}
.tp-item .ph { display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-dim); }
.tp-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-item .cnt { flex: none; font-size: 11px; color: var(--text-dim); }
.tp-none { color: var(--text-dim); }
.tp-foot {
  padding: 6px 12px 8px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--text-dim);
}
.tp-foot a { color: var(--text-dim); }

.reward.coins { gap: 5px; }
.coin-part { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--text); }

.ach-progress { grid-column: 1 / -1; }
.bar {
  height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden;
  border: 1px solid var(--line);
}
.bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #a8842f, var(--gold));
  transition: width .3s;
}
.ach.is-done .bar > span { background: var(--green); }

/* Barre découpée par paliers : un segment par palier, séparés par une coupure */
.bar.is-tiered {
  display: flex; gap: 2px;
  background: none; border: 0; border-radius: 0; overflow: visible;
}
.bar.is-tiered.is-dense { gap: 1px; }
.bar.is-tiered .seg {
  flex-basis: 0; min-width: 2px; height: 8px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 2px; overflow: hidden;
}
.bar.is-tiered .seg:first-child { border-radius: 999px 2px 2px 999px; }
.bar.is-tiered .seg:last-child  { border-radius: 2px 999px 999px 2px; }
.bar.is-tiered .seg > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #a8842f, var(--gold));
  transition: width .3s;
}
.bar.is-tiered .seg.is-full { border-color: #a8842f; }
.bar.is-tiered .seg.is-full > span { background: var(--gold); }
.ach.is-done .bar.is-tiered .seg > span { background: var(--green); }
.ach.is-done .bar.is-tiered .seg { border-color: var(--line); }

.bar-label { font-size: 12px; color: var(--text-dim); }
.tier-label { margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--line); }
.tier-label b { color: var(--gold); font-weight: 600; }
.ach.is-done .tier-label b { color: var(--green); }
.bar-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 4px;
}

.ach-side {
  display: flex; flex-direction: column; align-items: flex-end;
  justify-content: space-between; gap: 8px;
}

/* Étapes (bits) dépliables */
.steps-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 2px 0;
  color: var(--text-dim); font-size: 13px;
}
.steps-toggle:hover { color: var(--gold); }
.steps-toggle .chev { transition: transform .15s; display: inline-block; }
.steps-toggle.open .chev { transform: rotate(90deg); }

.ach-steps {
  grid-column: 1 / -1;
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

/* Grille de tuiles d'icônes */
.step-tiles {
  display: flex; flex-wrap: wrap; gap: 7px;
  max-height: 365px; overflow-y: auto;
  padding-right: 4px;
}
.step-tile {
  width: 46px; height: 46px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.step-tile.done { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }

.step-icon {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  /* Étape non obtenue : icône grisée/désaturée (convention collections) */
  filter: grayscale(1) brightness(0.5);
  opacity: 0.7;
  transition: filter .15s, opacity .15s;
}
.step-tile.done .step-icon { filter: none; opacity: 1; }
.step-tile a { display: block; width: 100%; height: 100%; }

/* Placeholder d'icône non encore résolue : "?" neutre, remplacé au fur et à mesure */
.step-icon-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-hover);
  color: var(--text-dim); font-weight: 700; font-size: 20px;
}

/* Étape texte : ligne pleine largeur, une par ligne */
.step-row {
  flex: 0 0 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 7px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.step-row.done { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.step-row-check {
  width: 17px; height: 17px; flex-shrink: 0;
  border: 1.5px solid var(--line); border-radius: 50%; position: relative;
}
.step-row.done .step-row-check { background: var(--green); border-color: var(--green); }
.step-row.done .step-row-check::after {
  content: "✓"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #16240f; font-weight: 700;
}
.step-text { font-size: 13px; line-height: 1.4; color: var(--text-dim); flex: 1; }
.step-row.done .step-text { color: var(--text); }

.status {
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  border: 0; font: inherit;
}
.status.done   { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.status.recurring { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.status.manual { color: var(--blue);  background: color-mix(in srgb, var(--blue) 14%, transparent); }
.status.todo   { color: var(--text-dim); background: var(--bg); }

/* Le statut "à faire"/"réalisé" est aussi le bouton de marquage manuel */
button.status { cursor: pointer; transition: filter .15s, border-color .15s; }
button.status:hover { filter: brightness(1.2); }
button.status.todo:hover { color: var(--blue); }

.empty {
  text-align: center; color: var(--text-dim);
  padding: 60px 20px; border: 1px dashed var(--line); border-radius: var(--radius);
}

.load-more { align-self: center; margin-top: 8px; }

/* --------------------------------------------------------------------------
   Fenêtre modale Événements
   -------------------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8, 9, 12, .6);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-card {
  width: min(640px, 100%);
  max-height: 85vh; overflow-y: auto;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 22px 28px 28px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-card h2 {
  font-family: var(--font-display);
  font-size: 20px; margin: 0; letter-spacing: .04em;
}
.modal-card h3 {
  font-family: var(--font-display);
  font-size: 14px; letter-spacing: .05em;
  margin: 22px 0 6px; color: var(--gold);
}
.modal-hint { color: var(--text-dim); font-size: 13px; margin: 0 0 10px; text-align: justify; }

.event-group { margin-bottom: 16px; }
.event-group-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px; border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.event-group-head label { flex: 1; cursor: pointer; }
.event-group-head .muted { color: var(--text-dim); font-size: 12px; margin-left: 8px; font-weight: 400; }
.event-group-toggle {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-dim); display: flex; align-items: center; flex-shrink: 0;
}
.event-group-toggle:hover { color: var(--gold); }
.event-group-toggle .chev { display: inline-block; font-size: 16px; transition: transform .15s; }
.event-group-toggle.open .chev { transform: rotate(90deg); }

.event-cat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px 6px 24px;
}
.event-cat-row label { flex: 1; cursor: pointer; }
.event-group input[type="checkbox"] {
  width: 17px; height: 17px;
  accent-color: var(--gold);
  cursor: pointer; flex-shrink: 0;
}
.auto-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-dim);
  white-space: nowrap;
}
.auto-badge.detected { color: var(--ember); border-color: color-mix(in srgb, var(--ember) 45%, transparent); }

/* --------------------------------------------------------------------------
   Chargement
   -------------------------------------------------------------------------- */
.loading {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center; color: var(--text-dim);
}
.loading-spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 1.5s !important; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; max-height: 260px; position: static;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .summary { gap: 14px; }
  .ach { grid-template-columns: 44px 1fr; }
  .ach-side { grid-column: 1 / -1; flex-direction: row; align-items: center; }
}

/* ==========================================================================
   Système de modules : bouton menu, navbar coulissante, conteneur de module
   ========================================================================== */

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex-shrink: 0;
  background: transparent; border: 1px solid transparent;
  border-radius: 9px; color: var(--text);
  font-size: 16px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg-hover); border-color: var(--line); }

/* Icône hamburger (3 traits -> croix quand ouvert) */
.burger, .burger::before, .burger::after {
  content: ""; display: block;
  width: 18px; height: 2px; border-radius: 2px;
  background: currentColor; transition: transform .2s, opacity .2s;
}
.burger { position: relative; }
.burger::before { position: absolute; top: -6px; left: 0; }
.burger::after  { position: absolute; top: 6px;  left: 0; }
#menu-btn[aria-expanded="true"] .burger { background: transparent; }
#menu-btn[aria-expanded="true"] .burger::before { transform: translateY(6px) rotate(45deg); }
#menu-btn[aria-expanded="true"] .burger::after  { transform: translateY(-6px) rotate(-45deg); }

/* Voile derrière la navbar */
.nav-backdrop {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(8, 9, 12, .55);
  opacity: 0; transition: opacity .2s;
}
.nav-backdrop.show { opacity: 1; }

/* Navbar coulissante */
.nav-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 46;
  width: 300px; max-width: 84vw;
  background: var(--bg-raise);
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 24px rgba(0,0,0,.35);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .22s ease;
}
.nav-drawer.open { transform: translateX(0); }

.nav-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.nav-title {
  font-family: var(--font-display); font-size: 15px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim);
}
.nav-list { list-style: none; margin: 0; padding: 10px; flex: 1; overflow-y: auto; }
.nav-list li { margin-bottom: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 11px 12px; text-align: left; color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.nav-item-ico {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--bg); border: 1px solid var(--line);
  color: var(--gold); font-size: 16px;
}
.nav-item.active .nav-item-ico { border-color: var(--gold); }

/* Filtre « Work in Progress » sur le module Légendaires : texte rouge en
   diagonale montante (bas-gauche -> haut-droite) + léger voile rouge. */
.nav-item.wip { position: relative; overflow: hidden; }
.nav-item.wip::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: rgba(25, 25, 25, .7); pointer-events: none;
}
.wip-ribbon {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  transform: rotate(-5deg); transform-origin: center;
  white-space: nowrap; pointer-events: none;
  font-size: 18px; font-weight: bold; letter-spacing: .5px;
  text-transform: uppercase; color: #e34b45;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .65);
}
.nav-item-text { display: flex; flex-direction: column; line-height: 1.25; }
.nav-item-text strong { font-size: 14px; }
.nav-item-text small { color: var(--text-dim); font-size: 12px; }
.nav-foot { padding: 12px 16px; border-top: 1px solid var(--line); color: var(--text-dim); }

/* Conteneur de module : occupe l'espace sous la barre du haut */
.module { flex: 1; min-height: 0; display: flex; }

@media (max-width: 620px) {
  .nav-drawer { width: 100vw; max-width: 100vw; }
}

/* ==========================================================================
   Module Calculateur de craft
   ========================================================================== */
.craft-content { display: block; }

.craft-search { position: relative; max-width: 640px; margin: 4px 0 20px; }
#craft-input {
  width: 100%;
  background: var(--bg-raise); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius); padding: 11px 14px; font-size: 15px;
}
#craft-input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.craft-suggests {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 15;
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius);
  max-height: 340px; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.craft-suggest {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 8px 12px; text-align: left; color: var(--text); cursor: pointer;
}
.craft-suggest:last-child { border-bottom: 0; }
.craft-suggest:hover { background: var(--bg-hover); }
.craft-suggest img, .craft-suggest .ci-ph { width: 32px; height: 32px; border-radius: 5px; background: var(--bg); flex-shrink: 0; }
.craft-suggest-empty { padding: 12px 14px; color: var(--text-dim); font-size: 13px; }

.ci { width: 34px; height: 34px; border-radius: 5px; background: var(--bg); object-fit: cover; flex-shrink: 0; }
.ci-ph { display: inline-block; border: 1px solid var(--line); }
.cn { font-weight: 500; text-decoration: none; }
.cn:hover { text-decoration: underline; }

/* Couleurs de rareté */
.rarity-fine { color: #62a4da; }
.rarity-masterwork { color: #1a9306; }
.rarity-rare { color: #fcd00b; }
.rarity-exotic { color: #ffa405; }
.rarity-ascended { color: #fb3e8d; }
.rarity-legendary { color: #4c139d; filter: brightness(1.5); }

.craft-note {
  border: 1px solid color-mix(in srgb, var(--ember) 40%, transparent);
  background: color-mix(in srgb, var(--ember) 10%, transparent);
  color: var(--text); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; margin: 0 0 14px;
  max-width: 720px;
}
.craft-note code { background: var(--bg); padding: 1px 6px; border-radius: 5px; }

.craft-head {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-top: 3px solid var(--gold); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 18px;
}
.craft-head-ico { width: 56px; height: 56px; border-radius: 8px; background: var(--bg); }
.craft-head-main h3 { font-family: var(--font-display); font-size: 20px; margin: 0 0 8px; letter-spacing: .03em; }
.craft-qty { display: flex; align-items: center; gap: 8px; }
.craft-qty label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-right: 4px; }
.qty-btn {
  width: 30px; height: 30px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); border-radius: 7px; font-size: 16px; line-height: 1;
}
.qty-btn:hover { border-color: var(--gold); color: var(--gold); }
#craft-qty {
  width: 80px; text-align: center; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); border-radius: 7px; padding: 6px 8px;
}

.craft-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.craft-panel {
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px;
}
.craft-panel h4 {
  font-family: var(--font-display); font-size: 14px; letter-spacing: .05em;
  color: var(--gold); margin: 0 0 12px;
}
.craft-panel h4 .muted { color: var(--text-dim); font-weight: 400; }

.craft-mats, .craft-steps { display: flex; flex-direction: column; gap: 6px; }
.craft-mat {
  display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 10px;
  padding: 5px 6px; border-radius: 7px;
}
.craft-mat:hover { background: var(--bg-hover); }
.cm-buy { font-weight: 700; color: var(--gold); }
.cm-owned { font-size: 12px; color: var(--text-dim); min-width: 90px; text-align: right; }

.craft-step {
  display: grid; grid-template-columns: auto 34px 1fr auto; align-items: center; gap: 10px;
  padding: 5px 6px; border-radius: 7px;
}
.craft-step:hover { background: var(--bg-hover); }
.cs-count { font-weight: 700; color: var(--gold); min-width: 34px; }
.cs-meta { font-size: 12px; color: var(--text-dim); }

/* Arbre de fabrication */
.craft-tree { font-size: 14px; }
.ct-node { margin: 2px 0; }
.ct-node > summary {
  list-style: none; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.ct-node > summary::-webkit-details-marker { display: none; }
.ct-node > summary:hover { background: var(--bg-hover); }
.ct-node > summary::before {
  content: "▸"; color: var(--text-dim); display: inline-block; width: 1em;
  transition: transform .15s;
}
.ct-node[open] > summary::before { transform: rotate(90deg); }
.ct-children { margin-left: 18px; border-left: 1px solid var(--line); padding-left: 8px; }
.ct-leaf { padding: 4px 6px 4px 26px; }
.ct-line { display: inline-flex; align-items: center; gap: 8px; }
.ct-line .ci { width: 26px; height: 26px; }
.ct-need { font-weight: 700; color: var(--gold); min-width: 40px; }
.ct-badge { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); }
.ct-badge.craft { color: var(--ember); border-color: color-mix(in srgb, var(--ember) 45%, transparent); }
.ct-badge.base { color: var(--text-dim); }
.ct-owned { font-size: 12px; color: var(--green); }

@media (max-width: 800px) {
  .craft-cols { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Module Légendaires (calculateur - 2 colonnes façon gw2efficiency)
   ========================================================================== */
.leg-layout { flex: 1; min-height: 0; display: flex; overflow: hidden; }

/* ---- Sélecteur (gauche) ---- */
.leg-sidebar {
  width: 290px; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--bg-raise);
}
.leg-sidebar-head { padding: 12px; border-bottom: 1px solid var(--line); }
#legendary-filter {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 9px 12px;
}
#legendary-filter:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.leg-sidebar .leg-toggle { display: flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: 12px; cursor: pointer; }
.leg-sidebar .leg-toggle input { width: 15px; height: 15px; accent-color: var(--gold); }
.legendary-summary { margin-top: 8px; font-size: 12px; color: var(--text-dim); }
.leg-sum-val { color: var(--gold); font-weight: 700; }
.leg-scope-note { color: var(--ember); margin-top: 4px; }
.leg-scope-note code { background: var(--bg); padding: 1px 4px; border-radius: 4px; }

.legendary-list { flex: 1; overflow-y: auto; padding: 8px 6px 30px; }
.leg-loading { padding: 16px; color: var(--text-dim); font-size: 13px; text-align: center; }

/* En-tête de type repliable (même style que la sidebar Succès) */
.leg-group-title {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: 0; color: var(--text);
  font-family: var(--font-display); font-size: 13px; letter-spacing: .05em;
  padding: 9px 10px; border-radius: 8px; text-align: left; cursor: pointer;
  margin-top: 2px;
}
.leg-group-title:hover { background: var(--bg-hover); }
.leg-grp-label { display: flex; align-items: baseline; gap: 8px; }
.leg-grp-count { font-family: var(--font-body); font-size: 11px; color: var(--text-dim); font-weight: 400; letter-spacing: 0; }
.leg-group-title .chev { color: var(--text-dim); transition: transform .15s; }
.leg-group-title.open .chev { transform: rotate(90deg); }

/* Grille d'icônes seules */
.leg-icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px; padding: 6px 6px 12px;
}
.leg-icon {
  position: relative; width: 100%; aspect-ratio: 1; padding: 0;
  background: var(--bg); border: 2px solid var(--line); border-radius: 8px;
  cursor: pointer; overflow: hidden; transition: border-color .12s, transform .06s;
}
.leg-icon img, .leg-icon .leg-ph { width: 100%; height: 100%; object-fit: cover; display: block; }
.leg-icon:hover { border-color: var(--gold); }
.leg-icon:active { transform: scale(.94); }
.leg-icon.selected { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 45%, transparent); }
/* Non débloqué : grisé (comme les collections de succès) */
.leg-icon.locked img { filter: grayscale(1) brightness(.55); }
.leg-icon.locked:hover img { filter: grayscale(.4) brightness(.8); }

/* ---- Calculateur (droite) ---- */
.leg-main { flex: 1; overflow-y: auto; }
.legendary-craft { padding: 22px 26px; max-width: 1100px; }
.leg-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 240px; color: var(--text-dim); text-align: center; gap: 14px; }
.leg-placeholder-ico { font-size: 48px; opacity: .5; }
.leg-placeholder p { max-width: 340px; }
/* Messages d'attente : centrés dans tout le corps de la page (et non dans
   la colonne de 1100 px du calculateur). */
.legendary-craft:has(> .leg-placeholder:only-child),
.legendary-craft:has(> .leg-loading:only-child) {
  height: 100%; max-width: none; display: flex; align-items: center; justify-content: center;
}
.legendary-craft > .leg-loading:only-child { font-size: 14px; }

.leg-craft-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.leg-craft-head img { width: 60px; height: 60px; border-radius: 10px; border-top: 3px solid var(--gold); background: var(--bg-raise); }
.leg-craft-head h2 { font-family: var(--font-display); font-size: 24px; margin: 0 0 4px; letter-spacing: .02em; color: #b483ff; }
.leg-craft-head a { color: var(--text-dim); font-size: 13px; text-decoration: none; }
.leg-craft-head a:hover { color: var(--gold); }

.craft-note { border: 1px solid color-mix(in srgb, var(--ember) 40%, transparent); background: color-mix(in srgb, var(--ember) 10%, transparent); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin: 0 0 14px; }
.craft-note code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

.leg-craft-cols { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 20px; align-items: start; }
.leg-panel h3 { font-family: var(--font-display); font-size: 15px; letter-spacing: .04em; color: var(--gold); margin: 0 0 12px; }
.leg-panel h3.mt { margin-top: 20px; }
.leg-panel h3 .muted { color: var(--text-dim); font-weight: 400; font-size: 12px; }

.ci { width: 30px; height: 30px; border-radius: 5px; background: var(--bg); border: 1px solid var(--line); object-fit: cover; flex-shrink: 0; }
.ci-ph { display: inline-block; }

/* Liste d'achat */
.buy-list { display: flex; flex-direction: column; gap: 4px; }
.buy-row { display: grid; grid-template-columns: 30px 1fr auto; grid-template-areas: "i n need" "i n owned"; gap: 2px 10px; align-items: center; padding: 6px 8px; border-radius: 7px; }
.buy-row:hover { background: var(--bg-hover); }
.buy-row .ci { grid-area: i; }
.buy-name { grid-area: n; font-size: 13px; font-weight: 500; }
.buy-need { grid-area: need; font-weight: 700; color: var(--gold); text-align: right; }
.buy-need small { color: var(--text-dim); font-weight: 400; }
.buy-owned { grid-area: owned; font-size: 11px; color: var(--text-dim); text-align: right; }
.buy-note { grid-area: need; grid-row: 1 / 3; font-size: 11px; color: var(--text-dim); text-align: right; max-width: 160px; }
.buy-row.got .buy-need { color: var(--green); }
.buy-row.special { grid-template-columns: 30px 1fr auto; }

/* Étapes de fabrication */
.cstep-list { display: flex; flex-direction: column; gap: 8px; }
.cstep {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 14px;
}
.cstep-n {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  /* même police que le nom des succès (.ach-name) */
  font-family: var(--font-body); font-weight: 600; font-size: 15px; color: var(--gold);
}
.cstep-body { flex: 1; min-width: 0; }
.cstep-out { font-size: 14px; margin-bottom: 6px; }
.cstep-out b { color: var(--gold); }
.cstep-ings { display: flex; flex-wrap: wrap; gap: 6px; }
.ing { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px 2px 3px; }
.ing .ci { width: 20px; height: 20px; }
.ing b { color: var(--text); }
.ing.out { background: none; border: 0; font-size: 14px; padding: 0; font-weight: 600; color: #b483ff; }
.ing.out .ci { width: 26px; height: 26px; }
.ing.mat { color: var(--text); }
.ing.craft { color: #b483ff; }
.ing.special { color: var(--ember); }
.cstep-method { flex-shrink: 0; font-size: 11px; color: var(--text-dim); font-style: italic; align-self: flex-start; }

@media (max-width: 900px) {
  .leg-layout { flex-direction: column; height: auto; }
  .leg-sidebar { width: auto; max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .leg-craft-cols { grid-template-columns: 1fr; }
}

/* Bascule « récurrents » dans le menu Événements (réintégrée) */
.recur-toggle {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 14px; margin-bottom: 14px;
  cursor: pointer;
}
.recur-toggle input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--gold); cursor: pointer; flex-shrink: 0; }
.recur-toggle span { display: flex; flex-direction: column; line-height: 1.3; }
.recur-toggle small { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

/* Compteur possédés/max sur les icônes de légendaires */
.leg-count {
  position: absolute; bottom: 2px; right: 2px;
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 2px 4px; border-radius: 5px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(2px);
}
.leg-count.full   { color: var(--green); border-color: color-mix(in srgb, var(--green) 55%, transparent); }
.leg-count.partial{ color: var(--gold); border-color: color-mix(in srgb, var(--gold) 55%, transparent); }
.leg-count.none   { color: var(--text-dim); }
.leg-count.check  { color: var(--green); border: 0; background: none; font-size: 13px; padding: 0 2px 1px; }

/* Compteur dans l'en-tête du calcul */
.leg-craft-count {
  display: inline-block; font-size: 12px; margin: 0 0 5px;
  padding: 2px 9px; border-radius: 999px;
  color: var(--text-dim); border: 1px solid var(--line);
}
.leg-craft-count.full    { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.leg-craft-count.partial { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.leg-craft-count b { color: var(--gold); }
.leg-craft-head > div { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }

/* Types d'acquisition (calculateur légendaire) : couleurs */
.ing.acq-forge  { color: #b483ff; }
.ing.acq-craft  { color: var(--blue); }
.ing.acq-achievement { color: var(--green); }
.ing.acq-purchase { color: var(--gold); }
.ing.acq-raw, .ing.acq-special { color: var(--text); }
.ing.out { background: none; border: 0; font-size: 14px; padding: 0; font-weight: 600; color: #b483ff; }
.ing.out .ci { width: 26px; height: 26px; }

/* Liste d'achat groupée par type */
.buy-list.grouped { gap: 2px; }
.buy-group { margin-bottom: 12px; }
.buy-group h4 {
  font-family: var(--font-display); font-size: 12px; letter-spacing: .04em;
  margin: 6px 0 4px; padding-left: 8px; border-left: 3px solid var(--line);
}
.buy-group h4 span { color: var(--text-dim); font-weight: 400; font-family: var(--font-body); }
.buy-group h4.acq-forge  { border-color: #b483ff; color: #b483ff; }
.buy-group h4.acq-craft  { border-color: var(--blue); color: var(--blue); }
.buy-group h4.acq-achievement { border-color: var(--green); color: var(--green); }
.buy-group h4.acq-purchase { border-color: var(--gold); color: var(--gold); }
.buy-group h4.acq-raw { border-color: var(--text-dim); color: var(--text-dim); }

.acq-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.acq-dot.acq-achievement { background: var(--green); }
.acq-dot.acq-special { background: var(--ember); }

/* Étape : badge + liseré par type */
.cstep.acq-craft  { border-left: 3px solid var(--blue); }
.cstep.acq-forge  { border-left: 3px solid #b483ff; }
.cstep-tag {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .03em;
  padding: 1px 6px; border-radius: 5px; margin-right: 6px; vertical-align: middle;
  text-transform: uppercase;
}
.cstep-tag.acq-forge { color: #b483ff; background: color-mix(in srgb, #b483ff 16%, transparent); }
.cstep-tag.acq-craft { color: var(--blue); background: color-mix(in srgb, var(--blue) 16%, transparent); }

/* Ingrédient déjà possédé (élagué) */
.ing.acq-owned { color: var(--green); opacity: .85; }
.ing.acq-owned b { color: var(--green); }

/* Étape d'achat par objets */
.cstep.acq-purchase { border-left: 3px solid var(--gold); }
.cstep-tag.acq-purchase { color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); }

/* --------------------------------------------------------------------------
   Module Builds : barre de catégories + iframe Snowcrows proxifiée
   -------------------------------------------------------------------------- */
#module-builds { display: flex; flex-direction: column; }
.builds-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.builds-tabs {
  display: flex; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.builds-tab {
  background: var(--bg-raise); border: 0; color: var(--text-dim);
  padding: 8px 15px; cursor: pointer;
}
.builds-tab + .builds-tab { border-left: 1px solid var(--line); }
.builds-tab:hover { color: var(--text); }
.builds-tab.active { background: var(--gold-soft); color: var(--gold); font-weight: 600; }
.builds-open { margin-left: auto; }
.builds-back {
  flex-shrink: 0; width: 38px; padding: 8px 0; font-size: 16px; line-height: 1;
}

.builds-frame-wrap {
  position: relative; flex: 1;
  height: calc(100vh - 168px); min-height: 460px;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #0f1116;
}
#builds-frame { width: 100%; height: 100%; border: 0; display: block; }
.builds-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: var(--text-dim); background: var(--bg);
  transition: opacity .25s;
}
.builds-loading.hidden { opacity: 0; pointer-events: none; }

/* --------------------------------------------------------------------------
   Module Tableaux (dashboards personnalisés)
   -------------------------------------------------------------------------- */
.dash-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-tab {
  background: var(--bg-raise); border: 1px solid var(--line);
  color: var(--text-dim); padding: 7px 13px; border-radius: var(--radius); cursor: pointer;
}
.dash-tab:hover { color: var(--text); }
.dash-tab.active { background: var(--gold-soft); color: var(--gold); font-weight: 600; border-color: color-mix(in srgb, var(--gold) 40%, transparent); }

.dash-empty { color: var(--text-dim); max-width: 640px; line-height: 1.6; padding: 24px 0; }
.dash-empty b { color: var(--text); }

.dash-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dash-name {
  font-family: var(--font-display, inherit); font-size: 18px; font-weight: 600;
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); padding: 8px 12px; min-width: 220px; flex: 1;
}
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.dash-danger:hover { background: color-mix(in srgb, var(--red) 15%, transparent); border-color: var(--red); }

.dash-grid-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.dash-grid { border-collapse: collapse; width: 100%; }
.dash-grid th, .dash-grid td { border: 1px solid var(--line); padding: 0; vertical-align: middle; }
.dash-grid thead th { background: var(--bg-raise); }
.dash-th { display: flex; align-items: center; gap: 5px; padding: 6px 7px; }
.dash-colname {
  background: transparent; border: 0; color: var(--text); font-weight: 600;
  width: 100%; min-width: 80px; padding: 4px;
}
.dash-colname:focus { outline: 1px solid var(--gold); border-radius: 4px; }
.dash-coltype {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text-dim); font-size: 12px; padding: 3px 4px; max-width: 130px;
}
.dash-x {
  flex-shrink: 0; width: 22px; height: 22px; line-height: 1;
  background: transparent; border: 0; color: var(--text-dim); cursor: pointer; border-radius: 5px;
}
.dash-x:hover { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }

.dash-cell {
  width: 100%; box-sizing: border-box; background: transparent; border: 0;
  color: var(--text); padding: 8px 9px; font-size: 14px;
}
.dash-cell:focus { outline: 2px solid var(--gold); outline-offset: -2px; }
.dash-check { width: 18px; height: 18px; margin: 8px 10px; cursor: pointer; accent-color: var(--gold); }
.dash-api { display: flex; align-items: center; gap: 6px; padding: 4px 6px; }
.dash-api .dash-ref { flex: 1; min-width: 90px; padding: 6px 7px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.dash-badge {
  flex-shrink: 0; font-size: 12px; font-weight: 700; padding: 3px 7px; border-radius: 999px;
  white-space: nowrap;
}
.dash-badge.ok { color: var(--green); background: color-mix(in srgb, var(--green) 16%, transparent); }
.dash-badge.no { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.dash-badge.part { color: var(--gold); background: var(--gold-soft); }
.dash-badge.muted { color: var(--text-dim); }
.dash-rowdel { width: 34px; text-align: center; background: var(--bg-raise); }
.dash-hint { color: var(--text-dim); padding: 14px; }

/* ==========================================================================
   Module Personnages
   ========================================================================== */
.chr-layout { flex: 1; min-height: 0; display: flex; overflow: hidden; }

/* ---- Menu gauche : portraits ---- */
.chr-sidebar {
  width: 290px; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--bg-raise);
}
.chr-list { flex: 1; overflow-y: auto; padding: 10px 8px 30px; display: flex; flex-direction: column; gap: 4px; }
.chr-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 7px 9px; border-radius: 10px; border: 1px solid transparent;
  background: none; color: var(--text); text-align: left; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.chr-item:hover { background: var(--bg-hover); }
.chr-item.selected { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.chr-item-text { display: flex; flex-direction: column; min-width: 0; }
.chr-item-text strong { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chr-item-text small { font-size: 11.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chr-portrait {
  --pc: var(--gold);
  position: relative; flex-shrink: 0; width: 46px; height: 46px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--pc) 38%, transparent), var(--bg) 75%);
  border: 2px solid color-mix(in srgb, var(--pc) 55%, var(--line));
}
.chr-item.selected .chr-portrait { border-color: var(--gold); }
.chr-portrait img.is-icon { width: 76%; height: 76%; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.chr-portrait img.is-photo { width: 100%; height: 100%; object-fit: cover; }
.chr-portrait-ph { font-family: var(--font-display); font-size: 20px; color: var(--pc); }
.chr-portrait.lg { width: 76px; height: 76px; border-radius: 16px; }

/* ---- Corps ---- */
.chr-main { flex: 1; overflow-y: auto; }
.chr-sheet { padding: 20px 24px 40px; }
.chr-head { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.chr-head-portrait { position: relative; }
.chr-portrait-btn { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 16px; display: block; }
.chr-portrait-edit {
  position: absolute; inset: auto 0 0 0; padding: 3px 0; border-radius: 0 0 14px 14px;
  background: rgba(10, 11, 15, .75); color: var(--text); font-size: 10.5px; text-align: center;
  opacity: 0; transition: opacity .15s;
}
.chr-portrait-btn:hover .chr-portrait-edit, .chr-portrait-btn:focus-visible .chr-portrait-edit { opacity: 1; }
.chr-portrait-del {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-raise); color: var(--text-dim);
  font-size: 10px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.chr-head-portrait:hover .chr-portrait-del, .chr-portrait-del:focus-visible { opacity: 1; }
.chr-portrait-del:hover { color: var(--danger); border-color: var(--danger); }
.chr-kicker { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); }
.chr-id { min-width: 0; }
.chr-id h1 { margin: 0; font-size: 26px; font-weight: 600; line-height: 1.15; }
.chr-meta { font-size: 13px; color: var(--text-dim); }
.chr-extra { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.chr-chip {
  font-size: 11.5px; color: var(--text); background: var(--bg-raise);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
}

/* Équipement : même largeur qu'avec l'ancien menu de 250 px (+40 px rendus
   au calcul) ; les 40 px pris par le menu de 290 px sont retirés au Build. */
.chr-panels {
  --menu-delta: 40px;
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: calc((100% + var(--menu-delta) - 16px) * 1.2 / 2.2) minmax(0, 1fr);
}
.chr-panel { background: var(--bg-raise); border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 18px; min-width: 0; container-type: inline-size; }
.chr-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chr-panel-head h2 { margin: 1.5px 0 0; font-size: 18px; font-weight: 600; }
.chr-panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chr-tabs { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.chr-tab {
  position: relative; min-width: 26px; height: 24px; border: 0; border-radius: 6px;
  background: none; color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer;
}
.chr-tab:hover { color: var(--text); background: var(--bg-hover); }
.chr-tab.is-sel { background: var(--gold-soft); color: var(--gold); }
/* Onglet non débloqué : grisé, non cliquable */
.chr-tab.is-locked {
  color: var(--text-dim); opacity: .3; filter: grayscale(1); cursor: not-allowed;
}
.chr-tab.is-locked:hover { background: none; color: var(--text-dim); }
/* Onglet actif en jeu : petit tick vert en bas à droite */
.chr-tab-live {
  position: absolute; right: 1px; bottom: 0; font-size: 9px; font-weight: 800; line-height: 1;
  color: var(--green); text-shadow: 0 0 2px var(--bg);
}
.chr-sec {
  margin: 8px 0; padding-bottom: 6px; border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim);
}

/* ---- Métiers : grille 5 × 2, 76 px de haut (comme le portrait) ---- */
.chr-crafts {
  margin-left: auto; flex-shrink: 0; box-sizing: border-box; height: 76px;
  display: grid; grid-template-columns: repeat(5, 32px); grid-template-rows: repeat(2, 32px);
  gap: 4px 6px; align-content: center; padding: 0 8px;
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: 10px;
}
.craft-cell {
  position: relative; width: 32px; height: 32px; border-radius: 6px; cursor: default;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--line); color: var(--text-dim);
}
.craft-cell img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 5px; }
.craft-cell > img, .craft-cell > svg { filter: grayscale(1) brightness(.55); }
.craft-cell.is-active { border-color: color-mix(in srgb, var(--gold) 70%, transparent); color: var(--gold); }
.craft-cell.is-active > img, .craft-cell.is-active > svg { filter: none; }
.craft-cell.is-none { opacity: .55; }
.craft-lvl {
  position: absolute; right: -4px; bottom: -4px; padding: 0 3px; border-radius: 4px;
  font-size: 9px; line-height: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--bg-raise); border: 1px solid var(--line); color: var(--text-dim);
}
.craft-cell.is-active .craft-lvl { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, transparent); }

/* ---- Cartes d'équipement ---- */
.eq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; }
/* Hauteur commune : celle de la carte la plus haute (calculée en JS). */
.eq-card { min-height: 90px; box-sizing: border-box; }
.eq-stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.eq-card {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 40%); gap: 10px; align-items: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 0px 10px; min-width: 0;
}
.eq-card.no-side { grid-template-columns: 44px minmax(0, 1fr); }
.eq-card.is-empty { opacity: .5; grid-template-columns: 44px minmax(0, 1fr); }
.eq-icon {
  --rc: var(--line);
  width: 44px; height: 44px; border-radius: 7px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--rc) 70%, transparent); background: var(--bg-raise);
}
.eq-card.is-empty .eq-icon { border-style: dashed; border-color: var(--line); }
.eq-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.eq-info { min-width: 0; }
.eq-slot { font-size: 11px; color: var(--text-dim); }
.eq-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; margin: 1px 0; cursor: default; }
.eq-stat { font-size: 11.5px; color: var(--text-dim); }
.eq-side {
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
  padding-left: 10px; border-left: 1px solid var(--line);
}
.eq-up { --rc: var(--text); display: flex; align-items: center; gap: 6px; font-size: 11px; line-height: 1.2; color: var(--rc); min-width: 0; cursor: default; }
.eq-up img, .eq-mini-ph { width: 22px; height: 22px; flex-shrink: 0; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--rc) 60%, transparent); box-sizing: border-box; }
.eq-up span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
/* Infusions empilées, une par ligne */
.eq-infs { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.eq-inf {
  display: inline-flex; align-items: center; gap: 4px; cursor: default;
}
.eq-inf img { width: 22px; height: 22px; border-radius: 3px; border: 1px solid color-mix(in srgb, var(--rc, var(--line)) 60%, transparent); box-sizing: border-box; }
.eq-inf b { font-size: 11.5px; font-weight: 600; }
.eq-inf-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.eq-inf small { font-size: 10.5px; color: var(--text-dim); }
.eq-inf-ph {
  width: 22px; height: 22px; flex-shrink: 0; box-sizing: border-box;
  border-radius: 3px; border: 1px dashed var(--line); background: var(--bg-raise);
}
.eq-inf.is-empty { opacity: .7; }

/* Armes : une arme à deux mains occupe la hauteur de deux cartes. */
.eq-grid.is-weapons { align-items: stretch; }
.eq-card.is-2h { flex: 1; min-height: calc(2 * 90px + 8px); }
/* Carte sur toute la largeur de la grille (relique, arme à deux mains sans 2e jeu). */
.eq-card.is-wide { grid-column: 1 / -1; }
.eq-card.is-wide { grid-template-columns: 44px minmax(0, 1fr) minmax(0, 52%); }
.eq-relic { font-size: 12px; line-height: 1.4; color: var(--text); }
/* Relique : l'effet commence juste après le nom (colonne du nom ajustée à son contenu). */
.eq-card.is-relic { grid-template-columns: 44px fit-content(45%) minmax(0, 1fr); }

/* ---- Compétences ---- */
/* Barre de compétences verticale, à gauche des spécialisations */
/* La barre prend la hauteur des spécialisations (fixée en JS) ; la taille
   des icônes (--sk) est ajustée pour tenir dans cette hauteur. */
.build-body { display: flex; gap: 10px; align-items: flex-start; }
.build-body .spec-lines { flex: 1; min-width: 0; }
.sk-col {
  --sk: 36px;
  flex-shrink: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; gap: 4px; box-sizing: border-box;
  padding: 6px 5px; border-radius: 6px; background: #120f0d; border: 1px solid #4a3a2c;
}
.sk-sets { display: flex; gap: 2px; margin-bottom: 2px; }
.sk-set {
  width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; cursor: pointer;
  background: none; color: var(--text-dim); font-size: 10.5px; font-weight: 700;
}
.sk-set:hover:not(:disabled) { color: var(--text); background: var(--bg-hover); }
.sk-set.is-sel { color: var(--gold); background: var(--gold-soft); }
.sk-set:disabled { opacity: .3; cursor: not-allowed; }
.sk-ico {
  width: var(--sk); height: var(--sk); flex-shrink: 0; border-radius: 4px; overflow: hidden; cursor: default;
  background: #1b1512; box-shadow: 0 0 0 1px rgba(0, 0, 0, .9), inset 0 0 0 1px #4a3a2c;
}
.sk-ico img { width: 100%; height: 100%; display: block; }
.sk-ico.is-empty { opacity: .45; }
.sk-sep { width: 24px; height: 1px; margin: 3px 0; background: #5a4632; }
.chr-subrow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.chr-subrow-lbl { font-size: 11px; color: var(--text-dim); margin-right: 2px; }
.chr-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px 2px 3px; cursor: default;
}
.chr-pill img { width: 20px; height: 20px; border-radius: 50%; }

/* ---- Lignes de spécialisation (style du jeu) ---- */
.spec-lines {
  display: flex; flex-direction: column; gap: 4px;
  padding: 4px; border-radius: 6px; background: #120f0d;
  border: 1px solid #4a3a2c;
}
.spec-line {
  position: relative; height: 150px; overflow: hidden; border-radius: 3px;
  border: 1px solid #3b2e24; background: #1d1612;
  box-shadow: inset 0 0 0 1px rgba(255, 220, 170, .04);
}
/* Même hauteur qu'une ligne remplie : la mise en page ne bouge pas. */
.spec-line.is-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 13px;
}
/* Illustration : pleine ligne, assombrie ; copie claire dans l'hexagone. */
.spec-art { position: absolute; max-width: none; pointer-events: none; user-select: none;
  filter: brightness(.5) saturate(.85); }
.spec-win { position: absolute; inset: 0; pointer-events: none; }
.spec-shade { position: absolute; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, rgba(18, 13, 10, .82) 0%, rgba(18, 13, 10, .6) 45%, rgba(18, 13, 10, 0) 72%); }
.spec-win .spec-art { filter: none; }
.spec-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.spec-frame polygon {
  fill: none; stroke: #e6d2b5; stroke-width: 2.5;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, .9)) drop-shadow(0 0 6px rgba(255, 225, 185, .35));
}
.spec-hit { position: absolute; z-index: 1; cursor: default; }
/* Nom de la spécialisation, centré sous l'emblème */
.spec-name {
  position: absolute; z-index: 2; transform: translateX(-50%);
  font-size: 12px; font-weight: 600; color: #f1e6d6; white-space: nowrap; pointer-events: none;
  text-shadow: 0 1px 3px #000, 0 0 6px rgba(0, 0, 0, .9);
}

/* Liens entre aptitudes : trait blanc lumineux en pointillés */
.spec-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.spec-links line {
  stroke: rgba(255, 246, 230, .85); stroke-width: 1.6; stroke-dasharray: 5 3; stroke-linecap: round;
  filter: drop-shadow(0 0 2px rgba(255, 230, 190, .9));
}

/* Insigne d'élite, en bas de l'hexagone */
.spec-elite {
  position: absolute; z-index: 2; transform: translate(-50%, -50%); width: 22px; height: 25px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: #e6d2b5; display: flex; align-items: center; justify-content: center;
}
.spec-elite::before {
  content: ""; position: absolute; inset: 2px; background: #1b1512;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.spec-elite img { position: relative; width: 14px; height: 14px; }

/* Aptitudes */
.tr-node {
  position: absolute; z-index: 1; transform: translate(-50%, -50%); cursor: default;
  display: block; overflow: hidden; background: #15100d;
}
.tr-node img { width: 100%; height: 100%; display: block; object-fit: cover; }
/* Majeures : tuiles carrées ; non choisies = sombres et désaturées */
.tr-node.major {
  width: 36px; height: 36px; border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .8), 0 2px 4px rgba(0, 0, 0, .6);
}
.tr-node.major img { filter: grayscale(1) brightness(.42) contrast(1.1); transition: filter .12s; }
.tr-node.major:hover img { filter: grayscale(.3) brightness(.85); }
.tr-node.major.is-sel {
  box-shadow: 0 0 0 1px rgba(255, 228, 196, .9), 0 0 10px rgba(255, 214, 170, .55), 0 2px 5px rgba(0, 0, 0, .7);
}
.tr-node.major.is-sel img { filter: none; }
/* Mineures : hexagones (toujours actives) */
.tr-node.minor {
  width: 34px; height: 38px; background: #d8c3a8;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.tr-node.minor img {
  position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

/* ---- Colonne de droite : Build + Statistiques (hauteur de leur contenu) ---- */
.chr-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.st-panel { padding: 0; }
.st-scroll { padding: 16px 16px 18px; }
.st-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
/* Attribut sur une ligne (sans carte) : icône, nom, valeur, écart. */
.st-row {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto; align-items: center; gap: 5px;
  padding: 5px 4px; border-radius: 6px; font-size: 12.5px; cursor: default; min-width: 0;
}
.st-row > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Séparateurs verticaux continus entre les 3 colonnes d'attributs */
.st-grid .st-row { border-radius: 0; padding: 4px 10px; }
.st-grid .st-row:nth-child(3n + 1) { padding-left: 4px; }
.st-grid .st-row:nth-child(3n) { padding-right: 4px; }
.st-grid .st-row:not(:nth-child(3n + 1)) { border-left: 1px solid var(--line); }
.st-row .st-ico { width: 18px; height: 18px; font-size: 10px; border-radius: 4px; }
.st-row .st-d { font-size: 10.5px; }
.st-row:hover { background: var(--bg-hover); }
.st-ico { width: 20px; height: 20px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #15161b; }
.st-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.st-d { font-size: 11.5px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.st-d.up { color: var(--green); } .st-d.down { color: var(--danger); }
.st-derived { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.st-title { margin: 8px 0; font-size: 18px; font-weight: 600; }
.st-chip { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; min-width: 0; }
.st-chip small { display: block; font-size: 10.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-chip b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.st-chip .st-d { margin-left: 5px; }
.st-break { width: 100%; border-collapse: collapse; margin-top: 6px; }
.st-break td { padding: 2px 0; } .st-break td:last-child { text-align: right; padding-left: 14px; font-variant-numeric: tabular-nums; }
.st-break tr.sub td { font-size: 11.5px; color: var(--text-dim); padding-left: 8px; }
.st-break tr.tot td { border-top: 1px solid var(--line); padding-top: 5px; font-weight: 600; color: var(--gold); }
/* Outils : intitulés puis 3 rangées de cartes de même hauteur. */
/* Outils : intitulés puis 3 rangées de cartes de même hauteur. */
.tl-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto; grid-auto-rows: 1fr; gap: 6px 10px;
}
.tl-head { margin: 0; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }
.tl-card {
  display: flex; align-items: center; gap: 8px; padding: 6px 7px; min-width: 0; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; cursor: default;
}
.tl-ic {
  --rc: var(--line); width: 34px; height: 34px; flex-shrink: 0; border-radius: 6px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--rc) 70%, transparent); background: var(--bg-raise);
}
.tl-ic img { width: 100%; height: 100%; display: block; }
.tl-tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.tl-tx small { font-size: 10.5px; color: var(--text-dim); }
.tl-tx b { font-size: 12px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tl-tx em { font-style: normal; font-size: 10.5px; color: var(--gold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-card.is-empty { opacity: .5; } .tl-card.is-empty .tl-ic { border-style: dashed; }
/* Panneau étroit : le nom de l'attribut est masqué (icône + infobulle). */
@container (max-width: 500px) {
  .st-row { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .st-row > span:nth-child(2) { display: none; }
}
@container (max-width: 560px) {
  .st-derived { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Infobulle ---- */
.gw-tip {
  position: fixed; z-index: 1000; display: none; max-width: 320px;
  background: #0f1015; color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,.55); padding: 10px 12px; font-size: 12.5px; line-height: 1.45;
  pointer-events: none;
}
.gw-tip.open { display: block; }
.tip-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.tip-line { color: var(--text-dim); font-size: 12px; }
.tip-desc { color: var(--text); margin-top: 4px; }
.tip-sub { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.tip-sub b { font-weight: 600; }
.tip-bonus { margin: 4px 0 0; padding-left: 18px; color: var(--text-dim); }

/* Panneau étroit : compétences en colonne (icône au-dessus du nom),
   équipement sur une colonne. */
@container (max-width: 520px) {
  .eq-grid { grid-template-columns: 1fr; }
  .spec-line { height: 112px; }
  .tr-node.major { width: 28px; height: 28px; }
  .tr-node.minor { width: 26px; height: 30px; }
}
@media (max-width: 1250px) {
  .chr-panels { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .chr-head { flex-wrap: wrap; }
  .chr-crafts { margin-left: 0; }
  .chr-layout { flex-direction: column; }
  .chr-sidebar { width: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .chr-list { flex-direction: row; overflow-x: auto; padding: 8px; }
  .chr-item { width: auto; flex-shrink: 0; }
  .chr-item-text { display: none; }
  .eq-grid { grid-template-columns: 1fr; }
}

/* Icône « personnage » (SVG) alignée comme un glyphe texte. */
.ico-person { display: inline-block; vertical-align: -0.12em; }

/* ==========================================================================
   Module Ressources
   ========================================================================== */
.res-layout { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.res-sidebar {
  width: 290px; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--bg-raise);
}
#res-filter {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 9px 12px;
}
#res-filter:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.res-side-sec {
  margin: 10px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-dim);
}
.res-side-sec:first-child { margin-top: 2px; }
.res-glyph { font-size: 20px; color: var(--gold); --pc: var(--gold); }
.res-item.is-dim { opacity: .45; }
.res-item small.res-hit { color: var(--gold); }
.res-side-warn { margin: 12px 8px 0; font-size: 12px; color: var(--ember); }
.res-main { flex: 1; overflow-y: auto; }
.res-sheet { padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 16px; }
.res-warn { padding: 9px 12px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--ember) 50%, transparent); color: var(--ember); font-size: 13px; }
.res-head-note { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; white-space: nowrap; }
.res-none { color: var(--text-dim); margin: 6px 0 0; font-size: 13px; }

/* Emplacement d'objet, façon inventaire du jeu */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, 48px); gap: 4px; }
.res-grid.is-10 { grid-template-columns: repeat(10, 48px); }
.res-slot {
  --rc: var(--line);
  position: relative; width: 48px; height: 48px; border-radius: 6px; overflow: hidden;
  background: #0f1015; border: 1px solid color-mix(in srgb, var(--rc) 70%, transparent);
  transition: opacity .12s, box-shadow .12s;
}
.res-slot img { width: 100%; height: 100%; display: block; object-fit: cover; }
.res-slot.is-empty { border-color: var(--line); background: color-mix(in srgb, #0f1015 70%, var(--bg-raise)); }
.res-slot.is-dim { opacity: .22; }
.res-slot.is-hit { box-shadow: 0 0 0 2px var(--gold); }
.res-slot.is-sm { width: 36px; height: 36px; flex-shrink: 0; }
.res-cnt {
  position: absolute; right: 3px; bottom: 1px; font-size: 12px; font-weight: 600; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 2px #000, 0 1px 1px #000; pointer-events: none;
}

/* Banque : onglets de 30 emplacements côte à côte */
.res-bank { display: flex; flex-wrap: wrap; gap: 6px 28px; }
.res-bank-tab .chr-sec { margin-top: 4px; }

/* Matériaux / sacs */
.res-mat-cat + .res-mat-cat, .res-bag + .res-bag { margin-top: 14px; }
.chr-sec span { float: right; letter-spacing: 0; text-transform: none; font-weight: 500; }
.res-bag-head { display: flex; align-items: center; gap: 8px; }
.res-bag-head span:last-child { margin-left: auto; float: none; }
.res-bag-ic {
  --rc: var(--line); width: 22px; height: 22px; border-radius: 4px; overflow: hidden; flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--rc) 70%, transparent); background: #0f1015;
}
.res-bag-ic img { width: 100%; height: 100%; display: block; }
.res-bag.is-none .chr-sec { opacity: .6; }
.res-char-head { align-items: center; justify-content: flex-start; gap: 12px; }
.res-char-head h2 { margin: 0; }
.res-char-head small { color: var(--text-dim); font-size: 12.5px; }
.res-char-head .res-head-note { margin-left: auto; }

/* Devises */
.res-wallet { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.res-cur {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--line); min-width: 0;
}
.res-cur-ic { width: 28px; height: 28px; flex-shrink: 0; }
.res-cur-ic img { width: 100%; height: 100%; display: block; }
.res-cur-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-cur-val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Pièces : or / argent / cuivre */
.res-coins { display: inline-flex; gap: 7px; align-items: center; }
.res-coin { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.res-coin i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: inset 0 -1px 0 rgba(0,0,0,.35); }
.res-coin.is-g i { background: #f2c12e; }
.res-coin.is-s i { background: #c9ccd3; }
.res-coin.is-c i { background: #c27a3e; }

/* Vue d'ensemble */
.res-rows { display: flex; flex-direction: column; }
.res-row {
  display: grid; grid-template-columns: 36px minmax(160px, 260px) minmax(0, 1fr) 80px;
  align-items: center; gap: 12px; padding: 5px 4px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.res-row:last-child { border-bottom: 0; }
.res-row-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-row-where { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.res-chip {
  font-size: 11.5px; color: var(--text-dim); background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.res-chip b { color: var(--text); font-weight: 600; }
.res-row-total { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.res-tip-tbl { width: 100%; margin-top: 3px; border-collapse: collapse; font-size: 12px; }
.res-tip-tbl td { padding: 1px 0; color: var(--text-dim); }
.res-tip-tbl td:last-child { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; padding-left: 14px; }
.summary-item .res-coins { font-size: inherit; }

@media (max-width: 900px) {
  .res-layout { flex-direction: column; }
  .res-sidebar { width: 100%; max-height: 40vh; }
  .res-grid.is-10 { grid-template-columns: repeat(auto-fill, 48px); }
  .res-row { grid-template-columns: 36px minmax(0, 1fr) 70px; }
  .res-row-where { grid-column: 2 / -1; }
}

/* Écran de connexion : compte connecté, export/import des réglages */
.setup-account { margin: 4px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.setup-account-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.setup-account-row + .setup-account-row { margin-top: 10px; }
.setup-account-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.setup-hint { color: var(--text-dim); font-size: 12.5px; margin: 0; }
#prefs-status:empty { display: none; }
#prefs-status { margin-top: 8px; }
.setup-sep { margin: 14px 0 0; font-weight: 600; }
.setup-privacy { color: var(--text-dim); font-size: 12px; margin-top: 10px; }
