/* ============================================================
   Proxy — Styles des pages internes (crédits, decks, paramètres…)
   ============================================================ */

.plainlink { color: var(--outline); text-decoration: none; }
.plainlink:hover { color: var(--primary); text-decoration: underline; }

/* ── Squelette de page ── */
.page {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.page--narrow { max-width: 860px; width: 100%; margin: 0 auto; }
.page--wide { max-width: none; width: 100%; margin: 0; padding: 20px 24px 40px; }
.page__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page__head h1 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 22px;
  letter-spacing: .04em;
  color: var(--primary-light);
}
.page__hint { margin: 0; font-size: 12px; color: var(--on-surface-var); }
.page__hint a { color: var(--primary); }

/* ── Panels ── */
.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--outline-subtle) 60%, transparent);
  border-radius: 14px;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.18);
}
.panel__title {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 14px;
  color: var(--primary-light);
}
.panel--danger { border-color: color-mix(in srgb, #ff7d70 35%, transparent); }

/* ── Crédits ── */
.credits-hero { text-align: center; padding: 10px 0 2px; }
.credits-hero__num {
  font-family: "JetBrains Mono", monospace;
  font-size: 52px;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 24px var(--glow);
  line-height: 1;
}
.credits-hero__label { font-size: 12px; color: var(--on-surface-var); margin-top: 6px; }
.credits-actions { display: flex; justify-content: center; gap: 12px; }
.credits-actions small { font-weight: 400; opacity: .85; }

.donate-row { display: flex; gap: 12px; flex-wrap: wrap; }
.donate-btn {
  flex: 1 1 200px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 12px;
  text-decoration: none;
  color: var(--on-surface);
  transition: all .15s;
}
.donate-btn:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.3); }
.donate-btn__icon { font-size: 26px; }
.donate-btn small { display: block; color: var(--outline); font-size: 11px; }
.donate-btn--kofi:hover { border-color: #ff5e5b; }
.donate-btn--paypal:hover { border-color: #0070ba; }

.redeem { display: flex; gap: 8px; }
.redeem .textfield { flex: 1; }
.redeem code {
  font-family: "JetBrains Mono", monospace;
  background: var(--surface-bright);
  border: 1px solid var(--outline-subtle);
  border-radius: 4px;
  padding: 0 5px;
  color: var(--primary);
}

.tx-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
  font-size: 12px;
}
.tx-item__amount { font-family: "JetBrains Mono", monospace; font-weight: 700; color: var(--primary); }
.tx-item__amount--neg { color: #ff9e94; }
.tx-item--clickable { cursor: pointer; transition: border-color .15s, background .15s; }
.tx-item--clickable:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.tx-item--clickable.is-current { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.tx-item__date { color: var(--outline); font-size: 11px; font-family: "JetBrains Mono", monospace; }

/* ── Pub simulée ── */
.ad-panel { max-width: 640px; }
.ad-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 34px 20px;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 60%),
    var(--surface-lowest);
  border: 1px dashed var(--outline);
  border-radius: 12px;
}
.ad-countdown {
  width: 74px; height: 74px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-family: "JetBrains Mono", monospace;
  font-size: 30px;
  font-weight: 700;
  box-shadow: 0 0 24px var(--glow);
}
.ad-progress { width: 100%; height: 8px; background: var(--surface-highest); border-radius: 9999px; overflow: hidden; }
.ad-progress__bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary-dark), var(--primary)); transition: width .3s linear; }
.ad-message {
  min-height: 20px;
  font-size: 13px;
  color: var(--on-surface-var);
  font-style: italic;
  text-align: center;
  animation: adfade .4s ease;
}
@keyframes adfade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Decks ── */
.decks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.deck-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--outline-subtle) 60%, transparent);
  border-radius: 14px;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.18);
}
.deck-card__name {
  font-family: "Cinzel", Georgia, serif;
  font-size: 14px;
  color: var(--primary-light);
  background: none;
  border: none;
  text-align: left;
  padding: 0;
  cursor: text;
  outline: none;
  border-bottom: 1px dashed transparent;
}
.deck-card__name:focus { border-bottom-color: var(--primary); }
.deck-card__count { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--on-surface-var); }
.deck-card__actions { display: flex; gap: 8px; margin-top: 4px; }
.deck-empty { color: var(--outline); font-size: 13px; padding: 30px 0; text-align: center; }

/* ── Deck : workspace complet (deck à gauche ~20 %, recherche à droite) ── */
/* ── Rangée de decks au-dessus des filtres (cartes cliquables) ── */
.deckstrip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 0;
  margin-left: 14px;
}
.deckstrip__cards { margin-top: 0; }

/* ── Popup de création de deck (thème du site) ── */
.overlay__panel--narrow {
  max-width: 460px;
  margin: 124px auto 0; /* descendu de 100 px sous le centre */
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 14px;
  padding: 18px 20px 20px;
  box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 24px var(--glow);
}
.newdeck-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  background: var(--surface-low);
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
  padding: 14px;
}
.newdeck-label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--on-surface-var);
}
.newdeck-formats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.newdeck-fmt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 8px;
  color: var(--on-surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: 11px;
}
.newdeck-fmt b { font-family: "Cinzel", Georgia, serif; font-size: 11px; }
.newdeck-fmt__cost { font-family: "JetBrains Mono", monospace; font-size: 10px; color: var(--on-surface-var); }
.newdeck-fmt:hover { border-color: var(--primary); }
.newdeck-fmt.is-selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, var(--surface-lowest));
  box-shadow: 0 0 0 1px var(--primary);
}
.newdeck-fmt.is-selected .newdeck-fmt__cost { color: var(--primary); }
.newdeck-go { margin-top: 4px; }
.newdeck-go:disabled { opacity: .5; cursor: not-allowed; }
.deckstrip__head { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 134px; }
.deckstrip__title { font-family: "Cinzel", Georgia, serif; font-size: 13px; color: var(--primary-light); white-space: nowrap; }
.deckstrip__new { width: 34px; }
.deckstrip__cards {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.deckcard {
  position: relative;
  flex: 0 0 134px;
  aspect-ratio: 5 / 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 10px;
  background:
    radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 60%),
    var(--gradient-card, var(--surface));
  border: 1px solid var(--outline-subtle);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.deckcard:hover { border-color: var(--primary); box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.deckcard.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent), 0 6px 18px rgba(0,0,0,.4); }
