/**
 * VSR — Premium Glassmorphic Theme Layer
 *
 * Additive visual layer: Geist typography, glass surfaces, depth shadows,
 * animations, and ambient effects. Loads AFTER layout.css. Uses --kb-*
 * variables for colors (all 44 themes supported), --vt-* for effects.
 *
 * Geist fonts v1.8.0 — vendored from https://github.com/vercel/geist-font
 */

/* ============================================================================
   FONT FACES
   Variable fonts — single file covers weight range 100-900
   ============================================================================ */

@font-face {
    font-family: 'Geist';
    src: url('../vendor/fonts/GeistVF.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geist Mono';
    src: url('../vendor/fonts/GeistMonoVF.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ============================================================================
   TYPOGRAPHY
   Global font override + data-oriented refinements
   ============================================================================ */

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    position: relative;
    z-index: 0;
}

/* Override Bootstrap's `.h-100` utility on the body element specifically.
 *
 * The maps / player / ODF pages (and their per-slug pre-gen stubs) all
 * open with `<body class="d-flex flex-column h-100">` — the standard
 * Bootstrap "sticky footer flexbox" pattern. Plain `.h-100` is
 * `height: 100% !important`, which combined with `<html class="h-100">`
 * clamps `body` to EXACTLY viewport height even when its content (a
 * tall card grid, etc.) overflows.
 *
 * Why that breaks `<nav class="sticky-top">`: a sticky element cannot
 * escape its containing block's bottom edge. The navbar's containing
 * block is `body`. As the document scrolls past
 * `body_height - navbar_height`, body's box slides up off-screen and
 * the navbar gets pinned to body's bottom — following it offscreen.
 * Result: navbar disappears once you scroll far enough.
 *
 * `min-height: 100%` preserves the sticky-footer behaviour (body still
 * fills the viewport on short pages so `main.flex-grow-1` can stretch),
 * but lets body grow with content so sticky descendants track the full
 * scroll height. The dashboard's `<body>` (no `h-100` class) is
 * unaffected — its body is already content-sized. */
body.h-100 {
    height: auto !important;
    min-height: 100%;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.01em;
}

.card-header h5 {
    letter-spacing: -0.015em;
    font-weight: 600;
}

.vt-mono {
    font-family: 'Geist Mono', ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

.stat-value {
    font-family: 'Geist Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    font-size: 1.5rem;
    font-weight: 700;
}

.table td.text-end,
.table th.text-end {
    font-variant-numeric: tabular-nums;
}

code, pre, .font-monospace {
    font-family: 'Geist Mono', ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
}

.navbar-brand {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.02em;
}

/* Theme foreground for the "VSR" brand link. Bootstrap's own
   .navbar-brand colour is near-black, which only shows on a shell that
   omits the inline colour the other pages carry (the Game Explorer). The
   :hover / :focus pair outranks Bootstrap's hover rule so the title stays
   put on hover; the crosshair icon takes the primary tint like every
   other shell. */
.navbar-brand,
.navbar-brand:hover,
.navbar-brand:focus {
    color: var(--kb-text-primary);
    text-decoration: none;
}

.navbar-brand > .bi {
    color: var(--kb-primary);
}

/* ============================================================================
   MIGRATED INLINE STYLES
   Moved from index.html <style> block for modularity
   ============================================================================ */

.chart-container {
    position: relative;
    min-height: 320px;
}

.chart-container-sm {
    position: relative;
    min-height: 200px;
}

/* Economy tab: P-D small-multiples pools chart. Two stacked lanes share a
   hard 0..peak y-scale; height is fixed so Chart.js (maintainAspectRatio:
   false) gets a definite box. Taller than the 115px preview so 1-count
   ticks have room; not chart-container-sm's 200px x 2. */
.vt-econ-pools-lanes {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vt-econ-pools-lane {
    position: relative;
    height: 160px;
}

#fullscreen-modal-body .vt-econ-pools-lanes {
    height: calc(100vh - 120px);
}

#fullscreen-modal-body .vt-econ-pools-lane {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
}

.vt-econ-loose-chart {
    position: relative;
    height: 280px;
}

#fullscreen-modal-body .vt-econ-loose-chart {
    height: calc(100vh - 160px);
}

.heatmap-cell {
    font-size: 0.75rem;
    min-width: 60px;
    padding: 4px !important;
    font-variant-numeric: tabular-nums;
}

.heatmap-header {
    font-size: 0.7rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    max-width: 40px;
    padding: 4px !important;
    white-space: nowrap;
}

.heatmap-corner {
    width: 100px;
}

.heatmap-row-header {
    font-size: 0.75rem;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rivalry-card {
    background: var(--kb-bg-card);
    border: 1px solid var(--kb-border-subtle);
}

.stat-card {
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--kb-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

th[data-sort] {
    cursor: pointer;
    user-select: none;
}

th[data-sort]:hover {
    color: var(--kb-primary);
}

th[data-sort].sort-active {
    color: var(--kb-primary);
    font-weight: 700;
}

/* Active-sort highlight must beat the higher-specificity muted color applied
   to split columns (#leaderboard / #career-table thead th.vt-col-split below),
   otherwise PvP/PvE split + per-match average columns never light up when they
   are the active sort column (including the default 'Dealt/m' sort). */
#leaderboard thead th[data-sort].sort-active,
#career-table thead th[data-sort].sort-active {
    color: var(--kb-primary);
    font-weight: 700;
}

.badge-f1 {
    background: var(--kb-primary);
    color: var(--kb-primary-fg);
}

.badge-f2 {
    background: var(--kb-accent);
    color: var(--kb-accent-fg);
}

.config-mod {
    font-size: 0.7rem;
    color: var(--kb-text-muted);
}

#all-matches-view {
    display: none;
}

/* ============================================================================
   FULLSCREEN BUTTONS — Borderless icon style
   ============================================================================ */

[data-expand] {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--kb-text-muted);
    padding: 0.375rem;
    border-radius: 6px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

[data-expand]:hover {
    color: var(--kb-text-primary);
    background: var(--kb-bg-muted) !important;
}

[data-expand]:focus {
    box-shadow: none !important;
}

/* ============================================================================
   EFFECT CUSTOM PROPERTIES — --vt-* namespace
   Controls visual effects; --kb-* controls colors
   ============================================================================ */

:root {
    /* Glass */
    --vt-glass-blur: 14px;
    --vt-glass-opacity: 87%;
    --vt-glass-border-luminance: 8%;

    /* Depth — multi-layer shadow tokens */
    --vt-shadow-elevation-1:
        0 1px 2px rgba(0, 0, 0, 0.12),
        0 4px 8px rgba(0, 0, 0, 0.08);
    --vt-shadow-elevation-2:
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 8px 24px rgba(0, 0, 0, 0.12);
    --vt-shadow-elevation-3:
        0 4px 8px rgba(0, 0, 0, 0.12),
        0 16px 48px rgba(0, 0, 0, 0.16);

    /* Animation */
    --vt-anim-stagger: 50ms;
    --vt-anim-duration: 0.4s;
    --vt-anim-ease: cubic-bezier(0.16, 1, 0.3, 1);

    /* Chart effects */
    --vt-chart-shadow-blur: 5px;
    --vt-chart-shadow-opacity: 0.12;

    /* Ambient background */
    --vt-ambient-opacity: 0.06;

    /* Map thumbnail brightness lift.
       Applied selectively to <img> surfaces tagged with .vt-map-img-lift-1
       (dim) or .vt-map-img-lift-2 (dark). The classification is computed
       once at pipeline time (`compute_image_luma()` in
       scripts/build_map_registry.py) and persisted on the registry as
       `luma_band`. Bright maps get no class — no filter cost.
       The positioning heatmap canvas underlay applies equivalent literal
       filter strings (canvas `ctx.filter` cannot resolve `var(...)`); keep
       the two paths in sync when retuning. */
    --vt-map-img-lift-1: brightness(1.15) contrast(1.04);
    --vt-map-img-lift-2: brightness(1.30) contrast(1.06) saturate(1.05);

    /* Fixed high-contrast team colors for Movemint heatmap spawn markers
       and per-player heatmap cells. Deliberately literal blue/red (not the
       themeable --kb-primary/--kb-accent) so opposing spawns always read
       clearly regardless of the active accent theme. */
    --vt-heatmap-team1: #3b82f6;
    --vt-heatmap-team2: #ef4444;

    /* YouTube brand mark — Watch VOD button only. Theme --kb-danger is
       not YouTube red (and shifts across palettes). */
    --vt-youtube: #ff0000;
}

/* Light mode — same effects, reduced intensity */
[data-mode="light"] {
    --vt-glass-blur: 10px;
    --vt-glass-opacity: 92%;
    --vt-glass-border-luminance: 5%;

    --vt-shadow-elevation-1:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 4px 8px rgba(0, 0, 0, 0.04);
    --vt-shadow-elevation-2:
        0 2px 4px rgba(0, 0, 0, 0.06),
        0 8px 24px rgba(0, 0, 0, 0.06);
    --vt-shadow-elevation-3:
        0 4px 8px rgba(0, 0, 0, 0.06),
        0 16px 48px rgba(0, 0, 0, 0.08);

    --vt-ambient-opacity: 0.03;
    --vt-chart-shadow-blur: 3px;
    --vt-chart-shadow-opacity: 0.06;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    :root {
        --vt-anim-duration: 0s;
        --vt-anim-stagger: 0ms;
    }
}

/* ============================================================================
   AMBIENT BACKGROUND
   Two soft radial gradient washes — adapts to active theme palette
   ============================================================================ */

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 10% 90%,
            color-mix(in oklab, var(--kb-primary) 6%, transparent),
            transparent 60%),
        radial-gradient(ellipse 50% 60% at 85% 15%,
            color-mix(in oklab, var(--kb-accent) 6%, transparent),
            transparent 60%);
}

[data-mode="light"] body::before {
    background:
        radial-gradient(ellipse 60% 50% at 10% 90%,
            color-mix(in oklab, var(--kb-primary) 3%, transparent),
            transparent 60%),
        radial-gradient(ellipse 50% 60% at 85% 15%,
            color-mix(in oklab, var(--kb-accent) 3%, transparent),
            transparent 60%);
}

/* ============================================================================
   GLASS SURFACES
   Translucent backgrounds with backdrop blur on primary surfaces
   ============================================================================ */

.card {
    background: color-mix(in oklab, var(--kb-bg-card) var(--vt-glass-opacity), transparent) !important;
    backdrop-filter: blur(var(--vt-glass-blur));
    -webkit-backdrop-filter: blur(var(--vt-glass-blur));
    border: 1px solid color-mix(in oklab, var(--kb-text-primary) var(--vt-glass-border-luminance), transparent) !important;
    box-shadow: var(--vt-shadow-elevation-1),
        inset 0 1px 0 color-mix(in oklab, white, transparent 92%) !important;
    transition: transform 0.25s var(--vt-anim-ease), box-shadow 0.25s var(--vt-anim-ease) !important;
}

.card:hover {
    box-shadow: var(--vt-shadow-elevation-2),
        inset 0 1px 0 color-mix(in oklab, white, transparent 88%) !important;
    transform: translateY(-2px);
    border-color: color-mix(in oklab, var(--kb-text-primary) 12%, transparent) !important;
}

.navbar {
    background: color-mix(in oklab, var(--kb-bg-card) var(--vt-glass-opacity), transparent) !important;
    backdrop-filter: blur(var(--vt-glass-blur));
    -webkit-backdrop-filter: blur(var(--vt-glass-blur));
    border-bottom: 1px solid color-mix(in oklab, var(--kb-text-primary) var(--vt-glass-border-luminance), transparent) !important;
}

/* World clocks: a full-width secondary bar flush under the dashboard navbar.
   Five equal rectangles by default. A sixth leading cell appears only when
   the viewer's timezone is not already one of the five. */
.vt-site-header {
    background: color-mix(in oklab, var(--kb-bg-card) var(--vt-glass-opacity), transparent);
    backdrop-filter: blur(var(--vt-glass-blur));
    -webkit-backdrop-filter: blur(var(--vt-glass-blur));
}

.vt-world-clocks {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid color-mix(in oklab, var(--kb-text-primary) var(--vt-glass-border-luminance), transparent);
}

.vt-world-clocks--extra {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.vt-world-clock {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    margin: 0;
    padding: 0.28rem 0.4rem;
    border-radius: 0;
    border-right: 1px solid color-mix(in oklab, var(--kb-text-primary) var(--vt-glass-border-luminance), transparent);
    background: transparent;
    color: var(--kb-text-secondary);
    font-size: 0.75rem;
    line-height: 1.3;
    white-space: nowrap;
}

.vt-world-clock:last-child {
    border-right: none;
}

.vt-world-clock--local {
    background: color-mix(in oklab, var(--kb-primary) 18%, transparent);
}

.vt-world-clock--local .vt-world-clock-time {
    color: var(--kb-primary);
}

.vt-world-clock-time {
    color: var(--kb-text-primary);
    font-weight: 600;
}

.vt-world-clock-place {
    display: contents;
}

.vt-world-clock-city::before,
.vt-world-clock-offset::before {
    content: "\00b7";
    margin-right: 0.35rem;
    color: var(--kb-text-muted);
}

.vt-world-clock-offset:empty {
    display: none;
}

/* Stack once a cell is too narrow for "4:42 PM · Los Angeles · UTC−7".
   Five columns fit that line from about 1100px. Six need about 1320px. */
@media (max-width: 1319.98px) {
    .vt-world-clocks--extra .vt-world-clock {
        flex-direction: column;
        align-items: center;
        gap: 0.05rem;
        white-space: normal;
        text-align: center;
        padding: 0.28rem 0.15rem;
    }

    .vt-world-clocks--extra .vt-world-clock-place {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        column-gap: 0.25rem;
        max-width: 100%;
        min-width: 0;
    }

    .vt-world-clocks--extra .vt-world-clock-city::before {
        content: none;
        margin: 0;
    }
}

@media (max-width: 1099.98px) {
    .vt-world-clock {
        flex-direction: column;
        align-items: center;
        gap: 0.05rem;
        white-space: normal;
        text-align: center;
        padding: 0.28rem 0.15rem;
    }

    .vt-world-clock-place {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        column-gap: 0.25rem;
        max-width: 100%;
        min-width: 0;
    }

    .vt-world-clock-city::before {
        content: none;
        margin: 0;
    }
}

.modal-content {
    background: color-mix(in oklab, var(--kb-bg-card) 92%, transparent) !important;
    backdrop-filter: blur(var(--vt-glass-blur));
    -webkit-backdrop-filter: blur(var(--vt-glass-blur));
    box-shadow: var(--vt-shadow-elevation-3);
}

.dropdown-menu {
    background: color-mix(in oklab, var(--kb-bg-card) 92%, transparent) !important;
    backdrop-filter: blur(var(--vt-glass-blur));
    -webkit-backdrop-filter: blur(var(--vt-glass-blur));
    box-shadow: var(--vt-shadow-elevation-2);
}

/* Topnav menus are solid: page content must never show through them. */
.navbar .dropdown-menu {
    background: var(--kb-bg-card) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Light mode: flip inset shadow from light edge to subtle dark edge */
[data-mode="light"] .card {
    box-shadow: var(--vt-shadow-elevation-1),
        inset 0 1px 0 color-mix(in oklab, black, transparent 96%);
}

[data-mode="light"] .card:hover {
    box-shadow: var(--vt-shadow-elevation-2),
        inset 0 1px 0 color-mix(in oklab, black, transparent 94%);
}

/* ============================================================================
   NAV-PILLS — Glass-styled tab navigation
   ============================================================================ */

#match-tabs,
#all-tabs {
    background: color-mix(in oklab, var(--kb-bg-card) 60%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 0.375rem;
    border: 1px solid color-mix(in oklab, var(--kb-text-primary) 5%, transparent);
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}
#match-tabs .nav-item,
#all-tabs .nav-item {
    flex: 0 0 auto;
}

#match-tabs .nav-link,
#all-tabs .nav-link {
    color: var(--kb-text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}

#match-tabs .nav-link:hover,
#all-tabs .nav-link:hover {
    color: var(--kb-text-primary);
    background: color-mix(in oklab, var(--kb-bg-muted) 60%, transparent);
}

#match-tabs .nav-link.active,
#all-tabs .nav-link.active {
    background: var(--kb-primary) !important;
    color: var(--kb-primary-fg) !important;
    box-shadow: 0 2px 8px color-mix(in oklab, var(--kb-primary), transparent 60%);
}

/* ============================================================================
   TABLE ROW HOVER — Subtle left-border indicator + text color fix
   ============================================================================ */

.table {
    --bs-table-hover-color: var(--kb-text-primary);
    --bs-table-hover-bg: var(--kb-bg-muted);
}

.table > tbody > tr {
    position: relative;
    transition: background-color 0.15s ease;
    color: var(--kb-text-primary);
}

.table > tbody > tr:hover {
    color: var(--kb-text-primary) !important;
}

.table > tbody > tr:hover td {
    color: inherit;
}

.table > tbody > tr::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--kb-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.table > tbody > tr:hover::after {
    opacity: 0.7;
}

/* ============================================================================
   RIVALRY CARD — Glass treatment
   ============================================================================ */

.rivalry-card {
    background: color-mix(in oklab, var(--kb-bg-card) var(--vt-glass-opacity), transparent) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid color-mix(in oklab, var(--kb-text-primary) var(--vt-glass-border-luminance), transparent) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rivalry-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--vt-shadow-elevation-1);
}

/* ============================================================================
   ANIMATION KEYFRAMES
   ============================================================================ */

@keyframes vt-card-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vt-enter {
    animation: vt-card-enter var(--vt-anim-duration) var(--vt-anim-ease) both;
    animation-delay: var(--vt-delay, 0ms);
}

/* Scroll-triggered reveal (fallback for non-tab content) */
.vt-scroll-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--vt-anim-duration) var(--vt-anim-ease),
                transform var(--vt-anim-duration) var(--vt-anim-ease);
}

.vt-scroll-reveal.vt-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Tab content fade transition enhancement */
.tab-pane.fade {
    transition: opacity 0.2s ease;
}

/* ============================================================================
   ERROR PANEL — Shown in place of the preloader when a shareable URL
   references a match that no longer exists. Provides a picker to recover.
   ============================================================================ */

.vt-error-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 60vh;
    text-align: center;
    padding: 1.5rem;
}

.vt-error-icon {
    font-size: 2.5rem;
    color: var(--kb-warning);
    line-height: 1;
}

.vt-error-title {
    font-family: 'Geist', sans-serif;
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--kb-text-primary);
    letter-spacing: -0.01em;
}

.vt-error-detail {
    font-size: 0.85rem;
    color: var(--kb-text-muted);
}

.vt-error-detail code {
    font-family: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    background: color-mix(in oklab, var(--kb-bg-subtle) 80%, transparent);
    color: var(--kb-primary);
}

.vt-error-action {
    margin-top: 0.5rem;
}

/* ============================================================================
   PRELOADER STYLES
   ============================================================================ */

.vt-preloader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 1.25rem;
}

.vt-preloader-ring {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid color-mix(in oklab, var(--kb-primary), transparent 75%);
    border-top-color: var(--kb-primary);
    animation: vt-spin 0.8s linear infinite;
}

@keyframes vt-spin {
    to { transform: rotate(360deg); }
}

.vt-preloader-brand {
    font-family: 'Geist', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: var(--kb-text-primary);
}

.vt-preloader-status {
    font-size: 0.875rem;
    color: var(--kb-text-muted);
}

.vt-preloader-status.is-error {
    color: var(--kb-danger);
}

.vt-preloader-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: min(440px, calc(100vw - 32px));
}

.vt-preloader-log {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    max-height: 240px;
    overflow: auto;
    text-align: left;
    font-family: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
    color: var(--kb-text-muted);
}

.vt-preloader-log:empty {
    display: none;
}

.vt-preloader-log li.is-done {
    opacity: 0.55;
}

.vt-preloader-log li.is-active {
    color: var(--kb-text-secondary);
}

.vt-preloader-log li.is-done::before {
    content: "· ";
}

.vt-preloader-log li.is-active::before,
.vt-preloader-log li.is-error::before {
    content: "› ";
}

.vt-preloader-log li.is-error {
    color: var(--kb-danger);
}

/* Preloader fade-out */
.vt-preloader.vt-fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* ============================================================================
   TOPNAV ICON BUTTONS
   Borderless, lone-icon style for lightweight nav controls (Docs, Theme,
   Mode). Muted by default; brighten + subtle backdrop on hover/active.
   Kept separate from Bootstrap's btn system so there's no default padding,
   border, or background-color fight.
   ============================================================================ */

.vt-nav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0.375rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--kb-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.vt-nav-icon-btn:hover,
.vt-nav-icon-btn:focus-visible {
    color: var(--kb-text-primary);
    background-color: color-mix(in oklab, var(--kb-bg-muted) 60%, transparent);
    outline: none;
}

.vt-nav-icon-btn.active,
.vt-nav-icon-btn[aria-current="page"] {
    color: var(--kb-primary);
}

/* Suppress Bootstrap's dropdown-toggle ::after caret when we're using the
   borderless nav-icon treatment (the palette button shows icon only). */
.vt-nav-icon-btn.dropdown-toggle::after,
.dropdown > .vt-nav-icon-btn::after {
    display: none !important;
}

/* Explicit chevron for Models / ELO dropdowns (Bootstrap's ::after is hidden). */
.vt-nav-caret {
    font-size: 0.65em;
    opacity: 0.7;
    margin-left: 0.15rem;
}

.vt-nav-dropdown .dropdown-item.active,
.vt-nav-dropdown .dropdown-item:active {
    background: var(--kb-primary);
    color: var(--kb-primary-fg);
}

/* Primary-tinted variant of .vt-nav-icon-btn — for a high-emphasis
   action in the topnav. No shell uses it today (the Record button it
   was built for now lives inside the Tools dropdown); kept for the
   next one. Mirrors the visual weight of .btn-primary while keeping the topnav's
   sizing and typography. Specificity matches the base .vt-nav-icon-btn
   hover/focus rules above; defined later in source so it wins. */
.vt-nav-icon-btn--primary {
    background: var(--kb-primary);
    color: var(--kb-primary-fg);
    box-shadow: 0 2px 10px var(--kb-primary-muted);
}

.vt-nav-icon-btn--primary:hover,
.vt-nav-icon-btn--primary:focus-visible {
    background: var(--kb-primary-hover);
    color: var(--kb-primary-fg);
    box-shadow: 0 4px 14px var(--kb-primary-muted);
}

.vt-nav-icon-btn--primary:active {
    filter: brightness(0.95);
    box-shadow: 0 1px 6px var(--kb-primary-muted);
}

/* The generic current-page rule paints --kb-primary text. On the filled
   Record button that would sit on a primary background, so keep the
   foreground token when this control is the current page. */
.vt-nav-icon-btn--primary[aria-current="page"] {
    color: var(--kb-primary-fg);
}

/* Secondary-background variant of .vt-nav-icon-btn — uses --kb-bg-muted as a
   clear surface tint without competing with the primary CTA. Used by the
   match-info banner's Raw / Map / VOD action chips. */
.vt-nav-icon-btn--secondary {
    background: var(--kb-bg-muted);
    color: var(--kb-text-primary);
}

.vt-nav-icon-btn--secondary:hover,
.vt-nav-icon-btn--secondary:focus-visible {
    background: var(--kb-bg-active);
    color: var(--kb-text-primary);
}

.vt-nav-icon-btn--secondary:active {
    filter: brightness(0.95);
}

/* Match-info banner action cluster: 2-column grey grid (Raw Data ·
   Map Page / Watch VOD). Missing map/VOD cells hide, so 3 items wrap
   2+1 and 2 items sit on one row. */
.vt-banner-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    align-items: stretch;
}
.vt-banner-actions > .vt-nav-icon-btn,
.vt-banner-vod,
.vt-banner-vod > .dropdown,
.vt-banner-vod .vt-nav-icon-btn {
    width: 100%;
    min-width: 0;
}
.vt-banner-vod {
    position: relative;
    display: flex;
    align-items: stretch;
}
.vt-banner-vod > .dropdown,
.vt-banner-vod > .vt-nav-icon-btn {
    flex: 1;
}
.vt-banner-vod .vt-nav-icon-btn {
    height: 100%;
}
.vt-banner-actions .bi-youtube,
.vt-banner-vod .bi-youtube {
    color: var(--vt-youtube);
}
/* .card clips overflow so corners stay rounded. The Watch VOD menu opens
   downward out of this banner; without this it is cut off and the tab
   strip covers the channel list. z-index stays under the navbar/modals. */
#match-info.card {
    overflow: visible;
    position: relative;
    z-index: 3;
}

/* ============================================================================
   TOPNAV URL-SYNC BUTTONS
   Share (one-shot copy) + Live Sync (toggle). Both render as standalone
   .vt-nav-icon-btn buttons (borderless, transparent) so they match the
   rest of the topnav. The base .vt-nav-icon-btn rule above already supplies
   the color/background transitions; these per-id rules only encode the
   stateful color tints (Live Sync .active, Share flash-success/error).
   ============================================================================ */

/* Live Sync "on" state — soft primary tint, painted on top of the
   borderless base button. */
#live-sync-toggle.active {
    color: var(--kb-primary);
    background-color: color-mix(in oklab, var(--kb-primary) 14%, transparent);
}

#share-url-btn.flash-success {
    color: var(--kb-success);
    background-color: color-mix(in oklab, var(--kb-success) 14%, transparent);
}

#share-url-btn.flash-error {
    color: var(--kb-danger);
    background-color: color-mix(in oklab, var(--kb-danger) 14%, transparent);
}

/* ============================================================================
   ACTIVE GAME INDICATOR (LIVE pill — restored on index.html topnav)
   Topnav widget that polls the live BZ2 lobby and surfaces a pulsing LIVE
   pill whenever a session hosted by an allowlisted Steam64 ID is active.
   Markup: #vt-active-game (Bootstrap dropdown wrapper) -> #vt-active-game-pill
   (state-driven trigger) + #vt-active-game-dropdown (multi-match list) +
   #vt-active-game-join (single-match shortcut) + .vt-active-game-gamewatch
   (always-visible external link). State drives via [data-state] on the
   wrapper: "loading" | "no-match" | "match-found-1" | "match-found-n".
   See js/active-game-indicator.js.
   ============================================================================ */

.vt-active-game {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: 0.5rem;
}

.vt-active-game-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.375rem 0.6rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--kb-text-secondary);
    font-size: 0.825rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease,
                border-color 0.2s ease, transform 0.2s ease;
    font-feature-settings: "tnum" 1;
}

.vt-active-game-pill:hover:not(:disabled),
.vt-active-game-pill:focus-visible:not(:disabled) {
    color: var(--kb-text-primary);
    background-color: color-mix(in oklab, var(--kb-success) 18%, transparent);
    border-color: color-mix(in oklab, var(--kb-success) 36%, transparent);
    outline: none;
}

.vt-active-game-pill:disabled {
    cursor: default;
    opacity: 0.7;
}

.vt-active-game-pill::after {
    display: none !important;
}

.vt-active-game-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--kb-success);
    box-shadow: 0 0 0 0 color-mix(in oklab, var(--kb-success) 50%, transparent);
    animation: vtActiveGamePulse 2.2s ease-in-out infinite;
}

@keyframes vtActiveGamePulse {
    0%   { box-shadow: 0 0 0 0   color-mix(in oklab, var(--kb-success) 55%, transparent); }
    70%  { box-shadow: 0 0 0 7px color-mix(in oklab, var(--kb-success) 0%,  transparent); }
    100% { box-shadow: 0 0 0 0   color-mix(in oklab, var(--kb-success) 0%,  transparent); }
}

@media (prefers-reduced-motion: reduce) {
    .vt-active-game-dot {
        animation: none;
    }
}

.vt-active-game-pill-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.vt-active-game-pill-text {
    color: var(--kb-success);
    letter-spacing: 0.04em;
}

.vt-active-game-pill-host {
    color: var(--kb-text-primary);
    font-weight: 600;
    max-width: 18ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vt-active-game-pill-count {
    color: var(--kb-text-secondary);
    font-weight: 500;
}

.vt-active-game-pill-skeleton {
    display: inline-block;
    width: 12px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg,
        color-mix(in oklab, var(--kb-bg-muted) 60%, transparent) 0%,
        color-mix(in oklab, var(--kb-bg-muted) 100%, transparent) 50%,
        color-mix(in oklab, var(--kb-bg-muted) 60%, transparent) 100%);
    background-size: 200% 100%;
    animation: vtActiveGameShimmer 1.6s linear infinite;
}

@keyframes vtActiveGameShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .vt-active-game-pill-skeleton { animation: none; }
}

