/* ══════════════════════════════════════════════════
   tresor.css — Tresor de sorts D&D 5.5
   7 variantes de cartes : 1a illuminate · 1b TCG
   1c compact · 1d dense · 1e library · 2a tarot-dark
   2b tarot-parch
   ══════════════════════════════════════════════════ */

/* ── Variables écoles ─────────────────────────────── */
:root {
  --sch-abjuration:    #4A7BB5;
  --sch-invocation:    #C9A227;
  --sch-divination:    #5FA8A0;
  --sch-enchantement:  #B65A8C;
  --sch-evocation:     #B23A2B;
  --sch-illusion:      #8A5FB5;
  --sch-necromancie:   #4E8A5B;
  --sch-transmutation: #C07A3A;
  --sch-universal:     #9AA1B0;

  /* palette tresor — suit le thème de l'app (app.css / app_themes.css),
     avec repli sur l'ancienne palette sombre si les variables sont absentes. */
  --tres-gold:     var(--gold, #E3B23C);
  --tres-gold-l:   var(--gold-light, #F6D684);
  --tres-gold-d:   var(--gold-dark, #9C7A22);
  --tres-bg:       var(--bg-void, #0C0E13);
  --tres-bg2:      var(--bg-panel, #141821);
  --tres-bg3:      var(--bg-card, #1B212C);
  --tres-bg-hover: var(--bg-hover, #222B39);
  --tres-border:   var(--border-dark, #283041);
  --tres-border2:  var(--border-gold, #3B455A);
  --tres-text:     var(--text-parchment, #ECE9E1);
  --tres-muted:    var(--text-muted, #9AA1B0);
  --tres-dim:      var(--text-dim, #5C6677);
}

/* ── Page layout ─────────────────────────────────── */
.tres-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--tres-bg);
  color: var(--tres-text);
  font-family: 'Crimson Text', serif;
}

/* ── Rail gauche ─────────────────────────────────── */
.tres-rail {
  width: 56px;
  flex: none;
  background: linear-gradient(180deg, var(--tres-bg2), var(--tres-bg));
  border-right: 1px solid var(--tres-border2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 0 16px;
  overflow: hidden;
}
.tres-rail-logo {
  font-size: 22px;
  margin-bottom: 6px;
  line-height: 1;
}
.tres-rail-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  transition: background .15s;
  color: var(--tres-muted);
  border: none;
  background: transparent;
}
.tres-rail-btn:hover { background: rgba(255,255,255,.07); }
.tres-rail-btn.active {
  background: var(--tres-gold);
  color: var(--tres-bg);
  box-shadow: 0 0 14px var(--gold-glow, rgba(227,178,60,.35));
}

/* ── Body (rail + main) ──────────────────────────── */
.tres-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}
.tres-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Barre de filtres ────────────────────────────── */
.tres-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--tres-border);
  background: var(--tres-bg2);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.tres-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--tres-gold);
  margin-right: 4px;
  white-space: nowrap;
}
.tres-search {
  flex: 1;
  min-width: 140px;
  max-width: 260px;
  background: var(--tres-bg3);
  border: 1px solid var(--tres-border);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 14px;
  color: var(--tres-text);
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.tres-search:focus { border-color: var(--tres-gold); }
.tres-search::placeholder { color: var(--tres-dim); }

.tres-filter-levels {
  display: flex;
  gap: 4px;
}
.tres-lvl-btn {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid var(--tres-border);
  background: transparent;
  color: var(--tres-muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.tres-lvl-btn:hover { background: rgba(255,255,255,.05); }
.tres-lvl-btn.active {
  background: var(--tres-gold);
  color: var(--tres-bg);
  border-color: var(--tres-gold);
}

.tres-filter-select {
  background: var(--tres-bg3);
  border: 1px solid var(--tres-border);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 13px;
  color: var(--tres-muted);
  cursor: pointer;
  font-family: inherit;
  outline: none;
}
.tres-filter-select:focus { border-color: var(--tres-gold); }

.tres-filter-toggle {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 99px;
  border: 1px solid var(--tres-border);
  background: transparent;
  color: var(--tres-muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
}
.tres-filter-toggle.active {
  background: rgba(227,178,60,.12);
  border-color: var(--tres-gold-d);
  color: var(--tres-gold-l);
}

/* Vue sélecteur */
.tres-view-btns {
  display: flex;
  gap: 3px;
  margin-left: auto;
  flex-shrink: 0;
}
.tres-view-btn {
  width: 30px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--tres-border);
  background: transparent;
  color: var(--tres-dim);
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tres-view-btn:hover { background: rgba(255,255,255,.05); color: var(--tres-muted); }
.tres-view-btn.active {
  background: rgba(227,178,60,.15);
  border-color: var(--tres-gold-d);
  color: var(--tres-gold);
}

/* ── Scroll area ─────────────────────────────────── */
.tres-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 32px;
  min-height: 0;
}
.tres-scroll::-webkit-scrollbar { width: 6px; }
.tres-scroll::-webkit-scrollbar-track { background: transparent; }
.tres-scroll::-webkit-scrollbar-thumb { background: var(--tres-border2); border-radius: 3px; }

/* ── Section sorts préparés ─────────────────────── */
.tres-prepared-section {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(227,178,60,.07), transparent);
  border-bottom: 1px solid rgba(227,178,60,.15);
}
.tres-prepared-hdr {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.tres-prepared-label {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--tres-gold);
}
.tres-prepared-info {
  font-size: 13px;
  color: var(--tres-dim);
}
.tres-prepared-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.tres-prepared-strip::-webkit-scrollbar { height: 3px; }
.tres-prepared-strip::-webkit-scrollbar-thumb { background: var(--tres-border2); }

.tres-prep-card {
  flex: none;
  width: 148px;
  background: var(--tres-bg3);
  border: 1px solid var(--tres-gold-d);
  border-radius: 10px;
  padding: 9px 11px;
  box-shadow: 0 0 12px rgba(227,178,60,.10);
  cursor: pointer;
  transition: box-shadow .15s, transform .12s;
}
.tres-prep-card:hover {
  box-shadow: 0 0 20px rgba(227,178,60,.22);
  transform: translateY(-1px);
}
.tres-prep-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.tres-prep-card-name {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: var(--tres-text);
  line-height: 1.2;
}
.tres-prep-card-sub {
  font-size: 12px;
  color: var(--tres-dim);
  margin-top: 2px;
}
.tres-prep-placeholder {
  flex: none;
  width: 148px;
  border: 1px dashed var(--tres-border2);
  border-radius: 10px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tres-dim);
  font-size: 13px;
  cursor: pointer;
}

/* ── Résultats header ────────────────────────────── */
.tres-results-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.tres-results-count {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--tres-muted);
}
.tres-col-select {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  background: var(--tres-bg3);
  border: 1px solid var(--tres-border);
  border-radius: 6px;
  padding: 3px 7px;
  color: var(--tres-muted);
  cursor: pointer;
}

/* ── Grille ──────────────────────────────────────── */
.tres-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(var(--tres-cols, 3), 1fr);
}
@media (max-width: 900px) {
  .tres-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .tres-grid { grid-template-columns: 1fr; }
}

/* Groupes de niveau pour vue liste dense */
.tres-level-group {
  margin-bottom: 18px;
}
.tres-level-hdr {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--tres-gold);
  padding: 8px 14px 5px;
  border-bottom: 1px solid var(--tres-border);
  background: var(--tres-bg3);
  border-radius: 8px 8px 0 0;
}
.tres-dense-list {
  background: var(--tres-bg2);
  border: 1px solid var(--tres-border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

/* ════════════════════════════════════════════════════
   VARIANTE 1a — Carte enluminée (parchemin + or)
   ════════════════════════════════════════════════════ */
.tres-card-illuminate {
  border-radius: 14px;
  padding: 6px;
  background: linear-gradient(160deg, #9C7A22, #E3B23C 30%, #9C7A22 70%, #6E5518);
  box-shadow: 0 12px 36px rgba(0,0,0,.55);
  cursor: pointer;
  transition: transform .14s, box-shadow .14s;
  /* La grille étire les cartes à hauteur de ligne égale : l'inner doit REMPLIR la
     carte (sinon le fond doré déborde en bas = « barre » sur les textes courts). */
  display: flex;
}
.tres-card-illuminate:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 50px rgba(0,0,0,.65);
}
.tres-card-illuminate .tres-ci-inner {
  flex: 1;                 /* remplit la carte étirée → bordure dorée uniforme */
  border-radius: 9px;
  background: linear-gradient(175deg, #F3EBD8, #EAE0C6 60%, #E3D7B8);
  color: #2A2318;
  padding: 18px 20px 14px;
  position: relative;
  border: 1px solid rgba(120,90,30,.35);
}
.tres-card-illuminate .tres-ci-stripe {
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 5px;
  border-radius: 0 4px 4px 0;
}
.tres-card-illuminate .tres-ci-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding-left: 10px;
}
.tres-card-illuminate .tres-ci-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 20px;
  color: #3B2E14;
}
.tres-card-illuminate .tres-ci-level {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 18px;
  flex: none;
}
.tres-card-illuminate .tres-ci-school {
  font-style: italic;
  font-size: 14px;
  color: #7A6A45;
  margin-top: 1px;
  padding-left: 10px;
}
.tres-card-illuminate .tres-ci-img {
  margin-top: 10px;
  height: 110px;
  border: 1px solid #9C7A22;
  border-radius: 6px;
  box-shadow: inset 0 0 0 3px #EAE0C6, inset 0 0 0 4px rgba(156,122,34,.5);
  background: repeating-linear-gradient(45deg, #E6DBBE, #E6DBBE 10px, #DFD2AE 10px, #DFD2AE 20px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.tres-card-illuminate .tres-ci-img img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 5px;
}
.tres-card-illuminate .tres-ci-img-placeholder {
  font-size: 12px;
  color: #7A6A45;
  background: rgba(243,235,216,.85);
  border: 1px solid rgba(156,122,34,.4);
  padding: 3px 9px;
  border-radius: 4px;
}
.tres-card-illuminate .tres-ci-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #9C7A22, transparent);
  margin: 10px 0;
}
.tres-card-illuminate .tres-ci-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  font-size: 14px;
  color: #2A2318;
}
.tres-card-illuminate .tres-ci-stat-label {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .08em;
  color: #9C7A22;
  display: block;
}
.tres-card-illuminate .tres-ci-desc {
  font-size: 14px;
  line-height: 1.42;
  text-align: justify;
  color: #2A2318;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tres-card-illuminate .tres-ci-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 12px;
  color: #7A6A45;
}
.tres-card-illuminate .tres-ci-classes {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tres-card-illuminate .tres-ci-class-chip {
  border: 1px solid #B8A878;
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 11px;
}
.tres-card-illuminate .tres-ci-fav {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #9C7A22;
  padding: 2px 4px;
  line-height: 1;
}

/* ════════════════════════════════════════════════════
   VARIANTE 1b — Carte TCG (illustrée)
   ════════════════════════════════════════════════════ */
.tres-card-tcg {
  aspect-ratio: 63.5 / 88.9;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  border-radius: 14px;
  padding: 7px;
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform .14s, box-shadow .14s;
}
.tres-card-tcg:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 54px rgba(0,0,0,.7);
}
.tres-card-tcg .tres-tcg-inner {
  flex: 1;
  border-radius: 9px;
  background: var(--tres-bg2);
  border: 1px solid rgba(236,233,225,.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tres-card-tcg .tres-tcg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
}
.tres-card-tcg .tres-tcg-level-badge {
  width: 30px; height: 30px;
  border-radius: 50%;
  color: var(--tres-bg);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: 0 0 10px currentColor;
}
.tres-card-tcg .tres-tcg-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--tres-text);
}
.tres-card-tcg .tres-tcg-img {
  height: 130px;
  flex: none;
  background: repeating-linear-gradient(45deg, var(--tres-bg3), var(--tres-bg3) 10px, var(--tres-bg-hover) 10px, var(--tres-bg-hover) 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-block: 1px solid rgba(236,233,225,.09);
  overflow: hidden;
  position: relative;
}
.tres-card-tcg .tres-tcg-img img { width: 100%; height: 100%; object-fit: cover; }
.tres-card-tcg .tres-tcg-img-placeholder {
  font-size: 12px;
  color: var(--tres-muted);
  background: rgba(12,14,19,.7);
  padding: 3px 9px;
  border-radius: 4px;
}
.tres-card-tcg .tres-tcg-type {
  display: flex;
  justify-content: space-between;
  padding: 6px 11px;
  font-style: italic;
  font-size: 13px;
  border-bottom: 1px solid rgba(236,233,225,.09);
}
.tres-card-tcg .tres-tcg-stats {
  display: flex;
  gap: 5px;
  padding: 7px 11px;
  font-size: 13px;
  color: var(--tres-muted);
  flex-wrap: wrap;
}
.tres-card-tcg .tres-tcg-stat {
  background: var(--tres-bg-hover);
  border-radius: 5px;
  padding: 2px 7px;
}
.tres-card-tcg .tres-tcg-desc {
  flex: 1;
  padding: 2px 13px 7px;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--tres-text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}
.tres-card-tcg .tres-tcg-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 11px;
  border-top: 1px solid rgba(236,233,225,.09);
  font-size: 11px;
  color: var(--tres-dim);
}
.tres-card-tcg .tres-tcg-school-label {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .06em;
}
.tres-card-tcg .tres-tcg-fav {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

/* ════════════════════════════════════════════════════
   VARIANTE 1c — Fiche compacte (sombre natif)
   ════════════════════════════════════════════════════ */
.tres-card-compact {
  background: var(--tres-bg3);
  border: 1px solid var(--tres-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  cursor: pointer;
  transition: box-shadow .14s, transform .12s;
}
.tres-card-compact:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  transform: translateY(-1px);
}
.tres-card-compact.prepared {
  border-color: var(--tres-gold-d);
  box-shadow: 0 0 16px rgba(227,178,60,.18), 0 6px 20px rgba(0,0,0,.35);
}
.tres-card-compact .tres-cc-stripe { height: 4px; }
.tres-card-compact .tres-cc-body { padding: 12px 14px 10px; }
.tres-card-compact .tres-cc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.tres-card-compact .tres-cc-name {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--tres-text);
}
.tres-card-compact .tres-cc-badges {
  display: flex;
  gap: 5px;
  flex: none;
  align-items: center;
}
.tres-card-compact .tres-cc-badge-conc {
  font-size: 11px;
  font-family: 'Cinzel', serif;
  letter-spacing: .05em;
  color: var(--tres-gold-l);
  border: 1px solid var(--tres-gold-d);
  border-radius: 99px;
  padding: 1px 7px;
}
.tres-card-compact .tres-cc-badge-ritual {
  font-size: 11px;
  font-family: 'Cinzel', serif;
  letter-spacing: .05em;
  color: var(--tres-muted);
  border: 1px solid #3B455A;
  border-radius: 99px;
  padding: 1px 7px;
}
.tres-card-compact .tres-cc-badge-level {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 12px;
  border-radius: 99px;
  padding: 1px 8px;
  color: var(--tres-bg);
}
.tres-card-compact .tres-cc-school {
  font-style: italic;
  font-size: 13px;
  margin-top: 1px;
}
.tres-card-compact .tres-cc-stats {
  display: flex;
  gap: 12px;
  margin-top: 7px;
  font-size: 13.5px;
  color: var(--tres-muted);
  flex-wrap: wrap;
}
.tres-card-compact .tres-cc-desc {
  font-size: 14px;
  line-height: 1.38;
  /* Couleur de thème (lisible en clair ET sombre) au lieu d'un gris fixe #C9C4B6
     qui devenait illisible sur le fond crème du thème clair. Légère opacité pour
     garder la hiérarchie sous le titre sans sacrifier le contraste. */
  color: var(--tres-text);
  opacity: .82;
  margin-top: 7px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tres-card-compact .tres-cc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 9px;
}
.tres-card-compact .tres-cc-classes {
  font-size: 13px;
  color: var(--tres-dim);
}
.tres-card-compact .tres-cc-prep-btn {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .06em;
  border: 1px solid #3B455A;
  border-radius: 8px;
  padding: 4px 10px;
  background: transparent;
  color: var(--tres-gold);
  cursor: pointer;
  transition: all .15s;
}
.tres-card-compact .tres-cc-prep-btn:hover { background: #222B39; border-color: var(--tres-gold); }
.tres-card-compact.prepared .tres-cc-prep-btn {
  background: var(--tres-gold);
  color: #0C0E13;
  border-color: var(--tres-gold);
  box-shadow: 0 0 10px rgba(227,178,60,.4);
}

/* ════════════════════════════════════════════════════
   VARIANTE 1d — Liste dense
   ════════════════════════════════════════════════════ */
.tres-dense-row {
  display: grid;
  /* Colonnes toutes en largeurs fixes ou fr : chaque ligne étant une grille
     indépendante, des colonnes « auto » (dimensionnées au contenu de CHAQUE ligne)
     désalignaient les colonnes entre l'en-tête et les lignes. */
  grid-template-columns: 12px minmax(120px,1.5fr) minmax(90px,.9fr) minmax(100px,1.4fr) 84px 104px 96px 44px 26px;
  gap: 0 12px;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--tres-border);
  font-size: 14.5px;
  cursor: pointer;
  transition: background .12s;
}
.tres-dense-row:last-child { border-bottom: none; }
.tres-dense-row:hover { background: var(--tres-bg-hover); }
.tres-dense-row .tres-dr-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex: none;
}
.tres-dense-row .tres-dr-name { color: var(--tres-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tres-dense-row .tres-dr-school {
  font-family: 'Cinzel', serif; font-size: 12px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tres-dense-row .tres-dr-classes {
  color: var(--tres-muted); font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tres-dense-row .tres-dr-comp { color: var(--tres-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tres-dense-row .tres-dr-time { color: var(--tres-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tres-dense-row .tres-dr-range { color: var(--tres-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* En-tête de colonnes (vue dense) */
.tres-dense-row.tres-dense-head {
  cursor: default;
  font-family: 'Cinzel', serif;
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tres-dim);
  padding-top: 6px; padding-bottom: 6px;
  position: sticky; top: 0;
  background: var(--tres-bg3);
  z-index: 1;
}
.tres-dense-row.tres-dense-head:hover { background: var(--tres-bg3); }
.tres-dense-row .tres-dr-flags {
  text-align: center;
  font-size: 12px;
  color: var(--tres-gold-l);
  white-space: nowrap;
}
.tres-dense-row .tres-dr-fav {
  text-align: center;
  cursor: pointer;
  font-size: 15px;
  background: none;
  border: none;
  color: var(--tres-dim);
  padding: 0;
  line-height: 1;
}
.tres-dense-row .tres-dr-fav.active { color: var(--tres-gold); }

/* ════════════════════════════════════════════════════
   VARIANTE 2a — Tarot sombre
   ════════════════════════════════════════════════════ */
.tres-card-tarot-dark {
  /* Le « Tarot sombre » garde sa propre identité, quel que soit le thème de l'app. */
  --tres-gold: #E3B23C; --tres-gold-l: #F6D684; --tres-gold-d: #9C7A22;
  --tres-text: #ECE9E1; --tres-muted: #9AA1B0; --tres-dim: #5C6677;
  --tres-bg: #0C0E13; --tres-bg2: #141821; --tres-bg3: #1B212C; --tres-border: #283041;
  width: 100%;
  max-width: 470px;
  margin: 0 auto;
  aspect-ratio: 70 / 120;
  border-radius: 18px;
  background: #141821;
  box-shadow: 0 14px 45px rgba(0,0,0,.65);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 46px 20px 20px;
  cursor: pointer;
  transition: transform .14s, box-shadow .14s;
}
.tres-card-tarot-dark:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 60px rgba(0,0,0,.75);
}
/* double border frame */
.tres-card-tarot-dark .tres-td-frame-outer {
  position: absolute; inset: 8px;
  border: 1.5px solid rgba(227,178,60,.8);
  border-radius: 12px;
  pointer-events: none;
}
.tres-card-tarot-dark .tres-td-frame-inner {
  position: absolute; inset: 13px;
  border: 1px solid rgba(227,178,60,.3);
  border-radius: 9px;
  pointer-events: none;
}
/* corner ornements */
.tres-card-tarot-dark .tres-td-corner {
  position: absolute;
  width: 30px; height: 30px;
  pointer-events: none;
}
.tres-card-tarot-dark .tres-td-corner.tl { top: 15px; left: 15px; border-top: 2px solid var(--tres-gold); border-left: 2px solid var(--tres-gold); border-radius: 8px 0 0 0; }
.tres-card-tarot-dark .tres-td-corner.tr { top: 15px; right: 15px; border-top: 2px solid var(--tres-gold); border-right: 2px solid var(--tres-gold); border-radius: 0 8px 0 0; }
.tres-card-tarot-dark .tres-td-corner.bl { bottom: 15px; left: 15px; border-bottom: 2px solid var(--tres-gold); border-left: 2px solid var(--tres-gold); border-radius: 0 0 0 8px; }
.tres-card-tarot-dark .tres-td-corner.br { bottom: 15px; right: 15px; border-bottom: 2px solid var(--tres-gold); border-right: 2px solid var(--tres-gold); border-radius: 0 0 8px 0; }

/* diamond level badge */
.tres-card-tarot-dark .tres-td-level-wrap {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 80px; height: 80px;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.tres-card-tarot-dark .tres-td-level-diamond {
  position: absolute;
  width: 56px; height: 56px;
  transform: rotate(45deg);
  background: #0C0E13;
  border: 2px solid var(--tres-gold);
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(227,178,60,.25);
}
.tres-card-tarot-dark .tres-td-level-text {
  position: relative;
  text-align: center;
}
.tres-card-tarot-dark .tres-td-level-num {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  color: var(--tres-text);
}
.tres-card-tarot-dark .tres-td-level-label {
  font-family: 'Cinzel', serif;
  font-size: 6.5px;
  letter-spacing: .06em;
  color: var(--tres-gold);
}
/* top row */
.tres-card-tarot-dark .tres-td-toprow {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 8px;
}
.tres-card-tarot-dark .tres-td-school-lbl {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .1em;
  color: var(--tres-gold-l);
}
.tres-card-tarot-dark .tres-td-school-sub {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: .08em;
  color: #C9C4B6;
}
/* image */
.tres-card-tarot-dark .tres-td-img {
  margin-top: 10px;
  height: 160px;
  border: 1px solid rgba(227,178,60,.5);
  border-radius: 7px;
  background: repeating-linear-gradient(45deg, #1B212C, #1B212C 12px, #222B39 12px, #222B39 24px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tres-card-tarot-dark .tres-td-img img { width: 100%; height: 100%; object-fit: cover; }
.tres-card-tarot-dark .tres-td-img-ph {
  font-size: 12px; color: #9AA1B0;
  background: rgba(12,14,19,.8); padding: 4px 10px; border-radius: 4px;
}
/* title block */
.tres-card-tarot-dark .tres-td-title-block { text-align: center; margin-top: 12px; }
.tres-card-tarot-dark .tres-td-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 26px;
  color: var(--tres-text);
  letter-spacing: .02em;
}
.tres-card-tarot-dark .tres-td-classes {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--tres-gold-l);
  margin-top: 3px;
}
.tres-card-tarot-dark .tres-td-action {
  font-style: italic;
  font-size: 14px;
  color: #C9C4B6;
  margin-top: 2px;
}
/* divider */
.tres-card-tarot-dark .tres-td-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(227,178,60,.6), transparent);
  margin: 10px 6px;
}
/* desc */
.tres-card-tarot-dark .tres-td-desc {
  font-size: 14px; /* base — ajusté dynamiquement par _fitTarotDescriptions */
  line-height: 1.42;
  color: #D8D4C8;
  text-align: justify;
  padding: 0 6px;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.tres-td-desc.tres-desc-clipped::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 24px; pointer-events: none;
  background: linear-gradient(transparent, #141821);
}
/* foot diamonds */
.tres-card-tarot-dark .tres-td-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  padding: 0 2px;
}
.tres-td-diamond {
  width: 40px; height: 40px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.tres-td-diamond .tres-td-d-bg {
  position: absolute;
  inset: 5px;
  transform: rotate(45deg);
  border-radius: 6px;
}
.tres-td-diamond .tres-td-d-lbl {
  position: relative;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 18px;
}
.tres-td-cartouche {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  background: rgba(20,24,33,.85);
  border: 1px solid rgba(227,178,60,.45);
  border-radius: 7px;
  padding: 5px 3px;
}
.tres-td-cartouche .tres-td-cart-val {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.14;
  color: var(--tres-text);
  overflow-wrap: anywhere;
}
.tres-td-cartouche .tres-td-cart-lbl {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--tres-gold);
}
.tres-td-vsm-wrap {
  width: 90px; height: 60px;
  position: relative;
  flex: none;
}

/* ── SRD badge + page MdJ (haut-droite, partagé dark/parch) ── */
.tres-td-srd {
  display: inline-block;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 11px;
  letter-spacing: .1em;
  color: #0C1A0E; background: #7FB77E;
  border-radius: 5px; padding: 1px 8px;
}
.tres-td-srd-off { background: #C98A8A; color: #2A0E0E; }
.tres-td-page {
  font-family: 'Cinzel', serif; font-size: 10px;
  letter-spacing: .06em; margin-top: 3px;
}
.tres-card-tarot-dark .tres-td-page { color: #C9C4B6; }
.tres-card-tarot-parch .tres-td-page { color: #7A6A45; }

/* ── Ligne composant matériel (sous la description) ── */
.tres-td-material, .tres-tp-material {
  font-size: 11px; font-style: italic; line-height: 1.3;
  padding: 7px 8px 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; flex: none;
}
.tres-td-material { color: var(--tres-gold-l, #E9C765); }
.tres-tp-material { color: #7A5A18; }
.tres-td-mat-icon, .tres-tp-mat-icon { font-style: normal; margin-right: 4px; opacity: .85; }

/* ════════════════════════════════════════════════════
   VARIANTE 2b — Tarot parchemin
   ════════════════════════════════════════════════════ */
.tres-card-tarot-parch {
  /* Le « Tarot parchemin » garde sa propre identité, quel que soit le thème de l'app. */
  --tres-gold: #9C7A22; --tres-gold-l: #B8923A; --tres-gold-d: #6E5518;
  --tres-text: #2A2318; --tres-muted: #7A6A45; --tres-dim: #9A8A65;
  --tres-bg: #EAE0C6; --tres-bg2: #F3EBD8; --tres-bg3: #E3D7B8; --tres-border: #C9B078;
  width: 100%;
  max-width: 470px;
  margin: 0 auto;
  aspect-ratio: 70 / 120;
  border-radius: 18px;
  padding: 6px;
  background: linear-gradient(160deg, #9C7A22, #E3B23C 30%, #9C7A22 70%, #6E5518);
  box-shadow: 0 14px 45px rgba(0,0,0,.65);
  display: flex;
  cursor: pointer;
  transition: transform .14s, box-shadow .14s;
}
.tres-card-tarot-parch:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
}
.tres-card-tarot-parch .tres-tp-inner {
  flex: 1;
  border-radius: 14px;
  background: linear-gradient(175deg, #F3EBD8, #EAE0C6 60%, #E3D7B8);
  color: #2A2318;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 46px 20px 20px;
}
.tres-card-tarot-parch .tres-tp-corner {
  position: absolute;
  width: 30px; height: 30px;
  pointer-events: none;
}
.tres-card-tarot-parch .tres-tp-corner.tl { top: 14px; left: 14px; border-top: 2px solid #9C7A22; border-left: 2px solid #9C7A22; border-radius: 8px 0 0 0; }
.tres-card-tarot-parch .tres-tp-corner.tr { top: 14px; right: 14px; border-top: 2px solid #9C7A22; border-right: 2px solid #9C7A22; border-radius: 0 8px 0 0; }
.tres-card-tarot-parch .tres-tp-corner.bl { bottom: 14px; left: 14px; border-bottom: 2px solid #9C7A22; border-left: 2px solid #9C7A22; border-radius: 0 0 0 8px; }
.tres-card-tarot-parch .tres-tp-corner.br { bottom: 14px; right: 14px; border-bottom: 2px solid #9C7A22; border-right: 2px solid #9C7A22; border-radius: 0 0 8px 0; }

.tres-card-tarot-parch .tres-tp-level-wrap {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 80px; height: 80px;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.tres-card-tarot-parch .tres-tp-level-diamond {
  position: absolute;
  width: 56px; height: 56px;
  transform: rotate(45deg);
  border: 2.5px solid #9C7A22;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(80,50,10,.4);
}
.tres-card-tarot-parch .tres-tp-level-num {
  position: relative;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  text-align: center;
}
.tres-card-tarot-parch .tres-tp-level-label {
  font-family: 'Cinzel', serif;
  font-size: 6.5px;
  letter-spacing: .06em;
  color: #F6EEDA;
  opacity: .92;
  display: block;
  text-align: center;
}
.tres-card-tarot-parch .tres-tp-toprow {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 8px;
}
.tres-card-tarot-parch .tres-tp-school-lbl {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .1em;
  color: #B23A2B;
}
.tres-card-tarot-parch .tres-tp-school-sub {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: .08em;
  color: #7A6A45;
}
.tres-card-tarot-parch .tres-tp-img {
  margin-top: 10px;
  height: 160px;
  border: 1px solid #9C7A22;
  border-radius: 7px;
  box-shadow: inset 0 0 0 3px #EAE0C6, inset 0 0 0 4px rgba(156,122,34,.5);
  background: repeating-linear-gradient(45deg, #E6DBBE, #E6DBBE 12px, #DFD2AE 12px, #DFD2AE 24px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tres-card-tarot-parch .tres-tp-img img { width: 100%; height: 100%; object-fit: cover; }
.tres-card-tarot-parch .tres-tp-img-ph {
  font-size: 12px; color: #7A6A45;
  background: rgba(243,235,216,.85); padding: 4px 10px; border-radius: 4px;
}
.tres-card-tarot-parch .tres-tp-title-block { text-align: center; margin-top: 12px; }
.tres-card-tarot-parch .tres-tp-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 26px;
  color: #3B2E14;
}
.tres-card-tarot-parch .tres-tp-classes {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .14em;
  color: #B23A2B;
  margin-top: 3px;
}
.tres-card-tarot-parch .tres-tp-action { font-style: italic; font-size: 14px; color: #7A6A45; margin-top: 2px; }
.tres-card-tarot-parch .tres-tp-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #9C7A22, transparent);
  margin: 10px 6px;
}
.tres-card-tarot-parch .tres-tp-desc {
  font-size: 14px; /* base — ajusté dynamiquement par _fitTarotDescriptions */
  line-height: 1.42;
  color: #3B2E14;
  text-align: justify;
  padding: 0 6px;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.tres-tp-desc.tres-desc-clipped::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 24px; pointer-events: none;
  background: linear-gradient(transparent, #E3D7B8);
}
.tres-card-tarot-parch .tres-tp-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  padding: 0 2px;
}
.tres-tp-cartouche {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  background: rgba(156,122,34,.1);
  border: 1px solid rgba(156,122,34,.5);
  border-radius: 7px;
  padding: 5px 3px;
}
.tres-tp-cartouche .tres-tp-cart-val {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.14;
  color: #3B2E14;
  overflow-wrap: anywhere;
}
.tres-tp-cartouche .tres-tp-cart-lbl {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: .12em;
  color: #9C7A22;
}
.tres-tp-vsm-wrap { width: 90px; height: 60px; position: relative; flex: none; }

/* ════════════════════════════════════════════════════
   LÉGENDE (bouton + modale)
   ════════════════════════════════════════════════════ */
.tres-legend-btn {
  background: var(--tres-bg2, #1B212C);
  color: var(--tres-gold, #E3B23C);
  border: 1px solid rgba(227,178,60,.5);
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  margin-left: auto;
  transition: background .14s, border-color .14s;
}
.tres-legend-btn:hover { background: rgba(227,178,60,.14); border-color: var(--tres-gold, #E3B23C); }

.tres-legend-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 1001;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.tres-legend-overlay.hidden { display: none; }
.tres-legend-panel {
  background: var(--tres-bg2, #1B212C);
  border: 1px solid var(--tres-border, rgba(227,178,60,.4));
  border-radius: 16px;
  max-width: 640px; width: 100%;
  max-height: 90dvh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,.8);
  overflow: hidden;
}
.tres-legend-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--tres-border, rgba(227,178,60,.3));
}
.tres-legend-title {
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 18px;
  color: var(--tres-gold, #E3B23C); flex: 1;
}
.tres-legend-close {
  background: none; border: none; color: var(--tres-text, #E8E3D5);
  font-size: 20px; cursor: pointer; line-height: 1; padding: 4px 8px;
  border-radius: 6px;
}
.tres-legend-close:hover { background: rgba(255,255,255,.08); }
.tres-legend-body { padding: 18px; overflow-y: auto; }
.tres-lg-section { margin-bottom: 22px; }
.tres-lg-section:last-child { margin-bottom: 0; }
.tres-lg-h {
  font-family: 'Cinzel', serif; font-size: 14px; letter-spacing: .08em;
  color: var(--tres-gold, #E3B23C);
  text-transform: uppercase; margin: 0 0 12px;
  border-bottom: 1px solid rgba(227,178,60,.25); padding-bottom: 6px;
}
.tres-lg-zones, .tres-lg-symbols { list-style: none; margin: 0; padding: 0; }
.tres-lg-zones li, .tres-lg-symbols li {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px;
}
.tres-lg-zones li div, .tres-lg-symbols li div { display: flex; flex-direction: column; }
.tres-lg-zones b, .tres-lg-symbols b { color: var(--tres-text, #E8E3D5); font-size: 14px; }
.tres-lg-zones span:not(.tres-lg-num), .tres-lg-symbols span:not(.tres-lg-sym) {
  color: var(--tres-text-dim, #B8B2A2); font-size: 13px; line-height: 1.4; margin-top: 2px;
}
.tres-lg-num {
  flex: none; width: 24px; height: 24px; font-size: 15px;
  color: var(--tres-gold, #E3B23C);
}
.tres-lg-sym {
  flex: none; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 15px;
  color: #0C0E13; background: var(--tres-gold, #E3B23C);
  border-radius: 7px;
}
.tres-lg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tres-lg-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--tres-border, rgba(227,178,60,.3));
  border-radius: 20px; padding: 5px 12px 5px 8px;
  font-size: 13px; color: var(--tres-text, #E8E3D5);
}
.tres-lg-swatch { width: 16px; height: 16px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.3); }

/* ════════════════════════════════════════════════════
   MODALE DÉTAIL (overlay)
   ════════════════════════════════════════════════════ */
.tres-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.tres-detail-overlay.hidden { display: none; }
.tres-detail-panel {
  background: var(--tres-bg2);
  border: 1px solid var(--tres-border);
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,.8);
  overflow: hidden;
}
.tres-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--tres-border);
  background: var(--tres-bg3);
  flex-shrink: 0;
}
.tres-detail-school-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex: none;
}
.tres-detail-titleblock {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.tres-detail-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--tres-text);
}
.tres-detail-name-en {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 13px;
  font-weight: 400;
  color: var(--tres-muted);
  letter-spacing: .02em;
}
.tres-detail-name-en:empty { display: none; }
.tres-detail-close {
  background: none;
  border: none;
  color: var(--tres-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  transition: background .12s;
}
.tres-detail-close:hover { background: rgba(255,255,255,.08); }
.tres-detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.tres-detail-scroll::-webkit-scrollbar { width: 5px; }
.tres-detail-scroll::-webkit-scrollbar-thumb { background: #3B455A; border-radius: 3px; }
.tres-detail-img-wrap {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  background: repeating-linear-gradient(45deg, #1B212C, #1B212C 12px, #222B39 12px, #222B39 24px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.tres-detail-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.tres-detail-img-btns {
  position: absolute;
  bottom: 10px; right: 10px;
  display: flex;
  gap: 6px;
}
.tres-detail-img-upload-btn {
  background: rgba(0,0,0,.7);
  color: var(--tres-gold);
  border: 1px solid var(--tres-gold-d);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.tres-detail-img-upload-btn:hover { background: rgba(0,0,0,.9); }
.tres-detail-img-no { font-size: 13px; color: var(--tres-dim); }
/* Mode repositionnement : l'image devient saisissable + repère visuel. */
.tres-detail-img-wrap.tres-repositioning { outline: 2px dashed var(--tres-gold); outline-offset: -2px; }
.tres-detail-img-wrap.tres-repositioning img { cursor: grab; touch-action: none; }
.tres-detail-img-wrap.tres-repositioning img:active { cursor: grabbing; }
.tres-detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  margin-bottom: 16px;
  font-size: 15px;
}
.tres-detail-meta-label {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--tres-gold-d);
  display: block;
}
.tres-detail-meta-val {
  color: var(--tres-text);
}
.tres-detail-divider {
  height: 1px;
  background: var(--tres-border);
  margin: 14px 0;
}
.tres-detail-desc {
  font-size: 16px;
  line-height: 1.6;
  /* Suit le thème (était #D8D4C8 codé en dur → illisible en thème clair et
     terne en sombre). --tres-text = fort contraste dans les deux modes. */
  color: var(--tres-text);
  margin-bottom: 12px;
}
.tres-detail-upcast {
  background: rgba(227,178,60,.07);
  border: 1px solid rgba(156,122,34,.4);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--tres-muted);
  margin-bottom: 14px;
}
.tres-detail-upcast strong { color: var(--tres-gold-l); }
.tres-detail-classes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tres-detail-class-chip {
  border: 1px solid #3B455A;
  border-radius: 99px;
  padding: 3px 11px;
  font-size: 13px;
  color: var(--tres-muted);
}
.tres-detail-actions {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--tres-border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.tres-detail-btn {
  flex: 1;
  min-width: 110px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--tres-border);
  background: var(--tres-bg3);
  color: var(--tres-muted);
  font-family: 'Cinzel', serif;
  font-size: 13px;
  letter-spacing: .05em;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
/* Le fond de survol est sombre (navy) quel que soit le thème → texte clair forcé
   (sinon en thème parchemin, --tres-text est sombre → texte illisible). */
.tres-detail-btn:hover { background: #222B39; color: #F0EDE4; }
.tres-detail-btn.primary {
  background: rgba(227,178,60,.15);
  border-color: var(--tres-gold-d);
  color: var(--tres-gold);
}
.tres-detail-btn.primary:hover { background: rgba(227,178,60,.25); }
.tres-detail-btn.prepared {
  background: var(--tres-gold);
  color: #0C0E13;
  border-color: var(--tres-gold);
  box-shadow: 0 0 14px rgba(227,178,60,.35);
}

/* ── Toast ───────────────────────────────────────── */
.tres-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: #1B212C;
  border: 1px solid var(--tres-gold-d);
  color: var(--tres-gold-l);
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: all .3s;
  white-space: nowrap;
  pointer-events: none;
}
.tres-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Upload input hidden ────────────────────────── */
#tresImgInput { display: none; }

/* ── Empty state ──────────────────────────────────── */
.tres-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--tres-dim);
  font-size: 15px;
}
.tres-empty-icon { font-size: 40px; margin-bottom: 10px; }

/* ── School color helpers ────────────────────────── */
.tres-sch-abjuration    { color: var(--sch-abjuration); }
.tres-sch-invocation    { color: var(--sch-invocation); }
.tres-sch-divination    { color: var(--sch-divination); }
.tres-sch-enchantement  { color: var(--sch-enchantement); }
.tres-sch-evocation     { color: var(--sch-evocation); }
.tres-sch-illusion      { color: var(--sch-illusion); }
.tres-sch-necromancie   { color: var(--sch-necromancie); }
.tres-sch-transmutation { color: var(--sch-transmutation); }

/* ── Adaptations Trésor (objets magiques) ────────── */
/* Boutons de rareté : autorise le retour à la ligne (labels plus longs
   que les chiffres de niveau du Grimoire). */
.tres-filter-levels { flex-wrap: wrap; }

/* Placeholder d'illustration = grande icône de catégorie (Phase 1, pas
   d'image serveur). Centrée dans sa zone (les conteneurs .tres-*-img
   sont déjà en flex center). */
.tres-cat-big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: saturate(.85);
}

/* ── Responsive tweaks ───────────────────────────── */
@media (max-width: 640px) {
  .tres-filter-bar { gap: 5px; padding: 8px 10px; }
  .tres-title { font-size: 15px; }
  .tres-filter-select { font-size: 12px; padding: 4px 7px; }
  .tres-rail { display: none; }
  .tres-detail-meta { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   PHASE 2 — Partage joueurs & illustrations
   ══════════════════════════════════════════════════════ */

/* Barre de partage MJ (dans l'en-tête des résultats). */
.tres-share-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--tres-border, rgba(227,178,60,.25));
}
.tres-share-count {
  font-size: 12px;
  opacity: .8;
  white-space: nowrap;
}
/* Bascule globale « visible aux joueurs » à l'état actif. */
#tresShareToggle.active {
  background: rgba(80,170,110,.22);
  border-color: #4caf6e;
  color: #7FB77E;
}

/* Repère visuel des objets partagés (liseré vert + coin 👁). */
.tres-shared-card {
  position: relative;
  outline: 2px solid rgba(76,175,110,.75);
  outline-offset: -1px;
  border-radius: 12px;
}
.tres-shared-card::after {
  content: '👁';
  position: absolute;
  top: 4px; left: 6px;
  font-size: 13px;
  z-index: 6;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.6));
}
.tres-dense-row.tres-shared-card { outline-offset: -2px; }

/* Badge « lecture seule » de la vue joueur. */
.tres-player-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(76,175,110,.18);
  border: 1px solid rgba(76,175,110,.5);
  color: #7FB77E;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════
   ÉDITEUR D'OBJET PERSONNALISÉ
   ═══════════════════════════════════════════════════ */
.tres-editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.tres-editor-overlay.hidden { display: none; }
.tres-editor-panel {
  width: 560px;
  max-width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--tres-bg2);
  border: 1px solid var(--tres-border2);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  overflow: hidden;
}
.tres-editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--tres-border);
  background: var(--tres-bg3);
}
.tres-editor-title {
  flex: 1;
  font-family: 'Cinzel', serif;
  font-size: 17px;
  color: var(--tres-gold-l);
  letter-spacing: .04em;
}
.tres-editor-close {
  background: none;
  border: none;
  color: var(--tres-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.tres-editor-close:hover { background: rgba(255,255,255,.08); color: var(--tres-text); }
.tres-editor-scroll {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tres-editor-row { display: flex; gap: 12px; flex-wrap: wrap; }
.tres-editor-row > .tres-editor-field { flex: 1; min-width: 160px; }
.tres-editor-field { display: flex; flex-direction: column; gap: 5px; }
.tres-editor-field > span {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tres-muted);
}
.tres-editor-field input,
.tres-editor-field select,
.tres-editor-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--tres-border);
  background: var(--tres-bg);
  color: var(--tres-text);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 15px;
}
.tres-editor-field textarea { resize: vertical; line-height: 1.4; }
.tres-editor-field input:focus,
.tres-editor-field select:focus,
.tres-editor-field textarea:focus { outline: none; border-color: var(--tres-gold); }
.tres-editor-field input::placeholder,
.tres-editor-field textarea::placeholder { color: var(--tres-dim); }
.tres-editor-check {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 150px;
  color: var(--tres-text);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 15px;
  cursor: pointer;
}
.tres-editor-check input { width: 17px; height: 17px; accent-color: var(--tres-gold); cursor: pointer; }
.tres-editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--tres-border);
  background: var(--tres-bg3);
}
.tres-editor-btn {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--tres-border);
  background: var(--tres-bg2);
  color: var(--tres-muted);
  font-family: 'Cinzel', serif;
  font-size: 13px;
  letter-spacing: .04em;
  cursor: pointer;
  transition: all .15s;
}
.tres-editor-btn:hover { background: var(--tres-bg-hover); color: var(--tres-text); }
.tres-editor-btn.primary {
  background: var(--tres-gold);
  border-color: var(--tres-gold);
  color: #1a1206;
  font-weight: 600;
}
.tres-editor-btn.primary:hover { background: var(--tres-gold-l); }
.tres-editor-btn.danger,
.tres-detail-btn.danger { color: #E0857A; border-color: rgba(224,133,122,.4); }
.tres-editor-btn.danger:hover,
.tres-detail-btn.danger:hover { background: rgba(224,133,122,.15); color: #F0A79E; }
.tres-editor-btn.danger.confirm { background: #B23A2B; border-color: #B23A2B; color: #fff; }
