/* ── SITE-LEVEL DESIGN TOKENS ──────────────────────────────────────── */
:root,
.wa-dark {
    --site-bg:           #0f0f11;
    --site-surface:      #1c1c20;
    --site-surface-2:    #27272a;
    --site-surface-3:    #3f3f46;
    --site-header:       #09090b;
    --site-text:         #f4f4f5;
    --site-text-muted:   #a1a1aa;
    --site-border:       #3f3f46;
    --site-accent:       #22c55e;
    --site-accent-hover: #16a34a;
}
.wa-light {
    --site-bg:           #f4f4f5;
    --site-surface:      #ffffff;
    --site-surface-2:    #f0f0f2;
    --site-surface-3:    #e4e4e7;
    --site-header:       #18181b;
    --site-text:         #18181b;
    --site-text-muted:   #71717a;
    --site-border:       #e4e4e7;
    --site-accent:       #16a34a;
    --site-accent-hover: #15803d;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--site-bg);
    color: var(--site-text);
    min-height: 100vh;
    transition: background 0.2s, color 0.2s;
}

/* ── SITE HEADER ─────────────────────────────────────────────────── */
.site-header {
    background: var(--site-header);
    color: #fff;
    position: relative;
    z-index: 200;
    box-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 1.25rem;
    height: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Logo */
.site-logo { height: 50px; width: auto; display: block; flex-shrink: 0; padding: 4px 6px; box-sizing: content-box; }
.brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }

