*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  overflow-y: visible;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #0f1117;
  color: #c9d1d9;
  line-height: 1.6;
  font-size: 16px;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  overflow-y: visible;
}

#app {
  width: 100%;
  min-width: 0;
  max-width: 1368px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #161b22; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* ── Section wrapper ── */
.dashboard-section {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 16px 24px;
  margin-bottom: 12px;
}

.dashboard-section.no-pad-top {
  padding-top: 0;
}

.section-label {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b949e;
  margin-bottom: 1rem;
}


.section-label-sub {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #6e7681;
}

/* ── Standings ── */
#standings {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  overflow: hidden;
}

.standings-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.75rem 0.2rem;
}
.sh-rank  { width: 1rem;  flex-shrink: 0; }
.sh-dot   { width: 7px;   flex-shrink: 0; }
.sh-name  { flex: 1; }
.sh-total { width: 4rem;  text-align: right; font-size: 0.62rem; color: #6e7681; text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; }
.sh-gap   { width: 3rem;  text-align: right; font-size: 0.62rem; color: #6e7681; text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; }
.sh-last5 {
  width: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 0.62rem;
  color: #6e7681;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  margin-left: calc(0.5rem + 8px);
}

.standing-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.75rem;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 5px;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
}

.standing-col { flex-shrink: 0; }

.standing-rank {
  font-size: 0.78rem;
  font-weight: 600;
  width: 1rem;
  text-align: center;
}

.rank-1 { color: #d29922; }
.rank-2 { color: #8b949e; }
.rank-3 { color: #b45309; }

.standing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.standing-name {
  flex: 1;
  font-weight: 500;
  font-size: 0.85rem;
}

.standing-total {
  width: 4rem;
  text-align: right;
  font-size: 0.88rem;
  font-weight: 500;
}

.standing-gap {
  width: 3rem;
  text-align: right;
  font-size: 0.72rem;
  font-weight: 500;
}

.standing-gap.leader { color: #3fb950; }
.standing-gap.behind { color: #6e7681; }

.standing-last5 {
  display: flex;
  gap: 3px;
  align-items: center;
  width: 5.5rem;
  flex-shrink: 0;
  margin-left: calc(0.5rem + 8px);
}

.last5-badge {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.last5-badge.pos-1     { background: #d29922; }
.last5-badge.pos-2     { background: #8b949e; }
.last5-badge.pos-3     { background: #b45309; }
.last5-badge.pos-empty { background: #30363d; }

/* ── Chart ── */
.chart-tabs {
  display: flex;
  border-bottom: 1px solid #21262d;
  margin-bottom: 1.25rem;
}

.chart-tab {
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.6rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #8b949e;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.chart-tab:hover {
  color: #c9d1d9;
}

.chart-tab.active {
  color: #c9d1d9;
  border-bottom-color: #58a6ff;
}

.chart-wrap {
  position: relative;
  height: 280px;
}

/* ── Featured Matchups ── */
#matchup-summary {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.matchup-summary-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.matchup-summary-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.matchup-summary-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.matchup-summary-name {
  font-size: 0.82rem;
  font-weight: 500;
}

.matchup-summary-bar-wrap {
  height: 6px;
  background: #21262d;
  border-radius: 999px;
  overflow: hidden;
}

.matchup-summary-bar {
  height: 100%;
  border-radius: 999px;
  border: 1px solid;
}

.matchup-summary-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.matchup-summary-pts {
  font-size: 0.9rem;
  font-weight: 500;
}

.matchup-summary-rate {
  font-size: 0.68rem;
  color: #8b949e;
}

/* Grid */
.grid-scroll {
  overflow-x: auto;
}

.matchup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.grid-user-header {
  min-width: 100px;
}

.grid-race-header {
  text-align: center;
  padding: 0 0.25rem 0.5rem;
  min-width: 58px;
  white-space: nowrap;
}

.grid-wk {
  display: block;
  font-weight: 500;
  color: #8b949e;
  font-size: 0.7rem;
}

.grid-track {
  display: block;
  color: #6e7681;
  font-size: 0.65rem;
}

.grid-user-cell {
  padding: 0.35rem 0.5rem 0.35rem 0;
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.grid-user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.grid-cell {
  text-align: center;
  padding: 0.3rem 0.25rem;
  font-weight: 500;
  border-radius: 4px;
}

.grid-cell.sweep { background: rgba(63,185,80,0.18);  color: #3fb950; }
.grid-cell.good  { background: rgba(63,185,80,0.1);   color: #3fb950; }
.grid-cell.mid   { background: rgba(210,153,34,0.15); color: #d29922; }
.grid-cell.low   { background: rgba(248,81,73,0.1);   color: #f85149; }
.grid-cell.zero  { background: rgba(248,81,73,0.18);  color: #f85149; }
.grid-cell.none  { background: transparent; color: #3d444d; }

/* ── Race detail ── */
.detail-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.detail-controls select {
  flex: 1;
  font-size: 0.85rem;
  padding: 8px 12px;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #0f1117;
  color: #c9d1d9;
  cursor: pointer;
}

.detail-controls select:focus {
  border-color: #58a6ff;
  outline: none;
}

.placeholder {
  font-size: 0.85rem;
  color: #6e7681;
  text-align: center;
  padding: 1.5rem 0;
}

.error   { color: #f85149; }
.loading { color: #8b949e; }

/* ── Awards ──────────────────────────────────────────────────────────────── */
#awards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.award-card {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 6px;
}

.award-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.award-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }

.award-title {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6e7681;
}

.award-winner {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.award-value {
  font-size: 0.78rem;
  color: #c9d1d9;
  font-weight: 500;
}

.award-context {
  font-size: 0.68rem;
  color: #6e7681;
}

.award-secondary {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
  font-size: 0.68rem;
  color: #6e7681;
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid #30363d;
}

.award-secondary-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6e7681;
  flex-shrink: 0;
}

/* ── Poll bar ── */
.live-poll-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.poll-last-lap {
  font-size: 0.72rem;
  color: #6e7681;
}

.poll-toggle-btn {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.7rem;
  border: 1px solid #30363d;
  border-radius: 999px;
  background: transparent;
  color: #8b949e;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.poll-toggle-btn:hover {
  background: #21262d;
  color: #c9d1d9;
}

/* ── Lap progress bar ── */
.lap-progress {
  margin: 0.75rem 0;
}

.lap-progress-track {
  display: flex;
  gap: 3px;
  height: 22px;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 6px;
  padding: 3px;
  box-sizing: border-box;
}

.lap-seg {
  position: relative;
  background: #161b22;
  border-radius: 3px;
  overflow: hidden;
  min-width: 0;
}

.lap-seg-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: #1f6feb;
  border-radius: 3px;
  z-index: 1;
}

.lap-seg-fill.caution {
  background: #d29922;
}

.lap-seg-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  z-index: 3;
}

.lap-progress-footer {
  position: relative;
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: #6e7681;
  margin-top: 0.25rem;
}

.lap-progress-current {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-weight: 600;
  color: #c9d1d9;
  white-space: nowrap;
}

/* ── Live Charts ── */
#live-charts-area {
  margin-bottom: 1.25rem;
}

.charts-prerace-msg {
  padding: 1.75rem 1rem;
  text-align: center;
}

.charts-prerace-line1 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #8b949e;
}

.charts-prerace-line2 {
  font-size: 0.78rem;
  color: #6e7681;
  margin-top: 0.3rem;
}

.live-chart-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6e7681;
  margin-bottom: 0.5rem;
}

.live-chart-wrap {
  position: relative;
  height: 200px;
}

.live-chart-wrap--breakdown {
  height: 160px;
  margin-top: 1.25rem;
}

/* ── Live Race ── */
.live-race-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.live-race-name {
  font-size: 1rem;
  font-weight: 500;
}

.live-race-meta {
  font-size: 0.78rem;
  color: #8b949e;
  font-weight: 400;
}

.live-badge {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  background: #f85149;
  color: #0f1117;
}

.live-badge.finished { background: #30363d; color: #8b949e; }
.live-badge.upcoming { background: #21262d; color: #8b949e; font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 0.72rem; }

.live-flag {
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: #21262d;
  color: #c9d1d9;
}

.live-flag.green  { background: rgba(63,185,80,0.18);  color: #3fb950; }
.live-flag.yellow { background: rgba(210,153,34,0.18); color: #d29922; }
.live-flag.red    { background: rgba(248,81,73,0.18);  color: #f85149; }

#live-content {
  margin-top: 0.75rem;
}

.live-view-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #21262d;
  border-radius: 6px;
  background: #0f1117;
}

.comparison-scope {
  min-width: 11rem;
  padding: 0.3rem 1.75rem 0.3rem 0.55rem;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #161b22;
  color: #c9d1d9;
  font-size: 0.75rem;
}

#live-content.comparison-active .comparison-excluded {
  display: none;
}

#live-content.pair-comparison .live-user-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.live-user-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (max-width: 520px) {
  .live-user-grid,
  #live-content.pair-comparison .live-user-grid {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }

  .comparison-scope {
    width: 100%;
    min-width: 0;
  }

  .live-user-col {
    padding: 0.6rem;
    min-width: 0;
    max-width: 100%;
  }

  .live-user-header {
    flex-wrap: wrap;
  }

  .live-user-pts-eq {
    width: 100%;
    justify-content: flex-end;
    padding-top: 0.15rem;
  }

  .live-pick-row,
  .live-pick-subtotal {
    flex-wrap: nowrap;
    gap: 0.18rem;
  }

  .live-pick-col-header {
    gap: 0.18rem;
  }

  .live-pick-car {
    width: 1.6rem;
    font-size: 0.62rem;
  }

  .live-pick-col-header span:nth-child(n+3),
  .live-pick-pos,
  .live-pick-stage-pts,
  .live-pick-proj-pts,
  .live-pick-pos-pts {
    width: 1.65rem;
    font-size: 0.62rem;
  }

  .live-pick-total-pts,
  .live-pick-col-header span:last-child {
    width: 1.95rem;
    font-size: 0.66rem;
  }

  .live-pick-pos-pts {
    color: #8b949e;
  }

  .live-pick-name {
    flex: 1 1 0;
    width: 0;
    gap: 0.18rem;
  }

  .driver-use-badge {
    padding: 0.02rem 0.2rem;
    font-size: 0.5rem;
  }

}

.comparison-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.comparison-summary-panel {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #30363d;
}

.comparison-summary-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.comparison-summary-stat + .comparison-summary-stat {
  padding-left: 1rem;
  border-left: 1px solid #30363d;
}

.comparison-summary-label {
  color: #8b949e;
  font-size: 0.75rem;
}

.comparison-summary-names {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.3rem;
  margin-top: 0.65rem;
}

.comparison-summary-name {
  padding: 0.12rem 0.45rem;
  border: 1px solid #30363d;
  border-radius: 999px;
  background: #161b22;
  color: #c9d1d9;
  font-size: 0.68rem;
  white-space: nowrap;
}

.comparison-summary-empty {
  color: #6e7681;
  font-size: 0.7rem;
  font-style: italic;
}

.comparison-garage-note {
  margin-left: auto;
  color: #d29922;
  font-size: 0.7rem;
}

@media (max-width: 520px) {
  .comparison-summary-grid {
    grid-template-columns: 1fr;
  }

  .comparison-summary-stat + .comparison-summary-stat {
    padding-top: 1rem;
    padding-left: 0;
    border-top: 1px solid #30363d;
    border-left: none;
  }

  .comparison-garage-note {
    width: 100%;
    margin-left: 0;
  }
}

.live-user-col {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0.75rem;
}

.live-user-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #30363d;
}

.live-user-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.live-user-name {
  font-size: 0.82rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-user-pts {
  font-size: 0.85rem;
  font-weight: 500;
  color: #58a6ff;
  flex-shrink: 0;
}

.live-user-pts-eq {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.live-pts-drv {
  font-size: 0.8rem;
  font-weight: 500;
  color: #c9d1d9;
}
.live-pts-op {
  font-size: 0.7rem;
  font-weight: 400;
  color: #8b949e;
}
.live-pts-mu {
  font-size: 0.8rem;
  font-weight: 500;
  color: #8b949e;
}
.live-pts-total {
  font-size: 0.88rem;
  font-weight: 500;
  color: #58a6ff;
}

.live-picks-label {
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6e7681;
  margin: 0.5rem 0 0.3rem;
}

.live-pick-subtotal {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0;
  margin-top: 0.1rem;
  border-top: 1px solid #30363d;
  font-size: 0.7rem;
}

.live-pick-subtotal .live-pick-name {
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6e7681;
}

.live-pick-subtotal .live-pick-stage-pts,
.live-pick-subtotal .live-pick-pos-pts {
  color: #6e7681;
}

.live-pick-subtotal .live-pick-stage-pts.has-pts { color: #8b949e; font-weight: 500; }
.live-pick-subtotal .live-pick-pos-pts.has-pts   { color: #58a6ff; font-weight: 500; }

.live-picks-label.garage-label {
  color: #d29922;
  margin-top: 0.6rem;
}

.garage-locked-badge {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(210,153,34,0.15);
  color: #d29922;
  border: 1px solid rgba(210,153,34,0.3);
  vertical-align: middle;
  margin-left: 0.3rem;
}

.live-pick-row.garage-pick {
  background: rgba(210,153,34,0.06);
  border-radius: 5px;
  padding-left: 0.3rem;
  padding-right: 0.3rem;
  margin-left: -0.3rem;
  margin-right: -0.3rem;
}

.live-pick-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0;
  font-size: 0.78rem;
}

#live-content.comparison-active .shared-pick,
#live-content.comparison-active .live-pick-subtotal,
#live-content.comparison-active .garage-label,
#live-content.comparison-active .live-matchup-pts-row {
  display: none;
}

.comparison-garage-icon {
  display: none;
  flex-shrink: 0;
  font-size: 0.68rem;
  line-height: 1;
  filter: grayscale(1);
  opacity: 0.8;
}

#live-content.comparison-active:not(.garage-ignored) .comparison-garage-icon {
  display: inline;
}

#live-content.comparison-active:not(.garage-ignored) .garage-pick {
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  margin-left: 0;
  margin-right: 0;
}

#live-content.comparison-active.garage-ignored .garage-pick {
  display: none;
}

.live-pick-car {
  font-size: 0.68rem;
  font-weight: 500;
  color: #6e7681;
  width: 2.2rem;
  flex-shrink: 0;
}

.live-pick-name {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  overflow: hidden;
  font-weight: 400;
}

.live-pick-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.driver-use-badge {
  flex-shrink: 0;
  padding: 0.03rem 0.28rem;
  border: 1px solid #30363d;
  border-radius: 999px;
  background: #161b22;
  color: #8b949e;
  font-size: 0.56rem;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
}

.driver-use-badge.uses-2 {
  border-color: rgba(210,153,34,0.4);
  color: #d29922;
}

.driver-use-badge.uses-1 {
  border-color: rgba(249,115,22,0.5);
  color: #f97316;
}

.driver-use-badge.uses-0 {
  border-color: rgba(248,81,73,0.5);
  color: #f85149;
}

.fastest-lap-badge {
  font-size: 0.6rem;
  font-weight: 600;
  color: #3fb950;
  background: rgba(63,185,80,0.12);
  border: 1px solid rgba(63,185,80,0.35);
  border-radius: 3px;
  padding: 0.05rem 0.2rem;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.4;
}

.live-pick-col-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0 0.15rem;
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6e7681;
}

.live-pick-col-header span:nth-child(n+3) {
  flex-shrink: 0;
  width: 2rem;
  text-align: right;
}

.live-pick-pos {
  font-size: 0.72rem;
  font-weight: 500;
  color: #8b949e;
  flex-shrink: 0;
  width: 2rem;
  text-align: right;
}

.live-pick-stage-pts {
  font-size: 0.7rem;
  font-weight: 400;
  color: #6e7681;
  flex-shrink: 0;
  width: 2rem;
  text-align: right;
  white-space: nowrap;
}

.live-pick-stage-pts.potential {
  color: #8b949e;
  font-weight: 400;
  text-decoration: underline dashed #8b949e;
}

.live-pick-proj-pts {
  font-size: 0.7rem;
  font-weight: 400;
  color: #8b949e;
  text-decoration: underline dashed #8b949e;
  flex-shrink: 0;
  width: 2rem;
  text-align: right;
}

.live-pick-pos-pts {
  font-size: 0.72rem;
  font-weight: 500;
  color: #58a6ff;
  flex-shrink: 0;
  width: 2rem;
  text-align: right;
}

.live-pick-pos-pts.projected {
  color: #8b949e;
  font-weight: 400;
}

.live-pick-subtotal .live-pick-pos-pts.has-pts.projected {
  color: #8b949e;
  font-weight: 400;
}

.live-pick-total-pts {
  width: 2.5rem;
  flex-shrink: 0;
  color: #58a6ff;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: right;
}

.live-pick-col-header span:last-child {
  width: 2.5rem;
}

.garage-pick .live-pick-stage-pts,
.garage-pick .live-pick-pos-pts,
.garage-pick .live-pick-total-pts {
  color: #8b949e;
  font-weight: 400;
}

.live-matchup-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0;
  font-size: 0.75rem;
}

.live-matchup-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.live-matchup-name .vs {
  color: #6e7681;
  font-weight: 400;
  font-size: 0.68rem;
}

.live-matchup-right {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.live-matchup-pos {
  font-size: 0.72rem;
  font-weight: 500;
  color: #8b949e;
  flex-shrink: 0;
}

.live-matchup-delta {
  font-size: 0.72rem;
  font-weight: 500;
  flex-shrink: 0;
}

.live-matchup-delta.ahead  { color: #3fb950; }
.live-matchup-delta.behind { color: #f85149; }

.live-matchup-pts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid #30363d;
}

.live-matchup-pts-label {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6e7681;
}

.live-matchup-pts-value {
  font-size: 0.75rem;
  font-weight: 500;
  color: #8b949e;
}

.live-matchup-pts-value.sweep { color: #3fb950; }

/* ── Projected Standings ── */
.proj-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #21262d;
  font-size: 0.85rem;
}

.proj-row:last-child { border-bottom: none; }

.proj-rank {
  font-size: 0.78rem;
  font-weight: 500;
  width: 1.2rem;
  color: #6e7681;
  text-align: center;
  flex-shrink: 0;
}

.proj-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.proj-name {
  flex: 1;
  font-weight: 500;
  min-width: 0;
}

.proj-season {
  font-size: 0.78rem;
  color: #8b949e;
  flex-shrink: 0;
}

.proj-plus {
  font-size: 0.78rem;
  font-weight: 500;
  color: #58a6ff;
  flex-shrink: 0;
  min-width: 3rem;
  text-align: right;
}

.proj-eq {
  color: #30363d;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.proj-total {
  font-weight: 500;
  font-size: 0.95rem;
  flex-shrink: 0;
  min-width: 3.5rem;
  text-align: right;
}

.proj-change {
  font-size: 0.78rem;
  font-weight: 500;
  min-width: 1.5rem;
  text-align: right;
  flex-shrink: 0;
}

.proj-change.up   { color: #3fb950; }
.proj-change.down { color: #f85149; }
.proj-change.same { color: #30363d; }

/* ── API info ── */
.api-info-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.api-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: #0f1117;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  min-width: 80px;
}

.api-info-label {
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6e7681;
}

.api-info-value {
  font-size: 0.82rem;
  font-weight: 500;
  color: #c9d1d9;
}

/* ── Debug panel ── */
.debug-panel {
  border-style: dashed;
  border-color: #30363d;
  background: #161b22;
}

.debug-panel .section-label {
  margin-bottom: 0.75rem;
}

.debug-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.debug-btn {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #0f1117;
  color: #8b949e;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.debug-btn:hover {
  background: #21262d;
  color: #c9d1d9;
}

.debug-btn.active {
  background: #21262d;
  color: #c9d1d9;
  border-color: #58a6ff;
}

.debug-btn-reset {
  margin-left: auto;
  color: #6e7681;
  border-color: #21262d;
  opacity: 0.55;
}

.debug-btn-reset.active {
  background: #3fb950;
  color: #0f1117;
  border-color: #3fb950;
  opacity: 1;
  font-weight: 500;
}

.debug-btn-reset.active::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0f1117;
  margin-right: 5px;
  vertical-align: middle;
  animation: live-pulse 1.5s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

/* ── Race to Daytona panel ── */
.rtd-panel-header {
  cursor: pointer;
  user-select: none;
}
.rtd-panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}
.rtd-chevron {
  font-size: 1.4rem;
  color: #d29922;
  transition: transform 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.rtd-panel.open .rtd-chevron { transform: rotate(180deg); }
.rtd-panel-body { display: none; }
.rtd-panel.open .rtd-panel-body { display: block; }
.rtd-inner-section {
  padding-top: 1.25rem;
  margin-top: 1.25rem;
  border-top: 1px solid #21262d;
}
.rtd-sub {
  font-size: 0.72rem;
  color: #6e7681;
  margin-top: 0.15rem;
}
.rtd-tab-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
@media (max-width: 500px) {
  .rtd-tab-grid { grid-template-columns: 1fr; }
}
.rtd-tab-card {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem 1rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.rtd-tab-card.in-credit { border-color: rgba(63,185,80,0.4); }
.rtd-tab-card.in-debt   { border-color: rgba(248,81,73,0.35); }
.rtd-tab-name {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #8b949e;
  margin-bottom: 0.2rem;
}
.rtd-tab-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rtd-tab-balance {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.rtd-tab-balance.positive { color: #3fb950; }
.rtd-tab-balance.negative { color: #f85149; }
.rtd-tab-balance.zero     { color: #6e7681; }
.rtd-tab-label { font-size: 0.72rem; color: #6e7681; }
.rtd-tab-record {
  font-size: 0.72rem;
  color: #6e7681;
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid #30363d;
}
.rtd-tab-debts {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid #30363d;
}
.rtd-tab-debt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
}
.rtd-tab-debt-name { color: #6e7681; }
.rtd-tab-debt-amt  { font-weight: 500; }
.rtd-tab-debt-amt.owes { color: #f85149; }
.rtd-tab-debt-amt.owed { color: #3fb950; }
.rtd-tab-debt-amt.even { color: #6e7681; }
.rtd-race-row {
  padding: 0.65rem 0;
  border-bottom: 1px solid #21262d;
}
.rtd-race-row:last-child { border-bottom: none; }
.rtd-race-row.finish-line { border-bottom: none; }
.rtd-race-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.rtd-race-wk {
  font-size: 0.65rem;
  font-weight: 500;
  color: #6e7681;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  width: 2.6rem;
}
.rtd-race-date { font-size: 0.72rem; color: #6e7681; flex-shrink: 0; width: 3.5rem; }
.rtd-race-track { font-size: 0.88rem; font-weight: 500; flex: 1; min-width: 0; }
.rtd-race-track.upcoming { color: #6e7681; font-weight: 400; }
.rtd-results-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.3rem;
  padding-left: 7.6rem;
}
.rtd-race-badge {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  flex-shrink: 0;
}
.rtd-race-badge.live   { background: #f85149; color: #0f1117; }
.rtd-race-badge.final  { border: 1px solid #30363d; color: #6e7681; }
.rtd-race-badge.finish { background: #d29922; color: #0f1117; font-weight: 700; letter-spacing: 0.04em; }
.rtd-score-item { display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
.rtd-score-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.rtd-score-name { font-size: 0.75rem; color: #6e7681; }
.rtd-score-pts  { font-size: 0.75rem; font-weight: 500; color: #8b949e; }
.rtd-score-item.winner { min-width: 10rem; }
.rtd-score-item.winner .rtd-score-name { font-weight: 600; font-size: 0.88rem; }
.rtd-score-item.winner .rtd-score-pts  { font-size: 0.88rem; color: #3fb950; }
.rtd-score-divider { color: #30363d; font-size: 0.65rem; }
.rtd-losers-stack { display: flex; flex-direction: column; gap: 0.2rem; }
.rtd-off-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #21262d;
}
.rtd-off-label { font-size: 0.78rem; color: #30363d; font-style: italic; }
.rtd-live-pending { font-size: 0.75rem; color: #f85149; font-style: italic; padding: 0.15rem 0 0.1rem; }
.rtd-flag-strip {
  height: 10px;
  border-radius: 3px;
  background-color: #c9d1d9;
  background-image:
    linear-gradient(45deg, #0f1117 25%, transparent 25%),
    linear-gradient(-45deg, #0f1117 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0f1117 75%),
    linear-gradient(-45deg, transparent 75%, #0f1117 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
  opacity: 0.55;
}
.rtd-header-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #d29922;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rtd-daytona-banner { padding: 1.5rem 0 0.5rem; text-align: center; }
.rtd-daytona-stripe {
  height: 12px;
  border-radius: 3px;
  margin: 0 -24px 1.75rem;
  background-color: #c9d1d9;
  background-image:
    linear-gradient(45deg, #0f1117 25%, transparent 25%),
    linear-gradient(-45deg, #0f1117 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0f1117 75%),
    linear-gradient(-45deg, transparent 75%, #0f1117 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
  opacity: 0.75;
}
.rtd-daytona-word {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #d29922;
  line-height: 1;
}
.rtd-daytona-sub {
  font-size: 0.72rem;
  color: #6e7681;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.5rem;
}

/* ── Narrow layouts, including iPhone 12/13 mini ── */
@media (max-width: 600px) {
  #app {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .dashboard-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Keep the useful standings columns visible without horizontal overflow. */
  .sh-last5,
  .standing-last5 {
    display: none;
  }

  .standings-header,
  .standing-card {
    gap: 0.4rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .standing-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* A two-column award card is too narrow once the section padding is applied. */
  #awards-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .award-card,
  .award-body {
    min-width: 0;
  }

  .rtd-daytona-stripe {
    margin-left: -12px;
    margin-right: -12px;
  }

  .rtd-results-row {
    padding-left: 0;
    flex-wrap: wrap;
  }

  .rtd-score-item.winner {
    min-width: 0;
  }
}
