/* ===========================================
   Broadcast Redesign: Scoped Shell + Standings
   =========================================== */

.bc[data-theme="light"] {
    --bc-bg: #F4F1EA;
    --bc-bg-1: #FFFFFF;
    --bc-bg-2: #EAE6DD;
    --bc-bg-3: #DAD3C5;
    --bc-bg-4: #C7BEAA;
    --bc-text: #0F0F0F;
    --bc-text-2: #555;
    --bc-text-3: #888;
    --bc-line: rgba(0,0,0,0.10);
    --bc-line-2: rgba(0,0,0,0.06);
}

.bc[data-density="compact"] { --bc-density: 0.78; }
.bc[data-density="comfortable"] { --bc-density: 1; }
.bc[data-density="cozy"] { --bc-density: 1.15; }

.bc,
.bc div,
.bc p,
.bc span,
.bc label,
.bc h1,
.bc h2,
.bc h3,
.bc h4,
.bc h5,
.bc h6,
.bc button {
    color: inherit !important;
}

.bc {
    background: var(--bc-bg);
    color: var(--bc-text);
    font-family: var(--bc-font-body);
    font-feature-settings: 'tnum';
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.bc-page-shell,
.bc-page {
    min-width: 0;
}

/* Ribbon */
.bc-ribbon {
    display: flex;
    align-items: stretch;
    height: 60px;
    background: var(--bc-bg-1);
    border-bottom: 4px solid var(--bc-accent);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.bc-ribbon-mark {
    width: 60px;
    background: var(--bc-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.bc-ribbon-mark::after {
    content: '';
    position: absolute;
    right: -22px;
    top: 0;
    width: 0;
    height: 0;
    border-left: 22px solid var(--bc-accent);
    border-top: 30px solid transparent;
    border-bottom: 30px solid transparent;
}

.bc-ribbon-mark-text {
    font-family: var(--bc-font-display);
    color: white !important;
    font-size: 22px;
    line-height: 1;
}

.bc-ribbon-title {
    display: flex;
    align-items: center;
    padding: 0 28px 0 44px;
    font-family: var(--bc-font-display);
    font-size: 17px;
    flex-shrink: 0;
    white-space: nowrap;
}

.bc-ribbon-title span { color: var(--bc-accent) !important; }

.bc-ribbon-tabs {
    display: flex;
    flex: 1 1 auto;
    align-items: stretch;
    min-width: 0;
}

.bc-ribbon-tabs .tab-content {
    display: none;
}

.bc-ribbon-nav {
    display: flex;
    flex: 1;
    align-items: stretch;
    gap: 0;
    border-left: 1px solid var(--bc-line);
    overflow-x: auto;
    scrollbar-width: none;
    height: 100%;
}

.bc-ribbon-nav::-webkit-scrollbar { display: none; }

.bc-ribbon-nav .dash-tabs-container,
.bc-ribbon-nav .dash-tabs,
.bc-ribbon-nav .tab-container {
    height: 100%;
}

.bc-ribbon-nav .dash-tabs {
    display: flex !important;
    flex: 1;
    background: transparent !important;
    border: 0 !important;
}

.bc-ribbon-nav .dash-tab,
.bc-ribbon-nav .tab,
.bc-rn-item {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 56px !important;
    padding: 0 22px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-family: var(--bc-font-body) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: 0.16em !important;
    text-transform: uppercase !important;
    color: var(--bc-text-2) !important;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
}

.bc-ribbon-nav .dash-tab:hover,
.bc-ribbon-nav .tab:hover,
.bc-rn-item:hover {
    color: var(--bc-text) !important;
}

.bc-ribbon-nav .dash-tab--selected,
.bc-ribbon-nav .tab--selected,
.bc-rn-item.active {
    color: var(--bc-text) !important;
    background: var(--bc-bg-2) !important;
}

.bc-ribbon-nav .dash-tab--selected::after,
.bc-ribbon-nav .tab--selected::after,
.bc-rn-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--bc-yellow);
}

.bc-ribbon-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    border-left: 1px solid var(--bc-line);
    flex-shrink: 0;
}

.bc-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bc-bg-2);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bc-text) !important;
}

.bc-meta-pill.live {
    background: var(--bc-accent);
    color: white !important;
}

.bc-meta-pill.live::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    animation: bc-pulse 1.4s infinite;
}

.bc[data-motion="off"] .bc-meta-pill.live::before { animation: none; }

@keyframes bc-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Subnav */
.bc-subnav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    border-bottom: 1px solid var(--bc-line);
    background: var(--bc-bg);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.bc-season-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.bc-season-picker label,
