/* ════════════════════════════════════════════════════════════════
   racecard.css — self-contained runner-list component.

   Architecture:
     • Pure CSS Grid — every runner is a single <div role="row"> with
       grid-template-columns matching the column header strip. The AI
       blurb wraps to its own grid line via grid-column: 1 / -1, no
       <table> + colspan + spacer-row hacks.
     • BEM — every class is .racecard or .racecard__<element>.
       Zero shared names with grand_national.css; zero collision.
     • Defensive cascade reset — `revert-layer` on the inheritable
       properties at the .racecard scope so any sibling stylesheet
       leaking into our DOM gets ignored.
═══════════════════════════════════════════════════════════════════ */

/* Defensive reset — only the properties most likely to leak from
   legacy stylesheets. Layout/box-model props are explicit per-rule. */
.racecard,
.racecard *,
.racecard-guest-bar,
.racecard-guest-bar * {
  background: revert-layer;
  color: revert-layer;
  font: revert-layer;
}

.racecard {
  /* ── Local palette (paper theme) ────────────────────────────── */
  --rc-paper:        #FAFAF7;
  --rc-card:         #FFFFFF;
  --rc-card-warm:    #F7F5EE;
  --rc-row-hover:    #F4F2EA;
  --rc-ink:          #11151F;
  --rc-ink-70:       #41474F;
  --rc-ink-40:       #9CA3AF;
  --rc-rule:         #E7E5DD;
  --rc-rule-strong:  #D6D2C5;
  --rc-gold-ink:     #9C7B12;
  --rc-gold-bright:  #D4AF37;
  --rc-gold-wash:    #FAF1D7;
  --rc-red:          #C0392B;
  --rc-emerald:      #1A7D4A;
  --rc-emerald-soft: rgba(26, 125, 74, 0.08);

  background: var(--rc-paper);
  color: var(--rc-ink);
  padding: 36px clamp(16px, 4vw, 32px) 56px;
  border-top: 1px solid rgba(212, 175, 55, 0.35);
  /* The 1px gold border-top above is enough to separate the cream
     paper from the dark hero — a soft inset shadow on top of that
     just leaked grey smudges around the inside edges. Removed. */
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
  font-size: 13.5px;
  line-height: 1.5;
}

.racecard *,
.racecard *::before,
.racecard *::after {
  box-sizing: border-box;
}

/* ════════════════════════════════════════════════════════════════
   HEADER MASTHEAD — eyebrow / title / hero-pick / stat pills /
   voting status / sort hint. Newspaper-spread feel with gold accents.
═══════════════════════════════════════════════════════════════════ */

/* ── RACECARD STATUS STRIP ────────────────────────────────────────
   Single-row compact band replacing the old multi-row header. Carries
   state pill + inline metrics + AI quick-glance + last-updated chip +
   compact sort affordance. Sits on the cream paper, ~44px tall.

   Visual register matches the .race-toolbar above — utility surface,
   not editorial. The hero now owns identity; this band owns *state*. */
.racecard__strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  padding: 10px 14px;
  margin-bottom: 18px;
  background: var(--rc-card);
  border: 1px solid var(--rc-rule);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  font-size: 12.5px;
  color: var(--rc-ink-70);
}

/* State pill — single source of truth for race lifecycle. */
.racecard__strip-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.racecard__strip-state-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Open — emerald pulse. */
.racecard__strip--open .racecard__strip-state {
  background: rgba(26, 125, 74, 0.10);
  border: 1px solid rgba(26, 125, 74, 0.35);
  color: var(--rc-emerald);
}
.racecard__strip--open .racecard__strip-state-dot {
  background: var(--rc-emerald);
  box-shadow: 0 0 0 0 rgba(26, 125, 74, 0.55);
  animation: rc-strip-pulse 1.6s ease-out infinite;
}
@keyframes rc-strip-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(26, 125, 74, 0.55); }
  50%     { box-shadow: 0 0 0 6px rgba(26, 125, 74, 0); }
}

/* Closed — amber, no pulse. */
.racecard__strip--closed .racecard__strip-state {
  background: rgba(196, 106, 26, 0.08);
  border: 1px solid rgba(196, 106, 26, 0.35);
  color: #c46a1a;
}
.racecard__strip--closed .racecard__strip-state-dot { background: #c46a1a; }

/* Settled — gold (race ran, result in). */
.racecard__strip--settled .racecard__strip-state {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.16), rgba(212, 175, 55, 0.06));
  border: 1px solid rgba(156, 123, 18, 0.45);
  color: var(--rc-gold-ink);
}
.racecard__strip--settled .racecard__strip-state-dot { background: var(--rc-gold-ink); }

/* Abandoned — slate, dimmed. */
.racecard__strip--abandoned .racecard__strip-state {
  background: rgba(108, 117, 125, 0.10);
  border: 1px solid rgba(108, 117, 125, 0.35);
  color: #6c757d;
}
.racecard__strip--abandoned .racecard__strip-state-dot { background: #6c757d; }
.racecard__strip--abandoned { opacity: 0.85; }

/* Inline metric chips — flat text, no boxed tiles. */
.racecard__strip-metrics {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 18px;
  align-items: center;
}
.racecard__strip-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}
.racecard__strip-metric strong {
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  color: var(--rc-ink);
  font-variant-numeric: tabular-nums;
}
.racecard__strip-metric-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rc-ink-40);
}
.racecard__strip-metric--alert strong { color: var(--rc-red); }

/* AI quick-glance — small inline marker, sits between metrics and
   right-cluster. Reads as a calm informational chip, not a CTA. */
.racecard__strip-ai {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  background: linear-gradient(135deg, var(--rc-gold-wash), var(--rc-card) 80%);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 6px;
  font-size: 11.5px;
  white-space: nowrap;
}
.racecard__strip-ai-bolt {
  color: var(--rc-gold-ink);
  font-size: 12px;
  align-self: center;
}
.racecard__strip-ai-eyebrow {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rc-gold-ink);
}
.racecard__strip-ai-name {
  font-weight: 800;
  color: var(--rc-ink);
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  font-size: 13px;
  letter-spacing: -0.005em;
}
.racecard__strip-ai-conf {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--rc-ink-40);
  padding-left: 5px;
  border-left: 1px solid rgba(212, 175, 55, 0.35);
  margin-left: 2px;
}

/* Spacer — flex auto-grow pushes everything below toward the right edge. */
.racecard__strip-spacer { flex: 1; }

/* Guest CTA — only renders when not authenticated AND voting open. */
.racecard__strip-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: rgba(26, 125, 74, 0.10);
  border: 1px solid rgba(26, 125, 74, 0.40);
  border-radius: 6px;
  color: var(--rc-emerald);
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: background 0.15s, transform 0.12s;
}
.racecard__strip-cta:hover {
  background: rgba(26, 125, 74, 0.18);
  transform: translateY(-1px);
}

/* Last-updated chip — quiet, italic, low contrast. Tooltip carries
   the precise timestamp on hover. */
