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

:root {
  --accent: #ffaa44;
  --accent-soft: rgba(255, 170, 68, 0.15);
  --accent-line: rgba(255, 170, 68, 0.25);
  --bg: #0b0b15;
  --panel: rgba(15, 15, 25, 0.85);
  --row: rgba(30, 30, 40, 0.6);
  --row-hover: rgba(40, 40, 55, 0.9);
  --text: #ccd;
  --text-dim: rgba(255, 255, 255, 0.5);
  --text-muted: rgba(255, 255, 255, 0.5);
  --text-fade: rgba(255, 255, 255, 0.35);
  --clr-win: #86efac;
  --clr-loss: #f87171;
  --clr-warn: #facc15;
  --clr-info: #7dd3fc;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', monospace;
  min-height: 100vh;
}

.container {
  max-width: 1720px;
  margin: 0 auto;
  padding: 1rem;
}

/* header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--accent-line);
  padding-bottom: 1.5rem;
}

.header-content h1 {
  font-size: 2.5rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-shadow: 0 0 12px rgba(255, 170, 68, 0.4);
}

.header-content p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 0.4rem;
  letter-spacing: 0.1em;
}

.back-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.5rem 1rem;
  min-height: 38px;
  font-family: inherit;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.25s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.back-btn:hover,
.back-btn.active {
  background: var(--accent-soft);
  box-shadow: 0 0 12px var(--accent);
}

.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.bottom-tab-bar {
  display: none;
}

.bottom-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.nav-btn {
  min-width: 8.5rem;
}

.primary-btn, .secondary-btn {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--accent-line);
  border-radius: 2px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.primary-btn {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.primary-btn:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 8px var(--accent);
}

.secondary-btn {
  background: transparent;
  color: var(--text-dim);
}

.secondary-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.secondary-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* date tabs */
.date-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.date-tab {
  background: transparent;
  border: 1px solid var(--accent-line);
  color: var(--text-dim);
  padding: 0.6rem 1.2rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  transition: all 0.25s;
}
.date-tab:hover { border-color: var(--accent); color: var(--accent); }
.date-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.date-tab .date-label { font-size: 0.95rem; font-weight: bold; letter-spacing: 0.05em; }
.date-tab .date-sub   { font-size: 0.7rem; opacity: 0.7; margin-top: 2px; }

/* country filter */
.filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.filter-btn {
  background: transparent;
  border: 1px solid var(--accent-line);
  color: var(--text-dim);
  padding: 0.5rem 0.6rem;
  min-height: 38px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.25s;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
  word-break: break-word;
  min-width: 0;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* breadcrumb */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-fade);
  margin-bottom: 1rem;
  min-height: 1.2em;
}
.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--text-fade); margin: 0 0.5rem; }

/* content panel */
.content {
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 0.9rem 0;
  margin-bottom: 0.9rem;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.view-header h2 {
  color: var(--accent);
  font-size: 1.2rem;
  letter-spacing: 0.1em;
}

.view-toggle { display: flex; gap: 0.5rem; }
.view-btn {
  background: transparent;
  border: 1px solid var(--accent-line);
  color: var(--text-dim);
  padding: 0.4rem 0.9rem;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.25s;
}
.view-btn:hover { border-color: var(--accent); color: var(--accent); }
.view-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.screener-header {
  align-items: flex-start;
}

.screener-subtitle {
  margin-top: 0.25rem;
  color: var(--text-fade);
  font-size: 0.8rem;
}

.screener-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.screen-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.screen-chip {
  background: transparent;
  border: 1px solid var(--accent-line);
  color: var(--text-dim);
  padding: 0.35rem 0.7rem;
  font-family: inherit;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.screen-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.screener-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.screener-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.screen-stat {
  border: 1px solid var(--accent-line);
  background: rgba(255, 170, 68, 0.05);
  color: var(--accent);
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.screen-stat.good { color: #4ade80; border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.08); }
.screen-stat.bad { color: #f47272; border-color: rgba(244, 114, 114, 0.35); background: rgba(244, 114, 114, 0.08); }
.screen-stat.muted { color: var(--text-fade); background: transparent; }

.screen-mode-note {
  color: var(--text-dim);
  border: 1px solid var(--accent-line);
  background: rgba(255, 170, 68, 0.04);
  padding: 0.55rem 0.7rem;
  font-size: 0.8rem;
}

.screen-table {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.screen-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border: 1px solid var(--accent-line);
  background: var(--row);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.screen-row:hover {
  background: var(--row-hover);
  border-color: var(--accent);
}

.screen-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.screen-row-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

.screen-row-title strong,
.screen-row-title span {
  min-width: 0;
}

.screen-row-title strong {
  color: var(--accent);
}

.screen-horse {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  align-items: center;
}

.screen-horse strong {
  color: var(--accent);
  font-size: 1rem;
  min-width: 0;
}

.screen-flags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.screen-context {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.35;
}

.screen-row-meta,
.screen-row-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.screen-row-picks span {
  color: var(--text);
}

.screen-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.screen-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  border: 1px solid var(--accent-line);
  background: rgba(255, 170, 68, 0.04);
  padding: 0.25rem 0.45rem;
  min-height: 1.75rem;
}

.screen-metric small {
  color: var(--text-fade);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.screen-metric strong {
  color: var(--text);
  font-size: 0.78rem;
}

.screen-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  min-width: 8rem;
}

.screen-score-label {
  color: var(--text-fade);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.screen-score {
  color: var(--accent);
  font-size: 1.45rem;
  font-weight: bold;
}

.screen-pill {
  display: inline-block;
  padding: 0.22rem 0.45rem;
  border: 1px solid var(--accent-line);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.screen-pill.plunge,
.screen-status.completed {
  color: #7dd3fc;
  border-color: rgba(125, 211, 252, 0.35);
  background: rgba(125, 211, 252, 0.08);
}

.screen-status.running {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.35);
  background: rgba(252, 165, 165, 0.08);
}

.screen-status.pending-result {
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.08);
}

.screen-status.placing-result {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}

.screen-pill.muted,
.screen-status.upcoming {
  color: var(--text-fade);
  background: transparent;
}

.screen-status {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.screen-bet-status,
.screen-countdown {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.15rem 0.42rem;
  border: 1px solid var(--accent-line);
  font-size: 0.68rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.screen-bet-status.won {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.1);
  font-weight: bold;
}

.screen-bet-status.loss {
  color: #f47272;
  border-color: rgba(244, 114, 114, 0.4);
  background: rgba(244, 114, 114, 0.1);
  font-weight: bold;
}

.screen-bet-status.void {
  color: var(--text-fade);
  background: transparent;
}

.screen-bet-status.pending,
.screen-bet-status.pending-result,
.screen-countdown {
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.08);
}

.screen-countdown.pending-text {
  color: var(--text-dim);
  border-color: var(--accent-line);
  background: rgba(255, 255, 255, 0.03);
}

.model-lab {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.live-plan {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.live-summary {
  background: var(--panel);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 1.4fr);
  gap: 1rem;
}

.live-summary-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  min-width: 0;
}

.live-summary-main strong {
  color: var(--accent);
  font-size: 1.3rem;
}

.live-summary-main > span:not(.live-kicker):not(.live-day-controls) {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.live-day-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.live-day-controls button {
  background: transparent;
  border: 1px solid var(--accent-line);
  color: var(--text-dim);
  border-radius: 3px;
  padding: 0.3rem 0.48rem;
  min-height: 36px;
  font-family: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.live-day-controls button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.live-kicker {
  color: var(--text-fade);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.live-freshness {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  color: var(--text-dim);
  font-size: 0.78rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 0.75rem;
}

.live-freshness b {
  color: var(--text);
  font-weight: 700;
}

.live-page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.next-race-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.18rem;
  background: linear-gradient(135deg, rgba(255, 170, 68, 0.14), rgba(255, 170, 68, 0.04));
  border: 1px solid rgba(255, 170, 68, 0.45);
  border-radius: 6px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 340px;
}
.next-race-btn:hover:not(.is-empty) {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.next-race-btn.is-empty {
  cursor: default;
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.02);
  color: var(--text-dim);
}
.next-race-eyebrow {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.next-race-btn.is-empty .next-race-eyebrow { color: var(--text-dim); }
.next-race-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}
.next-race-label {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.next-race-btn .next-race-countdown {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
  padding: 0.22rem 0.6rem;
  background: rgba(255, 170, 68, 0.12);
  border: 1px solid rgba(255, 170, 68, 0.32);
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 170, 68, 0.06), inset 0 0 8px rgba(255, 170, 68, 0.06);
}
.next-race-btn .next-race-countdown::before {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: next-race-pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes next-race-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.7); }
}

.live-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  background: rgba(255,255,255,0.015);
  padding: 0.75rem;
}

.live-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 0.45rem;
}

.live-section-head h3 {
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-section-head span {
  color: var(--text-dim);
  font-size: 0.82rem;
}

.live-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 0.75rem;
}

.live-bet-card {
  width: 100%;
  min-width: 0;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.live-bet-card:hover {
  border-color: var(--accent);
  background: var(--row-hover);
  transform: translateY(-1px);
}

.live-bet-card.locked {
  border-color: rgba(134, 239, 172, 0.45);
}

.live-bet-card.pending {
  border-color: rgba(250, 204, 21, 0.45);
}

.live-bet-card.settled {
  opacity: 0.88;
}

.live-card-top,
.live-card-bottom,
.live-odds-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.live-card-bottom {
  align-items: flex-end;
}

.live-state {
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.live-state.locked,
.live-state.won {
  color: var(--clr-win);
  border-color: rgba(134, 239, 172, 0.4);
  background: rgba(134, 239, 172, 0.1);
}

.live-state.pending {
  color: var(--clr-warn);
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.1);
}

.live-state.urgent {
  color: var(--clr-warn);
  border-color: rgba(250, 204, 21, 0.38);
  background: rgba(250, 204, 21, 0.1);
}

.live-state.lost,
.live-state.void {
  color: var(--clr-loss);
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}

.live-state.candidate {
  color: var(--clr-info);
  border-color: rgba(125, 211, 252, 0.35);
  background: rgba(125, 211, 252, 0.08);
}

.live-card-time,
.live-card-meta {
  color: var(--text-dim);
  font-size: 0.74rem;
  white-space: nowrap;
}

.live-race-line,
.live-selection-line {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.live-race-line strong,
.live-selection-line strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.live-race-line span,
.live-selection-line span {
  color: var(--text-dim);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.live-strategy-summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.live-strategy-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.35rem;
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent), rgba(125, 211, 252, 0.95));
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1;
  box-shadow: 0 0 16px rgba(255, 170, 68, 0.16);
}

.live-strategy-count::before {
  content: 'x';
  font-size: 0.55rem;
  opacity: 0.75;
  margin-right: 1px;
}

.live-strategy-names {
  flex: 1 1 auto;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-odds-line {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 3px;
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.live-odds-line b {
  color: var(--accent);
}

.live-signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-width: 0;
}

.live-signal {
  color: var(--text-dim);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 0.14rem 0.42rem;
  font-size: 0.63rem;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-signal.positive,
.live-signal.hot,
.live-signal.value {
  color: var(--clr-win);
  border-color: rgba(134, 239, 172, 0.34);
}

.live-signal.warning,
.live-signal.risk {
  color: var(--clr-warn);
  border-color: rgba(250, 204, 21, 0.34);
}

.live-signal.negative {
  color: var(--clr-loss);
  border-color: rgba(248, 113, 113, 0.34);
}

.live-signal.muted {
  color: var(--text-fade);
}

.live-countdown {
  color: var(--clr-info);
  border: 1px solid rgba(125, 211, 252, 0.25);
  border-radius: 999px;
  padding: 0.16rem 0.46rem;
  font-size: 0.72rem;
  white-space: nowrap;
}

.live-empty {
  padding: 0.85rem;
}

.live-overflow {
  color: var(--text-dim);
  font-size: 0.74rem;
}

.live-mobile-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin: -0.2rem 0 0;
  padding: 0.48rem;
  background: rgba(255,255,255,0.025);
  border: none;
  border-top: 1px solid rgba(255,255,255,0.05);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
}

@media (max-width: 768px) {
  .live-mobile-expand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    margin: -0.2rem 0 0;
    padding: 0.4rem;
    background: rgba(255,255,255,0.025);
    border: none;
    border-top: 1px solid rgba(255,255,255,0.05);
    color: var(--text-dim);
    font: inherit;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
  }
  .live-mobile-expand::after {
    content: '▾';
    font-size: 0.85rem;
    line-height: 1;
    transition: transform 0.15s ease;
  }
  .live-section[data-mobile-collapsed="false"] .live-mobile-expand::after {
    transform: rotate(180deg);
  }
  .live-mobile-expand:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
  }
  .live-section[data-mobile-collapsed="legacy"] .live-card-grid > .live-bet-card:nth-of-type(n+4) {
    display: none;
  }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 170, 68, 0.1), transparent 34rem),
    rgba(10, 12, 15, 0.92);
  backdrop-filter: blur(10px);
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-panel {
  width: min(92vw, 430px);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.6rem 1.4rem;
  background: rgba(20, 24, 29, 0.94);
  border: 1px solid rgba(255, 170, 68, 0.24);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}
.loading-copy { align-items: center; text-align: center; }

.loading-mark {
  width: 2.2rem;
  height: 2.2rem;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  border-right-color: rgba(125, 211, 252, 0.85);
  border-radius: 50%;
  animation: loading-spin 0.9s linear infinite;
}

.loading-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.loading-copy strong {
  color: var(--text);
  font-size: 0.95rem;
}

.loading-copy span {
  min-height: 2.5em;
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.35;
}

.loading-bar {
  grid-column: 1 / -1;
  height: 0.38rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.loading-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), rgba(125, 211, 252, 0.95));
  animation: loading-bar-slide 1.4s ease-in-out infinite;
}

.loading-section {
  min-height: 14rem;
}

.inline-loader {
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1rem;
  color: var(--text-dim);
  text-align: left;
}

.inline-loader strong,
.inline-loader span {
  display: block;
}

.inline-loader strong {
  color: var(--text);
  font-size: 0.92rem;
}

.inline-loader span {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.35;
}

.inline-pinwheel {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  border-right-color: rgba(125, 211, 252, 0.85);
  border-radius: 50%;
  animation: loading-spin 0.82s linear infinite;
}

