/*
 * Vision TV — AppKit wall layout.
 *
 * The public shell links the same portal token and component layers as the
 * application. This file owns only the room-scale composition: viewport
 * sizing, the 4×2 cage grid, and type hierarchy. All colour, material,
 * typography, radii, elevation, and semantic states come from AppKit tokens.
 */

html,
body {
    min-height: 100%;
}

.vs-bg {
    height: 100vh;
    padding: var(--portal-space-4);
    overflow: hidden;
    background: transparent;
    color: var(--portal-c-text);
    font-family: var(--portal-font-body);
}

.vs-data,
.vs-vision-wall {
    height: 100%;
    min-height: 0;
}

.vs-vision-wall {
    display: flex;
    flex-direction: column;
    gap: var(--portal-space-3);
}

#vs-loading {
    height: 100%;
}

.vs-tv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    gap: var(--portal-space-4);
    min-height: 4.5rem;
    padding-inline: var(--portal-space-1);
}

.vs-tv-brand {
    display: flex;
    align-items: center;
    gap: var(--portal-space-3);
}

.vs-tv-qr {
    display: flex;
    align-items: center;
    gap: var(--portal-space-3);
    margin-left: auto;
}

.vs-tv-qr-code {
    width: 4.5rem;
    height: 4.5rem;
    padding: 0.3rem;
    border-radius: 0.4rem;
    /* The code wears the theme: light plate, dark modules — always dark ON
       light, which is the polarity phone scanners expect. Light theme swaps
       the two tokens. The library's own fills are presentation attributes, so
       the rules below win. */
    background: var(--portal-c-text);
}

.vs-tv-qr-code rect {
    fill: var(--portal-c-text);
}

.vs-tv-qr-code path {
    fill: var(--portal-c-surface-opaque);
}

[data-portal-theme="light"] .vs-tv-qr-code {
    background: var(--portal-c-surface-opaque);
}

[data-portal-theme="light"] .vs-tv-qr-code rect {
    fill: var(--portal-c-surface-opaque);
}

[data-portal-theme="light"] .vs-tv-qr-code path {
    fill: var(--portal-c-text);
}

.vs-tv-qr-code svg {
    display: block;
    width: 100%;
    height: 100%;
}

.vs-tv-qr-label {
    max-width: 9rem;
    color: var(--portal-c-text);
    font-size: var(--portal-text-sm);
    font-weight: var(--portal-weight-strong);
    line-height: var(--portal-leading-tight);
}

.vs-tv-icon {
    display: block;
    width: 3.5rem;
    height: 3.5rem;
    flex: 0 0 auto;
    object-fit: contain;
}

.vs-tv-kicker {
    margin-bottom: var(--portal-space-1);
    color: var(--portal-c-accent);
}

.vs-tv-title {
    margin: 0;
    color: var(--portal-c-text);
    font-family: var(--portal-font-body);
    font-size: var(--portal-text-3xl);
    font-weight: var(--portal-weight-strong);
    line-height: var(--portal-leading-tight);
}

.vs-tv-current-top,
.vs-tv-current-meta,
.vs-tv-queue-position,
.vs-tv-queue-meta {
    font-family: var(--portal-font-mono);
    font-size: var(--portal-label-size);
    font-weight: var(--portal-label-weight);
    letter-spacing: var(--portal-label-tracking);
    text-transform: uppercase;
}

/* Eight cages fill four columns by two rows. A filtered TV URL rewrites the
   column count through --vs-tv-columns without changing the card component. */
.vs-tv-grid {
    display: grid;
    grid-template-columns: repeat(var(--vs-tv-columns, 4), minmax(0, 1fr));
    grid-auto-rows: auto;
    align-content: start;
    align-items: start;
    gap: var(--portal-space-3);
    flex: 1 1 auto;
    min-height: 0;
}

/* When the natural 4×2 wall would run below the viewport, JavaScript promotes
   the visible cages into compact, top-aligned lanes. This keeps every fight on
   the TV at once without introducing a scrollbar or an unattended carousel. */
