/* ============================================================
   Turtle's Racing — Dashboard + Playbook styles
   Palette reused from existing playbook HTML.
   ============================================================ */

:root {
  --green: #1a5c3a;
  --green-light: #eef5f0;
  --green-mid: #2d8653;
  --gold: #b8860b;
  --gold-light: #faf3df;
  --gold-rule: #c9a14a;
  --red: #8b1a1a;
  --red-light: #fdf0f0;
  --orange: #c45c00;
  --orange-light: #fff3e8;
  --grey: #4a4a4a;
  --grey-light: #f3f1ec;
  --grey-mid: #e0ddd8;
  --border: #d8d3cb;
  --border-soft: #e8e4dc;
  --ink: #15170f;
  --text: #1f2018;
  --text-muted: #5a5a5a;
  --text-light: #626262;
  --paper: #fbf8f1;
  --bg: #fbf8f1;
  --card: #ffffff;
  --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

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

html, body { background: var(--bg); }

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== MASTHEAD ===== */
.masthead {
  background:
    radial-gradient(ellipse at 88% 30%, rgba(201, 161, 74, 0.16), transparent 65%),
    #0f1a12;
  color: #fff;
  border-bottom: 3px solid var(--gold-rule);
  padding: 28px 0 24px;
  position: relative;
}
.masthead-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.masthead-logo {
  height: 88px;
  width: auto;
  flex-shrink: 0;
}
.masthead-brand { flex: 1; min-width: 0; }
.masthead-title {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
  color: #fff;
  margin-bottom: 6px;
}
.masthead-eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

/* ===== TAB NAV ===== */
.tab-nav {
  background: var(--paper);
  border-bottom: 1px solid var(--border-soft);
  text-align: center;
}
.tab-link {
  display: inline-block;
  padding: 12px 26px;
  color: var(--text-muted);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-link.is-active { color: var(--ink); border-bottom-color: var(--gold-rule); }
.tab-link:hover { text-decoration: none; color: var(--ink); }

/* ===== PAGE ===== */
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px;
}

/* ===== SUMMARY BLOCK (editorial hero) ===== */
.summary {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-top: 3px solid var(--gold-rule);
  border-radius: 2px;
  padding: 28px 32px 24px;
  margin-bottom: 18px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.summary-eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.summary-coverage, .summary-note {
  font-weight: 500;
  color: var(--text-light);
  letter-spacing: 1.2px;
  margin-left: 6px;
}
.summary-number {
  font-family: var(--serif);
  font-size: 72px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -1.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.summary-number.is-positive { color: var(--green); }
.summary-number.is-negative { color: var(--red); }
.summary-number-sm {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.summary-number-sm.is-positive { color: var(--green); }
.summary-number-sm.is-negative { color: var(--red); }
.summary-supporting {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}
.summary-supporting strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
/* Secondary band: framework baseline + "Total winners" side by side. */
.summary-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.summary-stat { min-width: 0; }
.summary-caveat {
  display: inline-block;
  margin-top: 3px;
  font-size: 12px;
  font-style: italic;
  color: var(--text-light);
}
.summary-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 22px 0 18px;
}
.summary-footnote {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 18px;
  font-style: italic;
  border-top: 1px dotted var(--border-soft);
  padding-top: 10px;
}

/* ===== GLANCE STRIP ===== */
.glance {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 32px;
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  background: var(--card);
  overflow: hidden;
}
.glance-item {
  flex: 1 1 0;
  min-width: 140px;
  padding: 12px 18px;
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.glance-item:last-child { border-right: none; }
.glance-label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.glance-value {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

/* ===== SECTION ===== */
.section { margin-bottom: 36px; }
.section-heading {
  font-family: var(--serif);
  font-size: 24px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.3px;
  border-bottom: 1px solid var(--gold-rule);
  padding-bottom: 6px;
  margin-bottom: 12px;
  display: block;
}
.section-standfirst {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
  max-width: 720px;
}
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.section-grid .col { min-width: 0; }

/* ===== CHART ===== */
.chart-wrap {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  padding: 18px;
  margin-bottom: 8px;
}
.chart-wrap canvas { max-height: 240px; }
.chart-wrap-primary { padding: 22px; }
.chart-wrap-primary canvas { max-height: 320px; }
.chart-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

/* ===== TABLES ===== */
.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 2px;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  background: transparent;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gold-rule);
  font-weight: 700;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.data-table th.num { text-align: right; }
.data-table td { padding: 10px 16px; border-bottom: 1px solid var(--border-soft); }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.data-table td.pos { color: var(--green); font-weight: 600; }
.data-table td.neg { color: var(--red); font-weight: 600; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--paper); }
.data-table td:first-child { font-weight: 500; color: var(--ink); }

/* ===== RULE CARDS ===== */
.rule-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--gold);
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: 0 2px 2px 0;
}
.rule-card .rule-tag {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--gold);
}
.rule-card .rule-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--ink);
  margin-top: 4px;
  line-height: 1.25;
}
.rule-card .rule-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.55;
}
.rule-card[data-status="downgraded"], .rule-card[data-status="cold-streak-resumed"] { border-left-color: var(--orange); }
.rule-card[data-status="downgraded"] .rule-tag, .rule-card[data-status="cold-streak-resumed"] .rule-tag { color: var(--orange); }
.rule-card[data-status="under-evaluation"] { border-left-color: var(--grey); }
.rule-card[data-status="under-evaluation"] .rule-tag { color: var(--grey); }
.rule-card[data-status="validated"] { border-left-color: var(--green); }
.rule-card[data-status="validated"] .rule-tag { color: var(--green); }

