/* ============================================
   PHILLIES WIRE — INNINGS TIMELINE
   Extends ../dashboard.css — reuses layout shell + motion tokens.
   ============================================ */

.dash-app,
.stage {
  min-width: 0;
  max-width: 100%;
}

.stage { gap: 18px; }

/* Filter toggle in topbar */
.filter-group {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--dash-border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.filter-btn {
  appearance: none;
  border: 0; background: transparent;
  color: var(--dash-ink-dim);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition:
    color      var(--t-hover) var(--ease-out-spring),
    background var(--t-hover) var(--ease-out-spring),
    transform  var(--t-press) var(--ease-snappy);
}
.filter-btn:hover  { color: var(--dash-ink); }
.filter-btn:active { transform: scale(0.94); }
.filter-btn[aria-pressed="true"] {
  background: var(--dash-brand);
  color: #fff;
}

/* Matchup card */
.innings-matchup {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 18px 22px;
  background: linear-gradient(160deg, var(--dash-surface) 0%, var(--dash-surface-raise) 100%);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius-lg);
  box-shadow: var(--dash-shadow);
  animation: card-enter var(--t-entry) var(--ease-out-spring) both;
  min-width: 0;
}
.matchup-head {
  font-family: var(--font-serif, Georgia, serif);
  font-size: clamp(20px, 2.2vw, 26px);
  color: var(--dash-ink);
  line-height: 1.3;
}
.matchup-detail {
  color: var(--dash-ink-dim);
  font-size: 13px;
  margin-top: 4px;
}

/* Linescore card */
.linescore-card {
  padding: 18px 22px;
  background: linear-gradient(160deg, var(--dash-surface) 0%, var(--dash-surface-raise) 100%);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius-lg);
  box-shadow: var(--dash-shadow);
  display: flex; flex-direction: column; gap: 14px;
  animation: card-enter var(--t-entry) var(--ease-out-spring) 80ms both;
  overflow: hidden;
  min-width: 0;
}
.linescore-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.linescore-note { font-size: 11px; color: var(--dash-ink-quiet); font-style: italic; }

.linescore-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.linescore {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px;
  font-family: var(--font-mono, "IBM Plex Mono", ui-monospace, monospace);
  font-size: 14px;
  min-width: 560px;
}
.linescore thead th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dash-ink-quiet);
  padding: 6px 0;
  text-align: center;
}
.linescore thead th.team-col  { text-align: left; padding-left: 8px; }
.linescore thead th.total-col { color: var(--dash-ink-dim); }
.linescore tbody td,
.linescore tbody th {
  padding: 10px 4px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  color: var(--dash-ink-dim);
  min-width: 34px;
}
.linescore tbody .team-col {
  text-align: left;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--dash-ink);
  font-family: var(--font-display, "Bangers", sans-serif);
  font-size: 16px;
  letter-spacing: 0.08em;
  font-weight: 600;
  min-width: 58px;
}
.linescore tbody .total-col {
  color: var(--dash-ink);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.04);
}
.linescore tbody tr[data-slot="line-home"] th.team-col { color: var(--dash-brand); }
.linescore td.has-run {
  color: var(--dash-ink);
  background: rgba(232, 24, 40, 0.10);
  border-color: rgba(232, 24, 40, 0.30);
}
.linescore td.high-run {
  background: rgba(232, 24, 40, 0.22);
  border-color: rgba(232, 24, 40, 0.50);
  color: #fff;
}
.linescore td.current-inning {
  outline: 2px solid var(--dash-brand);
  outline-offset: -2px;
}

/* Plays card */
.plays-card {
  padding: 18px 22px;
  background: linear-gradient(160deg, var(--dash-surface) 0%, var(--dash-surface-raise) 100%);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius-lg);
  box-shadow: var(--dash-shadow);
  display: flex; flex-direction: column; gap: 14px;
  animation: card-enter var(--t-entry) var(--ease-out-spring) 160ms both;
  min-width: 0;
}
.plays-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.plays-count {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dash-ink-dim);
}

.plays-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plays-empty {
  color: var(--dash-ink-quiet);
  font-size: 13px;
  line-height: 1.5;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.08);
}
.plays-empty code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--dash-ink-dim);
  padding: 1px 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
}

