/* VeloTime info screens (docs/info-screens-plan.md): the /display/{slug} documents and the frame inside the admin
   preview. Needs velotime-tokens.css; the activity panel also uses the stat tile styles from WebUI's velotime.css.
   .vt-display is a size container; everything inside sizes in container units, so a frame scales with the screen
   or a scaled preview box. Every container-unit declaration is preceded by the same value in viewport units: on the
   screen document the frame is the viewport, so kiosk browsers without container queries (also the no-JavaScript
   /display/{slug}/basic screen) still scale; newer browsers take the later container-unit value. Rows that do not fit are cut, never scrolled. Colours come from the display's own theme
   class, not the viewer's colour scheme, so the preview matches the screen. */
.vt-display-theme-light {
    --vt-display-bg: #F6F7FB; --vt-display-surface: #FFFFFF; --vt-display-text: #111827; --vt-display-muted: #5B6475;
    --vt-display-line: #E3E6EF; --vt-display-zebra: #F8F9FC; --vt-display-head: #111827; --vt-display-head-text: #FFFFFF;
    --vt-display-accent: var(--vt-track-blue); --vt-display-new: rgba(229, 50, 45, 0.14);
}
.vt-display-theme-dark {
    --vt-display-bg: #0B1020; --vt-display-surface: #141A2E; --vt-display-text: #E6E9F2; --vt-display-muted: #9AA3B8;
    --vt-display-line: #252D45; --vt-display-zebra: #182038; --vt-display-head: #050814; --vt-display-head-text: #FFFFFF;
    --vt-display-accent: #6C8CFF; --vt-display-new: rgba(255, 106, 92, 0.22);
}
.vt-display-theme-light, .vt-display-theme-dark {
    --vt-surface: var(--vt-display-surface); --vt-line: var(--vt-display-line);
    --vt-text: var(--vt-display-text); --vt-text-muted: var(--vt-display-muted); --vt-tone-neutral: var(--vt-display-muted);
}
html.vt-display-document, html.vt-display-document > body { margin: 0; height: 100%; overflow: hidden; background: var(--vt-display-bg); color: var(--vt-display-text); }
.vt-display-screen-body { font-family: var(--vt-font-body); }
.vt-display-screen { width: 100vw; height: 100vh; height: 100dvh; }

.vt-display {
    container-type: size; position: relative; box-sizing: border-box; width: 100%; height: 100%; overflow: hidden;
    display: flex; flex-direction: column; background: var(--vt-display-bg); color: var(--vt-display-text);
    font-family: var(--vt-font-body); line-height: 1.25;
    --vt-display-row-font: 2.7vmin; --vt-display-row-height: 4.8vmin;
}
.vt-display *, .vt-display *::before, .vt-display *::after { box-sizing: border-box; }
.vt-display-layout-threecolumns, .vt-display-layout-grid2x2 { --vt-display-row-font: 2.2vmin; --vt-display-row-height: 4vmin; }
/* A declaration using var() is only checked when computed, so it cannot fall back to an earlier one: custom properties
   and such declarations take their container-unit values under @supports (or split the var() into another longhand). */
@supports (width: 1cqmin) {
    .vt-display { --vt-display-row-font: 2.7cqmin; --vt-display-row-height: 4.8cqmin; }
    .vt-display-layout-threecolumns, .vt-display-layout-grid2x2 { --vt-display-row-font: 2.2cqmin; --vt-display-row-height: 4cqmin; }
}

.vt-display-header {
    flex: none; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
    gap: 2vmin; gap: 2cqmin; height: 11vmin; height: 11cqmin; padding: 0 2.5vmin 0.5vmin; padding: 0 2.5cqmin 0.5cqmin; background: var(--vt-display-head); color: var(--vt-display-head-text);
}
.vt-display-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 0.5vmin; height: 0.5cqmin; background: var(--vt-stripe); }
.vt-display-header-side { display: flex; align-items: center; gap: 2vmin; gap: 2cqmin; height: 100%; min-width: 0; }
.vt-display-header-left { justify-content: flex-start; }
.vt-display-header-right { justify-content: flex-end; }
.vt-display-header-centre { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; max-width: 60vw; max-width: 60cqw; text-align: center; }
.vt-display-logo { display: block; flex: none; height: 7.5vmin; height: 7.5cqmin; width: auto; max-width: 22vw; max-width: 22cqw; object-fit: contain; }
.vt-display-title-image { display: block; height: 8.5vmin; height: 8.5cqmin; width: auto; max-width: 56vw; max-width: 56cqw; object-fit: contain; }
.vt-display-title { margin: 0; max-width: 100%; font-family: var(--vt-font-display); font-weight: 700; font-size: 5.6vmin; font-size: 5.6cqmin; line-height: 1.05; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt-display-subtitle { max-width: 100%; font-size: 2.3vmin; font-size: 2.3cqmin; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt-display-clock { font-family: var(--vt-font-display); font-weight: 700; font-size: 5vmin; font-size: 5cqmin; font-variant-numeric: tabular-nums; }

.vt-display-body { flex: 1 1 auto; min-height: 0; display: grid; gap: 1.6vmin; gap: 1.6cqmin; padding: 1.6vmin; padding: 1.6cqmin; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.vt-display-layout-twocolumns .vt-display-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vt-display-layout-threecolumns .vt-display-body { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vt-display-layout-grid2x2 .vt-display-body { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
/* Portrait screens stack column layouts top to bottom; the 2x2 grid stays a grid. */
@container (aspect-ratio < 1) {
    .vt-display-layout-twocolumns .vt-display-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
    .vt-display-layout-threecolumns .vt-display-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr)); }
}
/* The same for browsers without container queries: the screen document's frame is the viewport (aspect ratio below 1,
   as above; a square screen keeps its columns). Scoped to the screen, so the admin preview follows its box. */
@media (max-aspect-ratio: 999/1000) {
    .vt-display-screen .vt-display-layout-twocolumns .vt-display-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
    .vt-display-screen .vt-display-layout-threecolumns .vt-display-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr)); }
}
.vt-display-message { grid-column: 1 / -1; margin: auto; font-size: 3vmin; font-size: 3cqmin; color: var(--vt-display-muted); }