.deckcard__format {
  position: absolute;
  top: 6px; left: 6px;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--primary) 88%, transparent);
  color: var(--on-primary);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  cursor: text;
}
.deckcard__del {
  position: absolute;
  top: 6px; right: 6px;
  opacity: 1;
  font-size: 15px;
  padding: 2px 5px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-lowest) 80%, transparent);
  cursor: pointer;
  transition: transform .12s, background .12s;
}
.deckcard__del:hover { transform: scale(1.18); background: color-mix(in srgb, #dc2626 35%, transparent); }
.deckcard--new {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--primary) 50%, transparent);
  background: transparent;
  gap: 8px;
}
.deckcard--new:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); transform: translateY(-2px); }
.deckcard--new .deckcard__name { color: var(--on-surface-var); font-size: 11px; }
.deckcard__newplus { font-size: 36px; color: var(--primary); line-height: 1; text-shadow: 0 0 16px var(--glow); }
.deckcard__back { font-size: 34px; line-height: 1; color: var(--primary); text-shadow: 0 0 14px var(--glow); }
.deckcard__name {
  max-width: 100%;
  font-family: "Cinzel", Georgia, serif;
  font-size: 12px;
  color: var(--on-surface);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deckcard__meta { display: flex; align-items: center; gap: 5px; font-family: "JetBrains Mono", monospace; font-size: 10px; color: var(--on-surface-var); }
.dcol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.5);
  font-size: 8px;
  font-weight: 700;
  color: #1a1a1a;
}
.dcol--W { background: #f8f6d8; } .dcol--U { background: #38b6ff; color: #04222e; }
.dcol--B { background: #c084fc; color: #fff; } .dcol--R { background: #ef4444; color: #fff; }
.dcol--G { background: #4ade80; } .dcol--C { background: #b9bec7; }
.dcol--none { background: transparent; border-color: var(--outline-subtle); color: var(--on-surface-var); }
.deckstrip__empty { color: var(--on-surface-var); font-size: 12px; }

/* ── Bouton flottant « Quêtes » + panneau ── */
#quests-fab {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 1100;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 6px 20px rgba(0,0,0,.5), 0 0 16px var(--glow);
  font-size: 20px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
#quests-fab:hover { transform: scale(1.08); box-shadow: 0 8px 26px rgba(0,0,0,.6), 0 0 22px var(--glow); }
.quests-fab__badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
#quests-fab-panel {
  position: fixed;
  bottom: 74px;
  right: 18px;
  z-index: 1100;
  width: 290px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.6), 0 0 18px var(--glow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quests-fab__title {
  font-family: "Cinzel", Georgia, serif;
  font-size: 13px;
  color: var(--primary-light);
}
.quests-fab__quest {
  padding: 8px 10px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
}
.quests-fab__quest.is-done { border-color: color-mix(in srgb, var(--primary) 55%, transparent); }
.quests-fab__questhead { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.quests-fab__questhead b { font-size: 12px; }
.quests-fab__questhead span { color: var(--primary); font-family: "JetBrains Mono", monospace; font-weight: 700; }
.quests-fab__goal { color: var(--on-surface-var); }
.quests-fab__goal.is-done { color: var(--primary); }
.quests-fab__empty { color: var(--on-surface-var); font-size: 12px; }

/* ── Particules d'effets ── */
.fx-particle {
  position: fixed;
  z-index: 1300;
  border-radius: 2px;
  pointer-events: none;
  animation: fxParticle .9s ease-out forwards;
}
@keyframes fxParticle {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--fxdx), var(--fxdy)) rotate(220deg); opacity: 0; }
}

/* ── Roue crantée ⚙ paramètres effets ── */
#fx-fab {
  position: fixed;
  bottom: 74px;
  right: 22px;
  z-index: 1100;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--outline-subtle);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--on-surface-var);
  font-size: 17px;
  cursor: pointer;
  transition: transform .3s, border-color .15s, color .15s;
}
#fx-fab:hover { transform: rotate(90deg); border-color: var(--primary); color: var(--primary); }
#fx-fab-panel {
  position: fixed;
  bottom: 120px;
  right: 22px;
  z-index: 1100;
  width: 230px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.6), 0 0 18px var(--glow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fx-fab__title { font-family: "Cinzel", Georgia, serif; font-size: 13px; color: var(--primary-light); }
.fx-fab__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--on-surface);
  cursor: pointer;
}
.fx-fab__row input[type="checkbox"] { accent-color: var(--primary); }
.fx-fab__row input[type="range"] { flex: 1; accent-color: var(--primary); }
.fx-fab__vol { font-family: "JetBrains Mono", monospace; font-size: 10px; color: var(--on-surface-var); min-width: 32px; text-align: right; }

