:root {
    --bg: #0b1020;
    --bg-soft: #141b33;
    --card: #161e3a;
    --card-hover: #1c264a;
    --line: #243156;
    --text: #e8ecf8;
    --muted: #8b97bd;
    --accent: #46e6a0;
    --accent-dim: #2bbd82;
    --live: #ff5c7a;
    --back: #6db3ff;
    --lay: #ffb4c6;
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    --radius: 16px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(1200px 600px at 80% -10%, #1a2547 0%, var(--bg) 55%);
    color: var(--text);
    min-height: 100vh;
}

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    padding: 22px clamp(16px, 4vw, 48px);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    background: rgba(11, 16, 32, 0.82);
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    font-size: 34px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.brand h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: -0.5px;
}

.tagline {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.controls {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

.field input {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 14px;
    color-scheme: dark;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
    box-shadow: 0 0 0 0 rgba(70, 230, 160, 0.6);
}

.dot.online {
    background: var(--accent);
    animation: pulse 2s infinite;
}

.dot.offline {
    background: var(--live);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(70, 230, 160, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(70, 230, 160, 0); }
    100% { box-shadow: 0 0 0 0 rgba(70, 230, 160, 0); }
}

/* ---------- Layout ---------- */
main {
    padding: 28px clamp(16px, 4vw, 48px) 60px;
}

.summary {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 18px;
}

.summary strong {
    color: var(--text);
}

.banner {
    background: rgba(255, 92, 122, 0.12);
    border: 1px solid rgba(255, 92, 122, 0.4);
    color: #ffd2dc;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
}

.board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    align-items: start;
    gap: 18px;
}

/* ---------- Card ---------- */
.card {
    background: linear-gradient(180deg, var(--card) 0%, #131a32 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, border-color 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-dim);
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.competition {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-soft);
    color: var(--muted);
    border: 1px solid var(--line);
    white-space: nowrap;
}

.badge.live {
    background: rgba(255, 92, 122, 0.16);
    color: var(--live);
    border-color: rgba(255, 92, 122, 0.5);
}

.event {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
    color: var(--muted);
}

.runners {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.runner {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.runner-name {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.price {
    min-width: 54px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 14px;
    padding: 5px 0;
    border-radius: 8px;
    background: #0d1430;
    border: 1px solid var(--line);
    transition: background 0.4s ease, color 0.4s ease;
}

.price.back { color: var(--back); }
.price.lay { color: var(--lay); }
.price.empty { color: var(--muted); font-weight: 500; }

.price.flash-up {
    background: rgba(70, 230, 160, 0.25);
    color: #d6ffe9;
}

.price.flash-down {
    background: rgba(255, 92, 122, 0.22);
    color: #ffdfe6;
}

.runner-head {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
    padding: 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.runner-head .price-label {
    min-width: 54px;
    text-align: center;
}

.card-foot {
    margin-top: auto;
    padding-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- States ---------- */
/* Page-level "no matches" message. Scoped to .empty-state so it never collides
   with the .price.empty modifier used on empty odds cells. */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text);
}

.muted {
    color: var(--muted);
}

.hidden {
    display: none !important;
}

.footer {
    border-top: 1px solid var(--line);
    padding: 20px clamp(16px, 4vw, 48px);
    color: var(--muted);
    font-size: 12.5px;
    max-width: 820px;
}

.footer strong {
    color: var(--text);
}

/* skeleton loading */
.skeleton {
    height: 220px;
    border-radius: var(--radius);
    background: linear-gradient(100deg, #141b33 30%, #1c264a 50%, #141b33 70%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite;
    border: 1px solid var(--line);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
