/* Wikiclash — Collection « Mes cartes » (README §5.2). */
.cl-main {
  display: grid; grid-template-columns: clamp(170px, 18vw, 240px) minmax(0, 1fr) clamp(220px, 24vw, 320px);
  gap: clamp(24px, 3vw, 48px); padding: clamp(20px, 3.5vh, 36px) var(--pad-x); min-height: 0;
}

/* filtres */
.cl-side { display: flex; flex-direction: column; gap: clamp(10px, 2.4vh, 28px); min-height: 0; overflow-x: hidden; }
.cl-head { display: flex; flex-direction: column; gap: 10px; }
.cl-h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 4.6vh, 42px); line-height: 1; }
.cl-count { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; color: var(--sub); border-bottom: 2px solid var(--bg3); padding-bottom: 6px; }
.cl-group { display: flex; flex-direction: column; gap: 8px; }
.cl-group > .wc-label { padding-bottom: 0; }
.cl-cat { display: flex; align-items: baseline; gap: 8px; padding: clamp(0px, .4vh, 3px) 0; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; }
.cl-cat .mk { width: 14px; font-family: var(--serif); font-size: 20px; color: var(--link); opacity: 0; transition: opacity 160ms ease; }
.cl-cat .lb { flex: 1; min-width: 0; font-family: var(--serif); font-size: clamp(15px, 2.25vh, 21px); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.cl-cat .n { font-size: 12px; color: var(--mut); }
.cl-cat:hover .lb { color: var(--link); }
.cl-cat.on .mk { opacity: 1; }
.cl-cat.on .lb { color: var(--link); text-decoration: underline; }
.cl-cat:focus-visible, .cl-rar:focus-visible, .cl-opts button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.cl-rars { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.cl-rar { display: flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; cursor: pointer; color: var(--ink); padding: 1px 0; border: 0; background: none; text-align: left; transition: color 160ms ease; }
.cl-rar i { width: 10px; height: 10px; flex: none; margin-left: 4px; background: var(--rc); outline: 1px solid transparent; outline-offset: 2px; transition: opacity 160ms ease; }
.cl-rar.on i { outline-color: var(--rc); }
.cl-rar.off { color: var(--ln); }
.cl-rar.off i { opacity: .25; }
.cl-opts { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.cl-opts button { display: flex; justify-content: space-between; border: 0; background: none; padding: 1px 0; cursor: pointer; color: var(--ink); }
.cl-opts .v { color: var(--link); }
.cl-opts .v.mut { color: var(--mut); }

/* classeur */
.cl-book { display: grid; grid-template-rows: minmax(0, 1fr) 40px; grid-template-columns: minmax(0, 1fr); gap: 12px; min-height: 0; min-width: 0; }
.cl-grid { display: grid; gap: clamp(12px, 1.6vw, 22px); min-height: 0; min-width: 0; }
/* une case = le composant carte, centré dans sa cellule */
.cl-card {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; cursor: pointer; outline: none;
  opacity: 0; transform: translateX(calc(var(--dir, 1) * 28px));
  transition: opacity 260ms ease var(--d), transform 360ms var(--ease-soft) var(--d);
}
.cl-card { container-type: size; }
.cl-card .wcard { width: min(100cqw, 100cqh * 5 / 7); }
.cl-grid.in .cl-card { opacity: 1; transform: none; }
.cl-grid.out .cl-card { opacity: 0; transform: translateX(calc(var(--dir, 1) * -28px)); transition-delay: 0ms; }
.cl-card.on .wc-in { outline: 2px solid var(--link); outline-offset: 3px; }
.cl-grid.in .cl-card.on { transform: translateY(-4px); }
.cl-qty { position: absolute; right: 6px; bottom: 6px; z-index: 3; background: var(--ink); color: var(--on); font-size: 11px; font-weight: 700; padding: 1px 6px; pointer-events: none; }
.cl-empty { grid-column: 1 / -1; grid-row: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--sub); font-size: 15px; }
.cl-empty .h { font-family: var(--serif); font-size: 24px; color: var(--ink); }
.cl-pager { display: flex; align-items: center; justify-content: center; gap: 18px; font-size: 13px; color: var(--sub); }
.cl-pager .pg { border: 0; background: none; cursor: pointer; color: var(--link); font-size: 18px; padding: 0 8px; }
.cl-pager .pg.off { color: var(--ln2); cursor: default; pointer-events: none; }
.cl-pager .dots { display: flex; gap: 8px; align-items: center; }
.cl-pager .dot { width: 12px; height: 3px; padding: 0; border: 0; background: var(--ln2); cursor: pointer; transition: width 320ms var(--ease-soft), background 260ms ease; }
.cl-pager .dot.on { width: 28px; background: var(--link); }
.cl-pager .pn { color: var(--mut); min-width: 72px; }

/* fiche : le composant carte en grand, puis la rareté, le tier, le taux et la défausse */
.cl-ficheBox { display: flex; flex-direction: column; min-height: 0; }
.cl-fiche { display: flex; flex-direction: column; gap: 10px; min-height: 0; animation: cl-in 300ms var(--ease-soft); }
@keyframes cl-in { from { opacity: 0; transform: translateX(10px); } }
.cl-fiche .fc { display: flex; justify-content: center; padding: 10px 14px 6px; /* place pour l'inclinaison au survol et les coins des cartes rares */ }
.cl-fiche .fc .wcard { width: min(100%, calc((100vh - var(--top-h) - var(--foot-h) - 2 * clamp(20px, 3.5vh, 36px) - 166px) * 5 / 7)); }
.cl-fiche .fl { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.cl-fiche .fl .nm { display: flex; align-items: center; gap: 6px; font-family: var(--serif); font-size: 19px; color: var(--ink); }
.cl-fiche .fl .nm i { width: 8px; height: 8px; background: var(--rc); }
.cl-fiche .fl .nm em { font-style: normal; font-family: var(--sans); font-size: 11px; font-weight: 600; color: var(--mut); border: 1px solid var(--ln); padding: 1px 5px; }
.cl-fiche .fl .mt { font-size: 12px; color: var(--mut); }
.cl-fiche .fb { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.cl-fiche .fb .btn { font-size: 13px; padding: 5px 10px; }
.cl-fiche .wc-toast { text-align: center; }

/* choix du deck */
.cl-decks { display: flex; flex-direction: column; gap: 6px; }
.cl-dk { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border: 1px solid var(--ln); background: var(--bg); padding: 8px 12px; cursor: pointer; text-align: left; border-radius: var(--radius-btn); }
.cl-dk:hover:not(:disabled), .cl-dk:focus-visible { border-color: var(--link); background: var(--sel); outline: none; }
.cl-dk:disabled { cursor: not-allowed; color: var(--mut); background: var(--bg2); }
.cl-dk .n { font-family: var(--serif); font-size: 17px; }
.cl-dk .n i { font-family: var(--sans); font-style: normal; font-size: 11px; color: var(--link); margin-left: 6px; }
.cl-dk .c { font-size: 12px; color: var(--mut); }
.cl-decks .err { color: var(--err); }

/* taille des cartes (Petites / Moyennes / Grandes) : même style, typographie ajustée */
.cl-size { align-self: flex-start; }
.cl-size button { padding: 4px 10px; font-size: 12px; }

/* liens de la carte sélectionnée : occupent la place restante sous les boutons */
.cl-fiche { flex: 1; }
.cl-lk { flex: 1; min-height: 110px; display: flex; flex-direction: column; border-top: 1px solid var(--ln); padding-top: 8px; }
.cl-lk .wc-lkbox { flex: 1; }
.cl-fiche .wc-toast:not(.on) { min-height: 0; height: 0; }
@media (min-height: 700px) {
  .cl-fiche .fc .wcard { width: min(100%, calc((100vh - var(--top-h) - var(--foot-h) - 2 * clamp(20px, 3.5vh, 36px) - 316px) * 5 / 7)); }
}
/* petites hauteurs : la fiche montre la carte OU ses liens (onglets, touche L) */
.cl-ftabs { display: none; }
@media (max-height: 699px) {
  .cl-ftabs { display: block; flex: none; order: -3; }
  .cl-ftabs .wc-tabs button { padding: 4px 12px; }
  .cl-fiche.lk-on .fc, .cl-fiche.lk-on .fl { display: none; }
  .cl-fiche.lk-on .cl-lk { order: -2; border-top: 0; padding-top: 0; }
  .cl-fiche:not(.lk-on) .cl-lk { display: none; }
}

/* ---------- sélection multiple ---------- */
.cl-grid.multi { user-select: none; -webkit-user-select: none; }
.cl-ck { display: none; position: absolute; top: calc((100cqh - min(100cqw, 100cqh * 5 / 7) * 7 / 5) / 2 - 8px); left: calc((100cqw - min(100cqw, 100cqh * 5 / 7)) / 2 - 8px); z-index: 4; width: 20px; height: 20px; border: 2px solid var(--ln); background: var(--bg); pointer-events: none; box-sizing: border-box; }
.cl-grid.multi .cl-ck { display: block; }
.cl-card.pk .cl-ck { border-color: var(--link); background: var(--link); }
.cl-card.pk .cl-ck::after { content: ""; position: absolute; left: 50%; top: 45%; width: 5px; height: 10px; border: solid var(--on); border-width: 0 2px 2px 0; transform: translate(-50%, -50%) rotate(45deg); }
.cl-grid.multi .cl-card .wc-in { transition: outline-color 160ms ease; }
.cl-card.pk .wc-in { outline: 3px solid var(--link); outline-offset: 3px; }
.cl-card.pk.on .wc-in { outline-style: double; outline-width: 4px; }
/* estompe les cartes non cochées sur la carte elle-même : l'opacité de la case reste libre pour l'animation de page */
.cl-grid.multi .cl-card:not(.pk) .wcard { opacity: .78; transition: opacity 160ms ease; }

.cl-pick { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; animation: cl-in 300ms var(--ease-soft); }
.cl-pick .hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cl-pick .hd .t { font-family: var(--serif); font-size: clamp(22px, 3.6vh, 28px); line-height: 1; }
.cl-pick .hd .btn { font-size: 12px; padding: 4px 10px; }
.cl-pick .ct { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--sub); border-bottom: 2px solid var(--bg3); padding-bottom: 6px; }
.cl-pick .ct b { font-family: var(--serif); font-weight: 400; font-size: 17px; color: var(--ink); }
.cl-pick .qs { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--mut); }
.cl-pick .qs button { border: 0; background: none; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
.cl-pick .qs button:hover:not(:disabled) { text-decoration: underline; }
.cl-pick .qs button:disabled { color: var(--ln2); cursor: default; }
.cl-pick .ls { flex: 1; min-height: 60px; display: flex; flex-direction: column; border-top: 1px solid var(--bg3); }
.cl-pick .rw { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--bg3); font-size: 13px; }
.cl-pick .rw i { width: 8px; height: 8px; flex: none; background: var(--rc); }
.cl-pick .rw .n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.cl-pick .rw .q { font-size: 11px; font-weight: 700; color: var(--sub); }
.cl-pick .rw button { border: 0; background: none; color: var(--mut); font-size: 16px; line-height: 1; padding: 0 4px; cursor: pointer; }
.cl-pick .rw button:hover { color: var(--err); }
.cl-pick .hint { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--mut); }
.cl-pick .ac { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cl-pick .ac .btn { font-size: 12px; padding: 6px 8px; min-width: 0; white-space: normal; line-height: 1.25; }
.cl-pick .ac .btn-p { grid-column: 1 / -1; }

/* fenêtre de défausse : choix de la quantité */
.cl-ways { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.cl-ways .cl-dk .n i { color: var(--mut); }
.cl-ways .cl-dk.on { border-color: var(--link); background: var(--sel); box-shadow: inset 3px 0 0 var(--link); }
.cl-warn { color: var(--warn); font-size: 13px; }
.cl-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }
.cl-bar .cl-pager { grid-column: 2; }
.cl-mbtn { grid-column: 1; justify-self: start; max-width: 100%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; border: 0; background: none; padding: 4px 0; font-size: 13px; color: var(--link); cursor: pointer; }
.cl-mbtn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cl-mbtn:hover { text-decoration: underline; }
.cl-mbtn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.cl-mbtn i { flex: none; position: relative; box-sizing: border-box; width: 16px; height: 16px; border: 2px solid var(--ln); background: var(--bg); }
.cl-mbtn i.on { border-color: var(--link); background: var(--link); }
.cl-mbtn i.on::after { content: ""; position: absolute; left: 50%; top: 45%; width: 4px; height: 8px; border: solid var(--on); border-width: 0 2px 2px 0; transform: translate(-50%, -50%) rotate(45deg); }
@media (max-width: 1180px) { .cl-mbtn { font-size: 12px; } .cl-pager .pn { display: none; } }

/* favoris : étoile au coin de la carte */
.cl-fav { display: none; position: absolute; z-index: 4; pointer-events: none;
  top: calc((100cqh - min(100cqw, 100cqh * 5 / 7) * 7 / 5) / 2 - 9px); right: calc((100cqw - min(100cqw, 100cqh * 5 / 7)) / 2 - 9px);
  width: 22px; height: 22px; align-items: center; justify-content: center; background: var(--warn); color: var(--on); font-size: 13px; line-height: 1; box-shadow: 0 2px 6px -2px rgba(var(--shr), .5); }
.cl-card.fav .cl-fav { display: flex; }
.cl-favb.on { color: var(--warn); border-color: var(--warn); }
.cl-warn { color: var(--warn); }
/* Doublons et Favoris : deux interrupteurs sur une ligne */
.cl-tgl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cl-opts .cl-tgl button { justify-content: center; gap: 6px; border: 1px solid var(--ln2); padding: 3px 6px; font-size: 12px; color: var(--sub); background: var(--bg); }
.cl-opts .cl-tgl button .v { color: var(--mut); }
.cl-opts .cl-tgl button.on { border-color: var(--link); background: var(--sel); color: var(--link); }
.cl-opts .cl-tgl button[data-act="favf"].on { border-color: var(--warn); color: var(--warn); }
.cl-opts .cl-tgl button.on .v { color: inherit; }
.cl-side { gap: clamp(8px, 2vh, 28px); }
.cl-head { gap: 6px; }
.cl-opts { gap: 4px; }
.cl-rar { padding: 0; }