.deck-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.deckside {
  flex: 0 0 20%;
  min-width: 230px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface-low);
  border-right: 1px solid var(--outline-subtle);
  overflow-y: auto;
}
.deckside__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.deckside__title {
  font-family: "Cinzel", Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--primary-light);
}
.deckside__new { padding: 6px 12px; font-size: 13px; }
.deckside__chips { display: flex; flex-direction: column; gap: 8px; }
.deckside__noactive { color: var(--outline); font-size: 12px; text-align: center; padding: 12px 0; }
.deckside__active {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  border-radius: 12px;
  box-shadow: 0 0 14px color-mix(in srgb, var(--primary) 18%, transparent);
}
.deckside__deckname {
  font-family: "Cinzel", Georgia, serif;
  font-size: 14px;
  color: var(--primary-light);
  cursor: pointer;
}
.deckside__deckname:hover { text-decoration: underline dotted var(--primary); }
.deckside__deckname small { color: var(--outline); font-family: "JetBrains Mono", monospace; font-size: 10px; }
.deckside__count { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--primary); }
.deckside__active { position: relative; }
.deckside__del {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 16px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: .75;
  transition: transform .12s, opacity .12s;
  padding: 3px 5px;
  border-radius: 6px;
}
.deckside__del:hover { opacity: 1; transform: scale(1.15); background: color-mix(in srgb, #dc2626 30%, transparent); }
.deckside__empty { font-size: 11px; color: var(--on-surface-var); line-height: 1.4; }
.deckside__hint { color: var(--outline); font-size: 11px; line-height: 1.4; }
.deckside__clear { align-self: stretch; }

/* La recherche occupe le reste */
.decksearch {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.deck-drawer {
  max-height: 40vh;
  border-bottom: 1px solid var(--outline-subtle);
}
.decksearch__results {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.decksearch__scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 24px; }
.deckstatusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 20px;
  border-top: 1px solid var(--outline-subtle);
  font-size: 11px;
  color: var(--outline);
}
.deckstatusbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Badge « N× dans le deck » sur les vignettes */
.card__deckbadge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--primary) 90%, transparent);
  color: var(--on-primary);
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.card.is-in-deck { outline: 2px solid var(--primary); outline-offset: -2px; }
.datatable tbody tr.is-in-deck { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.datatable .dt-deckcount { font-family: "JetBrains Mono", monospace; font-weight: 700; color: var(--primary); }

/* Avertissement « limite d'exemplaires atteinte » */
.deck-row.is-max {
  border-color: color-mix(in srgb, #f59e0b 70%, transparent);
  background: color-mix(in srgb, #f59e0b 12%, var(--surface-lowest));
}
.deck-row.is-max .deck-row__count { color: #f59e0b; }
.card__deckbadge--max { background: #b45309; color: #fff; }
.datatable .dt-deckcount.is-max { color: #f59e0b; }

/* ── Stats du deck (courbe, couleurs, types) ── */
.deck-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
  padding: 10px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
}
.deck-stats__row { display: flex; flex-direction: column; gap: 4px; }
.deck-stats__title { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--on-surface-var); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-stats__curve { display: flex; align-items: flex-end; gap: 3px; height: 44px; }
.deck-stats__bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.deck-stats__fill {
  width: 100%;
  min-height: 2px;
  background: linear-gradient(to top, var(--primary), color-mix(in srgb, var(--primary) 40%, transparent));
  border-radius: 3px 3px 0 0;
  position: relative;
}
.deck-stats__fill::after {
  content: attr(data-n);
  position: absolute;
  top: -14px; left: 50%; transform: translateX(-50%);
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  color: var(--on-surface-var);
}
.deck-stats__fill[data-n="0"]::after { content: ""; }
.deck-stats__label { font-family: "JetBrains Mono", monospace; font-size: 9px; color: var(--on-surface-var); margin-top: 2px; }
.deck-stats__colors { display: flex; flex-wrap: wrap; gap: 6px; }
.deck-stats__color { display: inline-flex; align-items: center; gap: 3px; font-family: "JetBrains Mono", monospace; font-size: 11px; }
.deck-stats__dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.4); display: inline-block; }
.deck-stats__types { display: flex; flex-wrap: wrap; gap: 4px; }
.deck-stats__type {
  padding: 1px 7px;
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  border-radius: 999px;
  font-size: 10px;
}
.deck-stats__type b { color: var(--primary); }

/* ── Deck : chips de sélection + builder 2 colonnes ── */
.deck-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--outline-subtle) 60%, transparent);
  border-radius: 14px;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.18);
  cursor: pointer;
  text-align: left;
  color: var(--on-surface);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.deck-chip:hover { border-color: var(--primary); }
.deck-chip.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 14px var(--glow), inset 0 1px 4px rgba(0,0,0,.18);
}
.deck-chip__format {
  align-self: flex-start;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  border-radius: 6px;
  color: var(--primary);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.deck-chip__name {
  font-family: "Cinzel", Georgia, serif;
  font-size: 14px;
  color: var(--primary-light);
}
.deck-chip__count { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--on-surface-var); }
.deck-chip__del {
  position: absolute;
  margin-top: -34px;
  right: 18px;
  cursor: pointer;
  opacity: .5;
  font-size: 14px;
}
.deck-chip__del:hover { opacity: 1; }
.deck-chip { position: relative; }

.deck-builder {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .deck-builder { grid-template-columns: 1fr; } }
.deck-search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 4px;
}
.deck-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
  font-size: 12px;
  cursor: default;
}
.deck-search-item:hover { border-color: var(--primary); }
.deck-search-item__cost { display: flex; gap: 2px; flex: none; }
.deck-search-item__cost .msym, .deck-row__cost .msym { width: 15px; height: 15px; }
.deck-search-item__name { font-weight: 600; color: var(--on-surface); flex: 1; }
.deck-search-item__meta { font-family: "JetBrains Mono", monospace; font-size: 10px; color: var(--outline); }
.deck-search-item__add { padding: 2px 10px; font-size: 14px; line-height: 1.4; }

