/* Season Standings — sits on top of results-v4.css tokens.
   NHRDA-style dense table with our hybrid additions: profile links,
   per-event breakdown tooltips, award-eligibility ★ marker, winner/RU
   subtle highlight in the per-event cells. */

.standings-page .standings-banner {
    margin: 20px 24px;
    padding: 12px 16px;
    border-left: 3px solid #e0b656;
    background: rgba(224,182,86,.06);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.5;
}
.standings-page .standings-banner strong {
    color: #e0b656;
    margin-right: 6px;
}

/* ───────── Tabs ───────── */
.standings-page .standings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 24px;
    margin: 16px 0 0;
    border-bottom: 1px solid var(--line);
}
.standings-page .standings-tab {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 10px 14px;
    margin-bottom: -1px;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-mute);
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
    transition: color .15s, background .15s, border-color .15s;
}
.standings-page .standings-tab:hover {
    color: var(--text-bright, #fff);
    background: var(--bg-2);
}
.standings-page .standings-tab.is-active {
    color: var(--text-bright, #fff);
    background: var(--bg-1);
    border-color: var(--line);
}
.standings-page .standings-tab .count {
    font-family: var(--f-mono);
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--bg-2);
    color: var(--text-mute);
}
.standings-page .standings-tab.is-active .count {
    background: rgba(255,215,0,0.1);
    color: var(--gold);
}

/* Panels */
.standings-page .standings-panel { display: none; }
.standings-page .standings-panel.is-active { display: block; }

/* ───────── Table ───────── */
.standings-page .standings-table-wrap {
    margin: 0 24px;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 6px 6px;
    background: var(--bg-1);
    overflow-x: auto;
}
.standings-page .standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.standings-page .standings-table thead th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-2);
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-mute);
    border-bottom: 1px solid var(--line);
    vertical-align: bottom;
    white-space: nowrap;
}
.standings-page .standings-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.standings-page .standings-table tbody tr:last-child td { border-bottom: 0; }
.standings-page .standings-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Column widths + alignment */
.standings-page .standings-table .col-pos    { text-align: center; width: 48px; }
.standings-page .standings-table .col-num    { text-align: right; width: 72px; font-family: var(--f-mono); color: var(--text-mute); }
.standings-page .standings-table .col-event  { text-align: center; min-width: 60px; }
.standings-page .standings-table .col-total  { text-align: right; width: 72px; }

/* Pos: rank number */
.standings-page .standings-table tbody .col-pos {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
    color: var(--text-dim);
}
/* Subtle award-threshold star next to rank (replaces colored medals) */
.standings-page .standings-table tbody tr.eligible .col-pos::after {
    content: '★';
    display: inline-block;
    margin-left: 4px;
    color: var(--gold);
    font-size: 10px;
    vertical-align: top;
    line-height: 1;
}

/* Racer name — bold, linked when profile exists */
.standings-page .standings-table tbody .col-racer {
    font-weight: 700;
    color: var(--text-bright, #fff);
}
.standings-page .standings-table tbody .col-racer a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted transparent;
}
.standings-page .standings-table tbody .col-racer a:hover {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

/* Event column header — two lines: abbr (bold) + date (small) */
.standings-page .standings-table thead .col-event .ev-abbr {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.08em;
}
.standings-page .standings-table thead .col-event .ev-date {
    display: block;
    margin-top: 2px;
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--text-mute);
}

/* Per-event point cell */
.standings-page .standings-table .ev-pts {
    display: inline-block;
    min-width: 26px;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--f-mono);
    font-size: 12px;
    color: var(--text-dim);
    cursor: help;
}
.standings-page .standings-table .ev-pts.ev-clickable {
    cursor: pointer;
    transition: box-shadow 0.12s ease, transform 0.12s ease;
}
.standings-page .standings-table .ev-pts.ev-clickable:hover,
.standings-page .standings-table .ev-pts.ev-clickable:focus-visible {
    box-shadow: 0 0 0 1px var(--gold);
    outline: none;
}
.standings-page .standings-table .ev-pts.is-winner {
    color: #111;
    background: var(--gold);
    font-weight: 700;
}
.standings-page .standings-table .ev-pts.is-ru {
    color: var(--gold);
    border: 1px solid rgba(255,215,0,0.4);
}
.standings-page .standings-table .ev-skip {
    color: var(--text-mute);
    font-family: var(--f-mono);
    font-size: 12px;
}

/* Total — bold, larger */
.standings-page .standings-table tbody .col-total b {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-bright, #fff);
}

/* ───────── Legend ───────── */
.standings-page .standings-legend {
    margin: 12px 24px 32px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 6px 6px;
    background: var(--bg-2);
    font-size: 12px;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.standings-page .standings-legend .legend-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}
.standings-page .standings-legend .legend-label {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-mute);
}
.standings-page .standings-legend .legend-event {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}
.standings-page .standings-legend .legend-event b {
    font-family: var(--f-mono);
    color: var(--gold);
    font-size: 11px;
    letter-spacing: 0.08em;
}
.standings-page .standings-legend .legend-event a {
    color: var(--text-dim);
    text-decoration: none;
    border-bottom: 1px dotted transparent;
}
.standings-page .standings-legend .legend-event a:hover {
    color: var(--gold);
    border-bottom-color: var(--gold);
}
.standings-page .standings-legend .legend-date {
    font-size: 11px;
    color: var(--text-mute);
}
.standings-page .standings-legend .legend-key {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-mute);
}
.standings-page .standings-legend .legend-key .award-star {
    color: var(--gold);
    font-size: 11px;
}