/* ===== PLAYBOOK PAGE CONTENT SLOTS ===== */
.content-slot {
  background: var(--grey-light);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px;
  color: var(--text-muted);
  font-size: 14px;
}
.content-slot.is-loaded { background: #fff; color: var(--text); padding: 0; border: none; }
.content-slot.is-loaded .page { max-width: none; padding: 0; }

/* ===== ARCHIVE LIST ===== */
.archive-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.archive-list a {
  display: inline-block;
  padding: 6px 12px;
  background: var(--green-light);
  color: var(--green);
  border: 1px solid var(--green-mid);
  border-radius: 3px;
  font-size: 13px;
  font-weight: 500;
}

/* ===== FOOTER ===== */
.footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 24px;
  font-size: 12px;
  color: var(--text-light);
  border-top: 1px solid var(--grey-mid);
}
.footer-disclaimer {
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 10px;
  line-height: 1.5;
}
.footer-disclaimer a { color: var(--text-muted); text-decoration: underline; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ===== CONTENT PLACEHOLDER ===== */
.placeholder-card {
  background: var(--gold-light);
  border: 1px dashed var(--gold);
  border-radius: 4px;
  padding: 24px;
  text-align: center;
}
.placeholder-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
}
.placeholder-title { font-size: 18px; margin-top: 4px; color: var(--text); }
.placeholder-text { font-size: 14px; color: var(--text-muted); margin-top: 8px; }

/* ===== INJECTED MARKDOWN-DERIVED CONTENT ===== */
.content-slot h1, .content-slot h2, .content-slot h3, .content-slot h4 {
  color: var(--green);
  margin: 18px 0 8px;
  font-weight: 600;
}
.content-slot h1 { font-size: 22px; }
.content-slot h2 { font-size: 18px; border-bottom: 2px solid var(--gold); padding-bottom: 4px; display: inline-block; }
.content-slot h3 { font-size: 16px; color: var(--text); }
.content-slot h4 { font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.content-slot p { margin: 8px 0; font-size: 14px; color: var(--text); line-height: 1.55; }
.content-slot ul, .content-slot ol { margin: 8px 0 12px 22px; }
.content-slot li { font-size: 14px; margin-bottom: 4px; }
.content-slot strong { color: var(--text); font-weight: 600; }
.content-slot hr { border: none; border-top: 1px solid var(--grey-mid); margin: 18px 0; }
.content-slot table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 10px 0 18px;
}
.content-slot table th {
  background: var(--grey-light);
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-muted);
}
.content-slot table td { padding: 6px 10px; border-bottom: 1px solid var(--grey-mid); }
.content-slot table td:first-child { font-weight: 500; }

/* ============================================================
   RESPONSIVE: phones <600px, tablets 600-900px
   ============================================================ */

/* Tablet */
@media (max-width: 900px) {
  .section-grid { grid-template-columns: 1fr; gap: 28px; }
  .masthead-inner { padding: 0 20px; }
  .page { padding: 20px; }
  .summary { padding: 24px 24px 20px; }
  .summary-number { font-size: 56px; }
}