.deck-list-panel { position: sticky; top: 16px; }
.deck-list-stats { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--primary); }
.deck-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 4px;
}
.deck-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
  font-size: 12px;
}
.deck-row:hover { border-color: var(--primary); }
.deck-row__count {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: var(--primary);
  min-width: 26px;
  text-align: right;
}
.deck-row__cost { display: flex; gap: 2px; flex: none; }
.deck-row__name { flex: 1; color: var(--on-surface); }
.deck-row__actions { display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.deck-row:hover .deck-row__actions { opacity: 1; }
.deck-row__btn {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--outline-subtle);
  border-radius: 6px;
  color: var(--on-surface);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.deck-row__btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Rangée d'exports sous le deck actif ── */
.deckside__exports {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.deckside__exp { padding: 4px 10px; font-size: 12px; }
.deckside__copies { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--on-surface-var); }
.deckside__copies .numinput { width: 44px; padding: 3px 5px; }
.deckside__copies .selinput { padding: 3px 5px; background: var(--surface-lowest); color: var(--on-surface); border: 1px solid var(--outline-subtle); border-radius: 6px; font-size: 11px; }
.deckside__copies--chk input { accent-color: var(--primary); }

/* ── Conformité du deck ── */
.deck-legality {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 8px 0;
  padding: 8px 10px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
  font-size: 11px;
}
.deck-legality__title { font-weight: 700; font-size: 11px; }
.deck-legality__item { color: var(--on-surface-var); }
.deck-legality__title.is-ok, .deck-legality__item.is-ok { color: #6ee7a0; }
.deck-legality__title.is-warn, .deck-legality__item.is-warn { color: #fbbf24; }

/* ── Planches : lignes de découpe + Letter ── */
.sheets--cuts .sheet::before,
.sheets--cuts .sheet::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.sheet { position: relative; }
.sheets--cuts .sheet::before {
  left: 8mm; right: 8mm; top: 8mm; bottom: 8mm;
  border: 1px dashed rgba(0,0,0,.35);
  background:
    repeating-linear-gradient(to right, transparent 0 calc(100% / 3 - .4px), rgba(0,0,0,.3) calc(100% / 3 - .4px) calc(100% / 3)),
    repeating-linear-gradient(to bottom, transparent 0 calc(100% / 3 - .4px), rgba(0,0,0,.3) calc(100% / 3 - .4px) calc(100% / 3));
}
.sheet--letter { aspect-ratio: 216 / 279; max-width: 762px; }
.sheet--a3 { aspect-ratio: 297 / 420; max-width: 1080px; }
/* En A3 : grille 4×4 — chaque case garde le ratio 63/88 (cartes non déformées) */
.sheet--a3 { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; }
.sheet--a3 .sheet__cell { aspect-ratio: 63 / 88; height: auto; }
@media print {
  .sheets--cuts .sheet::before { display: block !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Quêtes (journalière, hebdomadaire, mensuelle) ── */
.quests-box { display: flex; flex-direction: column; gap: 14px; }
.quest {
  padding: 10px 12px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.quest.is-done { border-color: color-mix(in srgb, var(--primary) 55%, transparent); }
.quest__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.quest__title { font-weight: 700; font-size: 13px; }
.quest__reward {
  padding: 2px 10px;
  background: color-mix(in srgb, var(--primary) 88%, transparent);
  color: var(--on-primary);
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.quest.is-done .quest__reward { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.quest-goal { display: flex; align-items: center; gap: 10px; }
.quest-goal__label { flex: 0 0 55%; font-size: 12px; color: var(--on-surface-var); }
.quest-goal__bar {
  flex: 1;
  height: 7px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border: 1px solid var(--outline-subtle);
  border-radius: 999px;
  overflow: hidden;
}
.quest-goal__fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #fff));
  border-radius: 999px;
  transition: width .4s ease;
}
.quest-goal__fill.is-done { background: var(--primary); }

/* ── Main de départ (7 cartes) ── */
.hand-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 16px;
}
.hand-card {
  width: 150px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
}
.hand-card__img {
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hand-card__img .card__sigil { font-size: 28px; color: var(--primary); }
.hand-card__name { font-size: 11px; color: var(--on-surface); text-align: center; }
.hand-card__cost { display: flex; justify-content: center; gap: 2px; }
.hand-grid__empty { color: var(--on-surface-var); text-align: center; width: 100%; }
.deck-list-actions { display: flex; justify-content: flex-end; }

/* Aperçu flottant de la carte au survol */
.deck-hover {
  position: absolute;
  z-index: 900;
  width: 450px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 24px var(--glow);
  pointer-events: none;
}
.deck-hover img { display: block; width: 100%; height: auto; }
.deck-hover__fallback { pointer-events: none; }
/* Zones de clic sur la grosse carte : haut/milieu = +1, bas 20 % = −1 */
.deck-hover__zone {
  position: absolute;
  left: 0; right: 0; top: 0; height: 80%;
  cursor: pointer;
}
.deck-hover__zone--remove {
  top: auto; bottom: 0; height: 20%;
}
.deck-hover__hint {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.9);
  opacity: 0;
  transition: opacity .12s ease;
}
.deck-hover__hint--add {
  top: 6px;
}
.deck-hover__hint--remove {
  bottom: 4px;
}
.deck-hover:hover .deck-hover__hint { opacity: 1; }

/* ── Bandes ＋/− sur les vignettes (grille deck) : haut = ajouter, bas 20 % = retirer ── */
.decksearch .card::before,
.decksearch .card::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 20%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  font-family: "Manrope", "Segoe UI", sans-serif;
  opacity: 0;
  transition: opacity .12s ease;
  pointer-events: none;
}
.decksearch .card::before {
  top: 0; content: "＋";
  color: #86efac;
  background: linear-gradient(to bottom, rgba(0,0,0,.78), rgba(0,0,0,0));
  border-radius: 13px 13px 0 0;
}
.decksearch .card::after {
  bottom: 0; content: "−";
  color: #fca5a5;
  background: linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,0));
  border-radius: 0 0 13px 13px;
}
.decksearch .card:hover::before,
.decksearch .card:hover::after { opacity: 1; }

/* ── Pop flottant « +1 / −1 » au point de clic ── */
.deck-pop {
  position: fixed;
  z-index: 1200;
  transform: translate(-50%, -120%);
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  font-weight: 800;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0,0,0,.9);
  animation: deckPopUp 1.9s ease-out forwards;
}
.deck-pop--add { color: #6ee7a0; }
.deck-pop--remove { color: #f87171; }
@keyframes deckPopUp {
  0% { translate: 0 6px; opacity: 0; }
  15% { opacity: 1; }
  70% { opacity: 1; }
  100% { translate: 0 -52px; opacity: 0; }
}
.card__img--fallback { position: relative; }
/* Case vide : rien à imprimer (blanche, jamais noire) */
.sheet__cell--plain { background: transparent !important; }
.sheet__cell--nofront {
  background:
    radial-gradient(circle at 50% 42%, #3a3f4a 0 11%, transparent 12%),
    repeating-linear-gradient(45deg, #23272f 0 12px, #2c313b 12px 24px),
    #1b1e24;
}
.deck-hover__fallback {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  font-size: 12px;
}
.deck-hover__fallback strong { font-family: "Cinzel", Georgia, serif; color: var(--primary-light); }
.deck-hover__fallback p { margin: 0; color: var(--on-surface-var); line-height: 1.4; }

/* ── Paramètres ── */
.settings-profile { display: flex; gap: 16px; align-items: flex-start; }
.settings-avatar {
  width: 72px; height: 72px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(200,157,92,.6);
  background: var(--surface-highest);
  background-size: cover;
  background-position: center;
  font-size: 34px;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}
.settings-avatar:hover { border-color: var(--primary); box-shadow: 0 0 10px var(--glow); }
.settings-profile__fields { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.settings-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--on-surface-var); }

/* ── Pop « +N XP » en haut de l'écran ── */
#xp-pop-host {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 1001;
  pointer-events: none;
}
.xp-pop {
  padding: 8px 18px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 10px;
  color: var(--primary);
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 24px rgba(0,0,0,.5), 0 0 16px var(--glow);
  animation: xp-pop-rise 1.5s cubic-bezier(.2,.8,.3,1) forwards;
}
@keyframes xp-pop-rise {
  0%   { opacity: 0; transform: translateY(-14px) scale(.85); }
  12%  { opacity: 1; transform: translateY(0) scale(1.06); }
  24%  { transform: translateY(0) scale(1); }
  75%  { opacity: 1; transform: translateY(6px); }
  100% { opacity: 0; transform: translateY(14px) scale(.95); }
}

/* ── Popup « Vous passez niveau N » ── */
#levelup-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 1100;
}
#levelup-overlay.is-visible { opacity: 1; pointer-events: auto; }
.levelup-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 44px 26px;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 18px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 34px var(--glow);
  transform: scale(.8);
  transition: transform .3s cubic-bezier(.2,.9,.3,1.3);
}
#levelup-overlay.is-visible .levelup-frame { transform: scale(1); }
/* Anneaux animés autour du cadre */
.levelup-frame::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 24px;
  border: 2px dashed var(--primary);
  opacity: .65;
  animation: levelup-spin 14s linear infinite;
}
.levelup-frame::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 21px;
  border: 1px solid color-mix(in srgb, var(--primary) 60%, transparent);
  animation: levelup-pulse 1.8s ease-in-out infinite;
}
@keyframes levelup-spin { to { transform: rotate(360deg); } }
@keyframes levelup-pulse {
  0%, 100% { box-shadow: 0 0 10px var(--glow); opacity: .55; }
  50%      { box-shadow: 0 0 26px var(--glow); opacity: 1; }
}
.levelup-frame__spark { font-size: 26px; color: var(--primary); animation: levelup-pulse 1.8s ease-in-out infinite; }
.levelup-frame__title {
  font-family: "Cinzel", Georgia, serif;
  font-size: 15px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--primary-light);
}
.levelup-frame__level { font-size: 20px; color: var(--on-surface); }
.levelup-frame__level b {
  font-family: "Cinzel", Georgia, serif;
  font-size: 30px;
  color: var(--primary);
  text-shadow: 0 0 18px var(--glow);
}
.levelup-frame__label { font-size: 13px; color: var(--outline); min-height: 16px; }
.levelup-frame__close {
  margin-top: 10px;
  padding: 8px 22px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary), var(--primary-light));
  border: none;
  border-radius: 10px;
  color: var(--on-primary);
  font-family: "Cinzel", Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
}
.levelup-frame__close:hover { filter: brightness(1.1); }