.strat-skeleton-grid {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.strat-card-skeleton .skeleton-pill,
.strat-card-skeleton .skeleton-circle,
.strat-card-skeleton .skeleton-text,
.strat-card-skeleton .skeleton-num,
.strat-card-skeleton .skeleton-stats {
  background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.11), rgba(255,255,255,0.05));
  background-size: 220% 100%;
  animation: skeleton-sheen 1.25s ease-in-out infinite;
  border-radius: 3px;
  display: inline-block;
}
.strat-card-skeleton .skeleton-pill {
  width: 5rem;
  height: 1.2rem;
}
.strat-card-skeleton .skeleton-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
}
.strat-card-skeleton .skeleton-text {
  width: 75%;
  height: 0.78rem;
  margin-top: 0.45rem;
}
.strat-card-skeleton .skeleton-num {
  width: 4.5rem;
  height: 1.65rem;
}
.strat-card-skeleton .skeleton-stats {
  width: 60%;
  height: 0.78rem;
}
.strat-card-skeleton .strat-card-name {
  opacity: 0.55;
}

.skeleton-card {
  height: 9rem;
  border: 1px solid rgba(255,255,255,0.08);
  background:
    linear-gradient(90deg, transparent, rgba(255,255,255,0.055), transparent),
    rgba(255,255,255,0.025);
  background-size: 220% 100%, 100% 100%;
  animation: skeleton-sheen 1.25s ease-in-out infinite;
}

.skeleton-card.short {
  height: 4.5rem;
  margin-top: 0.7rem;
}

@keyframes skeleton-sheen {
  from { background-position: 120% 0, 0 0; }
  to { background-position: -120% 0, 0 0; }
}

@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

@keyframes loading-bar-slide {
  0% { transform: translateX(-110%); }
  55% { transform: translateX(95%); }
  100% { transform: translateX(250%); }
}

@media (max-width: 520px) {
  .loading-panel {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .loading-copy span {
    min-height: 4em;
  }
}

.live-matched {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.settled-details {
  background: transparent;
  border: none;
}

.settled-details > .settled-summary {
  cursor: pointer;
  padding: 0;
  list-style: none;
  user-select: none;
}

.settled-details > .settled-summary::-webkit-details-marker {
  display: none;
}

.settled-details > .settled-summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.5rem;
  color: var(--text-dim);
  transition: transform 0.15s ease;
}

.settled-details[open] > .settled-summary::before {
  transform: rotate(90deg);
}

.settled-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.settled-row {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 2fr) minmax(0, 1fr) max-content;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.7rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.settled-strategy {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settled-row.settled-header {
  cursor: default;
  background: rgba(255,255,255,0.03);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.settled-row.settled-header:hover {
  background: rgba(255,255,255,0.03);
}

.settled-row.settled-header > span {
  color: var(--text-dim);
  font-weight: 600;
}

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

.settled-row:hover {
  background: var(--row-hover);
}

.settled-tone {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.settled-tone.won { color: rgb(134, 239, 172); }
.settled-tone.lost { color: rgb(248, 113, 113); }
.settled-tone.pending { color: rgb(250, 204, 21); }

.settled-race {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settled-horse {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settled-matched {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 0.3rem;
}

.settled-place {
  color: var(--text-dim);
  text-align: center;
}

.settled-profit {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.settled-profit.pos { color: rgb(134, 239, 172); }
.settled-profit.neg { color: rgb(248, 113, 113); }

@media (max-width: 720px) {
  .settled-row {
    grid-template-columns: max-content minmax(0, 1.4fr) minmax(0, 1fr) max-content;
    gap: 0.5rem;
  }
  .settled-race {
    display: none;
  }
}

.live-evidence {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.live-evidence-card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 0.85rem;
  min-width: 0;
}

.live-evidence-card h4 {
  color: var(--text);
  font-size: 0.82rem;
  margin-bottom: 0.65rem;
  letter-spacing: 0.04em;
}

.live-chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.live-chip-cloud b {
  color: var(--accent);
  margin-left: 0.2rem;
}

.live-mini-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.live-mini-table > div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.live-mini-table > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.live-mini-table span {
  color: var(--text-dim);
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}

.live-mini-table strong {
  color: var(--text);
  font-size: 0.74rem;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.live-muted {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.lab-header {
  align-items: flex-start;
}

.lab-alert {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border: 1px solid rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.06);
  padding: 0.85rem 1rem;
  color: var(--text);
}

.lab-alert strong {
  color: #facc15;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.78rem;
}

.lab-alert span {
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.45;
}

.lab-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.65rem;
}

.lab-stats-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.lab-stat {
  border: 1px solid var(--accent-line);
  background: rgba(255, 170, 68, 0.04);
  padding: 0.75rem;
  min-width: 0;
}

.lab-stat.pnl-stat.pos strong { color: rgb(134, 239, 172); }
.lab-stat.pnl-stat.neg strong { color: rgb(248, 113, 113); }

.pnl-sparkline {
  width: 100%;
  height: 26px;
  margin-top: 0.4rem;
  display: block;
}

.lab-stat span,
.lab-delta span {
  display: block;
  color: var(--text-fade);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lab-stat strong,
.lab-delta strong {
  display: block;
  margin-top: 0.2rem;
  color: var(--accent);
  font-size: 1rem;
}

.lab-stat small {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-dim);
  font-size: 0.7rem;
  line-height: 1.3;
}

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

.lab-panel {
  border: 1px solid var(--accent-line);
  background: rgba(20, 20, 32, 0.6);
  padding: 1rem;
  min-width: 0;
}

.lab-panel h3 {
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
}

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

.lab-delta div {
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  padding: 0.7rem;
}

.lab-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.lab-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: fixed;
}

.lab-table th,
.lab-table td {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0.55rem 0.45rem;
  text-align: left;
  white-space: nowrap;
}

.lab-table th {
  color: var(--text-fade);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.strategy-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.strategy-table th.sortable:hover {
  color: var(--accent);
}
.sort-indicator {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.85em;
  color: var(--accent);
}

.lab-table td {
  color: var(--text);
}

.strategy-table th:first-child,
.strategy-table .strategy-row td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #181827;
  box-shadow: 1px 0 0 rgba(255,255,255,0.06);
}

.strategy-table th:first-child {
  z-index: 2;
}

.market-label {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.12rem 0.38rem;
  margin-right: 0.25rem;
  border-radius: 999px;
  border: 1px solid rgba(125,211,252,0.3);
  background: rgba(125,211,252,0.08);
  color: #7dd3fc;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.source-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.14rem 0.42rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.035);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.lab-notes {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.5;
}

.lab-notes strong {
  color: var(--text);
}
.lab-pnl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}
.lab-pnl-grid.single {
  grid-template-columns: minmax(0, 1fr);
}
.lab-pnl-grid.triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.pnl-chart {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
}
.pnl-chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.pnl-chart .axis {
  stroke: rgba(255,255,255,0.22);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.pnl-chart .grid-line {
  stroke: rgba(255,255,255,0.08);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.pnl-chart .zero-line {
  stroke: rgba(250,204,21,0.55);
  stroke-width: 1.25;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
}
.pnl-chart .axis-label {
  fill: var(--text-fade);
  font-size: 10px;
  font-family: 'Courier New', monospace;
}
.pnl-chart .zero-label {
  fill: #facc15;
}
.pnl-chart .x-end {
  text-anchor: end;
}
.pnl-chart polyline {
  fill: none;
  stroke: #7dd3fc;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.pnl-chart circle {
  fill: #7dd3fc;
  stroke: #101018;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.pnl-chart circle.end-dot {
  fill: #4ade80;
}
.pnl-chart-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 0.45rem 0.55rem 0.5rem;
  color: var(--text-fade);
  font-size: 0.68rem;
}
.pnl-chart.empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-fade);
  font-size: 0.72rem;
  text-align: center;
  padding: 1rem;
}

.strategy-hero,
.strategy-portrait-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
  gap: 1rem;
  border: 1px solid var(--accent-line);
  background: rgba(20, 20, 32, 0.7);
  padding: 1rem;
  margin-bottom: 1rem;
}

.strategy-portrait-head .eyebrow {
  display: block;
  color: var(--text-fade);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.strategy-portrait-head h2 {
  color: var(--accent);
  font-size: 1.55rem;
  margin-bottom: 0.4rem;
}

.strategy-portrait-head p {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.45;
}

.strategy-portrait-head .strategy-scorecard {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.strategy-back-bar {
  margin-bottom: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.strategy-back-bar a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.strategy-back-bar a:hover {
  text-decoration: underline;
}

.race-explainer-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: linear-gradient(135deg, rgba(255, 170, 68, 0.18), rgba(255, 170, 68, 0.32));
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.5rem 1.05rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
  animation: raceExplainerGlow 2.4s ease-in-out infinite;
}

.race-explainer-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.45) 50%, transparent 100%);
  transform: skewX(-20deg);
  animation: raceExplainerShimmer 3.2s ease-in-out infinite;
  z-index: -1;
}

.race-explainer-btn:hover {
  transform: translateY(-1px);
  border-color: #ffd083;
}

.race-explainer-btn:active {
  transform: translateY(0);
}

.race-explainer-spark {
  display: inline-block;
  animation: raceExplainerSpark 1.6s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgba(255, 215, 130, 0.8));
}

.race-explainer-label {
  position: relative;
}

@keyframes raceExplainerGlow {
  0%, 100% {
    box-shadow:
      0 0 6px rgba(255, 170, 68, 0.35),
      0 0 12px rgba(255, 170, 68, 0.15);
  }
  50% {
    box-shadow:
      0 0 14px rgba(255, 170, 68, 0.75),
      0 0 28px rgba(255, 170, 68, 0.35),
      inset 0 0 8px rgba(255, 215, 130, 0.2);
  }
}

@keyframes raceExplainerShimmer {
  0%   { left: -120%; }
  55%  { left: 160%; }
  100% { left: 160%; }
}

@keyframes raceExplainerSpark {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.85; }
  50%      { transform: scale(1.25) rotate(15deg); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .race-explainer-btn,
  .race-explainer-btn::before,
  .race-explainer-spark {
    animation: none;
  }
}

.strategy-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.breakdown-panel h3 {
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}

.breakdown-table {
  min-width: auto;
  font-size: 0.78rem;
}

.breakdown-table td.positive { color: #86efac; }
.breakdown-table td.negative { color: #f87171; }

.strategy-bets-table .bet-row {
  cursor: pointer;
}

.strategy-bets-table .bet-row:hover {
  background: rgba(255,255,255,0.04);
}

.screen-pill.value {
  background: rgba(74, 222, 128, 0.12);
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.35);
}

.screen-pill.drift {
  background: rgba(250, 204, 21, 0.12);
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.35);
}

.decision-grid-outer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
}

