/* Playoff Machine overhaul (2026-10-07).
   Bracket + scenario board layout. Every color resolves from theme tokens so
   the light and dark themes keep text on real contrast; the machine never
   ships hardcoded white panels. Loaded last so it can correct the legacy
   playoff panels that predate the neutral theme. */

:root {
  --pm-track: #e4e4e7;
  --pm-accent: #1f55c5;
  --pm-in-bg: #f2f8f4;
  --pm-in-edge: #0f7a4d;
  --pm-out-edge: #a1a1aa;
  --pm-chip-green-bg: #e3f6ec;
  --pm-chip-green-ink: #0b5f3b;
  --pm-chip-gold-bg: #fdf1cf;
  --pm-chip-gold-ink: #6f4a00;
  --pm-chip-red-bg: #fde7ea;
  --pm-chip-red-ink: #9d1624;
  --pm-chip-gray-bg: #ececf0;
  --pm-chip-gray-ink: #3f3f46;
}

html[data-theme="dark"] {
  --pm-track: #2e2e33;
  --pm-accent: #8eb4ff;
  --pm-in-bg: #16241d;
  --pm-in-edge: #4fbf8a;
  --pm-out-edge: #52525b;
  --pm-chip-green-bg: #12332a;
  --pm-chip-green-ink: #8fe6b6;
  --pm-chip-gold-bg: #3a2e12;
  --pm-chip-gold-ink: #ffd479;
  --pm-chip-red-bg: #3d1c23;
  --pm-chip-red-ink: #ff9aa5;
  --pm-chip-gray-bg: #26262b;
  --pm-chip-gray-ink: #d4d4d8;
}

#playoff { display: grid; gap: 14px; }
#playoff .machine-hero { margin-bottom: 0; }
#playoff .pm-hero { overflow: hidden; }
#playoff .machine-hero .eyebrow { color: #ff9d94; }

.pm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  min-width: 0;
}

.pm-picker { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pm-picker > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pm-picker .select { min-width: 190px; max-width: 100%; }

.pm-legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 800; }
.pm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.pm-dot.is-clinched { background: var(--pm-chip-green-ink); }
.pm-dot.is-alive { background: var(--pm-chip-gray-ink); }
.pm-dot.is-eliminated { background: var(--pm-chip-red-ink); }

.pm-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }

.pm-conf {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  padding: 14px;
}

.pm-conf-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.pm-conf-head h2 { margin: 0; color: var(--ink); font-size: 26px; line-height: 1; }
.pm-conf-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.pm-cutline-chip {
  max-width: 52%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--wash);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.pm-bracket { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
.pm-bracket-col { display: grid; gap: 8px; align-content: center; min-width: 0; }
.pm-match { display: grid; gap: 8px; }

.pm-slot { min-width: 0; }
.pm-slot-btn {
  display: grid;
  gap: 7px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--pm-out-edge);
  border-radius: 12px;
  background: var(--wash);
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.pm-slot.is-in .pm-slot-btn { border-left-color: var(--pm-in-edge); background: var(--pm-in-bg); }
.pm-slot.is-selected .pm-slot-btn { border-color: var(--pm-accent); box-shadow: 0 0 0 2px var(--pm-accent); }
.pm-slot-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.pm-slot-top strong { color: var(--ink); font-size: 15px; }
.pm-seed {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--panel);
  font-size: 11px;
  font-weight: 1000;
}
.pm-record { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.pm-slot .team-mark { width: 30px; height: 26px; border-radius: 7px; }
.pm-slot .team-mark img { width: 22px; height: 22px; }
.pm-bye-tag { justify-self: center; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }

.pm-odds { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; min-width: 0; }
.pm-odds-track { height: 7px; border-radius: 999px; background: var(--pm-track); overflow: hidden; }
.pm-odds-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--pm-accent), #22c55e); }
.pm-odds b { min-width: 34px; color: var(--ink); font-size: 11px; font-weight: 900; text-align: right; }

.pm-chip {
  justify-self: start;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  background: var(--pm-chip-gray-bg);
  color: var(--pm-chip-gray-ink);
  white-space: nowrap;
}
.pm-chip.is-clinched { background: var(--pm-chip-green-bg); color: var(--pm-chip-green-ink); }
.pm-chip.is-eliminated { background: var(--pm-chip-red-bg); color: var(--pm-chip-red-ink); }