/* Pop « 🏆 Haut fait débloqué » : plus large, doré prononcé, reste ~3 s */
.xp-pop--hf {
  padding: 10px 20px;
  border-color: var(--primary-light);
  color: var(--on-surface);
  font-family: inherit;
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0,0,0,.55), 0 0 26px var(--glow);
  animation: xp-pop-rise 3s cubic-bezier(.2,.8,.3,1) forwards;
}
.xp-pop--hf b { color: var(--primary); }
.xp-pop--hf small { color: var(--primary-light); font-family: "JetBrains Mono", monospace; }

/* ── Page Hauts faits ── */
.hf-progress {
  padding: 10px 14px;
  background: var(--surface-lowest);
  border: 1px dashed var(--outline);
  border-radius: 10px;
  font-size: 13px;
  color: var(--on-surface-var);
}
.hf-progress b { color: var(--primary); font-family: "JetBrains Mono", monospace; }
.hf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.hf-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 12px;
  font-size: 12px;
  opacity: .55;
}
.hf-card.is-done {
  opacity: 1;
  border-color: color-mix(in srgb, var(--primary) 55%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--primary) 25%, transparent);
}
.hf-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hf-card__name { font-weight: 600; color: var(--on-surface); }
.hf-card__xp { font-family: "JetBrains Mono", monospace; font-weight: 700; color: var(--primary); flex: none; }
.hf-card__meta { color: var(--outline); font-size: 11px; }
.hf-card.is-done .hf-card__meta { color: var(--primary-light); }
.hf-year-band { margin-top: 6px; }

/* ── Toast XP / crédits ── */
.xp-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 80px);
  padding: 12px 22px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 12px;
  color: var(--on-surface);
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 0 20px var(--glow);
  opacity: 0;
  pointer-events: none;
  transition: all .35s cubic-bezier(.2,.9,.3,1.2);
  z-index: 999;
}
.xp-toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.xp-toast b { color: var(--primary); }
.xp-toast small { color: var(--outline); }