.decision-card {
  border: 1px solid var(--accent-line);
  background: rgba(20, 20, 32, 0.55);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.decision-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.decision-card-head h4 {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  color: var(--text);
}

.decision-card-head .eyebrow {
  font-size: 0.65rem;
  color: var(--text-fade);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.decision-grid > div {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
}

.decision-grid .meta-label {
  color: var(--text-fade);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.decision-grid .meta-value {
  color: var(--text);
  font-weight: 600;
}

.decision-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.decision-signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.decision-pnl {
  font-weight: 700;
  font-size: 0.95rem;
}

.decision-pnl.positive { color: #86efac; }
.decision-pnl.negative { color: #f87171; }

.data-health-panel summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.data-health-panel summary::-webkit-details-marker {
  display: none;
}

.data-health-panel summary::before {
  content: '▸ ';
  color: var(--text-fade);
}

.data-health-panel[open] summary::before {
  content: '▾ ';
}

.strategy-hero .eyebrow {
  display: block;
  color: var(--text-fade);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.strategy-hero h3 {
  color: var(--accent);
  font-size: 1.35rem;
  margin-bottom: 0.45rem;
}

.strategy-hero p,
.monitor-panel-head p {
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.45;
}

.strategy-scorecard,
.monitor-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.monitor-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.monitor-panel-head h3 {
  margin-bottom: 0.25rem;
}

/* lab-table fixed column widths — all columns visible on ≥1440px desktops */
.lab-table th.col-strat, .lab-table td.col-strat { width: 140px; white-space: normal; }
.lab-table th.col-market, .lab-table td.col-market { width: 64px; text-align: center; }
.lab-table td.col-market .market-label { display: inline-block; }
.lab-table th.col-rule, .lab-table td.col-rule { width: 108px; white-space: normal; }
.lab-table th.col-bets, .lab-table td.col-bets { width: 38px; text-align: right; }
.lab-table th.col-wins, .lab-table td.col-wins { width: 36px; text-align: right; }
.lab-table th.col-hit, .lab-table td.col-hit { width: 46px; text-align: right; }
.lab-table th.col-pnl, .lab-table td.col-pnl { width: 68px; text-align: right; }
.lab-table th.col-roi, .lab-table td.col-roi { width: 56px; text-align: right; }
.lab-table th.col-window, .lab-table td.col-window { width: 60px; text-align: right; }
.lab-table th.col-days, .lab-table td.col-days { width: 36px; text-align: right; }
.lab-table th.col-sample, .lab-table td.col-sample { width: 108px; }
.lab-table th.col-status, .lab-table td.col-status { width: 88px; }
td.col-sample .monitor-badge,
td.col-status .monitor-badge {
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
}

.monitor-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.45rem;
  white-space: nowrap;
}

.monitor-badge.good {
  border-color: rgba(74,222,128,0.35);
  background: rgba(74,222,128,0.1);
  color: #4ade80;
}

.monitor-badge.watch {
  border-color: rgba(250,204,21,0.35);
  background: rgba(250,204,21,0.1);
  color: #facc15;
}

.monitor-badge.bad {
  border-color: rgba(244,114,114,0.35);
  background: rgba(244,114,114,0.1);
  color: #f47272;
}

.monitor-badge.muted {
  color: var(--text-fade);
}

.monitor-bet-list,
.monitor-runs {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.monitor-bet-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0.55rem;
  min-width: 0;
  width: 100%;
  cursor: pointer;
}

.monitor-bet-row:hover,
.monitor-bet-row:focus-visible {
  border-color: rgba(255,170,68,0.35);
  background: rgba(255,170,68,0.06);
}

.monitor-rank {
  color: var(--accent);
  font-weight: bold;
  font-family: 'Courier New', monospace;
}

.monitor-bet-row strong,
.strategy-table strong {
  display: block;
  color: var(--text);
}

.monitor-bet-row small,
.strategy-table small {
  display: block;
  color: var(--text-dim);
  margin-top: 0.15rem;
  white-space: normal;
}

.monitor-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.75rem 0;
}

.monitor-flags span,
.monitor-runs div {
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  font-size: 0.72rem;
  padding: 0.4rem 0.5rem;
}

.monitor-runs div {
  display: grid;
  grid-template-columns: minmax(7rem, 1fr) minmax(5rem, 0.7fr) minmax(7rem, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.monitor-runs strong {
  color: var(--text);
}

.today-bets-panel {
  border-color: rgba(125,211,252,0.28);
}

.today-bets-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.8rem 0;
}

.today-bet-table {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
}

.today-bet-head,
.today-bet-row {
  display: grid;
  grid-template-columns: minmax(14rem, 1.45fr) 5.5rem 7rem 4.5rem minmax(7rem, 0.7fr) 6rem;
  gap: 0.5rem;
  align-items: center;
  min-width: 760px;
}

.today-bet-head {
  padding: 0.55rem 0.7rem;
  color: var(--text-fade);
  background: rgba(255,255,255,0.035);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.today-bet-row {
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.today-bet-row:hover {
  background: rgba(255,255,255,0.045);
}

.today-bet-row strong,
.today-bet-row small {
  display: block;
}

.today-bet-row small {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.pnl-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.pnl-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text-dim);
  font-size: 0.74rem;
  min-width: min(100%, 14rem);
}

.pnl-controls select {
  background: var(--bg);
  border: 1px solid var(--accent-line);
  color: var(--text);
  font: inherit;
  padding: 0.45rem 0.5rem;
  border-radius: 3px;
  color-scheme: dark;
}

.pnl-window-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0.75rem;
  border: 1px solid var(--accent-line);
  background: rgba(255,255,255,0.025);
  border-radius: 4px;
}

.pnl-date-nav,
.pnl-mode-row,
.pnl-range-controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  align-items: stretch;
}

.pnl-date-nav,
.pnl-mode-row {
  border: 1px solid var(--accent-line);
  border-radius: 2px;
  overflow: hidden;
  background: rgba(0,0,0,0.18);
}

.pnl-date-nav .pnl-window-btn + .pnl-window-btn,
.pnl-mode-row .pnl-window-btn + .pnl-window-btn {
  border-left: 1px solid var(--accent-line);
}

.pnl-date-nav .pnl-nav-btn {
  flex: 0 0 auto;
  min-width: 6rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.pnl-date-nav .pnl-date-display {
  flex: 1 1 auto;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-family: inherit;
}

.pnl-date-nav .pnl-date-display.pnl-date-range {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pnl-mode-row .pnl-mode-btn {
  flex: 1 1 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pnl-range-controls {
  gap: 0.5rem;
  padding-left: 1rem;
  border-left: 1px solid rgba(255,255,255,0.08);
}

.pnl-range-controls.hidden { display: none; }

.pnl-range-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text-dim);
  font-size: 0.72rem;
}

.pnl-range-controls input {
  background: var(--bg);
  border: 1px solid var(--accent-line);
  color: var(--text);
  font: inherit;
  min-height: 2.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
  color-scheme: dark;
}

.pnl-window-btn {
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  min-height: 2.35rem;
  padding: 0.45rem 0.72rem;
  cursor: pointer;
  white-space: nowrap;
}

.pnl-range-controls {
  flex-wrap: wrap;
  gap: 0.5rem;
  border-top: 1px dashed rgba(255,255,255,0.1);
  padding-top: 0.5rem;
  margin-top: 0.1rem;
}

.pnl-range-controls .pnl-window-btn {
  align-self: flex-end;
  border: 1px solid var(--accent-line);
  border-radius: 2px;
  background: rgba(255,255,255,0.035);
}

.pnl-window-btn:hover {
  color: var(--accent);
  background: rgba(255,170,68,0.07);
}

.pnl-window-btn.active {
  color: var(--accent);
  background: rgba(255,170,68,0.12);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.pnl-range-controls .pnl-window-btn.active {
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .pnl-window-controls {
    padding: 0.65rem;
  }

  .pnl-date-nav .pnl-nav-btn {
    min-width: 0;
    flex: 0 0 auto;
    font-size: 0.72rem;
    padding: 0.45rem 0.5rem;
  }

  .pnl-date-nav .pnl-date-display {
    font-size: 0.85rem;
  }

  .pnl-range-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .pnl-range-controls label,
  .pnl-range-controls .pnl-window-btn,
  .pnl-range-controls input {
    width: 100%;
  }

  .today-bets-summary {
    grid-template-columns: 1fr;
  }

  .today-bet-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .source-badges {
    justify-content: flex-start;
  }
}

.compact-table {
  margin-top: 0.85rem;
}

.strategy-table {
  min-width: 860px;
}

/* desktop default: hide mobile card cell */
.strategy-table td.mobile-only { display: none; }

.strategy-sort-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.85rem 0 1rem;
  min-width: 0;
}

.strategy-sort-label {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.strategy-sort-pills {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.1rem;
}

.strategy-sort-pills::-webkit-scrollbar { display: none; }

.strategy-sort-pill {
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.025);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.strategy-sort-pill:hover,
.strategy-sort-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.strategy-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-items: start;
}

.strategy-card-shell {
  min-width: 0;
}

.strategy-card-shell.open .strat-card {
  border-color: rgba(255,170,68,0.48);
  border-left-color: var(--accent);
  box-shadow: 0 12px 30px rgba(0,0,0,0.22), 0 0 0 1px rgba(255,170,68,0.08);
}

.strategy-card-detail {
  margin-top: 0.8rem;
  border: 1px solid rgba(255,170,68,0.16);
  background: rgba(10,10,16,0.58);
  padding: 0.95rem;
}

.strategy-card-detail .strategy-expand-inner {
  display: block;
}

.strategy-card-detail .expand-chart-col {
  display: none;
}

.strategy-card-detail .expand-bets-col {
  width: 100%;
  min-width: 0;
}

.strategy-card-detail .expand-bets-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem;
  max-height: min(420px, 62vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.35rem;
  scrollbar-gutter: stable;
}

.strategy-card-detail .bet-block {
  margin-bottom: 0;
}

.live-day-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(255,170,68,0.2);
  background: rgba(255,170,68,0.06);
  padding: 0.85rem;
}

.live-day-summary strong,
.live-day-summary span {
  display: block;
}

.live-day-summary strong {
  color: var(--accent);
  font-size: 0.94rem;
}

.live-day-summary span {
  margin-top: 0.25rem;
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.4;
}

.live-summary-action {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid rgba(255,170,68,0.28);
  background: rgba(255,170,68,0.12);
  color: var(--accent);
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
}

.live-collapsed-note {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0.55rem 0 0.25rem;
}

.strategy-grid-toggle {
  margin-top: 0.75rem;
}

/* mobile card — only ever visible at ≤640px (overridden in the mobile block) */
.strat-card {
  position: relative;
  isolation: isolate;
  padding: 0.95rem 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid rgba(255,255,255,0.08);
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  white-space: normal;
}
.strat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(9, 11, 14, 0.94) 0%, rgba(9, 11, 14, 0.74) 42%, rgba(9, 11, 14, 0.38) 100%),
    linear-gradient(180deg, rgba(9, 11, 14, 0.18) 0%, rgba(9, 11, 14, 0.8) 100%);
  pointer-events: none;
}
.strat-card > :not(.strat-card-bg) {
  position: relative;
  z-index: 2;
}
.strat-card * { min-width: 0; max-width: 100%; }
.strat-card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  opacity: 0.78;
  pointer-events: none;
}
.strat-card-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 170, 68, 0.16), transparent 12rem),
    linear-gradient(180deg, transparent 0%, rgba(9, 11, 14, 0.64) 100%);
}
.strat-card-bg svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 0 12px rgba(255, 170, 68, 0.12));
}
.strat-bg-grid {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
  stroke-dasharray: 4 7;
}
.strat-bg-area {
  fill: rgba(255, 170, 68, 0.08);
}
.strat-bg-line {
  fill: none;
  stroke: rgba(255, 170, 68, 0.72);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.strat-card-bg.positive .strat-bg-area { fill: rgba(95, 214, 138, 0.1); }
.strat-card-bg.positive .strat-bg-line { stroke: rgba(95, 214, 138, 0.72); }
.strat-card-bg.negative .strat-bg-area { fill: rgba(248, 113, 113, 0.09); }
.strat-card-bg.negative .strat-bg-line { stroke: rgba(248, 113, 113, 0.68); }
.strat-bg-dot {
  position: absolute;
  z-index: 1;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.28);
}
.strat-bg-dot.last {
  width: 7px;
  height: 7px;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.28), 0 0 14px rgba(255,170,68,0.38);
}
.strat-card-bg.positive .strat-bg-dot.last { background: var(--clr-win); }
.strat-card-bg.negative .strat-bg-dot.last { background: var(--clr-loss); }
.strat-card-bg-empty {
  background:
    linear-gradient(135deg, rgba(255, 170, 68, 0.12), transparent 34%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 12px);
}
.strat-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
}
.strat-card-name {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.strat-card-status {
  flex: 0 0 auto;
  font-size: 0.6rem !important;
  padding: 0.15rem 0.5rem !important;
  white-space: nowrap;
}
.strat-card-desc {
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--text-muted);
  margin-top: -0.35rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  width: 100%;
}
.strat-card-hero {
  display: flex;
  gap: 1.3rem;
  align-items: baseline;
  padding-top: 0.15rem;
}
.strat-hero-metric {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.strat-hero-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  font-family: 'Courier New', monospace;
}
.strat-hero-value.positive { color: var(--clr-win); }
.strat-hero-value.negative { color: var(--clr-loss); }
.strat-hero-label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.strat-card-stats {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  padding-top: 0.05rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: 0.15rem;
  padding-top: 0.55rem;
}
.strat-card-stats strong {
  color: var(--text);
  font-weight: 600;
}
.strat-dot {
  color: var(--text-fade);
  font-weight: 400;
}

.strat-card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}
.strat-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--accent-line);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-style: normal;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.strat-info-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.strat-name-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.strat-name-cell strong {
  flex: 1 1 auto;
}

.coming-soon-badge {
  background: rgba(120, 120, 160, 0.15) !important;
  color: var(--text-fade) !important;
  border: 1px solid rgba(120, 120, 160, 0.3) !important;
}
.coming-soon-cell {
  font-style: italic;
  color: var(--text-fade);
  font-size: 0.78rem;
  display: block;
  padding: 0.25rem 0;
  white-space: normal;
  word-break: break-word;
}
.strategy-row-coming-soon td[colspan] { white-space: normal; }
.strategy-row-coming-soon {
  opacity: 0.7;
  cursor: default;
}
.strategy-row-coming-soon:hover {
  background: transparent !important;
}
.strat-card-coming-soon {
  opacity: 0.75;
}
.strat-card-coming-soon-body {
  font-size: 0.72rem;
  color: var(--text-fade);
  line-height: 1.4;
  font-style: italic;
  padding: 0.45rem 0.6rem;
  border-left: 2px solid var(--accent-line);
  background: rgba(255,255,255,0.02);
  border-radius: 0 2px 2px 0;
}
.strat-card-coming-soon-body p { margin: 0; }

.strat-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: stratModalFadeIn 0.18s ease-out;
}
@keyframes stratModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.strat-modal {
  position: relative;
  background: var(--bg-panel, #0e0e14);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.6rem 1.6rem 1.4rem;
  box-shadow: 0 18px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,170,68,0.08);
  animation: stratModalSlideUp 0.22s ease-out;
}
@keyframes stratModalSlideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.strat-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s;
}
.strat-modal-close:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.strat-modal-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
  padding-right: 2rem;
}
.strat-modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.strat-modal-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--accent-line);
}
.strat-modal-meta strong {
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.66rem;
  margin-right: 0.25rem;
}
.strat-modal-meta-dot {
  color: var(--text-fade);
}
.strat-modal-section {
  margin-bottom: 1rem;
}
.strat-modal-section:last-child { margin-bottom: 0; }
.strat-modal-section h4 {
  margin: 0 0 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.strat-modal-section p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-dim);
}
.strat-modal-coming-soon p {
  color: var(--text-muted);
  font-style: italic;
  padding: 0.6rem 0.8rem;
  background: rgba(255,170,68,0.06);
  border-left: 2px solid var(--accent);
  border-radius: 0 2px 2px 0;
}

/* ── race explainer modal ───────────────────────────────────── */
.explainer-modal { padding: 2rem 1.75rem 1.5rem; }
.explainer-header {
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 170, 68, 0.15);
}
.explainer-header h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.explainer-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
}
.explainer-section {
  margin-bottom: 1.6rem;
}
.explainer-section:last-child { margin-bottom: 0; }
.explainer-section-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.explainer-section-head h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  text-transform: none;
  line-height: 1.3;
}
.explainer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: rgba(255, 170, 68, 0.12);
  border: 1px solid var(--accent-line);
  font-size: 0.95rem;
  flex-shrink: 0;
}
.explainer-section p {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text);
}
.explainer-section p:last-child { margin-bottom: 0; }
.explainer-section p strong { color: var(--accent); font-weight: 600; }
.explainer-section p code,
.explainer-formula code {
  font-family: 'Courier New', monospace;
  font-size: 0.82em;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.1em 0.35em;
  border-radius: 2px;
  color: var(--text);
}
.explainer-aside {
  padding: 0.55rem 0.8rem;
  background: rgba(125, 211, 252, 0.06);
  border-left: 2px solid rgba(125, 211, 252, 0.5);
  border-radius: 0 3px 3px 0;
  color: var(--text-dim) !important;
  font-size: 0.83rem !important;
}
.explainer-formula {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.8rem 0;
  padding: 0.9rem 1rem;
  background: rgba(255, 170, 68, 0.04);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
}
.explainer-formula code {
  background: transparent;
  padding: 0;
  color: var(--text);
  font-size: 0.85rem;
}
.explainer-strat-list {
  list-style: none;
  margin: 0.5rem 0 0.8rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.explainer-strat-list li {
  display: grid;
  grid-template-columns: minmax(8.5rem, auto) 1fr;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.5rem 0.7rem;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 3px;
  font-size: 0.82rem;
  line-height: 1.45;
}
.explainer-strat-name {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.explainer-strat-desc {
  color: var(--text-dim);
}
.explainer-badges {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.explainer-badges li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.explainer-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.2rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.explainer-tag.tag-top    { background: rgba(255, 170, 68, 0.18);  color: var(--accent); border: 1px solid var(--accent-line); }
.explainer-tag.tag-value  { background: rgba(125, 211, 252, 0.15); color: var(--clr-info); border: 1px solid rgba(125,211,252,0.35); }
.explainer-tag.tag-plunge { background: rgba(248, 113, 113, 0.15); color: var(--clr-loss); border: 1px solid rgba(248,113,113,0.35); }
.explainer-tag.tag-bet    { background: rgba(134, 239, 172, 0.15); color: var(--clr-win);  border: 1px solid rgba(134,239,172,0.35); }

@media (max-width: 600px) {
  .explainer-modal { padding: 1.4rem 1.1rem 1.1rem; }
  .explainer-section { margin-bottom: 1.3rem; }
  .explainer-strat-list li {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  .explainer-badges li { flex-wrap: wrap; }
}
.strat-modal-formula {
  padding: 0.9rem 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--accent-line);
  border-radius: 3px;
  overflow-x: auto;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text);
}
.strat-modal-formula .katex-display {
  margin: 0;
}
.strat-modal-formula-fallback {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  text-align: left;
  white-space: pre-wrap;
  color: var(--text-muted);
}
.strat-modal-vars {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 0.35rem;
}
.strat-modal-vars tr {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.strat-modal-vars tr:last-child {
  border-bottom: none;
}
.strat-var-sym {
  white-space: nowrap;
  padding: 0.35rem 0.7rem 0.35rem 0;
  width: 1%;
  vertical-align: middle;
  color: var(--accent);
}
.strat-var-sym .katex {
  font-size: 0.9em;
}
.strat-var-desc {
  padding: 0.35rem 0;
  color: var(--text-dim);
  vertical-align: middle;
  line-height: 1.4;
}
body.modal-open {
  overflow: hidden;
}

.strategy-row:hover {
  background: rgba(255,255,255,0.04);
}

.strategy-row-selected {
  background: rgba(99,102,241,0.12) !important;
  outline: 1px solid rgba(99,102,241,0.4);
  outline-offset: -1px;
}

.strategy-detail-panel {
  margin-top: 0;
}

/* ── unit size stepper ─────────────────────────────────────── */
.unit-stepper {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  font-family: inherit;
}

.unit-stepper-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-fade);
  margin-right: 0.35rem;
}

.unit-pills {
  display: flex;
  gap: 0.4rem;
  margin-left: 0.4rem;
}

.unit-pill {
  padding: 0.32rem 0.7rem;
  min-height: 36px;
  min-width: 38px;
  border: 1px solid var(--accent-line);
  background: transparent;
  color: var(--text-dim);
  border-radius: 2px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.25s;
}
.unit-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.unit-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px rgba(255,170,68,0.25);
}