.timeline-host {
  position: relative;
  min-width: 0;
}
.timeline-wrap {
  display: flex;
  border: 1px solid var(--dash-border);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  max-width: 100%;
  min-width: 0;
}
.timeline-gutter {
  flex: 0 0 58px;
  border-right: 1px solid var(--dash-ink);
  background: var(--dash-surface);
  position: relative;
  z-index: 1;
}
.timeline-gutter-head { height: 42px; }
.timeline-team-lane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--dash-border);
}
.timeline-team-lane.is-phi {
  background: color-mix(in srgb, var(--dash-brand) 8%, transparent);
}
.timeline-team-abbr {
  color: var(--dash-ink);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.timeline-team-lane.is-phi .timeline-team-abbr { color: var(--dash-brand); }
.timeline-team-total {
  color: var(--dash-ink);
  font-family: var(--font-serif, Georgia, serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}
.timeline-run-label {
  height: 34px;
  display: grid;
  place-items: center;
  border-top: 1px solid var(--dash-ink);
  color: var(--dash-ink-quiet);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.18em;
}
.timeline-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.timeline-scroll::-webkit-scrollbar { height: 9px; }
.timeline-scroll::-webkit-scrollbar-thumb {
  background: var(--dash-border);
  border-radius: 999px;
}
.timeline-svg {
  display: block;
  min-width: 100%;
}
.timeline-grid-line,
.timeline-lane-line {
  stroke: var(--dash-border);
  stroke-width: 1;
}
.timeline-total-line {
  stroke: var(--dash-ink);
  stroke-width: 1;
}
.timeline-phi-band {
  fill: var(--dash-brand);
  opacity: 0.035;
}
.timeline-inning-label,
.timeline-run {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  fill: var(--dash-ink-quiet);
}
.timeline-inning-label {
  font-size: 12px;
  fill: var(--dash-ink);
  font-weight: 700;
}
.timeline-run.has-run {
  fill: var(--dash-brand);
  font-weight: 800;
}
.timeline-marker {
  cursor: default;
  outline: none;
}
.timeline-marker[tabindex] { cursor: pointer; }
.timeline-marker:focus-visible {
  filter: drop-shadow(0 0 0.35rem var(--dash-brand));
}
.marker-fill.is-phi { fill: var(--dash-brand); }
.marker-fill.is-opp { fill: var(--dash-navy-soft); }
.marker-stroke.is-phi {
  fill: transparent;
  stroke: var(--dash-brand);
  stroke-width: 2;
}
.marker-stroke.is-opp {
  fill: transparent;
  stroke: var(--dash-navy-soft);
  stroke-width: 2;
}
.marker-ring {
  fill: transparent;
  stroke: var(--dash-gold);
  stroke-width: 1.5;
}
.marker-muted-stroke {
  fill: transparent;
  stroke: var(--dash-ink-quiet);
  stroke-width: 2.2;
  stroke-linecap: round;
}
.marker-muted-fill { fill: var(--dash-ink-quiet); }
.timeline-tooltip {
  position: fixed;
  z-index: 50;
  max-width: 280px;
  display: grid;
  gap: 4px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--dash-ink);
  color: var(--dash-surface);
  box-shadow: var(--dash-shadow);
  pointer-events: none;
}
.timeline-tooltip[hidden] { display: none; }
.timeline-tooltip strong {
  font-size: 12.5px;
  line-height: 1.2;
}
.timeline-tooltip span {
  font-size: 12px;
  line-height: 1.4;
}
.timeline-tooltip em {
  color: var(--dash-gold);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-style: normal;
}
.plays-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.play-row {
  display: grid;
  grid-template-columns: 48px 24px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  animation: row-slide-in var(--t-entry) var(--ease-out-spring) both;
  transition: background var(--t-hover) var(--ease-out-spring);
}
.play-row:hover { background: rgba(255, 255, 255, 0.04); }
.play-inning {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--dash-ink-quiet);
  text-align: center;
}
.play-marker {
  width: 20px; height: 20px;
  display: grid; place-items: center;
}
.play-text { color: var(--dash-ink); font-size: 13px; }
.play-actor { color: var(--dash-ink-quiet); font-size: 11px; font-style: italic; }

.plays-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
  color: var(--dash-ink-quiet);
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }

/* Event markers */
.marker {
  width: 12px; height: 12px;
  display: inline-block;
  border-radius: 50%;
}
.marker-score { background: var(--dash-brand); }
.marker-hr    { background: var(--dash-gold); clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); border-radius: 0; }
.marker-xbh   { background: var(--dash-ink); border-radius: 0; transform: rotate(45deg); width: 10px; height: 10px; }
.marker-single { background: var(--dash-ink); }
.marker-walk  { background: transparent; border: 2px solid var(--dash-ink); }
.marker-error { background: transparent; border: 2px solid var(--dash-ink); border-radius: 0; width: 10px; height: 10px; }
.marker-key   { background: transparent; border: 2px solid var(--dash-navy-soft); border-radius: 0; transform: rotate(45deg); width: 10px; height: 10px; }
.marker-k     { background: transparent; color: var(--dash-bad); font-family: var(--font-mono, ui-monospace, monospace); font-weight: 700; font-size: 13px; line-height: 1; border-radius: 0; }
.marker-k::before { content: "\00d7"; }
.marker-out   { background: var(--dash-ink-quiet); width: 14px; height: 4px; border-radius: 999px; }

/* ── At-bat card ──────────────────────────── */
.atbat-card {
  background: linear-gradient(160deg, var(--dash-surface) 0%, var(--dash-surface-raise) 100%);
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius-lg);
  box-shadow: var(--dash-shadow);
  padding: 18px 22px;
  animation: card-enter var(--t-entry) var(--ease-out-spring) both;
  animation-delay: 140ms;
  min-width: 0;
}
.atbat-card[hidden] { display: none; }
.atbat-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.atbat-pill {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--dash-brand);
  color: #fff;
  border: 1px solid var(--dash-brand);
}
.atbat-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 20px;
  padding-top: 14px;
  align-items: start;
}
.atbat-batter { min-width: 0; }
.batter-name {
  font-family: var(--font-display, "Bangers", sans-serif);
  font-size: clamp(22px, 2.4vw, 26px);
  color: var(--dash-ink);
  line-height: 1.1;
  letter-spacing: 0.02em;
}
.batter-meta {
  color: var(--dash-ink-dim);
  font-size: 12px;
  margin-top: 4px;
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.04em;
}
.pitch-seq-label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dash-ink-quiet);
  margin-top: 16px;
  margin-bottom: 8px;
}
.pitch-seq {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
}
.pitch-seq-empty {
  color: var(--dash-ink-quiet);
  font-style: italic;
  font-size: 12px;
}
.pitch {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px; font-weight: 700;
  border: 1px solid var(--dash-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dash-ink-dim);
}
.pitch[data-kind="B"] { background: rgba(74, 138, 225, 0.18); color: #6fb1ff; border-color: rgba(74, 138, 225, 0.4); }
.pitch[data-kind="S"] { background: rgba(245, 180, 84, 0.16); color: var(--dash-warn); border-color: rgba(245, 180, 84, 0.4); }
.pitch[data-kind="F"] { background: rgba(255, 255, 255, 0.06); color: var(--dash-ink-dim); }
.pitch[data-kind="X"] { background: var(--dash-brand); color: #fff; border-color: var(--dash-brand); }

.atbat-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
}
.diamond {
  width: 100%;
  max-width: 200px;
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
}
.diamond .base {
  fill: rgba(255, 255, 255, 0.06);
  stroke: rgba(255, 255, 255, 0.25);
  stroke-width: 1.4;
  transition: fill var(--t-hover) var(--ease-out-spring);
}
.diamond .base[data-on="true"] {
  fill: var(--dash-brand);
  stroke: #fff;
}
.diamond .home {
  fill: rgba(255, 255, 255, 0.04);
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1.4;
}

.count-bars {
  display: grid;
  gap: 14px;
}
.count-group { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.count-label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dash-ink-quiet);
}
.count-dots { display: flex; gap: 5px; }
.count-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--dash-border);
  transition: background var(--t-hover) var(--ease-out-spring);
}
.count-dot[data-on="true"] { background: var(--dash-brand); border-color: var(--dash-brand); }
.count-dot[data-kind="out"][data-on="true"] { background: var(--dash-ink); border-color: var(--dash-ink); }

/* Mobile — stack nav, compact linescore */
@media (max-width: 768px) {
  .innings-matchup { flex-direction: column; gap: 8px; }
  .linescore { font-size: 12px; min-width: 440px; }
  .filter-group { align-self: stretch; justify-content: stretch; }
  .filter-btn { flex: 1; }
  .atbat-body { grid-template-columns: 1fr; gap: 14px; }
  .atbat-field { grid-template-columns: 1fr; }
  .diamond { max-width: 180px; }
}
