/* ReyaMon Showdown – Draft-Modul (Board in Sheet-Optik, Team-Seiten, Tauschbörse) */

/* ---------- Gemeinsam: Teamlogo, Wer-Zeile, Pokémon-Icons ---------- */
.avatar.team-logo { object-fit: cover; image-rendering: auto; border-radius: 8px; background: var(--panel); }
.avatar.xxs { width: 18px; height: 18px; vertical-align: middle; }
.who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.team-nm { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-nm-big { display: block; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.picon { display: inline-block; width: 40px; height: 30px; flex: none; vertical-align: middle;
  background: url("https://play.pokemonshowdown.com/sprites/pokemonicons-sheet.png?v22") no-repeat; }
button.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
button.link-btn:hover { color: var(--link); text-decoration: underline; }
.my-team .avatar.lg { flex: none; }

/* ---------- Kopf / Status ---------- */
.d-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.d-head.my-turn { box-shadow: 0 0 0 2px #6a3cf0, var(--shadow); }
.on-clock.big { padding: 12px 16px; }
.on-clock.big .avatar { width: 56px; height: 56px; }
.on-clock.big strong { font-size: 1.25rem; }
.timer.paused { color: var(--muted); }
.d-manage { display: flex; gap: 6px; flex-wrap: wrap; }
.d-checklist { display: grid; gap: 6px; justify-items: start; font-size: .9rem; }
.d-checklist .ok { color: var(--good); }
.d-checklist .todo { color: var(--warn); }

/* ---------- Budget-Leiste über dem Board ---------- */
.d-board-panel { padding: 14px; }
.d-budget { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 10px 12px; margin: -2px 0 12px;
  border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.d-budget.other { border-style: dashed; }
.d-stat { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.d-stat b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.d-stat.big b { font-size: 1.5rem; color: #6a3cf0; }
.d-stat small { color: var(--muted); }
.d-stat.ok b { color: var(--good); }
.d-stat.no b { color: var(--accent); }
.d-legend { margin-left: auto; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.d-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 8px; vertical-align: -1px; }
.d-legend .lg.ok { background: var(--good); }
.d-legend .lg.no { background: repeating-linear-gradient(45deg, var(--muted) 0 2px, transparent 2px 5px); border: 1px solid var(--muted); }
.d-legend .lg.taken { background: var(--line); border: 1px solid var(--muted); }
.d-legend .lg.wish { width: auto; height: auto; color: #b07d00; font-weight: 700; }
@media (prefers-color-scheme: dark) { .d-stat.big b { color: #a98bff; } .d-legend .lg.wish { color: #f0c040; } }

/* ---------- Draft Board: Spalten je Kosten-Stufe (20 → 1), horizontal scrollbar ---------- */
.d-board-scroll { overflow-x: auto; padding-bottom: 6px; margin: 0 -4px; }
.d-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(142px, 1fr); gap: 6px; align-items: start; padding: 0 4px; }
.d-tier { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px; min-width: 0; }
.d-tier-head { display: flex; align-items: baseline; gap: 4px; position: sticky; top: 0;
  color: #fff; background: #6a3cf0; border-radius: 6px; padding: 4px 8px; margin-bottom: 3px; font-size: .78rem; }
.d-tier-head b { font-size: 1.1rem; line-height: 1; }
.d-tier-head .pts { opacity: .85; }
.d-tier-head .cnt { margin-left: auto; opacity: .8; font-variant-numeric: tabular-nums; }
.d-tier.ok .d-tier-head { background: var(--good); }
.d-tier.no .d-tier-head { background: repeating-linear-gradient(45deg, #8a90a0 0 6px, #7a8090 6px 12px); }
.d-tier.no { opacity: .92; }
.d-tier.naughty { border-color: #d63c3c66; }
.d-tier.naughty .d-tier-head { background: var(--accent); }

.d-item { display: flex; align-items: center; gap: 2px; width: 100%; min-height: 30px; padding: 0 4px 0 0; border: 0; border-radius: 5px; background: none;
  color: var(--ink); font: inherit; font-size: .8rem; text-align: left; cursor: pointer; position: relative; }
.d-item:hover { background: var(--panel); box-shadow: 0 0 0 1px var(--line); }
.d-item .picon { margin: -2px -4px -2px -6px; }
.d-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.d-item .nm small { display: block; font-size: .68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.d-item .by { flex: none; }
.d-item .by .avatar { border-radius: 4px; }
.d-item.taken .nm { color: var(--muted); }
.d-item.taken .nm::first-line { text-decoration: line-through; }
.d-item.taken .picon { opacity: .35; filter: grayscale(1); }
.d-item.nope { opacity: .45; }
.d-item.nope:hover { opacity: .8; }
.d-item.mine { background: #6a3cf01f; }
.d-item.mine .nm { color: var(--ink); font-weight: 600; }
.d-item.mine .nm::first-line { text-decoration: none; }
.d-item.mine .picon { opacity: 1; filter: none; }
.d-item.wished { box-shadow: inset 3px 0 0 #e0a400; }
.d-item .wish-no { font-size: .68rem; font-weight: 700; color: #b07d00; flex: none; }
.d-item.banned .nm { color: var(--accent); }
@media (prefers-color-scheme: dark) { .d-item .wish-no { color: #f0c040; } }

/* Einheitskosten (z. B. LC): eine Stufe als Raster */
.d-board.uniform { display: block; }
.d-board.uniform .d-tier { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px 6px; margin-bottom: 6px; }
.d-board.uniform .d-tier-head { grid-column: 1 / -1; }

/* ---------- Unter dem Board: Wunschliste, Kader, letzte Picks ---------- */
.draft-side { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.roster > div { padding: 4px 6px; border-radius: 6px; }
.roster > div.on { background: #6a3cf014; }
.roster .who { font-weight: 400; }
.mons-icons { display: flex; flex-wrap: wrap; }
.mons-icons .picon { margin: -2px -6px; }
.pick-log .slot .picon { margin: -6px -4px; }

/* ---------- Pool-Tabelle & Bann-Liste ---------- */
.d-pool-table input.d-cost { width: 70px; padding: 3px 6px; text-align: right; }
.naughty-panel { border-top: 4px solid var(--accent); }
.d-mon { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; white-space: nowrap; }
.d-mon .picon { margin: -6px 0 -6px -4px; flex: none; }
.d-icon { width: 32px; height: 32px; image-rendering: pixelated; margin: -4px 0; flex: none; }
.d-modal-stats { margin-top: 6px; }

/* ---------- Teams: Team-Seiten wie im Sheet ---------- */
.d-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 540px), 1fr)); gap: 14px; align-items: start; }
.d-team { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border-top: 4px solid #6a3cf0; min-width: 0; }
.d-team.mine { border-top-color: var(--accent); }
.d-team-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.d-team-head .avatar.lg { width: 56px; height: 56px; }
.d-team-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.d-team-nums { display: flex; flex-direction: column; align-items: flex-end; font-size: .8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.d-team-nums b { color: var(--ink); }
.d-team-nums .neg, .d-team-nums .neg b { color: var(--accent); }
.d-team-scroll { overflow-x: auto; }
table.d-sheet { font-size: .84rem; }
table.d-sheet th { font-size: .68rem; padding: 4px 5px; }
table.d-sheet td { padding: 1px 5px; height: 30px; }
table.d-sheet td.cost { font-weight: 700; color: #6a3cf0; width: 34px; }
table.d-sheet td.ic { width: 34px; padding: 0; }
table.d-sheet td.ic .picon { margin: 0 -4px; }
table.d-sheet td.mon-nm { white-space: nowrap; font-weight: 600; }
table.d-sheet td.types { white-space: nowrap; }
table.d-sheet td.types .type { font-size: .62rem; padding: 1px 5px; }
table.d-sheet .st { width: 34px; color: var(--muted); }
table.d-sheet td.st.s-good { color: var(--ink); }
table.d-sheet td.st.s-hi { color: var(--good); font-weight: 700; }
table.d-sheet td.st.s-lo { color: var(--accent); }
table.d-sheet td.bst { color: var(--ink); font-weight: 600; }
@media (prefers-color-scheme: dark) { table.d-sheet td.cost { color: #a98bff; } }
.d-team-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 14px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); background: var(--bg); min-height: 38px; }
.d-team-foot .btn { padding: 4px 10px; font-size: .85rem; }

/* ---------- MVP & Tausch ---------- */
td.empty-row { text-align: center; color: var(--muted); padding: 24px; }
.d-trade-out { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.d-trade .neg, .neg { color: var(--accent); }
.d-trade .pos, .pos { color: var(--good); }

@media (max-width: 700px) {
  .d-board { grid-auto-columns: minmax(132px, 1fr); }
  .d-legend { margin-left: 0; }
  .team-nm { max-width: 160px; }
  .d-team-head .avatar.lg { width: 44px; height: 44px; }
}

/* ---------- Board ohne Seitwärts-Scrollen (2026-11-30): volle Fensterbreite, Kostenstufen fließen wie
   Zeitungsspalten von oben nach unten und weiter in die nächste Spalte ---------- */
main:has(.d-board-panel) { max-width: none; }
.d-board-scroll { overflow-x: visible; margin: 0; }
.d-board:not(.uniform) { display: block; column-width: 168px; column-gap: 8px; padding: 0; }
.d-board:not(.uniform) .d-tier { display: block; margin: 0 0 8px; break-inside: auto; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.d-board:not(.uniform) .d-tier-head { position: static; break-after: avoid; break-inside: avoid; }
.d-board:not(.uniform) .d-item { break-inside: avoid; }

/* ---------- Bereich unter dem Board (2026-11-30): Wunschliste + letzte Picks nebeneinander,
   Kader als breites Raster mit einer Karte je Coach (Reihenfolge #1 … #12 wie im Sheet) ---------- */
.draft-side { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.draft-side > .panel:has(.roster) { grid-column: 1 / -1; order: 3; }
.draft-side .roster { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.draft-side .roster > div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); }
.draft-side .roster > div.on { border-color: #6a3cf0; }
.draft-side .roster .mons-icons { display: flex; flex-wrap: wrap; gap: 0; margin-top: 4px; }
.draft-side .roster .d-tb-btn { margin-top: 6px; width: 100%; }
.draft-side .pick-log { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 14px; }
.draft-side { grid-template-columns: 1fr 1fr; }
.draft-side > .panel:only-child, .draft-side > .panel:has(.pick-log):nth-child(2):last-child { grid-column: 1 / -1; }
@media (max-width: 820px) { .draft-side { grid-template-columns: 1fr; } }

/* Tauschbörse: Formular links, „Free agents left“ rechts im selben Kasten; darunter Transactions */
.d-trades, .d-trades .stack { grid-template-columns: minmax(0, 1fr); }
.d-trades * { min-width: 0; }
.d-trade-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; margin-top: 4px; }
@media (max-width: 900px) { .d-trade-grid { grid-template-columns: minmax(0, 1fr); } }
.d-fa-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); margin-top: 12px; }
.d-fa-title { margin: 0 0 6px; font-size: .95rem; }
table.d-fa { width: 100%; table-layout: fixed; }
table.d-fa td:first-child { overflow: hidden; }
table.d-fa .who-inline { max-width: 100%; }
table.d-fa .who-text, table.d-fa .who-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.d-tx td { vertical-align: middle; }
table.d-tx td:nth-child(3), table.d-tx td:nth-child(4) { line-height: 1.9; }
table.d-tx th:first-child, table.d-tx td:first-child { width: 56px; }
.d-trade .d-trade-out { display: flex; flex-wrap: wrap; gap: 6px; }
.d-trade select, .d-trade input { max-width: 100%; }