.vs-tv-grid.vs-tv-grid--dense {
    grid-template-columns: repeat(var(--vs-tv-dense-columns, 8), minmax(0, 1fr));
    /* Rows are as tall as the busiest cage needs, not the whole screen: the
       cards of a row stretch to match each other (one clean bottom line) but
       a quiet wall no longer stands as eight screen-high empty lanes. The
       client's row clipping still measures against the full wall height, so a
       long queue is cut to what fits and the overflow count pins to the foot. */
    grid-template-rows: repeat(var(--vs-tv-dense-rows, 1), auto);
    grid-auto-rows: unset;
    align-items: stretch;
    align-content: start;
}

.vs-tv-grid--dense .vs-tv-queue {
    flex: 1 1 auto;
    min-height: 0;
}

.vs-tv-grid--dense .vs-tv-overflow {
    margin-top: auto;
}

.vs-tv-grid--dense .vs-tv-cage-header.card-header {
    min-height: 2.4rem;
    padding: var(--portal-space-1) var(--portal-space-2);
}

.vs-tv-grid--dense .vs-tv-cage-header h2 {
    font-size: var(--portal-text-xl);
}

.vs-tv-grid--dense .vs-tv-cage-header .portal-chip {
    padding-inline: var(--portal-space-1);
    font-size: var(--portal-label-size-sm);
}

.vs-tv-grid--dense .vs-tv-current {
    min-height: 6.25rem;
    padding: var(--portal-space-2);
}

.vs-tv-grid--dense .vs-tv-matchup {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.vs-tv-grid--dense .vs-tv-matchup > span:not(.vs-vs) {
    width: 100%;
    font-size: var(--portal-text-lg);
    text-align: left;
}

.vs-tv-grid--dense .vs-tv-matchup > .vs-vs {
    display: none;
}

/* A four-lane laptop card is wide enough for the matchup on one line; the
   line it saves goes to one more queued fight. Narrow eight-lane TV cards
   keep the stacked names. */
@container (min-width: 18rem) {
    .vs-tv-grid--dense .vs-tv-current {
        min-height: 0;
    }

    .vs-tv-grid--dense .vs-tv-matchup {
        display: grid;
        align-items: baseline;
        gap: var(--portal-space-2);
    }

    .vs-tv-grid--dense .vs-tv-matchup > span:not(.vs-vs) {
        width: auto;
    }

    .vs-tv-grid--dense .vs-tv-matchup > span:last-child {
        text-align: right;
    }

    .vs-tv-grid--dense .vs-tv-matchup > .vs-vs {
        display: inline;
    }
}

.vs-tv-grid--dense .vs-tv-queue-row {
    /* Wide enough for "PIT WALL" on one line in the eight-lane TV layout */
    grid-template-columns: 3.5rem minmax(0, 1fr);
    gap: var(--portal-space-1);
    /* Grow to the two-line content on short laptop viewports, where 4.45vh
       is shorter than the text; clipTvQueues measures the real row height. */
    flex-basis: auto;
    min-height: clamp(2.35rem, 4.45vh, 3rem);
    padding: var(--portal-space-1) var(--portal-space-2);
}

.vs-tv-grid--dense .vs-tv-queue-bots {
    font-size: var(--portal-text-sm);
}

.vs-tv-grid--dense .vs-tv-queue-meta,
.vs-tv-grid--dense .vs-tv-queue-position {
    font-size: var(--portal-label-size-sm);
}

/* A compact lane with nothing queued: the message fills the lane's spare
   height and sits in the middle of it, instead of a one-line strip glued under
   the Now block with a blank lane below. */
.vs-tv-grid--dense .vs-tv-queue-empty {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--portal-space-2);
    min-height: 9rem;
    padding-inline: var(--portal-space-2);
    font-size: var(--portal-label-size-sm);
    text-align: center;
}

/* Sparky (the BrettZone empty-state mark) is the "queue clear" icon in every
   layout: small beside the text in a normal card's strip, large above it in a
   stretched compact lane. */
.vs-tv-queue-empty .fa-check {
    display: none;
}