.vt-display-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--vt-display-surface); border: 1px solid var(--vt-display-line); border-radius: 1.2vmin; border-radius: 1.2cqmin; }
.vt-display-panel-empty { background: transparent; border-color: transparent; }
.vt-display-panel-head { flex: none; display: flex; align-items: baseline; justify-content: space-between; gap: 2vmin; gap: 2cqmin; padding: 1.3vmin 1.8vmin 1vmin; padding: 1.3cqmin 1.8cqmin 1cqmin; border-bottom: solid var(--vt-display-accent); border-bottom-width: 0.35vmin; border-bottom-width: 0.35cqmin; }
.vt-display-panel-title { margin: 0; min-width: 0; font-family: var(--vt-font-display); font-weight: 700; font-size: 3.4vmin; font-size: 3.4cqmin; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt-display-panel-period { flex: none; font-size: 1.9vmin; font-size: 1.9cqmin; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--vt-display-muted); }
.vt-display-panel-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.vt-display-panel-status { margin: auto; padding: 2vmin; padding: 2cqmin; font-size: 2.2vmin; font-size: 2.2cqmin; color: var(--vt-display-muted); text-align: center; }

/* Result rows: flex rows with fixed-width value cells so columns line up; rows wrap into a hidden second column
   when they do not fit, which cuts whole rows instead of showing half a row. */