td.positive { color: #86efac; }
td.negative { color: #f87171; }

/* ── strategy expand row ───────────────────────────────────── */
.strategy-row { cursor: pointer; }

.strat-hidden,
.strat-hidden + .strategy-expand-row { display: none; }

/* default: show desktop count, hide mobile count on show-more button */
.strat-show-mobile { display: none; }

.strat-show-more-row td {
  padding: 0;
  border: none;
  text-align: center;
}

.strat-show-more-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.03);
  border: none;
  border-top: 1px dashed rgba(255,255,255,0.1);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.strat-show-more-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}

.strat-show-less-row td {
  padding: 0;
  border: none;
  text-align: center;
}

.strat-show-less-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.03);
  border: none;
  border-top: 1px dashed rgba(255,255,255,0.1);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.strat-show-less-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}

.strategy-expand-row > td {
  padding: 0;
  overflow: hidden;
  background: rgba(99,102,241,0.04);
  border-bottom: 1px solid rgba(99,102,241,0.18);
}

.strategy-expand-row .strategy-expand-inner {
  display: none;
  gap: 1.5rem;
  padding: 1rem 1.25rem;
  flex-direction: row;
  align-items: flex-start;
}

.strategy-expand-row.open .strategy-expand-inner {
  display: flex;
  animation: expandSlide 0.2s ease-out;
}

@keyframes expandSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.expand-chart-col {
  flex: 0 0 340px;
  min-width: 200px;
}

.expand-chart-title,
.expand-bets-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.mini-chart {
  width: 100%;
}

.mini-chart-body {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.mini-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 0.58rem;
  font-family: 'Courier New', monospace;
  line-height: 1;
  min-width: 34px;
  width: 34px;
  flex-shrink: 0;
  padding: 1px 0;
  position: relative;
}

.mini-y-zero {
  position: absolute;
  right: 0;
  color: rgba(255,255,255,0.35);
}

.mini-y-axis .positive { color: #86efac; }
.mini-y-axis .negative { color: #f87171; }

.mini-chart-body svg {
  display: block;
  flex: 1 1 auto;
  height: 72px;
  overflow: visible;
  min-width: 0;
}

.mini-line { fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.mini-line.positive { stroke: #86efac; }
.mini-line.negative { stroke: #f87171; }
.mini-zero { stroke: rgba(255,255,255,0.18); stroke-width: 1; stroke-dasharray: 3,3; }

.mini-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.mini-chart-labels .positive { color: #86efac; }
.mini-chart-labels .negative { color: #f87171; }

.mini-chart-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.expand-bets-col {
  flex: 1 1 0;
  min-width: 0;
}

.expand-bets-scroll {
  max-height: 220px;
  overflow-y: auto;
}
.expand-bet-row[data-race-key] {
  cursor: pointer;
}
.expand-bet-row[data-race-key]:hover td {
  background: rgba(255,255,255,0.04);
}

/* mobile bet blocks — hidden on desktop */
.expand-bets-blocks { display: none; }
.bet-block {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
}
.bet-block:hover { border-color: rgba(255,170,68,0.28); }
.bet-block-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.bet-flag {
  display: inline-block;
  width: 1.5em;
  text-align: center;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-size: 0.95em;
  vertical-align: -1px;
  flex-shrink: 0;
}
.bet-block-horse {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.bet-block-result {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.bet-block-tag {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-weight: 600;
}
.bet-block-tag.win { background: rgba(134,239,172,0.15); color: var(--clr-win); }
.bet-block-tag.loss { background: rgba(248,113,113,0.15); color: var(--clr-loss); }
.bet-block-pnl { font-family: 'Courier New', monospace; font-weight: 700; font-size: 0.84rem; }
.bet-block-result.positive .bet-block-pnl { color: var(--clr-win); }
.bet-block-result.negative .bet-block-pnl { color: var(--clr-loss); }
.bet-block-bottom {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
  flex-wrap: wrap;
}
.bet-block-dot { color: var(--text-fade); }

.expand-bets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
}

.expand-bets-table th {
  text-align: left;
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  background: #161a2a;
}

.expand-bets-table td {
  padding: 0.28rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  white-space: nowrap;
}

.expand-bet-row { cursor: default; }

.expand-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.cadence-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.cadence-row {
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
}

.cadence-row summary {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) auto auto;
  gap: 0.6rem;
  align-items: center;
  cursor: pointer;
  padding: 0.55rem;
  color: var(--text);
}

.cadence-row summary strong {
  color: var(--accent);
}

.cadence-row summary span,
.cadence-row summary small {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.cadence-row div {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 0.55rem;
  color: var(--text-fade);
  font-size: 0.72rem;
  line-height: 1.5;
}

.diagnostics-panel {
  opacity: 0.9;
}

.empty.compact {
  padding: 0.75rem;
  font-size: 0.82rem;
}

.strategy-chart-card {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.025);
}

.chart-hidden { display: none; }

.chart-show-more-btn,
.chart-show-less-btn {
  grid-column: 1 / -1;
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chart-show-more-btn:hover,
.chart-show-less-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}

/* desktop default: show desktop count, hide mobile count */
.chart-show-mobile { display: none; }

@media (max-width: 640px) {
  .chart-hidden-mobile { display: none; }
  .chart-show-desktop { display: none; }
  .chart-show-mobile { display: inline; }
}

.strategy-chart-title {
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: var(--accent);
  font-weight: bold;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 0.55rem 0.65rem;
}

.strategy-chart-card .pnl-chart {
  border: 0;
  background: transparent;
}

/* meeting grid */
.meetings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
}

.meeting-card,
.country-card {
  display: block;
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  padding: 1.25rem;
  background: var(--row);
  text-decoration: none;
  color: inherit;
  transition: all 0.25s;
}
.meeting-card:hover,
.country-card:hover {
  border-color: var(--accent);
  background: var(--row-hover);
  box-shadow: 0 0 14px rgba(255, 170, 68, 0.18);
}

.meeting-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.8rem;
  gap: 0.5rem;
}
.meeting-card h3,
.country-card h3 { color: var(--accent); font-size: 1.05rem; }

.tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  border-radius: 2px;
  white-space: nowrap;
}

.meeting-info,
.country-info {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.meeting-info p,
.country-info p { margin-bottom: 0.3rem; }
.meeting-info strong,
.country-info strong { color: rgba(255, 170, 68, 0.75); }

.card-cta {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.race-list {
  margin-top: 0.8rem;
  border-top: 1px solid rgba(255, 170, 68, 0.1);
  padding-top: 0.8rem;
}

.race-item-link {
  display: block;
  padding: 0.4rem 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-decoration: none;
}
.race-item-link:hover { color: var(--accent); }
.race-time { color: var(--accent); font-weight: bold; }

/* races view */
.meeting-summary {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--accent-line);
}
.meeting-summary strong { color: var(--accent); }

.races-list { display: flex; flex-direction: column; gap: 0.6rem; }

.race-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.2rem;
  background: var(--row);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}
.race-row:hover {
  border-color: var(--accent);
  background: var(--row-hover);
}

.race-row-left { display: flex; align-items: center; gap: 1rem; }
.race-num {
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: bold;
  min-width: 3rem;
  text-align: center;
  border-right: 1px solid var(--accent-line);
  padding-right: 1rem;
}
.race-row-name { font-size: 1rem; color: var(--text); }
.race-row-meta { font-size: 0.8rem; color: var(--text-fade); margin-top: 2px; }

.race-row-right { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.race-row-cta { color: var(--accent); font-size: 1.2rem; }

.race-time-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-direction: column;
  align-items: flex-end;
}

.countdown {
  display: inline-block;
  background: rgba(100, 150, 255, 0.2);
  color: #8ad;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  border-radius: 2px;
  font-weight: bold;
  letter-spacing: 0.05em;
  min-width: 55px;
  text-align: center;
  font-family: 'Courier New', monospace;
}

.countdown-detail {
  color: var(--accent);
  font-weight: bold;
  font-size: 1rem;
}

/* next race banner */
.next-race-banner {
  display: block;
  grid-column: 1 / -1;
  background: linear-gradient(90deg, rgba(255, 170, 68, 0.18), rgba(255, 170, 68, 0.05));
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s;
  box-shadow: 0 0 14px rgba(255, 170, 68, 0.15);
}
.next-race-banner:hover {
  background: linear-gradient(90deg, rgba(255, 170, 68, 0.25), rgba(255, 170, 68, 0.1));
  box-shadow: 0 0 20px rgba(255, 170, 68, 0.3);
}

.banner-label {
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.banner-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.banner-info {
  font-size: 0.95rem;
  color: var(--text);
}
.banner-info strong { color: var(--accent); display: block; margin-bottom: 0.2rem; }

.banner-countdown {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.banner-time {
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: bold;
  font-family: 'Courier New', monospace;
}

.banner-cd {
  font-size: 1rem !important;
  padding: 0.4rem 0.8rem !important;
  background: var(--accent) !important;
  color: #000 !important;
  min-width: 80px !important;
  animation: pulse-cd 2s infinite;
}

@keyframes pulse-cd {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 170, 68, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(255, 170, 68, 0); }
}

/* card countdown */
.next-race-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.7rem 0;
  padding: 0.5rem 0.7rem;
  background: rgba(100, 150, 255, 0.08);
  border-radius: 3px;
  border-left: 2px solid #8ad;
}
.next-race-info .meta-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0;
}
.card-cd {
  background: rgba(100, 150, 255, 0.3) !important;
  color: #8ad !important;
}

/* race detail view */
.race-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: 0.4rem 0.65rem;
  margin-bottom: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--row);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  position: relative;
  z-index: 1;
}
.race-meta > div {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  align-items: baseline;
  column-gap: 0.5rem;
  min-width: 0;
}
.meta-label { font-size: 0.6rem; color: var(--text-fade); text-transform: uppercase; letter-spacing: 0.08em; }
.meta-value { font-size: 0.82rem; color: var(--accent); margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.horses-table-wrap {
  overflow: visible;
  padding-bottom: 6rem;
  position: relative;
  z-index: 20;
}

.horses-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 0.85rem;
  overflow: visible;
}
.horses-table th {
  text-align: left;
  padding: 0.7rem 0.6rem;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-line);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sort-th {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 0.25rem 0.15rem;
  min-height: 32px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (max-width: 900px) {
  .race-explainer-btn {
    max-width: 100%;
    white-space: normal;
    box-shadow: none;
  }
}

@media (max-width: 640px) {
  .header-actions .back-btn,
  .data-source-info .back-btn {
    min-height: 40px;
    padding: 0.55rem 0.8rem;
  }

  .live-day-controls button,
  .unit-pill,
  .pnav-btn {
    min-height: 38px;
  }

  .strat-info-btn {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  .strategy-back-bar a {
    min-height: 38px;
  }

  #race-detail,
  #race-detail-view.active {
    max-width: 100%;
    overflow-x: clip;
  }

  .race-explainer-btn {
    max-width: 100%;
    white-space: normal;
    text-align: left;
    line-height: 1.35;
    box-shadow: none;
    animation: none;
  }

  .sort-th {
    min-height: 34px;
    padding: 0.35rem 0.2rem;
  }
}
.sort-th:hover,
.sort-th.active {
  color: #fff;
}
.horses-table td {
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid rgba(255, 170, 68, 0.08);
  color: var(--text);
  overflow: visible;
}
.horses-table tr:hover td { background: rgba(255, 170, 68, 0.05); }
.horses-table .num {
  color: var(--accent);
  font-weight: bold;
  text-align: center;
  width: 34px;
}
.horses-table th.col-result-medal,
.horses-table td.col-result-medal {
  width: 40px;
  min-width: 40px;
  text-align: center;
  padding-left: 0.3rem;
  padding-right: 0.3rem;
  overflow: visible;
  white-space: nowrap;
}
.horses-table th, .horses-table td { white-space: nowrap; }
.horses-table td:nth-child(3) { white-space: normal; min-width: 8rem; }
.horses-table td:nth-child(4) { white-space: normal; min-width: 7rem; }
.result-medal-cell {
  font-size: 1.35rem;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}
.result-placing {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-fade);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
}
.result-scr {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #f47272;
  background: rgba(244,114,114,0.1);
  border: 1px solid rgba(244,114,114,0.3);
  padding: 0.12rem 0.42rem;
  border-radius: 2px;
  letter-spacing: 0.05em;
}
.result-unplaced {
  color: var(--text-fade);
  font-size: 1rem;
  opacity: 0.5;
}
.race-detail-hero-main { display: flex; flex-direction: column; gap: 0.3rem; }

.race-detail-hero,
#observatory .strategy-hero {
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
  gap: 0.6rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
}
#observatory .strategy-hero .eyebrow {
  font-size: 0.62rem;
  margin-bottom: 0.1rem;
}
#observatory .strategy-hero h3 {
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  line-height: 1.2;
  margin-bottom: 0.15rem;
}
#observatory .strategy-hero p {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.3;
  margin: 0;
}
#observatory .strategy-hero .strategy-scorecard {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
}
#observatory .strategy-hero .strategy-scorecard .lab-stat {
  padding: 0.35rem 0.5rem;
  min-height: 0;
}
#observatory .strategy-hero .strategy-scorecard .lab-stat span {
  font-size: 0.58rem;
}
#observatory .strategy-hero .strategy-scorecard .lab-stat strong {
  font-size: 0.82rem;
  margin-top: 0.05rem;
}
@media (max-width: 640px) {
  #observatory .strategy-hero {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  #observatory .strategy-hero .strategy-scorecard {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

#observatory.model-lab {
  gap: 0.5rem;
}