/* ── Boosters ── */
.booster-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.booster-actions small { font-weight: 400; opacity: .85; }
.booster-set-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.booster-set-label {
  font-family: "Cinzel", Georgia, serif;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--primary-light);
  flex: none;
}
.booster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.booster-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
  font-size: 12px;
}
.booster-card__name { font-weight: 600; color: var(--on-surface); }
.booster-card__set { font-family: "JetBrains Mono", monospace; font-size: 10px; color: var(--outline); }
.booster-card.rar--mythic { border-color: color-mix(in srgb, #ff7d40 55%, transparent); box-shadow: 0 0 10px rgba(255,140,64,.25); }
.booster-card.rar--rare { border-color: color-mix(in srgb, #e8c96a 55%, transparent); }
.booster-card.rar--uncommon { border-color: color-mix(in srgb, #a8b6c8 45%, transparent); }

/* ── Draft ── */
.draft-setup { display: flex; flex-direction: column; gap: 18px; }

.draft-field { display: flex; flex-direction: column; gap: 8px; }
.draft-field__label {
  font-family: "Cinzel", Georgia, serif;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--primary-light);
}

/* Mêmes boutons .btn-primary que la page Boosters ; celui non choisi est grisé,
   celui choisi garde le dégradé doré + halo */
.draft-choice small { font-weight: 400; opacity: .85; }
.draft-choice:not(.is-selected) { filter: grayscale(.6) brightness(.7); opacity: .8; }
.draft-choice:not(.is-selected):hover { filter: grayscale(.3) brightness(.85); }
.draft-choice.is-selected { filter: none; opacity: 1; box-shadow: 0 4px 16px var(--glow), 0 0 18px var(--glow); }
.draft-choice:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 3px; }

.draft-players-row { display: flex; align-items: center; gap: 10px; }
.draft-players-row .textfield { width: 110px; }
.draft-players-hint { font-size: 11px; color: var(--outline); }

.draft-summary {
  padding: 10px 14px;
  background: var(--surface-lowest);
  border: 1px dashed var(--outline);
  border-radius: 10px;
  font-size: 13px;
  color: var(--on-surface-var);
}

.draft-actions { display: flex; gap: 12px; }

.panel__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.draft-total { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--primary); }

.draft-players { display: flex; flex-direction: column; gap: 16px; }
.draft-player { display: flex; flex-direction: column; gap: 8px; }
.draft-player__head {
  font-family: "Cinzel", Georgia, serif;
  font-size: 13px;
  color: var(--primary-light);
}
.draft-player__head small {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--outline);
  margin-left: 6px;
}
.draft-player__boosters { display: flex; flex-direction: column; gap: 12px; }
.draft-booster { display: flex; flex-direction: column; gap: 6px; }
.draft-booster__head {
  font-size: 12px;
  color: var(--on-surface-var);
  border-bottom: 1px solid var(--outline-subtle);
  padding-bottom: 4px;
}
.draft-booster__head small { color: var(--primary); font-size: 11px; margin-left: 6px; }
.draft-booster__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

/* ── Deck : badge de format ── */
.deck-card__format {
  align-self: flex-start;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  border-radius: 6px;
  color: var(--primary);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Cartes générées (carte-render.js) dans l'aperçu, la main de départ et les planches ── */
.deck-hover .deck-hover__pc { display: block; }
.hand-card__img .pcard, .sheet__cell .pcard { display: block; }
.sheet__cell { overflow: hidden; }

/* Boosters : cartes générées */
.booster-grid--cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.booster-card__pc { width: 100%; aspect-ratio: 492 / 688; border-radius: 8px; overflow: hidden; }

/* ═══════════ Page Deck : panneau du deck par-dessus la page, recherche pleine largeur ═══════════ */
.deckside {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90;
  flex: none; width: min(400px, 92vw); max-width: none; min-width: 0;
  border-right: 0; border-left: 1px solid var(--brass);
  background: color-mix(in srgb, var(--surface-low) 96%, #000);
  box-shadow: -14px 0 40px rgba(0,0,0,.55);
  padding-top: 46px;
  animation: deckin .26s cubic-bezier(.2,.8,.2,1);
}
.deckside[hidden] { display: none; }
@keyframes deckin { from { transform: translateX(100%); opacity: .4; } to { transform: none; opacity: 1; } }
.deckside__close {
  position: absolute; top: 10px; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--outline-subtle); background: var(--surface); color: var(--on-surface); cursor: pointer; font-size: 14px;
}
.deckside__close:hover { border-color: var(--brass); color: var(--primary-light); }
.deck-noactive { margin: 36px auto; padding: 0 24px; max-width: 640px; text-align: center; color: var(--outline); font-size: 14px; line-height: 1.6; }
.deck-noactive[hidden] { display: none; }
.deck-workspace.is-noactive .decksearch { display: none; }
@media (prefers-reduced-motion: reduce) { .deckside { animation: none; } }

/* Page Deck : le panneau du deck se place à côté de la liste des cartes, sous les filtres */
.decksearch__results { --selw: 380px; transition: padding-right .26s cubic-bezier(.2,.8,.2,1); }
.decksearch__results.has-deck { padding-right: var(--selw); }
.deckside {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 30; width: var(--selw);
  box-shadow: -8px 0 24px rgba(0,0,0,.4); padding-top: 46px;
}
@media (max-width: 1100px) {
  .deckside { position: fixed; z-index: 90; width: min(400px, 92vw); }
  .decksearch__results.has-deck { padding-right: 0; }
}

/* ═══════════ Page Deck = consultation : fiche du deck sélectionné, en pleine largeur ═══════════ */
.deck-workspace { display: block; overflow-y: auto; flex: 1; min-height: 0; padding: 16px 24px 40px; }
.deckside {
  position: static; width: auto; max-width: 1200px; margin: 0 auto; padding: 18px; z-index: auto; animation: none;
  background: var(--surface-low); border: 1px solid var(--outline-subtle); border-radius: 14px; box-shadow: none; overflow: visible;
}
.deckside__active {
  display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 10px 24px; align-items: start;
  grid-template-areas: "bar bar" "name list" "count list" "stats list" "legal list" "empty list" "clear list" "exports list";
}
.deckside__bar { grid-area: bar; display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.deckside__edit { text-decoration: none; padding: 10px 18px; }
.deckside__del { position: static; }
.deckside__deckname { grid-area: name; }
.deckside__count { grid-area: count; }
#deck-stats { grid-area: stats; }
#deck-legality { grid-area: legal; }
#deck-active-empty { grid-area: empty; }
#btn-clear-deck { grid-area: clear; }
#deck-exports { grid-area: exports; }
#deck-list { grid-area: list; max-height: 70vh; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px; align-content: start; }
.deck-row__actions { display: none; }
.deck-noactive { margin: 26px auto; }
@media (max-width: 900px) {
  .deckside__active { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "name" "count" "stats" "legal" "empty" "list" "clear" "exports"; }
}

/* Page Deck : bandeau d'infos (sous les decks) + galerie des cartes en entier */
.deck-workspace { padding-top: 10px; }
.deckside { max-width: none; padding: 14px 18px 20px; }
.deckside__active { display: flex; flex-direction: column; gap: 16px; grid-template-areas: none; }
.deckband {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px 18px;
  padding: 12px 14px; border: 1px solid var(--outline-subtle); border-radius: 12px; background: var(--surface);
}
.deckband__id { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 220px; }
.deckband__id .deckside__bar { display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; }
.deckband__id .deckside__edit { padding: 8px 14px; font-size: 12px; }
.deckband .deckside__deckname, .deckband .deckside__count, .deckband #deck-stats, .deckband #deck-legality,
.deckband #deck-active-empty, .deckband #btn-clear-deck, .deckband #deck-exports { grid-area: auto; }
.deckband #deck-stats { flex: 1 1 280px; max-width: 420px; align-self: center; }
.deckband__legal { display: flex; flex-direction: column; justify-content: center; gap: 8px; flex: 1 1 220px; min-width: 200px; }
.deckband #deck-exports { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--outline-subtle); }
.deck-gallery { max-height: none; overflow: visible; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; align-content: start; }
.deck-gallery .card { cursor: default; }
#deck-list.deck-gallery { grid-area: auto; max-height: none; overflow: visible; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; align-content: start; }
.deckside__active { align-items: stretch; }
#deck-list.deck-gallery { width: 100%; }

/* Draft : cartes générées */
.draft-booster__cards--cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.draft-booster[hidden] { display: none; }

/* ── Planches : cartes jointives 63×88 mm, sans marge entre elles (plus de découpe superflue) ── */
.sheet, .sheet--letter, .sheet--a3 {
  padding: 0;
  gap: 0;
  grid-template-columns: repeat(3, 30%); /* 3 × 63 mm sur 210 mm */
  grid-auto-rows: auto;
  justify-content: center;
  align-content: center;
}
.sheet--letter { grid-template-columns: repeat(3, 29.1667%); } /* 63 / 216 */
.sheet--a3 { grid-template-columns: repeat(4, 21.2121%); }     /* 63 / 297 */
.sheet__cell, .sheet--a3 .sheet__cell { height: auto; aspect-ratio: 63 / 88; position: relative; }

/* Lignes de découpe : alternance noir / blanc (visible sur les cartes sombres comme claires) */
.sheets--cuts .sheet::before, .sheets--cuts .sheet::after { content: none !important; display: none !important; }
.sheets--cuts .sheet__cell::after {
  content: "";
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  --d: repeating-linear-gradient(90deg, #262626 0 1.5mm, #d3d2d0 1.5mm 3mm);
  --v: repeating-linear-gradient(180deg, #262626 0 1.5mm, #d3d2d0 1.5mm 3mm);
  background:
    var(--d) top left / 100% .35mm no-repeat,
    var(--v) top left / .35mm 100% no-repeat;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
/* bords extérieurs : dernière colonne (droite) et dernière ligne (bas) */
.sheets--cuts .sheet:not(.sheet--a3) .sheet__cell:nth-child(3n)::after {
  background:
    var(--d) top left / 100% .35mm no-repeat,
    var(--v) top left / .35mm 100% no-repeat,
    var(--v) top right / .35mm 100% no-repeat;
}
.sheets--cuts .sheet--a3 .sheet__cell:nth-child(4n)::after {
  background:
    var(--d) top left / 100% .35mm no-repeat,
    var(--v) top left / .35mm 100% no-repeat,
    var(--v) top right / .35mm 100% no-repeat;
}
.sheets--cuts .sheet:not(.sheet--a3) .sheet__cell:nth-last-child(-n+3)::after { background-image: var(--d), var(--v), var(--d); background-position: top left, top left, bottom left; background-size: 100% .35mm, .35mm 100%, 100% .35mm; }
.sheets--cuts .sheet--a3 .sheet__cell:nth-last-child(-n+4)::after { background-image: var(--d), var(--v), var(--d); background-position: top left, top left, bottom left; background-size: 100% .35mm, .35mm 100%, 100% .35mm; }
.sheets--cuts .sheet:not(.sheet--a3) .sheet__cell:nth-child(3n):nth-last-child(-n+3)::after,
.sheets--cuts .sheet--a3 .sheet__cell:nth-child(4n):nth-last-child(-n+4)::after {
  background-image: var(--d), var(--v), var(--v), var(--d);
  background-position: top left, top left, top right, bottom left;
  background-size: 100% .35mm, .35mm 100%, .35mm 100%, 100% .35mm;
}
@media print {
  .sheet { padding: 0 !important; }
}
.deckside__copies[hidden]{display:none!important}

/* ── Page Crédits : sources de gain ── */
.earn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.earn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--outline-subtle); border-radius: 12px; background: var(--surface-low); }
.earn[hidden] { display: none; }
.earn__icon { font-size: 24px; flex: none; width: 34px; text-align: center; }
.earn__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.earn__body strong { font-size: 14px; }
.earn__body small { color: var(--on-surface-var); font-size: 11.5px; line-height: 1.35; }
.earn__code { font-family: "JetBrains Mono", monospace; font-weight: 700; letter-spacing: .12em; color: var(--primary); }
.earn--soon { opacity: .55; }

/* ── Page Compare ── */
.cmp-pick { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--on-surface-var); }
.cmp-pick select { max-width: 460px; }
.cmp-set { display: flex; align-items: center; gap: 16px; }
.cmp-set__logo { height: 64px; max-width: 120px; object-fit: contain; filter: invert(.85) sepia(.2); }
.cmp-set__name { margin: 0; font-family: "Cinzel", Georgia, serif; font-size: 22px; color: var(--primary-light); }
.cmp-colors { display: flex; gap: 22px; align-items: flex-end; margin-top: 14px; }
.cmp-colors__col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 40px; }
.cmp-colors__bar { width: 26px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--primary-light), var(--primary-dark)); }
.cmp-colors__col .msym { width: 20px; height: 20px; }
.cmp-colors__col small { font: 11px "JetBrains Mono", monospace; color: var(--outline); }

.cmp-pairs { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.cmp-pair {
  display: grid; grid-template-columns: 26px 78px minmax(140px, 1.2fr) 82px minmax(110px, 1.8fr) repeat(4, 52px);
  align-items: center; gap: 12px; padding: 8px 12px; text-align: left; cursor: pointer; color: inherit;
  background: var(--surface-low); border: 1px solid var(--outline-subtle); border-radius: 10px; font: inherit;
  transition: border-color .15s, background .15s;
}
.cmp-pair:hover { border-color: var(--brass); }
.cmp-pair.is-sel { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface-low)); box-shadow: 0 0 0 1px var(--primary); }
.cmp-pair__rank { font: 700 14px "JetBrains Mono", monospace; color: var(--primary); }
.cmp-pair__sym { display: flex; gap: 3px; }
.cmp-pair__sym .msym, #cmp-deck-title .msym { width: 22px; height: 22px; }
.cmp-pair__name { display: flex; flex-direction: column; font-weight: 700; font-size: 14px; }
.cmp-pair__name small { font-weight: 400; font-size: 11px; color: var(--on-surface-var); }
.cmp-pair__bar { height: 10px; background: var(--surface-highest); border-radius: 9999px; overflow: hidden; }
.cmp-pair__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-dark), var(--primary-light)); }
.cmp-pair__stat { font: 12px "JetBrains Mono", monospace; color: var(--on-surface-var); white-space: nowrap; }
@media (max-width: 760px) { .cmp-pair { grid-template-columns: 22px 54px 1fr; } .cmp-pair__bar, .cmp-pair__stat { display: none; } }