.bc-sub-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bc-bg-1);
    border: 1px solid var(--bc-line);
    border-radius: 0;
    font-family: var(--bc-font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    color: var(--bc-text-2) !important;
}

.bc-season-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.bc-season-picker label:has(input:checked),
.bc-sub-pill.active {
    color: var(--bc-text) !important;
    background: var(--bc-bg-3);
    border-color: var(--bc-text-3);
}

.bc-season-picker label:hover,
.bc-sub-pill:hover {
    color: var(--bc-text) !important;
}

.bc-sub-spacer { flex: 1; }

.bc-sub-updated {
    font-family: var(--bc-font-mono);
    font-size: 11px;
    color: var(--bc-text-3) !important;
    letter-spacing: 0.1em;
}

.bc-sub-refresh {
    padding: 7px 14px;
    background: var(--bc-accent);
    color: white !important;
    border: 0;
    border-radius: 0 !important;
    font-family: var(--bc-font-mono) !important;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
}

.bc-refresh-status {
    font-family: var(--bc-font-mono);
    font-size: 11px;
    color: var(--bc-text-2) !important;
    max-width: 300px;
}

/* Hero */
.bc-hero {
    position: relative;
    padding: calc(28px * var(--bc-density)) 32px calc(34px * var(--bc-density));
    background: var(--bc-bg);
    border-bottom: 1px solid var(--bc-line);
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 28px;
    flex-shrink: 0;
    overflow: hidden;
}

.bc-hero::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -100px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,45,45,0.18), transparent 60%);
    pointer-events: none;
}

.bc-hero-copy,
.bc-hero-leader {
    position: relative;
    z-index: 1;
}

.bc-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--bc-accent) !important;
    margin-bottom: 8px;
}

.bc-hero-eyebrow::before {
    content: '';
    width: 30px;
    height: 2px;
    background: var(--bc-accent);
}

.bc-hero h1 {
    font-family: var(--bc-font-display);
    font-size: clamp(36px, 5.4vw, 72px);
    line-height: 0.92;
    letter-spacing: -0.04em;
    margin: 0;
    color: var(--bc-text) !important;
}

.bc-hero h1 em {
    font-style: normal;
    color: var(--bc-accent) !important;
}

.bc-hero h1 .slash {
    color: var(--bc-yellow) !important;
    font-style: italic;
    display: inline-block;
    transform: skewX(-12deg);
}

.bc-hero-sub {
    margin-top: 14px;
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    font-family: var(--bc-font-mono);
    font-size: 12px;
    color: var(--bc-text-2) !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bc-hero-sub strong {
    color: var(--bc-text) !important;
}

.bc-hero-leader {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bc-bg-1);
    padding: 22px;
    border-left: 4px solid var(--bc-accent);
}

.bc-hero-leader-eyebrow {
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--bc-text-3) !important;
    font-weight: 700;
}

.bc-hero-leader-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bc-hero-leader-icon {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border: 2px solid var(--bc-accent);
    flex-shrink: 0;
}

.bc-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bc-bg-3);
    font-family: var(--bc-font-display);
}

.bc-hero-leader-copy {
    flex: 1;
    min-width: 0;
}

.bc-hero-leader-name {
    font-family: var(--bc-font-display);
    font-size: 22px;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.bc-hero-leader-team {
    font-family: var(--bc-font-mono);
    font-size: 11px;
    color: var(--bc-text-2) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bc-hero-leader-pts {
    font-family: var(--bc-font-display);
    font-size: 56px;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--bc-yellow) !important;
}

.bc-hero-leader-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-family: var(--bc-font-mono);
    font-size: 11px;
    color: var(--bc-text-2) !important;
}

.bc-hero-leader-meta span:first-child {
    color: var(--bc-green) !important;
}

/* Main grid and blocks */
.bc-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 0;
    min-height: 0;
}

.bc-col {
    background: var(--bc-bg);
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.bc-col + .bc-col {
    border-left: 1px solid var(--bc-line);
}

.bc[data-layout="single"] .bc-main { grid-template-columns: 1fr; }
.bc[data-layout="single"] .bc-rail { display: none; }

.bc-block {
    padding: calc(20px * var(--bc-density)) 28px;
    border-bottom: 1px solid var(--bc-line);
}

.bc-block-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 14px;
    flex-wrap: wrap;
}

.bc-block-title {
    font-family: var(--bc-font-display);
    font-size: 22px;
    line-height: 1;
    letter-spacing: -0.02em;
}

.bc-block-title em,
.bc-rail-title em {
    color: var(--bc-accent) !important;
    font-style: normal;
}

.bc-block-head-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.bc-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--bc-bg-2);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bc-text-2) !important;
}