.vt-active-game-dropdown {
    min-width: 320px;
    padding: 0.25rem 0;
}

.vt-active-game-dropdown-item {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) auto auto;
    gap: 0.55rem;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0.85rem;
    font-size: 0.825rem;
    text-align: left;
}

.vt-active-game-dropdown-host {
    color: var(--kb-text-primary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vt-active-game-dropdown-map {
    color: var(--kb-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vt-active-game-dropdown-count {
    color: var(--kb-text-secondary);
    font-weight: 500;
    font-feature-settings: "tnum" 1;
    font-variant-numeric: tabular-nums;
}

.vt-active-game-join,
.vt-active-game-gamewatch {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.6rem;
    border-radius: 999px;
    font-size: 0.825rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.vt-active-game-join {
    background-color: var(--kb-success);
    color: var(--kb-primary-fg);
    box-shadow: 0 2px 8px color-mix(in oklab, var(--kb-success) 30%, transparent);
}

.vt-active-game-join:hover,
.vt-active-game-join:focus-visible {
    background-color: color-mix(in oklab, var(--kb-success) 88%, white);
    color: var(--kb-primary-fg);
    outline: none;
}

.vt-active-game-join--locked {
    background-color: color-mix(in oklab, var(--kb-bg-muted) 70%, transparent);
    color: var(--kb-text-muted);
    box-shadow: none;
    pointer-events: none;
}

.vt-active-game-gamewatch {
    background: transparent;
    color: var(--kb-text-secondary);
    border: 1px solid color-mix(in oklab, var(--kb-border-subtle), transparent 35%);
}

.vt-active-game-gamewatch:hover,
.vt-active-game-gamewatch:focus-visible {
    color: var(--kb-text-primary);
    background-color: color-mix(in oklab, var(--kb-bg-muted) 60%, transparent);
    outline: none;
}

.vt-active-game[data-state="loading"] .vt-active-game-pill {
    opacity: 0.85;
}

.vt-active-game[data-state="no-match"] #vt-active-game-pill,
.vt-active-game[data-state="no-match"] #vt-active-game-join {
    display: none !important;
}

.vt-active-game[data-state="match-found-1"] .vt-active-game-pill,
.vt-active-game[data-state="match-found-n"] .vt-active-game-pill {
    background-color: color-mix(in oklab, var(--kb-success) 12%, transparent);
    border-color: color-mix(in oklab, var(--kb-success) 28%, transparent);
}

.vt-active-game[data-state="match-found-1"] .vt-active-game-gamewatch,
.vt-active-game[data-state="match-found-n"] .vt-active-game-gamewatch {
    display: none !important;
}

.vt-active-game-pill-chevron {
    color: var(--kb-text-muted);
    font-size: 0.85em;
    margin-left: 0.15rem;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.vt-active-game-pill:hover:not(:disabled) {
    transform: translateY(-1px);
}

.vt-active-game-pill:hover:not(:disabled) .vt-active-game-pill-chevron {
    opacity: 1;
    transform: translateX(2px);
}

@media (prefers-reduced-motion: reduce) {
    .vt-active-game-pill,
    .vt-active-game-pill-chevron { transition: none; }
    .vt-active-game-pill:hover:not(:disabled) { transform: none; }
    .vt-active-game-pill:hover:not(:disabled) .vt-active-game-pill-chevron {
        transform: none;
    }
}

.vt-active-game-pill-loading-compact,
.vt-active-game-pill-multi-compact {
    display: none;
}

@media (max-width: 767.98px) {
    .vt-active-game {
        margin-left: 0.25rem;
        gap: 0.25rem;
    }
    .vt-active-game-pill-host {
        display: none;
    }
    .vt-active-game-pill-loading-full,
    .vt-active-game-pill-multi-full {
        display: none;
    }
    .vt-active-game-pill-loading-compact,
    .vt-active-game-pill-multi-compact {
        display: inline;
    }
    .vt-active-game-gamewatch-label {
        display: none;
    }
    .vt-active-game[data-state="match-found-1"] #vt-active-game-join,
    .vt-active-game[data-state="match-found-n"] #vt-active-game-join {
        display: none !important;
    }
}

/* ============================================================================
   TOOLS TOPNAV PULSE
   Slim "live activity" pulse on the Tools dropdown button, fired by
   js/active-game-indicator.js. Markup contract: the button with
   `data-vt-tools-link` carries `data-vt-tools-live="0|1"`. `1` triggers
   the pulse animation; `0` is the resting state. The same flag tints the
   Tools menu row (not Discord Time) while the menu is open. Same
   animation as the LIVE pill dot above so the visual language stays
   consistent. Only index.html loads the poller; other shells keep the
   attribute so the markup matches.
   ============================================================================ */

.vt-nav-icon-btn--tools[data-vt-tools-live="1"] {
    color: var(--kb-success);
    background-color: color-mix(in oklab, var(--kb-success) 12%, transparent);
    box-shadow: 0 0 0 0 color-mix(in oklab, var(--kb-success) 50%, transparent);
    animation: vtToolsLivePulse 2.2s ease-in-out infinite;
}

.vt-nav-icon-btn--tools[data-vt-tools-live="1"] i {
    color: var(--kb-success);
}

@keyframes vtToolsLivePulse {
    0%   { box-shadow: 0 0 0 0   color-mix(in oklab, var(--kb-success) 55%, transparent); }
    70%  { box-shadow: 0 0 0 7px color-mix(in oklab, var(--kb-success) 0%,  transparent); }
    100% { box-shadow: 0 0 0 0   color-mix(in oklab, var(--kb-success) 0%,  transparent); }
}

@media (prefers-reduced-motion: reduce) {
    .vt-nav-icon-btn--tools[data-vt-tools-live="1"] {
        animation: none;
    }
}

.vt-nav-dropdown:has(.vt-nav-icon-btn--tools[data-vt-tools-live="1"]) .dropdown-item[data-vt-tools-item]:not(.active),
.vt-nav-dropdown:has(.vt-nav-icon-btn--tools[data-vt-tools-live="1"]) .dropdown-item[data-vt-tools-item]:not(.active) i {
    color: var(--kb-success);
}

/* ============================================================================
   ACTIVE GAME MODAL
   Click-through detail card mirroring the bz2api demo: header badges
   (state, mode, VSR) -> map thumbnail + map line + host -> player table
   with HOST/CMDR badges + Steam profile + VSR deep-link chips ->
   session stats grid -> mods row -> footer (Join, GameWatch, Close).
   Body markup is rendered by js/active-game-indicator.js on
   shown.bs.modal so a closed modal carries no per-session DOM cost.
   ============================================================================ */

/* Game Watch modal (#gamewatch-modal): full-bleed iframe embedding the /gw
   live grid. The iframe scrolls internally; the modal body does not. */
.vt-gamewatch-frame {
    display: block;
    width: 100%;
    height: 72vh;
    border: 0;
    background-color: var(--kb-bg-card);
}

#gamewatch-modal .modal-body {
    overflow: hidden;
}

.vt-active-game-modal-title {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.vt-active-game-modal-title-text {
    font-weight: 600;
}

.vt-active-game-modal-title-badges {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.vt-active-game-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background-color: color-mix(in oklab, var(--kb-bg-muted) 60%, transparent);
    color: var(--kb-text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
}

.vt-active-game-badge--ingame {
    background-color: color-mix(in oklab, var(--kb-success) 16%, transparent);
    color: var(--kb-success);
}

.vt-active-game-badge--pregame {
    background-color: color-mix(in oklab, var(--kb-warning, #d4a017) 18%, transparent);
    color: var(--kb-warning, #d4a017);
}

.vt-active-game-badge--vsr {
    background-color: color-mix(in oklab, var(--kb-primary) 16%, transparent);
    color: var(--kb-primary);
}

.vt-active-game-badge--host {
    background-color: color-mix(in oklab, var(--kb-success) 14%, transparent);
    color: var(--kb-success);
}

.vt-active-game-badge--cmdr {
    background-color: color-mix(in oklab, var(--kb-primary) 14%, transparent);
    color: var(--kb-primary);
}

.vt-active-game-modal-summary {
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

@media (max-width: 575.98px) {
    .vt-active-game-modal-summary {
        grid-template-columns: 1fr;
    }
}

.vt-active-game-modal-thumb {
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background-color: color-mix(in oklab, var(--kb-bg-muted) 80%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vt-active-game-modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vt-active-game-modal-thumb-missing {
    visibility: hidden;
}

.vt-active-game-modal-thumb-placeholder {
    color: var(--kb-text-muted);
    font-size: 1.6rem;
}

.vt-active-game-modal-summary-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.vt-active-game-modal-mapline {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--kb-text-primary);
}

.vt-active-game-modal-mapline a {
    color: inherit;
    text-decoration: none;
}

.vt-active-game-modal-mapline a:hover {
    text-decoration: underline;
}

.vt-active-game-modal-host,
.vt-active-game-modal-count {
    color: var(--kb-text-secondary);
    font-size: 0.875rem;
}

/* Host is the single most identifying piece of info on the modal
   (the player you're about to join). The summary line carries the
   weight that the per-row HOST badge previously did, so the host
   name itself gets the primary accent color + a slight size bump. */
.vt-active-game-modal-host strong {
    color: var(--kb-primary);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.vt-active-game-modal-section {
    margin-top: 1.1rem;
}

.vt-active-game-modal-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--kb-text-muted);
    margin-bottom: 0.5rem;
}

.vt-active-game-modal-players {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* Two-column TEAM 1 / TEAM 2 layout for team-based modes (STRAT/MPI/
   Team-DM/etc., gated by session.isTeamGame in js/active-game-indicator.js).
   Falls back to a single column on narrow viewports so player rows stay
   legible. The flat single-list layout is kept for FFA/DM modes. */
.vt-active-game-modal-teams {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (max-width: 575.98px) {
    .vt-active-game-modal-teams {
        grid-template-columns: 1fr;
    }
}

.vt-active-game-modal-team-column {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.vt-active-game-modal-team-header {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--kb-text-muted);
    padding-left: 0.65rem;
    margin-bottom: 0.15rem;
}

.vt-active-game-modal-team-empty {
    color: var(--kb-text-muted);
    font-size: 0.85rem;
    font-style: italic;
    padding: 0.45rem 0.65rem;
}

.vt-active-game-modal-player-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.6rem;
    align-items: center;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    background-color: color-mix(in oklab, var(--kb-bg-muted) 28%, transparent);
    border-left: 3px solid transparent;
}

.vt-active-game-modal-player-row--team1,
.vt-active-game-modal-player-row--team2 {
    border-left-color: color-mix(in oklab, var(--kb-primary) 70%, transparent);
}

.vt-active-game-modal-player-badges {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.vt-active-game-modal-player-badges:empty {
    display: none;
}

.vt-active-game-modal-player-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: 0;
}

.vt-active-game-modal-player-nick {
    font-weight: 600;
    color: var(--kb-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.vt-active-game-modal-player-chips {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.vt-active-game-modal-player-stats {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-feature-settings: "tnum" 1;
    font-variant-numeric: tabular-nums;
    color: var(--kb-text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
}

.vt-active-game-modal-player-stat-sep {
    color: var(--kb-text-muted);
}

/* Inline link chip used for the Steam profile link on each player row,
   and the mod-link chips in the Mods row. */
.vt-active-game-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background-color: color-mix(in oklab, var(--kb-bg-muted) 60%, transparent);
    color: var(--kb-text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.vt-active-game-chip:hover,
.vt-active-game-chip:focus-visible {
    color: var(--kb-text-primary);
    background-color: color-mix(in oklab, var(--kb-primary) 14%, transparent);
    outline: none;
}

.vt-active-game-chip--static {
    pointer-events: none;
}

.vt-active-game-chip i {
    font-size: 0.75em;
    line-height: 1;
}

/* Icon-only variant: square-ish, no text, used for the per-player-row
   Steam profile link where the bi-steam glyph alone carries the meaning.
   The base .vt-active-game-chip uses 0.7rem font-size to size text + a
   0.75em <i> rule to keep glyphs proportionate; icon-only mode bumps the
   chip up to 1rem and resets the inner glyph to 1em (declared AFTER the
   generic .vt-active-game-chip i rule so it wins on source order, since
   both selectors carry equal specificity). */
.vt-active-game-chip--icon {
    padding: 0.25rem 0.45rem;
    gap: 0;
    font-size: 1rem;
}

.vt-active-game-chip--icon i {
    font-size: 1em;
    line-height: 1;
}

/* Stats grid: two rows of four cells on desktop, collapses to two columns
   on mobile. Mirrors the kb-style stat tile look used elsewhere. */
.vt-active-game-modal-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

@media (max-width: 575.98px) {
    .vt-active-game-modal-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.vt-active-game-stat {
    padding: 0.5rem 0.7rem;
    background-color: color-mix(in oklab, var(--kb-bg-muted) 30%, transparent);
    border-radius: 6px;
    min-width: 0;
}

.vt-active-game-stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--kb-text-muted);
    margin-bottom: 0.15rem;
}

.vt-active-game-stat-value {
    color: var(--kb-text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vt-active-game-modal-mods {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* ============================================================================
   IN-GAME NICK SUBTEXT
   Subtle alias rendered alongside the canonical/known player name when the
   two differ. Pipeline emits `in_game_nick` (null when names match
   case-insensitively); UI checks truthiness and renders one of these two
   variants. Used in: leaderboard rows (block sub), faction roster (inline),
   and kill feed entries (inline).
   ============================================================================ */

.vt-nick-sub,
.vt-nick-inline {
    color: var(--kb-text-muted);
    font-size: 0.72rem;
    font-weight: 400;
    opacity: 0.85;
}

.vt-nick-sub {
    display: block;
    margin-top: -2px;
}

.vt-nick-inline {
    margin-left: 0.35em;
}

/* Kill-feed weapon ODF chip — clickable into the ODF Browser
   (odf/index.html?odf=<basename>). Defined here (not in
   css/odf-browser.css) so the dashboard, which doesn't load the ODF
   browser stylesheet, picks it up. The .vt-odf-link-fallback variant
   covers the rare edge case where the resolver returned a name from
   somewhere but the raw entry.killer_odf / entry.victim_odf is empty
   so we can't build a meaningful URL. */
.vt-odf-link {
    color: var(--kb-text-muted);
    font-size: 0.75rem;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.vt-odf-link:hover {
    color: var(--kb-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.vt-odf-link-fallback {
    color: var(--kb-text-muted);
    font-size: 0.75rem;
}

/* Map Info Modal title-link styling. Wraps the modal title text so a
   click on the modal title opens the map's full /map/<slug>/ page in a
   new tab. Lives here (not css/maps.css) because the dashboard needs
   it without loading the map-browser stylesheet. The new-tab semantics
   prevent accidental modal-title clicks from yanking the user out of
   their dashboard state mid-navigation. Mirrors the .vt-odf-link
   pattern exactly. */
.vt-map-title-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
    border-bottom: 1px dashed transparent;
}
.vt-map-title-link:hover {
    color: var(--kb-primary);
    border-bottom-color: color-mix(in oklab, var(--kb-primary) 50%, transparent);
}

/* Player profile cross-link. Wraps any player display name across the
   dashboard (leaderboard, VSR-T leaderboard, career table, kill feed,
   match/career highlights, commander head-to-head, global rivalries)
   so a click drops the user onto /player/<slug>/. Twin of .vt-odf-link,
   defined here (not in css/player.css) so the dashboard picks it up
   without loading the player-page stylesheet. The .vt-player-link-fallback
   variant is rendered when the slug map is missing or the player has no
   slug yet — it's keeps the visual styling consistent (same colored hover)
   while still functioning as a runtime ?p=<steam64> redirect target. */
.vt-player-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
    border-bottom: 1px dashed transparent;
}
.vt-player-link:hover,
.vt-player-link:focus-visible {
    color: var(--kb-primary);
    border-bottom-color: color-mix(in oklab, var(--kb-primary) 60%, transparent);
    text-decoration: none;
}
.vt-player-link-fallback {
    color: inherit;
}
.vt-player-link-fallback:hover,
.vt-player-link-fallback:focus-visible {
    color: var(--kb-primary);
}

/* YouTube VOD timestamp deep-link. Sibling of .vt-odf-link so the
   dashboard, storyline rail, and player match log pick it up without
   a dedicated stylesheet. Muted by default; --kb-danger hover tint. */
.vt-video-link {
    color: var(--kb-text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    margin-left: 0.15rem;
    transition: color 0.15s ease;
}
.vt-video-link i {
    font-size: 0.9em;
}
.vt-video-link:hover,
.vt-video-link:focus-visible {
    color: var(--kb-danger);
    text-decoration: none;
}
.vt-video-link--hover {
    opacity: 0;
}
.vt-econ-log-row:hover .vt-video-link--hover,
.vt-econ-log-row:focus-within .vt-video-link--hover {
    opacity: 1;
}
.vt-video-chip {
    color: inherit;
}
.vt-video-chip:hover,
.vt-video-chip:focus-visible {
    color: var(--kb-danger);
}

/* Used by the Snipe Feed card to fully hide itself when the feed is empty. */
.vt-hide {
    display: none !important;
}

/* ============================================================================
   GLOBAL FILTER BAR
   Player/team filter controls inside the match-info banner
   Positioned as a right-side column, separated from metadata by a vertical rule
   ============================================================================ */

.vt-filter-bar--right {
    border-left: 1px solid color-mix(in oklab, var(--kb-border-subtle), transparent 30%);
    padding-left: 1.25rem;
    margin-left: auto;
    min-width: 260px;
}

.vt-filter-bar-label {
    margin-bottom: 0.4rem;
}

/* Collapse to stacked layout below md so the filter slides beneath metadata */
@media (max-width: 767.98px) {
    .vt-filter-bar--right {
        border-left: none;
        border-top: 1px solid color-mix(in oklab, var(--kb-border-subtle), transparent 30%);
        padding-left: 0;
        padding-top: 0.75rem;
        margin-left: 0;
        width: 100%;
    }
}

#filter-mode .btn {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.3rem 0.75rem;
}

#filter-mode .btn.active {
    background: var(--kb-primary) !important;
    border-color: var(--kb-primary) !important;
    color: var(--kb-primary-fg) !important;
}

/* --- Player picker dropdown --- */

.vt-player-picker {
    min-width: 240px;
    max-height: 360px;
    overflow-y: auto;
    padding: 0.5rem;
    background: color-mix(in oklab, var(--kb-bg-card) 96%, transparent);
    backdrop-filter: blur(var(--vt-glass-blur));
    -webkit-backdrop-filter: blur(var(--vt-glass-blur));
    border: 1px solid color-mix(in oklab, var(--kb-text-primary) var(--vt-glass-border-luminance), transparent);
    border-radius: 8px;
    box-shadow: var(--vt-shadow-elevation-3);
}

/* Floating variant — appended to <body>, positioned manually so it can
   escape any ancestor with backdrop-filter (which would otherwise trap
   even position: fixed descendants). */
.vt-player-picker--floating {
    position: fixed;
    z-index: 1080;
    display: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.vt-player-picker--floating.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.vt-player-picker .vt-player-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--kb-text-secondary);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.vt-player-picker .vt-player-option:hover {
    background: color-mix(in oklab, var(--kb-bg-muted) 60%, transparent);
    color: var(--kb-text-primary);
}

.vt-player-picker .vt-player-option input[type="checkbox"] {
    flex-shrink: 0;
}

.vt-player-picker .vt-team-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vt-player-picker .vt-team-dot--t1 {
    background: var(--kb-primary);
}

.vt-player-picker .vt-team-dot--t2 {
    background: var(--kb-accent);
}

/* --- Player profile card --- */

.vt-profile-panel {
    padding: 1.5rem;
    border-radius: 10px;
    background: color-mix(in oklab, var(--kb-bg-subtle) 80%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-left-width: 3px;
    border-left-style: solid;
}

.vt-profile-panel .vt-profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--kb-text-primary);
}

.vt-profile-panel .stat-value {
    font-size: 1.5rem;
}

.vt-profile-rival {
    padding: 0.75rem;
    border-radius: 8px;
    background: color-mix(in oklab, var(--kb-bg-card) 70%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-border-subtle), transparent 50%);
}

.vt-profile-chart-wrap {
    width: 120px;
    height: 120px;
}

/* Player Performance Radar wrapper inside the Overview profile panel.
   Square aspect, a touch larger than the adjacent doughnut so the 7-axis
   shape is readable without crowding the stat cards. */
.vt-profile-radar-wrap {
    width: 220px;
    height: 220px;
    position: relative;
}

.vt-profile-radar-wrap canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Inline info icon overlayed on the Profile Radar. The radar wrap is small
   (220px) and has no header, so the icon sits in the top-right corner with
   a subtle hover lift to flag that hovering shows the axis legend. */
.vt-profile-radar-info {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    cursor: help;
    opacity: 0.65;
    transition: opacity 0.15s ease-in-out;
}

.vt-profile-radar-info:hover {
    opacity: 1;
}

/* ============================================================================
   PLAYER PERFORMANCE RADAR — card-level styling
   Clickable top-rivalry drill-down, Custom... picker, empty-state hints.
   ============================================================================ */

/* Clickable rivalry card (drives the compare-mode Rivalry Radar). */
.vt-rivalry-card--interactive {
    cursor: pointer;
    outline: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.vt-rivalry-card--interactive:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in oklab, var(--kb-primary) 55%, transparent);
}

.vt-rivalry-card--interactive.is-active {
    border-color: var(--kb-primary) !important;
    box-shadow: 0 0 0 1px color-mix(in oklab, var(--kb-primary) 35%, transparent),
                var(--vt-shadow-elevation-1);
}

.vt-rivalry-card--interactive.is-active::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--kb-primary);
    margin-left: 0.5rem;
    align-self: center;
}

/* Custom... dropdown block inside the Rivalry / Career Radar cards. */
/* Chip-based two-slot rivalry picker (replaces the old dual-select picker).
   Each slot is a Bootstrap dropdown trigger; menu list is populated
   dynamically by populateRivalryPickerMenu() in js/app.js. */

.vt-radar-picker {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: color-mix(in oklab, var(--kb-bg-subtle) 65%, transparent);
    border: 1px solid var(--kb-border-subtle);
}

.vt-radar-picker-slots {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.vt-radar-picker-dropdown {
    /* Wrapper for each slot trigger + menu. The Bootstrap .dropdown class
       handles toggle plumbing. */
}

.vt-radar-picker-slot {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    padding: 0.45rem 1.85rem 0.45rem 0.85rem;
    min-width: 180px;
    border: 1px solid var(--kb-border-subtle);
    border-radius: 8px;
    background: color-mix(in oklab, var(--kb-bg-card) 80%, transparent);
    color: var(--kb-text-primary);
    cursor: pointer;
    position: relative;
    text-align: left;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.vt-radar-picker-slot:hover,
.vt-radar-picker-slot:focus-visible,
.vt-radar-picker-slot[aria-expanded="true"] {
    border-color: var(--kb-primary);
    outline: none;
    background: color-mix(in oklab, var(--kb-bg-card) 95%, transparent);
}

.vt-radar-picker-slot-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--kb-text-muted);
    font-weight: 600;
}

.vt-radar-picker-slot-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--kb-text-primary);
    line-height: 1.2;
    max-width: 16ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Faction-tinted name color to telegraph which side of the comparison
   each slot represents. */
.vt-radar-picker-slot[data-faction="1"] .vt-radar-picker-slot-name {
    color: var(--kb-primary);
}

.vt-radar-picker-slot[data-faction="2"] .vt-radar-picker-slot-name {
    color: var(--kb-accent);
}

/* Empty slot: muted/italic placeholder so it reads as "click to pick". */
.vt-radar-picker-slot[data-empty="true"] .vt-radar-picker-slot-name {
    color: var(--kb-text-muted);
    font-style: italic;
    font-weight: 400;
}

.vt-radar-picker-slot-caret {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: var(--kb-text-muted);
}

.vt-radar-picker-vs {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--kb-text-muted);
    text-transform: lowercase;
    letter-spacing: 0.06em;
    padding: 0 0.15rem;
}

.vt-radar-picker-menu {
    max-height: 320px;
    overflow-y: auto;
    min-width: 200px;
}

.vt-radar-picker-menu .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.vt-radar-picker-menu .dropdown-item.is-current i {
    color: var(--kb-success);
}

.vt-radar-picker-action {
    /* Inherits btn-outline-secondary; just keep alignment honest. */
    align-self: stretch;
}

/* Toggle button "active" state for Custom... / Compare. */
.vt-radar-custom-toggle.active,
.vt-radar-custom-toggle.active:hover,
.vt-radar-custom-toggle.active:focus {
    background: color-mix(in oklab, var(--kb-primary) 18%, transparent);
    border-color: color-mix(in oklab, var(--kb-primary) 55%, transparent);
    color: var(--kb-text-primary);
}

/* Inline hint paragraph shown below the radar in edge cases (same player
   picked twice, too few players to compare, etc.). */
.vt-radar-hint {
    color: var(--kb-text-muted);
    text-align: center;
}

/* Radar charts are intrinsically square. Centre the canvas within its wide
   chart-container so a 7-axis spiderweb stays readable instead of stretching
   into an ellipse. Fullscreen modals have their own sizing and bypass this. */
#section-rivalry-radar .chart-container,
#section-faction-radar .chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
}

#section-rivalry-radar .chart-container > canvas,
#section-faction-radar .chart-container > canvas {
    max-width: 480px;
    max-height: 380px;
}

/* ============================================================================
   FACTION SCOREBOARD — Player-first compact layout
   Each team panel is a quieter theme fill. Roster chips lead; team
   combat/economy totals sit in a quiet strip below.
   ============================================================================ */

#section-faction .card-body {
    padding: 1.15rem;
}

/* Two team panels share one grid. At md+ each panel is a subgrid of the
   same tracks (heading, roster, combat cards, optional scrap cards) so a
   wrapping roster cannot push one side's scorecards down. Below md the
   panels stack and do not share rows. row-gap stays 0 at md+ because the
   existing heading/roster margins already separate those tracks; a parent
   gap would add to them. */
#faction-content {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    #faction-content {
        grid-template-columns: 1fr 1fr;
        row-gap: 0;
        column-gap: 1rem;
        align-items: stretch;
    }

    #faction-content > .vt-faction-panel {
        display: grid;
        grid-template-rows: subgrid;
        grid-row: span 3;
    }

    #faction-content.vt-faction-has-econ > .vt-faction-panel {
        grid-row: span 4;
    }

    /* Fills the shared combat / scrap tracks. Below this breakpoint the
       panels are ordinary blocks, and 100% would stretch the first row
       to the whole card. */
    .vt-faction-stats {
        height: 100%;
    }
}

#outcome-read:empty,
#outcome-after:empty {
    display: none;
}

/* The gauge, verdict, and played-out read start closed. The disclosure
   hides when both slots are empty so an unrated match shows only the
   team panels. */
#faction-content:not(.d-none) + #outcome-elo-fold {
    margin-top: 1.35rem;
}

#outcome-elo-fold:not(:has(#outcome-read:not(:empty), #outcome-after:not(:empty))) {
    display: none;
}

#outcome-elo-fold > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    min-height: 2.25rem;
    margin: 0;
    padding: 0.15rem 0;
    list-style: none;
    cursor: pointer;
}

#outcome-elo-fold > summary::-webkit-details-marker {
    display: none;
}

#outcome-elo-fold > summary::marker {
    content: none;
}

#outcome-elo-fold > summary:hover .vt-balonce-fold-label,
#outcome-elo-fold > summary:hover .vt-balonce-fold-chevron {
    color: var(--kb-text-primary);
}

#outcome-elo-fold > summary:focus {
    outline: none;
}

#outcome-elo-fold > summary:focus-visible {
    outline: 2px solid var(--kb-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.vt-balonce-fold-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--kb-text-secondary);
}

.vt-balonce-fold-chevron {
    font-size: 0.9rem;
    color: var(--kb-text-secondary);
    flex-shrink: 0;
    transition: transform var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease);
}

#outcome-elo-fold[open] .vt-balonce-fold-chevron {
    transform: rotate(180deg);
}

#outcome-elo-fold[open] > summary {
    margin-bottom: 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
    .vt-balonce-fold-chevron { transition: none; }
}

/* Played-out is the next chapter after the call, so it keeps a divider. */
#outcome-after:not(:empty) {
    margin-top: 1.5rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--kb-border-subtle);
}

/* Gauge and verdict are one read, so the zone divider stays off here.
   The margin is the air between the gap chips and the verdict. */
#outcome-read .vt-balonce-zone + .vt-balonce-zone {
    margin-top: 1.15rem;
    padding-top: 0;
    border-top: none;
}