.race-browser-hero {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}
.race-browser-hero h3 {
  color: var(--accent);
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  line-height: 1.2;
  margin: 0;
}
.race-browser-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.race-browser-stats b {
  color: var(--text);
  font-family: 'Courier New', monospace;
  font-weight: 700;
  margin-right: 0.25rem;
  font-size: 0.85rem;
}
.race-browser-stats .positive b { color: #4ade80; }
.race-browser-stats .pending b { color: #facc15; }
#observatory .strategy-hero {
  margin-bottom: 0;
  border: 0;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}

.strat-panel-flat {
  border: 0 !important;
  background: transparent !important;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: 0;
  padding: 0 !important;
}
.strat-panel-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.35rem;
}
.strat-panel-flat .pnl-window-controls {
  margin: 0 0 0.5rem 0;
}
.race-detail-hero .eyebrow {
  font-size: 0.62rem;
  margin-bottom: 0.1rem;
}
.race-detail-hero h3 {
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  line-height: 1.2;
  margin-bottom: 0.15rem;
}
.race-detail-hero p {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.3;
  margin: 0;
}
.race-detail-hero .race-status-inline {
  margin-top: 0.3rem;
  padding: 0.28rem 0.65rem;
  font-size: 0.72rem;
}
.race-detail-hero .race-status-inline .race-status-countdown { font-size: 0.78rem; }
.race-detail-hero .strategy-scorecard {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}
.race-detail-hero .strategy-scorecard .lab-stat {
  padding: 0.35rem 0.5rem;
  min-height: 0;
}
.race-detail-hero .strategy-scorecard .lab-stat span {
  font-size: 0.58rem;
}
.race-detail-hero .strategy-scorecard .lab-stat strong {
  font-size: 0.82rem;
  margin-top: 0.05rem;
}

@media (max-width: 640px) {
  .race-detail-hero {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .race-detail-hero .strategy-scorecard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.race-status-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  align-self: flex-start;
  margin-top: 0.35rem;
}
.race-status-inline .race-status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
}
.race-status-inline .race-status-dot.pulse {
  animation: race-status-pulse 1.4s ease-in-out infinite;
}
@keyframes race-status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}
.race-status-inline.upcoming {
  background: rgba(125, 211, 252, 0.08);
  border-color: rgba(125, 211, 252, 0.35);
  color: var(--clr-info, #7dd3fc);
}
.race-status-inline.running {
  background: rgba(255, 170, 68, 0.12);
  border-color: rgba(255, 170, 68, 0.5);
  color: var(--accent);
}
.race-status-inline.pending {
  background: rgba(250, 204, 21, 0.12);
  border-color: rgba(250, 204, 21, 0.5);
  color: #facc15;
}
.race-status-inline.resulted {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.4);
  color: #4ade80;
}
.race-status-inline.terminal {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.4);
  color: #f87171;
}
.race-status-inline .race-status-countdown {
  font-family: 'Courier New', monospace;
  color: var(--text);
  letter-spacing: 0.05em;
  font-size: 0.85rem;
}

.horses-table-wrap { display: none; }
.horses-cards {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  width: 100%;
}

.hcm-body-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.hcm-main {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

@media (min-width: 1024px) {
  .hcm-body-wrap {
    flex-direction: row;
    align-items: stretch;
    gap: 1.2rem;
  }
  .hcm-snapshot {
    flex: 0 0 38%;
    max-width: 460px;
    border-left: 1px solid rgba(255,255,255,0.05);
    padding-left: 1rem;
    margin-left: 0.25rem;
  }
  .hcm-snapshot .hcm-spark { height: 140px !important; }
}

@media (min-width: 769px) {
  .horse-card-m {
    padding: 0.9rem 1.1rem;
    gap: 0.7rem;
  }
  .hcm-number {
    min-width: 2.3rem;
    height: 2.3rem;
    font-size: 1.05rem;
  }
  .hcm-name { font-size: 1.1rem; }
  .hcm-summary-meta { font-size: 0.82rem; gap: 0.85rem; }
  .hcm-win-price { font-size: 1.35rem; }
  .hcm-win-label { font-size: 0.7rem; }
  .hcm-chevron { font-size: 1.15rem; }
  .hcm-meta { font-size: 0.78rem; }
  .hcm-odds-row { gap: 0.6rem; }
  .hcm-odds-row > div { padding: 0.55rem 0.4rem; }
  .hcm-odds-row span { font-size: 0.68rem; }
  .hcm-odds-row strong { font-size: 1rem; }
  .hcm-spark { height: 96px; }
  .hcm-snapshot-head { font-size: 0.72rem; }
  .hcm-spark-axis { font-size: 0.72rem; }
  .hcm-formstr { font-size: 0.82rem; }
}

.horse-card-m {
  background: var(--panel, #14181d);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 5px;
  padding: 0.6rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.horse-card-m.is-fav { border-color: rgba(255, 170, 68, 0.4); }
.horse-card-m.is-scratched { opacity: 0.5; }
.horse-card-m.is-scratched .hcm-name { text-decoration: line-through; }

.hcm-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}
.hcm-chevron {
  font-size: 0.95rem;
  color: var(--text-dim);
  transition: transform 0.18s ease;
}
.horse-card-m.is-expanded .hcm-chevron { transform: rotate(180deg); }

.hcm-summary-meta {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  margin-top: 0.18rem;
  font-size: 0.72rem;
  flex-wrap: wrap;
}

.hcm-badges-top {
  margin-top: 0.1rem;
}

.horse-card-m .hcm-progressive { display: none !important; }
.horse-card-m.is-expanded .hcm-progressive { display: revert !important; }

@media (min-width: 1024px) {
  .horse-card-m .hcm-progressive[data-tier="1"],
  .horse-card-m .hcm-progressive[data-tier="2"],
  .horse-card-m .hcm-progressive[data-tier="3"] { display: revert !important; }
}

@media (min-width: 1024px) {
  .horse-card-m .hcm-chevron { display: none; }
  .horse-card-m .hcm-head { cursor: default; }
}

.hcm-spark-axis {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
  font-size: 0.62rem;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
}
.hcm-spark-span {
  color: var(--text);
  letter-spacing: 0.04em;
}
.hcm-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  font-weight: 700;
  font-size: 0.9rem;
}
.horse-card-m.is-fav .hcm-number {
  background: rgba(255, 170, 68, 0.14);
  border-color: rgba(255, 170, 68, 0.55);
  color: var(--accent);
}
.hcm-id { min-width: 0; }
.hcm-name-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.hcm-name {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.2;
}
.hcm-result.medal { font-size: 1.1rem; line-height: 1; }
.hcm-result.scr {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: rgba(244,114,114,0.18);
  border: 1px solid rgba(244,114,114,0.4);
  color: #f87171;
}
.hcm-result.placing {
  font-size: 0.7rem;
  color: var(--text-dim);
  padding: 0.08rem 0.32rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 2px;
}
.hcm-fav-pill {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  background: rgba(255, 170, 68, 0.18);
  color: var(--accent);
  padding: 0.08rem 0.36rem;
  border-radius: 2px;
  border: 1px solid rgba(255, 170, 68, 0.4);
}
.hcm-meta {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
  line-height: 1.3;
}
.hcm-win {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 4rem;
}
.hcm-win-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.hcm-win-price {
  font-family: 'Courier New', monospace;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
}
.hcm-move {
  font-size: 0.65rem;
  color: var(--text-dim);
}
.hcm-move.plunge { color: #4ade80; font-weight: 600; }

.hcm-form {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}
.hcm-form-bar {
  position: relative;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.hcm-form-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.5), rgba(74, 222, 128, 0.85));
  border-radius: 999px;
}
.hcm-form-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
}
.hcm-form-pct { font-weight: 600; }
.hcm-edge.positive { color: #4ade80; }
.hcm-edge.negative { color: #f87171; }

.hcm-odds-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.hcm-odds-row > div {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 3px;
  padding: 0.2rem 0.45rem;
}
.hcm-odds-row span {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.hcm-odds-row strong {
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  color: var(--text);
}

.hcm-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.hcm-badges .hbadge { font-size: 0.6rem; }

.hcm-snapshot {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.hcm-snapshot-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.hcm-snapshot-count { color: var(--text); }
.hcm-spark {
  position: relative;
  height: 64px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  border-radius: 3px;
  overflow: hidden;
}
.hcm-spark.empty,
.hcm-spark.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}
.hcm-spark-pinwheel {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loading-spin 0.82s linear infinite;
}
.hcm-spark svg { width: 100%; height: 100%; display: block; }
.hcm-spark-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.hcm-spark-area {
  fill: rgba(255, 170, 68, 0.12);
  stroke: none;
}
.hcm-spark.positive .hcm-spark-line { stroke: #4ade80; }
.hcm-spark.positive .hcm-spark-area { fill: rgba(74, 222, 128, 0.12); }
.hcm-spark.negative .hcm-spark-line { stroke: #f87171; }
.hcm-spark.negative .hcm-spark-area { fill: rgba(248, 113, 113, 0.12); }
.hcm-spark-first,
.hcm-spark-last {
  position: absolute;
  top: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  background: rgba(0,0,0,0.5);
  padding: 0 0.25rem;
  border-radius: 2px;
}
.hcm-spark-first { left: 4px; }
.hcm-spark-last { right: 4px; }

.hcm-formstr {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.horses-table .odds {
  font-family: 'Courier New', monospace;
  color: var(--accent);
  font-weight: bold;
  text-align: right;
  white-space: nowrap;
  position: relative;
  overflow: visible;
}

.odds-watch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: default;
  outline: none;
}
.odds-watch:focus .odds-price,
.odds-watch:hover .odds-price {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.odds-flag {
  font-size: 0.58rem;
  line-height: 1;
  padding: 0.18rem 0.3rem;
  border-radius: 2px;
  letter-spacing: 0.06em;
}
.odds-flag.plunge {
  background: rgba(74, 222, 128, 0.18);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.35);
}
.odds-flag.drift {
  display: none;
}
.odds-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.55rem);
  z-index: 10000;
  display: none;
  width: min(340px, calc(100vw - 2rem));
  padding: 0.8rem;
  background: #101018;
  border: 1px solid var(--accent-line);
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  color: var(--text);
  text-align: left;
  font-weight: normal;
  white-space: normal;
}
.odds-watch:hover .odds-popover,
.odds-watch:focus .odds-popover,
.odds-watch:focus-within .odds-popover {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}
.odds-popover strong {
  color: var(--accent);
  font-size: 0.75rem;
}
.odds-popover span {
  color: var(--text-dim);
  font-size: 0.72rem;
}
.odds-chart {
  width: 100%;
  aspect-ratio: 292 / 190;
  margin: 0.25rem 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.odds-chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.odds-chart .axis {
  stroke: rgba(255,255,255,0.22);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.odds-chart .grid-line {
  stroke: rgba(255,255,255,0.08);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.odds-chart .axis-label {
  fill: var(--text-fade);
  font-size: 10px;
  font-family: 'Courier New', monospace;
}
.odds-chart .x-end {
  text-anchor: end;
}
.odds-chart polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.odds-chart circle {
  fill: var(--accent);
  stroke: #101018;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.odds-chart circle.end-dot {
  fill: #4ade80;
}
.odds-chart-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 0.45rem 0.55rem 0.5rem;
  color: var(--text-fade);
  font-size: 0.68rem;
}
.odds-chart.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-fade);
  font-size: 0.72rem;
}
.fav-row td { background: transparent; }
.scratched-row td {
  color: var(--text-fade);
  opacity: 0.72;
  text-decoration: line-through;
}
.scratched-row .odds,
.scratched-row .prob {
  text-decoration: none;
  color: var(--text-fade);
}
.fav {
  background: var(--accent);
  color: #000;
  padding: 0 0.3rem;
  font-size: 0.65rem;
  border-radius: 2px;
  letter-spacing: 0.05em;
}

/* form badges */
.form { white-space: nowrap; letter-spacing: 1px; }
.fc {
  display: inline-block;
  width: 1.4rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: bold;
  margin-right: 1px;
  padding: 0.1rem 0;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
}
.fc.f-win   { background: #2a7a3a; color: #d8ffe2; }
.fc.f-place { background: #4a5a90; color: #d8e3ff; }
.fc.f-bad   { background: rgba(255,255,255,0.04); color: var(--text-fade); }

.form-legend {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-fade);
}
.form-legend code {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 2px;
}

/* states */
.loading, .empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-fade);
}
.error {
  background: rgba(255, 100, 100, 0.1);
  border: 1px solid rgba(255, 100, 100, 0.3);
  color: #ff9999;
  padding: 1rem;
  border-radius: 4px;
}

/* footer */
.data-source-info {
  padding: 1rem;
  background: rgba(255, 170, 68, 0.05);
  border-left: 2px solid var(--accent);
  color: var(--text-dim);
  font-size: 0.8rem;
}
.data-source-info p { margin-bottom: 0.3rem; }
.data-source-info strong { color: var(--accent); }
.data-source-info code {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 0.75rem;
}

/* results */
.race-result-box,
.race-status-box {
  margin-bottom: 1.5rem;
  padding: 1.1rem 1.2rem;
  border-radius: 6px;
  border: 1px solid var(--accent-line);
  background: linear-gradient(160deg, rgba(255, 170, 68, 0.08), rgba(255, 170, 68, 0.02));
  box-shadow: 0 1px 0 rgba(255, 170, 68, 0.08) inset;
}

.race-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 170, 68, 0.18);
}
.race-result-box h3 {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.race-result-trophy {
  font-size: 1.05rem;
  filter: drop-shadow(0 0 4px rgba(255, 170, 68, 0.4));
}

.race-result {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.result-row {
  display: grid;
  grid-template-columns: 2rem 3.2rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 0.88rem;
  color: var(--text);
  transition: background 120ms ease, border-color 120ms ease;
}
.result-row:hover {
  background: rgba(255, 170, 68, 0.08);
  border-color: var(--accent-line);
}
.result-row-1 {
  background: linear-gradient(90deg, rgba(255, 170, 68, 0.14), rgba(255, 170, 68, 0.04));
  border-color: rgba(255, 170, 68, 0.3);
}
.result-row-2 {
  background: linear-gradient(90deg, rgba(220, 220, 230, 0.08), rgba(220, 220, 230, 0.02));
}
.result-row-3 {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.10), rgba(205, 127, 50, 0.02));
}