.bc-tag.red {
    background: var(--bc-accent);
    color: white !important;
}

.bc-tag.yellow {
    background: var(--bc-yellow);
    color: #000 !important;
}

/* Standings rows */
.bc-stand {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bc-row {
    display: grid;
    grid-template-columns: 56px 1fr 96px 120px 70px;
    align-items: center;
    gap: 14px;
    padding: calc(12px * var(--bc-density)) 16px;
    background: var(--bc-bg-1);
    border-left: 4px solid transparent;
    position: relative;
    transition: transform 0.18s ease;
}

.bc[data-motion="on"] .bc-row:hover {
    transform: translateX(2px);
}

.bc-row.p1 {
    background: linear-gradient(90deg, rgba(255,236,0,0.10), var(--bc-bg-1) 50%);
    border-left-color: var(--bc-yellow);
}

.bc-row.p2 { border-left-color: rgba(220,220,220,0.5); }
.bc-row.p3 { border-left-color: #CD7F32; }

.bc-row-pos {
    font-family: var(--bc-font-display);
    font-size: 32px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.bc-row.p1 .bc-row-pos { color: var(--bc-yellow) !important; }
.bc-row.p2 .bc-row-pos { color: #DDD !important; }
.bc-row.p3 .bc-row-pos { color: #CD7F32 !important; }

.bc-row-team {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.bc-row-icon {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border: 1px solid var(--bc-line);
    flex-shrink: 0;
    font-size: 12px;
}

.bc-row-id {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bc-row-owner {
    font-weight: 700;
    font-size: 14px;
}

.bc-row-fname {
    font-family: var(--bc-font-mono);
    font-size: 11px;
    color: var(--bc-text-2) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bc-row-spark {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.bc-spark-graph {
    width: 88px;
    height: 34px;
}

.bc-spark-graph .js-plotly-plot,
.bc-spark-graph .plot-container {
    width: 88px !important;
    height: 34px !important;
}

.bc-spark-label {
    font-family: var(--bc-font-mono);
    font-size: 9px;
    color: var(--bc-text-3) !important;
    letter-spacing: 0.12em;
}

.bc-row-pts {
    text-align: right;
    min-width: 0;
}

.bc-row-pts-big {
    font-family: var(--bc-font-display);
    font-size: 26px;
    line-height: 1;
    letter-spacing: -0.03em;
}

.bc-row-pts-meta {
    font-family: var(--bc-font-mono);
    font-size: 10px;
    color: var(--bc-text-3) !important;
    margin-top: 2px;
    letter-spacing: 0.06em;
}

.bc-row-pts-meta .neg { color: var(--bc-accent) !important; }

.bc-row-delta {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--bc-font-display);
    font-size: 16px;
    padding: 8px 0;
    background: var(--bc-bg-2);
}

.bc-row-delta.up { color: var(--bc-green) !important; }
.bc-row-delta.down { color: var(--bc-accent) !important; }
.bc-row-delta.flat { color: var(--bc-text-3) !important; }

/* Calendar and charts */
.bc-races {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.bc-races::-webkit-scrollbar { height: 6px; }
.bc-races::-webkit-scrollbar-thumb { background: var(--bc-bg-3); }

.bc-race {
    flex: 0 0 110px;
    background: var(--bc-bg-1);
    padding: 12px 14px;
    border-top: 3px solid var(--bc-line);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bc-race.done { border-top-color: var(--bc-accent); }
.bc-race.next {
    border-top-color: var(--bc-yellow);
    background: linear-gradient(180deg, rgba(255,236,0,0.10), var(--bc-bg-1));
}
.bc-race.upcoming { opacity: 0.45; }

.bc-race-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bc-race-rd {
    font-family: var(--bc-font-mono);
    font-size: 10px;
    color: var(--bc-text-3) !important;
    letter-spacing: 0.1em;
}

.bc-race.next .bc-race-rd { color: var(--bc-yellow) !important; }
.bc-race-flag { font-size: 18px; }
.bc-race-name { font-weight: 800; font-size: 13px; }
.bc-race-date {
    font-family: var(--bc-font-mono);
    font-size: 10px;
    color: var(--bc-text-2) !important;
}

.bc-chart-wrap {
    background: var(--bc-bg-1);
    padding: 16px 12px 10px;
}

.bc-arc-graph {
    min-height: 260px;
}

/* Rail */
.bc-rail-card {
    padding: calc(20px * var(--bc-density)) 22px;
    border-bottom: 1px solid var(--bc-line);
    background: var(--bc-bg);
}

.bc-rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.bc-rail-title {
    font-family: var(--bc-font-display);
    font-size: 18px;
    letter-spacing: -0.02em;
}

.bc-driver {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--bc-line-2);
}

.bc-driver:last-child { border-bottom: 0; }

.bc-driver-pos {
    font-family: var(--bc-font-display);
    font-size: 16px;
    color: var(--bc-text-3) !important;
}

.bc-driver.p1 .bc-driver-pos { color: var(--bc-yellow) !important; }

.bc-driver-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.bc-driver-bar {
    width: 4px;
    height: 22px;
    flex-shrink: 0;
}

.bc-driver-copy {
    min-width: 0;
}

.bc-driver-text {
    font-weight: 700;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bc-driver-team {
    font-family: var(--bc-font-mono);
    font-size: 10px;
    color: var(--bc-text-3) !important;
    letter-spacing: 0.1em;
}

.bc-driver-pts {
    font-family: var(--bc-font-display);
    font-size: 14px;
}

.bc-rail-empty,
.bc-empty-state {
    font-family: var(--bc-font-mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--bc-text-2) !important;
}

.bc-cd {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.bc-cd-cell {
    background: var(--bc-bg-1);
    padding: 10px 0;
    text-align: center;
}

.bc-cd-val {
    font-family: var(--bc-font-display);
    font-size: 22px;
    line-height: 1;
    color: var(--bc-yellow) !important;
}

.bc-cd-lbl {
    font-size: 9px;
    color: var(--bc-text-3) !important;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-top: 4px;
}

.bc-next-flag-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.bc-next-flag {
    width: 56px;
    height: 56px;
    background: var(--bc-bg-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}

.bc-next-name {
    font-family: var(--bc-font-display);
    font-size: 16px;
    letter-spacing: -0.02em;
}

.bc-next-country {
    font-family: var(--bc-font-mono);
    font-size: 11px;
    color: var(--bc-text-2) !important;
    letter-spacing: 0.1em;
}

.bc-next-note {
    font-family: var(--bc-font-mono);
    font-size: 12px;
    line-height: 1.55;
    color: var(--bc-text-2) !important;
    letter-spacing: 0.02em;
}

.bc-next-note strong {
    color: var(--bc-yellow) !important;
}

@media (max-width: 1100px) {
    .bc-main { grid-template-columns: 1fr; }
    .bc-col + .bc-col {
        border-left: 0;
        border-top: 1px solid var(--bc-line);
    }
}

@media (max-width: 760px) {
    .bc-ribbon {
        flex-wrap: wrap;
        height: auto;
    }

    .bc-ribbon-mark {
        height: 56px;
    }

    .bc-ribbon-mark::after {
        border-top-width: 28px;
        border-bottom-width: 28px;
    }

    .bc-ribbon-tabs {
        order: 3;
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
        height: 52px;
        min-width: 0;
    }

    .bc-ribbon-nav {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
        height: 52px;
        border-left: 0;
        border-top: 1px solid var(--bc-line);
    }

    .bc-ribbon-nav .dash-tabs {
        flex: none;
        width: max-content;
        min-width: 100%;
    }

    .bc-ribbon-nav .dash-tab,
    .bc-ribbon-nav .tab,
    .bc-rn-item {
        flex: 0 0 auto !important;
        min-height: 52px !important;
    }

    .bc-hero {
        grid-template-columns: minmax(0, 1fr);
        padding: 22px 18px 26px;
        gap: 18px;
    }

    .bc-hero-copy {
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    .bc-hero h1 {
        font-size: 32px;
        line-height: 0.98;
        max-width: 100%;
        width: 100%;
        white-space: normal;
        overflow-wrap: normal;
    }

    .bc-hero h1 .bc-headline-primary {
        display: block;
    }

    .bc-hero h1 em {
        display: inline;
    }

    .bc-block { padding: 18px 14px; }

    .bc-row {
        grid-template-columns: 38px 1fr auto;
        gap: 10px;
        padding: 12px;
    }

    .bc-row-spark,
    .bc-row-delta {
        display: none;
    }

    .bc-row-pos { font-size: 24px; }
    .bc-row-pts-big { font-size: 20px; }
    .bc-row-icon { width: 36px; height: 36px; }

    .bc-ribbon-title {
        padding: 0 14px 0 34px;
        font-size: 14px;
        flex: 1;
        min-width: 0;
    }

    .bc-ribbon-meta { display: none; }
    .bc-ribbon-nav .dash-tab,
    .bc-ribbon-nav .tab,
    .bc-rn-item {
        padding: 0 14px !important;
        font-size: 11px !important;
    }

    .bc-subnav { padding: 10px 14px; }
    .bc-sub-updated { display: none; }
    .bc-cd { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 360px) {
    .bc-hero h1 {
        font-size: 28px;
    }
}