.vt-balonce-verdict-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* Team color as a background-only mix, not a solid fill. The second
   declaration mixes toward black when the team text is light and toward
   white when it is dark, so a bright theme color gets darker under white
   text and stays a light tint under dark text. The transparent mix is the
   fallback where contrast-color() is missing. Opacity on the panel would
   fade the text too. --vt-faction-fg is that text; --vt-faction-ink is the
   color used for text sitting on an inverted player chip. */
.vt-faction-panel {
    padding: 1.1rem;
    border-radius: 0.55rem;
    border: none;
    transition: box-shadow 0.2s ease;
}

.vt-faction-panel--t1,
.vt-faction-panel--t2 {
    background: color-mix(in oklab, var(--kb-primary) 58%, transparent);
    background: color-mix(in oklab, var(--kb-primary) 58%, contrast-color(var(--kb-primary-fg)));
    color: var(--kb-primary-fg);
    --vt-faction-fg: var(--kb-primary-fg);
    --vt-faction-ink: var(--kb-primary);
}

.vt-faction-panel:hover {
    box-shadow: var(--vt-shadow-elevation-1);
}

.vt-faction-heading {
    display: flex;
    align-items: center;
    align-content: flex-start;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
    /* Bootstrap sets h6 color to body text. The title has to use the
       panel foreground the fill was mixed for, at full strength. */
    color: inherit;
}

.vt-faction-subset-note {
    font-size: 0.75rem;
    font-weight: 400;
    color: color-mix(in oklab, var(--vt-faction-fg) 78%, transparent);
}

.vt-faction-roster {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0.4rem;
    margin-bottom: 0.7rem;
}

.vt-faction-roster-empty {
    color: color-mix(in oklab, var(--vt-faction-fg) 70%, transparent);
    font-size: 0.85rem;
}

.vt-faction-player-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.25;
    color: var(--vt-faction-ink);
    background: color-mix(in oklab, var(--vt-faction-fg) 62%, transparent);
    border: 1px solid transparent;
    border-radius: 999px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vt-faction-player-chip--cmdr {
    background: var(--vt-faction-fg);
}

.vt-faction-player-chip .vt-player-link:hover,
.vt-faction-player-chip .vt-player-link:focus-visible,
.vt-faction-player-chip .vt-player-link-fallback:hover,
.vt-faction-player-chip .vt-player-link-fallback:focus-visible {
    color: inherit;
    border-bottom-color: currentColor;
}

.vt-faction-player-chip .vt-nick-inline {
    font-weight: 400;
    color: color-mix(in oklab, var(--vt-faction-ink) 72%, transparent);
}

.vt-faction-cmdr-pip {
    color: currentColor;
    font-size: 0.78em;
    line-height: 1;
}

.vt-faction-elo {
    font-weight: 500;
    font-size: 0.78em;
    color: color-mix(in oklab, var(--vt-faction-ink) 72%, transparent);
    font-variant-numeric: tabular-nums;
}

.vt-faction-elo--t {
    color: color-mix(in oklab, var(--vt-faction-ink) 55%, transparent);
}

.vt-faction-avg {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 500;
    color: color-mix(in oklab, var(--vt-faction-fg) 78%, transparent);
    font-variant-numeric: tabular-nums;
}

.vt-faction-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

/* Padding, not margin. These rows are subgrid tracks with height: 100%,
   and a top margin sits outside that height and eats the panel's
   bottom padding. */
.vt-faction-stats + .vt-faction-stats {
    margin-top: 0;
    padding-top: 0.65rem;
}

.vt-faction-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.08rem;
    min-width: 0;
    padding: 0.4rem 0.55rem;
    background: color-mix(in oklab, var(--vt-faction-fg) 12%, transparent);
    border-radius: 0.35rem;
    cursor: help;
}

.vt-faction-stat-label {
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: color-mix(in oklab, var(--vt-faction-fg) 62%, transparent);
}

.vt-faction-stat-value {
    font-family: 'Geist Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: color-mix(in oklab, var(--vt-faction-fg) 78%, transparent);
}

/* Muted state — team is outside the current filter scope.
   Kept visible for context but clearly deprioritized. */
.vt-faction-panel--muted {
    position: relative;
    opacity: 0.55;
    filter: saturate(0.4);
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.vt-faction-panel--muted::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: color-mix(in oklab, var(--kb-bg-body) 35%, transparent);
    pointer-events: none;
}

.vt-faction-panel--muted:hover {
    opacity: 0.85;
    filter: saturate(0.7);
}

.vt-faction-muted-badge {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    padding: 0.15rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: color-mix(in oklab, var(--vt-faction-fg) 78%, transparent);
    background: color-mix(in oklab, var(--vt-faction-fg) 12%, transparent);
    border: 1px solid color-mix(in oklab, var(--vt-faction-fg) 28%, transparent);
    border-radius: 999px;
}

/* Faction badge — derived from match.team_factions (schema_version 3+).
   Color is keyed by data-faction-code: i = ISDF, e = Hadean, f = Scion.
   The Outcome team panels override this to one foreground wash so the
   trophy is the only accent there. All colors come from --kb-* tokens. */
.vt-faction-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 999px;
    border: 1px solid currentColor;
    background: color-mix(in oklab, currentColor 12%, transparent);
}

/* Faction palette aliases — used by both the Commanders tab faction-picks
   chart and the Meta tab donut/bar charts. Defined here so all faction
   visualisations stay in lock-step with the badge colors above. */
:root {
    --kb-faction-i: var(--kb-primary);   /* ISDF — cyan/blue (project primary) */
    --kb-faction-e: var(--kb-warning);   /* Hadean — warm amber/red */
    --kb-faction-f: var(--kb-accent);    /* Scion — accent (typically green) */
}

.vt-faction-badge[data-faction-code="i"] {
    color: var(--kb-faction-i);
}

.vt-faction-badge[data-faction-code="e"] {
    color: var(--kb-faction-e);
}

.vt-faction-badge[data-faction-code="f"] {
    color: var(--kb-faction-f);
}

/* Outcome team panels: one quiet foreground pill so ISDF / Scion / Hadean
   do not compete with the winner trophy. Other surfaces keep the
   per-faction colors above. */
.vt-faction-panel .vt-faction-badge[data-faction-code] {
    color: color-mix(in oklab, var(--vt-faction-fg) 78%, transparent);
    background: color-mix(in oklab, var(--vt-faction-fg) 12%, transparent);
    border-color: color-mix(in oklab, var(--vt-faction-fg) 28%, transparent);
}

/* All Matches → Meta faction matchup table. Neutral cells: the number is
   the whole read. Diagonal is mirror counts, not a win rate. */
.vt-matchup-table th,
.vt-matchup-table td {
  vertical-align: middle;
}
.vt-matchup-cell {
  min-width: 5.5rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}
.vt-matchup-pct {
  font-size: 1.05rem;
  color: var(--kb-text-primary);
}
.vt-matchup-record {
  font-size: 0.75rem;
  color: var(--kb-text-muted);
}
.vt-matchup-mirror .vt-matchup-pct {
  color: var(--kb-text-secondary);
}

/* Map win-rate card shares a row with Faction Matchups. At lg and up
   the matchup card sets the row height. The map card is taken out of
   flow so its table cannot stretch the row, then stretched to the
   same height and scrolled. Below lg the cards stack and the map
   table is not clipped. */
@media (min-width: 992px) {
  .vt-meta-maps-col {
    position: relative;
  }
  #section-meta-maps {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--bs-gutter-x) * 0.5);
    right: calc(var(--bs-gutter-x) * 0.5);
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  #section-meta-maps > .card-header {
    flex-shrink: 0;
  }
  #meta-maps-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #meta-maps-body .table-responsive {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }
  #meta-maps-body .vt-matchup-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--kb-bg-card);
  }
}

/* Campod + Partial row badges (v2.5). Sit inside the Player Leaderboard
   "Player" cell next to the player name when the row is excluded from
   VSR-T and career stats for one of three reasons:
     - Campod : spent >25% of match wall-clock in a camera-pod ship.
     - Partial: event-stream presence window covered <75% of match
                duration (late joiner or mid-match disconnect).
     - Idle   : thug dealt 0 damage in a match that recorded some.
                Commanders are never Idle.
   The flags are pipeline-emitted; the row stays visible in the
   per-match leaderboard for transparency but is de-emphasized via the
   .vt-row-* row classes below. Tooltips carry the actual share /
   presence numbers. */
.vt-campod-badge,
.vt-partial-badge,
.vt-pilot-badge,
.vt-mine-badge,
.vt-idle-badge,
.vt-bench-badge {
    display: inline-block;
    padding: 0.15em 0.55em;
    margin-left: 0.4em;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--kb-text-muted);
    background: color-mix(in oklab, var(--kb-text-muted) 12%, transparent);
    border: 1px solid var(--kb-border);
    border-radius: 999px;
    vertical-align: middle;
    cursor: help;
}

/* v2.9: on-foot pilot kill marker in the kill feed. Neutral/muted tone --
   it's informational (these rows are kept for transparency but earn no
   kill/death credit), not a warning. Smaller margin since it trails an
   ODF chip rather than a leaderboard name. */
.vt-pilot-badge,
.vt-mine-badge {
    margin-left: 0.25em;
}

/* Partial badge gets the warning accent so the two states are visually
   distinguishable at a glance. */
.vt-partial-badge {
    color: var(--kb-warning);
    border-color: color-mix(in oklab, var(--kb-warning) 50%, var(--kb-border));
}

/* Connected player who stopped fighting after a leave. Still rated.
   Career stats keep the whole match, so this is not a Partial badge. */
.vt-bench-badge {
    color: var(--kb-info);
    border-color: color-mix(in oklab, var(--kb-info) 50%, var(--kb-border));
    background: color-mix(in oklab, var(--kb-info) 12%, transparent);
}

/* De-emphasize excluded leaderboard rows so users immediately see the
   real ratees. Hover restores most of the opacity for readability when
   inspecting the row. */
.vt-row-campod,
.vt-row-partial,
.vt-row-idle {
    opacity: 0.55;
}

.vt-row-campod:hover,
.vt-row-partial:hover,
.vt-row-idle:hover {
    opacity: 0.9;
}

/* v7: identity-reroute provenance chip on per-match leaderboard rows.
   Pipeline-emitted (scripts/process_stats.py ACCOUNT_REROUTES) when a
   slot's Steam64 was rewritten at session-load time (shared-PC case,
   e.g. MAX playing on DD's account). Distinct from .vt-campod-badge /
   .vt-partial-badge -- those signal exclusion, this signals provenance.
   Info accent (blue) so it reads as informational, not warning. */
.vt-reroute-badge {
    display: inline-block;
    padding: 0.15em 0.55em;
    margin-left: 0.4em;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--kb-info);
    background: color-mix(in oklab, var(--kb-info) 12%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-info) 50%, var(--kb-border));
    border-radius: 999px;
    vertical-align: middle;
    cursor: help;
}

/* Range fingerprint mini-bar (match.schema_version 11) — a 4-segment
   close/mid/long/extreme stacked sparkline in the Shot Accuracy table's
   Range column. Monochrome --kb-primary opacity ramp (close -> extreme)
   to read as a neutral distribution, NOT a good/bad scale. Segment widths
   are proportional via inline flex-grow set by rangeFingerprintHtml(). */
.vt-range-fingerprint {
    display: inline-flex;
    width: 100%;
    min-width: 140px;
    max-width: 220px;
    height: 12px;
    gap: 1px;
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
    cursor: help;
    background: color-mix(in oklab, var(--kb-text-muted) 10%, transparent);
}

.vt-range-seg {
    display: block;
    height: 100%;
    min-width: 2px;
}

.vt-range-seg-1 { background: color-mix(in oklab, var(--kb-primary) 30%, transparent); }
.vt-range-seg-2 { background: color-mix(in oklab, var(--kb-primary) 50%, transparent); }
.vt-range-seg-3 { background: color-mix(in oklab, var(--kb-primary) 72%, transparent); }
.vt-range-seg-4 { background: var(--kb-primary); }

/* Engagement Envelope cell (match.schema_version 12) — weapon-fair mean
   "% of weapon max range" for a player. Number + mini-bar. Neutral coloring
   (no good/bad connotation); the bar uses --kb-primary like the fingerprint. */
.vt-range-envelope {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    width: 100%;
    min-width: 140px;
    max-width: 220px;
    cursor: help;
    line-height: 1.15;
}

.vt-range-envelope-val {
    font-family: "Geist Mono", monospace;
    font-weight: 600;
    font-size: 0.8rem;
}

.vt-range-envelope-bar {
    display: block;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: color-mix(in oklab, var(--kb-text-muted) 16%, transparent);
    overflow: hidden;
}

.vt-range-envelope-bar > span {
    display: block;
    height: 100%;
    background: var(--kb-primary);
}

/* Winner badge — sits next to "Kill Feed" in the Combat-tab card header.
   Three visual states keyed by data-decided-by:
     - clean      : decisive win (recycler + factory of the loser are dead,
                    other team untouched). Success color.
     - contested  : both teams' bases fell; loser fell first. Info color.
     - unclear    : outcome could not be determined (rebuild ambiguity,
                    timeout, host quit, commander self-demo). Muted with
                    cursor:help so users know the tooltip explains why.
   Empty <span> renders nothing (display:none when empty); pre-v3 matches
   simply leave the slot empty. */
.vt-winner-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 999px;
    border: 1px solid currentColor;
    background: color-mix(in oklab, currentColor 15%, transparent);
    line-height: 1;
}

.vt-winner-badge:empty {
    display: none;
}

.vt-winner-badge[data-decided-by="clean"] {
    color: var(--kb-success);
}

/* v15: host-attested team win (proto v3 game_outcome dialog). Success tone
   like clean, with the help cursor because the badge carries a provenance
   tooltip. */
.vt-winner-badge[data-decided-by="attested"] {
    color: var(--kb-success);
    cursor: help;
}

/* v16: reviewer-decided team win (pipeline outcome-review prompt overrode
   or supplied the outcome). Same success tone; provenance in the tooltip.
   The reviewer check-mark suffix rides on data-adjudicated regardless of
   which decided_by branch rendered the badge. */
.vt-winner-badge[data-decided-by="adjudicated"] {
    color: var(--kb-success);
    cursor: help;
}

.vt-winner-badge[data-adjudicated="1"] {
    cursor: help;
}

.vt-winner-badge[data-decided-by="contested"] {
    color: var(--kb-info);
    cursor: help;
}

.vt-winner-badge[data-decided-by="unclear"] {
    color: var(--kb-text-muted);
    cursor: help;
}

/* v15: host-attested no-winner outcomes. Draw = neutral info tone;
   cancelled = muted (the match doesn't count toward ratings). */
.vt-winner-badge[data-decided-by="draw"] {
    color: var(--kb-info);
    cursor: help;
}

.vt-winner-badge[data-decided-by="cancelled"] {
    color: var(--kb-text-muted);
    cursor: help;
}

/* Operator void. The recorded draw or win is irrelevant, so this pill
   replaces it and stays visually louder than a normal outcome badge. */
.vt-winner-badge[data-decided-by="void"] {
    color: var(--kb-warning);
    background: color-mix(in oklab, var(--kb-warning) 28%, transparent);
    border-color: var(--kb-warning);
    border-width: 2px;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: help;
}

/* Winner highlight on the faction scoreboard panel. The .vt-faction-panel
   --winner class is still attached to the winning team's panel so other
   contexts (e.g. fullscreen modal, future per-section selectors) can
   target it, but we deliberately leave its visual treatment to the
   trophy icon alone -- no extra border or box-shadow on the panel.
   The trophy is the only saturated accent on the solid theme fill. */
.vt-faction-winner-icon {
    color: var(--kb-warning);
    font-size: 0.95em;
    filter: drop-shadow(0 0 4px color-mix(in oklab, var(--kb-warning) 40%, transparent));
}

/* In-feed milestone marker — divider row inserted into the Kill Feed at
   the winner's decided_at_tick. Uses --kb-success accent so it visually
   parallels the "clean" winner badge. Filter-safe: the renderer reads
   the tick from currentData.match.winner (passthrough), not from the
   filtered kills.feed. */
.vt-killfeed-milestone {
    margin: 0.4rem 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--kb-success);
    background: color-mix(in oklab, var(--kb-success) 10%, transparent);
    border-top: 1px solid color-mix(in oklab, var(--kb-success) 40%, transparent);
    border-bottom: 1px solid color-mix(in oklab, var(--kb-success) 40%, transparent);
    border-left: 3px solid var(--kb-success);
    border-radius: 0 4px 4px 0;
}

/* ============================================================================
   RIVALRY CARDS — Breathing Room
   Larger doughnut charts, more whitespace
   ============================================================================ */

/* All Matches global rivalries use the same compact row as the per-match
   Top Rivalries list so five pairs don't stretch the column. */
#global-rivalries-container .rivalry-card {
    padding: 0.4rem 0.55rem;
    margin-bottom: 0.35rem;
    gap: 0.5rem;
    border-radius: 8px;
}

#global-rivalries-container .rivalry-card:last-child {
    margin-bottom: 0;
}

#global-rivalries-container .rivalry-card canvas {
    width: 56px !important;
    height: 56px !important;
}

#rivalries-container .rivalry-card {
    padding: 0.35rem 0.55rem;
    margin-bottom: 0.35rem;
    gap: 0.45rem;
    border-radius: 8px;
}

#rivalries-container .rivalry-card:last-child {
    margin-bottom: 0;
}

#rivalries-container .rivalry-card canvas {
    width: 44px !important;
    height: 44px !important;
}

#rivalries-container .vt-rivalry-menu-names {
    font-size: 0.82rem;
    line-height: 1.25;
}

#rivalries-container .vt-rivalry-menu-split {
    color: var(--kb-text-secondary);
    line-height: 1.2;
}

#rivalries-container .vt-rivalry-vs {
    color: var(--kb-text-muted);
    font-weight: 500;
}

/* Desktop: the sidebar fills the comparison card and scrolls inside it.
   The chart column sets the row height; the menu is taken out of flow
   so a long list cannot stretch the page. */
@media (min-width: 992px) {
    .vt-rivalry-split > .col-lg-4 {
        display: flex;
        flex-direction: column;
    }

    .vt-rivalry-menu-slot {
        position: relative;
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
    }

    #section-rivalries {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        min-height: 0;
        margin-bottom: 0;
    }

    #section-rivalries > .card-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }
}

/* ============================================================================
   VIEW TRANSITION STYLES
   ============================================================================ */

::view-transition-old(root) {
    animation: 250ms ease-out both vt-view-fade-out;
}

::view-transition-new(root) {
    animation: 250ms ease-in both vt-view-fade-in;
}

@keyframes vt-view-fade-out {
    to { opacity: 0; }
}

@keyframes vt-view-fade-in {
    from { opacity: 0; }
}

/* ============================================================================
   DOCUMENTATION PAGE — Layout, TOC, prose, tables, code blocks
   ============================================================================ */

.docs-container {
    max-width: 1200px;
}

/* --- Sticky sidebar TOC (desktop) ---------------------------------------- */

.docs-toc-sticky {
    position: sticky;
    top: 70px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in oklab, var(--kb-text-muted), transparent 60%) transparent;
}

.docs-toc {
    background: color-mix(in oklab, var(--kb-bg-card) var(--vt-glass-opacity), transparent);
    backdrop-filter: blur(var(--vt-glass-blur));
    -webkit-backdrop-filter: blur(var(--vt-glass-blur));
    border: 1px solid color-mix(in oklab, var(--kb-text-primary) var(--vt-glass-border-luminance), transparent);
    border-radius: 10px;
    padding: 1rem;
}

/* --- Scroll progress bar ------------------------------------------------- */

.docs-toc-progress {
    height: 3px;
    border-radius: 3px;
    background: color-mix(in oklab, var(--kb-border-subtle), transparent 50%);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.docs-toc-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: var(--kb-primary);
    box-shadow: 0 0 6px color-mix(in oklab, var(--kb-primary), transparent 50%);
    transition: width 0.1s linear;
}

/* --- TOC title ----------------------------------------------------------- */

.docs-toc-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--kb-text-muted);
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

/* --- TOC list structure -------------------------------------------------- */

.docs-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-toc-section {
    margin-bottom: 2px;
    border-bottom: 1px solid color-mix(in oklab, var(--kb-border-subtle), transparent 70%);
    padding-bottom: 4px;
}

.docs-toc-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* H2 row: chevron + link side by side */
.docs-toc-h2-row {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Chevron toggle button */
.docs-toc-chevron {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: none;
    color: var(--kb-text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.6rem;
    transition: color 0.15s ease, transform 0.2s ease, background-color 0.15s ease;
}

.docs-toc-chevron:hover {
    color: var(--kb-text-primary);
    background: color-mix(in oklab, var(--kb-bg-muted) 50%, transparent);
}

.docs-toc-chevron i {
    transition: transform 0.2s ease;
    display: block;
}

.docs-toc-section--open > .docs-toc-h2-row > .docs-toc-chevron i {
    transform: rotate(90deg);
}

/* H2 and H3 links */
.docs-toc-link {
    display: block;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--kb-text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.docs-toc-link--h2 {
    font-weight: 500;
    color: var(--kb-text-secondary);
    flex: 1;
    min-width: 0;
}

.docs-toc-link--h3 {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
}

.docs-toc-link:hover {
    color: var(--kb-text-primary);
    background: color-mix(in oklab, var(--kb-bg-muted) 50%, transparent);
}

.docs-toc-link--active {
    color: var(--kb-primary) !important;
    border-left-color: var(--kb-primary);
    font-weight: 500;
}

/* Active section: H2 gets accent indicator */
.docs-toc-section--active > .docs-toc-h2-row > .docs-toc-link--h2 {
    color: var(--kb-primary);
    border-left-color: var(--kb-primary);
}

/* --- Collapsible H3 sublists --------------------------------------------- */

.docs-toc-sublist {
    list-style: none;
    padding-left: 0.5rem;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
    border-left: 1px solid color-mix(in oklab, var(--kb-border-subtle), transparent 40%);
    margin-left: 9px;
}

.docs-toc-section--open > .docs-toc-sublist {
    max-height: 600px;
    opacity: 1;
    margin-top: 2px;
    margin-bottom: 4px;
}

.docs-toc-sublist > li {
    margin-bottom: 1px;
}

/* Sections without children (no chevron) get consistent left padding */
.docs-toc-section:not(:has(.docs-toc-chevron)) > .docs-toc-h2-row {
    padding-left: 22px;
}

/* Mobile TOC variant */
.docs-toc--mobile {
    max-height: 50vh;
    overflow-y: auto;
}

/* --- Heading anchor links ------------------------------------------------ */

.docs-heading-anchor {
    color: var(--kb-text-muted);
    text-decoration: none !important;
    margin-left: 0.4em;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    font-size: 0.8em;
    vertical-align: middle;
}

h2:hover .docs-heading-anchor,
h3:hover .docs-heading-anchor,
h4:hover .docs-heading-anchor,
.docs-heading-anchor:focus {
    opacity: 0.6;
}

.docs-heading-anchor:hover {
    opacity: 1 !important;
    color: var(--kb-primary);
}

/* --- Back-to-top button -------------------------------------------------- */

.docs-back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid color-mix(in oklab, var(--kb-text-primary) var(--vt-glass-border-luminance), transparent);
    background: color-mix(in oklab, var(--kb-bg-card) var(--vt-glass-opacity), transparent);
    backdrop-filter: blur(var(--vt-glass-blur));
    -webkit-backdrop-filter: blur(var(--vt-glass-blur));
    color: var(--kb-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: var(--vt-shadow-elevation-1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease, color 0.15s ease, box-shadow 0.15s ease;
    z-index: 1020;
}

.docs-back-to-top--visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.docs-back-to-top:hover {
    color: var(--kb-primary);
    box-shadow: var(--vt-shadow-elevation-2);
}

/* --- Prose typography ---------------------------------------------------- */

.docs-prose {
    color: var(--kb-text-primary);
    line-height: 1.7;
}

.docs-prose h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--kb-primary);
}

.docs-prose h2 {
    font-size: 1.5rem;
    font-weight: 650;
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--kb-border-subtle);
    scroll-margin-top: 70px;
}

.docs-prose h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--kb-text-primary);
    scroll-margin-top: 70px;
}

.docs-prose h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--kb-text-secondary);
    scroll-margin-top: 70px;
}

.docs-prose p {
    margin-bottom: 1rem;
    color: var(--kb-text-secondary);
}

.docs-prose strong {
    color: var(--kb-text-primary);
    font-weight: 600;
}

.docs-prose a:not(.docs-heading-anchor) {
    color: var(--kb-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.docs-prose a:not(.docs-heading-anchor):hover {
    color: var(--kb-accent);
}

.docs-prose ul,
.docs-prose ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    color: var(--kb-text-secondary);
}

.docs-prose li {
    margin-bottom: 0.35rem;
}

.docs-prose hr {
    border-color: var(--kb-border-subtle);
    margin: 2.5rem 0;
    opacity: 0.5;
}

.docs-prose code {
    font-family: 'Geist Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
    font-size: 0.85em;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    background: color-mix(in oklab, var(--kb-bg-subtle) 80%, transparent);
    color: var(--kb-primary);
}

.docs-prose pre {
    margin-bottom: 1.25rem;
}

.docs-prose pre > code {
    display: block;
    padding: 0;
    background: none;
    color: var(--kb-text-primary);
    font-size: 0.82rem;
    line-height: 1.6;
}

.docs-prose .docs-code-block {
    background: color-mix(in oklab, var(--kb-bg-card) var(--vt-glass-opacity), transparent);
    backdrop-filter: blur(var(--vt-glass-blur));
    -webkit-backdrop-filter: blur(var(--vt-glass-blur));
    border: 1px solid color-mix(in oklab, var(--kb-text-primary) var(--vt-glass-border-luminance), transparent);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
}

.docs-prose .table {
    font-size: 0.85rem;
    color: var(--kb-text-primary);
    margin-bottom: 1.25rem;
    --bs-table-striped-bg: color-mix(in oklab, var(--kb-bg-subtle), transparent 50%);
}

.docs-prose .table th {
    font-weight: 600;
    white-space: nowrap;
    color: var(--kb-text-primary);
    border-bottom-color: var(--kb-border-subtle);
    position: sticky;
    top: 0;
    background: var(--kb-bg-card);
    z-index: 1;
}

.docs-prose .table td {
    color: var(--kb-text-secondary);
    border-bottom-color: color-mix(in oklab, var(--kb-border-subtle), transparent 50%);
}

.docs-prose .table td code {
    font-size: 0.82em;
}

.docs-prose blockquote {
    border-left: 3px solid var(--kb-primary);
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    background: color-mix(in oklab, var(--kb-bg-subtle) 50%, transparent);
    border-radius: 0 6px 6px 0;
    color: var(--kb-text-secondary);
}

/* ============================================================
 * Replay Player (3D embed)
 * Iframe wrapper around the standalone _map-analysis/render/replay.html
 * viewer. The iframe owns its own UI (transport bar, roster panel, kill
 * ticker, camera pills, scrub markers, expand control, etc.) -- this
 * stylesheet only positions the wrapper in the dashboard's #tab-replay
 * pane and skins the empty-state card. Expand is `body.vt-replay-expand-active`
 * (CSS) plus native Fullscreen API on the wrap, never on the iframe.
 * ============================================================ */

.vt-replay-3d-wrap {
    position: relative;
    width: 100%;
    /* Size the iframe to FIT inside the visible viewport area below the
       topnav + match-info banner + tab strip so the bottom transport bar
       (`position: fixed; bottom: 12px` inside replay.html) is always in
       view without scrolling. `min(...)` (no floor) guarantees the iframe
       shrinks with short viewports; the `min-height` safety net only
       kicks in on tiny screens where some scroll is unavoidable. The
       1400px ceiling caps it on 4K so the canvas doesn't grow unreasonably
       tall. The 240px subtractor approximates the chrome above the iframe
       (topnav ~60 + match-info banner ~120 + tab strip ~52 + padding ~8). */
    height: min(calc(100vh - 240px), 1400px);
    min-height: 420px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--kb-bg-subtle);
    border: 1px solid var(--kb-border-subtle);
}

@media (max-width: 768px), (max-height: 520px) and (pointer: coarse) {
    .vt-replay-3d-wrap {
        height: min(calc(100dvh - 180px), 1400px);
        min-height: 280px;
    }
}

.vt-replay-3d-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: var(--kb-bg-subtle);
}

body.vt-replay-expand-active {
    overflow: hidden;
}

body.vt-replay-expand-active > .vt-site-header,
body.vt-replay-expand-active #match-info,
body.vt-replay-expand-active .vt-tab-scroll-wrap {
    display: none !important;
}