/* ───────── Points breakdown modal ───────── */
.pts-modal { display: none; }
.pts-modal.is-open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
body.pts-modal-open { overflow: hidden; }
.pts-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(3px);
    animation: ptsFade 0.18s ease;
}
.pts-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: 88vh;
    overflow-y: auto;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
    animation: ptsPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes ptsFade { from { opacity: 0; } }
@keyframes ptsPop  { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) {
    .pts-modal__overlay, .pts-modal__dialog { animation: none; }
}

/* Header — gold-accented band */
.pts-modal__head {
    position: relative;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 215, 0, 0.06), transparent 70%),
        var(--bg-2);
    border-radius: 12px 12px 0 0;
}
.pts-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-mute);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.pts-modal__close:hover {
    color: var(--text-bright, #fff);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--line);
}
.pts-modal__class {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
}
.pts-modal__title {
    margin: 5px 0 3px;
    padding-right: 30px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 25px;
    color: var(--text-bright, #fff);
    line-height: 1.05;
}
.pts-modal__event {
    font-size: 12px;
    color: var(--text-mute);
    font-family: var(--f-mono);
}
.pts-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--f-mono);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    vertical-align: middle;
    transform: translateY(-2px);
}
.pts-tag--win { background: var(--gold); color: #111; font-weight: 700; }
.pts-tag--ru {
    color: var(--gold);
    border: 1px solid rgba(255, 215, 0, 0.45);
    background: rgba(255, 215, 0, 0.08);
}

/* Scorecard — the totals breakdown */
.pts-modal__table { width: calc(100% - 44px); border-collapse: collapse; margin: 6px 22px; }
.pts-modal__table th,
.pts-modal__table td {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
}
.pts-modal__table tr:last-child th,
.pts-modal__table tr:last-child td { border-bottom: 0; }
.pts-modal__table th {
    text-align: left;
    font-weight: 500;
    color: var(--text-dim);
}
.pts-modal__table td {
    text-align: right;
    font-family: var(--f-mono);
    font-weight: 600;
    color: var(--text-bright, #fff);
    white-space: nowrap;
}
.pts-modal__table tr.is-penalty td { color: #ff6b6b; }
/* TOTAL — boxed gold footer */
.pts-modal__table tr.is-total th,
.pts-modal__table tr.is-total td {
    border-bottom: 0;
    padding: 12px 12px;
    background: rgba(255, 215, 0, 0.09);
    border-top: 1px solid rgba(255, 215, 0, 0.25);
}
.pts-modal__table tr.is-total th {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-bright, #fff);
    border-radius: 6px 0 0 6px;
}
.pts-modal__table tr.is-total td {
    font-size: 20px;
    font-weight: 700;
    color: var(--gold);
    border-radius: 0 6px 6px 0;
}

/* Round-by-round detail */
.pts-detail__loading {
    margin: 6px 22px 18px;
    font-size: 12px;
    color: var(--text-mute);
    display: flex;
    align-items: center;
    gap: 8px;
}
.pts-detail__loading::before {
    content: "";
    width: 12px; height: 12px;
    border: 2px solid var(--line);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: ptsSpin 0.7s linear infinite;
}
@keyframes ptsSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pts-detail__loading::before { animation: none; } }

.pts-detail { margin: 16px 22px 18px; }
.pts-detail__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 6px;
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-mute);
}
.pts-detail__head::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}
.pts-round {
    display: grid;
    grid-template-columns: 58px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 8px 12px;
    border-left: 3px solid var(--line);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    border-radius: 0 4px 4px 0;
}
.pts-round:last-child { border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.pts-round--win  { border-left-color: var(--gold); }
.pts-round--loss { border-left-color: #ff6b6b; }
.pts-round--bye  { border-left-color: var(--text-mute); }
.pts-round--qual { border-left-color: rgba(255, 255, 255, 0.12); }
.pts-round--win  { background: rgba(255, 215, 0, 0.04); }
.pts-round__label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.pts-round__body { min-width: 0; color: var(--text-bright, #fff); line-height: 1.35; }
.pts-round__head { display: block; }
.pts-round__head .pts-vs {
    color: var(--text-mute);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 2px;
}
.pts-round__head .pts-opp { font-weight: 600; }
.pts-round__head .pts-opp-num { font-family: var(--f-mono); color: var(--text-dim); font-size: 12px; }
.pts-round__run {
    display: block;
    margin-top: 1px;
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--text-mute);
}
.pts-round__note {
    display: block;
    font-size: 11px;
    font-style: italic;
    color: var(--text-mute);
}
.pts-round--qual .pts-round__body { color: var(--text-dim); }
.pts-round__pts {
    font-family: var(--f-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
    text-align: right;
    white-space: nowrap;
}
.pts-round__pts--zero { color: var(--text-mute); }

.pts-modal__note {
    margin: 0;
    padding: 13px 22px 18px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--text-mute);
    line-height: 1.45;
}

/* Mobile */
@media (max-width: 768px) {
    .standings-page .standings-tabs { padding: 0 12px; }
    .standings-page .standings-table-wrap,
    .standings-page .standings-legend { margin-left: 12px; margin-right: 12px; }
    .standings-page .standings-tab { font-size: 12px; padding: 8px 10px; }
    .pts-modal { padding: 0; align-items: flex-end; }
    .pts-modal__dialog {
        max-width: none;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        border-bottom: 0;
    }
    .pts-modal__head { border-radius: 16px 16px 0 0; }
}
