/* Dual-pane Matchup / Liga — layout + container density (not viewport). */

:root { --split-min: 1150px }

.split-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  min-width: 0;
  width: 100%;
}
/*
 * Two columns + full-height center line.
 * Both routes: independent flex stacks, panes stretch to equal height.
 * Matchup: .split-bench { margin-top: auto } parks both Bench headers
 * on one baseline (gap sits under the shorter starter column).
 * No subgrid — that collapsed starter rows on top of each other.
 */
.split-stage.is-split {
  --split-row-gap: 12px;
  --split-col-gap: 12px;
  position: relative;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto;
  column-gap: calc(var(--split-col-gap) * 2 + 1px);
  row-gap: 0;
  align-items: stretch;
  align-content: start;
  height: auto;
  background-image: linear-gradient(var(--line, #e4e8e2), var(--line, #e4e8e2));
  background-size: 1px 100%;
  background-position: center top;
  background-repeat: no-repeat;
}
.split-pane[data-pane="a"] { grid-column: 1; grid-row: 1 }
.split-pane[data-pane="b"] { grid-column: 2; grid-row: 1 }
.split-stage.is-split > .split-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: var(--split-row-gap);
  min-width: 0;
  min-height: 0;
  height: auto;
  overflow: visible;
}
.split-divider {
  display: none;
}

/* Matchup: push Bench to a shared floor without stretching the stage. */
body[data-route="matchup"] .split-stage.is-split > .split-pane > .split-bench {
  margin-top: auto;
}

body[data-route="league"] .split-stage.is-split > .split-pane > .league-grid {
  min-width: 0;
}

/* Same surface language as .topbar-mini — navy chip, not olive rail accent. */
.split-header-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  gap: 6px;
  margin: 8px 0 8px 10px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2px;
  color: #c5d2e6;
  background: #1a2c48;
  border: 1px solid #2a4060;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.split-header-btn:hover {
  background: #223756;
  border-color: #3a5478;
  color: #e8eef8;
}
.split-header-btn:active { transform: scale(0.96) }
.split-header-btn.active {
  color: #fff;
  background: #243a5a;
  border-color: #5a7ab0;
  box-shadow: inset 0 0 0 1px #5a7ab080;
}
.split-header-btn .ph { font-size: 15px; color: inherit }
.split-header-btn[hidden] { display: none !important }

@media (max-width: 650px) {
  .split-header-btn { display: none !important }
}
.split-pane {
  container-type: inline-size;
  container-name: split-pane;
  min-width: 0;
}
.split-pane-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 2px;
}