body.vt-replay-expand-active #tab-replay .vt-replay-3d-wrap {
    position: fixed;
    inset: 0;
    z-index: 1050;
    height: 100dvh;
    width: 100%;
    border-radius: 0;
    min-height: 0;
    border: none;
}

body.vt-replay-expand-active #tab-replay .vt-replay-3d-wrap:fullscreen,
body.vt-replay-expand-active #tab-replay .vt-replay-3d-wrap:-webkit-full-screen {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

body.vt-replay-expand-active #tab-replay {
    display: block;
    opacity: 1;
}

body.vt-replay-expand-active #dashboard,
body.vt-replay-expand-active .tab-content {
    overflow: visible;
}

/* Empty state card for matches without position data or 3D extract. */
.vt-replay-3d-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 360px;
    padding: 2.5rem 1.5rem;
    border-radius: 10px;
    background: color-mix(in oklab, var(--kb-bg-subtle) 60%, transparent);
    border: 1px dashed var(--kb-border-subtle);
    color: var(--kb-text-secondary);
    text-align: center;
}

.vt-replay-3d-empty i {
    font-size: 2.25rem;
    color: var(--kb-text-muted);
    opacity: 0.7;
}

.vt-replay-3d-empty-title {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--kb-text-primary);
}

.vt-replay-3d-empty-body {
    font-size: 0.875rem;
    max-width: 32rem;
    line-height: 1.5;
}

/* ============================================================================
   MOBILE RESPONSIVENESS
   Topnav hamburger (<md), tab horizontal-scroll strip, match-info grid,
   filter bar compaction, player picker clamp, container spacing.
   ============================================================================ */

/* ---------- Label helpers (hidden on desktop, shown inside collapsed nav) ---------- */

.vt-nav-label {
    display: none;
}

/* ---------- Burger button ---------- */

.vt-navbar-toggler {
    border: none;
    box-shadow: none;
    font-size: 1.25rem;
    padding: 0.375rem 0.5rem;
    line-height: 1;
}

.vt-navbar-toggler:focus,
.vt-navbar-toggler:focus-visible {
    box-shadow: none;
    outline: none;
}

/* ---------- Horizontal-scroll tab strip wrapper ---------- */

.vt-tab-scroll-wrap {
    position: relative;
}

/* ---------- Breakpoint: below md (<768px) ---------- */

@media (max-width: 767.98px) {
    /* -- Navbar collapsed menu -- */
    /* The menus render inline inside the navbar here, so the navbar itself
       goes solid while the collapse is open. */
    .navbar:has(.navbar-collapse.show, .navbar-collapse.collapsing) {
        background: var(--kb-bg-card) !important;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .navbar-collapse {
        flex-basis: 100%;
        margin-top: 0.5rem;
        padding-top: 0.75rem;
        border-top: 1px solid color-mix(in oklab, var(--kb-text-primary) 8%, transparent);
    }

    /* Inner flex column fills the collapsed row so stacked items align flush */
    .vt-nav-menu {
        width: 100%;
    }

    .vt-nav-menu .vt-nav-icon-btn {
        justify-content: flex-start;
        width: 100%;
        padding: 0.5rem 0.75rem;
    }

    .vt-nav-menu .vt-nav-label {
        display: inline;
    }

    /* Theme dropdown: render its menu inline with the collapsed menu
       so it doesn't float off the viewport edge. */
    .vt-nav-menu .dropdown {
        width: 100%;
    }

    .vt-nav-menu .dropdown-menu {
        position: static !important;
        transform: none !important;
        inset: auto !important;
        width: 100%;
        min-width: 0 !important;
        border: none;
        box-shadow: none;
        background: transparent !important;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding-left: 0.5rem;
    }

    /* -- Tab navigation: horizontal scroll strip -- */
    #match-tabs,
    #all-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    #match-tabs::-webkit-scrollbar,
    #all-tabs::-webkit-scrollbar {
        display: none;
    }

    #match-tabs .nav-item,
    #all-tabs .nav-item {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    #match-tabs .nav-link,
    #all-tabs .nav-link {
        white-space: nowrap;
    }

    /* Right-edge fade hint: suggests more tabs are off-screen.
       Applied to the match-tabs wrapper (always overflows on mobile);
       the 4-tab all-tabs fits without scrolling. */
    .vt-tab-scroll-wrap:has(#match-tabs)::after {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 2rem;
        pointer-events: none;
        background: linear-gradient(to right, transparent, var(--kb-bg-body) 85%);
        border-top-right-radius: 10px;
        border-bottom-right-radius: 10px;
    }

    /* -- Match-info banner: 2-column grid for stat blocks -- */
    #match-info .card-body {
        gap: 0.75rem !important;
        padding: 1rem;
    }

    #match-info .card-body > .d-flex:first-child {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem 1.25rem;
        width: 100%;
    }

    #match-info .card-body > .d-flex:first-child > div {
        min-width: 0;
    }

    /* -- Filter mode btn-group: compact so 3 buttons fit one row -- */
    #filter-mode .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* ---------- Breakpoint: below sm (<576px) ---------- */

@media (max-width: 575.98px) {
    /* Tighter container spacing on phones */
    #dashboard,
    #all-matches-view {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* Even tighter filter btn-group */
    #filter-mode .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    /* Player picker floating dropdown: pin to both sides so it never clips.
       The JS sets `right: Xpx` + `left: auto` to right-anchor against the
       toggle; on phones we override both to stretch full-width with 8px
       margins, keeping it on-screen at 320px. */
    .vt-player-picker--floating {
        left: 0.5rem !important;
        right: 0.5rem !important;
        max-width: none !important;
        min-width: 0 !important;
        max-height: 60vh;
    }
}

/* ============================================================================
   POSITIONING TAB
   Movement Profile: top-down heatmaps, radial small multiples, score bars.
   Honors the same glass + kb-* theme system as the rest of the dashboard.
   ============================================================================ */

/* Movement score cell in main leaderboard + movement leaderboard */
.vt-movement-cell {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 110px;
}

.vt-movement-cell-top {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    justify-content: space-between;
}

.vt-movement-score {
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1;
}

.vt-movement-band-label {
    color: var(--kb-text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
}

.vt-movement-bar {
    height: 4px;
    background: var(--kb-border-subtle);
    border-radius: 2px;
    overflow: hidden;
}

.vt-movement-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 300ms ease;
}

.vt-movement-chip {
    display: inline-block;
    padding: 0 0.4em;
    border-radius: 4px;
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.72rem;
    line-height: 1.35;
}

/* Heatmap canvas wrappers */
.vt-heatmap-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 520px;
}

.vt-heatmap-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
    border: 1px solid var(--kb-border-subtle);
}

/* Per-player small-multiples grid. `.vt-heatmap-grid` is a plain wrapper
   (it also holds the legend strip); `.vt-heatmap-grid-inner` is the actual
   responsive grid of cards. */
.vt-heatmap-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

/* Fullscreen variant: larger cards for high-resolution detail. */
.vt-heatmap-grid-inner--fullscreen {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.vt-heatmap-grid-cell {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: var(--kb-bg-subtle);
    border: 1px solid var(--kb-border-subtle);
}

/* Two-row header: row 1 = diamond + name, row 2 = score chip + band.
   Fixed min-height keeps every card's canvas at the same vertical offset
   regardless of name length wrapping. */
.vt-heatmap-grid-title {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.8rem;
    min-height: 2.5rem;
}

.vt-heatmap-grid-title-row1 {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.vt-heatmap-grid-dot {
    flex: 0 0 auto;
    line-height: 1;
}

.vt-heatmap-grid-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.vt-heatmap-grid-title-row2 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.vt-heatmap-grid-band {
    color: var(--kb-text-muted);
    font-size: 0.75rem;
}

.vt-heatmap-small {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.vt-heatmap-small canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 6px;
}

/* Combined-heatmap hover tooltip (cell visit total + top contributors). */
.vt-heatmap-hover-tip {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    background: var(--kb-bg-elevated, var(--kb-bg-subtle));
    border: 1px solid var(--kb-border-subtle);
    border-radius: 6px;
    padding: 0.4rem 0.55rem;
    font-size: 0.75rem;
    color: var(--kb-text);
    box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.6);
    min-width: 120px;
}

.vt-heatmap-hover-total {
    font-weight: 600;
    margin-bottom: 0.2rem;
    font-family: 'Geist Mono', ui-monospace, monospace;
}

.vt-heatmap-hover-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--kb-text-muted);
}

/* Empty-state card */
.vt-empty-icon {
    opacity: 0.45;
}

/* ============================================================================
   POSITIONING POLISH PASS
   Intro banner, info icons on column headers, band pill chip.
   ============================================================================ */

.vt-info-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: color-mix(in oklab, var(--kb-info) 10%, var(--kb-bg-card));
    border: 1px solid color-mix(in oklab, var(--kb-info) 30%, transparent);
    color: var(--kb-text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.vt-info-banner > i.bi {
    color: var(--kb-info);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.vt-info-banner strong {
    color: var(--kb-text-primary);
    font-weight: 600;
}

.vt-info-banner em {
    color: var(--kb-text-primary);
    font-style: normal;
    font-weight: 600;
}

/* Info icon on column headers */
.vt-col-info {
    color: var(--kb-text-muted);
    font-size: 0.85em;
    cursor: help;
    transition: color 0.15s ease;
    vertical-align: baseline;
}

.vt-col-info:hover {
    color: var(--kb-info);
}

/* Bootstrap tooltips — dark-theme correction.
   Bootstrap's defaults derive tooltip text color from --bs-body-bg, which this
   project remaps to a dark color, collapsing tooltip text to invisible.
   Remap the tooltip tokens directly to our --kb-* surface/text variables. */
.tooltip {
    --bs-tooltip-color: var(--kb-text-primary);
    --bs-tooltip-bg: var(--kb-bg-card);
    --bs-tooltip-max-width: 260px;
    --bs-tooltip-padding-x: 0.6rem;
    --bs-tooltip-padding-y: 0.45rem;
    --bs-tooltip-font-size: 0.78rem;
    --bs-tooltip-opacity: 1;
}

/* Wider tooltip for the per-axis bar rows in the VSR-T expand panel.
   The body carries label + formula (in <code>) + description + per-row
   sigma interpretation; 260px wraps the formula awkwardly. */
.tooltip.vt-axis-tooltip {
    --bs-tooltip-max-width: 340px;
}

.tooltip.vt-match-elo-tip {
    --bs-tooltip-max-width: 340px;
}

.tooltip .tooltip-inner {
    border: 1px solid var(--kb-border-default);
    text-align: left;
    line-height: 1.4;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* Arrow color must match the background per placement — Bootstrap hardcodes
   these and does not read --bs-tooltip-bg for the arrow. */
.tooltip.bs-tooltip-top    .tooltip-arrow::before { border-top-color:    var(--kb-bg-card); }
.tooltip.bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color: var(--kb-bg-card); }
.tooltip.bs-tooltip-start  .tooltip-arrow::before { border-left-color:   var(--kb-bg-card); }
.tooltip.bs-tooltip-end    .tooltip-arrow::before { border-right-color:  var(--kb-bg-card); }
.tooltip.bs-tooltip-auto[data-popper-placement^="top"]    .tooltip-arrow::before { border-top-color:    var(--kb-bg-card); }
.tooltip.bs-tooltip-auto[data-popper-placement^="bottom"] .tooltip-arrow::before { border-bottom-color: var(--kb-bg-card); }
.tooltip.bs-tooltip-auto[data-popper-placement^="left"]   .tooltip-arrow::before { border-left-color:   var(--kb-bg-card); }
.tooltip.bs-tooltip-auto[data-popper-placement^="right"]  .tooltip-arrow::before { border-right-color:  var(--kb-bg-card); }

/* Split columns (PvP / PvE breakdowns) — visually secondary vs the combined total */
.vt-col-split,
td.vt-col-split {
    color: var(--kb-text-muted);
    font-size: 0.92em;
}

#leaderboard thead th.vt-col-split,
#career-table thead th.vt-col-split {
    color: var(--kb-text-muted);
    font-weight: 500;
}

/* Career leaderboard: show per-match averages, totals, or both */
#career-table.vt-career-cols-per-match .vt-career-col-total,
#career-table.vt-career-cols-totals .vt-career-col-avg {
    display: none;
}

/* Sticky table headers — keep column labels visible while scrolling the page.
   Anchored to the .kb-header height (64px). Uses --kb-bg-popover to match
   the existing `.table > thead` background in css/main.css (otherwise the
   thead would shift color on themes where -popover and -card diverge).

   IMPORTANT: the `position: sticky` declaration itself MUST live inside the
   >=992px media query alongside the wrapper's `overflow: visible` override.
   Below 992px the .table-responsive wrapper keeps Bootstrap's overflow-x:auto,
   which the CSS spec promotes into a y-axis scroll container too. If
   `position: sticky; top: 64px` were left always-on, the thead would anchor
   to the wrapper (not the page) and `top: 64px` would push it down 64px
   inside the wrapper — even though the wrapper never scrolls vertically —
   visually covering row #1 of the table. Do not hoist the sticky declaration
   back out of the media query without also fixing that. */
@media (min-width: 992px) {
    .vt-sticky-thead-card.table-responsive {
        overflow: visible;
    }
    .vt-sticky-thead thead th {
        position: sticky;
        top: 64px;
        z-index: 5;
        background: var(--kb-bg-popover);
        box-shadow: inset 0 -1px 0 var(--kb-border-subtle);
    }
}

/* Inside the Fullscreen modal the cloned table sits in its own scroll
   container (.modal-body), and the page header isn't above it — re-anchor
   sticky to the top of that scroll container. Declared independently of the
   >=992px media query because the modal's .modal-body is always a scroll
   container regardless of viewport width, so the sticky behaviour is safe
   (and desirable) at every breakpoint. */
#fullscreen-modal .vt-sticky-thead thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--kb-bg-popover);
    box-shadow: inset 0 -1px 0 var(--kb-border-subtle);
}

/* Movement band pill (replaces the muted band-label text) */
.vt-movement-band-pill {
    padding: 0.1em 0.5em;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.35;
    white-space: nowrap;
}

.vt-sort-caret {
    color: var(--kb-info);
    font-size: 0.75em;
    margin-left: 0.15em;
    vertical-align: baseline;
}

/* ============================================================================
   HEATMAP LEGEND
   Compact strip rendered above the per-player small-multiples grid.
   Spans the full grid row via grid-column: 1 / -1 so it sits above the cards.
   ============================================================================ */

.vt-heatmap-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    padding: 0.5rem 0.25rem 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--kb-text-muted);
    font-size: 0.75rem;
    border-bottom: 1px solid var(--kb-border-subtle);
}

.vt-heatmap-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.vt-heatmap-legend-diamond {
    width: 8px;
    height: 8px;
    background: var(--kb-info);
    transform: rotate(45deg);
    display: inline-block;
}

/* Team spawn swatch in the heatmap legend. Inline color set per item. */
.vt-heatmap-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
}

.vt-heatmap-legend-gradient {
    display: inline-block;
    width: 80px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(
        to right,
        color-mix(in oklab, var(--kb-info) 10%, transparent),
        color-mix(in oklab, var(--kb-info) 85%, transparent)
    );
}

.vt-heatmap-legend-label {
    font-size: 0.7rem;
}

/* =====================================================================
   Rich Match Picker
   ---------------------------------------------------------------------
   Faux-dropdown trigger in both hero contexts (#match-info on the
   per-match dashboard and the .vt-all-hero card on the All Matches
   view) opens #match-picker-modal, which houses a searchable card
   grid. Phase 2 will add a filter toolbar above the grid.
   ===================================================================== */

/* Map thumbnail in the match-info hero. 70x70 top-down image from
 * data/map-registry.json. Hidden (d-none) on matches whose map isn't
 * in the registry. Renders to the left of the match-picker trigger.
 * Wrapped in a `.vt-map-thumb-btn` button that opens #map-info-modal
 * with the full-resolution image + registry metadata. */
.vt-map-thumb {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    border: 1px solid var(--kb-border-subtle);
    background: var(--kb-bg-subtle);
    object-fit: cover;
    flex-shrink: 0;
    display: block;
    transition: border-color var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease),
                transform var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease);
}

.vt-map-thumb-btn {
    position: relative;
    cursor: pointer;
    line-height: 0;
    border-radius: 8px;
}

.vt-map-thumb-btn:hover .vt-map-thumb,
.vt-map-thumb-btn:focus-visible .vt-map-thumb {
    border-color: var(--kb-primary);
    transform: translateY(-1px);
}

/* Lightbox-style affordance: a small zoom-in badge in the bottom-right
 * corner of the thumbnail signals the image opens the Map Info Modal.
 * Pointer-events disabled so the wrapping button still owns the click. */
.vt-map-thumb-overlay {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: color-mix(in oklab, var(--kb-bg-surface) 75%, transparent);
    color: var(--kb-primary);
    font-size: 0.85rem;
    line-height: 1;
    pointer-events: none;
    backdrop-filter: blur(2px);
    border: 1px solid var(--kb-border-subtle);
    transition: transform var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease),
                background var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease);
}

.vt-map-thumb-btn:hover .vt-map-thumb-overlay,
.vt-map-thumb-btn:focus-visible .vt-map-thumb-overlay {
    transform: scale(1.1);
    background: color-mix(in oklab, var(--kb-primary) 25%, var(--kb-bg-surface));
}

/* Map Info Modal: full-resolution map image + registry / terrain meta.
 * Triggered by the .vt-map-thumb-btn in the match-info banner. */
.vt-map-info-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--kb-border-subtle);
    background: var(--kb-bg-subtle);
    display: block;
}

/* Map thumbnail brightness lift.
 *
 * Selectively applied to <img> surfaces when the registry's `luma_band`
 * field flags an image as `dim` or `dark`. Classification happens once
 * at pipeline time (`compute_image_luma()` in scripts/build_map_registry.py);
 * `--vt-map-img-lift-*` custom properties are defined in the :root
 * block above for theme-layer tunability.
 *
 * Surfaces that pick up these classes:
 *   - .vt-map-thumb, .vt-map-info-image (dashboard banner + Map Info Modal)
 *   - .vt-map-card-thumb, .vt-map-single-image (/map/ browser pages)
 *
 * Equivalent canvas-side lifts live in `_drawMapImageLayer()` in
 * js/positioning-charts.js (literal filter strings — canvas's
 * `ctx.filter` cannot resolve `var(...)`). Retune both in lockstep. */
.vt-map-img-lift-1 { filter: var(--vt-map-img-lift-1); }
.vt-map-img-lift-2 { filter: var(--vt-map-img-lift-2); }

.vt-map-info-meta {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.45rem 1rem;
    font-size: 0.9rem;
}

.vt-map-info-meta dt {
    color: var(--kb-text-muted);
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

.vt-map-info-meta dd {
    color: var(--kb-text-primary);
    margin: 0;
    word-break: break-word;
}

/* Author / community blurb shown beneath the map image in the left
 * column. Multi-line strings (registry `description` is a raw newline-
 * delimited dump from iondriver's API) read better here than crammed
 * into the right-column metadata grid. */
.vt-map-info-description {
    margin-top: 0.75rem;
    color: var(--kb-text-secondary);
    font-style: italic;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0.6rem 0.85rem;
    border-left: 2px solid var(--kb-border-subtle);
    background: color-mix(in oklab, var(--kb-bg-subtle) 40%, transparent);
    border-radius: 0 6px 6px 0;
    word-break: break-word;
}

.vt-map-info-meta-empty {
    color: var(--kb-text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* vsrmaplist-sourced map tags (e.g. "popular", "played"). Rendered as
 * inline chips in the Map Info Modal's Tags row. Aesthetic mirrors the
 * project's existing pill-shaped badge treatments. */
.vt-map-info-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    margin-right: 0.25rem;
    border-radius: 999px;
    background: var(--kb-bg-subtle);
    color: var(--kb-text-secondary);
    border: 1px solid var(--kb-border-subtle);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
}

.vt-map-info-tag:last-child {
    margin-right: 0;
}

.vt-map-info-meta .vt-map-info-meta-section {
    grid-column: 1 / -1;
    color: var(--kb-text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--kb-border-subtle);
}

.vt-map-info-meta .vt-map-info-meta-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* --- Trigger button (lives in each hero) --- */

.vt-match-picker-trigger {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.4rem 0.85rem 0.45rem;
    min-width: 180px;
    max-width: 320px;
    border: 1px solid var(--kb-border-subtle);
    border-radius: 0.5rem;
    background: color-mix(in oklab, var(--kb-bg-subtle) 50%, transparent);
    color: var(--kb-text-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease),
                transform var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease),
                background var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease);
}

.vt-match-picker-trigger:hover,
.vt-match-picker-trigger:focus-visible {
    border-color: var(--kb-primary);
    transform: translateY(-1px);
    background: color-mix(in oklab, var(--kb-bg-subtle) 75%, transparent);
    outline: none;
}

.vt-match-picker-trigger .stat-label {
    font-size: 0.65rem;
    line-height: 1;
    opacity: 0.9;
}

.vt-match-picker-trigger-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vt-match-picker-trigger-primary .bi-chevron-down {
    font-size: 0.75rem;
    color: var(--kb-text-muted);
    transition: transform var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease);
}

.vt-match-picker-trigger[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.vt-match-picker-trigger-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.vt-match-picker-trigger-secondary {
    font-size: 0.75rem;
    color: var(--kb-text-muted);
    font-family: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Modal --- */

.vt-match-picker-modal .modal-content {
    background: var(--kb-bg-card);
    border: 1px solid var(--kb-border-subtle);
}

.vt-match-picker-modal .modal-header {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    align-items: center;
    border-bottom: 1px solid var(--kb-border-subtle);
}

.vt-match-picker-modal .modal-title {
    flex: 0 0 auto;
}

.vt-match-picker-search {
    flex: 1 1 260px;
    max-width: 360px;
    margin-left: auto;
    border: 1px solid var(--kb-primary);
    border-radius: 0.375rem;
    background: color-mix(in oklab, var(--kb-primary) 14%, var(--kb-bg-card));
    overflow: hidden;
}

.vt-match-picker-modal .vt-match-picker-search > .input-group-text,
.vt-match-picker-modal .vt-match-picker-search > .form-control {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.vt-match-picker-modal .vt-match-picker-search > .input-group-text {
    color: var(--kb-primary);
}

.vt-match-picker-modal .vt-match-picker-search > .form-control:focus {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--kb-text-primary);
}

.vt-match-picker-modal .vt-match-picker-search:focus-within {
    box-shadow: 0 0 0 0.2rem color-mix(in oklab, var(--kb-primary) 28%, transparent);
}

.vt-match-picker-modal .modal-body {
    background: transparent;
}

/* --- Grid --- */

.vt-match-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.75rem;
}

/* --- Card (rendered as <button>, visually a card) --- */

.vt-match-picker-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--kb-border-subtle);
    border-radius: 0.55rem;
    background: color-mix(in oklab, var(--kb-bg-subtle) 55%, transparent);
    color: var(--kb-text-primary);
    text-align: left;
    font: inherit;
    cursor: pointer;
    /* Buttons clip overflow by default, which slices the winner ring.
       Name ellipsis stays on the inner leader span. */
    overflow: visible;
    transition: border-color var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease),
                transform var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease),
                background var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease);
    position: relative;
}

.vt-match-picker-card:hover,
.vt-match-picker-card:focus-visible {
    border-color: var(--kb-primary);
    transform: translateY(-1px);
    background: color-mix(in oklab, var(--kb-bg-subtle) 75%, transparent);
    outline: none;
}

.vt-match-picker-card.is-active {
    border-color: var(--kb-primary);
    background: color-mix(in oklab, var(--kb-primary) 10%, var(--kb-bg-subtle));
}

.vt-match-picker-card.is-active::after {
    content: "\F26A"; /* bi-check-lg */
    font-family: "bootstrap-icons";
    position: absolute;
    top: 0.55rem;
    right: 0.6rem;
    color: var(--kb-primary);
    font-size: 1rem;
    line-height: 1;
}

.vt-match-picker-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Thumbnail on the left of each match-picker card. Top-down map image
 * from data/map-registry.json; when unavailable (map not in registry
 * or registry not fetched yet), renders a neutral placeholder so card
 * heights stay stable. Square to preserve aspect ratio regardless of
 * source image dimensions. */
.vt-match-picker-card-thumb {
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    border-radius: 0.4rem;
    border: 1px solid var(--kb-border-subtle);
    background: color-mix(in oklab, var(--kb-bg-subtle) 80%, transparent);
    object-fit: cover;
    align-self: center;
}

.vt-match-picker-card-thumb--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--kb-text-muted);
    font-size: 1.5rem;
}

/* Wrapper around the text side of the card. flex-column so the existing
 * head/meta/submeta/leaders rows still stack vertically inside. */
.vt-match-picker-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1 1 auto;
    min-width: 0;
}

@media (max-width: 480px) {
    /* On narrow viewports the left thumb eats too much of the card width.
     * Fold to a top thumb / bottom text layout at 64px height. */
    .vt-match-picker-card {
        flex-direction: column;
        align-items: stretch;
    }
    .vt-match-picker-card-thumb {
        width: 100%;
        height: 72px;
    }
}

.vt-match-picker-card-title {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    flex: 1 1 auto;
}

.vt-match-picker-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.vt-void-banner {
    flex: 1 0 100%;
    margin: 0;
    padding: 0.5rem 0.75rem;
    color: var(--kb-text-secondary);
    background: var(--kb-bg-subtle);
    border: 1px solid var(--kb-border-subtle);
    border-radius: var(--bs-border-radius);
    font-size: 0.875rem;
}

.vt-void-chip {
    display: inline-flex;
    align-items: center;
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--kb-text-muted);
    background: var(--kb-bg-subtle);
    border: 1px solid var(--kb-border-subtle);
    border-radius: 999px;
    vertical-align: middle;
}

.vt-match-picker-vod {
    color: var(--vt-youtube);
    font-size: 0.72rem;
    flex: 0 0 auto;
    vertical-align: 0.05em;
}

.vt-match-picker-card-meta {
    font-size: 0.75rem;
    color: var(--kb-text-muted);
    font-family: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
    white-space: nowrap;
}

.vt-match-picker-card-rawmap {
    font-size: 0.72rem;
    color: var(--kb-text-muted);
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vt-match-picker-card-submeta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--kb-text-muted);
}

.vt-match-picker-card-submitter {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.vt-match-picker-card-date {
    font-family: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vt-match-picker-card-leaders {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding-top: 0.4rem;
    margin-top: 0.15rem;
    border-top: 1px dashed var(--kb-border-subtle);
    font-size: 0.8rem;
    min-width: 0;
}

.vt-match-picker-card-leader {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    /* Room so the winner ring is not flush against this overflow clip.
       Negative margin keeps the row the same size. */
    padding: 2px;
    margin: -2px;
}

/* Faction letter in place of the old team-colored dot. I / S / H still
   names the faction, but the color does not: gold for the winner, grey
   for everyone else (the loser, and both sides when the match has no winner). */
.vt-match-picker-faction-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
    border-radius: 0.18rem;
    border: 1px solid currentColor;
    background: color-mix(in oklab, currentColor 14%, transparent);
    color: var(--bs-secondary);
    font-family: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
}

.vt-match-picker-card-leader--winner .vt-match-picker-faction-mark {
    color: var(--kb-warning);
}

.vt-match-picker-card-leader-vs {
    color: var(--kb-text-muted);
    font-size: 0.75rem;
    font-style: italic;
    flex: 0 0 auto;
}

/* --- "All Matches" pinned card --- */

.vt-match-picker-card--all {
    background: color-mix(in oklab, var(--kb-primary) 6%, var(--kb-bg-subtle));
    border-style: dashed;
}

.vt-match-picker-card--all:hover,
.vt-match-picker-card--all:focus-visible {
    background: color-mix(in oklab, var(--kb-primary) 12%, var(--kb-bg-subtle));
}

/* --- Empty state (search / filters yield zero matches) --- */

.vt-match-picker-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--kb-text-muted);
    border: 1px dashed var(--kb-border-subtle);
    border-radius: 0.5rem;
    background: color-mix(in oklab, var(--kb-bg-subtle) 30%, transparent);
    margin-top: 0.5rem;
}

/* --- Phase 2: Filter toolbar --- */

.vt-match-picker-filters {
    margin-bottom: 0.85rem;
    border: 1px solid var(--kb-border-subtle);
    border-radius: 0.55rem;
    background: color-mix(in oklab, var(--kb-bg-subtle) 35%, transparent);
    overflow: hidden;
}

.vt-match-picker-filters-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem;
}

