/* menu du haut : voir style.css (thème commun) */

/* Deckbuilder : le deck en haut (grandes cartes), le catalogue en dessous (petites cartes) + aperçu */
.db-layout {
  flex: 1; display: grid; grid-template-columns: 1fr; grid-template-rows: auto minmax(420px, 70vh);
  grid-template-areas: "deck" "catalog"; overflow: auto; min-height: 0;
}
.catalog { grid-area: catalog; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line);
  border-top: 1px solid var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: center; }
.filters input[type=search] {
  flex: 1 1 220px; font: inherit; color: var(--text); background: var(--mat-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
}
.colors { display: flex; gap: 4px; }
.colors button { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid transparent; opacity: .45; }
.colors button.on { opacity: 1; border-color: #fff; }
.check { color: var(--muted); font-size: 12px; display: flex; gap: 4px; align-items: center; }
.count { padding: 6px 12px; color: var(--muted); font-size: 12px; }
.grid {
  flex: 1; overflow: auto; padding: 4px 12px 16px; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); align-content: start; gap: 5px;
}
.tile { position: relative; cursor: pointer; border-radius: 6px; aspect-ratio: .716; background: #223; }
.tile img { width: 100%; height: 100%; border-radius: 6px; display: block; }
.tile:hover { outline: 2px solid var(--select); }
.tile .qty {
  position: absolute; top: 4px; right: 4px; background: var(--gold); color: #000; font-weight: 800;
  border-radius: 10px; padding: 0 7px; font-size: 12px;
}
.tile .nocode {
  position: absolute; bottom: 4px; left: 4px; right: 4px; background: rgba(0,0,0,.75); color: var(--muted);
  font-size: 9px; text-align: center; border-radius: 3px;
}
.tile.illegal { opacity: .35; }

/* aperçu de la carte survolée : fixé en bas à droite de l'écran, par-dessus la page */
.db-preview {
  position: fixed; right: 16px; bottom: 16px; z-index: 40; width: 320px; max-height: calc(100vh - 90px);
  overflow: auto; padding: 12px; background: rgba(15, 24, 38, .97); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 34px rgba(0, 0, 0, .7);
  pointer-events: none;  /* ne bloque jamais le curseur : il disparaît dès qu'on quitte la carte */
}
.db-preview img { width: 100%; border-radius: 10px; }
.db-preview h3 { margin: 8px 0 4px; font-size: 15px; }
.db-preview p { font-size: 13px; line-height: 1.45; white-space: pre-line; margin: 6px 0; }
.db-preview .empty-hint { margin: 0; }

.deck { grid-area: deck; display: flex; flex-direction: column; background: var(--panel); }
.deck-head { padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); }
.deck-head #deck-name { flex: 0 1 260px; }
.deck-body { display: grid; grid-template-columns: 300px 1fr; min-height: 0; }
.deck-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.deck-side .talk { padding: 0 12px 12px; }
.deck-head input {
  font: inherit; color: var(--text); background: var(--mat-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px;
}
.row { display: flex; gap: 6px; flex-wrap: wrap; }
button.primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
button.danger { background: #3a2124; border-color: #6b2f36; }
.leader-slot { padding: 10px 12px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); min-height: 96px; }
.leader-slot img { width: 110px; border-radius: 8px; }
.leader-slot .label { margin-bottom: 2px; }
.stats { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.stats .total { font-size: 16px; font-weight: 700; }
.stats .total.ok { color: var(--good); }
.stats .errors { color: var(--accent); margin: 0; padding-left: 16px; }
.stats .warn { color: var(--gold); }
.curve { display: flex; align-items: flex-end; gap: 3px; height: 54px; }
.curve > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.curve .bar { width: 100%; background: var(--select); border-radius: 2px 2px 0 0; min-height: 1px; }
.curve span { font-size: 9px; color: var(--muted); }
.deck-list { padding: 6px 14px 16px; min-height: 260px; }
.deck-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.dtile { position: relative; border-radius: 8px; cursor: pointer; aspect-ratio: .716; background: #223;
  box-shadow: 0 3px 10px rgba(0,0,0,.5); }
.dtile img { width: 100%; height: 100%; border-radius: 8px; display: block; }
.dtile .n { position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,.85); color: #fff; font-weight: 800;
  font-size: 18px; border-radius: 10px; padding: 1px 9px; border: 2px solid var(--gold); }
.dtile .ctl { position: absolute; top: 6px; left: 6px; display: none; gap: 4px; }
.dtile:hover .ctl { display: flex; }
.dtile:hover { outline: 2px solid var(--select); }
.dtile .ctl button { padding: 1px 10px; font-weight: 800; background: rgba(0,0,0,.8); }
.dtile.nocode::after { content: "⚠ effet non codé"; position: absolute; top: 6px; right: 6px; font-size: 10px;
  background: rgba(0,0,0,.8); color: var(--gold); border-radius: 4px; padding: 0 4px; }
.deck-list h4 { margin: 10px 0 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.entry { display: grid; grid-template-columns: 34px 1fr auto auto auto; gap: 6px; align-items: center; padding: 2px 0; }
.entry img { width: 34px; border-radius: 3px; }
.entry .nm { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .nm small { color: var(--muted); }
.entry .n { font-weight: 700; min-width: 18px; text-align: center; }
.entry button { padding: 0 8px; }
.entry.nocode .nm::after { content: " ⚠"; color: var(--gold); }

.box.import { width: min(560px, 92vw); max-height: 80vh; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.box.import input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.import-list { overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; max-height: 55vh; }
.import-list label { display: flex; gap: 6px; font-size: 13px; padding: 2px 4px; border-radius: 4px; }
.import-list label:hover { background: var(--bg); }
.overlay[hidden] { display: none; }
#paste-text {
  font: 13px/1.4 ui-monospace, Consolas, monospace; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px; resize: vertical;
}

@media (max-width: 1100px) {
  .db-preview { width: 240px; }
}
@media (max-width: 760px) {
  .deck-body { grid-template-columns: 1fr; }
  .deck-side { border-right: 0; }
  .deck-cards { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

/* discussion de la team sur un deck */
.talk { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.talk h3 { margin: 0; font-size: 14px; }
.talk-list { max-height: 320px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.talk-msg { background: var(--mat-2); border-radius: 8px; padding: 6px 9px; font-size: 13px; }
.talk-msg p { margin: 3px 0; white-space: pre-wrap; }
.talk-head { display: flex; justify-content: space-between; gap: 8px; }
.talk-changes { list-style: none; margin: 4px 0; padding: 0; }
.talk-changes li { cursor: default; }
.talk-changes li.plus { color: var(--good); }
.talk-changes li.minus { color: var(--accent); }
.talk-status { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 8px; margin-top: 3px; }
.talk-status.open { background: #a8892f; color: #fff; }
.talk-status.accepted { background: #2f8f5b; color: #fff; }
.talk-status.rejected { background: #6b3a3a; color: #fff; }
.talk-actions { display: flex; gap: 6px; margin-top: 4px; }
.talk-actions button { padding: 2px 9px; font-size: 12px; }
.talk-actions button.link { background: none; border: none; color: var(--muted); text-decoration: underline; }
.talk textarea { width: 100%; font: inherit; color: var(--text); background: var(--mat-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; resize: vertical; box-sizing: border-box; }

/* probabilités de pioche */
.odds-box { padding: 8px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.odds-box h3 { margin: 0; font-size: 14px; }
.odds-box .row label { font-size: 12px; color: var(--muted); }
.odds-pick { max-height: 150px; overflow: auto; display: flex; flex-direction: column; gap: 1px; font-size: 12px; }
.odds-pick label { display: flex; gap: 6px; align-items: center; padding: 1px 4px; border-radius: 4px; cursor: pointer; }
.odds-pick label.on { background: color-mix(in srgb, var(--select) 18%, transparent); }
.odds-pick small { color: var(--muted); }
.odds-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.odds-table th, .odds-table td { padding: 3px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.odds-table th:first-child, .odds-table td:first-child { text-align: left; }
.odds-table td { font-variant-numeric: tabular-nums; font-weight: 600; }

/* boutons qui ouvrent les panneaux (calculateur, répartition, discussion) */
button.toggle.on { border-color: var(--select); background: color-mix(in srgb, var(--select) 22%, var(--mat-2)); }
#curve-box h3 { margin: 0; font-size: 14px; }

.delete-list { max-height: 50vh; overflow-y: auto; margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.delete-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* fiches leader : listes regroupées par leader + stats */
.box.leaders { width: min(1100px, 96vw); max-height: 88vh; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.leaders-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.leaders-head h2 { margin: 0; flex: 1; }
.leaders-head input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; }
.leaders-grid { overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; padding: 2px; }
.leader-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.leader-card.focus { outline: 2px solid var(--gold, #d4a017); }
.leader-card header { display: flex; align-items: center; gap: 10px; }
.leader-card header img { width: 44px; height: 44px; object-fit: cover; object-position: 50% 22%; border-radius: 50%; flex: none; }
.leader-card header div { flex: 1; min-width: 0; }
.leader-card h3 { margin: 0; font-size: 15px; }
.leader-card h4 { margin: 4px 0 2px; font-size: 12px; color: var(--muted); font-weight: normal; }
.lc-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.lc-mu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lc-mu ul, .lc-decks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.lc-mu li { display: flex; align-items: center; gap: 5px; }
.lc-mu li img { width: 20px; height: 20px; object-fit: cover; object-position: 50% 22%; border-radius: 50%; flex: none; }
.lc-decks li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.lc-decks .link { background: none; border: none; padding: 0; color: var(--accent, #6cb4ff); cursor: pointer; font: inherit; text-decoration: underline; }
.lc-decks .warn { color: #e0a030; }
.lc-mu li b, .lc-mu li .label { white-space: nowrap; }
.lc-mu li { flex-wrap: nowrap; }