/* Phone */
@media (max-width: 600px) {

  body { font-size: 14px; }

  .masthead { padding: 22px 0 18px; }
  .masthead-inner { flex-direction: row; align-items: center; gap: 14px; padding: 0 18px; }
  .masthead-logo { height: 52px; }
  .masthead-title { font-size: 28px; }
  .masthead-eyebrow { font-size: 10px; letter-spacing: 1.2px; }

  .tab-nav { display: flex; }
  .tab-link { flex: 1; text-align: center; padding: 12px 8px; font-size: 11px; letter-spacing: 1.2px; min-height: 44px; }

  .page { padding: 16px; }

  .summary { padding: 20px; }
  .summary-number { font-size: 44px; letter-spacing: -1px; }
  .summary-number-sm { font-size: 26px; }
  .summary-supporting { font-size: 13px; }
  .summary-divider { margin: 18px 0 14px; }
  .summary-secondary { grid-template-columns: 1fr; gap: 20px; }
  .summary-secondary .summary-stat + .summary-stat {
    border-top: 1px dotted var(--border-soft);
    padding-top: 16px;
  }

  .glance { flex-wrap: wrap; }
  .glance-item { flex: 1 1 50%; min-width: 0; border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
  .glance-item:nth-child(2n) { border-right: none; }
  .glance-item:nth-last-child(-n+2) { border-bottom: none; }

  .section-heading { font-size: 20px; }
  .section-standfirst { font-size: 14px; }

  /* Tables: compact cards per row */
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    background: var(--grey-light);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  .data-table td {
    border: none;
    padding: 3px 0;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
  }
  .data-table td:first-child {
    font-weight: 600;
    font-size: 15px;
    color: var(--green);
    padding-bottom: 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--grey-mid);
    display: block;
  }
  .data-table td.num::before {
    content: attr(data-label);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
  }

  .chart-wrap { padding: 10px; }
  .chart-wrap canvas { max-height: 200px; }

  .rule-card { padding: 10px 12px; }
  .rule-card .rule-title { font-size: 14px; }
  .rule-card .rule-note { font-size: 13px; }

  .archive-list a { padding: 8px 14px; font-size: 13px; min-height: 44px; display: inline-flex; align-items: center; }

  .footer { padding: 14px 16px; }
  .footer-bottom { flex-direction: column; gap: 4px; text-align: center; }
  .footer-disclaimer { font-size: 10px; }

  /* Playbook content: override fixed print widths */
  .content-slot.is-loaded .page,
  .content-slot.is-loaded > div[style*="max-width"] {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .content-slot { font-size: 13px; }
  .content-slot table { font-size: 12px; }

  .tips-pdf-frame iframe { height: 80vh; min-height: 480px; }
}

/* ===== TIPS PAGE ===== */
.tips-recent {
  background: var(--green-light);
  border: 1px solid var(--green-mid);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--green);
  margin-bottom: 12px;
  text-align: center;
}
.tips-recent strong { color: var(--green); }
.tips-status-strip {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 6px 9px;
  background: #fffdf8;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 13px;
  border-radius: 3px;
}
.tips-status-strip strong {
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 700;
}
.tips-howto {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}
.tips-pdf-frame {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--grey-light);
  overflow: hidden;
}
.tips-pdf-frame iframe {
  display: block;
  width: 100%;
  height: 1020px;
  border: 0;
  background: #fff;
}
.tips-fallback {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.tips-button {
  display: inline-block;
  background: var(--green);
  color: #fff !important;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none !important;
}
.tips-button:hover { background: var(--green-mid); }

/* ===== TIPS CARD (one-bet-per-race chronological) ===== */
.tips-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--paper);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.tips-venue-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 6px 0 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.tips-venue-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tips-venue-legend .chip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.tips-card-row {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--grey);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}