.racecard__strip-updated {
  font-size: 11px;
  font-style: italic;
  color: var(--rc-ink-40);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Sort tool — compact icon-button with tooltip on hover. The full
   sort hint moves to the title attribute; no more long instructional
   sentence eating vertical space. */
.racecard__strip-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--rc-rule-strong);
  border-radius: 6px;
  color: var(--rc-ink-70);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: help;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.racecard__strip-tool:hover {
  background: var(--rc-gold-wash);
  border-color: var(--rc-gold-bright);
  color: var(--rc-gold-ink);
}
.racecard__strip-tool-icon { font-size: 13px; }

/* Mobile — let the strip wrap if needed, tighten spacing. */
@media (max-width: 640px) {
  .racecard__strip {
    gap: 10px;
    padding: 8px 10px;
  }
  .racecard__strip-metrics { gap: 12px; }
  .racecard__strip-updated { display: none; }
}

/* Anchor-scroll offset — when the user clicks the hero pick the
   runner card scrolls into view; nudge it down so the card isn't
   flush with the top of the viewport. */
.racecard__runner { scroll-margin-top: 80px; }

/* ── Filter chips ────────────────────────────────────────────── */
.racecard__filters {
  display: flex;
  gap: 6px;
  margin: 0 0 18px;
  padding: 0 0 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--rc-rule);
}
.racecard__filter {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--rc-ink-70);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.racecard__filter:hover { color: var(--rc-ink); }
.racecard__filter.is-active {
  color: var(--rc-ink);
  border-bottom-color: var(--rc-gold-bright);
}

/* ════════════════════════════════════════════════════════════════
   GRID — column widths shared by header strip + every runner row.
   The CSS custom property is the single source of truth: change it
   here and headers + cells move together, no <colgroup> needed.
═══════════════════════════════════════════════════════════════════ */

/* Column order narrates the punter's read:
     identity → form → connections → ratings → context → engagement → action
   See _racecard_columns.html for the matching header order.

   Spacing strategy:
     - Every visible column is capped (minmax X→Y) so the row doesn't
       have a single column gobbling slack on wide viewports.
     - A trailing 1fr "spacer" slot sits at the end and silently
       absorbs any remaining horizontal space — keeps PICK in its
       expected cluster without empty gaps appearing mid-row.
     - The spacer is an empty grid track; no cells are routed to it,
       so it renders invisibly. */
.racecard__grid {
  --rc-cols:
       40px                       /* number  */
       48px                       /* silk    — fits the 'md' silk badge */
       minmax(200px, 300px)       /* horse   — capped */
       150px                      /* form    — fits 6 of the 22px chip pills */
       minmax(190px, 260px)       /* conn    — capped; was 1fr (gobbled row) */
       60px                       /* or      — BHA Official Rating */
       60px                       /* sr      — Saturday Rating */
       64px                       /* rpr     */
       56px                       /* age     */
       72px                       /* wgt     */
       104px                      /* ai      */
       72px                       /* votes   */
       92px                       /* odds    — fits price-trail pill */
       92px                       /* pick    */
       minmax(220px, 1fr);        /* comment — uses the trailing slack
                                      to render the Racing API spotlight
                                      inline, with line-clamp + tooltip */
}

.racecard--no-pick .racecard__grid {
  --rc-cols:
       40px
       48px                       /* silk    */
       minmax(200px, 300px)       /* horse   */
       150px                      /* form    */
       minmax(190px, 260px)       /* conn    */
       60px                       /* or      */
       60px                       /* sr      */
       64px                       /* rpr     */
       56px                       /* age     */
       72px                       /* wgt     */
       104px                      /* ai      */
       72px                       /* votes   */
       92px                       /* odds    */
       minmax(220px, 1fr);        /* comment */
}

/* Hide-column variants — set --rc-cols to a track count matching what's
   actually rendered and `display: none` on the matching cells. The
   meeting-full page uses these to suppress votes (no race-level voting
   context) + ai (often empty across many races at once). */
.racecard--no-votes .racecard__col--votes,
.racecard--no-votes .racecard__cell--votes { display: none; }
.racecard--no-ai    .racecard__col--ai,
.racecard--no-ai    .racecard__cell--ai    { display: none; }
.racecard--no-rpr   .racecard__col--rpr,
.racecard--no-rpr   .racecard__cell--rpr   { display: none; }
.racecard--no-or    .racecard__col--or,
.racecard--no-or    .racecard__cell--or    { display: none; }

/* Slip-mode column variants — slimmer than the racecard-page defaults
   so the runner row actually fits inside the .mf-races column when
   the bet slip is taking 320px on the right. Classes stack, so order
   goes most specific → least. */

/* meeting-full default: no votes, no AI, no RPR (11 cells incl. OR +
   trailing spacer). Order mirrors the default racecard. */
.racecard--no-votes.racecard--no-ai.racecard--no-rpr.racecard--slip .racecard__grid {
  --rc-cols:
       34px                      /* number */
       44px                      /* silk   — bumped from 30 for legibility */
       minmax(160px, 240px)      /* horse  — capped */
       124px                     /* form   — fits slip-mode 18px chips */
       minmax(170px, 230px)      /* conn   — capped; was 1fr (gobbled row) */
       46px                      /* or     */
       46px                      /* sr     */
       40px                      /* age    */
       56px                      /* wgt    */
       76px                      /* odds   — fits compact trail pill */
       40px                      /* slip + */
       1fr;                      /* spacer — slip-mode keeps blurb-below */
}

/* meeting-full + RPR shown */
.racecard--no-votes.racecard--no-ai.racecard--slip .racecard__grid {
  --rc-cols:
       34px
       44px                      /* silk   */
       minmax(160px, 240px)      /* horse  */
       124px                     /* form   */
       minmax(170px, 230px)      /* conn   */
       46px                      /* or     */
       46px                      /* sr     */
       50px                      /* rpr    */
       40px                      /* age    */
       56px                      /* wgt    */
       76px                      /* odds   */
       40px                      /* slip + */
       1fr;                      /* spacer */
}

/* Slip-mode runner rows sit inside .mf-race already; trim cell padding
   + the racecard's outer padding so the runners are visually flush
   with the race header. .mf-race owns the spacing. */
.racecard--slip {
  padding: 0;
  border-top: 0;
  box-shadow: none;
}
.racecard--slip .racecard__grid { gap: 0; }
.racecard--slip .racecard__runners { gap: 4px; padding-top: 4px; }
.racecard--slip .racecard__runner {
  padding: 8px 10px;
  gap: 4px 8px;
  font-size: 12.5px;
  border-radius: 6px;
  box-shadow: none;
  border-color: var(--rc-rule);
}
.racecard--slip .racecard__columns {
  padding: 10px 10px 8px;
  gap: 0 8px;
  font-size: 11px;
  letter-spacing: 0.06em;        /* tighter than the default 0.08em */
  /* Slip rows sit inside .mf-race, which already paints its own warm
     surface — drop the column-strip background so the masthead reads
     as part of the meeting card rather than a separate band. */
  background: transparent;
  border-top: none;
}
.racecard--slip .racecard__col[aria-sort="ascending"]::after,
.racecard--slip .racecard__col[aria-sort="descending"]::after {
  bottom: -9px;                  /* sit inside the slip-mode 8px bottom padding */
}
.racecard--slip .racecard__name {
  font-size: 16px;                /* bumped from 13.5 for /full/ legibility */
  letter-spacing: -0.005em;
}
.racecard--slip .racecard__number { font-size: 17px; }
/* Silk grew from 24×28 to 34×38 — still smaller than the default-racecard
   md (36×42) so the slip-mode row stays compact, but visibly larger than
   before. Sits inside the new 44px silk column with 5px gutter each side. */