.result-medal {
  font-size: 1.3rem;
  text-align: center;
  line-height: 1;
}
.result-place-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
}
.result-place-text {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.result-horse {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}
.result-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: rgba(255, 170, 68, 0.12);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 600;
}
.result-name {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-jockey {
  font-size: 0.72rem;
  color: var(--text-fade);
  font-style: italic;
  letter-spacing: 0.03em;
}
@media (max-width: 600px) {
  .result-row {
    grid-template-columns: 1.8rem 1fr;
    grid-template-areas: "medal horse";
    row-gap: 0.25rem;
  }
  .result-medal { grid-area: medal; }
  .result-place-text { display: none; }
  .result-horse { grid-area: horse; }
  .result-jockey { grid-column: 2; font-size: 0.7rem; }
}

.result-table-wrap {
  width: 100%;
  margin-top: 0.9rem;
  overflow-x: auto;
}

.result-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.result-table th,
.result-table td {
  padding: 0.45rem 0.5rem;
  border-top: 1px solid rgba(255, 170, 68, 0.1);
  text-align: left;
  white-space: nowrap;
}

.result-table th {
  color: var(--accent);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-table td:not(:nth-child(2)) {
  font-family: 'Courier New', monospace;
}

.result-meta {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: var(--text-fade);
}

.race-status-box {
  background: rgba(100, 200, 100, 0.05);
  border-left-color: #6cc;
  color: #8dd;
}
.race-status-box strong { color: #8dd; }

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  border-radius: 2px;
  white-space: nowrap;
  letter-spacing: 0.05em;
  font-weight: bold;
  margin-left: 0.3rem;
}
.badge.completed {
  background: rgba(100, 200, 100, 0.2);
  color: #8dd;
}
.badge.running {
  background: rgba(255, 200, 100, 0.2);
  color: #fc8;
  animation: pulse 1.5s infinite;
}
.badge.upcoming {
  background: rgba(100, 150, 255, 0.2);
  color: #8ad;
}

.badge.abandoned,
.badge.cancelled,
.badge.canceled,
.badge.postponed,
.badge.void {
  background: rgba(255, 120, 120, 0.18);
  color: #ff9b9b;
}

.race-status-box.terminal {
  background: rgba(255, 120, 120, 0.06);
  border-left-color: #ff9b9b;
  color: #ffb0b0;
}

.race-status-box.terminal strong {
  color: #ff9b9b;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.placing {
  font-weight: bold;
  text-align: center;
  color: var(--accent);
}
.placing-1 { background: rgba(100, 200, 100, 0.15); color: #8dd; }
.placing-2 { background: rgba(200, 200, 100, 0.15); color: #dd8; }
.placing-3 { background: rgba(200, 150, 100, 0.15); color: #d9a; }

/* mobile */
@media (max-width: 768px) {
  .container { padding: 0.8rem; }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
    border-bottom: 1px solid var(--accent-line);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }

  .header-content h1 {
    font-size: 1.5rem;
    letter-spacing: 0.1em;
  }

  .header-content p { font-size: 0.8rem; }

  .header-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }

  .nav-btn {
    min-width: 0;
    flex: 1 1 8rem;
  }

  .back-btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }

  .date-tabs {
    gap: 0.4rem;
    margin-bottom: 0.8rem;
  }

  .date-tab {
    flex: 1;
    min-width: 70px;
    padding: 0.45rem 0.5rem;
    font-size: 0.75rem;
  }
  .date-tab .date-label { font-size: 0.8rem; }
  .date-tab .date-sub { font-size: 0.65rem; }

  .filters {
    gap: 0.4rem;
    margin-bottom: 0.8rem;
  }
  .filter-btn {
    padding: 0.35rem 0.4rem;
    font-size: 0.65rem;
  }

  .breadcrumb {
    font-size: 0.75rem;
    margin-bottom: 0.8rem;
  }

  .content {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 0.6rem;
  }
  .view-header h2 { font-size: 1rem; }
  .view-toggle { gap: 0.35rem; }
  .view-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
  }

  .live-summary {
    grid-template-columns: 1fr;
    padding: 0.8rem;
  }

  .live-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .live-card-grid {
    grid-template-columns: 1fr;
  }

  .live-page-toolbar {
    margin-bottom: 0.4rem;
  }

  .live-bet-card {
    padding: 0.6rem 0.7rem;
    gap: 0.4rem;
  }

  .live-card-top {
    gap: 0.4rem;
  }

  .live-card-bottom {
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .live-odds-line {
    flex-wrap: wrap;
    gap: 0.4rem 0.7rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.74rem;
  }

  .live-race-line,
  .live-selection-line {
    gap: 0.1rem;
  }

  .live-race-line strong,
  .live-selection-line strong {
    font-size: 0.92rem;
    line-height: 1.2;
  }

  .live-race-line span,
  .live-selection-line span {
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .live-signal-row {
    gap: 0.22rem;
  }

  .live-signal {
    font-size: 0.66rem;
    padding: 0.1rem 0.35rem;
  }

  .live-state {
    font-size: 0.62rem;
    padding: 0.14rem 0.4rem;
  }

  .live-card-time,
  .live-card-meta {
    font-size: 0.7rem;
  }

  .live-evidence-grid {
    grid-template-columns: 1fr;
  }

  .live-mini-table > div {
    flex-direction: column;
    gap: 0.15rem;
  }

  .live-mini-table strong {
    text-align: left;
    white-space: normal;
  }

  .meetings-grid { grid-template-columns: 1fr; }

  .meeting-card,
  .country-card {
    padding: 0.9rem;
    border-radius: 3px;
  }
  .meeting-card h3,
  .country-card h3 { font-size: 0.95rem; }

  .meeting-info,
  .country-info { font-size: 0.8rem; }

  .card-cta { font-size: 0.7rem; }

  .meeting-summary {
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.75rem;
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
  }

  .races-list { gap: 0.5rem; }

  .race-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.8rem 1rem;
  }
  .race-row:hover { transform: none; background: var(--row-hover); }

  .race-row-left {
    width: 100%;
    gap: 0.6rem;
  }
  .race-num {
    border-right: none;
    padding-right: 0;
    min-width: auto;
    margin-right: 0;
  }
  .race-row-name { font-size: 0.9rem; }
  .race-row-meta { font-size: 0.75rem; }

  .race-row-right {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
  }
  .race-row-cta { font-size: 1rem; }

  .race-time-group {
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
  }

  .countdown {
    padding: 0.2rem 0.4rem;
    font-size: 0.65rem;
    min-width: 45px;
  }

  .next-race-banner {
    padding: 0.8rem 1rem;
    margin-bottom: 0.8rem;
  }
  .banner-label { font-size: 0.65rem; margin-bottom: 0.4rem; }
  .banner-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
  .banner-info { font-size: 0.85rem; }
  .banner-countdown { gap: 0.5rem; }
  .banner-time { font-size: 1.1rem; }
  .banner-cd {
    font-size: 0.85rem !important;
    padding: 0.3rem 0.6rem !important;
    min-width: 65px !important;
  }

  .next-race-info {
    margin: 0.5rem 0;
    padding: 0.4rem 0.6rem;
  }
  .next-race-info .meta-label { font-size: 0.7rem; }

  /* race detail */
  .race-meta {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.4rem;
    padding: 0.8rem;
    margin-bottom: 1rem;
  }
  .meta-label { font-size: 0.65rem; }
  .meta-value { font-size: 0.85rem; margin-top: 1px; }

  .horses-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4.5rem;
    margin-inline: 0;
    padding-inline: 0;
    max-width: 100%;
  }

  .horses-table {
    font-size: 0.7rem;
    width: max-content;
    min-width: 900px;
  }
  .horses-table th,
  .horses-table td {
    padding: 0.4rem 0.3rem;
  }
  .horses-table th { font-size: 0.65rem; }

  .horses-table .num { width: 2rem; }

  .lab-grid {
    grid-template-columns: 1fr;
  }

  .lab-panel {
    padding: 0.8rem;
  }

  .lab-delta {
    grid-template-columns: 1fr;
  }

  .lab-pnl-grid {
    grid-template-columns: 1fr;
  }

  .lab-table {
    min-width: 720px;
    font-size: 0.72rem;
  }

  .odds-popover {
    position: fixed;
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: min(340px, calc(100vw - 2rem));
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
  }

  .badge { font-size: 0.6rem; padding: 0.2rem 0.4rem; }

  .race-result-box,
  .race-status-box {
    margin-bottom: 1rem;
    padding: 0.8rem;
  }
  .race-result-box h3 { font-size: 0.88rem; }
  .result-meta { font-size: 0.75rem; margin-top: 0.6rem; }

  .form-legend { font-size: 0.7rem; }

  .data-source-info {
    padding: 0.8rem;
    font-size: 0.75rem;
  }
}

/*  insights panel  */
.insights-panel {
  background: linear-gradient(135deg, rgba(255,170,68,0.06), rgba(80,180,120,0.04));
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  padding: 0.95rem 1rem;
  margin-bottom: 1.2rem;
}

.insights-panel.locked {
  border-color: rgba(120,160,255,0.28);
  background: linear-gradient(135deg, rgba(120,160,255,0.05), rgba(255,170,68,0.04));
}
.insights-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: baseline;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 0.55rem;
}
.insights-head h3 {
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.insights-head span {
  color: var(--text-fade);
  font-size: 0.72rem;
  text-align: right;
}

.score-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  letter-spacing: 0;
}

.score-info-btn {
  width: 1.2rem;
  height: 1.2rem;
  border: 1px solid var(--accent-line);
  background: rgba(255, 170, 68, 0.08);
  color: var(--accent);
  border-radius: 50%;
  font-family: inherit;
  font-size: 0.72rem;
  line-height: 1;
  cursor: help;
}

.score-popover {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 0.5rem);
  z-index: 20000;
  width: min(32rem, calc(100vw - 3rem));
  padding: 0.8rem;
  border: 1px solid var(--accent-line);
  background: rgba(10, 10, 18, 0.98);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.74rem;
  line-height: 1.45;
}