/* Venue left-border colours */
.tips-card-row[data-venue="randwick"]         { border-left-color: #0057B8; }
.tips-card-row[data-venue="rosehill"]         { border-left-color: #2563EB; }
.tips-card-row[data-venue="caulfield"]        { border-left-color: #B00020; }
.tips-card-row[data-venue="flemington"]       { border-left-color: #7B1FA2; }
.tips-card-row[data-venue="sandown-hillside"] { border-left-color: #111827; }
.tips-card-row[data-venue="eagle-farm"]       { border-left-color: #00A651; }
.tips-card-row[data-venue="doomben"]          { border-left-color: #F9A825; }
.tips-card-row[data-venue="gold-coast"]       { border-left-color: #FF6D00; }
.tips-card-row[data-venue="sunshine-coast"]   { border-left-color: #00A6D6; }
.tips-card-row[data-venue="scone"]            { border-left-color: #607D8B; }

.tips-venue-legend .chip[data-venue="randwick"]         { background: #0057B8; }
.tips-venue-legend .chip[data-venue="rosehill"]         { background: #2563EB; }
.tips-venue-legend .chip[data-venue="caulfield"]        { background: #B00020; }
.tips-venue-legend .chip[data-venue="flemington"]       { background: #7B1FA2; }
.tips-venue-legend .chip[data-venue="sandown-hillside"] { background: #111827; }
.tips-venue-legend .chip[data-venue="eagle-farm"]       { background: #00A651; }
.tips-venue-legend .chip[data-venue="doomben"]          { background: #F9A825; }
.tips-venue-legend .chip[data-venue="gold-coast"]       { background: #FF6D00; }
.tips-venue-legend .chip[data-venue="sunshine-coast"]   { background: #00A6D6; }
.tips-venue-legend .chip[data-venue="scone"]            { background: #607D8B; }

.tips-time {
  min-width: 88px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tips-time strong {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.5px;
}
.tips-time span {
  color: var(--text-muted);
  font-size: 12px;
}

.tips-pick {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.tips-saddle {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  min-width: 21px;
  text-align: center;
  background: var(--grey-light);
  padding: 1px 5px;
  border-radius: 3px;
}
.tips-horse {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.2px;
}
.tips-optional {
  color: var(--text-light);
  font-size: 12px;
  font-style: italic;
}

.tips-tier {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.tips-tier-bb    { background: #fff3e8; color: #a14d00; }
.tips-tier-tt    { background: #eef5f0; color: #1a5c3a; }
.tips-tier-saver { background: #faf3df; color: #8a6308; }

.tips-g1 {
  background: #fff3e8;
  color: #a14d00;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 2px;
}

.tips-price {
  font-family: var(--mono);
  color: var(--text-muted);
  min-width: 52px;
  text-align: right;
  font-size: 12px;
}

.tips-stake {
  min-width: 68px;
  text-align: right;
}
.tips-stake .amount {
  color: #3a3a3a;
  font-weight: 600;
  font-size: 13px;
}
.tips-stake .mode {
  font-size: 10px;
  letter-spacing: 0.5px;
}
.tips-stake .mode-win { color: var(--text-light); }
.tips-stake .mode-ew  { color: var(--green); font-weight: 700; }

.tips-result {
  font-family: var(--mono);
  font-weight: 700;
  min-width: 84px;
  text-align: right;
  font-size: 13px;
}
.tips-result-won  { color: var(--green); }
.tips-result-loss { color: var(--red); }
.tips-result-pending { color: var(--text-light); font-weight: 400; }

.tips-totals {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--gold-rule);
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.tips-totals .label { color: var(--text-muted); }
.tips-totals .amount {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 15px;
}
.tips-totals .amount.pos { color: var(--green); }
.tips-totals .amount.neg { color: var(--red); }

/* ── Two-pick head-to-head card (W24 trial onwards) ── */
.tips-race {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--grey);
  border-radius: 4px;
  padding: 7px 10px;
}
.tips-race[data-venue="randwick"]         { border-left-color: #0057B8; }
.tips-race[data-venue="rosehill"]         { border-left-color: #2563EB; }
.tips-race[data-venue="caulfield"]        { border-left-color: #B00020; }
.tips-race[data-venue="flemington"]       { border-left-color: #7B1FA2; }
.tips-race[data-venue="sandown-hillside"] { border-left-color: #111827; }
.tips-race[data-venue="sandown"]          { border-left-color: #111827; }
.tips-race[data-venue="newcastle"]        { border-left-color: #1565C0; }
.tips-venue-legend .chip[data-venue="sandown"] { background: #111827; }
.tips-venue-legend .chip[data-venue="newcastle"] { background: #1565C0; }
.tips-race[data-venue="eagle-farm"]       { border-left-color: #00A651; }
.tips-race[data-venue="doomben"]          { border-left-color: #F9A825; }
.tips-race[data-venue="gold-coast"]       { border-left-color: #FF6D00; }
.tips-race[data-venue="sunshine-coast"]   { border-left-color: #00A6D6; }
.tips-race[data-venue="scone"]            { border-left-color: #607D8B; }

.tips-race-hdr {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.tips-race-hdr strong {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.5px;
  text-transform: none;
}

.tips-pair {
  display: flex;
  gap: 7px;
}
.tips-pick-card {
  flex: 1;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 7px 9px;
}
/* The backed pick. No coloured outline (Sam, 29 Aug) - it is marked by the
   white card ground against the other pick's paper, and by the tick in its
   tier chip ("TOP TIP ✓"). Border stays the same neutral 1px as its pair so
   the two cards sit level. */
.tips-pick-card.is-bet {
  background: var(--card);
}
/* Winning selection — green highlight so wins stand out clearly. Placed after
   .is-bet so a winning bet reads as green (the win) rather than plain. */
.tips-pick-card.is-won {
  background: var(--green-light);
  border: 2px solid var(--green-mid);
  padding: 6px 8px; /* match .is-bet so heights stay aligned */
  box-shadow: 0 1px 3px rgba(45, 134, 83, 0.22);
}
.tips-pc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.tips-pick-card.is-solo .tips-pc-top { justify-content: flex-end; }
.tips-pc-price {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.tips-pc-horse {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}
.tips-pc-result {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}
.tips-pc-result.won  { color: var(--green); }
.tips-pc-result.loss { color: var(--text-light); }

/* ── Winner emphasis (added W31) ──────────────────────────────
   Three layers so a win is obvious at a glance, at three zoom levels:
   the winners strip (whole card), the race header chip (scanning the
   list), and the result badge (reading one race).                */

/* 1. Result badge on the winning selection — filled, not just coloured text */
.tips-pc-result.won {
  display: inline-block;
  background: var(--green-mid);
  color: #fff;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

/* 2. Race blocks that produced a winner — tinted so they stand out in the list.
      The venue colour keeps the left border; the green sits on the other three. */
.tips-race[data-won="1"] {
  background: var(--green-light);
  border-color: var(--green-mid);
  border-left-width: 4px;
}
.tips-hdr-won {
  margin-left: auto;
  background: var(--green-mid);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Compact race-day card (W39 draft): primary bet first, Saver as quiet second line */
.tips-card {
  gap: 6px;
  padding: 8px;
  background: var(--paper);
}
.tips-race {
  border-left-width: 7px;
  border-radius: 3px;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: 112px 1fr 70px;
  gap: 3px 10px;
  align-items: center;
  min-height: 54px;
}
.tips-sam-note {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.tips-personal-extra {
  margin: 12px 0 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.tips-race[data-won="1"] {
  background: var(--green-light);
  border-top-color: var(--green-mid);
  border-right-color: var(--green-mid);
  border-bottom-color: var(--green-mid);
}
.tips-race-hdr {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: block;
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}
.tips-race-hdr strong {
  display: block;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  color: #806019;
  margin-bottom: 5px;
}
.tips-race-hdr span:not(.tips-hdr-won) {
  display: block;
  font-weight: 800;
  color: var(--ink);
}
.tips-hdr-won {
  display: inline-block;
  margin: 4px 0 0;
  font-size: 9px;
  padding: 1px 5px;
}
.tips-pair {
  grid-column: 2 / 4;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tips-pick-card,
.tips-pick-card.is-bet,
.tips-pick-card.is-won,
.tips-pick-card.is-solo {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}
.tips-pick-card.is-bet,
.tips-pick-card.is-solo {
  order: 0;
  display: grid;
  grid-template-columns: 1fr 70px;
  gap: 8px;
  align-items: baseline;
}
.tips-pick-card:not(.is-bet):not(.is-solo) {
  order: 1;
  display: grid;
  grid-template-columns: auto 1fr 70px;
  gap: 7px;
  align-items: baseline;
  color: var(--text-muted);
  font-size: 12px;
  min-width: 0;
}
.tips-pc-top { display: contents; }
.tips-pick-card.is-bet .tips-tier,
.tips-pick-card.is-solo .tips-tier { display: none; }
.tips-pick-card:not(.is-bet):not(.is-solo) .tips-tier {
  grid-column: 1;
  grid-row: 1;
  align-self: baseline;
  background: transparent;
  color: var(--text-muted);
  padding: 0;
  font-size: 10px;
  letter-spacing: 0.05em;
}
.tips-pc-horse {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
  min-width: 0;
}
.tips-pick-card.is-bet .tips-pc-horse,
.tips-pick-card.is-solo .tips-pc-horse {
  grid-column: 1;
  grid-row: 1;
}
.tips-pick-card:not(.is-bet):not(.is-solo) .tips-pc-horse {
  grid-column: 2;
  grid-row: 1;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tips-pc-price {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 800;
  color: var(--green);
  text-align: right;
}
.tips-pick-card.is-bet .tips-pc-price,
.tips-pick-card.is-solo .tips-pc-price {
  grid-column: 2;
  grid-row: 1;
}
.tips-pick-card:not(.is-bet):not(.is-solo) .tips-pc-price {
  grid-column: 3;
  grid-row: 1;
  font-size: 12px;
  color: #4b5563;
}
.tips-saddle {
  font-size: 12px;
  min-width: 0;
  padding: 0 4px;
  border-radius: 2px;
}
.tips-pick-card.is-bet .tips-saddle,
.tips-pick-card.is-solo .tips-saddle { font-size: 13px; }
.tips-pc-result {
  margin: 0;
  font-size: 12px;
  text-align: right;
  font-family: var(--mono);
  font-weight: 700;
}
/* Post-race: replace the price with the result, rather than showing both. */
.tips-pick-card:has(.tips-pc-result) .tips-pc-price { display: none; }
.tips-pick-card.is-bet .tips-pc-result,
.tips-pick-card.is-solo .tips-pc-result {
  grid-column: 2;
  grid-row: 1;
  font-size: 14px;
}
.tips-pick-card:not(.is-bet):not(.is-solo) .tips-pc-result {
  grid-column: 3;
  grid-row: 1;
  font-size: 12px;
}
.tips-pc-result.won {
  background: transparent;
  color: var(--green);
  padding: 0;
  border-radius: 0;
}
.tips-pc-result.loss { color: var(--text-light); }
.tips-hdr-won { display: none; }
.tips-pick-card.is-won .tips-pc-horse { color: var(--green); }
.tips-pick-card:not(.is-bet):not(.is-solo).is-won .tips-pc-horse { color: var(--green); }

/* Side-by-side holds down to ~340px; below that, stack the pair */
@media (max-width: 340px) {
  .tips-pair { flex-direction: column; }
}

/* Mobile collapse — single-line row per race (time | pick | result) */
@media (max-width: 640px) {
  .tips-card-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0 10px;
    padding: 7px 11px;
  }
  .tips-card-row .tips-price,
  .tips-card-row .tips-stake {
    display: none;
  }
  /* Left: time stacked over race label (venue colour = left border) */
  .tips-time {
    grid-column: 1;
    min-width: 0;
  }
  .tips-time strong { font-size: 14px; }
  .tips-time span { font-size: 11px; white-space: nowrap; }
  /* Middle: saddle + horse + tier on one line; horse name truncates */
  .tips-pick {
    grid-column: 2;
    flex-wrap: nowrap;
    align-items: center;
    gap: 7px;
    min-width: 0;
    overflow: hidden;
  }
  .tips-horse {
    font-size: 14px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tips-saddle { font-size: 12px; min-width: 19px; flex: none; }
  .tips-tier { font-size: 9px; padding: 2px 5px; flex: none; }
  .tips-optional { flex: none; }
  /* Right: result */
  .tips-result {
    grid-column: 3;
    min-width: 0;
    font-size: 13px;
    white-space: nowrap;
  }
  .tips-card { padding: 9px; gap: 4px; }
  .tips-race {
    grid-template-columns: 1fr 64px;
    gap: 3px 8px;
    padding: 7px 9px;
  }
  .tips-race-hdr {
    grid-column: 1 / -1;
    grid-row: auto;
    margin-bottom: 1px;
    font-size: 12px;
  }
  .tips-pair {
    grid-column: 1 / -1;
    grid-row: auto;
  }
  .tips-pick-card.is-bet,
  .tips-pick-card.is-solo {
    grid-template-columns: 1fr 64px;
  }
  .tips-pick-card:not(.is-bet):not(.is-solo) {
    grid-template-columns: auto 1fr 64px;
  }
  .tips-pc-horse { font-size: 14px; }
  .tips-pc-price { font-size: 15px; }
  .tips-pick-card:not(.is-bet):not(.is-solo) .tips-pc-price { font-size: 12px; }
  .tips-totals {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* Fictional venue used only by the private test fixture. */
.tips-race[data-venue="example-park"]{border-left-color:#1a5c3a}
.tips-venue-legend .chip[data-venue="example-park"]{background:#1a5c3a}
.tips-demo-note{padding:12px 14px;border:1px solid var(--border);background:var(--gold-light);color:#5b481b;margin:12px 0}
.tips-download{display:inline-block;padding:10px 14px;border:1px solid var(--green);border-radius:4px;font-weight:600;margin-top:16px}