/* Left section */
.header-left { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.header-sep  { width: 1px; height: 20px; background: rgba(255,255,255,.12); flex-shrink: 0; }

/* Right section */
.header-right { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }

.header-nav { display: flex; gap: 0.1rem; align-items: center; }
.nav-link {
    color: #a1a1aa; text-decoration: none;
    font-size: 0.8rem; font-weight: 600;
    padding: 0.3rem 0.6rem; border-radius: 6px;
    transition: background 0.12s, color 0.12s;
    display: flex; align-items: center; gap: 0.3rem;
    white-space: nowrap; min-height: 36px;
}
.nav-link:hover  { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: var(--site-accent); color: #fff; }

.header-spacer { flex: 1; min-width: 0; }

/* Theme toggle */
.theme-toggle {
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,.5); font-size: .85rem;
    width: 34px; height: 34px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color .12s, background .12s; flex-shrink: 0;
}
.theme-toggle:hover { color: #fff; background: rgba(255,255,255,.1); }

/* Date nav */
.date-nav {
    display: flex; align-items: center; gap: 0.3rem;
    background: #27272a; border-radius: 8px; padding: 0.25rem;
}
.date-nav a {
    display: inline-flex; align-items: center; justify-content: center;
    color: #d4d4d8; text-decoration: none; border-radius: 5px;
    padding: 0.3rem 0.55rem; font-size: 0.8rem;
    transition: background 0.1s, color 0.1s; min-height: 36px;
}
.date-nav a:hover { background: #52525b; color: #fff; }
.date-nav .date-label {
    font-size: 0.82rem; font-weight: 600; color: #fff;
    padding: 0.3rem 0.6rem; cursor: pointer; white-space: nowrap;
}
.date-nav input[type="date"] {
    position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.date-nav .today-link { background: var(--site-accent) !important; color: #fff !important; font-weight: 700; }

/* Theme toggle */
.theme-toggle {
    background: transparent; border: 1px solid #3f3f46; border-radius: 6px;
    padding: 0.28rem 0.55rem; cursor: pointer; color: #a1a1aa;
    font-size: 0.8rem; display: flex; align-items: center; gap: 0.35rem;
    transition: border-color 0.1s, color 0.1s, background 0.1s; flex-shrink: 0;
    min-height: 36px;
}
.theme-toggle:hover { border-color: #71717a; color: #fff; background: #27272a; }

/* ── STATS NAV DROPDOWN ──────────────────────────────────────────── */
.nav-dropdown { position: relative; flex-shrink: 0; }

.nav-dropdown-trigger {
    background: transparent; border: none; cursor: pointer;
    font-family: inherit;
}
.nav-dropdown.active .nav-dropdown-trigger { color: #fff !important; }

.nav-dropdown-menu {
    display: none;
    position: absolute; top: calc(100% + 6px); left: 0;
    min-width: 190px;
    background: var(--site-surface-2);
    border: 1px solid var(--site-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.45);
    padding: 0.3rem;
    z-index: 300;
}
.nav-dropdown-menu.open { display: block; }

.nav-dropdown-item {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.5rem 0.7rem; border-radius: 6px;
    color: var(--site-text); text-decoration: none;
    font-size: 0.82rem; font-weight: 500;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
}
.nav-dropdown-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-dropdown-item i { width: 1rem; text-align: center; font-size: 0.8rem; color: var(--site-text-muted); flex-shrink: 0; }
.nav-dropdown-item:hover i { color: var(--site-accent); }

/* ── USER DROPDOWN ───────────────────────────────────────────────── */
.user-dropdown { position: relative; flex-shrink: 0; }

.user-dropdown-trigger {
    background: transparent; border: none; cursor: pointer;
    color: #a1a1aa; font-size: 0.8rem; font-weight: 600;
    padding: 0.3rem 0.6rem; border-radius: 6px;
    display: flex; align-items: center; gap: 0.3rem;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap; min-height: 36px;
}
.user-dropdown-trigger:hover { background: rgba(255,255,255,.08); color: #fff; }
.user-dropdown-trigger[aria-expanded="true"] { background: rgba(255,255,255,.08); color: #fff; }

.user-dropdown-chevron {
    font-size: 0.6rem; margin-left: 0.1rem;
    transition: transform 0.18s;
}
.user-dropdown-trigger[aria-expanded="true"] .user-dropdown-chevron { transform: rotate(180deg); }

.user-dropdown-menu {
    display: none;
    position: absolute; top: calc(100% + 6px); right: 0;
    min-width: 175px;
    background: var(--site-surface-2);
    border: 1px solid var(--site-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.45);
    padding: 0.3rem;
    z-index: 300;
}
.user-dropdown-menu.open { display: block; }

.user-dropdown-item {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.5rem 0.7rem; border-radius: 6px;
    color: var(--site-text); text-decoration: none;
    font-size: 0.82rem; font-weight: 500;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
}
.user-dropdown-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.user-dropdown-item.active { color: var(--site-accent); }
.user-dropdown-item i { width: 1rem; text-align: center; font-size: 0.8rem; color: var(--site-text-muted); flex-shrink: 0; }
.user-dropdown-item:hover i { color: #fff; }
.user-dropdown-item.active i { color: var(--site-accent); }

.user-dropdown-logout { color: #71717a; }
.user-dropdown-logout:hover { color: #f87171; background: rgba(248,113,113,.08); }
.user-dropdown-logout i { color: #71717a; }
.user-dropdown-logout:hover i { color: #f87171; }

.user-dropdown-divider { height: 1px; background: var(--site-border); margin: 0.3rem 0; }

/* ── HEADER AUTH BUTTONS (logged-out state) ──────────────────────── */
.btn-auth-login {
    color: #a1a1aa; text-decoration: none;
    font-size: 0.8rem; font-weight: 600;
    padding: 0.3rem 0.65rem; border-radius: 6px;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.btn-auth-login:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-auth-join {
    background: var(--site-accent); color: #fff; text-decoration: none;
    font-size: 0.8rem; font-weight: 700;
    padding: 0.3rem 0.75rem; border-radius: 6px;
    transition: background 0.12s;
    white-space: nowrap;
}
.btn-auth-join:hover { background: var(--site-accent-hover); }

/* ── HAMBURGER BUTTON ────────────────────────────────────────────── */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    min-height: 36px; min-width: 36px;
}
.hamburger span {
    display: block;
    width: 18px; height: 2px;
    background: #a1a1aa;
    border-radius: 1px;
    transition: transform 0.22s, opacity 0.22s;
}
.hamburger:hover { border-color: #71717a; }
.hamburger:hover span { background: #fff; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── MOBILE NAV DRAWER ───────────────────────────────────────────── */
.mobile-nav {
    display: none;
    background: var(--site-header);
    border-top: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 8px 24px rgba(0,0,0,.55);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 190;
}
.mobile-nav.open { display: block; }
.mobile-nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.5rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    text-decoration: none;
    color: #a1a1aa;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.1s, color 0.1s;
    min-height: 48px;
}
.mobile-nav-link:hover  { background: rgba(255,255,255,.08); color: #fff; }
.mobile-nav-link.active { color: #fff; background: rgba(22,163,74,.2); }
.mobile-nav-link i { width: 1.1rem; text-align: center; font-size: 0.85rem; color: var(--site-accent); }
.mobile-nav-divider { height: 1px; background: rgba(255,255,255,.1); margin: 0.4rem 0; }
.mobile-nav-auth { display: flex; gap: 0.5rem; padding: 0.5rem 0.9rem 0; }
.mobile-nav-auth a {
    flex: 1; text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem; font-weight: 700;
    text-decoration: none;
    min-height: 48px; display: flex; align-items: center; justify-content: center;
}
.mobile-nav-auth .btn-login  { background: transparent; border: 1px solid rgba(255,255,255,.2); color: #d4d4d8; }
.mobile-nav-auth .btn-signup { background: var(--site-accent); color: #fff; }

/* ── SHARED LAYOUT ───────────────────────────────────────────────── */
.page-main { max-width: 1280px; margin: 1.5rem auto; padding: 0 1.25rem; }

/* show-mobile hidden by default; revealed inside the ≤640px breakpoint */
.show-mobile { display: none !important; }

/* ── CARDS ───────────────────────────────────────────────────────── */
.site-card {
    background: var(--site-surface); border-radius: 10px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.06);
}
.site-card-header {
    background: var(--site-surface-2); padding: 0.7rem 1rem;
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}

/* ── TABLES ──────────────────────────────────────────────────────── */
.table-wrap {
    margin-bottom: 1.75rem;
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; background: var(--site-surface); }
th {
    background: var(--site-header); color: #fff; text-align: left;
    padding: 0.55rem 0.75rem; font-size: 0.68rem;
    text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}
td {
    padding: 0.6rem 0.75rem; font-size: 0.85rem;
    border-bottom: 1px solid var(--site-border);
    vertical-align: middle; color: var(--site-text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--site-surface-2); }

/* ── SECTION TITLE ───────────────────────────────────────────────── */
.section-title {
    font-size: 0.78rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--site-text);
    margin-bottom: 0.75rem; padding-bottom: 0.45rem;
    border-bottom: 2px solid var(--site-border);
}

/* ── RACE META STRIP ─────────────────────────────────────────────── */
.race-meta {
    background: var(--site-surface); border-radius: 10px;
    padding: 0.25rem 0; margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    display: flex; flex-wrap: wrap; gap: 0;
}
.meta-item {
    display: flex; flex-direction: column; gap: 0.15rem;
    padding: 0.55rem 1.1rem;
    border-right: 1px solid var(--site-border);
}
.meta-item:last-child { border-right: none; }
.meta-label {
    display: flex; align-items: center; gap: 0.3rem;
    font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--site-text-muted); font-weight: 700;
}
.meta-label i { font-size: 0.65rem; opacity: 0.8; }
.meta-value { font-size: 0.88rem; font-weight: 600; color: var(--site-text); padding-left: 0.05rem; }

/* ── RACE WEATHER PANEL ──────────────────────────────────────────── */
.race-weather {
    display: flex; flex-wrap: wrap; gap: 0;
    background: var(--site-surface); border-radius: 10px;
    padding: 0.25rem 0; margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.wx-item {
    display: flex; flex-direction: column; gap: 0.15rem;
    padding: 0.55rem 1.1rem;
    border-right: 1px solid var(--site-border);
}
.wx-item:last-child { border-right: none; }
.wx-item i {
    font-size: 0.65rem; opacity: 0.8; color: var(--site-text-muted);
}
.wx-label {
    font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--site-text-muted); font-weight: 700;
    display: flex; align-items: center; gap: 0.3rem;
}
.wx-value { font-size: 0.88rem; font-weight: 600; color: var(--site-text); padding-left: 0.05rem; }

/* ── WEATHER COMPACT WIDGET ──────────────────────────────────────── */
/* Shared across racecards, race, big-races, festival, course pages */
.wx-compact {
    display: flex; align-items: center; gap: 0.25rem;
    font-size: 0.72rem; font-weight: 600;
    color: var(--site-text-muted); white-space: nowrap;
}
.wx-compact .wx-icon { font-size: 0.9rem; }
.wx-precip { font-size: 0.65rem; display: inline-flex; align-items: center; gap: 1px; }

/* ── ERROR ───────────────────────────────────────────────────────── */
.site-error {
    display: flex; align-items: flex-start; gap: 0.6rem;
    background: rgba(220,38,38,.15); border: 1px solid #f87171;
    color: #fff; padding: 0.7rem 1rem; border-radius: 5px;
}
.site-error::before {
    font-family: "Font Awesome 6 Free"; font-weight: 900;
    content: '\f071'; color: #f87171; flex-shrink: 0;
    font-size: 0.85rem; line-height: 1.5;
}

/* ── POSITION BADGES ─────────────────────────────────────────────── */
.pos-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.4rem; height: 1.9rem; border-radius: 6px;
    font-size: 0.75rem; font-weight: 800; padding: 0 0.4rem;
}
.pos-gold   { background: #FFD700; color: #1a1a1a; }
.pos-silver { background: #C0C0C0; color: #1a1a1a; }
.pos-bronze { background: #CD7F32; color: #fff; }
.pos-num    { background: var(--site-surface-3); color: var(--site-text-muted); }
.pos-nr     { background: var(--site-surface-2); color: var(--site-text-muted); font-size: 0.62rem; }

/* ── AUTH FORMS ──────────────────────────────────────────────────── */
.auth-wrap {
    min-height: calc(100vh - 70px);
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1.25rem;
}
.auth-card {
    width: 100%; max-width: 440px;
    background: var(--site-surface); border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.04);
    overflow: hidden;
    border-top: 3px solid var(--site-accent);
}
.auth-card-header {
    padding: 1.4rem 1.75rem 1.1rem;
    border-bottom: 1px solid var(--site-border);
}
.auth-card-header h1 { font-size: 1.25rem; font-weight: 900; color: var(--site-text); margin: 0; }
.auth-card-body { padding: 1.75rem; }
.form-group { margin-bottom: 1.1rem; }
@media (max-width: 640px) {
    .auth-wrap { align-items: flex-start; padding-top: 1.25rem; }
    .auth-card-header { padding: 1rem 1rem 0.75rem; }
    .auth-card-body { padding: 1rem; }
    .form-group { margin-bottom: 0.75rem; }
}
.form-label {
    display: block; font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--site-text-muted); margin-bottom: 0.35rem;
}
.form-input {
    width: 100%; max-width: 100%; box-sizing: border-box;
    background: var(--site-surface-2);
    border: 1px solid var(--site-border); border-radius: 7px;
    padding: 0.6rem 0.9rem; font-size: 0.925rem;
    color: var(--site-text); outline: none; transition: border-color 0.15s;
}
.form-input:focus  { border-color: var(--site-accent); }
.form-input.is-error { border-color: #dc2626; box-shadow: 0 0 0 2px rgba(220,38,38,.15); }
.form-error {
    display: none; align-items: center; gap: 0.3rem;
    font-size: 0.78rem; color: #dc2626; margin-top: 0.35rem;
    font-weight: 500;
}
.form-error.visible { display: flex; }
.form-error::before { content: '✕'; font-size: 0.68rem; font-weight: 700; }
.pw-strength {
    height: 4px; border-radius: 2px; margin-top: 0.35rem;
    background: var(--site-surface-3); transition: background 0.2s, width 0.2s;
}
.pw-strength.weak   { background: #dc2626; }
.pw-strength.medium { background: #f59e0b; }
.pw-strength.strong { background: #16a34a; }
.pw-hint { font-size: 0.68rem; margin-top: 0.2rem; color: var(--site-text-muted); min-height: 1em; }
.btn-primary {
    width: 100%; background: var(--site-accent); color: #000;
    border: none; border-radius: 7px; padding: 0.65rem 1.25rem;
    font-size: 0.925rem; font-weight: 700; cursor: pointer;
    transition: background 0.1s; min-height: 44px;
}
.btn-primary:hover { background: var(--site-accent-hover); }
.auth-link { display: block; text-align: center; margin-top: 1rem; font-size: 0.82rem; color: var(--site-text-muted); }
.auth-link a { color: var(--site-accent); text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }
.alert {
    display: flex; align-items: flex-start; gap: 0.6rem;
    padding: 0.7rem 1rem; border-radius: 5px; margin-bottom: 1rem;
    font-size: 0.875rem; border: 1px solid transparent; color: #fff;
}
.alert::before {
    font-family: "Font Awesome 6 Free"; font-weight: 900;
    flex-shrink: 0; font-size: 0.85rem; line-height: 1.5;
}
.alert-success { background: rgba(22,163,74,.15); border-color: #22c55e; }
.alert-success::before { content: '\f00c'; color: #22c55e; } /* fa-check */
.alert-error   { background: rgba(220,38,38,.15); border-color: #f87171; }
.alert-error::before { content: '\f071'; color: #f87171; } /* fa-triangle-exclamation */
.alert-info    { background: rgba(37,99,235,.15); border-color: #60a5fa; }
.alert-info::before { content: '\f129'; color: #60a5fa; } /* fa-circle-info */

/* ── TOAST NOTIFICATIONS ─────────────────────────────────────────── */
#toast-container {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    z-index: 9999; display: flex; flex-direction: column;
    gap: 0.5rem; pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.65rem 1rem;
    border-radius: 8px; font-size: 0.875rem; font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
    opacity: 0; transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: auto;
}
.toast.show    { opacity: 1; transform: translateY(0); }
.toast-track   { background: #14532d; border: 1px solid #86efac; color: #dcfce7; }
.toast-untrack { background: #1e293b; border: 1px solid #475569; color: #cbd5e1; }

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .header-inner { padding: 0.5rem 1rem; gap: 0.5rem; }
    .page-main    { padding: 0 0.75rem; margin-top: 1rem; }
    .site-logo    { height: 42px; }
}

@media (max-width: 640px) {
    /* Hamburger on, desktop nav off */
    .hamburger              { display: flex; }
    .header-nav             { display: none; }
    .header-sep             { display: none; }
    .header-right .nav-link { display: none; }

    /* Global hide/show helpers */
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }

    /* Touch-friendly tap targets */
    .race-row      { min-height: 52px; }
    .region-tab    { min-height: 44px; }
    .meeting-race-link { min-height: 40px; }

    /* Race meta: icon-only labels, hide Surface + Age Band */
    .meta-item  { padding: 0.45rem 0.8rem; }
    .meta-value { font-size: 0.82rem; }
    .label-text { display: none; }
    .meta-label i { font-size: 0.85rem; opacity: 0.9; }
}

/* ── SITE FOOTER ──────────────────────────────────────────────────── */
.site-footer {
    margin-top: 3rem;
    border-top: 1px solid var(--site-border);
    background: var(--site-header);
}
.site-footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.site-footer-copy {
    font-size: 0.75rem;
    color: var(--site-text-muted);
}
.site-footer-links {
    display: flex;
    gap: 1.25rem;
}
@media (max-width: 640px) {
    .site-footer-links { display: none; }
}
.site-footer-links a {
    font-size: 0.75rem;
    color: var(--site-text-muted);
    text-decoration: none;
}
.site-footer-links a:hover {
    color: var(--site-text);
    text-decoration: underline;
}

@media (max-width: 480px) {
    .page-main { padding: 0 0.6rem; margin-top: 0.75rem; }
    #toast-container { right: 0.75rem; left: 0.75rem; }
    .toast { font-size: 0.8rem; }
    .meta-item { padding: 0.4rem 0.65rem; }
}

/* ── PAGE HEADING ────────────────────────────────────────────────────── */
.page-heading {
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
    border-bottom: 2px solid var(--site-accent);
    padding-bottom: 0.75rem; margin-bottom: 1rem;
}
.page-heading-title { font-size: 1.5rem; font-weight: 800; color: var(--site-text); margin: 0; }
@media (max-width: 640px) {
    .page-heading-title { font-size: 1.2rem; }
}

/* ── BREADCRUMB ──────────────────────────────────────────────────────── */
.breadcrumb {
    display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
    font-size: 0.75rem; color: var(--site-text-muted);
    margin-bottom: 0.75rem;
}
.breadcrumb a { color: var(--site-text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--site-accent); }
.breadcrumb .bc-sep { opacity: 0.4; font-size: 0.65rem; }
.breadcrumb .bc-current { color: var(--site-text); font-weight: 600; }

/* ── FORM STRING COLOUR-CODING ───────────────────────────────────────── */
.form-str      { display: inline-flex; gap: 0.05em; flex-wrap: nowrap; }
.form-char     { font-size: 0.78rem; font-weight: 700; letter-spacing: 0; }
.form-win      { color: #22c55e; }
.form-place    { color: #f59e0b; }
.form-fell     { color: #f87171; }
.form-np       { color: #fb923c; }
.form-unplaced { color: var(--site-text-muted); }
.form-sep      { color: var(--site-border); margin: 0 0.08em; opacity: 0.6; }
.form-nr       { color: var(--site-text-muted); }

/* ── RACE COUNTDOWN TIMERS ────────────────────────────────────────────── */
.race-countdown {
    display: inline-flex; align-items: center;
    font-size: 0.62rem; font-weight: 700;
    background: var(--site-surface-2); color: var(--site-text-muted);
    border: 1px solid var(--site-border);
    border-radius: 4px; padding: 0.1rem 0.35rem;
    margin-left: 0.4rem; vertical-align: middle;
    white-space: nowrap; letter-spacing: 0.02em;
}
.race-countdown--soon {
    background: rgba(251,191,36,.15); border-color: #fbbf24; color: #fbbf24;
}
.race-countdown--very-soon {
    background: rgba(239,68,68,.15); border-color: #f87171; color: #f87171;
}
.race-countdown--off {
    background: rgba(161,161,170,.12); border-color: var(--site-border);
    color: var(--site-text-muted); font-style: italic;
}

/* ── VENUE JUMP BAR ───────────────────────────────────────────────────── */
.venue-jump-bar {
    position: sticky; top: 0; z-index: 100;
    background: var(--site-bg);
    border-bottom: 1px solid var(--site-border);
    margin: 0 -1.25rem 1rem;
}
.venue-jump-bar-inner {
    max-width: 1280px; margin: 0 auto;
    padding: 0 1.25rem;
    display: flex; gap: 0; overflow-x: auto;
    scrollbar-width: none;
}
.venue-jump-bar-inner::-webkit-scrollbar { display: none; }
.venue-jump-link {
    flex-shrink: 0;
    font-size: 0.73rem; font-weight: 600;
    color: var(--site-text-muted); text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid transparent;
    transition: color 0.1s, border-color 0.1s;
    white-space: nowrap;
}
.venue-jump-link:hover  { color: var(--site-text); }
.venue-jump-link.active { color: var(--site-accent); border-bottom-color: var(--site-accent); }

/* ── BETTING CALCULATOR ───────────────────────────────────────────────── */
.bet-calc-fab {
    position: fixed; bottom: 5rem; right: 1.5rem; z-index: 900;
    background: var(--site-accent); color: #000;
    border: none; border-radius: 50%; width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    transition: background 0.15s, transform 0.15s;
}
.bet-calc-fab:hover { background: var(--site-accent-hover); transform: scale(1.06); }
.bet-calc-overlay {
    display: none; position: fixed; inset: 0; z-index: 901;
    background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
    align-items: flex-end; justify-content: center;
}
.bet-calc-overlay.open { display: flex; }
@media (min-width: 640px) { .bet-calc-overlay { align-items: center; } }
.bet-calc-modal {
    background: var(--site-surface); border-radius: 16px 16px 0 0;
    width: 100%; max-width: 480px;
    padding: 1.25rem 1.25rem 2rem;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 -8px 32px rgba(0,0,0,.5);
}
@media (min-width: 640px) { .bet-calc-modal { border-radius: 14px; max-height: 80vh; } }
.bet-calc-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem;
}
.bet-calc-header h2 { font-size: 1rem; font-weight: 800; color: var(--site-text); margin: 0; }
.bet-calc-close-btn {
    background: var(--site-surface-2); border: 1px solid var(--site-border);
    border-radius: 6px; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--site-text-muted); font-size: 1rem;
}
.bet-calc-close-btn:hover { color: var(--site-text); }
.bet-calc-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.bet-calc-tab {
    flex: 1; padding: 0.45rem; text-align: center;
    background: var(--site-surface-2); border: 1px solid var(--site-border);
    border-radius: 7px; font-size: 0.75rem; font-weight: 700;
    color: var(--site-text-muted); cursor: pointer; transition: all 0.12s;
    font-family: inherit;
}
.bet-calc-tab.active { background: var(--site-accent); border-color: var(--site-accent); color: #000; }
.bet-calc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.65rem; }
.bet-calc-row.full { grid-template-columns: 1fr; }
.bet-calc-label {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--site-text-muted); margin-bottom: 0.2rem;
}
.bet-calc-input {
    width: 100%; background: var(--site-surface-2); border: 1px solid var(--site-border);
    border-radius: 7px; padding: 0.5rem 0.75rem; font-size: 0.9rem;
    color: var(--site-text); outline: none; transition: border-color 0.15s;
    font-family: inherit;
}
.bet-calc-input:focus { border-color: var(--site-accent); }
.bet-calc-select {
    width: 100%; appearance: none; background: var(--site-surface-3); border: 1px solid var(--site-border);
    border-radius: 6px; padding: 0.26rem 1.8rem 0.26rem 0.65rem; font-size: 0.78rem; font-weight: 700;
    color: var(--site-text); outline: none; font-family: inherit; cursor: pointer;
    transition: border-color 0.1s, color 0.1s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a1a1aa'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.55rem center;
}
.bet-calc-select:hover, .bet-calc-select:focus { border-color: var(--site-accent); color: var(--site-accent); }
.bet-calc-select option { background: var(--site-surface); }
.bet-calc-calc-btn {
    width: 100%; background: var(--site-accent); color: #000;
    border: none; border-radius: 7px; padding: 0.6rem;
    font-size: 0.9rem; font-weight: 700; cursor: pointer;
    margin-top: 0.75rem; transition: background 0.1s; font-family: inherit;
}
.bet-calc-calc-btn:hover { background: var(--site-accent-hover); }
.bet-calc-results {
    background: var(--site-surface-2); border-radius: 8px;
    padding: 0.85rem 1rem; margin-top: 0.75rem;
    border: 1px solid var(--site-border);
}
.bet-calc-result-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.82rem; padding: 0.25rem 0;
}
.bet-calc-result-label { color: var(--site-text-muted); }
.bet-calc-result-val   { font-weight: 700; color: var(--site-text); }
.bet-calc-result-val.positive { color: #22c55e; }
.bet-calc-result-val.negative { color: #f87171; }
.bet-calc-result-row.total    { border-top: 1px solid var(--site-border); margin-top: 0.35rem; padding-top: 0.55rem; }
.bet-calc-result-row.total .bet-calc-result-label { font-weight: 700; color: var(--site-text); }
.bet-calc-result-row.total .bet-calc-result-val   { font-size: 1rem; }
.bet-calc-runners { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }
.bet-calc-runner-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; align-items: center; }
.bet-calc-runner-row .bet-calc-input { font-size: 0.82rem; padding: 0.4rem 0.65rem; }
.bet-calc-add-runner {
    background: none; border: 1px dashed var(--site-border);
    color: var(--site-text-muted); border-radius: 7px;
    padding: 0.45rem; font-size: 0.78rem; cursor: pointer; width: 100%;
    transition: border-color 0.12s, color 0.12s; font-family: inherit;
}
.bet-calc-add-runner:hover { border-color: var(--site-accent); color: var(--site-accent); }

/* ── BOOKMAKER ODDS BOXES (shared across all pages) ─────────────────── */
.bk-odds-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 4px 8px;
    min-width: 54px;
    text-decoration: none;
    line-height: 1.2;
}
.bk-odds-val  { font-size: 1rem; font-weight: 800; }
.best-odds-none { color: var(--site-text-muted); font-size: 0.78rem; }

/* ── SHARED SELECT & DATE CONTROLS ─────────────────────────────────── */
/* Matches the .venue-btn style used on individual race pages */
.filter-select, .date-select, .compare-select {
    appearance: none;
    background: var(--site-surface-3); border: 1px solid var(--site-border);
    color: var(--site-text); font-size: 0.78rem; font-weight: 700;
    padding: 0.26rem 1.8rem 0.26rem 0.65rem; border-radius: 6px; cursor: pointer;
    font-family: inherit; outline: none; transition: border-color 0.1s, color 0.1s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a1a1aa'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.55rem center;
}
.filter-select:hover, .date-select:hover, .compare-select:hover,
.filter-select:focus, .date-select:focus, .compare-select:focus { border-color: var(--site-accent); color: var(--site-accent); }
.filter-select option, .date-select option, .compare-select option { background: var(--site-surface); }
.date-select { max-width: 12rem; }
.compare-select { width: 100%; }

/* Visible date inputs: styled to match the venue-btn style */
.date-input,
.movers-date-form input[type="date"],
.tips-date-form input[type="date"] {
    background: var(--site-surface-3); border: 1px solid var(--site-border);
    border-radius: 6px; color: var(--site-text); font-size: 0.78rem; font-weight: 700;
    padding: 0.26rem 0.65rem; outline: none; font-family: inherit;
    transition: border-color 0.1s, color 0.1s; cursor: pointer; color-scheme: dark;
}
.date-input:hover, .date-input:focus,
.movers-date-form input[type="date"]:hover,
.movers-date-form input[type="date"]:focus,
.tips-date-form input[type="date"]:hover,
.tips-date-form input[type="date"]:focus { border-color: var(--site-accent); }
.wa-light .date-input,
.wa-light .movers-date-form input[type="date"],
.wa-light .tips-date-form input[type="date"] { color-scheme: light; }

/* select.form-input — custom arrow for selects using the form-input class */
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a1a1aa'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.75rem center;
    padding-right: 2.25rem;
}
.wa-light select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2371717a'/%3E%3C/svg%3E");
}