/* A mask, not an <img>: the mark takes the muted text colour, so it reads on
   every theme (a white SVG vanishes on the light theme signed-out visitors get). */
.vs-tv-queue-empty-mark {
    display: block;
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    background-color: currentColor;
    -webkit-mask: url('/img/brettzone/sparky-white.svg') center / contain no-repeat;
    mask: url('/img/brettzone/sparky-white.svg') center / contain no-repeat;
    opacity: 0.55;
}

.vs-tv-grid--dense .vs-tv-queue-empty-mark {
    width: 4rem;
    height: 4rem;
    margin-bottom: var(--portal-space-1);
    opacity: 0.4;
}

.vs-tv-queue-position > span {
    white-space: nowrap;
}

.vs-tv-queue-row--display-hidden {
    display: none !important;
}

.vs-tv-overflow {
    display: flex;
    align-items: center;
    flex: 0 0 clamp(2.35rem, 4.45vh, 3rem);
    min-height: clamp(2.35rem, 4.45vh, 3rem);
    padding-inline: var(--portal-space-2);
    border-top: 1px solid var(--portal-c-border-subtle);
    color: var(--portal-c-text-muted);
    font-family: var(--portal-font-mono);
    font-size: var(--portal-label-size-sm);
    font-weight: var(--portal-label-weight);
    letter-spacing: var(--portal-label-tracking);
    text-transform: uppercase;
}

/* True 720p venue displays are 1280×720, not 1920×720. Four lanes per row
   preserve readable bot names and queue labels; the adaptive overflow count
   carries the fights that cannot fit vertically in each half-height lane. */
@media (min-width: 901px) and (max-width: 1599.98px) {
    .vs-tv-grid--dense .vs-tv-queue-bots {
        font-size: var(--portal-text-base);
    }
}

.vs-tv-cage.card {
    container-type: inline-size;
    min-width: 0;
    overflow: hidden;
}

.vs-tv-cage-header.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--portal-space-2);
    flex: 0 0 auto;
    min-height: 2.75rem;
    padding: var(--portal-space-2) var(--portal-space-3);
}

.vs-tv-cage-header h2 {
    margin: 0;
    color: var(--portal-c-text);
    font-size: var(--portal-text-2xl);
    font-weight: var(--portal-weight-strong);
    letter-spacing: var(--portal-tracking-caps);
    line-height: var(--portal-leading-tight);
    text-transform: uppercase;
}

.vs-tv-cage-header > span {
    overflow: hidden;
    color: var(--portal-c-text-muted);
    font-family: var(--portal-font-mono);
    font-size: var(--portal-label-size);
    font-weight: var(--portal-label-weight);
    letter-spacing: var(--portal-label-tracking);
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.vs-tv-cage-header .portal-chip {
    flex: 0 0 auto;
}

.vs-tv-current {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 6.75rem;
    padding: var(--portal-space-3);
    border-bottom: 1px solid var(--portal-c-border-subtle);
    background: var(--portal-c-surface-header);
}

.vs-tv-current::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0.25rem;
    background: var(--portal-c-accent);
    content: '';
}

.vs-tv-current.status-active {
    background: var(--portal-c-badge-success-bg);
}

.vs-tv-current.status-active::before {
    background: var(--portal-c-badge-success-color);
}

.vs-tv-current.status-soon {
    background: var(--portal-c-badge-warning-bg);
}

.vs-tv-current.status-soon::before {
    background: var(--portal-c-badge-warning-color);
}

.vs-tv-current.status-warning {
    background: var(--portal-c-badge-danger-bg);
}

.vs-tv-current.status-warning::before {
    background: var(--portal-c-badge-danger-color);
}

.vs-tv-current.status-load {
    background: var(--portal-c-badge-info-bg);
}

.vs-tv-current.status-load::before {
    background: var(--portal-c-badge-info-color);
}

.vs-tv-current-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--portal-space-2);
    margin-bottom: var(--portal-space-1);
}

.vs-tv-position {
    color: var(--portal-c-accent);
}