.racecard--slip .racecard__silk--sm { width: 34px; height: 38px; }
.racecard--slip .racecard__sr {
  min-width: 30px;
  padding: 1px 5px;
  font-size: 11.5px;
}
/* Slip-mode form pills are a touch more compact than the default
   racecard's 22x22 — they still need to read clearly, but the slip
   row carries less horizontal budget. */
.racecard--slip .racecard__form .rcf {
  min-width: 18px;
  height: 18px;
  font-size: 11.5px;
  padding: 0 4px;
  margin-right: 2px;
  border-radius: 3px;
}
.racecard--slip .racecard__form .rcf--sep {
  width: 6px;
  height: 18px;
  line-height: 18px;
}
.racecard--slip .racecard__jockey  { font-size: 14px; }      /* was 12 */
.racecard--slip .racecard__trainer { font-size: 12.5px; }    /* was 11 */
/* Slip mode shrinks the badge to 36px — the meeting-full view shows
   many runners across multiple meetings, so the avatar-scale badge
   would push row counts too high. */
.racecard--slip .racecard__odds {
  font-size: 11.5px;
  box-shadow: none;
  animation: none;
}
.racecard--slip .racecard__odds--round {
  width: 36px;
  height: 36px;
}
.racecard--slip .racecard__odds--capsule {
  height: 36px;
  min-width: 42px;
  padding: 0 10px;
}
.racecard--slip .racecard__odds--fav {
  /* Keep the gold fill but no pulse in the dense slip view. */
  animation: none;
}
.racecard--slip .racecard__slip-btn {
  width: 32px;
  height: 32px;
  font-size: 18px;
}

/* Slip-mode runner — visual cue that a click adds to the slip rather
   than voting. Subtle: the row picks up a slip-pointer cursor on hover. */
.racecard--slip .racecard__runner { cursor: default; }
.racecard__runner--unpriced { opacity: 0.55; }
.racecard__runner--in-slip {
  background: var(--rc-emerald-soft);
  border-color: rgba(26, 125, 74, 0.45);
  border-left-color: var(--rc-emerald);
}

/* +/✓ slip toggle button — replaces the Pick CTA in slip-mode rows. */
.racecard__slip-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.10);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 6px;
  color: var(--rc-gold-ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s, transform 0.08s, color 0.12s;
}
.racecard__slip-btn:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.22);
  border-color: var(--rc-gold-bright);
  transform: translateY(-1px);
}
.racecard__slip-btn:active { transform: translateY(0); }
/* Unpriced state — the button stays clickable (bet_slip.js accepts the
   leg as "awaiting price"), but visually muted so the punter knows
   the cumulative will defer. */
.racecard__slip-btn--unpriced {
  opacity: 0.55;
  border-style: dashed;
}
.racecard__slip-btn--unpriced:hover {
  opacity: 1;
  border-style: solid;
}
.racecard__slip-btn-tick { display: none; }
.racecard__runner--in-slip .racecard__slip-btn {
  background: rgba(26, 125, 74, 0.22);
  border-color: var(--rc-emerald);
  color: var(--rc-emerald);
}
.racecard__runner--in-slip .racecard__slip-btn-plus { display: none; }
.racecard__runner--in-slip .racecard__slip-btn-tick { display: inline; }

/* ── Column header strip ─────────────────────────────────────── */
/* ── Column header strip — magazine-style masthead ─────────────
 * Sits above the runner rows and reads as the "table header" without
 * us paying the cost of a real <thead>. The strip carries:
 *   - a warm paper wash so it visually separates from the runner band
 *   - a top + bottom hairline rule for newspaper-table feel
 *   - tighter, bolder, darker type than the previous wash-out grey
 *   - a slim 2px gold underline below the active-sort column
 */