.pm-chase { margin-top: 12px; }
.pm-chase h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pm-chase-list { display: grid; gap: 6px; }
.pm-chase-row {
  display: grid;
  grid-template-columns: 22px auto minmax(0, 1fr) minmax(84px, 0.8fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 6px 9px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.pm-chase-row.is-selected { border-color: var(--pm-accent); box-shadow: inset 3px 0 0 var(--pm-accent); }
.pm-chase-row .team-mark { width: 26px; height: 22px; border-radius: 6px; }
.pm-chase-row .team-mark img { width: 18px; height: 18px; }

.pm-name { display: grid; min-width: 0; }
.pm-name strong { color: var(--ink); font-size: 13px; }
.pm-name small { color: var(--muted); font-size: 11px; font-weight: 700; }

.pm-slot-btn:hover, .pm-chase-row:hover, .pm-race-row:hover { border-color: var(--pm-accent); }

.pm-outlook {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  padding: 16px;
}
.pm-outlook-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pm-outlook-id { flex: 1 1 240px; min-width: 0; }
.pm-outlook-id h2 { margin: 2px 0 4px; color: var(--ink); font-size: 30px; line-height: 1; }
.pm-outlook-id p { margin: 0; color: var(--ink); font-size: 13px; font-weight: 800; }
.pm-outlook-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pm-action {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--wash);
  color: var(--ink);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.pm-action--ghost { background: var(--panel); }

.pm-outlook-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pm-outlook-col { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--wash); padding: 12px; }
.pm-outlook-col h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pm-odds-list { display: grid; gap: 9px; }
.pm-odds-row { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: center; gap: 8px; }
.pm-odds-row > span:first-child { color: var(--ink); font-size: 12px; font-weight: 800; }
.pm-model-note { margin: 0 0 8px; color: var(--muted); font-size: 10.5px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.pm-outlook-col > .pm-model-note:last-child { margin: 8px 0 0; }

.pm-impact-list, .pm-race-list, .pm-outlook-paths { display: grid; gap: 8px; }
.pm-impact-row { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 9px; }
.pm-impact-row header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pm-impact-row header strong { color: var(--ink); font-size: 12px; }
.pm-impact-row header span { color: var(--muted); font-size: 11px; font-weight: 800; text-align: right; overflow-wrap: anywhere; }
.pm-impact-meter { display: grid; gap: 4px; }
.pm-impact-meter small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.pm-impact-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pm-impact-pair span { border-radius: 8px; padding: 6px 8px; font-size: 11px; font-weight: 900; text-align: center; }
.pm-impact-win { background: var(--pm-chip-green-bg); color: var(--pm-chip-green-ink); }
.pm-impact-loss { background: var(--pm-chip-red-bg); color: var(--pm-chip-red-ink); }

.pm-race-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) minmax(74px, 0.8fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 6px 8px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.pm-scenarios { display: grid; gap: 14px; }

#playoff .pm-outlook .eyebrow { color: var(--muted); }
#playoff .team-mark span { color: #18181b; }

#playoff .scenario-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
#playoff .pm-board-head { align-items: flex-start; }
#playoff .pm-board-head h2 { color: var(--ink); font-size: 20px; }
#playoff .pm-board-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }
#playoff .scenario-grid { margin-top: 10px; }

#playoff .scenario-card {
  grid-template-columns: minmax(112px, 0.3fr) minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--pm-accent);
  border-radius: 12px;
  background: var(--wash);
  box-shadow: none;
  padding: 12px;
}
#playoff .scenario-card.is-selected { box-shadow: 0 0 0 2px var(--pm-accent); }
#playoff .scenario-card.scenario-one_seed { border-left-color: var(--pm-chip-gold-ink); }
#playoff .scenario-card.scenario-division,
#playoff .scenario-card.scenario-playoff { border-left-color: var(--pm-in-edge); }
#playoff .scenario-card.scenario-elimination { border-left-color: var(--pm-chip-red-ink); }

#playoff .scenario-team {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
#playoff .scenario-team strong { display: block; color: var(--ink); font-size: 20px; line-height: 1; }
#playoff .scenario-team-copy span { color: var(--muted); font-size: 11px; font-weight: 800; }
#playoff .scenario-team .team-mark { width: 44px; height: 36px; }

.pm-scenario-copy { min-width: 0; }
.pm-scenario-lead { margin: 0 0 6px; color: var(--ink); font-size: 13px; font-weight: 900; overflow-wrap: anywhere; }
.pm-scenario-list { display: grid; gap: 4px; margin: 0; padding-left: 18px; }
.pm-scenario-list li { color: var(--ink); font-size: 12.5px; font-weight: 800; overflow-wrap: anywhere; }
.pm-scenario-none { margin: 0; color: var(--muted); font-size: 12px; font-weight: 800; }

.pm-empty {
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--wash);
  color: var(--muted);
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .pm-bracket { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .pm-board { grid-template-columns: 1fr; }
  .pm-outlook-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .pm-bracket { grid-template-columns: 1fr; }
  .pm-conf-head { flex-direction: column; }
  .pm-cutline-chip { max-width: 100%; }
  .pm-outlook-id h2 { font-size: 24px; }
}

@media (max-width: 430px) {
  .pm-chase-row { grid-template-columns: 22px auto minmax(0, 1fr) auto; }
  .pm-chase-row .pm-chip { grid-column: 4; grid-row: 1; }
  .pm-chase-row .pm-odds { grid-column: 1 / -1; grid-row: 2; }
  .pm-race-row { grid-template-columns: 22px minmax(0, 1fr) minmax(64px, 0.8fr); }
  .pm-picker .select { min-width: 0; width: 100%; }
  .pm-picker { flex: 1 1 100%; }
}