.status-active .vs-tv-position {
    color: var(--portal-c-badge-success-color);
}

.status-soon .vs-tv-position {
    color: var(--portal-c-badge-warning-color);
}

.status-warning .vs-tv-position {
    color: var(--portal-c-badge-danger-color);
}

.status-load .vs-tv-position {
    color: var(--portal-c-badge-info-color);
}

.vs-tv-status.portal-chip {
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vs-tv-matchup {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: baseline;
    gap: var(--portal-space-2);
    min-width: 0;
}

.vs-tv-matchup > span:not(.vs-vs) {
    overflow: hidden;
    color: var(--portal-c-text);
    font-size: var(--portal-text-2xl);
    font-weight: var(--portal-weight-strong);
    line-height: var(--portal-leading-tight);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vs-tv-matchup > span:last-child {
    text-align: right;
}

.vs-vs {
    color: var(--portal-c-text-muted);
    font-size: var(--portal-text-xs);
    font-style: italic;
    font-weight: var(--portal-weight-body);
}

.vs-tv-current-meta {
    margin-top: var(--portal-space-1);
    overflow: hidden;
    color: var(--portal-c-text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vs-tv-current--empty {
    align-items: flex-start;
    background: var(--portal-c-surface-header);
}

.vs-tv-empty,
.vs-tv-queue-empty {
    color: var(--portal-c-text-muted);
    font-family: var(--portal-font-mono);
    font-size: var(--portal-text-sm);
    font-weight: var(--portal-weight-label);
    letter-spacing: var(--portal-label-tracking);
    text-transform: uppercase;
}

.vs-tv-empty-title {
    color: var(--portal-c-text);
    font-size: var(--portal-text-xl);
    font-weight: var(--portal-weight-strong);
    line-height: var(--portal-leading-tight);
}

.vs-tv-queue {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
}

.vs-tv-queue-row {
    display: grid;
    /* 4.5rem holds "PIT WALL" on one line at the full label size; rows grow
       to their content so a long label or name never spills into the next. */
    grid-template-columns: 4.5rem minmax(0, 1fr);
    align-items: center;
    gap: var(--portal-space-2);
    flex: 0 0 auto;
    min-height: 3.2rem;
    padding: var(--portal-space-2) var(--portal-space-3);
    border-bottom: 1px solid var(--portal-c-border-subtle);
}

.vs-tv-queue-row:last-child {
    border-bottom: 0;
}

.vs-tv-queue-position {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    color: var(--portal-c-accent);
}

.vs-tv-queue-position strong {
    color: var(--portal-c-text-muted);
    font-size: var(--portal-text-sm);
}

.vs-tv-queue-fight {
    min-width: 0;
}

.vs-tv-queue-bots {
    overflow: hidden;
    color: var(--portal-c-text);
    font-size: var(--portal-text-base);
    font-weight: var(--portal-weight-strong);
    line-height: var(--portal-leading-snug);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vs-tv-queue-meta {
    margin-top: 0.1rem;
    overflow: hidden;
    color: var(--portal-c-text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Each queued fight's TrueFinals state leads its meta line, tinted with the
   same semantic tokens as the current fight's chip. */
.vs-tv-queue-state {
    margin-right: var(--portal-space-2);
    color: var(--portal-c-text);
}

.vs-tv-queue-state.status-active {
    color: var(--portal-c-badge-success-color);
}

.vs-tv-queue-state.status-soon {
    color: var(--portal-c-badge-warning-color);
}

.vs-tv-queue-state.status-warning {
    color: var(--portal-c-badge-danger-color);
}

.vs-tv-queue-state.status-load {
    color: var(--portal-c-badge-info-color);
}

.vs-tv-queue-empty {
    display: flex;
    align-items: center;
    gap: var(--portal-space-2);
    flex: 0 0 3.2rem;
    min-height: 3.2rem;
    padding: 0 var(--portal-space-3);
    border-bottom: 1px solid var(--portal-c-border-subtle);
    color: var(--portal-c-text-muted);
}

.vs-cell--highlight {
    border-color: var(--portal-c-accent-border);
    box-shadow: var(--portal-c-focus-ring), var(--portal-c-shadow-raised);
}

.vs-no-matches.card {
    position: fixed;
    inset: 45% auto auto 50%;
    z-index: 8;
    width: min(32rem, calc(100vw - 2rem));
    transform: translate(-50%, -50%);
}

.vs-header {
    flex: 0 0 auto;
    text-align: center;
}

.vs-title {
    margin: 0;
    color: var(--portal-c-text);
    font-size: var(--portal-text-3xl);
    font-weight: var(--portal-weight-strong);
}

.vs-date {
    color: var(--portal-c-accent);
    font-family: var(--portal-font-mono);
    font-size: var(--portal-label-size);
    font-weight: var(--portal-label-weight);
    letter-spacing: var(--portal-label-tracking);
    text-transform: uppercase;
}

.vs-empty {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--portal-space-2);
    color: var(--portal-c-text-muted);
}

.vs-empty-title {
    color: var(--portal-c-text);
    font-size: var(--portal-text-2xl);
    font-weight: var(--portal-weight-strong);
}

.vs-empty-note {
    font-size: var(--portal-text-base);
}

@media (max-width: 900px) {
    .vs-bg {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .vs-data,
    .vs-vision-wall {
        height: auto;
    }

    .vs-tv-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: minmax(14rem, auto);
    }
}

@media (max-width: 575.98px) {
    .vs-tv-grid {
        grid-template-columns: 1fr;
    }

    /* A phone card is ~350px: two names side by side cut each other off with
       an ellipsis ("Momentary…"). Stack them instead so a name is always
       read in full, wrapping if it must. */
    .vs-tv-matchup {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    .vs-tv-matchup > span:not(.vs-vs) {
        max-width: 100%;
        overflow: visible;
        text-align: left;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vs-cell--highlight {
        box-shadow: inset 0 0 0 2px var(--portal-c-accent-border);
    }
}

/* ── Sport theme: the BrettZone display masthead ─────────────────────────
   Mirrors havocManager's eventBrackets display — purple wash + grid +
   drifting outline squares behind a logo / rule / title masthead, notched
   cards, and a teal line along the bottom edge. Every rule is gated on the
   sport theme; the other themes keep the AppKit wall untouched. */
.vs-ambient,
.vs-footline,
.vs-tv-wordmark,
.vs-tv-section {
    display: none;
}

html[data-portal-theme="sport"] .vs-bg {
    position: relative;
    padding: var(--portal-space-4) var(--portal-space-6) var(--portal-space-3);
}

html[data-portal-theme="sport"] .vs-ambient {
    position: fixed;
    inset: 0;
    display: block;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 55% -40%, var(--bz-brand-purple), transparent 75%),
        linear-gradient(125deg, transparent 30%, var(--bz-surface-1));
}

html[data-portal-theme="sport"] .vs-ambient::after {
    position: absolute;
    inset: 0;
    opacity: 0.17;
    background-image:
        linear-gradient(var(--bz-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--bz-border) 1px, transparent 1px);
    background-size: 4.5rem 4.5rem;
    mask-image: linear-gradient(transparent, var(--bz-bg));
    content: '';
}

html[data-portal-theme="sport"] .vs-ambient i {
    position: absolute;
    top: -19rem;
    right: -37rem;
    width: 69rem;
    height: 69rem;
    border: 1px solid var(--bz-border-strong);
    opacity: 0.45;
    transform: rotate(35deg);
    animation: vs-ambient-drift 32s ease-in-out infinite alternate;
}

html[data-portal-theme="sport"] .vs-ambient i:nth-child(2) {
    top: -14rem;
    right: -41rem;
    animation-delay: -11s;
}

html[data-portal-theme="sport"] .vs-ambient i:nth-child(3) {
    top: 25rem;
    right: auto;
    left: -43rem;
    width: 50rem;
    height: 50rem;
    animation-delay: -20s;
}

@keyframes vs-ambient-drift {
    to {
        opacity: 0.2;
        transform: translate(-4.5rem, 3.5rem) rotate(42deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    html[data-portal-theme="sport"] .vs-ambient i {
        animation: none;
    }
}

html[data-portal-theme="sport"] .vs-footline {
    position: fixed;
    inset: auto 0 0;
    display: block;
    height: 0.25rem;
    background: var(--bz-w3);
    pointer-events: none;
}

html[data-portal-theme="sport"] .vs-vision-wall {
    position: relative;
    z-index: 1;
}

html[data-portal-theme="sport"] .vs-tv-header {
    min-height: 4rem;
    padding: 0 0 var(--portal-space-3);
    border-bottom: 1px solid var(--bz-border-strong);
}

html[data-portal-theme="sport"] .vs-tv-brand {
    gap: var(--portal-space-4);
}

html[data-portal-theme="sport"] .vs-tv-icon,
html[data-portal-theme="sport"] .vs-tv-kicker {
    display: none;
}

html[data-portal-theme="sport"] .vs-tv-wordmark {
    display: block;
    width: auto;
    height: 3rem;
    padding-right: var(--portal-space-4);
    border-right: 0.25rem solid var(--bz-w3);
    box-sizing: content-box;
}

html[data-portal-theme="sport"] .vs-tv-title {
    font-family: var(--portal-font-body);
    font-size: var(--portal-text-3xl);
    font-weight: var(--portal-weight-strong);
    letter-spacing: var(--portal-tracking-caps);
    text-transform: uppercase;
}

html[data-portal-theme="sport"] .vs-tv-section {
    display: block;
    padding: var(--portal-space-3) 0;
    color: var(--bz-w3);
    font-family: var(--portal-font-body);
    font-size: var(--portal-label-size);
    font-weight: var(--portal-weight-label);
    letter-spacing: var(--portal-label-tracking);
    text-transform: uppercase;
}

html[data-portal-theme="sport"] .vs-tv-cage.card {
    position: relative;
    border-color: var(--bz-border-strong);
    background: linear-gradient(105deg, var(--bz-surface-2), var(--bz-surface-1));
    clip-path: polygon(0 0, calc(100% - 0.75rem) 0, 100% 0.75rem, 100% 100%, 0 100%);
}

html[data-portal-theme="sport"] .vs-tv-cage.card::after {
    position: absolute;
    top: 0.3rem;
    right: -0.15rem;
    width: 1.05rem;
    height: 2px;
    background: var(--bz-border-strong);
    transform: rotate(45deg);
    content: '';
}

/* ── NXT theme: All Cages NXT on the Vision wall ──────────────────────────
   The NXT theme sheet (portal-nxt-theme.css) is self-contained and knows
   nothing about this page, so without this block the wall rendered in NXT's
   palette but as the plain AppKit wall — plainer than sport, which is
   backwards for the language Austin built for audience displays.

   Modelled on havocManager's All Cages NXT (docs/technical/vertical-all-
   cages-nxt.md, app/mi/displays/assets/verticalAllCageStatusNXT.css), the
   nearest NXT board to a multi-cage wall: a static diagonal surface, the
   NHRL mark over a Joyride headline with its offset outline echo, the
   magenta | cyan | keyline brand rule, cage cards with the signature
   top-right cut, a state rail down each current fight, and robot names in
   DIN Heavy Italic in their corner colours.

   States follow NXT_DESIGN.md, always with the chip's words beside the
   colour: on-air red for ACTIVE/FIGHTING, preparation pink for CALLED,
   paused lilac for HOLD, brand blue for LOAD-IN/OUT. The only continuous
   motion is the live triangle ("continuous motion is limited to the shared
   live triangle"), and reduced motion stops it.

   Every rule is scoped to `.vs-bg`, the public wall's <main>: the cage cards
   are shared with the signed-in /vision-system page, which this leaves alone.
   Every colour is a token the NXT sheet already declares — this file carries
   no palette of its own (VisionSystemTvTextSizeTest bans colour literals here). */
html[data-portal-theme="nxt"] .vs-bg {
    padding: var(--portal-space-4) var(--portal-space-6) var(--portal-space-3);
    background: linear-gradient(145deg, var(--bz-surface-2), var(--bz-bg) 38%);
}

/* Masthead: NHRL mark, a small dim kicker, the Joyride headline. */
html[data-portal-theme="nxt"] .vs-bg .vs-tv-header {
    min-height: 5rem;
    padding: 0 0 var(--portal-space-3);
    /* The brand rule — magenta, cyan, then keyline (All Cages' .brand-rule). */
    background: linear-gradient(90deg,
            var(--bz-accent) 0 48%,
            var(--bz-brand-teal) 48% 64%,
            var(--bz-border-strong) 64%)
        bottom / 100% 5px no-repeat;
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-brand {
    gap: var(--portal-space-4);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-icon {
    display: none;
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-wordmark {
    display: block;
    width: auto;
    height: 3rem;
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-kicker {
    color: var(--bz-text-dim);
    font-family: var(--portal-font-body);
    font-weight: var(--portal-weight-label);
    letter-spacing: 0.14em;
}

/* The hero. "Event hero — Joyride, uppercase; restrained offset Joyride
   Outline echo." The echo is the same word in the outline cut, offset down
   and right in the keyline colour, behind the solid face. */
html[data-portal-theme="nxt"] .vs-bg .vs-tv-title {
    position: relative;
    isolation: isolate;
    font-family: var(--portal-font-display);
    font-size: calc(var(--portal-text-3xl) * 1.5);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.1;
    text-transform: uppercase;
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-title::before {
    position: absolute;
    top: 0.2rem;
    left: 0.18rem;
    z-index: -1;
    color: var(--bz-border-strong);
    font-family: 'NXT Joyride Outline', var(--portal-font-display);
    content: attr(data-echo);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-section {
    display: block;
    padding: var(--portal-space-2) 0 0;
    color: var(--bz-text-dim);
    font-family: var(--portal-font-body);
    font-size: var(--portal-text-sm);
    font-weight: var(--portal-weight-strong);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Cards: straight edges, a strong keyline and the signature top-right cut.
   Safe to clip here — the wall is display-only, with no focus ring or menu
   at a card edge to amputate. */
html[data-portal-theme="nxt"] .vs-bg .vs-tv-cage.card {
    border: 1px solid var(--bz-border-strong);
    border-radius: 0;
    background: var(--bz-surface-1);
    clip-path: polygon(0 0, calc(100% - 1.125rem) 0, 100% 1.125rem, 100% 100%, 0 100%);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-cage-header.card-header {
    border-bottom: 1px solid var(--bz-border);
    background: transparent;
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-cage-header h2 {
    font-weight: 800;
    letter-spacing: 0.065em;
}

/* The fight at the cage: a 4px state rail and, while something is
   happening, a wash of that state fading into the card. */
html[data-portal-theme="nxt"] .vs-bg .vs-tv-current {
    --vs-nxt-state: var(--bz-border-strong);
    background: var(--bz-surface-1);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current::before {
    background: var(--vs-nxt-state);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-active {
    --vs-nxt-state: var(--bz-live);
    background: linear-gradient(90deg, var(--portal-c-badge-live-bg), var(--bz-surface-1) 45%);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-soon {
    --vs-nxt-state: var(--bz-accent);
    background: linear-gradient(90deg, var(--portal-c-corner-pink-soft), var(--bz-surface-1) 45%);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-warning {
    --vs-nxt-state: var(--bz-brand-lilac);
    background: var(--bz-surface-3);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-load {
    --vs-nxt-state: var(--bz-brand-blue);
    background: linear-gradient(90deg, var(--portal-c-badge-info-bg), var(--bz-surface-1) 45%);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-position {
    color: var(--bz-text-dim);
    font-family: var(--portal-font-body);
    font-weight: var(--portal-weight-strong);
    letter-spacing: 0.065em;
    text-transform: uppercase;
}

html[data-portal-theme="nxt"] .vs-bg .status-active .vs-tv-position { color: var(--bz-live); }
html[data-portal-theme="nxt"] .vs-bg .status-soon .vs-tv-position { color: var(--bz-accent-strong); }
html[data-portal-theme="nxt"] .vs-bg .status-warning .vs-tv-position { color: var(--bz-brand-lilac); }
html[data-portal-theme="nxt"] .vs-bg .status-load .vs-tv-position { color: var(--nxt-focus-ink); }

/* The status chip speaks in the state's colour; on-air red gets the live
   triangle, the one piece of continuous motion NXT allows. */
/* An unmapped status (AVAILABLE, anything new from TrueFinals) reads in dim
   ink: the rail's keyline colour is 1.5:1 on the chip and was unreadable. */
html[data-portal-theme="nxt"] .vs-bg .vs-tv-current .vs-tv-status.portal-chip {
    background: var(--bz-surface-3);
    color: var(--bz-text-dim);
    font-family: var(--portal-font-body);
    font-weight: var(--portal-weight-strong);
    letter-spacing: 0.065em;
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-active .vs-tv-status.portal-chip,
html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-warning .vs-tv-status.portal-chip {
    color: var(--vs-nxt-state);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-soon .vs-tv-status.portal-chip {
    color: var(--bz-accent-strong);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-load .vs-tv-status.portal-chip {
    color: var(--nxt-focus-ink);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-active .vs-tv-status.portal-chip {
    background: var(--portal-c-badge-live-bg);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-active .vs-tv-status.portal-chip::before {
    display: inline-block;
    width: 0.55em;
    height: 0.55em;
    margin-right: 0.45em;
    background: currentColor;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    animation: vs-nxt-live 3.2s ease-in-out infinite;
    content: '';
}

@keyframes vs-nxt-live {
    50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
    html[data-portal-theme="nxt"] .vs-bg .vs-tv-current.status-active .vs-tv-status.portal-chip::before {
        animation: none;
    }
}

/* Robot names: DIN Heavy Italic in their corner colours — magenta left,
   cyan right — at the cage and in the queue. */
html[data-portal-theme="nxt"] .vs-bg .vs-tv-matchup > span:not(.vs-vs),
html[data-portal-theme="nxt"] .vs-bg .vs-tv-queue-bots > span:not(.vs-vs) {
    font-style: italic;
    font-weight: 800;
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-matchup > span:first-child,
html[data-portal-theme="nxt"] .vs-bg .vs-tv-queue-bots > span:first-child {
    color: var(--bz-accent-strong);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-matchup > span:last-child,
html[data-portal-theme="nxt"] .vs-bg .vs-tv-queue-bots > span:last-child {
    color: var(--bz-brand-teal);
}

html[data-portal-theme="nxt"] .vs-bg .vs-vs {
    font-family: var(--portal-font-mono);
    font-style: normal;
}

/* Queue rows sit on the card with a plain divider; state words keep NXT's
   colours. */
html[data-portal-theme="nxt"] .vs-bg .vs-tv-queue-row {
    border-bottom-color: var(--bz-border);
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-queue-position {
    color: var(--bz-text-dim);
    font-weight: var(--portal-weight-strong);
    letter-spacing: 0.065em;
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-queue-state.status-active { color: var(--bz-live); }
html[data-portal-theme="nxt"] .vs-bg .vs-tv-queue-state.status-soon { color: var(--bz-accent-strong); }
html[data-portal-theme="nxt"] .vs-bg .vs-tv-queue-state.status-warning { color: var(--bz-brand-lilac); }
html[data-portal-theme="nxt"] .vs-bg .vs-tv-queue-state.status-load { color: var(--nxt-focus-ink); }

/* Empty is dashed, loaded is solid (NXT keeps the distinction). */
html[data-portal-theme="nxt"] .vs-bg .vs-tv-current--empty {
    background: transparent;
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-current--empty::before {
    background: transparent;
    border-left: 4px dashed var(--bz-border-strong);
    width: 0;
}

html[data-portal-theme="nxt"] .vs-bg .vs-tv-empty-title {
    color: var(--bz-text-dim);
    font-weight: 800;
}