.split-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  margin: 4px 0 14px;
}
.split-map-pane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f4f6f8;
  border: 1px solid #e2e7ee;
}
.split-map-pane.is-right {
  background: #eef4fb;
  border-color: #d4e0ef;
}
.split-map-pane strong {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  color: #1a334d;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.split-map-pane small {
  font-size: 11px;
  color: #6a7a8c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.split-map-select {
  padding: 6px 8px;
  cursor: pointer;
}
.split-right-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 6px 28px 6px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1a334d;
  font: 800 13px/1.25 Manrope, Arial, sans-serif;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.2 1.2L6 6l4.8-4.8' stroke='%236a7a8c' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  cursor: pointer;
}
.split-right-select:focus-visible {
  outline: 2px solid var(--accent, #ef743b);
  outline-offset: 2px;
}
.split-right-select:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.split-map-swap {
  align-self: center;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid #d4e0ef;
  background: #fff;
  color: #25466f;
  padding: 0;
}
.split-map-swap:hover:not(:disabled) { background: #eef4fb }
.split-map-swap:disabled { opacity: .4; cursor: not-allowed }
.split-map-swap .ph { font-size: 18px }

/*
 * Tabs-Zeile im Subgrid: volle Pill-Höhe reservieren.
 * Sonst kollabiert die Zeile (Spacer rechts = 0) und das Scoreboard
 * überdeckt die Übersichtskarten.
 */
.split-stage.is-split {
  --split-tabs-h: 64px;
}
.split-pane .matchup-tabs--spacer {
  display: block;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.split-stage.is-split:has(.matchup-tabs:not(.matchup-tabs--spacer)) .matchup-tabs--spacer {
  min-height: var(--split-tabs-h);
}
.split-stage.is-split > .split-pane > .matchup-tabs {
  margin: 0;
  align-self: start;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.split-stage.is-split > .split-pane > .matchup-tabs:not(.matchup-tabs--spacer) {
  min-height: var(--split-tabs-h);
  padding: 0;
  /* overflow-x:auto würde overflow-y auf auto zwingen und Pills vertikal clippen */
  overflow: visible;
  mask-image: none;
  -webkit-mask-image: none;
}
.split-stage.is-split > .split-pane > .matchup-tabs .matchup-pill {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  min-height: var(--split-tabs-h);
  height: auto;
  box-sizing: border-box;
}
.split-stage.is-split > .split-pane > .matchup-tabs,
.split-stage.is-split > .split-pane > .matchup-stage,
.split-stage.is-split > .split-pane > .split-bench,
.split-stage.is-split > .split-pane > .league-grid,
.split-stage.is-split > .split-pane > .split-pane-chrome {
  flex: 0 0 auto;
  min-width: 0;
  width: 100%;
}
.split-stage.is-split > .split-pane > .split-bench > .bench-panel {
  margin-top: 0;
}

/*
 * Matchup split: natural starter height only — never viewport-fill or
 * flex-shrink rows (that crushed names on top of each other).
 * Keep .matchup-panel overflow:hidden so scoreboard top radius still clips.
 */
body[data-route="matchup"] .split-workspace.is-split .matchup-stage,
body[data-route="matchup"] .split-workspace.is-split .matchup-panel,
body[data-route="matchup"] .split-workspace.is-split .matchup-panel > .lineup-list {
  flex: 0 0 auto;
  height: auto !important;
  max-height: none !important;
  min-height: 0;
}
body[data-route="matchup"] .split-workspace.is-split .matchup-stage,
body[data-route="matchup"] .split-workspace.is-split .matchup-panel > .lineup-list {
  overflow: visible !important;
}
body[data-route="matchup"] .split-workspace.is-split .matchup-panel {
  overflow: hidden;
}
body[data-route="matchup"] .split-workspace.is-split .matchup-panel > .lineup-list > .lineup-row {
  flex: 0 0 auto !important;
  height: auto;
  max-height: none;
  min-height: var(--starter-row-min, 68px);
}
body[data-route="matchup"] .split-workspace.is-split :is(.matchup-panel, .bench-panel) .lineup-list > .lineup-row > .player-cell {
  height: auto;
  min-height: var(--starter-row-min, 68px);
  padding-bottom: var(--matchup-cell-pad-y, 4px);
  align-content: stretch;
}
body[data-route="matchup"] .split-workspace.is-split .matchup-panel > .lineup-list {
  padding-bottom: 2px;
}
.split-pane-league {
  font-size: 12px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.split-narrow-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff4ef;
  border: 1px solid #f0d0c4;
  color: #8a3d28;
  font-size: 12px;
  font-weight: 700;
}

.split-pane .primary-column { min-width: 0 }
.split-workspace.is-split .sidebar { display: none }

/*
 * Split panes are too narrow for 64px headshots × 2 cells.
 * Matchup desktop grid uses --matchup-photo-w for the shot track + .player-shot
 * width; set it to 0 so columns collapse without reflowing name/score.
 * Keep shot in the grid (visibility:hidden) — display:none would re-auto-place.
 */
.split-stage.is-split {
  --matchup-photo-w: 0px;
}
.split-stage.is-split .player-shot {
  visibility: hidden;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  overflow: hidden;
  pointer-events: none;
}
/* Non-matchup / legacy 3-col grids that hardcode 64px */
.split-stage.is-split .player-cell {
  grid-template-columns: 0 minmax(0, 1fr) 56px;
}
.split-stage.is-split .player-cell.opp {
  grid-template-columns: 56px minmax(0, 1fr) 0;
}
body[data-route="matchup"] .split-stage.is-split :is(.matchup-panel, .bench-panel) .lineup-list > .lineup-row > .player-cell {
  grid-template-columns: var(--matchup-photo-w) minmax(0, 1fr) var(--matchup-score-w, 52px);
  padding-left: 0;
  padding-right: var(--matchup-cell-pad-x, 6px);
}
body[data-route="matchup"] .split-stage.is-split :is(.matchup-panel, .bench-panel) .lineup-list > .lineup-row > .player-cell.opp {
  grid-template-columns: var(--matchup-score-w, 52px) minmax(0, 1fr) var(--matchup-photo-w);
  padding-left: var(--matchup-cell-pad-x, 6px);
  padding-right: 0;
}
body[data-route="matchup"] .split-stage.is-split :is(.matchup-panel, .bench-panel) .lineup-list .player-shot {
  width: var(--matchup-photo-w);
  min-width: var(--matchup-photo-w);
}

@container split-pane (max-width: 560px) {
  .scoreboard { padding: 8px 10px 6px }
  .hero-team h2 { font-size: 12px; -webkit-line-clamp: 1 }
  .team-record { display: none }
  .hero-score { font-size: 30px }
  .hero-logo { width: 28px; height: 28px }
  .pc-name { font-size: 11px }
  .pc-score { font-size: 17px }
  .matchup-pill { padding: 5px 8px; font-size: 10px }
  .league-grid { grid-template-columns: 1fr }
}

.picker-section { margin-bottom: 14px }
.picker-section h3 {
  font-size: 10px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted, #7c8680);
  margin: 0 0 8px;
}