.score-info:hover .score-popover,
.score-info:focus-within .score-popover {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.score-popover strong {
  color: var(--accent);
  font-size: 0.75rem;
}

.score-popover span {
  color: var(--text-dim);
}

.insights-grid {
  display: flex;
  align-items: stretch;
  gap: 0.85rem;
  width: 100%;
}
.insights-grid.three-col {
  display: flex;
}
.insights-grid.two-col {
  display: flex;
}

.insights-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.insights-col h4 {
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 0.45rem;
  border-bottom: 1px solid var(--accent-line);
  padding-bottom: 0.28rem;
}

.insights-col h4 small {
  color: var(--text-fade);
  font-weight: normal;
  font-size: 0.7rem;
  margin-left: 0.4rem;
}

.ins-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.ins-list li {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0.28rem 0.4rem;
  padding: 0.34rem 0;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
  font-size: 0.85rem;
  min-height: 3.15rem;
  align-content: start;
}

.ins-list li:last-child { border-bottom: none; }
.ins-list li.empty { color: var(--text-fade); font-style: italic; font-size: 0.8rem; }

.ins-rank {
  background: var(--accent);
  color: var(--bg);
  width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: bold;
  font-size: 0.75rem;
}

.ins-num { color: var(--accent); font-weight: bold; }
.ins-name { flex: 1; }
.ins-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.ins-detail {
  color: var(--text-dim);
  font-size: 0.75rem;
  grid-column: 1 / -1;
  line-height: 1.35;
}
.win-tone {
  font-weight: bold;
}
.win-tone.prob-low { color: var(--text-fade); }
.win-tone.prob-ok { color: #9ca3af; }
.win-tone.prob-good { color: #86efac; }
.win-tone.prob-strong { color: #22c55e; }
.ins-edge {
  color: #4ade80;
  font-weight: bold;
  font-size: 0.85rem;
  grid-column: 1 / -1;
}

.ins-edge.positive { color: #4ade80; }
.ins-edge.negative { color: #f87171; }

.momentum-plunge .ins-detail { color: #7dd3fc; }
.momentum-drift .ins-detail { color: #facc15; }

.screen-metric strong.positive { color: #86efac; }
.screen-metric strong.negative { color: #f87171; }

.ex-list li { justify-content: space-between; }
.ex-list strong { color: var(--accent); margin-right: 0.4rem; }
.ex-prob {
  color: #4ade80;
  font-weight: bold;
  margin-left: auto;
  font-size: 0.8rem;
}

.insights-note {
  margin-top: 0.8rem;
  font-size: 0.7rem;
  color: var(--text-fade);
  font-style: italic;
}

@media (max-width: 768px) {
  .insights-panel { padding: 0.75rem 0.8rem; }
  .insights-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }
  .insights-head span {
    text-align: left;
  }
  .insights-grid {
    flex-direction: column;
    gap: 0.95rem;
    overflow: visible;
    padding-bottom: 0;
  }
  .insights-col {
    flex: 1 1 auto;
    width: 100%;
  }
  .insights-col h4 { font-size: 0.78rem; }
  .ins-list {
    display: flex;
    height: auto;
    gap: 0;
  }
  .ins-list li {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    font-size: 0.8rem;
    min-height: 2.75rem;
  }
  .ins-detail { font-size: 0.7rem; }
  .score-popover {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(22rem, calc(100vw - 2rem));
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
  }
  .screen-row { flex-direction: column; }
  .screen-row-side { align-items: flex-start; min-width: 0; }
  .screen-metrics { width: 100%; }
  .screen-metric { flex: 1 1 7rem; }
  .screener-filters { align-items: flex-start; }
  .screen-chip-group { justify-content: flex-start; }
  .strategy-hero,
  .monitor-grid,
  .lab-grid {
    grid-template-columns: 1fr;
  }
  .strategy-scorecard,
  .monitor-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .monitor-panel-head {
    flex-direction: column;
  }
  .monitor-bet-row {
    grid-template-columns: 1.8rem minmax(0, 1fr) auto;
  }
  .monitor-bet-row .monitor-badge {
    grid-column: 2 / -1;
    justify-self: start;
  }
  .monitor-runs div {
    grid-template-columns: 1fr;
  }
  .cadence-row summary {
    grid-template-columns: 1fr;
  }
  .lab-pnl-grid.triple {
    grid-template-columns: 1fr;
  }
}

/*  horse-row badges  */
.horse-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.hbadge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hbadge.b-top { background: rgba(255,170,68,0.2); color: var(--accent); border: 1px solid var(--accent); }
.hbadge.b-second { background: rgba(255,170,68,0.08); color: rgba(255,170,68,0.8); }
.hbadge.b-third { background: rgba(255,170,68,0.05); color: rgba(255,170,68,0.6); }
.hbadge.b-bet { background: rgba(250,204,21,0.2); color: #fde68a; border: 1px solid rgba(250,204,21,0.55); font-weight: bold; }
.hbadge.b-value { background: rgba(74,222,128,0.18); color: #4ade80; border: 1px solid rgba(74,222,128,0.4); font-weight: bold; }
.hbadge.b-plunge { background: rgba(56,189,248,0.16); color: #7dd3fc; border: 1px solid rgba(56,189,248,0.45); font-weight: bold; }
.hbadge.b-hot { background: rgba(244,114,114,0.15); color: #f47272; }
.hbadge.b-cold { background: rgba(120,140,180,0.15); color: #8aa; }
.signal-badges { opacity: 0.92; }
.hbadge.b-signal { border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.06); color: var(--text); }
.hbadge.b-confidence,
.hbadge.b-top { font-weight: bold; }
.hbadge.b-confidence { background: rgba(34,197,94,0.14); color: #86efac; border-color: rgba(34,197,94,0.35); }
.hbadge.b-wet { background: rgba(14,165,233,0.15); color: #7dd3fc; border-color: rgba(14,165,233,0.42); }
.hbadge.b-dry { background: rgba(250,204,21,0.12); color: #fde68a; border-color: rgba(250,204,21,0.32); }
.hbadge.b-field,
.hbadge.b-market,
.hbadge.b-fresh { background: rgba(148,163,184,0.13); color: #cbd5e1; border-color: rgba(148,163,184,0.3); }
.hbadge.b-risk { background: rgba(248,113,113,0.14); color: #fca5a5; border-color: rgba(248,113,113,0.35); }

.signal-panel {
  border-color: rgba(125, 211, 252, 0.22);
}

.signal-pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.9rem 0 1rem;
}

.signal-pipeline span {
  border: 1px solid rgba(125, 211, 252, 0.22);
  background: rgba(125, 211, 252, 0.08);
  color: #bae6fd;
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
  font-size: 0.72rem;
}

.signal-table-wrap {
  overflow-x: auto;
}

.signal-table th,
.signal-table td {
  white-space: nowrap;
}

/*  probability column  */
.horses-table td.prob {
  position: relative;
  min-width: 70px;
}

.prob-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--pct, 0%);
  background: linear-gradient(90deg, rgba(74,222,128,0.25), rgba(74,222,128,0.1));
  z-index: 0;
}

.prob-pct {
  position: relative;
  z-index: 1;
  font-weight: bold;
  color: #4ade80;
}

/*  race-list pick chips  */
.rrow-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
}

.rrow-pick {
  color: var(--accent);
  background: rgba(255,170,68,0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
}

.rrow-value {
  color: #4ade80;
  background: rgba(74,222,128,0.12);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  font-weight: bold;
}

/*  primary nav  */
.primary-nav {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--accent-line);
  padding-bottom: 0.6rem;
  flex-wrap: wrap;
}
.pnav-btn {
  background: transparent;
  border: 1px solid var(--accent-line);
  color: var(--text-dim);
  padding: 0.55rem 1rem;
  min-height: 38px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.2s;
  border-radius: 3px;
}
.pnav-btn:hover { color: var(--accent); border-color: var(--accent); }
.pnav-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: bold;
}

.primary-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--bg);
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.primary-btn:hover { box-shadow: 0 0 12px var(--accent); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--accent-line);
  color: var(--text-dim);
  padding: 0.4rem 0.8rem;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 3px;
}
.btn-secondary:hover { color: var(--accent); border-color: var(--accent); }

.btn-danger {
  background: transparent;
  border: 1px solid rgba(244,114,114,0.5);
  color: #f47272;
  padding: 0.4rem 0.8rem;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 3px;
}
.btn-danger:hover { background: rgba(244,114,114,0.15); }

/* mobile-first race browser */
.races-list {
  gap: 1rem;
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }

  .container {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .header-actions #live-plan-page-btn,
  .header-actions #observatory-page-btn,
  .header-actions #race-page-btn {
    display: none;
  }

  .bottom-tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 950;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem;
    padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 1px solid rgba(255,170,68,0.28);
    background:
      linear-gradient(180deg, rgba(22, 22, 34, 0.96), rgba(10, 10, 18, 0.98));
    box-shadow: 0 -12px 34px rgba(0,0,0,0.58), 0 -1px 0 rgba(255,255,255,0.04);
    backdrop-filter: blur(14px);
  }

  .bottom-tab {
    min-width: 0;
    min-height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.24rem;
    padding: 0.36rem 0.2rem;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--text-muted);
    transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
  }

  .bottom-tab svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .bottom-tab span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    color: currentColor;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
  }

  .bottom-tab.active {
    color: var(--accent);
    border-color: rgba(255,170,68,0.36);
    background: rgba(255,170,68,0.13);
    box-shadow: inset 0 -2px 0 var(--accent), 0 0 14px rgba(255,170,68,0.12);
  }
}

.race-meeting-section {
  border: 1px solid var(--accent-line);
  background: rgba(20, 20, 32, 0.58);
  padding: 0.85rem;
}

.race-meeting-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.race-meeting-head h3 {
  color: var(--accent);
  font-size: 0.98rem;
  line-height: 1.25;
  margin: 0.12rem 0 0;
}

.race-meeting-head p {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.race-meeting-count {
  flex: 0 0 auto;
  min-width: 76px;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.race-meeting-count strong {
  display: block;
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
}

.race-meeting-races {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  padding-top: 0.75rem;
}

.race-view-switch {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  margin: 0 0 1rem;
  border: 1px solid var(--accent-line);
  background: rgba(255,255,255,0.025);
}

.race-view-switch button {
  min-height: 34px;
  padding: 0.35rem 0.85rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.race-view-switch button.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.race-calendar-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--accent-line);
  background: rgba(20, 20, 32, 0.58);
}

.race-calendar {
  display: grid;
  grid-template-columns: minmax(150px, 1.55fr) repeat(var(--race-cols), minmax(78px, 1fr));
  min-width: calc(150px + var(--race-cols) * 78px);
}

.race-calendar-head,
.race-calendar-location,
.race-calendar-cell {
  min-height: 52px;
  border-right: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.race-calendar-head {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
}

.race-calendar-head.location {
  justify-content: flex-start;
  padding: 0 0.55rem;
}

.race-calendar-location {
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.12rem;
  padding: 0.48rem 0.55rem;
  background: #151521;
}

.race-calendar-location strong {
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.2;
}

.race-calendar-location span,
.race-calendar-location small {
  color: var(--text-muted);
  font-size: 0.66rem;
  line-height: 1.15;
}

.race-calendar-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border-top: 0;
  border-left: 0;
  background: rgba(255,255,255,0.025);
  color: #aeb4c5;
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.race-calendar-cell span {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.race-calendar-cell:hover {
  background: rgba(255,170,68,0.12);
  color: var(--accent);
}

.race-calendar-cell.empty {
  cursor: default;
  background: rgba(255,255,255,0.12);
}

.race-calendar-cell.resulted {
  color: #aab1c4;
}

.race-calendar-cell.pending {
  color: #fde68a;
  background: rgba(250,204,21,0.08);
}

.race-calendar-cell.countdown,
.race-calendar-cell.soon {
  color: #fff;
  font-weight: 800;
  background: #070923;
}

.race-calendar-cell.soon {
  box-shadow: inset 0 0 0 1px rgba(255,170,68,0.45);
}

.race-calendar-cell.void {
  color: #fca5a5;
  background: rgba(248,113,113,0.08);
}

.race-row {
  position: relative;
  align-items: stretch;
  gap: 0.75rem;
  min-width: 0;
  text-align: left;
  cursor: pointer;
}

.race-row-main {
  flex: 1 1 auto;
  min-width: 0;
}

.race-row-topline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.race-row .race-num {
  min-width: 0;
  border-right: 0;
  padding-right: 0;
  margin-right: 0.1rem;
  font-size: 0.86rem;
  line-height: 1;
  padding: 0.28rem 0.45rem;
  border: 1px solid rgba(255,170,68,0.35);
  background: rgba(255,170,68,0.08);
  border-radius: 999px;
}

.race-row .race-time-group {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.race-row-name {
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.race-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.race-row-meta span {
  padding: 0.16rem 0.42rem;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  border-radius: 999px;
}

.race-row-right {
  flex: 0 0 auto;
  align-self: center;
}

.race-row-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,170,68,0.28);
  border-radius: 50%;
  background: rgba(255,170,68,0.05);
}

@media (min-width: 860px) {
  .race-meeting-races {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .race-meeting-races {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.horses-table {
  min-width: 780px;
}

.horses-table th:nth-child(4),
.horses-table td:nth-child(4) {
  min-width: 5.5rem;
  white-space: nowrap;
}

.horses-table th:nth-child(9),
.horses-table td:nth-child(9) {
  white-space: normal;
  min-width: 8rem;
}

@media (max-width: 640px) {
  .primary-nav {
    border-bottom: 0;
    padding-bottom: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .primary-nav::-webkit-scrollbar { display: none; }

  .primary-nav .pnav-btn {
    flex: 0 0 auto;
    border-radius: 999px;
    font-size: 0.74rem;
    padding: 0.48rem 0.78rem;
    white-space: nowrap;
  }

  .race-browser-hero,
  .race-detail-hero {
    padding: 0.85rem;
  }

  .race-meeting-section {
    padding: 0.72rem;
  }

  .race-meeting-head {
    align-items: flex-start;
  }

  .race-meeting-head h3 {
    font-size: 0.92rem;
  }

  .race-row {
    flex-direction: row;
    align-items: stretch;
    padding: 0.78rem;
    border-radius: 7px;
  }

  .race-row-right {
    width: auto;
    justify-content: center;
  }

  .race-row-name {
    font-size: 0.88rem;
  }

  .rrow-picks {
    gap: 0.35rem;
  }

  .rrow-pick,
  .rrow-value {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .race-meta {
    border-radius: 7px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .horses-table-wrap {
    border: 1px solid var(--accent-line);
    background: rgba(20,20,32,0.5);
    border-radius: 7px;
    padding: 0 0 4rem;
  }

  .horses-table {
    min-width: 780px;
  }

  .horses-table th.col-result-medal,
  .horses-table td.col-result-medal {
    width: 38px;
    min-width: 38px;
  }

  .horses-table .num {
    width: 28px;
    min-width: 28px;
  }

  .horses-table th:nth-child(3),
  .horses-table td:nth-child(3) {
    width: 10.5rem;
    min-width: 10.5rem;
    max-width: 10.5rem;
    white-space: normal;
  }

  .horses-table td:nth-child(3) strong {
    display: block;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }

  .horses-table td:nth-child(3) small {
    display: block;
  }

  .horse-badges {
    max-width: 100%;
  }

  .hbadge {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/*  strategies view  */
.strategies-list { display: flex; flex-direction: column; gap: 1rem; }

.strategy-card {
  background: var(--panel);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  padding: 1rem 1.2rem;
}
.strategy-card.inactive { opacity: 0.55; }

.strat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.6rem;
}
.strat-head h3 { color: var(--accent); margin-bottom: 0.2rem; font-size: 1.05rem; }
.strat-desc { color: var(--text-dim); font-size: 0.8rem; }

.strat-rule {
  font-size: 0.8rem;
  color: var(--text);
  background: rgba(255,170,68,0.05);
  padding: 0.5rem 0.7rem;
  border-radius: 3px;
  margin-bottom: 0.7rem;
}
.strat-rule strong { color: var(--accent); }
.rule-bet {
  margin-left: 0.4rem;
  color: #4ade80;
  font-weight: bold;
}

.strat-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.6rem;
  padding: 0.7rem 0;
  border-top: 1px dashed var(--accent-line);
  border-bottom: 1px dashed var(--accent-line);
  margin-bottom: 0.7rem;
}
.strat-stats > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.strat-actions { display: flex; gap: 0.5rem; }

.meta-value.pos { color: #4ade80; }
.meta-value.neg { color: #f47272; }

/* toggle */
.toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: rgba(255,255,255,0.15);
  transition: 0.2s;
  border-radius: 22px;
}
.slider:before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}
.toggle input:checked + .slider { background-color: var(--accent); }
.toggle input:checked + .slider:before { transform: translateX(20px); }

/* strategy editor */
.strategy-editor {
  background: rgba(255,170,68,0.05);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1.2rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.strategy-editor h3 { color: var(--accent); margin-bottom: 0.3rem; }
.strategy-editor label {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  color: var(--text-dim);
  gap: 0.25rem;
}
.strategy-editor label small { color: var(--text-fade); font-weight: normal; }
.strategy-editor input,
.strategy-editor select,
.strategy-editor textarea {
  background: var(--bg);
  border: 1px solid var(--accent-line);
  color: var(--text);
  font-family: inherit;
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  font-size: 0.85rem;
}
.strategy-editor input:focus,
.strategy-editor select:focus,
.strategy-editor textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.form-check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
}
.form-actions { display: flex; gap: 0.5rem; margin-top: 0.4rem; }

/*  bets view  */
.bets-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.summary-tile {
  background: var(--panel);
  border: 1px solid var(--accent-line);
  border-radius: 3px;
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
}
.summary-tile .meta-label { font-size: 0.7rem; }
.summary-tile .meta-value { font-size: 1.1rem; font-weight: bold; margin-top: 0.2rem; }

.bets-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  font-size: 0.82rem;
}
.bets-table th,
.bets-table td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.bets-table th {
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  background: rgba(255,170,68,0.06);
}
.bets-table small { color: var(--text-fade); font-size: 0.7rem; }
.bets-table td.pos { color: #4ade80; font-weight: bold; }
.bets-table td.neg { color: #f47272; font-weight: bold; }

.bet-status {
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  white-space: nowrap;
}
.bet-status.pending { background: rgba(255,170,68,0.15); color: var(--accent); }
.bet-status.won { background: rgba(74,222,128,0.18); color: #4ade80; font-weight: bold; }
.bet-status.lost { background: rgba(244,114,114,0.15); color: #f47272; }

.bets-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

/*  performance view  */
.perf-overall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.perf-h3 {
  color: var(--accent);
  margin: 1rem 0 0.6rem;
  font-size: 1rem;
  letter-spacing: 0.05em;
}
.perf-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  font-size: 0.85rem;
}
.perf-table th,
.perf-table td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.perf-table th { color: var(--accent); font-size: 0.75rem; letter-spacing: 0.04em; background: rgba(255,170,68,0.06); }
.perf-table tr.dim { opacity: 0.55; }
.perf-table td.pos { color: #4ade80; font-weight: bold; }
.perf-table td.neg { color: #f47272; font-weight: bold; }
.tag-inactive {
  background: rgba(255,255,255,0.08);
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  color: var(--text-fade);
}
.perf-actions { display: flex; gap: 0.5rem; margin-top: 1.5rem; flex-wrap: wrap; }
.perf-note { font-size: 0.75rem; color: var(--text-fade); margin-top: 1rem; font-style: italic; }

/*  suggestions panel (race detail)  */
.suggestions-panel {
  background: rgba(74,222,128,0.04);
  border: 1px solid rgba(74,222,128,0.2);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
}
.suggestions-panel h4 {
  color: #4ade80;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.suggestions-hint { font-size: 0.72rem; color: var(--text-fade); margin-bottom: 0.7rem; }
.sug-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.7rem;
}
.sug-strat {
  background: var(--panel);
  border: 1px solid var(--accent-line);
  border-radius: 3px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
}
.sug-strat.inactive { opacity: 0.55; }
.sug-strat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
}
.sug-strat-tag {
  font-size: 0.65rem;
  background: rgba(255,255,255,0.06);
  color: var(--text-fade);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
}
.sug-list { list-style: none; padding: 0; margin: 0; }
.sug-list li { padding: 0.25rem 0; font-size: 0.82rem; }
.sug-detail { color: var(--text-dim); font-size: 0.72rem; margin-left: 0.3rem; }
.sug-placed { color: #4ade80; font-size: 0.7rem; margin-left: 0.4rem; font-weight: bold; }

.sug-bets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 0.5rem;
}
.sug-bets-table th, .sug-bets-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  text-align: left;
}
.sug-bets-table th { color: #4ade80; font-size: 0.72rem; }
.sug-bets-table td.pos { color: #4ade80; font-weight: bold; }
.sug-bets-table td.neg { color: #f47272; font-weight: bold; }

/*  backtest panel  */
.backtest-panel {
  background: rgba(120,160,255,0.04);
  border: 1px solid rgba(120,160,255,0.25);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
}

.backtest-panel .perf-h3 { margin-top: 0; color: #8ab4ff; }

.backtest-note {
  background: rgba(255,170,68,0.07);
  border-left: 3px solid var(--accent);
  padding: 0.6rem 0.8rem;
  font-size: 0.78rem;
  color: var(--text);
  margin-bottom: 0.9rem;
  font-style: italic;
  border-radius: 2px;
}

.backtest-controls {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.backtest-controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--text-dim);
  gap: 0.25rem;
}
.backtest-controls input[type="date"],
.backtest-controls select {
  background: var(--bg);
  border: 1px solid var(--accent-line);
  color: var(--text);
  font-family: inherit;
  padding: 0.4rem 0.5rem;
  border-radius: 3px;
  font-size: 0.85rem;
  color-scheme: dark;
}
.backtest-controls .form-check {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}
.backtest-controls .primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.backtest-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.perf-table.backtest {
  border-left: 3px solid #8ab4ff;
}

.backtest-skipped {
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  background: rgba(255,255,255,0.03);
  border-radius: 3px;
}
.backtest-skipped h5 {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
}
.backtest-skipped ul { list-style: none; padding: 0; margin: 0; }
.backtest-skipped li {
  font-size: 0.78rem;
  padding: 0.25rem 0;
  color: var(--text-dim);
}
.skip-reason { color: var(--text-fade); margin-left: 0.4rem; font-style: italic; }

.backtest-future {
  margin-top: 0.8rem;
  font-size: 0.7rem;
  color: var(--text-fade);
  font-style: italic;
}

.sug-bets-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/*  expandable cards  */
.horse-card,
.bet-card,
.perf-row {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
}

.horse-card:hover,
.bet-card:hover,
.perf-row:hover {
  background: var(--row-hover);
}

.card-header,
.row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
}

.toggle-icon {
  display: inline-block;
  transition: transform 0.2s;
  width: 1rem;
  color: var(--accent);
  font-size: 0.9rem;
}

.horse-card.expanded .toggle-icon,
.bet-card.expanded .toggle-icon,
.perf-row.expanded .toggle-icon {
  transform: rotate(90deg);
}

.card-body,
.row-body {
  display: none;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  animation: slideDown 0.2s ease-out;
}

.horse-card.expanded .card-body,
.bet-card.expanded .card-body,
.perf-row.expanded .row-body {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

/* Card body content */
.card-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.card-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.card-detail-label {
  color: var(--text-dim);
  font-weight: normal;
}

.card-detail-value {
  color: var(--text);
  text-align: right;
}

/* Mobile card layouts */
@media (max-width: 640px) {
  .horses-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .horse-card {
    border-radius: 2px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .bets-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .bet-card {
    border: 1px solid var(--accent-line);
    border-radius: 3px;
    padding: 0.75rem;
  }

  .perf-list {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .perf-row {
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .card-header {
    font-size: 0.9rem;
  }

  .card-body,
  .row-body {
    padding-top: 0.75rem;
    margin-top: 0.5rem;
  }
}

/* Desktop table layouts (640px+) */
@media (min-width: 641px) {
  .horses-grid {
    display: table;
    width: 100%;
    border-collapse: collapse;
  }

  .horse-card {
    display: table-row;
    border: none;
    padding: 0;
  }

  .horse-card .card-header {
    display: table-cell;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .horse-card .card-body {
    display: none;
  }

  .bets-list {
    display: table;
    width: 100%;
    border-collapse: collapse;
  }

  .bet-card {
    display: table-row;
    border: none;
    padding: 0;
  }

  .bet-card .card-header {
    display: table-cell;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .perf-list {
    display: table;
    width: 100%;
    border-collapse: collapse;
  }

  .perf-row {
    display: table-row;
    border: none;
    padding: 0;
  }

  .perf-row .row-header {
    display: table-cell;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .perf-row .row-body {
    display: none;
  }
}

@media (max-width: 768px) {
  .primary-nav { gap: 0.3rem; }
  .pnav-btn { font-size: 0.75rem; padding: 0.5rem 0.7rem; }
  .strat-head { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .bets-table, .perf-table { font-size: 0.72rem; }
  .bets-table th, .bets-table td,
  .perf-table th, .perf-table td { padding: 0.4rem 0.4rem; }
  .summary-tile { padding: 0.5rem 0.6rem; }
  .summary-tile .meta-value { font-size: 0.95rem; }

  /* Tighter tile grids so they reflow on narrow phones */
  .bets-summary,
  .perf-overall { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 0.4rem; }
  .strat-stats  { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 0.5rem; }

  /* Strategy suggestions in race detail collapse to one column */
  .sug-grid { grid-template-columns: 1fr; }

  /* Strategy bets table on race detail  tighten + ensure scrollable */
  .sug-bets-table { font-size: 0.72rem; min-width: 540px; }
  .sug-bets-table th, .sug-bets-table td { padding: 0.35rem 0.4rem; }

  /* Next race banner stacks vertically */
  .banner-content { flex-direction: column; align-items: flex-start; gap: 0.4rem; }

  /* Backtest controls stack on phone widths */
  .backtest-controls { flex-direction: column; align-items: stretch; }
  .backtest-controls label { width: 100%; }
  .backtest-controls .primary-btn { width: 100%; }
  .backtest-panel { padding: 0.8rem 0.9rem; }
  .backtest-note { font-size: 0.72rem; padding: 0.5rem 0.6rem; }
}

@media (max-width: 480px) {
  .container { padding: 1rem 0.8rem; }
  .race-meta { grid-template-columns: 1fr 1fr; }
  .bets-summary,
  .perf-overall { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
  .summary-tile .meta-value { font-size: 0.85rem; }
  .summary-tile .meta-label { font-size: 0.65rem; }
  .pnav-btn { font-size: 0.68rem; padding: 0.4rem 0.5rem; letter-spacing: 0.02em; }
  .header-content h1 { font-size: 1.7rem; }
  .header-content p { font-size: 0.7rem; }
  .perf-h3 { font-size: 0.9rem; }
  .strat-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════
   BETTERMAN MOBILE — consolidated responsive overrides
   ═══════════════════════════════════════════════════════════════ */

/* ── tablet (≤ 900px): hide secondary table columns ─────────── */
@media (max-width: 900px) {
  .strategy-table { min-width: 640px; }
  .col-rule, .col-wins, .col-days { display: none; }
}

/* ── mobile (≤ 640px): aggressive column pruning ────────────── */
@media (max-width: 640px) {
  /* container */
  html, body { overflow-x: hidden; }
  .container { padding: 0.75rem; max-width: 100%; }
  .content { padding: 0.75rem; margin-bottom: 0.75rem; max-width: 100%; overflow-x: hidden; }
  .lab-panel { max-width: 100%; overflow-x: hidden; padding-left: 0.6rem; padding-right: 0.6rem; }

  /* header */
  .header { flex-direction: column; align-items: flex-start; gap: 0.5rem; margin-bottom: 1rem; padding-bottom: 0.75rem; }
  .header-content h1 { font-size: 1.5rem; }
  .header-content p { font-size: 0.72rem; }
  .header-actions { width: 100%; }
  .back-btn { font-size: 0.72rem; }

  /* ─── strategy table → mobile card list ───────────────────── */
  /* Hide desktop cells, show mobile card cell. Force everything to block. */
  .lab-table-wrap { overflow-x: visible !important; overflow-y: visible; }
  .strategy-table { min-width: 0 !important; width: 100% !important; display: block; max-width: 100%; }
  .strategy-table tbody { display: block; width: 100%; max-width: 100%; }
  .strategy-table thead { display: none; }
  .strategy-table tr {
    display: block;
    width: 100%;
    max-width: 100%;
  }
  .strategy-table td.desktop-only { display: none !important; }
  .strategy-table td.mobile-only {
    display: block !important;
    width: 100%;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    white-space: normal !important;
  }
  .strategy-table tr.strategy-row {
    margin: 0 0 0.6rem 0;
  }
  .strategy-table tr.strategy-row.strategy-row-selected .strat-card {
    background: rgba(99,102,241,0.1);
    border-color: rgba(99,102,241,0.45);
    border-left-color: rgba(99,102,241,0.85);
  }

  /* expand row + show-more/less rows: also block-level */
  .strategy-table tr.strategy-expand-row {
    margin: -0.55rem 0 0.6rem 0;
  }
  .strategy-table tr.strategy-expand-row > td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    background: rgba(99,102,241,0.04) !important;
    border: 1px solid rgba(99,102,241,0.18) !important;
    border-top: none !important;
    border-radius: 0 0 6px 6px !important;
  }
  .strategy-table tr.strat-show-more-row,
  .strategy-table tr.strat-show-less-row { margin-bottom: 0.6rem; }
  .strategy-table tr.strat-show-more-row > td,
  .strategy-table tr.strat-show-less-row > td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
  }
  .strat-show-more-btn,
  .strat-show-less-btn { border: 1px dashed rgba(255,255,255,0.12); border-radius: 6px; }

  /* the hidden classes must beat tr display rules — set as block first then override */
  .strategy-table tr.strategy-row.strat-hidden,
  .strategy-table tr.strategy-row.strat-hidden-mobile,
  .strategy-table tr.strat-hidden + .strategy-expand-row,
  .strategy-table tr.strat-hidden-mobile + .strategy-expand-row { display: none !important; }
  .strat-show-more-btn,
  .strat-show-less-btn { border-top: none; border: 1px dashed rgba(255,255,255,0.12); border-radius: 6px; }

  /* mobile-only hidden rows */
  .strat-hidden-mobile,
  .strat-hidden-mobile + .strategy-expand-row { display: none; }

  /* show-more button uses mobile-count text on small screens */
  .strat-show-desktop { display: none; }
  .strat-show-mobile { display: inline; }

  /* hide the entire multi-strategy chart section on mobile */
  .multi-strategy-pnl { display: none !important; }

  /* expand row: contain to screen, stack chart above bets */
  .strategy-table tr.strategy-expand-row {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .strategy-table tr.strategy-expand-row > td {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }
  .strategy-expand-inner {
    padding: 0.75rem 0.7rem !important;
    flex-direction: column !important;
    gap: 0.85rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .expand-chart-col,
  .expand-bets-col {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
    flex: none !important;
    box-sizing: border-box;
  }
  .mini-chart svg { width: 100% !important; max-width: 100%; }

  /* swap the bets table for block-list on mobile */
  .expand-bets-scroll { display: none; }
  .expand-bets-blocks {
    display: block;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-right: 2px;
  }

  /* unit stepper — stack to two lines */
  .monitor-panel-head { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .unit-stepper { flex-wrap: wrap; flex-shrink: 1; gap: 0.35rem; width: 100%; }
  .unit-stepper-label { width: 100%; margin-bottom: 0.1rem; }
  .unit-pills { flex-wrap: wrap; margin-left: 0; gap: 0.35rem; }
  .unit-pill { font-size: 0.78rem; padding: 0.3rem 0.65rem; flex: 1 1 auto; text-align: center; }

  /* expand accordion — stack chart above bets */
  .strategy-expand-inner { flex-direction: column; gap: 1rem; }
  .expand-chart-col { flex: none; width: 100%; }
  .expand-bets-col { flex: none; width: 100%; }
  .expand-bets-scroll { max-height: 260px; }
  .expand-bets-table th,
  .expand-bets-table td { font-size: 0.75rem; padding: 0.3rem 0.4rem; }
  .expand-chart-title,
  .expand-bets-title { font-size: 0.72rem; }

  /* scorecard tiles */
  .strategy-scorecard { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .strategy-hero { flex-direction: column; gap: 1rem; }

  /* pnl window controls — keep compact on small screens */
  .pnl-window-controls {
    padding: 0.6rem;
    margin: 0.6rem 0;
    gap: 0.45rem;
  }
  .pnl-window-btn { font-size: 0.72rem; padding: 0.4rem 0.4rem; }
  .pnl-date-nav .pnl-nav-btn { min-width: 0; font-size: 0.7rem; padding: 0.45rem 0.4rem; }
  .pnl-date-nav .pnl-date-display { font-size: 0.85rem; }
  .pnl-range-controls.hidden { display: none; }
  .pnl-range-controls label { flex: 1 1 calc(50% - 0.2rem); min-width: 0; }
  .pnl-range-controls input[type="date"] { width: 100%; min-width: 0; }
  .pnl-range-controls .pnl-window-btn { flex: 1 1 100%; }

  /* data health panel */
  .monitor-grid { grid-template-columns: 1fr; }

  /* badges + pills */
  .monitor-badge { font-size: 0.68rem; padding: 0.2rem 0.45rem; }
  .screen-pill { font-size: 0.68rem; }
}

/* ── small phones (≤ 400px) — fine tuning ───────────────────── */
@media (max-width: 400px) {
  .unit-pill { font-size: 0.72rem; padding: 0.25rem 0.5rem; }
  .strategy-scorecard { grid-template-columns: 1fr 1fr; }
  .strat-card { padding: 0.8rem 0.85rem; gap: 0.55rem; }
  .strat-card-name { font-size: 0.92rem; }
  .strat-hero-value { font-size: 1.2rem; }
  .strat-card-hero { gap: 1rem; }
  .strat-card-stats { font-size: 0.7rem; gap: 0.3rem; }
}