.vt-match-picker-filter-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    min-height: 1.9rem;
}

.vt-match-picker-filter-row--controls {
    justify-content: space-between;
    padding-bottom: 0.35rem;
    border-bottom: 1px dashed var(--kb-border-subtle);
    margin-bottom: 0.1rem;
}

.vt-match-picker-filter-label {
    flex: 0 0 84px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--kb-text-muted);
}

.vt-match-picker-filter-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.vt-match-picker-filter-summary {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.8rem;
    color: var(--kb-text-muted);
}

.vt-match-picker-sort {
    min-width: 150px;
    max-width: 220px;
}

/* Player-count multi-select. Looks like the Sort <select>; the menu is
   checkboxes so several counts can be OR'd. None checked reads "Any". */
.vt-match-picker-count {
    position: relative;
    flex: 0 1 auto;
}

.vt-match-picker-count-toggle {
    width: auto;
    min-width: 7.5rem;
    max-width: 14rem;
    cursor: pointer;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vt-match-picker-count-menu {
    max-height: 16rem;
    overflow-y: auto;
    min-width: 7.5rem;
    padding: 0.25rem;
    /* Portaled to document.body while open. The modal sits at 1055,
       so the menu has to paint above it. */
    z-index: 1080;
}

.vt-match-picker-count-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--kb-text-primary);
}

.vt-match-picker-count-item .form-check-input {
    margin: 0;
    flex: 0 0 auto;
}

.vt-match-picker-count-menu .dropdown-item:active {
    background: color-mix(in oklab, var(--kb-primary) 14%, transparent);
    color: var(--kb-text-primary);
}

.vt-match-picker-chipset {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    flex: 1 1 auto;
    min-width: 0;
}

.vt-match-picker-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--kb-border-subtle);
    border-radius: 999px;
    background: color-mix(in oklab, var(--kb-bg-card) 88%, transparent);
    color: var(--kb-text-primary);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    transition: border-color var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease),
                background var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease),
                color var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease);
}

.vt-match-picker-chip:hover,
.vt-match-picker-chip:focus-visible {
    border-color: var(--kb-primary);
    outline: none;
}

.vt-match-picker-chip.is-active {
    background: var(--kb-primary);
    color: var(--kb-primary-fg);
    border-color: var(--kb-primary);
}

.vt-match-picker-chip.is-active:hover,
.vt-match-picker-chip.is-active:focus-visible {
    background: color-mix(in oklab, var(--kb-primary) 85%, white);
}

/* --- Players section (chip list with own search + Match-mode toggle +
   Role toggle). Replaced the old Commanders section: the chip list now
   spans the full roster (every name that ever appeared in any match)
   and role membership is derived per-match from `team_leaders`. */

.vt-match-picker-filter-row--players {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.vt-match-picker-players-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    margin: 0;
    padding: 0.1rem 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    min-height: 1.9rem;
}

.vt-match-picker-players-toggle:hover .vt-match-picker-filter-label,
.vt-match-picker-players-toggle:hover .vt-match-picker-players-chevron {
    color: var(--kb-text-primary);
}

.vt-match-picker-players-toggle:focus-visible {
    outline: 2px solid var(--kb-primary);
    outline-offset: 2px;
}

.vt-match-picker-players-summary {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--kb-text-muted);
}

.vt-match-picker-players-chevron {
    margin-left: auto;
    flex: 0 0 auto;
    color: var(--kb-text-muted);
    font-size: 0.75rem;
    transition: transform var(--vt-anim-duration, 0.15s) var(--vt-anim-ease, ease);
}

.vt-match-picker-filter-row--players[data-expanded="true"] .vt-match-picker-players-chevron {
    transform: rotate(180deg);
}

.vt-match-picker-faction {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.vt-match-picker-faction-select {
    width: auto;
    min-width: 7.25rem;
}

.vt-match-picker-faction-select:disabled {
    opacity: 0.45;
}

.vt-match-picker-faction-vs {
    color: var(--kb-text-muted);
    font-size: 0.75rem;
    font-style: italic;
}

.vt-match-picker-players {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
}

.vt-match-picker-players-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.vt-match-picker-players-search {
    flex: 1 1 200px;
    max-width: 280px;
}

.vt-match-picker-players-mode,
.vt-match-picker-players-role {
    flex: 0 0 auto;
}

.vt-match-picker-chipset--players {
    max-height: 132px;
    overflow-y: auto;
    padding: 0.35rem;
    border: 1px dashed var(--kb-border-subtle);
    border-radius: 0.4rem;
    background: color-mix(in oklab, var(--kb-bg-subtle) 50%, transparent);
    scrollbar-width: thin;
    scrollbar-color: var(--kb-border-subtle) transparent;
}

/* --- Active-filter badge on trigger + inline mobile toggle --- */

.vt-match-picker-trigger-badge,
.vt-match-picker-filters-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 999px;
    background: var(--kb-primary);
    color: var(--kb-primary-fg);
}

/* --- Clear-all button spacing --- */

.vt-match-picker-clear {
    white-space: nowrap;
}

/* --- Responsive: mobile Filters disclosure --- */

.vt-match-picker-filters-toggle {
    display: none;
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: none;
    border-bottom: 1px solid var(--kb-border-subtle);
    background: transparent;
    color: var(--kb-text-primary);
    font: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    align-items: center;
    gap: 0.35rem;
}

.vt-match-picker-filters-toggle:focus-visible {
    outline: 2px solid var(--kb-primary);
    outline-offset: -2px;
}

.vt-match-picker-filters[data-expanded="true"] .vt-match-picker-filters-toggle .bi-chevron-down {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .vt-match-picker-filters-toggle {
        display: flex;
    }

    .vt-match-picker-filters-body {
        display: none;
    }

    .vt-match-picker-filters[data-expanded="true"] .vt-match-picker-filters-body {
        display: flex;
    }

    /* Labels stack above chipsets on narrow screens for readability. */
    .vt-match-picker-filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
    }

    .vt-match-picker-filter-label {
        flex: 0 0 auto;
    }

    .vt-match-picker-filter-row--controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .vt-match-picker-trigger {
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    .vt-match-picker-trigger-name {
        max-width: 100%;
    }

    .vt-match-picker-modal .modal-dialog {
        margin: 0;
    }

    .vt-match-picker-modal .modal-content {
        min-height: 100vh;
        border-radius: 0;
    }

    .vt-match-picker-modal .modal-header {
        flex-wrap: wrap;
    }

    .vt-match-picker-search {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        margin-left: 0;
    }

    .vt-match-picker-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   ALL MATCHES HERO
   Markup in index.html (#all-tab-overview): .vt-all-hero card + 5-up
   .vt-hero-stats grid. Renderer in js/app.js: renderHeroStats().
   ============================================================================ */

.vt-all-hero-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.vt-all-hero-head h4 {
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Primary fill. .card forces a glass background with !important, so this
   has to win the same way. Stat tiles sit as translucent panels on it. */
.vt-all-hero.card {
    background: var(--kb-primary) !important;
    color: var(--kb-primary-fg);
    border-color: transparent !important;
}

.vt-all-hero.card:hover {
    border-color: transparent !important;
}

.vt-all-hero .vt-hero-stat {
    background: color-mix(in oklab, var(--kb-primary-fg) 12%, transparent);
    border-color: color-mix(in oklab, var(--kb-primary-fg) 28%, transparent);
}

.vt-all-hero .vt-hero-stat-label,
.vt-all-hero .vt-hero-stat-sub,
.vt-all-hero .vt-hero-stat-icon {
    color: color-mix(in oklab, var(--kb-primary-fg) 78%, transparent);
}

.vt-all-hero .vt-hero-stat-value,
.vt-all-hero .vt-all-hero-head h4 {
    color: var(--kb-primary-fg);
}

.vt-all-hero a.vt-hero-stat-label {
    text-decoration: none;
}

.vt-all-hero a.vt-hero-stat-label:hover {
    color: var(--kb-primary-fg);
    text-decoration: underline;
}

.vt-hero-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (max-width: 1199.98px) {
    .vt-hero-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .vt-hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .vt-hero-stats {
        grid-template-columns: 1fr;
    }
}

.vt-hero-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1.1rem;
    background: color-mix(in oklab, var(--kb-bg-card) 60%, transparent);
    border: 1px solid var(--kb-border-subtle);
    border-radius: 0.55rem;
    position: relative;
    overflow: hidden;
}

.vt-hero-stat-icon {
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
    font-size: 1.25rem;
    color: var(--kb-text-muted);
    opacity: 0.5;
}

.vt-hero-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--kb-text-muted);
    font-weight: 500;
}

.vt-hero-stat-value {
    font-family: 'Geist Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--kb-text-primary);
}

.vt-hero-stat-sub a {
    color: var(--kb-text-secondary);
    text-decoration: none;
}

.vt-hero-stat-sub a:hover {
    text-decoration: underline;
}

.vt-standings-table {
    font-size: 0.85rem;
}

.vt-vtsr-c-unranked {
    margin-top: 1.5rem;
    padding-top: 1.1rem;
    border-top: 1px dashed color-mix(in oklab, var(--kb-text-muted) 28%, transparent);
}

.vt-vtsr-c-unranked-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--kb-text-muted);
    margin: 0 0 0.35rem 0;
}

.vt-vtsr-c-unranked-blurb {
    font-size: 0.82rem;
    color: var(--kb-text-muted);
    margin-bottom: 0.75rem;
    max-width: 52rem;
}

.vt-hero-stat-sub {
    font-size: 0.78rem;
    color: var(--kb-text-muted);
    /* Stop the optional sub-line from shoving the value down on hover or
       wrapping mid-card; truncates with ellipsis on overflow. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Side-by-side cards stretch with the row (h-100). The chart box has to
   grow with the card body or a horizontal bar chart stays at min-height
   while the sibling (rivalries, head-to-head) makes the card taller. */
#section-global-weapon > .card-body,
#section-commander-faction-picks > .card-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#section-global-weapon .chart-container,
#section-commander-faction-picks .chart-container {
    flex: 1 1 auto;
    height: 100%;
    min-height: 320px;
}

/* ============================================================================
   DOCS SEARCH PALETTE
   Cmd/Ctrl+K modal that fuzzy-searches the rendered DATA_DICTIONARY.md.
   Markup in docs/index.html (#docs-search-modal); behavior in js/docs-search.js.
   Matches the existing match-picker glass aesthetic.
   ============================================================================ */

/* Algolia-style centered trigger pill in the docs navbar. Absolutely
 * positioned inside the sticky navbar so it stays at viewport-center
 * regardless of brand / collapse-menu widths. Hidden on mobile (d-md-flex
 * on the markup); the burger menu has its own icon-button trigger. */
.vt-docs-nav {
    position: sticky; /* matches existing .sticky-top; absolute children anchor here */
}

.vt-docs-search-pill {
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.7rem 0.4rem 0.85rem;
    min-width: 0;
    max-width: 280px;
    background: var(--kb-bg-subtle);
    border: 1px solid var(--kb-border-subtle);
    border-radius: 999px;
    color: var(--kb-text-muted);
    font-size: 0.85rem;
    line-height: 1.2;
    cursor: pointer;
    text-align: left;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.vt-docs-search-pill:hover,
.vt-docs-search-pill:focus-visible {
    background: var(--kb-bg-card);
    border-color: var(--kb-primary);
    color: var(--kb-text-primary);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--kb-primary) 18%, transparent);
}

.vt-docs-search-pill-icon {
    font-size: 1rem;
    color: var(--kb-text-muted);
    flex-shrink: 0;
}

.vt-docs-search-pill:hover .vt-docs-search-pill-icon,
.vt-docs-search-pill:focus-visible .vt-docs-search-pill-icon {
    color: var(--kb-primary);
}

.vt-docs-search-pill-label {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vt-docs-search-pill-kbd {
    font-family: 'Geist Mono', ui-monospace, SFMono-Regular, 'SF Mono', Consolas, monospace;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    background: var(--kb-bg-card);
    color: var(--kb-text-muted);
    border: 1px solid var(--kb-border-subtle);
    border-radius: 4px;
    line-height: 1;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

/* Sit in the leftover gap after the brand (not viewport-centered) so
   the wider Models / ELO dropdown cluster never collides. Hidden below
   xl via .d-xl-flex on the button; the menu Search row covers < xl. */
@media (min-width: 1200px) {
    .vt-docs-search-pill {
        position: static;
        transform: none;
        flex: 0 1 280px;
    }
}

.vt-docs-search-modal .modal-dialog {
    max-width: 720px;
}

.vt-docs-search-modal .modal-content {
    background: var(--kb-bg-card);
    border: 1px solid var(--kb-border-subtle);
    border-radius: 12px;
    box-shadow: var(--vt-shadow-elevation-3, 0 16px 48px rgba(0, 0, 0, 0.35));
    overflow: hidden;
}

.vt-docs-search-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--kb-border-subtle);
    background: var(--kb-bg-card);
}

.vt-docs-search-icon {
    color: var(--kb-text-muted);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.vt-docs-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    color: var(--kb-text-primary);
    font-size: 1rem;
    padding: 0;
    line-height: 1.4;
}

.vt-docs-search-input:focus {
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    color: var(--kb-text-primary);
}

.vt-docs-search-input::placeholder {
    color: var(--kb-text-muted);
    opacity: 0.7;
}

/* Cancel the default search input clear (X) Webkit/Edge button so the layout
 * stays predictable; users have Esc + the modal close button. */
.vt-docs-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.vt-docs-search-count {
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-size: 0.75rem;
    color: var(--kb-text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}

.vt-docs-search-body {
    padding: 0;
    max-height: min(60vh, 520px);
    overflow-y: auto;
}

.vt-docs-search-results {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
}

.vt-docs-search-result {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid transparent;
}

.vt-docs-search-result-link {
    display: block;
    padding: 0.65rem 1rem;
    color: var(--kb-text-primary);
    text-decoration: none;
    transition: background 120ms ease;
    border-left: 2px solid transparent;
}

.vt-docs-search-result.is-active .vt-docs-search-result-link,
.vt-docs-search-result-link:hover {
    background: var(--kb-bg-subtle);
    border-left-color: var(--kb-primary);
    text-decoration: none;
    color: var(--kb-text-primary);
}

.vt-docs-search-result-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}

.vt-docs-search-result-section {
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    background: var(--kb-primary);
    color: var(--kb-primary-fg, #fff);
    border-radius: 4px;
    line-height: 1.3;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.vt-docs-search-result-heading {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--kb-text-primary);
}

.vt-docs-search-result-breadcrumb {
    font-size: 0.72rem;
    color: var(--kb-text-muted);
    margin-bottom: 0.15rem;
    line-height: 1.4;
}

.vt-docs-search-result-breadcrumb i {
    font-size: 0.6rem;
    margin: 0 0.15rem;
    opacity: 0.6;
}

.vt-docs-search-result-snippet {
    font-size: 0.82rem;
    color: var(--kb-text-secondary);
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.vt-docs-search-result-snippet mark {
    background: color-mix(in srgb, var(--kb-primary) 25%, transparent);
    color: var(--kb-text-primary);
    padding: 0 0.1rem;
    border-radius: 2px;
}

.vt-docs-search-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--kb-text-muted);
    font-size: 0.9rem;
    list-style: none;
}

.vt-docs-search-footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--kb-border-subtle);
    background: var(--kb-bg-subtle);
    justify-content: flex-end;
}

.vt-docs-search-legend {
    font-size: 0.72rem;
    color: var(--kb-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.vt-docs-search-legend kbd {
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    background: var(--kb-bg-card);
    color: var(--kb-text-secondary);
    border: 1px solid var(--kb-border-subtle);
    border-radius: 3px;
    line-height: 1;
    margin-right: 0.15rem;
}

.vt-docs-search-sep {
    opacity: 0.5;
    margin: 0 0.25rem;
}

@media (max-width: 575.98px) {
    .vt-docs-search-modal .modal-dialog {
        margin: 0;
    }

    .vt-docs-search-modal .modal-content {
        min-height: 100vh;
        border-radius: 0;
    }

    .vt-docs-search-body {
        max-height: none;
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vt-docs-search-result-link {
        transition: none;
    }
}

/* ============================================================================
   Match Highlights — fixed-slate award catalog (12 cards, always-on).
   Tile is the unit; the section card uses the standard glass surface from
   `.card`. Layout uses Bootstrap row-cols utilities; tile styling lives here.
   xl breakpoint (>=1200px): 6 tiles wide, flavor copy collapses to a tooltip
   to keep tiles compact. md/lg/sm/xs: flavor copy renders inline below the
   value.
   ============================================================================ */

.vt-highlights-card .card-header h5 {
    color: var(--kb-text-primary);
}

.vt-highlight-tile {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.85rem 0.9rem;
    border-radius: 0.6rem;
    background: color-mix(in oklab, var(--kb-bg-card) 92%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-text-primary) 8%, transparent);
    box-shadow: var(--vt-shadow-elevation-1, 0 1px 2px rgba(0, 0, 0, 0.18));
    transition: border-color var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease),
                box-shadow var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease),
                transform var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease);
}

.vt-highlight-tile:hover {
    border-color: color-mix(in oklab, var(--kb-text-primary) 16%, transparent);
    transform: translateY(-1px);
}

.vt-highlight-tile--dominant {
    border-color: color-mix(in oklab, var(--kb-primary) 45%, transparent);
    box-shadow: 0 0 0 1px color-mix(in oklab, var(--kb-primary) 22%, transparent),
                var(--vt-shadow-elevation-1, 0 1px 2px rgba(0, 0, 0, 0.18));
}

.vt-highlight-tile--dominant:hover {
    border-color: color-mix(in oklab, var(--kb-primary) 65%, transparent);
}

.vt-highlight-tile-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--kb-text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.vt-highlight-tile-icon {
    font-size: 0.95rem;
    color: var(--kb-primary);
}

.vt-highlight-tile--dominant .vt-highlight-tile-icon {
    color: var(--kb-primary);
    filter: drop-shadow(0 0 4px color-mix(in oklab, var(--kb-primary) 45%, transparent));
}

.vt-highlight-tile-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vt-highlight-tile-winner {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--kb-text-primary);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Keep pair winners ("A vs B") on one row when possible; clamp at two. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.vt-highlight-tile-vs {
    color: var(--kb-text-muted);
    font-weight: 500;
    margin: 0 0.3rem;
}

.vt-highlight-tile-value {
    font-family: var(--vt-font-mono, "Geist Mono", ui-monospace, monospace);
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--kb-text-primary);
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.vt-highlight-tile--dominant .vt-highlight-tile-value {
    color: var(--kb-primary);
}

/* Unit suffix on the headline value. Smaller, regular weight, system font
   (Geist Sans renders short word units cleaner than mono); muted color so
   the big number remains the visual anchor. Slight vertical lift makes the
   unit read as a label rather than competing with the value baseline. */
.vt-highlight-tile-value-unit {
    font-family: var(--vt-font-system, "Geist", system-ui, sans-serif);
    font-size: 0.55em;
    font-weight: 500;
    color: var(--kb-text-muted);
    letter-spacing: 0;
    margin-left: 0.2em;
    vertical-align: 0.2em;
}

/* Schema-v2 breakdown line: pre-computed context that gives the headline value
   meaning ("4.00" -> "12K / 3D (4.00)"). Sits between the big value and the
   runner-up line; visible at every breakpoint (unlike `vt-highlight-tile-copy`
   which xl hides). Names are inline-bold; numerics use the mono stack so digits
   align across cards. */
.vt-highlight-tile-breakdown {
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--kb-text-secondary);
    font-variant-numeric: tabular-nums;
}

.vt-highlight-tile-copy {
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--kb-text-secondary);
    /* Wraps gracefully on small/medium tiles; xl hides this and uses a tooltip. */
}

.vt-highlight-tile-runner {
    font-size: 0.74rem;
    color: var(--kb-text-muted);
    margin-top: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vt-highlight-tile-runner-val {
    color: var(--kb-text-secondary);
    font-family: var(--vt-font-mono, "Geist Mono", ui-monospace, monospace);
    margin-left: 0.25rem;
}

.vt-highlight-tile-runner--solo {
    font-style: italic;
}

/* Compact xl layout: 6 tiles wide, drop the flavor copy and lean on the
   tooltip (rendered via the `title` attr by renderHighlights). */
@media (min-width: 1200px) {
    .vt-highlight-tile {
        padding: 0.75rem 0.8rem;
        gap: 0.3rem;
    }

    .vt-highlight-tile-copy {
        display: none;
    }

    /* Keep the breakdown visible on xl, but force a single-line ellipsis to
       protect tile width. The tooltip (carrying the flavor copy) provides
       any overflow narrative. */
    .vt-highlight-tile-breakdown {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.74rem;
    }

    .vt-highlight-tile-value {
        font-size: 1.3rem;
    }

    .vt-highlight-tile-winner {
        font-size: 0.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vt-highlight-tile {
        transition: none;
    }

    .vt-highlight-tile:hover {
        transform: none;
    }
}

/* ============================================================================
   VSR-T LEADERBOARD + 5-TIER LADDER
   Render-layer presentation for the All Matches → Overview tab.
   Tier color tokens lean on the existing --kb-* palette where possible
   (Tier 3 picks up project blue so the anchor band matches the brand).
   ============================================================================ */

:root {
    --vt-tier-0: #ff5fa2;                     /* Tier 0 — rose, above gold */
    --vt-tier-1: #f5c518;                     /* Tier 1 — gold */
    --vt-tier-2: #84d6e6;                     /* Tier 2 — silver-cyan */
    --vt-tier-3: var(--kb-primary);           /* Tier 3 — anchor band, brand */
    --vt-tier-4: #f0a93b;                     /* Tier 4 — warm amber */
    --vt-tier-5: var(--kb-text-muted);        /* Tier 5 — muted slate (wide band) */
}

.vt-tier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    padding: 0.1rem 0.45rem;
    border-radius: 0.4rem;
    font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 600;
    font-size: 0.78rem;
    line-height: 1.2;
    color: var(--kb-bg-primary);
    background: var(--kb-text-muted);  /* default for unknown tier */
    cursor: default;
    user-select: none;
}

.vt-tier-badge.vt-tier-0 { background: var(--vt-tier-0); color: #1f0612; }
.vt-tier-badge.vt-tier-1 { background: var(--vt-tier-1); color: #1a1306; }
.vt-tier-badge.vt-tier-2 { background: var(--vt-tier-2); color: #061520; }
.vt-tier-badge.vt-tier-3 { background: var(--vt-tier-3); color: var(--kb-bg-primary); }
.vt-tier-badge.vt-tier-4 { background: var(--vt-tier-4); color: #1a1006; }
.vt-tier-badge.vt-tier-5 {
    background: color-mix(in oklab, var(--vt-tier-5) 60%, transparent);
    color: var(--kb-text-primary);
}

.vt-vtsr-provisional {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    padding: 0.1rem 0.45rem;
    border-radius: 0.4rem;
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-weight: 600;
    font-size: 0.78rem;
    line-height: 1.2;
    color: var(--kb-text-muted);
    background: color-mix(in oklab, var(--kb-text-muted) 22%, transparent);
    border: 1px dashed color-mix(in oklab, var(--kb-text-muted) 38%, transparent);
    cursor: default;
    user-select: none;
}

/* ============================================================================
   VSR-T display layer (js/vtsr-display.js): band chip, fuzzy position bar,
   per-game verdict chip. VSR-T never renders as a number.
   ============================================================================ */
:is(.vt-band-chip, .vt-band-bar)[data-tier="0"] { --vt-band-color: var(--vt-tier-0); }
:is(.vt-band-chip, .vt-band-bar)[data-tier="1"] { --vt-band-color: var(--vt-tier-1); }
:is(.vt-band-chip, .vt-band-bar)[data-tier="2"] { --vt-band-color: var(--vt-tier-2); }
:is(.vt-band-chip, .vt-band-bar)[data-tier="3"] { --vt-band-color: var(--vt-tier-3); }
:is(.vt-band-chip, .vt-band-bar)[data-tier="4"] { --vt-band-color: var(--vt-tier-4); }
:is(.vt-band-chip, .vt-band-bar)[data-tier="5"] { --vt-band-color: var(--kb-text-secondary); }

.vt-band-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    vertical-align: middle;
    cursor: default;
}
.vt-band-half {
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--kb-text-secondary);
}
.vt-band-half[data-half="upper"] { color: var(--kb-text-primary); }
.vt-band-half.vt-band-half--compact {
    font-size: 0.6rem;
    color: var(--vt-band-color, var(--kb-text-secondary));
}
/* Muted chip (e.g. the ladder's Peak column): one subtle tone for the
   badge, numeral and caret so it never competes with the current band. */
.vt-band-chip--muted .vt-tier-badge {
    background: color-mix(in oklab, var(--kb-text-muted) 22%, transparent);
    color: var(--kb-text-muted);
}
.vt-band-chip--muted .vt-band-half,
.vt-band-chip--muted .vt-band-half.vt-band-half--compact {
    color: var(--kb-text-muted);
}

.vt-band-bar {
    position: relative;
    display: inline-flex;
    gap: 2px;
    width: 100%;
    max-width: 10rem;
    height: 6px;
    vertical-align: middle;
    cursor: default;
    /* Keep the soft marker inside the track ends; it may overhang vertically. */
    clip-path: inset(-6px 0);
}
.vt-band-bar--compact { max-width: 8rem; height: 6px; }
.vt-band-bar-seg {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: color-mix(in oklab, var(--kb-text-muted) 22%, transparent);
}
.vt-band-bar-seg.is-lit {
    background: color-mix(in oklab, var(--vt-band-color, var(--kb-primary)) 45%, transparent);
}
.vt-band-bar-marker {
    position: absolute;
    top: -3px;
    height: calc(100% + 6px);
    transform: translateX(-50%);
    border-radius: 999px;
    background: radial-gradient(ellipse at center,
        color-mix(in oklab, var(--vt-band-color, var(--kb-primary)) 40%, var(--kb-text-primary)) 0%,
        color-mix(in oklab, var(--vt-band-color, var(--kb-primary)) 40%, var(--kb-text-primary)) 10%,
        var(--vt-band-color, var(--kb-primary)) 22%,
        color-mix(in oklab, var(--vt-band-color, var(--kb-primary)) 45%, transparent) 40%,
        transparent 74%);
    pointer-events: none;
}
/* Exact position: a thin pin that reads against the lit segment in either mode. */
.vt-band-bar-marker::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
    border-radius: 999px;
    background: color-mix(in oklab, var(--vt-band-color, var(--kb-primary)) 40%, var(--kb-text-primary));
    box-shadow: 0 0 3px color-mix(in oklab, var(--vt-band-color, var(--kb-primary)) 70%, transparent);
}

.vt-verdict-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    border: 1px solid color-mix(in oklab, var(--vt-verdict-color) 45%, transparent);
    background: color-mix(in oklab, var(--vt-verdict-color) 12%, transparent);
    color: var(--vt-verdict-color);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    vertical-align: middle;
    cursor: default;
}
.vt-verdict-chip[data-verdict="beat"]  { --vt-verdict-color: var(--kb-success); }
.vt-verdict-chip[data-verdict="par"]   { --vt-verdict-color: var(--kb-text-secondary); }
.vt-verdict-chip[data-verdict="below"] { --vt-verdict-color: var(--kb-danger); }

/* VSR-C v4-telemetry chip (ladder rows + duel-log entries) */
.vt-cmdr-telem-chip {
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    color: var(--kb-primary);
    background: color-mix(in oklab, var(--kb-primary) 12%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-primary) 25%, transparent);
    vertical-align: middle;
    cursor: default;
}

/* VSR-C unranked progress chip (Elo ladder + player-page rank).
   Muted on purpose — "how close to the gate", not a rank. */
.vt-cmdr-progress-chip {
    display: inline-block;
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    margin-left: 0.25rem;
    border-radius: 999px;
    color: var(--kb-text-muted);
    background: color-mix(in oklab, var(--kb-text-muted) 10%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-text-muted) 22%, transparent);
    vertical-align: middle;
    cursor: default;
    white-space: nowrap;
}

.vt-vtsr-inactive-chip,
.vt-vtsr-returning-chip,
.vt-vtsr-stale-chip {
    display: inline-block;
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    margin-left: 0.25rem;
    border-radius: 999px;
    vertical-align: middle;
    cursor: default;
    white-space: nowrap;
}
.vt-vtsr-inactive-chip {
    color: var(--kb-text-muted);
    background: color-mix(in oklab, var(--kb-text-muted) 10%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-text-muted) 22%, transparent);
}
.vt-vtsr-returning-chip {
    color: var(--kb-primary);
    background: color-mix(in oklab, var(--kb-primary) 12%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-primary) 28%, transparent);
}
.vt-vtsr-stale-chip {
    color: var(--kb-warning);
    background: color-mix(in oklab, var(--kb-warning) 12%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-warning) 28%, transparent);
}