.racecard__columns {
  display: grid;
  grid-template-columns: var(--rc-cols);
  gap: 0 12px;
  padding: 14px 18px 12px;
  background: var(--rc-card-warm);
  border-top:    1px solid var(--rc-rule);
  border-bottom: 1px solid var(--rc-rule-strong);
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--rc-ink-70);
  position: relative;
}
.racecard__col {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;     /* anchors the active-sort underline */
  padding-bottom: 2px;    /* gives the underline a touch of breath */
}
.racecard__col[data-sortable] {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.racecard__col[data-sortable]:hover { color: var(--rc-ink); }
.racecard__col[aria-sort="ascending"],
.racecard__col[aria-sort="descending"] {
  color: var(--rc-ink);
  font-weight: 900;
}
.racecard__col[aria-sort="ascending"]::after,
.racecard__col[aria-sort="descending"]::after {
  /* Slim gold underline that ties the active-sort column visually
     to the gold sort glyph next to its label. */
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -13px;          /* sits inside the padding-bottom of the strip */
  height: 2px;
  background: var(--rc-gold-ink);
  border-radius: 1px;
}
.racecard__col-icon {
  font-size: 9px;
  color: var(--rc-ink-40);
  transition: color 0.15s;
  /* Render a default ascending/descending neutral diamond so sortable
     columns telegraph they're sortable, not just hoverable. */
}
.racecard__col[data-sortable] .racecard__col-icon::before { content: '◇'; }
.racecard__col[data-sortable]:hover .racecard__col-icon { color: var(--rc-ink-70); }
.racecard__col[aria-sort="ascending"]  .racecard__col-icon,
.racecard__col[aria-sort="descending"] .racecard__col-icon { color: var(--rc-gold-ink); }
.racecard__col[aria-sort="ascending"]  .racecard__col-icon::before  { content: '▲'; }
.racecard__col[aria-sort="descending"] .racecard__col-icon::before  { content: '▼'; }
.racecard__col[aria-sort="ascending"]  .racecard__col-icon,
.racecard__col[aria-sort="descending"] .racecard__col-icon { font-size: 0; }
.racecard__col[aria-sort="ascending"]  .racecard__col-icon::before,
.racecard__col[aria-sort="descending"] .racecard__col-icon::before { font-size: 10px; }

/* ── Inline help badge on sortable column headers ───────────
 * Used on the SR column (and reusable for OR / RPR / AI etc.)
 * to surface an in-row link to /sr-rating/ without breaking the
 * column's existing sort affordance. Click is excluded from the
 * sort handler via data-noclickthrough on the anchor. */
.racecard__col-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border-radius: 50%;
  background: rgba(212,175,55,0.12);
  border: 1px solid rgba(212,175,55,0.45);
  color: var(--rc-gold-ink);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: help;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.racecard__col-help:hover {
  background: rgba(212,175,55,0.30);
  border-color: var(--rc-gold-ink);
  transform: scale(1.15);
}
.racecard__col-help:focus-visible {
  outline: 2px solid var(--rc-gold-ink);
  outline-offset: 1px;
}

.racecard__col--age,
.racecard__col--wgt,
.racecard__col--or,
.racecard__col--sr,
.racecard__col--rpr,
.racecard__col--ai,
.racecard__col--votes,
.racecard__col--odds,
.racecard__col--pick { justify-content: center; }

/* ── Runner row ──────────────────────────────────────────────── */
.racecard__runners { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }

.racecard__runner {
  display: grid;
  grid-template-columns: var(--rc-cols);
  gap: 4px 12px;
  padding: 12px 18px;
  background: var(--rc-card);
  border: 1px solid var(--rc-rule);
  border-left: 3px solid transparent;
  border-radius: 10px;
  position: relative;
  align-items: center;
  transition: border-color 0.15s, box-shadow 0.18s, transform 0.12s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.racecard__runner:hover {
  border-color: var(--rc-rule-strong);
  border-left-color: var(--rc-gold-bright);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.racecard__runner.is-hidden { display: none; }

/* State variants */
.racecard__runner--featured {
  background: var(--rc-gold-wash);
  border-color: var(--rc-gold-bright);
  border-left-color: var(--rc-gold-bright);
}
.racecard__runner--leader { border-left-color: var(--rc-emerald); }
.racecard__runner--voted {
  background: var(--rc-emerald-soft);
  border-left-color: var(--rc-emerald);
}
.racecard__runner--guest-pick {
  background: var(--rc-gold-wash);
  border-left-color: var(--rc-gold-bright);
}
.racecard__runner--7day {
  border-left-style: dashed;
  border-left-color: var(--rc-rule-strong);
}
.racecard__runner--nr {
  background: var(--rc-card-warm);
  color: var(--rc-ink-40);
}
.racecard__runner--nr .racecard__name {
  color: var(--rc-ink-40);
  text-decoration: line-through;
  text-decoration-color: var(--rc-red);
  text-decoration-thickness: 1.5px;
}
.racecard__runner--nr .racecard__sr,
.racecard__runner--nr .racecard__rpr,
.racecard__runner--nr .racecard__form,
.racecard__runner--nr .racecard__odds,
.racecard__runner--nr .racecard__jockey,
.racecard__runner--nr .racecard__trainer { opacity: 0.7; }

/* ── Cell internals ──────────────────────────────────────────── */
.racecard__cell { min-width: 0; }
.racecard__cell--age,
.racecard__cell--wgt,
.racecard__cell--or,
.racecard__cell--sr,
.racecard__cell--rpr,
.racecard__cell--ai,
.racecard__cell--votes,
.racecard__cell--odds,
.racecard__cell--pick { text-align: center; }

.racecard__cell--age,
.racecard__cell--wgt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--rc-ink-70);
  font-size: 13.5px;
}

.racecard__name {
  font-size: 17px;
  font-weight: 700;
  color: var(--rc-ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;       /* tightens the bigger size visually */
}
a.racecard__name:hover { border-bottom-color: var(--rc-gold-ink); }
.racecard__name-tags {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 7px;
  vertical-align: middle;
}
.racecard__name-meta {
  font-size: 11.5px;
  color: var(--rc-ink-40);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  display: none;        /* visible on mobile only */
}

.racecard__sr {
  display: inline-block;
  min-width: 36px;
  padding: 2px 7px;
  background: var(--rc-card);
  border: 1px solid var(--rc-rule-strong);
  border-radius: 4px;
  color: var(--rc-ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}
.racecard__sr--empty { color: var(--rc-ink-40); }

.racecard__form {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--rc-ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Connection block — jockey leads, trainer reads as the supporting
   cast. Body sans-serif at this size scans cleaner than the display
   serif (which gets awkward on one-word names at 14px). Weight
   contrast does the hierarchical work: jockey 700, trainer 500
   italic. Each row is a flex grid so the win-rate chip can right-
   align via margin-left: auto without floating. */
.racecard__cell--conn {
  text-align: left;
  padding-left: 4px;
}
.racecard__jockey,
.racecard__trainer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
  font-feature-settings: 'tnum';
  white-space: nowrap;
  min-width: 0;
}
.racecard__jockey {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--rc-ink);
  line-height: 1.25;
  letter-spacing: -0.005em;
}
.racecard__trainer {
  font-size: 11.5px;
  font-style: italic;
  font-weight: 500;
  color: var(--rc-ink-70);
  line-height: 1.3;
  margin-top: 2px;
  letter-spacing: 0.005em;
}

/* Name + rate sit shoulder-to-shoulder with the flex parent's `gap`
   providing the breathing space — no `margin-left: auto` push to the
   right edge, so the chip stays visually attached to the connection
   it describes rather than floating off in the empty column. Name
   uses `flex: 0 1 auto` (don't grow, allow shrink + truncate). */
.racecard__jockey-name,
.racecard__trainer-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Symmetrical letter badges — J for jockey, T for trainer. Same chip
   chrome as the existing T glyph; the J row was previously prefix-less
   and read inconsistently against the trainer line. */
.racecard__jockey::before,
.racecard__trainer::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--rc-card-warm);
  color: var(--rc-ink-40);
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0;
  flex-shrink: 0;
}
.racecard__jockey::before  { content: 'J'; }
.racecard__trainer::before { content: 'T'; }

/* ── Win-rate chip — career % beside jockey / trainer name ──
 * Modern "data-tag" style: tight 4px-radius rectangle, bold tabular
 * digits, solid fills for the tiers that earn attention (hot + warm)
 * so punters' peripheral vision picks them out across the column.
 * Subtle treatment for neutral / cold so they recede.
 *
 * Sample-size context lives in the title tooltip; the chip itself
 * carries the headline % only.
 */
.rc-rate {
  display: inline-flex;
  align-items: baseline;
  padding: 3px 7px 3px;
  border-radius: 4px;
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
  font-style: normal;            /* override the trainer row's italic */
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  letter-spacing: -0.01em;
  line-height: 1.05;
  white-space: nowrap;
  cursor: help;
  background: transparent;
  border: 1px solid transparent;
  flex-shrink: 0;
  /* No `margin-left: auto` — the chip sits next to the name via the
     parent flex `gap` (see .racecard__jockey / .racecard__trainer). */
}
.rc-rate__dot {
  /* The solid pill fills are the heat signal — no separate dot needed. */
  display: none;
}
.rc-rate__num small {
  font-size: 8.5px;
  font-weight: 700;
  margin-left: 1px;
  opacity: 0.75;
}

/* ── Heat tiers ──────────────────────────────────────────────
 * Hot + warm fill solid so they read as "look here" badges.
 * Neutral + cold use a subtle card-warm surface so they support
 * without competing for attention. Values mirror
 * connections/templatetags/connections_links.py.
 */