#cmp-deck-title { display: flex; align-items: center; gap: 8px; }
#cmp-deck-title small { font-weight: 400; color: var(--on-surface-var); font-size: 12px; }
.cmp-actions { display: flex; gap: 8px; }
.cmp-deck { display: grid; grid-template-columns: 240px 1fr; gap: 24px; margin-top: 12px; align-items: start; }
@media (max-width: 900px) { .cmp-deck { grid-template-columns: 1fr; } }
.cmp-curve { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 6px 4px 0; border-bottom: 1px solid var(--outline-subtle); }
.cmp-curve__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
.cmp-curve__bar { width: 100%; max-width: 26px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--primary-light), var(--primary-dark)); }
.cmp-curve__n { font: 700 11px "JetBrains Mono", monospace; color: var(--primary); }
.cmp-curve__col small { font: 11px "JetBrains Mono", monospace; color: var(--outline); }
.cmp-list { columns: 2 280px; column-gap: 28px; }
.cmp-list__h { break-after: avoid; margin: 8px 0 4px; font-size: 13px; color: var(--primary-light); }
.cmp-list__h small { color: var(--outline); font-weight: 400; }
.cmp-row { display: grid; grid-template-columns: 22px 1fr auto 34px; gap: 8px; align-items: center; padding: 3px 6px; border-radius: 6px; font-size: 13px; border-left: 3px solid transparent; break-inside: avoid; cursor: default; }
.cmp-row:hover { background: var(--surface-high); }
.cmp-row.rar--mythic { border-left-color: #ff7d40; }
.cmp-row.rar--rare { border-left-color: #e8c96a; }
.cmp-row.rar--uncommon { border-left-color: #a8b6c8; }
.cmp-row__cmc { font: 700 11px "JetBrains Mono", monospace; color: var(--outline); text-align: center; }
.cmp-row__tags { font-size: 11px; letter-spacing: 1px; }
.cmp-row__score { font: 11px "JetBrains Mono", monospace; color: var(--primary); text-align: right; }
.cmp-lands { display: flex; gap: 18px; font-size: 13px; padding: 4px 6px; }
.cmp-lands .msym { width: 16px; height: 16px; vertical-align: -3px; }

.cmp-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.cmp-filters__label { font: 700 11px "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: .08em; color: var(--outline); margin: 0 4px 0 12px; }
.cmp-filters__label:first-child { margin-left: 0; }
.cmp-style { display: inline-block; padding: 2px 8px; border-radius: 9999px; font: 700 10.5px "JetBrains Mono", monospace; text-align: center; border: 1px solid; white-space: nowrap; }
.cmp-style--aggro { color: #ff9e7a; border-color: color-mix(in srgb, #ff9e7a 50%, transparent); background: color-mix(in srgb, #ff7d40 12%, transparent); }
.cmp-style--midrange { color: #e8c96a; border-color: color-mix(in srgb, #e8c96a 50%, transparent); background: color-mix(in srgb, #e8c96a 10%, transparent); }
.cmp-style--control { color: #8fc4ff; border-color: color-mix(in srgb, #8fc4ff 50%, transparent); background: color-mix(in srgb, #58b6ff 10%, transparent); }
#cmp-deck-title .cmp-style { margin-left: 6px; }
@media (max-width: 760px) { .cmp-pair .cmp-style { display: none; } }

.cmp-var { font-style: normal; font-weight: 400; font-size: 11px; color: var(--primary); margin-left: 4px; padding: 1px 6px; border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent); border-radius: 6px; }
.cmp-theme { width: auto; min-width: 150px; padding: 5px 8px; }
.cmp-count { margin-left: auto; font: 11px "JetBrains Mono", monospace; color: var(--outline); }
.cmp-more { text-align: center; margin: 10px 0 0; }

.cmp-pair__title { display: block; }
.cmp-pair__name .cmp-var { display: inline-block; }
.cmp-pair__name small { display: block; }

.cmp-var--best { color: #e8c96a; border-color: color-mix(in srgb, #e8c96a 45%, transparent); }
.cmp-toggle { margin-left: 8px; color: var(--primary); cursor: pointer; text-decoration: underline dotted; }
.cmp-toggle:hover { color: var(--primary-light); }

/* variantes : décalées sous leur meilleur deck */
.cmp-pair--variant { margin-left: 34px; border-left: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); background: color-mix(in srgb, var(--surface-low) 70%, transparent); }
.cmp-pair--variant .cmp-pair__rank { color: var(--outline); text-align: center; }
/* deck déplié sous sa ligne */
.cmp-detail { margin: -2px 0 10px; padding: 14px 16px 16px; border: 1px solid var(--primary); border-top: 0; border-radius: 0 0 12px 12px; background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.cmp-detail__title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; }
.cmp-detail__title small { font-weight: 400; color: var(--on-surface-var); font-size: 12px; }
.cmp-detail__keyh { margin-top: 16px; }
.cmp-pair.is-sel { border-radius: 10px 10px 0 0; }
.cmp-pair--variant.is-sel + .cmp-detail { margin-left: 34px; }
.cmp-lang { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--on-surface-var); cursor: pointer; }

.cmp-help summary { cursor: pointer; font-weight: 700; font-family: "Cinzel", Georgia, serif; font-size: 16px; color: var(--primary-light); }
.cmp-help__body { margin-top: 10px; font-size: 13px; line-height: 1.55; color: var(--on-surface-var); }
.cmp-help__body b { color: var(--on-surface); }
.cmp-help__body p { margin: 0 0 10px; }
.cmp-help__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin: 12px 0; }
.cmp-help__grid h4 { margin: 0 0 6px; font-size: 13px; color: var(--primary); }
.cmp-help__grid ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.cmp-legend { margin: 0 0 8px; font-size: 11.5px; color: var(--outline); }