/* F9bomber community-ledger chip (VSR-C ladder Games cell, duel-log
   rows, detail stats). Deliberately muted — provenance marker, not an
   accent. Sibling of .vt-cmdr-telem-chip. */
.vt-f9-chip {
    display: inline-block;
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    margin-left: 0.25rem;
    border-radius: 999px;
    color: var(--kb-text-muted);
    background: color-mix(in oklab, var(--kb-text-muted) 10%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-text-muted) 22%, transparent);
    vertical-align: middle;
    cursor: default;
    white-space: nowrap;
}

.vt-vtsr-delta-positive { color: var(--kb-success); }
.vt-vtsr-delta-negative { color: var(--kb-danger); }

.vt-vtsr-rating {
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--kb-text-primary);
    letter-spacing: -0.01em;
}

#vtsr-table tbody tr {
    cursor: pointer;
}

/* "How It's Calculated" button next to the VSR-T fullscreen icon. Borderless,
   muted, with the same hover treatment as the surrounding card-header icon
   buttons so the pair reads as a single control cluster. */
.vt-vtsr-info-btn {
    border: 0;
    background: transparent;
    color: var(--kb-text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.25rem 0.55rem;
}

.vt-vtsr-info-btn:hover,
.vt-vtsr-info-btn:focus-visible {
    color: var(--kb-text-primary);
    background: color-mix(in oklab, var(--kb-text-muted) 12%, transparent);
}

/* ============================================================================
   KATEX TOOLTIP
   Override Bootstrap tooltip width + KaTeX glyph color so equations pick
   up the theme foreground in both light and dark modes.

   The shared .vt-katex-tooltip class is reused on the modal body that
   opens from the VSR-T Leaderboard's "How It's Calculated" button so it
   inherits the same equation-spacing rules below. The width cap is
   scoped to tooltip context only — applying max-width: 600px to a modal
   body would visually shrink the dialog content even though the dialog
   itself is .modal-lg, so we exclude that context here.
   ============================================================================ */

.vt-katex-tooltip:not(.modal-body) {
    --bs-tooltip-max-width: 600px;
    max-width: 600px;
}

.vt-katex-tooltip .tooltip-inner {
    text-align: left;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    line-height: 1.55;
    background: var(--kb-bg-secondary);
    color: var(--kb-text-primary);
    border: 1px solid color-mix(in oklab, var(--kb-text-muted) 25%, transparent);
}

.vt-katex-tooltip .tooltip-arrow::before { display: none; }

.vt-katex-tooltip .vt-katex-tooltip-body { line-height: 1.55; }

.vt-katex-tooltip .katex-display {
    margin: 0.95em 0 0.8em;
    line-height: 1.4;
}

.vt-katex-tooltip .katex {
    font-size: 1.0em;
    line-height: 1.4 !important;
}

.vt-katex-tooltip .vt-katex-tooltip-body strong {
    display: inline-block;
    margin-top: 0.45em;
}

.vt-katex-tooltip table {
    width: 100%;
    margin: 0.55rem 0;
    font-size: 0.78rem;
}

.vt-katex-tooltip table th,
.vt-katex-tooltip table td {
    padding: 0.18rem 0.4rem;
    border-bottom: 1px solid color-mix(in oklab, var(--kb-text-muted) 18%, transparent);
}

.vt-katex-tooltip table th {
    color: var(--kb-text-muted);
    font-weight: 600;
    text-align: left;
}

.vt-katex-tooltip .vt-katex-caveat {
    color: var(--kb-text-muted);
    font-size: 0.78rem;
    margin: 0.45em 0;
}

.vt-katex-tooltip a { color: var(--kb-primary); }

/* Modal variant — the VSR-T methodology button opens #vtsr-methodology-modal
   whose body carries .vt-katex-tooltip so the equation-spacing rules above
   apply inside the modal too. The modal body has much more room than a
   tooltip, so restore a comfortable reading size for the prose. */
.modal-body.vt-katex-tooltip {
    font-size: 0.95rem;
    line-height: 1.55;
}

.modal-body.vt-katex-tooltip .vt-katex-tooltip-body { line-height: 1.55; }

/* VSR-T methodology modal — v2 (Phase 12) structured-reference layout.
   The body is divided into six titled <section class="vt-vtsr-doc-section">
   blocks (golden equation / expected curve / composite / K & hope / tiers /
   worked example). Each section is separated by a subtle bottom border so
   the reference reads like a doc page rather than a long blob. */
.modal-body.vt-katex-tooltip .vt-vtsr-doc-section {
    padding: 1.1rem 0;
    border-bottom: 1px solid color-mix(in oklab, var(--kb-text-muted) 18%, transparent);
}
.modal-body.vt-katex-tooltip .vt-vtsr-doc-section:first-of-type { padding-top: 0; }
.modal-body.vt-katex-tooltip .vt-vtsr-doc-section:last-of-type {
    padding-bottom: 0.5rem;
    border-bottom: 0;
}
.modal-body.vt-katex-tooltip .vt-vtsr-doc-section h6 {
    color: var(--kb-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 0.85rem 0;
}

/* Symbol legend grid — 2 columns under the hero equation. Each cell pairs
   a <code> symbol with a brief description. */
.modal-body.vt-katex-tooltip .vt-vtsr-doc-symbols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem 1.2rem;
    margin: 0.75rem 0;
    font-size: 0.86rem;
}
.modal-body.vt-katex-tooltip .vt-vtsr-doc-symbols code {
    color: var(--kb-primary);
    margin-right: 0.4rem;
}

/* Compact 2/3-column tables used by the expected-curve, K-decay, and tier
   sections. Slightly tighter than the legacy .vt-katex-tiers / .vt-katex-weights
   tables so the dense data reads at a glance. */
.modal-body.vt-katex-tooltip .vt-vtsr-doc-curve-table {
    width: auto;
    min-width: 50%;
    margin: 0.65rem 0;
    font-size: 0.86rem;
}
.modal-body.vt-katex-tooltip .vt-vtsr-doc-curve-table th,
.modal-body.vt-katex-tooltip .vt-vtsr-doc-curve-table td {
    padding: 0.3rem 1rem 0.3rem 0;
}
.modal-body.vt-katex-tooltip .vt-vtsr-doc-curve-table th {
    color: var(--kb-text-muted);
    font-weight: 500;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid color-mix(in oklab, var(--kb-text-muted) 25%, transparent);
}

/* KaTeX ships hard-coded color: #000 on .katex; force it to follow the
   theme so equations stay legible in dark mode. */
.katex { color: inherit; }

/* ===== Annotated explainer stages (js/vtsr-explainers.js) ============
   Free-form "chalk talk" blocks shared by the dashboard methodology
   modal and the /elo/ page tabs: a centerpiece (KaTeX equation or the
   8-axes mixing board) with callout cards absolutely positioned at
   author-chosen % coordinates and SVG connectors measured from the
   live DOM by the stage engine. Below 620px the free-form layer
   collapses to the stacked .vt-eq-list (which doubles as the sr-only
   canonical copy on desktop). */

.vt-eq-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
    min-height: 280px;
    max-height: 460px;
    margin: 0.4rem 0 0.5rem;
}

.vt-eq-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vt-eq-center .katex { font-size: clamp(1.5rem, 3.2vw, 2.3rem); }
.vt-eq-center .katex-display { margin: 0; }
/* Beat the modal-scoped `.vt-katex-tooltip .katex-display` margin rule. */
.modal-body.vt-katex-tooltip .vt-eq-center .katex-display { margin: 0; }

/* Anchor elements (tagged glyphs / board segments): lit once their
   callout is revealed, glowing while they are the current step.
   eq-gap wraps eq-perf/eq-exp, so dimming is never used (it would
   cascade into the nested terms). */
.vt-eq-term {
    border-radius: 4px;
    transition: color 0.25s ease, text-shadow 0.25s ease;
}
.vt-eq-center .katex .vt-eq-term.is-lit { color: var(--kb-primary); }
.vt-eq-term.is-current {
    text-shadow: 0 0 16px color-mix(in oklab, var(--kb-primary) 60%, transparent);
}

.vt-eq-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}
.vt-eq-connector {
    fill: none;
    stroke: color-mix(in oklab, var(--kb-primary) 55%, transparent);
    stroke-width: 1.5;
}
.vt-eq-connector.is-current {
    stroke: var(--kb-primary);
    stroke-width: 1.8;
}
.vt-eq-anchor-dot { fill: var(--kb-primary); }
.vt-eq-svg marker path { stroke: var(--kb-primary); stroke-width: 1.6; }

.vt-eq-callout {
    position: absolute;
    width: clamp(170px, 27%, 250px);
    padding: 0.55rem 0.7rem;
    background: color-mix(in oklab, var(--kb-bg-secondary) 90%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-primary) 28%, transparent);
    border-radius: 0.55rem;
    backdrop-filter: blur(var(--vt-glass-blur, 10px));
    box-shadow: var(--vt-shadow-elevation-1);
    opacity: 0;
    transform: translateY(6px) scale(0.97);
    transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
    pointer-events: none;
    z-index: 2;
}
.vt-eq-callout.is-shown {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
.vt-eq-callout.is-current {
    border-color: color-mix(in oklab, var(--kb-primary) 60%, transparent);
    box-shadow: var(--vt-shadow-elevation-2);
}
.vt-eq-callout-title {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--kb-primary);
    margin-bottom: 0.2rem;
}
.vt-eq-callout-body {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--kb-text-secondary, inherit);
}

.vt-eq-hint {
    position: absolute;
    left: 50%;
    bottom: 4%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    color: var(--kb-text-muted);
    white-space: nowrap;
    transition: opacity 0.3s ease;
}
.vt-eq-hint.is-gone { opacity: 0; }

.vt-eq-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.25rem;
}
.vt-eq-btn {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0.15rem 0.4rem;
    font-weight: 600;
    color: var(--kb-text-muted);
    transition: color 0.2s ease, opacity 0.2s ease;
}
.vt-eq-btn:hover:not(:disabled),
.vt-eq-btn:focus-visible:not(:disabled) {
    background: transparent;
    box-shadow: none;
    color: var(--kb-text-primary);
}
.vt-eq-btn-primary { color: var(--kb-primary); }
.vt-eq-btn-primary:hover:not(:disabled),
.vt-eq-btn-primary:focus-visible:not(:disabled) {
    color: color-mix(in oklab, var(--kb-primary) 80%, var(--kb-text-primary));
}
.vt-eq-btn:disabled {
    background: transparent;
    box-shadow: none;
    opacity: 0.4;
}

.vt-eq-dots { display: flex; gap: 0.35rem; }
.vt-eq-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid color-mix(in oklab, var(--kb-text-muted) 55%, transparent);
    background: transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.vt-eq-dot.is-active {
    background: var(--kb-primary);
    border-color: var(--kb-primary);
}

/* Canonical callout copy. Desktop: sr-only (the floating cards are the
   visual). Narrow: the visible stacked walkthrough. Items stay in the
   DOM at every step (dimmed, not removed) so assistive tech can always
   read the full content. */
.vt-eq-list {
    margin: 0.25rem 0 0.75rem;
    padding-left: 1.25rem;
    font-size: 0.88rem;
}
.vt-eq-list li {
    margin-bottom: 0.45rem;
    opacity: 0.38;
    transition: opacity 0.25s ease;
}
.vt-eq-list li.is-shown { opacity: 1; }
.vt-eq-list li.is-current strong { color: var(--kb-primary); }

@media (min-width: 621px) {
    .vt-eq-list {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }
}

@media (max-width: 620px) {
    .vt-eq-stage {
        aspect-ratio: auto;
        min-height: 0;
        max-height: none;
        padding: 0.5rem 0;
    }
    .vt-eq-center { position: static; }
    .vt-eq-center .katex { font-size: 1.35rem; }
    .vt-eq-callout,
    .vt-eq-svg,
    .vt-eq-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .vt-eq-callout,
    .vt-eq-term,
    .vt-eq-hint,
    .vt-eq-dot,
    .vt-eq-list li { transition: none; }
}

/* The 8-axes mixing board: a horizontal stacked weight bar whose
   segments are the stage anchors (solo mode). Luxury 0.005 axes render
   as a hairline with a halo hit-area so they stay visible + clickable
   despite their ~0.5% true width. */
.vt-axesboard {
    display: flex;
    width: min(92%, 760px);
    height: 56px;
    border-radius: 0.6rem;
    overflow: hidden;
    border: 1px solid color-mix(in oklab, var(--kb-text-muted) 30%, transparent);
}
.vt-axesboard-seg {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    flex-grow: 0;
    flex-shrink: 1;
    background: color-mix(in oklab, var(--kb-primary) 14%, var(--kb-bg-secondary));
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}
.vt-axesboard-seg + .vt-axesboard-seg {
    border-left: 1px solid color-mix(in oklab, var(--kb-text-muted) 30%, transparent);
}
.vt-axesboard-seg:nth-child(even) {
    background: color-mix(in oklab, var(--kb-primary) 24%, var(--kb-bg-secondary));
}
.vt-axesboard-seg.is-lit {
    background: color-mix(in oklab, var(--kb-primary) 45%, var(--kb-bg-secondary));
}
.vt-axesboard-seg.is-current {
    background: var(--kb-primary);
    box-shadow: 0 0 18px color-mix(in oklab, var(--kb-primary) 55%, transparent);
    z-index: 1;
}
.vt-axesboard-seg-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--kb-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.35rem;
    pointer-events: none;
}
.vt-axesboard-seg.is-current .vt-axesboard-seg-label {
    color: var(--kb-bg-primary, var(--kb-bg-secondary));
}

@media (max-width: 620px) {
    .vt-axesboard { width: 100%; height: 40px; }
    .vt-axesboard-seg-label { display: none; }
}

/* ===== VSR-T teaser card (dashboard) ================================
   Compact top-5 list + provisional chip row + View-full-ladder
   footer. The full tier-grouped ladder lives on the /elo/ page. */
.vt-vtsr-teaser-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 0.25rem;
    border-bottom: 1px solid color-mix(in oklab, var(--kb-text-muted) 14%, transparent);
}
.vt-vtsr-teaser-row:last-child { border-bottom: 0; }
.vt-vtsr-teaser-band {
    padding: 0.55rem 0.25rem 0.2rem;
}
.vt-vtsr-teaser-band:first-child { padding-top: 0; }
.vt-vtsr-teaser-row { padding-left: 0.75rem; }
.vt-vtsr-teaser-more { padding: 0.25rem 0.25rem 0.25rem 0.75rem; }
.vt-vtsr-teaser-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vt-vtsr-teaser-delta {
    flex: 0 0 auto;
    text-align: right;
}
.vt-vtsr-teaser-provisional,
.vt-vtsr-teaser-inactive {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.6rem;
}
.vt-vtsr-teaser-chip {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    font-size: 0.78rem;
    border-radius: 999px;
    border: 1px solid color-mix(in oklab, var(--kb-text-muted) 30%, transparent);
    background: color-mix(in oklab, var(--kb-text-muted) 8%, transparent);
}
.vt-vtsr-teaser-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 0.85rem;
}

/* ===== VSR-T v2.3 — Loadout Profile + Per-Class Combat + chips ===== */

/* Compact PvP/PvE chip rendered next to the kills/deaths total in the
   Player Leaderboard + Career Leaderboard tables. The total stays as
   the primary number; the chip is a small, muted parenthetical so the
   row reads as TOTAL (PvP/PvE). Tooltip surfaces the full split. */
.vt-kd-split {
    color: var(--kb-text-muted);
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
    margin-left: 0.15em;
}

/* Assist-aware effective kills (match.schema_version 13). The `+N` chip on
   the Player Leaderboard's Kills cell flags how many kills this player
   contributed assist credit to; the kill-feed trailer lists the assisting
   players + their damage-share %. Success accent so assists read as a
   positive contribution. */
.vt-assist-badge {
    display: inline-block;
    padding: 0.05em 0.4em;
    margin-left: 0.3em;
    font-size: 0.7rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--kb-success);
    background: color-mix(in oklab, var(--kb-success) 14%, transparent);
    border-radius: 0.5em;
}

.vt-killfeed-assist {
    font-size: 0.92em;
    font-variant-numeric: tabular-nums;
}

/* Loadout Profile card. Stacked horizontal bar + per-class list,
   shown inside renderPlayerProfile and the All Matches Career card.
   Uses the same chart-palette tokens as the Combat Timeline so a
   "wingman" segment renders the same color across the whole UI. */
.vt-loadout-card {
    border: 1px solid var(--kb-border-subtle);
    border-radius: var(--kb-radius-md, 6px);
    padding: 0.75rem 0.9rem;
    background: color-mix(in srgb, var(--kb-bg-card) 60%, transparent);
}
.vt-loadout-bar {
    display: flex;
    height: 14px;
    width: 100%;
    border-radius: 999px;
    overflow: hidden;
    background: color-mix(in srgb, var(--kb-text-muted) 10%, transparent);
    margin-bottom: 0.6rem;
}
.vt-loadout-bar-seg {
    height: 100%;
    transition: opacity 120ms ease;
    cursor: default;
}
.vt-loadout-bar-seg:hover {
    opacity: 0.85;
}
.vt-loadout-classlist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.25rem 1rem;
    font-size: 0.85rem;
}
.vt-loadout-classlist li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--kb-text-secondary);
}
.vt-loadout-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.vt-loadout-ship {
    color: var(--kb-text-primary);
    font-weight: 500;
}
.vt-loadout-share {
    color: var(--kb-text-secondary);
    font-variant-numeric: tabular-nums;
}
.vt-loadout-time {
    color: var(--kb-text-muted);
    font-size: 0.92em;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

/* Per-Class Combat table. Shown immediately below the Loadout bar.
   Compact rows — one per ship class with time>0. PvE K column is
   muted (not zeroed) to keep PvP K visually primary. */
.vt-pcc-card {
    margin-top: 0.75rem;
}
.vt-pcc-table th {
    color: var(--kb-text-muted);
    font-weight: 500;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid color-mix(in oklab, var(--kb-text-muted) 25%, transparent);
    padding: 0.35rem 0.5rem;
}
.vt-pcc-table td {
    padding: 0.35rem 0.5rem;
    font-size: 0.86rem;
    color: var(--kb-text-secondary);
    border-top: 1px solid color-mix(in oklab, var(--kb-text-muted) 12%, transparent);
}
.vt-pcc-table tbody tr:first-child td {
    border-top: 0;
}

/* Player weapon-breakdown table (with v2.3 PvP Hits + PvP Acc cols).
   Same compact aesthetic as the per-class combat table. */
.vt-wb-card {
    margin-top: 0.75rem;
}
.vt-wb-table th {
    color: var(--kb-text-muted);
    font-weight: 500;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid color-mix(in oklab, var(--kb-text-muted) 25%, transparent);
    padding: 0.35rem 0.5rem;
}
.vt-wb-table td {
    padding: 0.35rem 0.5rem;
    font-size: 0.86rem;
    color: var(--kb-text-secondary);
    border-top: 1px solid color-mix(in oklab, var(--kb-text-muted) 12%, transparent);
}
.vt-wb-table tbody tr:first-child td {
    border-top: 0;
}

/* VSR-T leaderboard expandable rows + detail panel (v2.3 polish).
   Replaces the prior popover/tooltip pattern with always-discoverable
   inline drill-down. Each visible row pairs with a sibling
   `<tr class="collapse vt-vtsr-detail">` that hosts a 5-section panel
   in a 2-column responsive grid. Sort + filter re-renders preserve
   expand state via the module-local `expandedVtsrRows` Set. */
.vt-vtsr-expand-col { width: 32px; padding-left: 0; padding-right: 0; }
.vt-row-expand {
    background: transparent;
    border: 0;
    padding: 0.15rem 0.35rem;
    color: var(--kb-text-muted);
    cursor: pointer;
    transition: transform 150ms ease, color 120ms ease;
    line-height: 1;
}
.vt-row-expand:hover { color: var(--kb-primary); }
.vt-row-expand[aria-expanded="true"] {
    transform: rotate(90deg);
    color: var(--kb-text-primary);
}
.vt-row-expand:focus-visible {
    outline: 2px solid var(--kb-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.vt-vtsr-detail > td {
    padding: 0;
    background: color-mix(in srgb, var(--kb-bg-card) 70%, transparent);
    border-top: 1px solid var(--kb-border-subtle);
}
.vt-vtsr-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
}
@media (max-width: 1199.98px) {
    .vt-vtsr-detail-grid { grid-template-columns: 1fr; }
}
.vt-vtsr-detail-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.vt-vtsr-detail-section {
    border: 1px solid var(--kb-border-subtle);
    border-radius: var(--kb-radius-md, 6px);
    padding: 0.75rem 0.9rem;
    background: var(--kb-bg-card);
}
.vt-vtsr-detail-section h6 {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--kb-text-muted);
    margin-bottom: 0.55rem;
}
.vt-vtsr-detail-section .vt-vtsr-detail-sub {
    font-size: 0.7rem;
    text-transform: none;
    letter-spacing: normal;
    margin-left: 0.3rem;
}

/* Section A: combat split stats grid */
.vt-vtsr-detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem 1rem;
}
.vt-vtsr-detail-stats > div { display: flex; flex-direction: column; }
.vt-vtsr-detail-stats .vt-stat-label {
    color: var(--kb-text-muted);
    font-size: 0.74rem;
    line-height: 1;
    margin-bottom: 0.15rem;
}
.vt-vtsr-detail-stats .vt-stat-value {
    color: var(--kb-text-primary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Sections B+C: 6-axis horizontal bar grid (per-axis z-score with
   weighted contribution sub-text). Each row has an axis name | bar
   centered on 0 (extends right for positive, left for negative) |
   z value (color-coded) + optional w*z weighted contribution. */
.vt-axis-bar-grid {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}
.vt-axis-bar-row {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) minmax(120px, 2fr) minmax(140px, auto);
    gap: 0.6rem;
    align-items: center;
    font-variant-numeric: tabular-nums;
}
.vt-axis-bar-name {
    color: var(--kb-text-secondary);
    font-size: 0.78rem;
}
.vt-axis-bar-track {
    position: relative;
    display: block;
    height: 8px;
    background: color-mix(in srgb, var(--kb-text-muted) 10%, transparent);
    border-radius: 4px;
}
.vt-axis-bar-center {
    position: absolute;
    left: 50%;
    top: -2px;
    bottom: -2px;
    width: 1px;
    background: color-mix(in srgb, var(--kb-text-muted) 50%, transparent);
}
.vt-axis-bar-fill {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 4px;
}
.vt-axis-bar-median {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 0;
    border-left: 2px dashed var(--kb-text-muted);
    z-index: 1;
}
.vt-axis-bar-row.is-positive .vt-axis-bar-fill {
    background: var(--kb-success);
}
.vt-axis-bar-row.is-negative .vt-axis-bar-fill {
    background: var(--kb-danger);
}
.vt-axis-bar-z {
    text-align: right;
    color: var(--kb-text-secondary);
    font-size: 0.78rem;
}
.vt-axis-bar-row.is-positive .vt-axis-bar-z { color: var(--kb-success); }
.vt-axis-bar-row.is-negative .vt-axis-bar-z { color: var(--kb-danger); }
.vt-axis-bar-weighted {
    color: var(--kb-text-muted);
    font-size: 0.7rem;
    margin-left: 0.4rem;
}

.vt-vtsr-detail-formula {
    color: var(--kb-text-secondary);
    font-size: 0.78rem;
    font-family: var(--bs-font-monospace);
    margin-bottom: 0.6rem;
}

/* Section D: ship loadout mini-rows (top 5 by time). */
.vt-vtsr-detail-loadout-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.5fr) minmax(80px, 2fr) 60px 60px 70px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.18rem 0;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}
.vt-vtsr-detail-loadout-name {
    color: var(--kb-text-primary);
    font-weight: 500;
}
.vt-vtsr-detail-loadout-bar {
    position: relative;
    display: block;
    height: 6px;
    background: color-mix(in srgb, var(--kb-text-muted) 10%, transparent);
    border-radius: 3px;
}
.vt-vtsr-detail-loadout-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--kb-primary);
    border-radius: 3px;
}
.vt-vtsr-detail-loadout-share,
.vt-vtsr-detail-loadout-time,
.vt-vtsr-detail-loadout-kd {
    color: var(--kb-text-secondary);
    text-align: right;
}
.vt-vtsr-detail-loadout-more {
    margin-top: 0.3rem;
    font-size: 0.74rem;
}

/* Section E: peak rating callout. */
.vt-vtsr-detail-peak {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-variant-numeric: tabular-nums;
}
.vt-vtsr-detail-peak-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--kb-text-primary);
}
.vt-vtsr-detail-peak-label {
    font-size: 0.78rem;
}

/* Primary ship chip on the VSR-T leaderboard. Small badge sized
   to align with the existing Tier badge column. (Token name kept as
   `vt-vtsr-primary-class` for backwards-CSS-token-stability; renders
   ship names like "Tank", "Scout" in v2.3+.) */
.vt-vtsr-primary-class {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    background: color-mix(in srgb, var(--kb-text-muted) 15%, transparent);
    color: var(--kb-text-secondary);
    border: 1px solid var(--kb-border-subtle);
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

/* Commander Cohort card (All Matches -> Commanders tab).
   Side-by-side axis-comparison grid. First column is the axis label;
   remaining columns are one per player. Both views (z / contrib) share
   this grid layout - only cell contents differ. */
.vt-cohort-subtitle {
    line-height: 1.45;
}
.vt-cohort-table-wrap {
    overflow-x: auto;     /* horizontal scroll for narrow viewports */
    padding-bottom: 0.25rem;   /* clear scrollbar from sum-row border */
}
.vt-cohort-grid {
    display: grid;
    /* grid-template-columns is set inline by the renderer so it scales
       with the visible player count. Rows are auto-sized. */
    gap: 0;
    min-width: 100%;
    font-variant-numeric: tabular-nums;
}
.vt-cohort-row {
    display: contents;    /* let parent grid lay out the cells */
}
.vt-cohort-axis-cell {
    padding: 0.5rem 0.75rem 0.5rem 0;
    color: var(--kb-text-secondary);
    font-size: 0.82rem;
    border-bottom: 1px solid color-mix(in srgb, var(--kb-text-muted) 14%, transparent);
    position: sticky;
    left: 0;
    background: var(--kb-bg);   /* mask scroll-under cells */
    z-index: 1;
}
.vt-cohort-axis-weight {
    color: var(--kb-text-muted);
    font-size: 0.72rem;
    font-weight: 400;
}
.vt-cohort-cell {
    padding: 0.5rem 0.6rem;
    text-align: right;
    font-size: 0.85rem;
    color: var(--kb-text-secondary);
    border-bottom: 1px solid color-mix(in srgb, var(--kb-text-muted) 14%, transparent);
}
.vt-cohort-cell.vt-cohort-pos { color: var(--kb-success); }
.vt-cohort-cell.vt-cohort-neg { color: var(--kb-danger); }

/* Header row: per-player summary stack (name, share, VSR-T, peak). */
.vt-cohort-header-row .vt-cohort-axis-cell {
    border-bottom: 2px solid color-mix(in srgb, var(--kb-text-muted) 22%, transparent);
}
.vt-cohort-col-header {
    padding: 0.4rem 0.6rem;
    text-align: right;
    border-bottom: 2px solid color-mix(in srgb, var(--kb-text-muted) 22%, transparent);
    line-height: 1.25;
}
.vt-cohort-col-name {
    font-weight: 600;
    color: var(--kb-text-primary);
    font-size: 0.92rem;
    margin-bottom: 0.15rem;
}
.vt-cohort-col-share {
    color: var(--kb-text-secondary);
    font-size: 0.78rem;
}
.vt-cohort-col-share-detail {
    color: var(--kb-text-muted);
    font-size: 0.72rem;
}
.vt-cohort-col-rating {
    color: var(--kb-text-primary);
    font-size: 0.82rem;
    margin-top: 0.15rem;
}
.vt-cohort-col-rating-label {
    color: var(--kb-text-muted);
    font-size: 0.7rem;
    margin-left: 0.2rem;
}
.vt-cohort-col-peak {
    color: var(--kb-text-muted);
    font-size: 0.72rem;
}
.vt-cohort-prov {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    margin-left: 0.25rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--kb-text-muted) 18%, transparent);
    color: var(--kb-text-secondary);
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

/* Headline VSR-C-prev cell in each column header. Mirrors the sign-coded
   look of body cells but slightly larger/bolder so it reads as a leaderboard
   number. Neutral-band (near-zero composite) uses the primary text color. */