.rc-rate--hot {
  background: var(--rc-emerald, #1A7D4A);
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(26, 125, 74, 0.30);
}
.rc-rate--warm {
  /* Gold-bright doesn't carry white reliably; pair with ink-on-gold. */
  background: var(--rc-gold-bright, #D4AF37);
  color: var(--rc-ink, #11151F);
  box-shadow: 0 1px 3px rgba(212, 175, 55, 0.30);
}
.rc-rate--neutral {
  color: var(--rc-ink, #11151F);
  background: var(--rc-card-warm);
  border-color: var(--rc-rule-strong);
}
.rc-rate--cold {
  color: var(--rc-ink-40, #9CA3AF);
  background: transparent;
  border-color: var(--rc-rule);
}

/* Slip-mode tightens to fit the 150px conn column on /full/. */
.racecard--slip .rc-rate {
  padding: 2px 6px;
  font-size: 10.5px;
  border-radius: 3px;
}
.racecard--slip .rc-rate__num small { font-size: 8px; }

/* Inner <a class="connection-link"> renders blue by default because no
   CSS targets it. Force it to inherit the parent racecard typography
   colour + family so the visual treatment we wrote above actually shows
   on screen. Hover hints clickability without underlining (which clutters
   a dense racecard). */
.racecard__jockey  .connection-link,
.racecard__trainer .connection-link {
  color: inherit;
  font: inherit;
  text-decoration: none;
  transition: color 0.12s;
}
.racecard__jockey  .connection-link:hover,
.racecard__trainer .connection-link:hover {
  color: var(--rc-gold-ink);
}
.racecard__jockey  .connection-link:focus-visible,
.racecard__trainer .connection-link:focus-visible {
  color: var(--rc-gold-ink);
  outline: 2px solid var(--rc-gold-bright);
  outline-offset: 2px;
  border-radius: 2px;
}

.racecard__stars {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.racecard__stars-on  { color: var(--rc-gold-ink); }
.racecard__stars-off { color: var(--rc-rule-strong); }
.racecard__stars--pending { color: var(--rc-ink-40); }

.racecard__votes {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--rc-rule);
  color: var(--rc-ink-70);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.racecard__runner--leader .racecard__votes {
  background: var(--rc-emerald-soft);
  color: var(--rc-emerald);
  border: 1px solid rgba(26, 125, 74, 0.35);
}

/* ── ODDS BADGE — avatar-style ─────────────────────────────────
   Three tiers driven by market position:
     · standard — white card, gold-ink border
     · favourite — gold gradient, animated pulse halo
     · outsider — muted greys (≥ 33/1)
   Plus a winner tier when the race has settled (🏆 corner flag).

   Shape adapts to content length:
     ≤ 4 chars  → 48px circle (.racecard__odds--round)
     5+ chars   → capsule, 48px tall, auto-width  (.racecard__odds--capsule) */
.racecard__odds {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--rc-card);
  border: 1.5px solid var(--rc-gold-ink);
  color: var(--rc-ink);
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  letter-spacing: -0.01em;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.14s ease, box-shadow 0.18s ease;
}
.racecard__odds:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.16);
}

/* Shape variants. */
.racecard__odds--round {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}
.racecard__odds--capsule {
  height: 48px;
  min-width: 56px;
  padding: 0 14px;
  border-radius: 24px;
}

/* Tier: market favourite — gold-filled, pulsing halo. */
.racecard__odds--fav {
  background: linear-gradient(135deg, #f5d76e 0%, #c8a951 100%);
  border-color: var(--rc-gold-bright);
  border-width: 2px;
  color: #11151F;
  box-shadow: 0 3px 10px rgba(212, 175, 55, 0.28);
  animation: rc-fav-pulse 2.5s ease-in-out infinite;
}
@keyframes rc-fav-pulse {
  0%, 100% {
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.28),
                0 0 0 0 rgba(212, 175, 55, 0.45);
  }
  50% {
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.28),
                0 0 0 7px rgba(212, 175, 55, 0);
  }
}

/* Tier: outsider — muted, low contrast. Reads as "long shot" without
   being judgemental about it. */
.racecard__odds--outsider {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(17, 21, 31, 0.15);
  border-width: 1px;
  color: var(--rc-ink-40);
  font-weight: 700;
  box-shadow: none;
}
.racecard__odds--outsider:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Tier: winner — emerald border + trophy corner flag. Replaces the
   favourite styling post-settle, even on horses that started as fav. */
.racecard__odds--winner {
  background: linear-gradient(135deg,
              rgba(26, 125, 74, 0.16),
              rgba(26, 125, 74, 0.06));
  border-color: var(--rc-emerald);
  border-width: 2px;
  color: var(--rc-emerald);
  animation: none;
}
.racecard__odds-flag {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
  pointer-events: none;
}

/* Inner value span — keeps content above the corner-flag pseudo so
   stacking works regardless of fav/winner state. */
.racecard__odds-val {
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

/* Unpriced fallback — dashed border, muted text. Smaller than the
   priced badges to visually de-emphasise. */
.racecard__odds--unpriced {
  border: 1px dashed rgba(17, 21, 31, 0.20);
  background: transparent;
  color: var(--rc-ink-40);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  animation: none;
  box-shadow: none;
}

/* Honour reduced-motion: drop the fav pulse for users who opt out. */
@media (prefers-reduced-motion: reduce) {
  .racecard__odds--fav { animation: none; }
}

/* Pick button */
.racecard__pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--rc-ink);
  color: var(--rc-card);
  border: 1px solid var(--rc-ink);
  border-radius: 5px;
  padding: 7px 14px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s, box-shadow 0.18s;
  white-space: nowrap;
}
.racecard__pick:hover {
  background: #2a2f3d;
  box-shadow: 0 3px 10px rgba(17, 21, 31, 0.25);
  transform: translateY(-1px);
}
.racecard__pick:active { transform: translateY(0); }
.racecard__pick--active {
  background: var(--rc-emerald);
  border-color: var(--rc-emerald);
}
.racecard__pick--active:hover {
  background: #166841;
  box-shadow: 0 3px 10px rgba(26, 125, 74, 0.30);
}
.racecard__pick--guest.is-selected {
  background: var(--rc-gold-bright);
  border-color: var(--rc-gold-bright);
  color: #11151F;
}
.racecard__pick--block { width: 100%; padding: 12px; font-size: 13px; }

/* ── Vote score pill ─────────────────────────────────────────────
   Shown on the cub's picked runner once the race has settled.
   Spans full width below the data row via grid-column: 1/-1, sits
   alongside the AI blurb. Four states:
     • won       — gold gradient (the marquee state)
     • placed    — emerald (in the places paid)
     • unplaced  — muted grey (finished but outside the places)
     • pending   — dashed border, italic (between result + settle)
─────────────────────────────────────────────────────────────────── */
.vote-score-pill {
  grid-column: 1 / -1;
  margin: 6px 0 0 56px;            /* indent past silk + number to align under HORSE */
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.vote-score-pill__icon  { font-size: 14px; line-height: 1; }
.vote-score-pill__label { letter-spacing: 0.02em; }
.vote-score-pill__points {
  font-variant-numeric: tabular-nums;
  padding-left: 8px;
  border-left: 1px solid currentColor;
  opacity: 0.85;
}
.vote-score-pill__bonus {
  font-size: 10px;
  letter-spacing: 0.12em;
  background: rgba(192, 57, 43, 0.85);
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 4px;
}

/* WON — gold gradient, the celebratory state */
.vote-score-pill--won {
  background: linear-gradient(135deg, #f5d76e 0%, #c8a951 100%);
  color: #11151F;
  border: 1px solid #b8900a;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.30);
}

/* PLACED — emerald, "in the money" */
.vote-score-pill--placed {
  background: rgba(26, 125, 74, 0.10);
  color: var(--rc-emerald, #1A7D4A);
  border: 1px solid rgba(26, 125, 74, 0.45);
}

/* UNPLACED — muted, didn't score but acknowledged */
.vote-score-pill--unplaced {
  background: var(--rc-card-warm, #F7F5EE);
  color: var(--rc-ink-40, #9CA3AF);
  border: 1px solid var(--rc-rule-strong, #D6D2C5);
  font-weight: 600;
}
.vote-score-pill--unplaced .vote-score-pill__points { opacity: 0.6; }

/* PENDING — dashed border, italic — brief window between results landing and settle_votes scoring it */
.vote-score-pill--pending {
  background: transparent;
  color: var(--rc-ink-40, #9CA3AF);
  border: 1px dashed var(--rc-rule-strong, #D6D2C5);
  font-style: italic;
  font-weight: 600;
  box-shadow: none;
}

/* ABANDONED — muted slate, void chip. Pick refunded, no points. */
.vote-score-pill--abandoned {
  background: rgba(108, 117, 125, 0.10);
  color: #6c757d;
  border: 1px solid rgba(108, 117, 125, 0.35);
  font-weight: 700;
  box-shadow: none;
}

/* ── Spotlight blurb (full-width, below the data row) ─────────
 * Editorial-pull-quote treatment for the Racing API's spotlight
 * comment / AI reason. Rendered on slip-mode and mobile where the
 * inline column is hidden. Sits in its own cream-tinted card with a
 * solid gold left rule and a tiny SPOTLIGHT kicker — the rule + kicker
 * carry the "this is analyst commentary" semantic that the old curly
 * double quotes used to carry, more quietly and more editorially.
 */
.racecard__blurb {
  grid-column: 1 / -1;
  margin: 10px 0 2px 56px;          /* indent past silk to align under HORSE */
  padding: 10px 14px;
  background: rgba(212, 175, 55, 0.05);
  border-left: 3px solid var(--rc-gold);
  border-radius: 0 6px 6px 0;
  font-family: 'Iowan Old Style', 'Charter', Georgia, 'Times New Roman', serif;
  font-size: 14px;
  font-weight: 400;
  font-style: normal;
  color: var(--rc-ink-80);
  line-height: 1.6;
  letter-spacing: 0.003em;
  max-width: 88ch;
}
.racecard__blurb::before {
  content: 'SPOTLIGHT';
  display: block;
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--rc-gold-ink);
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ── Inline COMMENT column ───────────────────────────────────
 * Renders the Racing API spotlight inline at the right end of each
 * runner row. Same data as `.racecard__blurb` (rendered below the
 * row); the responsive rule at the bottom of this block hides
 * whichever rendering doesn't fit the current viewport, so the same
 * comment never appears twice on screen.
 *
 * Design: pull-quote-style — solid 2px gold left rule replaces the
 * old dashed grey + curly-quote pseudo, upright serif body replaces
 * the old italic sans. The vertical gold bar reads as "this is
 * editorial copy, not data" without needing literal quote marks, and
 * the serif gives the row a Racing Post / FT analyst-note voice.
 *
 * Truncated to 3 lines via -webkit-line-clamp with overflow ellipsis;
 * the full comment lives in the cell's `title` attribute so a hover
 * tooltip restores the full read. Tight column = no SPOTLIGHT kicker
 * here — the rule + serif treatment carries the meaning alone.
 */
.racecard__cell--comment {
  align-self: center;
  padding: 2px 6px 2px 12px;
  border-left: 2px solid var(--rc-gold);
  text-align: left;                 /* override centred default for text cells */
  min-width: 0;                     /* lets line-clamp + ellipsis work */
}
.racecard__comment {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;           /* avoids long horse names breaking the layout */
  font-family: 'Iowan Old Style', 'Charter', Georgia, 'Times New Roman', serif;
  font-size: 13px;
  font-weight: 400;
  font-style: normal;
  color: var(--rc-ink-80);
  line-height: 1.55;
  letter-spacing: 0.005em;
}
.racecard__comment--empty {
  color: var(--rc-ink-40);
  font-style: normal;
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
}

/* Slip-mode + compact density: tighter font, narrower padding. */
.racecard--slip .racecard__cell--comment,
.racecard--compact .racecard__cell--comment {
  padding-left: 8px;
  font-size: 11.5px;
  line-height: 1.4;
}
.racecard--slip .racecard__comment,
.racecard--compact .racecard__comment {
  -webkit-line-clamp: 2;            /* shorter rows = shorter comment */
}

/* ── Coordination with the row-footer blurb ────────────────
 * Both the inline COMMENT column and the row-footer .racecard__blurb
 * surface the same content (runner.comment / runner.ai_reason). Show
 * whichever fits the current context, never both:
 *
 *   default racecard (non-slip, non-mobile)  → COLUMN  (blurb hidden)
 *   slip-mode (/full/, bet-slip beside row)  → BLURB   (column not rendered)
 *   mobile (≤ 640px)                         → BLURB   (column hidden via media query)
 *
 * Compact density already hides .racecard__blurb via its own rule;
 * for visual symmetry we also hide the column in compact, so dense
 * grids stay strictly one line per runner. */
.racecard__blurb { display: none; }
.racecard--slip .racecard__blurb { display: block; }
.racecard--compact .racecard__col--comment,
.racecard--compact .racecard__cell--comment { display: none; }
.racecard--compact .racecard__blurb { display: none; }

/* ── Saddle number cell ──────────────────────────────────────── */
.racecard__cell--number {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.racecard__number {
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--rc-ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.racecard__runner--nr .racecard__number {
  color: var(--rc-ink-40);
  text-decoration: line-through;
  text-decoration-color: var(--rc-red);
  text-decoration-thickness: 1.5px;
}

/* ── Silk SVG ────────────────────────────────────────────────── */
.racecard__cell--silk {
  display: flex;
  align-items: center;
  justify-content: center;
}
.racecard__silk {
  display: inline-block;
  vertical-align: middle;
  border-radius: 4px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.10));
}
.racecard__silk--sm { width: 28px; height: 32px; }
.racecard__silk--md { width: 36px; height: 42px; }
.racecard__silk--lg { width: 56px; height: 64px; }

/* ── Badges (universal pill) ─────────────────────────────────── */
.racecard__badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid transparent;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.3;
}
.racecard__badge--fav {
  color: var(--rc-card);
  background: var(--rc-gold-bright);
  border-color: var(--rc-gold-bright);
}
.racecard__badge--big-race {
  color: var(--rc-card);
  background: var(--rc-red);
  border-color: var(--rc-red);
}
.racecard__badge--nr {
  color: var(--rc-red);
  background: rgba(192, 57, 43, 0.10);
  border-color: rgba(192, 57, 43, 0.40);
}
.racecard__badge--7day {
  color: var(--rc-ink-70);
  background: var(--rc-card);
  border-color: var(--rc-rule-strong);
}
.racecard__badge--result {
  color: var(--rc-emerald);
  background: rgba(26, 125, 74, 0.10);
  border-color: rgba(26, 125, 74, 0.40);
}

/* ── Empty state ─────────────────────────────────────────────── */
.racecard__empty {
  text-align: center;
  padding: 80px 24px 96px;
  color: var(--rc-ink-70);
  max-width: 520px;
  margin: 0 auto;
}
.racecard__empty-icon {
  font-size: 64px;
  margin-bottom: 18px;
  opacity: 0.85;
}
.racecard__empty-title {
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  color: var(--rc-ink);
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  letter-spacing: -0.012em;
  margin: 0 0 10px;
}
.racecard__empty-sub {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--rc-ink-70);
}
.racecard__empty-cta {
  display: inline-block;
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rc-gold-ink);
  background: var(--rc-gold-wash);
  border: 1px solid rgba(212, 175, 55, 0.40);
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.racecard__empty-cta:hover {
  background: var(--rc-gold-bright);
  color: var(--rc-card);
  border-color: var(--rc-gold-bright);
}

/* ── Toast ───────────────────────────────────────────────────── */
.racecard__toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--rc-ink);
  color: var(--rc-card);
  border: 1px solid var(--rc-ink);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.20);
}
.racecard__toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════════════════════════════
   GUEST PICK BAR — sticky bottom, sits OUTSIDE .racecard so it can
   pin to the viewport without inheriting paper styles.
═══════════════════════════════════════════════════════════════════ */
.racecard-guest-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(8, 10, 18, 0.95);
  border-top: 1px solid rgba(212, 175, 55, 0.30);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: translateY(100%);
  transition: transform 0.28s ease;
  z-index: 90;
}
.racecard-guest-bar.is-visible { transform: translateY(0); }
.racecard-guest-bar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.racecard-guest-bar__left {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
}
.racecard-guest-bar__silk {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 36px;
  background: #1a3a6b;
  color: #fff;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.racecard-guest-bar__text {
  display: flex; flex-direction: column;
  min-width: 0; line-height: 1.2;
}
.racecard-guest-bar__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(212, 175, 55, 0.7);
  font-weight: 700;
}
.racecard-guest-bar__horse {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.racecard-guest-bar__odds {
  background: rgba(212, 175, 55, 0.20);
  color: var(--rc-gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.40);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.racecard-guest-bar__cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #f5d76e 0%, #c8a951 100%);
  color: #11151F;
  border: 1px solid #b8900a;
  padding: 9px 16px;
  border-radius: 5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  transition: box-shadow 0.18s, transform 0.08s;
}
.racecard-guest-bar__cta:hover {
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.30);
  transform: translateY(-1px);
}
.racecard-guest-bar__clear {
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.racecard-guest-bar__clear:hover {
  background: rgba(192, 57, 43, 0.18);
  border-color: rgba(192, 57, 43, 0.40);
  color: var(--rc-red);
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — at narrow widths the grid collapses to a card
   layout. Same template, different grid template.
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  /* Tight desktop — drop FORM, AI, and RPR (keeping SR as the
     primary rating). Connections stack their two lines tighter. */
  .racecard__grid {
    --rc-cols:
         36px
         36px
         minmax(170px, 1.4fr)
         48px
         64px
         60px
         minmax(72px, 80px)
         96px;
  }
  .racecard--no-pick .racecard__grid {
    --rc-cols:
         36px
         36px
         minmax(170px, 1.4fr)
         48px
         64px
         60px
         minmax(72px, 80px);
  }
  .racecard__col--form,
  .racecard__cell--form,
  .racecard__col--ai,
  .racecard__cell--ai,
  .racecard__col--rpr,
  .racecard__cell--rpr { display: none; }
  .racecard__col--conn,
  .racecard__cell--conn { display: flex; flex-direction: column; align-items: flex-start; }
}

/* ── Mobile inline stats row ──────────────────────────────────────
   Hidden on desktop where the data columns live as separate cells.
   Surfaced on ≤640px so the mobile card retains SR / RPR / Form /
   AI / Votes signal in one scannable line. */
.racecard__mobile-stats { display: none; }
.racecard__mobile-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.racecard__mobile-stat-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rc-ink-40);
}
.racecard__mobile-stat strong {
  font-weight: 700;
  color: var(--rc-ink);
  font-size: 13px;
}

@media (max-width: 900px) {
  /* Tablet — desktop column grid is too wide but the full mobile band
     layout below kicks in at 640px. Tablet keeps the existing column
     grid via the 768px-block above this file. Nothing to do here. */
}

@media (max-width: 640px) {
  /* ── Mobile band layout ────────────────────────────────────────
     The desktop column grid is too dense for narrow viewports, but
     dropping data columns sacrifices the analytical signal cubs
     need to pick. So we surface ALL fields stacked into bands:

       Band 1  identity   number-silk · horse name · age/wgt · odds
       Band 2  connections jockey · trainer
       Band 3  stats        SR · RPR · Form · AI · Votes
       Band 4  blurb        editor / AI commentary
       Band 5  action       pick button / score pill

     Plus full-width treatment — rows go edge-to-edge with no
     border-radius for a true app-feel. */
  .racecard__columns { display: none; }
  .racecard__runners { gap: 0; padding-top: 0; }

  /* Drop the cream paper's horizontal padding so rows bleed edge-to-edge. */
  .racecard { padding-left: 0; padding-right: 0; }

  .racecard__runner {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    grid-template-areas:
      "id   name  odds"
      "id   meta  odds"
      "id   conn  conn"
      "stats stats stats"
      "blurb blurb blurb"
      "pick  pick  pick";
    gap: 4px 12px;
    padding: 14px 14px 12px;
    align-items: start;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--rc-rule);
    border-bottom: none;
    margin-bottom: 0;
    box-shadow: none;
  }
  .racecard__runner:first-child { border-top: none; }
  .racecard__runner:hover {
    /* Drop the desktop hover-lift on touch — it's a click target,
       not a hover surface. */
    border-color: var(--rc-rule);
    border-left-color: transparent;
    box-shadow: none;
  }

  /* Identity rail — number above silk, gold accent on favourites. */
  .racecard__cell--number {
    grid-area: id;
    grid-row: 1 / 3;
    align-self: start;
    text-align: center;
    padding-top: 2px;
  }
  .racecard__cell--silk {
    grid-area: id;
    grid-row: 3 / 5;
    align-self: start;
    justify-self: center;
    margin-top: 4px;
  }
  .racecard__number { font-size: 17px; font-weight: 800; }

  /* Identity column — name, meta (age/wgt), jockey/trainer. */
  .racecard__cell--horse { grid-area: name; }
  .racecard__name { white-space: normal; font-size: 18px; }
  .racecard__name-meta {
    display: block;
    grid-area: meta;
    font-size: 12px;
    color: var(--rc-ink-40);
    margin-top: 2px;
  }

  /* Jockey / trainer — re-shown on mobile (was hidden in the old
     layout). One line each, jockey in ink, trainer muted. */
  .racecard__cell--conn {
    grid-area: conn;
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 1.35;
  }
  .racecard__jockey { color: var(--rc-ink); font-weight: 700; }
  .racecard__trainer { color: var(--rc-ink-70); font-size: 11.5px; }

  /* Odds badge — top-right, stays at 48px. Reuses the avatar work. */
  .racecard__cell--odds {
    grid-area: odds;
    grid-row: 1 / 3;
    justify-self: end;
    align-self: center;
  }

  /* Mobile inline stats row — show it; hide the old per-cell stats. */
  .racecard__mobile-stats {
    display: flex;
    grid-area: stats;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px solid rgba(17, 21, 31, 0.06);
  }
  .racecard__cell--age,
  .racecard__cell--wgt,
  .racecard__cell--or,
  .racecard__cell--sr,
  .racecard__cell--rpr,
  .racecard__cell--form,
  .racecard__cell--ai,
  .racecard__cell--votes,
  .racecard__cell--comment,
  .racecard__col--comment {
    display: none;
  }
  /* Mobile: bring back the blurb-below now that the column is hidden. */
  .racecard__blurb { display: block; }

  /* Blurb — full width with breathing room above. */
  .racecard__blurb {
    grid-area: blurb;
    margin: 10px 0 0;
    padding-top: 10px;
    font-size: 13px;
    border-top: 1px solid rgba(17, 21, 31, 0.06);
  }

  /* Pick action — full-width button. */
  .racecard__cell--pick {
    grid-area: pick;
    margin-top: 12px;
  }
  .racecard__pick--block,
  .racecard__pick {
    width: 100%;
    padding: 12px;
    font-size: 13px;
  }
  .racecard__pick { justify-content: center; }

  /* Score pill on mobile — full width, sits in pick row. */
  .vote-score-pill {
    margin-top: 12px;
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

/* a11y helper */
.racecard .sr-only,
.racecard-guest-bar .sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Silk image (API-supplied) ────────────────────────────────
   Matches the same footprint as the stylised SVG variants so swapping
   between API image and fallback never reflows the row. object-fit
   keeps non-square assets clean. */
.racecard__silk--img {
  object-fit: contain;
  background: var(--rc-card-warm);
  padding: 1px;
}

/* ── Forecast SP chip ────────────────────────────────────────
   Sits under the live odds badge. Subtle by design — the live price
   is the headline; FCST is the context. Mono numerics so the value
   lines up vertically across the column. */
.racecard__odds-forecast {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--rc-card-warm);
  border: 1px solid var(--rc-rule);
  font-size: 10px;
  font-weight: 600;
  color: var(--rc-ink-70);
  font-feature-settings: 'tnum';
  cursor: help;
}
.racecard__odds-forecast-lbl {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--rc-ink-40);
}
.racecard__odds-forecast-val {
  font-size: 11px;
  font-weight: 700;
  color: var(--rc-ink);
}