.vt-display-table { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; font-size: var(--vt-display-row-font); }
.vt-display-rows { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; flex-wrap: wrap; align-content: flex-start; overflow: hidden; }
.vt-display-row { flex: none; width: 100%; overflow: hidden; display: flex; align-items: center; gap: 1.2vmin; gap: 1.2cqmin; height: var(--vt-display-row-height); padding: 0 1.8vmin; padding: 0 1.8cqmin; border-bottom: 1px solid var(--vt-display-line); }
.vt-display-rows > .vt-display-row:nth-child(even) { background: var(--vt-display-zebra); }
.vt-display-row-head { height: calc(var(--vt-display-row-height) * 0.72); font-size: 0.68em; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--vt-display-muted); }
.vt-display-rows > .vt-display-row.vt-display-row-new { background: var(--vt-display-new); box-shadow: inset 0.6vmin 0 0 var(--vt-sprint-red); }
@supports (width: 1cqmin) { .vt-display-rows > .vt-display-row.vt-display-row-new { box-shadow: inset 0.6cqmin 0 0 var(--vt-sprint-red); } }
.vt-display-cell { flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; font-variant-numeric: tabular-nums; }
.vt-display-cell-name { flex: 1 1 auto; min-width: 4em; text-align: left; font-weight: 600; }
.vt-display-cell-rank { width: 2.2em; text-align: center; font-weight: 700; border-radius: 999px; }
.vt-display-rows .vt-display-podium-1 .vt-display-cell-rank { background: var(--vt-gold); color: #111827; }
.vt-display-rows .vt-display-podium-2 .vt-display-cell-rank { background: var(--vt-silver); color: #111827; }
.vt-display-rows .vt-display-podium-3 .vt-display-cell-rank { background: var(--vt-bronze); color: #111827; }
.vt-display-cell-time { width: 5.4em; font-family: var(--vt-font-display); font-weight: 700; font-size: 1.1em; }
.vt-display-cell-speed { width: 3.6em; }
.vt-display-cell-split { width: 8.5em; color: var(--vt-display-muted); }
.vt-display-cell-clocktime { width: 4.6em; color: var(--vt-display-muted); }
.vt-display-cell-laps { width: 3.4em; }
.vt-display-cell-distance { width: 3.8em; }
.vt-display-cell-measure { font-family: var(--vt-font-display); font-weight: 700; font-size: 1.1em; }
.vt-display-row-head .vt-display-cell-time, .vt-display-row-head .vt-display-cell-measure { font-family: inherit; font-size: inherit; }
.vt-display-columns { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.vt-display-columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vt-display-columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Narrow lap columns (three of them show only the ranking measure) use a slightly smaller type. */
.vt-display-columns-2 > .vt-display-table, .vt-display-columns-3 > .vt-display-table { font-size: calc(var(--vt-display-row-font) * 0.88); }
.vt-display-columns > .vt-display-table + .vt-display-table { border-left: 1px solid var(--vt-display-line); }

/* Activity: the shared stat tiles, scaled to the frame. */
.vt-display-tiles { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 1.6vmin; gap: 1.6cqmin; padding: 1.6vmin; padding: 1.6cqmin; }
.vt-display-tile.vt-stat-tile { display: flex; flex-direction: column; justify-content: center; min-height: 0; padding: 1.6vmin 2.4vmin; padding: 1.6cqmin 2.4cqmin; border-radius: 1vmin; border-radius: 1cqmin; }
.vt-display-tile.vt-stat-tile::before { width: 0.6vmin; width: 0.6cqmin; }
.vt-display-tile .vt-overline { font-size: 1.9vmin; font-size: 1.9cqmin; }
.vt-display-tile .vt-stat-value { margin-top: 0.6vmin; margin-top: 0.6cqmin; font-size: 8vmin; font-size: 8cqmin; }
.vt-display-tile .vt-stat-unit { margin-left: 0.6vmin; margin-left: 0.6cqmin; font-size: 3vmin; font-size: 3cqmin; }
.vt-display-layout-threecolumns .vt-display-tile .vt-stat-value, .vt-display-layout-grid2x2 .vt-display-tile .vt-stat-value { font-size: 5.5vmin; font-size: 5.5cqmin; }

.vt-display-text { flex: 1 1 auto; min-height: 0; overflow: hidden; padding: 2.4vmin; padding: 2.4cqmin; font-size: 4vmin; font-size: 4cqmin; line-height: 1.3; overflow-wrap: anywhere; }
.vt-display-layout-threecolumns .vt-display-text, .vt-display-layout-grid2x2 .vt-display-text { font-size: 3vmin; font-size: 3cqmin; }
.vt-display-image { flex: 1 1 auto; display: block; width: 100%; height: 100%; min-height: 0; }
.vt-display-image-fit { object-fit: contain; }
.vt-display-image-fill { object-fit: cover; }

.vt-display-footer { flex: none; display: flex; align-items: center; gap: 2.4vmin; gap: 2.4cqmin; height: 6vmin; height: 6cqmin; padding: 0 2.5vmin; padding: 0 2.5cqmin; border-top: 1px solid var(--vt-display-line); background: var(--vt-display-surface); font-size: 2vmin; font-size: 2cqmin; color: var(--vt-display-muted); }
.vt-display-footer-text { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--vt-display-text); }
.vt-display-sponsors { flex: 0 1 auto; min-width: 0; overflow: hidden; display: flex; align-items: center; gap: 2.4vmin; gap: 2.4cqmin; height: 100%; }
.vt-display-sponsor { display: block; flex: none; height: 4.2vmin; height: 4.2cqmin; width: auto; max-width: 14vw; max-width: 14cqw; object-fit: contain; }
.vt-display-footer-status { flex: none; display: flex; align-items: center; gap: 2.4vmin; gap: 2.4cqmin; white-space: nowrap; }
.vt-display-updated time { font-variant-numeric: tabular-nums; }
.vt-display-mark { position: relative; padding-bottom: 0.25em; font-family: var(--vt-font-display); font-weight: 700; font-size: 1.25em; letter-spacing: -0.01em; color: var(--vt-display-text); }
.vt-display-mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 0.14em; background: var(--vt-stripe); }
.vt-display-offline { padding: 0.2em 0.8em; border-radius: 999px; font-weight: 700; color: #FFFFFF; background: var(--vt-sprint-red); }
.vt-display-offline[hidden] { display: none; }
.vt-display-offline-floating { position: absolute; right: 2vmin; right: 2cqmin; bottom: 2vmin; bottom: 2cqmin; font-size: 2vmin; font-size: 2cqmin; }

/* Not found and outage pages for a screen URL. */
.vt-display-notice { box-sizing: border-box; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 2rem; text-align: center; }
.vt-display-notice .vt-display-mark { font-size: 2rem; }
.vt-display-notice-title { margin: 0; font-family: var(--vt-font-display); font-weight: 700; font-size: clamp(2rem, 5vw, 4rem); }
.vt-display-notice-text { margin: 0; max-width: 40ch; font-size: clamp(1rem, 2vw, 1.5rem); color: var(--vt-display-muted); }