.vt-cohort-col-vtsrc {
    margin-top: 0.25rem;
    padding: 0.15rem 0.35rem;
    font-size: 0.95rem;
    line-height: 1.15;
    border-radius: 4px;
    background: color-mix(in srgb, var(--kb-text-muted) 6%, transparent);
    color: var(--kb-text-primary);
    cursor: help;
}
.vt-cohort-col-vtsrc.vt-cohort-pos { color: var(--kb-success); }
.vt-cohort-col-vtsrc.vt-cohort-neg { color: var(--kb-danger); }
.vt-cohort-col-vtsrc-label {
    color: var(--kb-text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-left: 0.25rem;
    text-transform: uppercase;
    vertical-align: middle;
}

/* Title tag on the card header ("VSR-C preview" sub-label). */
.vt-cohort-title-tag {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--kb-accent) 14%, transparent);
    color: var(--kb-accent);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

/* VSR-C top-5 ladder strip (experimental commander rating) prepended
   above the cohort grid. Compact glass band: header line with title +
   sub + full-ladder link, then one row per top-5 commander. */
.vt-cohort-vtsrc-strip {
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--kb-primary) 7%, transparent);
    border: 1px solid color-mix(in srgb, var(--kb-primary) 18%, transparent);
}
.vt-cohort-vtsrc-strip-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.45rem;
}
.vt-cohort-vtsrc-strip-title {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--kb-text-primary);
}
.vt-cohort-vtsrc-strip-sub {
    color: var(--kb-text-muted);
    font-size: 0.72rem;
}
.vt-cohort-vtsrc-strip-link {
    margin-left: auto;
    font-size: 0.76rem;
    font-weight: 600;
    text-decoration: none;
}
.vt-cohort-vtsrc-strip-link:hover { text-decoration: underline; }
.vt-cohort-vtsrc-rows {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.4rem;
}
.vt-cohort-vtsrc-row {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    font-size: 0.82rem;
}
.vt-cohort-vtsrc-rank {
    color: var(--kb-text-muted);
    font-family: var(--vt-font-mono, monospace);
    font-size: 0.72rem;
}
.vt-cohort-vtsrc-name { font-weight: 600; }
.vt-cohort-vtsrc-rating {
    font-family: var(--vt-font-mono, monospace);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--kb-primary);
}
.vt-cohort-vtsrc-record {
    font-family: var(--vt-font-mono, monospace);
    font-variant-numeric: tabular-nums;
    color: var(--kb-text-muted);
    font-size: 0.76rem;
}

/* Preview-status callout banner inside the card body. Compact, low-key,
   uses muted-text and a tinted accent strip on the left so it reads as
   informational rather than alarmist. */
.vt-cohort-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.6rem;
    border-radius: 6px;
    background: color-mix(in srgb, var(--kb-accent) 8%, transparent);
    border-left: 3px solid color-mix(in srgb, var(--kb-accent) 55%, transparent);
    color: var(--kb-text-secondary);
    line-height: 1.4;
}
.vt-cohort-callout-icon {
    color: var(--kb-accent);
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}
.vt-cohort-callout strong {
    color: var(--kb-text-primary);
}

/* Weighted-view sum row: highlighted band that totals each player's
   weighted axis contributions into mean P_i. */
.vt-cohort-sum-row .vt-cohort-axis-cell,
.vt-cohort-sum-row .vt-cohort-cell {
    background: color-mix(in srgb, var(--kb-text-muted) 8%, transparent);
    border-top: 2px solid color-mix(in srgb, var(--kb-text-muted) 22%, transparent);
    border-bottom: none;
    font-weight: 600;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}
.vt-cohort-sum-row .vt-cohort-axis-cell {
    color: var(--kb-text-primary);
}

/* ============================================================================
   Custom cursor (BZCC in-game cursor) + Settings gear
   Driven by js/cursor-settings.js. The overlay plays the HD sprite strip
   (data/ui/cursor-sprite.png, 4096x64, 64 frames of 64px) via a steps(64)
   keyframe for a continuous in-game-style spin, downscaled to a 32px on-screen
   cursor. CSS vars are set on :root by the module; background-image is set
   inline on the element (path resolved at runtime per page depth).
   ========================================================================= */

:root {
    --vt-cursor-scale: 1;
    --vt-cursor-speed: 1.05s;
    /* --vt-cursor-frame is the on-screen DISPLAY size of one frame; the HD
       sprite strip (4096x64, 64 frames of 64px) downscales to it crisply. */
    --vt-cursor-frame: 32px;
    --vt-cursor-frames: 64;
    --vt-cursor-hotspot-x: 5px;
    --vt-cursor-hotspot-y: 10px;
}

/* When active, the native pointer is fully replaced everywhere. */
html.vt-cursor-active,
html.vt-cursor-active * {
    cursor: none !important;
}

/* Pointer-lock pages (Game Explorer) suppress the sprite; the reticle is the pointer. */
.vt-cursor.is-suppressed {
    opacity: 0 !important;
    visibility: hidden;
}

.vt-cursor {
    position: fixed;
    left: 0;
    top: 0;
    width: calc(var(--vt-cursor-frame) * var(--vt-cursor-scale));
    height: calc(var(--vt-cursor-frame) * var(--vt-cursor-scale));
    background-repeat: no-repeat;
    background-size:
        calc(var(--vt-cursor-frame) * var(--vt-cursor-frames) * var(--vt-cursor-scale))
        calc(var(--vt-cursor-frame) * var(--vt-cursor-scale));
    /* offset so the comet tip (hotspot) lands on the real pointer position */
    margin-left: calc(var(--vt-cursor-hotspot-x) * var(--vt-cursor-scale) * -1);
    margin-top: calc(var(--vt-cursor-hotspot-y) * var(--vt-cursor-scale) * -1);
    pointer-events: none;
    z-index: 2147483646;
    opacity: 0;
    will-change: transform;
    animation: vt-cursor-spin var(--vt-cursor-speed) steps(var(--vt-cursor-frames)) infinite;
}

@keyframes vt-cursor-spin {
    from { background-position-x: 0; }
    to {
        background-position-x: calc(
            var(--vt-cursor-frame) * var(--vt-cursor-frames) * var(--vt-cursor-scale) * -1);
    }
}

/* Reduced-motion: keep the cursor visible but stop the spin (rests on frame 0). */
@media (prefers-reduced-motion: reduce) {
    .vt-cursor {
        animation: none;
    }
}

/* ---------- Settings gear dropdown panel ---------- */

.vt-settings-panel,
.vt-nav-menu .dropdown-menu.vt-settings-panel {
    min-width: 260px;
    padding: 0.75rem;
    background: var(--kb-bg-card) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.vt-settings-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--kb-text-muted);
    margin-bottom: 0.6rem;
}

.vt-settings-row {
    margin-bottom: 0.85rem;
}

.vt-settings-row:last-of-type {
    margin-bottom: 0;
}

.vt-settings-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85rem;
    color: var(--kb-text-primary);
    margin-bottom: 0.2rem;
}

.vt-settings-label b {
    font-family: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    font-weight: 600;
    color: var(--kb-primary);
}

.vt-settings-scale-hints {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--kb-text-muted);
    margin-top: -0.1rem;
}

.vt-settings-actions {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid color-mix(in oklab, var(--kb-text-primary) 8%, transparent);
}

/* About modal (injected site-wide by js/cursor-settings.js) */
.vt-about-entry {
    margin-bottom: 1.5rem;
}

.vt-about-entry:last-child {
    margin-bottom: 0;
}

.vt-about-label {
    font-size: 0.75rem;
}

.vt-settings-divider {
    margin: 0.5rem 0 0.65rem;
}

.vt-settings-page-slot:empty {
    display: none;
}

.vt-settings-navlist {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0.75rem;
}

.vt-settings-navitem {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.45rem 0.5rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--kb-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}

.vt-settings-navitem:hover,
.vt-settings-navitem:focus-visible {
    color: var(--kb-text-primary);
    background-color: color-mix(in oklab, var(--kb-bg-muted) 60%, transparent);
    outline: none;
}

.vt-settings-navitem.active,
.vt-settings-navitem[aria-current="page"] {
    color: var(--kb-primary);
}

/* Page-control labels stay visible inside the gear even though
   .vt-nav-label is display:none on desktop. */
.vt-settings-navitem .vt-nav-label,
.vt-settings-navitem .vt-settings-navitem-label {
    display: inline;
    margin-left: 0.5rem;
}

/* The relocated page controls keep their .vt-nav-icon-btn class, whose
   justify-content: center would centre them in the panel; everything
   in the gear reads as a left-aligned list. Same for the cursor switch. */
.vt-settings-panel .vt-settings-navitem,
.vt-settings-panel .vt-nav-icon-btn.vt-settings-navitem {
    justify-content: flex-start;
    text-align: left;
}

.vt-settings-panel .form-check.form-switch {
    justify-content: flex-start;
    padding-left: 0;
    min-height: 0;
}

.vt-settings-panel .form-check.form-switch .form-check-input {
    float: none;
    margin-left: 0;
}


/* ============================================================================
   ECONOMY TAB (proto v4 commander telemetry) — production cards + build log
   ============================================================================ */

.vt-econ-team-dot {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    margin-right: 0.45rem;
    vertical-align: baseline;
}

/* The two production cards render as a matched pair (row N on the left is
   row N on the right), so a row must be EXACTLY one line tall on both
   cards. Locking line-height + min-height and forbidding wrap means a long
   label or value can never push one card's rows out of step with the
   other's. See renderEconomyProductionCards() in js/app.js. */
.vt-econ-stat-row {
    font-size: 0.85rem;
    line-height: 1.35;
    min-height: calc(1.35em + 0.36rem);
    padding: 0.18rem 0;
    border-bottom: 1px solid color-mix(in oklab, var(--kb-text-primary) 5%, transparent);
}

.vt-econ-stat-row:last-child {
    border-bottom: none;
}

/* Label column. The text ellipsizes rather than wrapping; the info icon
   sits outside the ellipsing span so it is never what gets clipped. */
.vt-econ-stat-label {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    min-width: 0;
    color: var(--kb-text-muted);
}

.vt-econ-stat-label-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vt-econ-stat-label .vt-col-info {
    flex: 0 0 auto;
}

.vt-econ-stat-val {
    flex: 0 0 auto;
    font-family: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    font-weight: 600;
    white-space: nowrap;
}

/* Inert slot padding the shorter per-thug list, so the rows beneath it stay
   level with the other card. Borderless — an empty ruled row reads as a bug. */
.vt-econ-row-spacer {
    border-bottom-color: transparent;
}

.vt-econ-divider {
    border-color: var(--kb-border-subtle);
}

/* Scrap-status share bar: green / yellow / red segments over match time. */
.vt-econ-status-bar {
    display: flex;
    height: 0.55rem;
    border-radius: 999px;
    overflow: hidden;
    background: color-mix(in oklab, var(--kb-text-primary) 8%, transparent);
}

/* Band legend under the status bar: percentage on top, absolute time
   beneath it. Three columns pinned left / center / right by the flex
   parent's justify-content: space-between. */
.vt-econ-band-legend {
    font-size: 0.72rem;
    color: var(--kb-text-muted);
    line-height: 1.25;
}

.vt-econ-band-time {
    font-family: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    opacity: 0.75;
}

/* Sub-section heading inside a production card (e.g. "Thug supply"). */
.vt-econ-subhead {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--kb-text-muted);
    margin: 0.1rem 0 0.25rem;
}

/* Ship-type continuation under a thug or commander loss row. Same
   one-line lock as the stat rows so the paired cards stay aligned;
   the label ellipsizes and the tooltip carries the full list. */
.vt-econ-shiploss .vt-econ-stat-label-text {
    padding-left: 1.5rem;
    font-weight: 500;
}

/* Commander sibling under Thug supply — not in the team totals. */
.vt-econ-cmdr-tag {
    display: inline-block;
    padding: 0.05em 0.4em;
    margin-left: 0.3em;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--kb-text-muted);
    background: color-mix(in oklab, var(--kb-text-muted) 12%, transparent);
    border: 1px solid var(--kb-border-subtle);
    border-radius: 999px;
    vertical-align: middle;
}

.vt-econ-log-help-btn {
    padding: 0.1rem 0.3rem;
    line-height: 1;
    color: var(--kb-text-muted);
    border: 0;
    background: transparent;
}
.vt-econ-log-help-btn:hover,
.vt-econ-log-help-btn:focus-visible {
    color: var(--kb-info);
}

.vt-econ-help-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 0.35rem;
}
.vt-econ-help-dot[data-status="green"]    { background: var(--kb-success); }
.vt-econ-help-dot[data-status="yellow"]   { background: var(--kb-warning); }
.vt-econ-help-dot[data-status="red"]      { background: var(--kb-danger); }
.vt-econ-help-dot[data-status="parallel"] { background: var(--kb-info); }

.vt-econ-inferred-badge {
    background: color-mix(in oklab, var(--kb-warning) 22%, transparent);
    color: var(--kb-warning);
    font-size: 0.65rem;
    font-weight: 600;
    vertical-align: middle;
}

/* Cross-card row highlight: hovering a row lights the SAME row on the other
   commander card so the two sides can be read against each other. Mirrors
   the raw browser's paired DamageDealt/Received highlight. The negative
   inline margin cancels the added padding, so the highlight bleeds past the
   text without nudging any content sideways -- which is also why these
   rules must stay BELOW every .vt-econ-* rule that sets a margin shorthand
   (.vt-econ-subhead), since they share single-class specificity. */
.vt-econ-row-hl {
    background: color-mix(in oklab, var(--kb-accent) 14%, transparent);
    outline: 1px solid color-mix(in oklab, var(--kb-accent) 55%, transparent);
    outline-offset: -1px;
    border-radius: 4px;
    margin-inline: -0.4rem;
    padding-inline: 0.4rem;
}

.vt-econ-row-hl--origin {
    background: color-mix(in oklab, var(--kb-accent) 22%, transparent);
}

/* Build Order Log — two team columns of compact event rows. */
.vt-econ-log-head {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

/* Compact nav-pills for commander scope (radio) and type/kind filters
   (checkbox). Smaller cousin of #match-tabs: glass tray, primary fill
   when .active, tools-pill density. Shared by #economy-buildlog-scope
   and #economy-buildlog-filter. No hardcoded colors. */
.vt-econ-log-pills {
    /* Tray must contrast against the card header (which is already
       --kb-bg-card); mixing card-on-card would make the group invisible. */
    background: color-mix(in oklab, var(--kb-text-primary) 6%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 0.22rem;
    border: 1px solid color-mix(in oklab, var(--kb-text-primary) 10%, transparent);
    flex-wrap: wrap;
    gap: 0.1rem;
}

.vt-econ-log-pills .nav-link {
    color: var(--kb-text-secondary);
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.18rem 0.55rem;
    line-height: 1.2;
    letter-spacing: 0.01em;
    border-radius: 8px;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.vt-econ-log-pills .nav-link:hover {
    color: var(--kb-text-primary);
    background: color-mix(in oklab, var(--kb-bg-muted) 60%, transparent);
}

.vt-econ-log-pills .nav-link.active {
    background: var(--kb-primary) !important;
    color: var(--kb-primary-fg) !important;
    box-shadow: 0 2px 8px color-mix(in oklab, var(--kb-primary), transparent 60%);
}

/* Visual clusters inside the type/kind strip: type | kind | All events. */
.vt-econ-log-pills .vt-econ-log-pills-gap {
    margin-left: 0.4rem;
}

/* Card-header find bar. Capped so it can't crowd out the filter pills, and
   allowed to shrink before the pills wrap on narrow viewports. */
.vt-econ-log-search {
    max-width: 180px;
    min-width: 120px;
}

/* Tall enough to read a real build order without constant scrolling, but
   viewport-relative so the card never outgrows the screen it renders on.
   The floor keeps short laptop viewports usable. overflow:auto covers both
   axes so a table wider than the column scrolls sideways in the same pane. */
.vt-econ-log-col {
    max-height: clamp(360px, 68vh, 820px);
    overflow: auto;
    padding-right: 0.35rem;
}

/* One table per team column. width 100% fills the column (and the doubled
   col-12 when a single commander is scoped). No min-width: max-content and
   no percentage width on a cell — that pair resolves to a cyclic percentage
   and Chrome stretches the table to ~1e6 px. nowrap columns still force the
   table past the scroller when the content itself is wider. */
.vt-econ-log-table {
    width: 100%;
    font-size: 0.82rem;
    --bs-table-bg: transparent;
    /* separate, not collapse: a collapsed border breaks position:sticky on th */
    border-collapse: separate;
    border-spacing: 0;
}

.vt-econ-log-table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--kb-bg-card);
    color: var(--kb-text-muted);
    font-weight: 600;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    padding: 0.28rem 0.4rem;
    border-bottom: 1px solid var(--kb-border-subtle);
    white-space: nowrap;
    vertical-align: middle;
}

.vt-econ-log-table > tbody > tr > td {
    padding: 0.16rem 0.4rem;
    vertical-align: middle;
    white-space: nowrap;
    border-bottom: 1px solid var(--kb-border-subtle, color-mix(in oklab, var(--kb-text-primary) 6%, transparent));
}

/* Shrink-to-content on every column except Unit, which takes the leftover
   when the column is wider than the row. width: 0.1% is a hint, not a
   percentage of an indefinite max-content size. */
.vt-econ-log-table > thead > tr > th:not(:nth-child(4)),
.vt-econ-log-table > tbody > tr > td:not(.vt-econ-log-unit) {
    width: 0.1%;
}

/* Sum mode has its own columns (Unit is not always the 4th), so the
   chronological nth-child rule would stretch ODF or Scrap. Unit takes the
   leftover; every other column shrinks to its content. */
.vt-econ-log-table.vt-econ-log-table--sum > thead > tr > th,
.vt-econ-log-table.vt-econ-log-table--sum > tbody > tr > td {
    width: 0.1%;
}

.vt-econ-log-table.vt-econ-log-table--sum > thead > tr > th.vt-econ-log-unit,
.vt-econ-log-table.vt-econ-log-table--sum > tbody > tr > td.vt-econ-log-unit {
    width: auto;
}

.vt-econ-log-row.vt-econ-row-cancel .vt-econ-log-name {
    text-decoration: line-through;
    opacity: 0.65;
}

.vt-econ-log-ts,
.vt-econ-log-num,
.vt-econ-log-odf {
    font-family: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

.vt-econ-log-ts {
    color: var(--kb-text-muted);
    font-size: 0.76rem;
}

.vt-econ-log-num {
    text-align: right;
}

.vt-econ-log-ev,
.vt-econ-log-src,
.vt-econ-log-st,
.vt-econ-log-vid {
    text-align: center;
}

.vt-econ-log-vid .vt-video-link {
    margin-left: 0;
}

.vt-econ-log-empty {
    font-size: 0.85rem;
    margin: 0.4rem 0 0;
}

.vt-econ-status-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex: 0 0 auto;
}

.vt-econ-status-dot[data-status="green"]    { background: var(--kb-success); }
.vt-econ-status-dot[data-status="yellow"]   { background: var(--kb-warning); }
.vt-econ-status-dot[data-status="red"]      { background: var(--kb-danger); }
.vt-econ-status-dot[data-status="parallel"] { background: var(--kb-info, var(--kb-secondary)); }

/* Economy Leaders tiles (All Matches → Commanders tab, v4 telemetry) */
.vt-econ-leader-tile {
    height: 100%;
    padding: 0.85rem 1rem;
    border-radius: var(--kb-radius, 0.5rem);
    background: color-mix(in oklab, var(--kb-text-muted) 7%, transparent);
    border: 1px solid var(--kb-border-subtle);
}

.vt-econ-leader-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--kb-text-muted);
    margin-bottom: 0.35rem;
}

.vt-econ-leader-name {
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.vt-econ-leader-value {
    font-family: var(--vt-font-mono, monospace);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--kb-text);
}

.vt-econ-leader-unit {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--kb-text-muted);
}

.vt-econ-leader-sub {
    font-size: 0.75rem;
    color: var(--kb-text-secondary);
    margin-top: 0.15rem;
}

/* ============================================================
   Storyline tab (match.schema_version 22) — .vt-story-*
   Rendered by js/storyline.js from the pipeline `storyline` block.
   All colors from --kb-* tokens; light mode inherits automatically.
   ============================================================ */

.vt-story-why {
    font-size: 0.75rem;
    color: var(--kb-text-muted);
    font-weight: 400;
}

.vt-story-name { font-weight: 600; }

/* --- verdict grid ---------------------------------------------- */
.vt-story-vcell {
    height: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--kb-border-subtle);
    border-radius: var(--kb-radius-md, 8px);
    background: color-mix(in srgb, var(--kb-bg-card) 80%, transparent);
}
.vt-story-vcell--flip {
    border-color: color-mix(in srgb, var(--kb-warning) 35%, var(--kb-border-subtle));
}
.vt-story-vlabel {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--kb-text-muted);
    font-weight: 600;
    margin-bottom: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vt-story-vbody {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.82rem;
}
.vt-story-vchip {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--kb-text-secondary);
}
.vt-story-vchip b {
    font-family: var(--vt-font-mono, monospace);
    font-variant-numeric: tabular-nums;
    color: var(--kb-text-primary);
}
.vt-story-vchip--t1 { border-left: 2px solid var(--kb-primary); padding-left: 0.4rem; }
.vt-story-vchip--t2 { border-left: 2px solid var(--kb-success); padding-left: 0.4rem; }
.vt-story-vwin { color: var(--kb-warning); font-size: 0.7rem; }
.vt-story-vdecided {
    font-size: 0.7rem;
    color: var(--kb-text-muted);
}
.vt-story-vcap {
    font-size: 0.68rem;
    color: var(--kb-text-muted);
    margin-top: 0.3rem;
    line-height: 1.3;
}
.vt-story-vmuted { color: var(--kb-text-muted); }

/* --- timeline lanes -------------------------------------------- */
.vt-story-lane-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.8rem;
    color: var(--kb-text-primary);
    margin: 0.75rem 0 0.15rem;
}
.vt-story-lane-title b { font-weight: 600; }
.vt-story-lane-why {
    font-size: 0.72rem;
    color: var(--kb-text-muted);
}
.vt-story-legend {
    display: inline-flex;
    gap: 0.8rem;
    font-size: 0.72rem;
    color: var(--kb-text-muted);
    margin-left: auto;
}
.vt-story-legend-item i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: -1px;
}
.vt-story-lane { position: relative; }
.vt-story-lane--momentum { height: 170px; }
.vt-story-lane--map { height: 150px; }
.vt-story-lane--war { height: 140px; }
.vt-story-lane--intensity { height: 90px; }

/* --- scrap-status band strips ----------------------------------- */
.vt-story-bands { margin-top: 0.35rem; }
.vt-story-band-row {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}
.vt-story-band-label {
    flex: none;
    font-size: 0.7rem;
    color: var(--kb-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 6px;
}
.vt-story-band-strip {
    display: flex;
    height: 12px;
    border-radius: 3px;
    overflow: hidden;
}
.vt-story-band-seg { height: 100%; opacity: 0.75; }
.vt-story-band-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    font-size: 0.7rem;
    color: var(--kb-text-muted);
    margin-top: 0.2rem;
}
.vt-story-band-legend i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: -1px;
    opacity: 0.75;
}

/* --- key moments rail ------------------------------------------- */
.vt-story-beats {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 480px;
    overflow-y: auto;
}
.vt-story-beat {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    padding: 0.42rem 0.6rem;
    border-radius: var(--kb-radius-md, 8px);
    cursor: pointer;
    transition: background 120ms ease;
}
.vt-story-beat:hover {
    background: color-mix(in srgb, var(--kb-bg-subtle) 70%, transparent);
}
.vt-story-beat-time {
    flex: none;
    width: 52px;
    text-align: right;
    font-family: var(--vt-font-mono, monospace);
    font-variant-numeric: tabular-nums;
    font-size: 0.76rem;
    color: var(--kb-text-muted);
}
.vt-story-beat-ico {
    flex: none;
    width: 20px;
    text-align: center;
    color: var(--kb-text-muted);
    font-size: 0.85rem;
}
.vt-story-beat--major .vt-story-beat-ico,
.vt-story-beat--major .vt-story-beat-title { color: var(--kb-warning); font-weight: 600; }
.vt-story-beat-body { flex: 1; min-width: 0; }
.vt-story-beat-title { font-size: 0.85rem; }
.vt-story-beat-detail {
    display: block;
    font-size: 0.74rem;
    color: var(--kb-text-muted);
}
.vt-story-beat-side {
    flex: none;
    font-size: 0.68rem;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--kb-border-subtle);
    color: var(--kb-text-muted);
    white-space: nowrap;
}
.vt-story-beat-side--t1 { color: var(--kb-primary); border-color: color-mix(in srgb, var(--kb-primary) 45%, transparent); }
.vt-story-beat-side--t2 { color: var(--kb-success); border-color: color-mix(in srgb, var(--kb-success) 45%, transparent); }
.vt-story-beat-expand {
    flex: none;
    width: 20px;
    background: transparent;
    border: 0;
    padding: 0;
    text-align: center;
    color: var(--kb-text-muted);
    cursor: pointer;
    line-height: 1;
}
.vt-story-beat-expand:hover { color: var(--kb-primary); }
.vt-story-beat-expand--ph { visibility: hidden; cursor: inherit; }
.vt-story-beat-sub {
    margin: 0 0 0.35rem 114px;
    padding: 0.35rem 0.6rem;
    border-left: 2px solid var(--kb-border-subtle);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.vt-story-beat-subrow {
    display: flex;
    gap: 0.7rem;
    font-size: 0.76rem;
    color: var(--kb-text-secondary);
}
.vt-story-beat-subrow .vt-story-beat-time { width: 44px; }

@media (max-width: 640px) {
    .vt-story-legend { display: none; }
    .vt-story-beat-side { display: none; }
    .vt-story-beat-sub { margin-left: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    .vt-story-beat { transition: none; }
}

/* ------------------------------------------------------------------
   Per-match Elo tab (#tab-elo / js/match-elo.js)
   Lobby Δ list, selected-player verdict + axis bars, P-vs-E scatter,
   compact VSR-C duel strip (hidden when this match has no duel).
   ------------------------------------------------------------------ */
.vt-match-elo-why {
    font-size: 0.78rem;
    color: var(--kb-text-muted);
}
.vt-match-elo-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.4fr) minmax(80px, 2fr) 6rem;
    gap: 0.6rem;
    align-items: center;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
}
.vt-match-elo-row:hover {
    background: color-mix(in oklab, var(--kb-primary) 8%, transparent);
}
.vt-match-elo-row.is-selected {
    background: color-mix(in oklab, var(--kb-primary) 14%, transparent);
    outline: 1px solid color-mix(in oklab, var(--kb-primary) 35%, transparent);
}
.vt-match-elo-row.is-unrated {
    opacity: 0.55;
}
.vt-match-elo-row-who {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    min-width: 0;
}
.vt-match-elo-track {
    position: relative;
    display: block;
    min-width: 80px;
    width: 100%;
    height: 8px;
    background: color-mix(in srgb, var(--kb-text-muted) 22%, transparent);
    border-radius: 4px;
}
.vt-match-elo-track-center {
    position: absolute;
    left: 50%;
    top: -2px;
    bottom: -2px;
    width: 1px;
    background: color-mix(in srgb, var(--kb-text-muted) 50%, transparent);
}
.vt-match-elo-track-fill {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 4px;
}
.vt-match-elo-track-fill.is-positive { background: var(--kb-success); }
.vt-match-elo-track-fill.is-negative { background: var(--kb-danger); }
.vt-match-elo-delta {
    font-family: var(--bs-font-monospace);
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-size: 0.85rem;
}
.vt-match-elo-cmdr {
    display: inline-block;
    padding: 0.1em 0.45em;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--kb-primary);
    background: color-mix(in oklab, var(--kb-primary) 12%, transparent);
    border: 1px solid color-mix(in oklab, var(--kb-primary) 25%, transparent);
    border-radius: 999px;
    vertical-align: middle;
}
.vt-match-elo-unrated-label {
    margin: 0.75rem 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--kb-text-muted);
}
.vt-match-elo-headline {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.vt-match-elo-headline-delta {
    font-family: var(--bs-font-monospace);
    font-size: 1.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.vt-match-elo-headline-range {
    font-size: 0.95rem;
    color: var(--kb-text-secondary);
}
.vt-match-elo-headline-delta .vt-verdict-chip {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.2rem 0.7rem;
    letter-spacing: 0;
}
.vt-match-elo-verdict {
    font-size: 0.95rem;
    color: var(--kb-text-primary);
}
.vt-match-elo-info {
    margin-left: 0.15rem;
}
.vt-match-elo-sentence {
    font-size: 0.85rem;
    color: var(--kb-text-secondary);
}
.vt-match-elo-cmdr-note {
    font-size: 0.78rem;
    color: var(--kb-text-muted);
}
.vt-match-elo-scatter-wrap {
    position: relative;
    height: 280px;
}
.vt-match-elo-vtsrc-row {
    grid-template-columns: minmax(140px, 1.4fr) minmax(80px, 2fr) 4.5rem 5.5rem;
}
.vt-match-elo-vtsrc-range {
    font-size: 0.8rem;
    color: var(--kb-text-secondary);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.vt-match-elo-vtsrc-verdict {
    font-size: 0.9rem;
    color: var(--kb-text-primary);
}
@media (max-width: 640px) {
    .vt-match-elo-row {
        grid-template-columns: 1fr 6rem;
        grid-template-rows: auto auto;
    }
    .vt-match-elo-track { grid-column: 1 / -1; }
    .vt-match-elo-vtsrc-row {
        grid-template-columns: 1fr 3.5rem;
        grid-template-rows: auto auto auto;
    }
    .vt-match-elo-vtsrc-range {
        grid-column: 1 / -1;
        text-align: left;
    }
}


/* ============================================================================
   BALONCE METER (shared: Tools Team Balonce + per-match dashboard section)
   ============================================================================
   The community name for a lopsided lobby is "getting PLAYED", so the gauge
   is the Balonce Meter. Markup is emitted by js/balonce-meter.js and used
   verbatim on both surfaces, which is why these rules live here (loaded by
   index.html AND tools/index.html) rather than in css/tools.css.

   The legacy `.vt-tools-balonce-played-meter-*` rules in css/tools.css stay
   put on purpose (class-name stability precedent: `.vt-active-game-modal-*`);
   the tools card keeps that block only as the outer spacing wrapper. */

.vt-balonce-meter {
    margin: 0.35rem 0 0.1rem;
}

/* Gradient reads outward from a balanced centre: green in the middle,
   warning at the shoulders, danger at the extremes. */
.vt-balonce-meter-track {
    position: relative;
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(
        to right,
        color-mix(in oklab, var(--kb-danger) 30%, transparent) 0%,
        color-mix(in oklab, var(--kb-warning) 26%, transparent) 20%,
        color-mix(in oklab, var(--kb-warning) 12%, transparent) 35%,
        color-mix(in oklab, var(--kb-success) 24%, transparent) 50%,
        color-mix(in oklab, var(--kb-warning) 12%, transparent) 65%,
        color-mix(in oklab, var(--kb-warning) 26%, transparent) 80%,
        color-mix(in oklab, var(--kb-danger) 30%, transparent) 100%
    );
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}

.vt-balonce-meter-tick {
    position: absolute;
    top: -2px;
    bottom: -2px;
    left: 50%;
    width: 2px;
    background-color: color-mix(in oklab, var(--kb-text-primary) 50%, transparent);
    transform: translateX(-1px);
}

.vt-balonce-meter-chevron {
    position: absolute;
    top: -10px;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    color: var(--kb-text-primary);
    font-size: 1.1rem;
    line-height: 1;
    text-align: center;
    transition: left var(--vt-anim-duration, 0.2s) var(--vt-anim-ease, ease-out);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

@media (prefers-reduced-motion: reduce) {
    .vt-balonce-meter-chevron { transition: none; }
}

.vt-balonce-meter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.4rem;
    font-size: 0.7rem;
    color: var(--kb-text-muted);
}

.vt-balonce-meter-end {
    flex-shrink: 0;
    color: var(--kb-text-muted);
}

/* The dashboard card names the commander on both end labels
   ("Team 1 (mort) disadv"), so they have to be allowed to shrink.
   The Tools gauge keeps the short rigid form. Dashboard-only spacing
   below opens the Outcome card into roster / call / played-out without
   moving the Tools Team Balonce gauge, which shares these classes. */
#section-faction .vt-balonce-meter-end {
    flex-shrink: 1;
    min-width: 0;
}

#section-faction .vt-balonce-meter {
    margin: 0.85rem 0 0.2rem;
}

#section-faction .vt-balonce-meter-track {
    height: 18px;
    border-radius: 9px;
}