/* ── Price trail — opening → current arrow chain ─────────────
 * Sits beneath the odds badge when the market has moved. Tells the
 * journey at a glance: the old price is struck through + muted, the
 * arrow + new price take the direction colour (emerald shorten /
 * red drift). Tabular nums keep the pair visually aligned. */
.racecard__odds-trail {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--rc-card-warm);
  border: 1px solid var(--rc-rule);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: help;
}
.racecard__odds-trail-step {
  color: var(--rc-ink-70);
}
.racecard__odds-trail-step--opening {
  color: var(--rc-ink-40);
  text-decoration: line-through;
  text-decoration-color: var(--rc-ink-40);
}
.racecard__odds-trail-step--current {
  font-weight: 800;
  color: var(--rc-ink);
}
.racecard__odds-trail-arrow {
  font-weight: 800;
  font-size: 11px;
  color: var(--rc-ink-40);
}
/* Direction tinting — emerald when the price shortened, red when it
   drifted. Applies to the arrow + the current step so the colour
   reads even after the user's eyes have skimmed past the line. */
.racecard__odds-trail--in {
  background: var(--rc-emerald-soft, rgba(26, 125, 74, 0.08));
  border-color: rgba(26, 125, 74, 0.30);
}
.racecard__odds-trail--in .racecard__odds-trail-arrow,
.racecard__odds-trail--in .racecard__odds-trail-step--current {
  color: var(--rc-emerald, #1A7D4A);
}
.racecard__odds-trail--out {
  background: rgba(192, 57, 43, 0.06);
  border-color: rgba(192, 57, 43, 0.28);
}
.racecard__odds-trail--out .racecard__odds-trail-arrow,
.racecard__odds-trail--out .racecard__odds-trail-step--current {
  color: var(--rc-red, #C0392B);
}

/* Slip-mode trail — tighter pill since the /full/ odds column is 60px. */
.racecard--slip .racecard__odds-trail {
  margin-top: 3px;
  padding: 1px 6px;
  font-size: 9.5px;
  border-radius: 999px;
}
.racecard--slip .racecard__odds-trail-arrow { font-size: 10px; }

/* Stack the chip vertically under the odds badge inside the odds cell. */
.racecard__cell--odds {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ── Form figures — podium-coloured chips ──────────────────
   Each character of the form string is wrapped in a .rcf chip by
   _form.html. The chip carries:
     - background colour matching the finishing position
       (emerald win, silver 2nd, bronze 3rd, red 4+/dnf)
     - the actual digit / letter so the position is still readable
       (different from generic 'W' / 'L' stripes seen elsewhere)
   Pure CSS — no animations, no JS, zero perf cost. */
.rcf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  margin-right: 3px;
  border-radius: 4px;
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  vertical-align: middle;
}
.rcf:last-child { margin-right: 0; }

/* 1st — emerald podium */
.rcf--win {
  background: var(--rc-emerald, #1A7D4A);
  color: #FFFFFF;
}
/* 2nd — gunmetal silver */
.rcf--silver {
  background: #B0B6BD;
  color: #11151F;
}
/* 3rd — warm bronze */
.rcf--bronze {
  background: #B87333;
  color: #FFFFFF;
}
/* 4–9 + 0 — out of the places */
.rcf--loss {
  background: var(--rc-red, #C0392B);
  color: #FFFFFF;
}
/* Pulled up / fell / unseated / refused / brought down / slipped — DNF.
   Darker red + dashed inset so it reads as "non-completion" rather
   than just "lost" even on a quick glance. */
.rcf--dnf {
  background: #8B2A20;
  color: #FFFFFF;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.30);
}
/* Season divider — render as a small muted middle-dot, not a chip.
   Height matches the pill row so the separator doesn't drop the
   baseline; width is narrow so it reads as a breath, not a column. */
.rcf--sep {
  display: inline-block;
  min-width: 0;
  width: 8px;
  height: 22px;
  background: transparent;
  color: var(--rc-ink-40);
  margin: 0 2px;
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
  line-height: 22px;
}

.racecard__form--empty { color: var(--rc-ink-40); }
/* The .racecard__form wrapper no longer needs monospace — chips align
   themselves via fixed min-width. Slip-mode + mobile size overrides
   still cascade because they target .racecard__form (parent), not .rcf. */
.racecard__form {
  font-family: inherit;
  letter-spacing: 0;
}