#section-faction .vt-balonce-meter-footer {
    margin-top: 0.7rem;
}

#section-faction .vt-balonce-parts {
    margin-top: 0.9rem;
}

#section-faction .vt-balonce-perf {
    padding: 0.55rem 0.7rem;
}

#section-faction .vt-balonce-axis-row {
    margin-bottom: 0.45rem;
}

#section-faction .vt-balonce-axis-track {
    height: 9px;
}

#outcome-after .vt-balonce-chiprow {
    margin-top: 0.85rem;
}

.vt-balonce-meter-status {
    flex-grow: 1;
    text-align: center;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.72rem;
}

.vt-balonce-meter-status--green {
    color: var(--kb-success);
    background-color: color-mix(in oklab, var(--kb-success) 16%, transparent);
}
.vt-balonce-meter-status--yellow {
    color: color-mix(in oklab, var(--kb-warning) 75%, var(--kb-text-primary) 25%);
    background-color: color-mix(in oklab, var(--kb-warning) 12%, transparent);
}
.vt-balonce-meter-status--orange {
    color: var(--kb-warning);
    background-color: color-mix(in oklab, var(--kb-warning) 18%, transparent);
}
.vt-balonce-meter-status--red {
    color: var(--kb-danger);
    background-color: color-mix(in oklab, var(--kb-danger) 18%, transparent);
}

/* The band label used to ALSO render as a pill next to each caller's
   headline. That was the same status printed twice, so the pill is gone
   and `.vt-balonce-meter-status` above is the single home for it. */

/* ---- Shared chips / parts readout ---- */

.vt-balonce-chiprow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.vt-balonce-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2em 0.55em;
    border-radius: 6px;
    border: 1px solid var(--kb-border-subtle);
    background-color: color-mix(in oklab, var(--kb-bg-subtle) 70%, transparent);
    color: var(--kb-text-secondary);
    font-size: 0.74rem;
    line-height: 1.35;
}
.vt-balonce-parts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--kb-text-secondary);
}
.vt-balonce-part .vt-mono { color: var(--kb-text-primary); }

/* ---- Dashboard section zones ---- */

.vt-balonce-zone + .vt-balonce-zone {
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--kb-border-subtle);
}

.vt-balonce-zone-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.vt-balonce-zone-title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--kb-text-muted);
}

/* Receipts zone is a <details>: the title is the only collapsed chrome.
   Native marker is replaced by the rotating chevron so it matches the
   match-picker / storyline expanders. */
.vt-balonce-zone--receipts > summary {
    display: flex;
    width: 100%;
    /* The zone-head base is space-between; the receipts summary keeps the
       chevron snug against the title so it reads as the expand affordance
       rather than a far-edge decoration. Full width stays clickable. */
    justify-content: flex-start;
    gap: 0.4rem;
    list-style: none;
    cursor: pointer;
}
.vt-balonce-zone--receipts > summary::-webkit-details-marker {
    display: none;
}
.vt-balonce-zone--receipts > summary::marker {
    content: none;
}
.vt-balonce-zone--receipts > summary:hover .vt-balonce-zone-title,
.vt-balonce-zone--receipts > summary:hover .vt-balonce-receipts-chevron {
    color: var(--kb-text-primary);
}
.vt-balonce-zone--receipts:not([open]) > summary {
    margin-bottom: 0;
}
.vt-balonce-zone--receipts > summary:focus {
    outline: none;
}
.vt-balonce-zone--receipts > summary:focus-visible {
    outline: 2px solid var(--kb-primary);
    outline-offset: 2px;
    border-radius: 4px;
}
.vt-balonce-receipts-chevron {
    font-size: 0.9rem;
    color: var(--kb-text-secondary);
    flex-shrink: 0;
    transition: transform var(--vt-anim-duration, 150ms) var(--vt-anim-ease, ease);
}
.vt-balonce-zone--receipts[open] .vt-balonce-receipts-chevron {
    transform: rotate(180deg);
}
.vt-balonce-receipts-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.45rem;
}

.vt-balonce-link {
    font-size: 0.74rem;
    color: var(--kb-primary);
    text-decoration: none;
    white-space: nowrap;
}
.vt-balonce-link:hover { text-decoration: underline; }

.vt-balonce-headline {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--kb-text-primary);
}
.vt-balonce-prob {
    color: var(--kb-primary);
    font-weight: 700;
}
/* Main reason a side is favored (VTBalonce.mainReason). */
.vt-balonce-reason {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    margin: 0.35rem 0 0.5rem;
    font-size: 0.82rem;
    color: var(--kb-text-secondary);
}
.vt-balonce-reason-label {
    flex: 0 0 auto;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--vt-reason-color, var(--kb-primary));
    background: color-mix(in oklab, var(--vt-reason-color, var(--kb-primary)) 14%, transparent);
    border: 1px solid color-mix(in oklab, var(--vt-reason-color, var(--kb-primary)) 40%, transparent);
}
.vt-balonce-reason[data-reason="commander_edge"] { --vt-reason-color: var(--vt-tier-1); }
.vt-balonce-reason[data-reason="stacked"]        { --vt-reason-color: var(--kb-warning); }
.vt-balonce-reason[data-reason="thug_edge"]      { --vt-reason-color: var(--vt-tier-2); }
.vt-balonce-reason[data-reason="both"]           { --vt-reason-color: var(--kb-primary); }
.vt-balonce-reason[data-reason="even"]           { --vt-reason-color: var(--kb-text-muted); }
.vt-balonce-reason[title] { cursor: help; }

/* ---- Pre-match team columns ---- */

.vt-balonce-teams {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.vt-balonce-team {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--kb-border-subtle);
    border-radius: 8px;
    background-color: color-mix(in oklab, var(--kb-bg-subtle) 45%, transparent);
    min-width: 0;
}

.vt-balonce-team-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}
.vt-balonce-team-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--kb-text-secondary);
}

.vt-balonce-team-cmdr {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    min-width: 0;
}

.vt-balonce-cmdr-chip {
    flex-shrink: 0;
    padding: 0.05em 0.35em;
    border-radius: 3px;
    background-color: color-mix(in oklab, var(--kb-accent) 22%, transparent);
    color: var(--kb-accent);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.vt-balonce-team-ratings {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.3rem;
}

.vt-balonce-rating {
    padding: 0.1em 0.4em;
    border-radius: 4px;
    background-color: color-mix(in oklab, var(--kb-primary) 14%, transparent);
    color: var(--kb-text-primary);
    font-size: 0.72rem;
}
.vt-balonce-rating.is-secondary {
    background-color: color-mix(in oklab, var(--kb-text-muted) 14%, transparent);
    color: var(--kb-text-secondary);
}
.vt-balonce-rating.is-muted {
    background-color: transparent;
    border: 1px dashed var(--kb-border-subtle);
    color: var(--kb-text-muted);
}

.vt-balonce-team-thugs {
    margin-top: 0.35rem;
    font-size: 0.74rem;
    color: var(--kb-text-secondary);
}

/* ---- What-if (host-cancelled matches) ----
   The pre-match numbers on these cards are real, but nothing was scored
   off them. The dashed accent + Not-rated chip exist so the card can
   never be mistaken for a match that counted. */

.vt-balonce-hypothetical .vt-balonce-meter-track,
.vt-balonce-hypothetical .vt-balonce-team {
    border: 1px dashed var(--kb-border-subtle);
}
.vt-balonce-hypothetical .vt-balonce-meter-chevron { opacity: 0.7; }

.vt-balonce-notrated {
    display: inline-flex;
    align-items: center;
    padding: 0.15em 0.55em;
    border-radius: 999px;
    border: 1px dashed var(--kb-warning);
    color: var(--kb-warning);
    background-color: color-mix(in oklab, var(--kb-warning) 12%, transparent);
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.vt-balonce-whatif-note {
    margin-bottom: 0.55rem;
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--kb-text-secondary);
}

.vt-balonce-whatif-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    padding: 0.4rem 0.55rem;
    border-radius: 6px;
    background-color: color-mix(in oklab, var(--kb-bg-subtle) 45%, transparent);
    font-size: 0.78rem;
    color: var(--kb-text-secondary);
}
.vt-balonce-whatif-row + .vt-balonce-whatif-row { margin-top: 0.3rem; }

.vt-balonce-whatif-cmdr {
    font-weight: 600;
    color: var(--kb-text-primary);
    min-width: 7rem;
}

.vt-balonce-whatif-branches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.9rem;
    margin-left: auto;
}

.vt-balonce-whatif-branch {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    white-space: nowrap;
}
.vt-balonce-whatif-label {
    font-size: 0.7rem;
    color: var(--kb-text-muted);
}
.vt-balonce-whatif-branch.is-win .vt-balonce-whatif-delta { color: var(--kb-success); }
.vt-balonce-whatif-branch.is-loss .vt-balonce-whatif-delta { color: var(--kb-danger); }

/* ---- Stakes (plain-language rating-at-risk sentences) ---- */

.vt-balonce-stakes { margin-top: 0.6rem; }

.vt-balonce-stake {
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    background-color: color-mix(in oklab, var(--kb-bg-subtle) 45%, transparent);
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--kb-text-secondary);
}
.vt-balonce-stake + .vt-balonce-stake { margin-top: 0.3rem; }
.vt-balonce-stake strong { color: var(--kb-text-primary); }
.vt-balonce-stake .vt-mono { color: var(--kb-text-primary); }

/* ---- Verdict ---- */

.vt-balonce-call {
    display: inline-flex;
    align-items: baseline;
    padding: 0.3em 0.7em;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    /* Names the winner, so it has to wrap instead of forcing the card wide. */
    text-wrap: pretty;
}
.vt-balonce-call--hit {
    color: var(--kb-success);
    background-color: color-mix(in oklab, var(--kb-success) 15%, transparent);
}
.vt-balonce-call--turn {
    color: var(--kb-info);
    background-color: color-mix(in oklab, var(--kb-info) 16%, transparent);
}
.vt-balonce-call--upset {
    color: var(--kb-warning);
    background-color: color-mix(in oklab, var(--kb-warning) 16%, transparent);
}
.vt-balonce-call--even,
.vt-balonce-call--draw,
.vt-balonce-call--unknown {
    color: var(--kb-text-muted);
    background-color: color-mix(in oklab, var(--kb-text-muted) 12%, transparent);
}

.vt-balonce-provenance {
    font-size: 0.7rem;
    color: var(--kb-text-muted);
    text-transform: lowercase;
}

/* ---- Played-out zone ---- */

.vt-balonce-perfs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.vt-balonce-perf {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    background-color: color-mix(in oklab, var(--kb-bg-subtle) 45%, transparent);
    font-size: 0.78rem;
    color: var(--kb-text-secondary);
}
.vt-balonce-perf-team {
    font-weight: 600;
    color: var(--kb-text-primary);
}
.vt-balonce-perf.is-positive .vt-mono { color: var(--kb-success); }
.vt-balonce-perf.is-negative .vt-mono { color: var(--kb-danger); }

.vt-balonce-sub {
    margin: 0.7rem 0 0.35rem;
    font-size: 0.72rem;
    color: var(--kb-text-muted);
}
.vt-balonce-zone--played > .vt-balonce-sub {
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.vt-balonce-duel-line {
    margin: 0 0 0.4rem;
    font-size: 0.88rem;
    color: var(--kb-text-primary);
}
.vt-balonce-econ { margin-top: 0.5rem; }
.vt-balonce-econ-head {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--kb-text-secondary);
    margin-bottom: 0.2rem;
    cursor: help;
}
.vt-balonce-econ-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.8rem;
    color: var(--kb-text-secondary);
}
.vt-balonce-econ-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
    padding: 0.15rem 0;
    border-bottom: 1px solid color-mix(in oklab, var(--kb-text-muted) 12%, transparent);
}
.vt-balonce-econ-list li:last-child { border-bottom: 0; }
.vt-balonce-econ-axis { color: var(--kb-text-primary); }
.vt-balonce-econ-list li.vt-balonce-econ-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
    align-items: baseline;
    gap: 0.15rem 0.75rem;
}
.vt-balonce-econ-values { white-space: nowrap; }
.vt-balonce-econ-edge { text-align: right; }
@media (max-width: 575.98px) {
    .vt-balonce-econ-list li.vt-balonce-econ-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .vt-balonce-econ-values {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

.vt-balonce-axis-row {
    /* Fixed label column so the bar keeps the room on a wide card —
       the fill is a true fraction of the maximum possible axis gap, so
       an over-long track would read as "tiny difference". */
    grid-template-columns: minmax(90px, 9rem) 1fr minmax(120px, 11rem);
    display: grid;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.74rem;
    color: var(--kb-text-secondary);
    margin-bottom: 0.2rem;
}
.vt-balonce-axis-track {
    position: relative;
    display: block;
    height: 7px;
    border-radius: 4px;
    background: color-mix(in oklab, var(--kb-text-muted) 10%, transparent);
    overflow: hidden;
}
.vt-balonce-axis-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    border-radius: 4px;
}
.vt-balonce-axis-row.is-positive .vt-balonce-axis-fill { background: var(--kb-success); }
.vt-balonce-axis-row.is-negative .vt-balonce-axis-fill { background: var(--kb-danger); }
.vt-balonce-axis-note {
    text-align: right;
    color: var(--kb-text-muted);
    font-size: 0.68rem;
}

/* ---- Receipts ---- */

.vt-balonce-receipt-headline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.82rem;
    color: var(--kb-text-secondary);
}
.vt-balonce-receipt-headline strong { color: var(--kb-text-primary); }

.vt-balonce-spark {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--kb-primary);
    font-size: 0.72rem;
}

.vt-balonce-reliability { margin-top: 0.6rem; }

/* Key for the two marks in every row. Without it the prediction tick is
   just an unexplained white line across a blue bar. */
.vt-balonce-rel-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.5rem;
    font-size: 0.68rem;
    color: var(--kb-text-muted);
}
.vt-balonce-rel-key {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.vt-balonce-rel-key-bar {
    width: 18px;
    height: 9px;
    border-radius: 3px;
    background: var(--kb-primary);
}
.vt-balonce-rel-key-tick {
    width: 2px;
    height: 13px;
    background: var(--kb-text-primary);
}
.vt-balonce-rel-key-note { margin-left: auto; }

.vt-balonce-rel-row {
    display: grid;
    grid-template-columns: minmax(5.5rem, 7rem) minmax(80px, 1fr) minmax(14rem, 17rem);
    gap: 0.6rem;
    align-items: center;
    font-size: 0.74rem;
    color: var(--kb-text-secondary);
    margin-bottom: 0.3rem;
}
.vt-balonce-rel-row.is-thin { opacity: 0.55; }
.vt-balonce-rel-label { color: var(--kb-text-muted); }
.vt-balonce-rel-track {
    position: relative;
    display: block;
    height: 9px;
    border-radius: 4px;
    background: color-mix(in oklab, var(--kb-text-muted) 10%, transparent);
}
.vt-balonce-rel-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    border-radius: 4px;
    background: var(--kb-primary);
}
/* Tick marking what the model PREDICTED, so the bar can be read against
   it. The halo keeps it legible where it lands on top of the fill. */
.vt-balonce-rel-claim {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    margin-left: -1px;
    background: var(--kb-text-primary);
    box-shadow: 0 0 0 1px color-mix(in oklab, var(--kb-bg-card) 65%, transparent);
}

/* Outcome cell: what happened, over how many games, and the read. */
.vt-balonce-rel-outcome {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.3rem 0.4rem;
}
.vt-balonce-rel-value { color: var(--kb-text-primary); }
.vt-balonce-rel-n {
    color: var(--kb-text-muted);
    font-size: 0.68rem;
}
.vt-balonce-rel-verdict {
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
}
.vt-balonce-rel-verdict.is-match { color: var(--kb-success); }
.vt-balonce-rel-verdict.is-over { color: var(--kb-info); }
.vt-balonce-rel-verdict.is-under { color: var(--kb-warning); }

.vt-balonce-credit {
    margin-top: 0.6rem;
    font-size: 0.7rem;
    color: var(--kb-text-muted);
}
.vt-balonce-credit a { color: var(--kb-primary); }

/* ---- Tools-side extras (confidence + honesty footer) ---- */

.vt-balonce-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--kb-border-subtle);
    font-size: 0.68rem;
    color: var(--kb-text-muted);
}
.vt-balonce-footer a { color: var(--kb-primary); text-decoration: none; }
.vt-balonce-footer a:hover { text-decoration: underline; }

.vt-balonce-confidence {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15em 0.45em;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 600;
}
.vt-balonce-confidence--high {
    color: var(--kb-success);
    background-color: color-mix(in oklab, var(--kb-success) 15%, transparent);
}
.vt-balonce-confidence--medium {
    color: var(--kb-warning);
    background-color: color-mix(in oklab, var(--kb-warning) 15%, transparent);
}
.vt-balonce-confidence--low {
    color: var(--kb-danger);
    background-color: color-mix(in oklab, var(--kb-danger) 15%, transparent);
}

@media (max-width: 640px) {
    .vt-balonce-teams,
    .vt-balonce-perfs {
        grid-template-columns: minmax(0, 1fr);
    }
    .vt-balonce-axis-row {
        grid-template-columns: minmax(80px, 1fr) minmax(60px, 1fr);
    }
    .vt-balonce-axis-note { grid-column: 1 / -1; text-align: left; }

    /* Reliability rows drop the outcome under the bar rather than
       squeezing three columns into a phone width. */
    .vt-balonce-rel-row {
        grid-template-columns: minmax(5rem, auto) minmax(60px, 1fr);
        row-gap: 0.2rem;
    }
    .vt-balonce-rel-outcome {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    /* What-if branches stack under the commander name on a phone. */
    .vt-balonce-whatif-branches {
        margin-left: 0;
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Timezone control on the All Matches Meta "Start hour" card. */
.vt-when-tz {
    width: auto;
    max-width: 22rem;
}

/* All Matches → Players. Small samples stay readable but quieter than
   an 8-game row. The hollow swatch marks a 1–2 game quarter on the
   form charts. */
.vt-players-schedule-scroll {
    max-height: 520px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

#vt-players-schedule-table th[data-vt-sort] {
    cursor: pointer;
}

#vt-players-schedule-table td[data-bs-toggle="tooltip"] {
    cursor: help;
}

#vt-players-schedule-table th.is-sorted::after {
    content: " \2193";
    color: var(--kb-text-muted);
}

#vt-players-schedule-table th.is-sorted.is-asc::after {
    content: " \2191";
}

.vt-players-row-small td {
    opacity: 0.55;
}

.vt-players-row-selected {
    background: color-mix(in oklab, var(--kb-primary) 12%, transparent);
}

.vt-players-thin-mark {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    margin-right: 0.35rem;
    border: 2px solid var(--kb-primary);
    border-radius: 2px;
    vertical-align: -1px;
}

.vt-players-search-menu {
    position: absolute;
    z-index: 5;
    width: 100%;
    max-height: 16rem;
    overflow-y: auto;
}

/* Player search menu on the schedule / form cards (js/players-tab.js;
   mounted in the Players hub Trends pane). */
.vt-players-search-menu .list-group-item {
    background: transparent;
    color: var(--kb-text-primary);
    border-color: var(--kb-border-subtle);
}

.vt-players-search-menu .list-group-item:hover,
.vt-players-search-menu .list-group-item:focus {
    background: color-mix(in oklab, var(--kb-primary) 12%, transparent);
    color: var(--kb-text-primary);
}

/* Who this browser follows — picker, gear row, For you scan.
   The row wash itself is an injected stylesheet in js/who.js so the
   Steam64 never lands in a static file. */
.vt-who-gear {
    display: flex;
    align-items: stretch;
    gap: 0.15rem;
}

.vt-who-gear .vt-settings-navitem {
    flex: 1 1 auto;
}

.vt-who-clear {
    flex: 0 0 auto;
    width: auto;
    color: var(--kb-text-muted);
}

.vt-who-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 18rem;
    overflow-y: auto;
    padding: 0.1rem;
}

.vt-who-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid color-mix(in oklab, var(--kb-text-secondary) 38%, var(--kb-border-subtle));
    border-radius: 0.45rem;
    background: color-mix(in oklab, var(--kb-bg-subtle) 72%, transparent);
    color: var(--kb-text-primary);
    text-align: left;
    box-shadow: inset 0 0 0 1px transparent;
}

.vt-who-row:hover:not(.is-active) {
    border-color: color-mix(in oklab, var(--kb-primary) 55%, var(--kb-border-subtle));
    background: color-mix(in oklab, var(--kb-primary) 8%, var(--kb-bg-subtle));
}

.vt-who-row.is-active {
    border-color: var(--kb-primary);
    background: color-mix(in oklab, var(--kb-primary) 28%, var(--kb-bg-card));
    /* Second ring, same color, so the selection reads as a 2px primary stroke
       without the row changing size. */
    box-shadow: inset 0 0 0 1px var(--kb-primary);
}

.vt-who-name {
    font-weight: 650;
}

.vt-who-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.vt-who-chip,
.vt-you-title-chip {
    display: inline-flex;
    align-items: center;
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    color: var(--kb-text-secondary);
    background: color-mix(in oklab, var(--kb-bg-subtle) 80%, transparent);
    border: 1px solid var(--kb-border-subtle);
}

.vt-who-games {
    color: var(--kb-text-muted);
    font-size: 0.72rem;
}

.vt-match-picker-you {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 1.55em;
    margin: 0;
    padding: 0 0.35em;
    border-radius: 999px;
    border: 1px solid color-mix(in oklab, var(--kb-primary) 32%, var(--kb-border-subtle));
    background: color-mix(in oklab, var(--kb-primary) 10%, transparent);
    color: color-mix(in oklab, var(--kb-primary) 62%, var(--kb-text-secondary));
    font-size: 0.52rem;
    font-weight: 650;
    letter-spacing: 0;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.vt-you-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    align-items: baseline;
    margin-bottom: 0.85rem;
}

.vt-you-head-name {
    font-weight: 700;
    font-size: 1.15rem;
}

.vt-you-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 0.75rem;
}

.vt-you-card {
    padding: 0.85rem 1rem;
    border: 1px solid var(--kb-border-subtle);
    border-radius: 0.75rem;
    background: color-mix(in oklab, var(--kb-bg-card) 92%, transparent);
}

.vt-you-jump {
    padding: 0;
    border: 0;
    background: none;
    color: var(--kb-primary);
    font-weight: 700;
    font-size: 0.95rem;
}

.vt-you-jump:hover { text-decoration: underline; }

.vt-you-card p {
    margin: 0.35rem 0 0;
}

.vt-you-outcome {
    margin: 0.5rem 0 0;
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.vt-you-outcome[data-tone="won"] { color: var(--kb-success); }
.vt-you-outcome[data-tone="lost"] { color: var(--kb-danger); }
.vt-you-outcome[data-tone="muted"] { color: var(--kb-text-secondary); }

.vt-you-sub,
.vt-you-note {
    margin: 0.35rem 0 0;
    color: var(--kb-text-secondary);
}

.vt-you-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem 1.15rem;
    margin-top: 0.55rem;
}

.vt-you-stat {
    display: flex;
    flex-direction: column;
    min-width: 3.4rem;
}

.vt-you-stat-value {
    font-size: 1.35rem;
    font-weight: 650;
    line-height: 1.05;
    color: var(--kb-text-primary);
}

.vt-you-stat-label,
.vt-you-rate-k,
.vt-you-rival-k,
.vt-you-meter-band {
    font-size: 0.68rem;
    color: var(--kb-text-muted);
}

.vt-you-awards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.55rem;
}

.vt-you-rate {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin: 0.45rem 0 0;
}

.vt-you-arrow { color: var(--kb-text-muted); }

.vt-you-delta { font-weight: 700; }
.vt-you-delta[data-sign="up"] { color: var(--kb-success); }
.vt-you-delta[data-sign="down"] { color: var(--kb-danger); }
.vt-you-delta[data-sign="flat"] { color: var(--kb-text-muted); font-weight: 650; }

.vt-you-meter { margin-top: 0.5rem; }

.vt-you-meter-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.vt-you-meter-score {
    font-size: 1.35rem;
    font-weight: 650;
    line-height: 1;
}

.vt-you-meter-track {
    height: 0.4rem;
    margin-top: 0.35rem;
    border-radius: 999px;
    background: color-mix(in oklab, var(--kb-bg-subtle) 80%, transparent);
    overflow: hidden;
}

.vt-you-meter-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--kb-primary);
}

.vt-you-rival {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.vt-you-rival-copy {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.vt-you-rival-k { display: block; }
