/* ==========================================================================================
   VFPS UI STANDARD - "Boost" look in signature colours                         v1 2026-11-03
   ------------------------------------------------------------------------------------------
   Distilled from prp-boosting (ui/assets/index.css + tablet/css/*) and prp-racing's
   boosting/signature themes (tablet/css/theme-*.css). Every value here is taken from those
   two UIs; README.md explains each decision and where it came from.

   Use: copy this file + fonts/ into the resource's html folder, link it FIRST, then the app's
   own app.css. Put class "vui" on <html>. Everything is in rem (1 rem = 1/80 of the frame
   width) EXCEPT the device safe-area, which is px (see --vui-top-inset).
   ========================================================================================== */

/* Fonts. DEFAULT = Quantico everywhere (house font, ships with the app). Class "vui-font-classic"
   on <html> = the boosting/racing original pair: Exo 2 (Google, every weight; bundled regular cut
   as offline fallback) + Departure Mono (ships with the app, OFL). Pick per app - ask Oliver. */
@import url("https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,100..900;1,100..900&display=swap");

@font-face {
    font-family: "Quantico";
    src: url("./fonts/Quantico-Regular.ttf");
}

@font-face {
    font-family: "Quantico";
    src: url("./fonts/Quantico-Bold.ttf");
    font-weight: 700;
}

@font-face {
    font-family: "Exo 2 Local";
    src: url("./fonts/Exo2-Regular.ttf");
}

@font-face {
    font-family: "Departure Mono";
    src: url("./fonts/DepartureMono-Regular.otf");
}

/* ------------------------------------------------------------------------------- tokens */
:root.vui {
    /* frame: 80 rem = full width (boosting/racing tablet.css). Same density as a 1080p original. */
    font-size: calc(100vw / 80);

    /* device safe area - PX, never rem (the rem scales with the frame). sd-phone/sd-tablet draw
       their 54px status bar OVER the app; their own apps reserve 58px. Bottom-centre 150x21px =
       home-bar swipe zone: no buttons there. Scroll areas stop --vui-bottom-inset above the
       bottom edge (a margin: padding would only show at the very end of the scroll). */
    --vui-top-inset: 58px;
    --vui-bottom-inset: 20px;
    --vui-home-zone-w: 150px;
    --vui-home-zone-h: 21px;

    /* fonts: --vui-font = reading / titles / buttons, --vui-font-mono = labels, values, numbers,
       timers, page titles. Default both Quantico; .vui-font-classic below swaps in Exo 2 + Departure Mono. */
    --vui-font: "Quantico", sans-serif;
    --vui-font-mono: "Quantico", sans-serif;

    /* surfaces, darkest -> lightest (signature navy; boosting's teal set in brackets) */
    --vui-bg-top: #03070d;          /* (#010909) modal / form gradient top */
    --vui-bg-bottom: #050c16;       /* (#010e0e) modal / form gradient bottom, page top */
    --vui-bg-page: #020a14;         /* (#001214) page bottom */
    --vui-bg-menu: #070d16;         /* (#0b1010) dropdown list */
    --vui-panel: #081624;           /* (#02191b) panel / row base */
    --vui-panel-glow: #0f2d47;      /* (#022a25) panel radial edge */
    --vui-card-glow: #1d4f7a;       /* (#1a554e) card radial edge (used at 15-30%) */
    --vui-field: #15151580;         /* buttons / inputs / dropdown header fill (same in both) */

    /* lines */
    --vui-line: #c6e9ff1a;          /* (#ffffff1a) hairline: rows, dividers */
    --vui-line-strong: #c6e9ff40;   /* (#ffffff40) panel / modal border */
    --vui-line-field: #5a5a5a;      /* button / input / dropdown border (same in both) */

    /* text */
    --vui-text: #ffffff;
    --vui-text-soft: #ffffffbf;     /* descriptions */
    --vui-text-dim: #ffffff80;      /* secondary values, disabled */
    --vui-text-faint: #ffffff3d;    /* "dark" row text, empty slots */
    --vui-muted: #6f7f8f;           /* (#686565) inactive tabs, labels, icons */

    /* accent */
    --vui-accent: #84d4ff;          /* (#87da21) primary: active tab, buttons, progress, scrollbar */
    --vui-accent-10: #84d4ff1a;
    --vui-accent-20: #84d4ff33;
    --vui-accent-glow: #84d4ff40;
    --vui-accent-2: #4fb3ea;        /* (#56e6d5) secondary: info tags, icons, ELO */
    --vui-accent-2-light: #c9ecff;  /* (#a1f7ec) text on secondary tags */
    --vui-accent-grad: linear-gradient(90deg, #3d8fd6 0%, #84d4ff 100%);

    /* semantic - never recoloured by a theme */
    --vui-ok: #4ade80;
    --vui-warn: #ffb326;            /* cooldowns, rep tag */
    --vui-error: #ff6b6b;
    --vui-error-line: #d85151;
    --vui-gold: #ffc700;
    --vui-silver: #d9d9d9;
    --vui-bronze: #fe6712;

    /* composed backgrounds */
    --vui-page-bg: radial-gradient(70% 55% at 50% 0%, #84d4ff0d 0%, #84d4ff00 100%),
        linear-gradient(var(--vui-bg-bottom) 0%, var(--vui-bg-page) 100%);
    --vui-panel-bg: radial-gradient(119.66% 78.1% at 49.85% 50%, var(--vui-panel) 49%, var(--vui-panel-glow) 100%), var(--vui-panel);
    --vui-panel-sheen: linear-gradient(160deg, #84d4ff0f 0%, #84d4ff00 45%);
    --vui-card-bg: radial-gradient(96.01% 67.49% at 49.85% 50%, #08162480 49%, #1d4f7a26 100%), var(--vui-panel);
    --vui-modal-bg: linear-gradient(var(--vui-bg-top) 0%, var(--vui-bg-bottom) 99.16%);

    /* shape + motion */
    --vui-radius: .125rem;          /* the ONLY radius (tabs, cards). Panels / modals / inputs: 0 */
    --vui-corner: .5rem;            /* corner-triangle size */
    --vui-fast: .2s;                /* every hover / colour transition */
    --vui-slide: 2s cubic-bezier(.44, .26, .39, -.45); /* the cover slide (boosting unlock masks) */

    /* spacing scale (boosting :root) */
    --vui-xxs: .5rem;
    --vui-xs: .75rem;
    --vui-s: 1rem;
    --vui-m: 1.25rem;
    --vui-l: 1.5rem;
    --vui-xl: 2rem;
    --vui-xxl: 2.5rem;
    --vui-xxxl: 3rem;

    /* class colours (vfps_tools/signature-theme/class-colors.json) */
    --vui-class-D: #b4bcc6; --vui-class-D-glow: #8a939e;
    --vui-class-C: #4ade80; --vui-class-C-glow: #22c55e;
    --vui-class-B: #3b82f6; --vui-class-B-glow: #2563eb;
    --vui-class-A: #b26bff; --vui-class-A-glow: #9333ea;
    --vui-class-S: #fcc93a; --vui-class-S-glow: #f59e0b;
    --vui-class-X: #ff3b2f; --vui-class-X-glow: #b91c1c;
}

/* the boosting/racing original pair, opt-in per app: <html class="vui vui-font-classic"> */
:root.vui.vui-font-classic {
    --vui-font: "Exo 2", "Exo 2 Local", Oswald, sans-serif;
    --vui-font-mono: "Departure Mono", "GeistMono", monospace;
}

/* ------------------------------------------------------------------------------- base */
.vui *,
.vui *::before,
.vui *::after {
    box-sizing: border-box;
}

.vui,
.vui body,
.vui #app {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--vui-bg-page);
    color: var(--vui-text);
    font-family: var(--vui-font);
    -webkit-user-select: none;
    user-select: none;
}

.vui :is(p, h1, h2, h3, h4, h5) {
    margin: 0;
    font-weight: 400;
}

.vui ::-webkit-scrollbar { width: .25rem; height: .25rem; }
.vui ::-webkit-scrollbar-track { background: #101010; border-radius: .25rem; }
.vui ::-webkit-scrollbar-thumb { background: var(--vui-accent); border-radius: .5rem; }

/* ------------------------------------------------------------------------------- frame
   <div class="vui-app"> > .vui-topbar + .vui-screen   (the whole tablet, no outer box) */
.vui-app {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding-top: var(--vui-top-inset);
    background: var(--vui-page-bg);
    overflow: hidden;
}

.vui-screen {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-bottom: var(--vui-bottom-inset);
    padding: 1.5rem 3rem;
    overflow-y: auto;
}

/* page heading row: big mono title left, badges / buttons right */
.vui-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.vui-h1 { font-family: var(--vui-font-mono); font-size: 2rem; letter-spacing: -.024rem; }
.vui-h2 { font-family: var(--vui-font); font-size: 1.75rem; }                 /* card / item title */
.vui-h3 { font-family: var(--vui-font-mono); font-size: 1rem; text-transform: uppercase; }
.vui-hero { font-family: var(--vui-font); font-size: 3rem; }                  /* big item name */
.vui-mono { font-family: var(--vui-font-mono); }
.vui-dim { color: var(--vui-text-faint); }
.vui-muted { color: var(--vui-muted); }

/* ------------------------------------------------------------------------------- top bar
   tabs (icon + UPPERCASE text) left, player block right, one line, hairline sheen under it */
.vui-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-shrink: 0;
    margin: 0 2.5rem;
    padding: .75rem 0;
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(90deg, #84d4ff00, #84d4ff59 50%, #84d4ff00) 1;
}

.vui-tabs {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: .125rem;
    min-width: 0;
}

.vui-tab {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: .4rem;
    padding: .5rem .625rem;
    border: 1px solid transparent;
    border-radius: var(--vui-radius);
    color: var(--vui-muted);
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--vui-fast), background var(--vui-fast), border-color var(--vui-fast);
}

.vui-tab:hover { color: var(--vui-text); }

.vui-tab.active {
    border-color: var(--vui-accent);
    background: linear-gradient(180deg, #84d4ff26 0%, #84d4ff0d 100%);
    box-shadow: 0 0 .6rem #84d4ff26;
    color: var(--vui-accent);
}

.vui-tab.active svg { color: var(--vui-text); }

/* unread count on a tab */
.vui-tab-badge {
    min-width: 1.125rem;
    padding: 0 .25rem;
    background: var(--vui-accent);
    color: #020a14;
    font-family: var(--vui-font-mono);
    font-size: .6875rem;
    line-height: 1.125rem;
    text-align: center;
}

.vui-player {
    display: flex;
    align-items: center;
    gap: 1rem;
    white-space: nowrap;
}

.vui-player-name { font-size: 1.125rem; font-weight: 600; }

/* level / XP bar (boosting exp-progress) */
.vui-xp { display: flex; flex-direction: column; gap: .75rem; min-width: 12rem; font-family: var(--vui-font-mono); }
.vui-xp-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .75rem; }
.vui-progress { width: 100%; height: .375rem; background: #ffffff1a; }
.vui-progress > i { display: block; height: 100%; background: var(--vui-accent-grad); box-shadow: 0 0 4px var(--vui-accent-glow); }

/* ------------------------------------------------------------------------------- surfaces */
/* panel: section container (square, thin strong border, centre glow, signature sheen) */
.vui-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    border: 1px solid var(--vui-line-strong);
    background: var(--vui-panel-sheen), var(--vui-panel-bg);
}

/* card / row / tile: item inside a panel or list */
.vui-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--vui-line);
    background: var(--vui-card-bg);
    transition: border-color var(--vui-fast), box-shadow var(--vui-fast);
}

.vui-card.vui-col { flex-direction: column; align-items: stretch; }
.vui-card.clickable { cursor: pointer; }
.vui-card.clickable:hover { border-color: var(--vui-line-strong); }

/* selected / "you": accent edge + faint fill + glow */
.vui-card.active {
    border-color: var(--vui-accent);
    background: linear-gradient(var(--vui-accent-10), var(--vui-accent-10)), var(--vui-card-bg);
    box-shadow: 0 0 .5rem #84d4ff26;
}

/* flat row (list entries, players) */
.vui-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1rem;
    border: 1px solid var(--vui-line);
    background: var(--vui-panel);
}

/* podium / rank accents: left edge colour instead of a coloured block */
.vui-rank-1 { border-left: 3px solid var(--vui-gold); background: linear-gradient(90deg, #ffc7001a, transparent 60%), var(--vui-card-bg); }
.vui-rank-2 { border-left: 3px solid var(--vui-silver); background: linear-gradient(90deg, #ffffff14, transparent 60%), var(--vui-card-bg); }
.vui-rank-3 { border-left: 3px solid var(--vui-bronze); background: linear-gradient(90deg, #fe67121a, transparent 60%), var(--vui-card-bg); }

/* big banner (home call-outs: "3 new contracts", "rep limit reached") - big mono text */
.vui-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border: 1px solid var(--vui-line-strong);
    background: var(--vui-panel-bg);
}

.vui-banner > p { font-family: var(--vui-font-mono); font-size: 2rem; }

/* small bordered chip with icon (timers, counters) - boosting .active-badge */
.vui-chip {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    border: 1px solid var(--vui-line);
    font-family: var(--vui-font-mono);
}

.vui-chip svg { width: 1.5rem; height: 1.5rem; }

/* empty state / "nothing here" */
.vui-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border: 1px solid var(--vui-line);
    background: var(--vui-card-bg);
    color: #ffffff40;
    font-family: var(--vui-font-mono);
    text-align: center;
}

/* error box */
.vui-error {
    padding: .75rem 1rem;
    border: 1px solid #d851514d;
    background: #d851511a;
    color: var(--vui-error);
}

/* layout helpers */
.vui-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
.vui-grid-21 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 2rem; }
.vui-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.vui-stack { display: flex; flex-direction: column; gap: 1rem; }
.vui-line { display: flex; align-items: center; gap: 1rem; }
.vui-spacer { flex: 1; }

/* scroll lists fade out at the edges instead of a hard cut (boosting .contract-list / .contracts) */
.vui-list-y {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
    margin: -1rem -.5rem -1rem 0;
    padding: 1rem 1.5rem 1rem 1px;
    overflow-y: auto;
    -webkit-mask: linear-gradient(#0000 0%, #fff 1rem calc(100% - 1rem), #0000 100%);
}

.vui-list-x {
    display: flex;
    gap: 1.5rem;
    min-width: 0;
    margin: 0 -1rem;
    padding: 0 1rem 1rem;
    overflow-x: auto;
    -webkit-mask: linear-gradient(270deg, #0000 0%, #fff 1rem calc(100% - 1rem), #0000 100%);
}

/* ------------------------------------------------------------------------------- corner motif
   THE signature detail: two small glowing white triangles, top-left + bottom-right, on every
   control (buttons, inputs, dropdown heads get them automatically; add .vui-corners to anything
   else). On hover / focus they slide .25rem inwards and the text glows. */
:is(.vui-corners, .vui-btn, .vui-input, .vui-dropdown-head) {
    position: relative;
}

:is(.vui-corners, .vui-btn, .vui-input, .vui-dropdown-head)::before,
:is(.vui-corners, .vui-btn, .vui-input, .vui-dropdown-head)::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: var(--vui-corner);
    height: var(--vui-corner);
    background: #fff;
    clip-path: polygon(0% 0%, 100% 0%, 0% 100%);
    filter: drop-shadow(0 0 4px #ffffff80);
    pointer-events: none;
    transition: top var(--vui-fast), left var(--vui-fast), opacity var(--vui-fast);
}

:is(.vui-corners, .vui-btn, .vui-input, .vui-dropdown-head)::after {
    top: 100%;
    left: 100%;
    translate: -100% -100%;
    clip-path: polygon(100% 100%, 0% 100%, 100% 0%);
}

/* ------------------------------------------------------------------------------- controls */
.vui-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: fit-content;
    padding: .75rem 1rem;
    border: 1px solid var(--vui-line-field);
    background: var(--vui-field);
    color: var(--vui-text);
    font-family: var(--vui-font);
    font-size: .875rem;
    font-weight: 400;
    text-transform: uppercase;
    cursor: pointer;
    transition: border var(--vui-fast), background var(--vui-fast), text-shadow var(--vui-fast);
}

.vui-btn.full { width: 100%; }
.vui-btn.grow { flex: 1; }

.vui-btn:not(:disabled):hover {
    text-shadow: 0 0 4px #ffffff80;
    background: linear-gradient(#ffffff05 0% 100%), var(--vui-field);
}

.vui-btn:not(:disabled):hover::before { top: .25rem; left: .25rem; }
.vui-btn:not(:disabled):hover::after { top: calc(100% - .25rem); left: calc(100% - .25rem); }
.vui-btn:disabled { opacity: .5; cursor: default; }
.vui-btn:disabled::before,
.vui-btn:disabled::after { opacity: 0; }

/* primary: accent outline + 10% fill (boosting kct-button) */
.vui-btn.primary { border-color: var(--vui-accent); background: var(--vui-accent-10); }
.vui-btn.primary:not(:disabled):hover { background: var(--vui-accent-20); box-shadow: 0 0 .5rem #84d4ff26; }

/* danger */
.vui-btn.danger { border-color: var(--vui-error-line); background: #d851511a; }
.vui-btn.danger:not(:disabled):hover { background: #d8515133; }

/* input: same box as the button, text in --vui-font 1rem */
.vui-input {
    position: relative;
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    min-width: 13rem;
    padding: 0 .75rem;
    border: 1px solid var(--vui-line-field);
    background: var(--vui-field);
    transition: border var(--vui-fast), background var(--vui-fast);
}

.vui-input:focus-within { border-color: var(--vui-accent); }
.vui-input:focus-within::before { top: .25rem; left: .25rem; }
.vui-input:focus-within::after { top: calc(100% - .25rem); left: calc(100% - .25rem); }

.vui-input :is(input, textarea) {
    width: 100%;
    padding: .75rem 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--vui-text);
    font-family: var(--vui-font);
    font-size: 1rem;
}

.vui-input textarea { display: block; resize: none; }
.vui-input :is(input, textarea)::placeholder { color: var(--vui-text-dim); }
.vui-input svg { flex-shrink: 0; width: 1.25rem; height: 1.25rem; color: var(--vui-muted); }

/* dropdown: header like a button, list square below it */
.vui-dropdown { position: relative; width: 100%; }

.vui-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 12rem;
    padding: .75rem 1rem;
    border: 1px solid var(--vui-line-field);
    background: var(--vui-field);
    font-size: .875rem;
    text-transform: uppercase;
    cursor: pointer;
}

.vui-dropdown-head svg { height: 1rem; transition: transform .1s; }
.vui-dropdown.open .vui-dropdown-head svg { transform: rotate(180deg); }
.vui-dropdown.open .vui-dropdown-head::after { scale: 0; }

.vui-dropdown-list {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 20rem;
    padding: .625rem 1rem;
    border: 1px solid var(--vui-line-field);
    border-top: none;
    background: var(--vui-bg-menu);
    font-size: .875rem;
    text-transform: uppercase;
    overflow: auto;
}

.vui-dropdown-list > * { padding: .5rem 0; cursor: pointer; }
.vui-dropdown-list > *:not(:last-child) { border-bottom: 1px solid #ffffff1a; }
.vui-dropdown-list > *:hover { color: var(--vui-accent); }

/* toggle switch (boosting kct-checkbox) */
.vui-switch {
    position: relative;
    width: 3rem;
    height: 1.5rem;
    border: .05rem solid #ffffff26;
    border-radius: 3.75rem;
    background: #12121226;
    appearance: none;
    cursor: pointer;
    transition: border-color .1s;
}

.vui-switch::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: #9e9e9e;
    transition: left .2s ease-in-out, background-color .1s;
}

.vui-switch:checked { border-color: #84d4ff80; background: var(--vui-accent-10); }
.vui-switch:checked::before { left: calc(100% - 1.5rem); background: var(--vui-accent); }

/* segmented buttons (filters): plain buttons, the active one inverted white */
.vui-segment { display: flex; align-items: center; gap: 1rem; }
.vui-segment > .active { background: #fff; color: #151515; }

/* ------------------------------------------------------------------------------- data display */
/* field: small label over a big value */
.vui-field { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.vui-field-label { font-family: var(--vui-font-mono); font-size: .75rem; text-transform: uppercase; color: var(--vui-text); }
.vui-field.dark .vui-field-label { color: var(--vui-text-dim); }
.vui-field-value { font-size: 1.5rem; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* key / value line in mono uppercase (card headers: "BOOSTING ... NERO2_S") */
.vui-kv {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-family: var(--vui-font-mono);
    text-transform: uppercase;
}

/* tag: tinted box with ONE coloured corner triangle; colour as "r, g, b" in --c */
.vui-tag {
    --c: 132, 212, 255;
    position: relative;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .75rem;
    background: rgba(var(--c), .05);
    font-size: .75rem;
}

.vui-tag::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: var(--vui-corner);
    height: var(--vui-corner);
    background: rgb(var(--c));
    clip-path: polygon(0% 0%, 100% 0%, 0% 100%);
    filter: drop-shadow(0 0 4px rgba(var(--c), .5));
}

.vui-tag svg { width: 1.5rem; height: 1.5rem; color: rgb(var(--c)); }
.vui-tag.money { --c: 161, 238, 255; }
.vui-tag.rep { --c: 255, 179, 38; }
.vui-tag.ok { --c: 74, 222, 128; }
.vui-tag.bad { --c: 255, 107, 107; }

/* small value pill (ELO, crew, level) */
.vui-pill {
    padding: .25rem .625rem;
    border: 1px solid var(--vui-accent-2);
    background: #4fb3ea1a;
    color: var(--vui-accent-2-light);
    font-family: var(--vui-font-mono);
    font-size: .875rem;
}

/* class badge: rotated square with bracket corners, letter upright (boosting class badge) */
.vui-badge {
    --b: var(--vui-accent);
    --bg: #84d4ff1a;
    --g: var(--vui-accent);
    position: relative;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    margin: .5rem;
    background: var(--bg);
    rotate: 45deg;
}

/* bracket corners: boosting's .accent-border, verbatim (--a = bracket length, --w = line width) */
.vui-badge::before {
    --a: .75rem;
    --w: 2px;
    content: "";
    position: absolute;
    top: calc(-1 * var(--w) / 2);
    left: calc(-1 * var(--w) / 2);
    width: calc(100% - var(--w));
    height: calc(100% - var(--w));
    border: var(--w) solid var(--b);
    filter: drop-shadow(0 0 4px var(--g));
    clip-path: polygon(0% 0%, var(--a) 0%, var(--a) var(--a), calc(100% - var(--a)) var(--a), 100% var(--a), 100% 0%,
        calc(100% - var(--a)) 0%, calc(100% - var(--a)) calc(100% - var(--a)), var(--a) calc(100% - var(--a)), var(--a) 101%,
        0% 100%, 0% calc(100% - var(--a)), var(--a) calc(100% - var(--a)), 100% calc(100% - var(--a)), 100% 100%,
        calc(100% - var(--a)) 100%, calc(100% - var(--a)) calc(100% - var(--a)), calc(100% - var(--a)) var(--a), 50% var(--a), 0% var(--a));
}

.vui-badge > span {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 3rem;
    line-height: 1;
    text-shadow: 0 0 .25rem var(--g);
    transform: translate(-50%, -50%) rotate(-45deg) translateY(-.125rem);
}

.vui-class-D { --b: var(--vui-class-D); --g: var(--vui-class-D-glow); --bg: #b4bcc61a; }
.vui-class-C { --b: var(--vui-class-C); --g: var(--vui-class-C-glow); --bg: #4ade801a; }
.vui-class-B { --b: var(--vui-class-B); --g: var(--vui-class-B-glow); --bg: #3b82f61a; }
.vui-class-A { --b: var(--vui-class-A); --g: var(--vui-class-A-glow); --bg: #b26bff1a; }
.vui-class-S { --b: var(--vui-class-S); --g: var(--vui-class-S-glow); --bg: #fcc93a1a; }
.vui-class-X { --b: var(--vui-class-X); --g: var(--vui-class-X-glow); --bg: #ff3b2f1a; }

/* coloured top accent line on a card (racing: race class as a 2px top edge, not a tinted card) */
.vui-card[class*="vui-class-"] { border-top: 2px solid var(--b); }

/* ------------------------------------------------------------------------------- feedback */
/* spinner: thick accent arc */
.vui-loader {
    flex-shrink: 0;
    width: 5rem;
    height: 5rem;
    margin: auto;
    border: .5rem solid var(--vui-accent);
    border-bottom-color: transparent;
    border-left: none;
    border-radius: 50%;
    animation: vui-spin .75s linear infinite;
}

@keyframes vui-spin { to { rotate: 720deg; } }

/* skeleton shimmer for text / rows still loading */
.vui-skeleton {
    position: relative;
    isolation: isolate;
    min-height: 1rem;
    overflow: hidden;
}

.vui-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: #ffffff03;
}

.vui-skeleton::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, #0000 8%, #84d4ff14 18%, #0000 33%);
    animation: vui-shimmer 1s linear -.25s infinite;
}

@keyframes vui-shimmer { from { translate: -75% 0; } to { translate: 75% 0; } }

/* modal: dim layer over the whole app, square gradient box, centred text */
.vui-modal-layer {
    position: absolute;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #00000080;
}

.vui-modal {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 35rem;
    padding: 3rem 2rem;
    border: 1px solid var(--vui-line-strong);
    background: var(--vui-modal-bg);
    font-size: 1.125rem;
    text-align: center;
}

.vui-modal-title { font-family: var(--vui-font-mono); font-size: 1.5rem; }
.vui-modal-buttons { display: flex; gap: .75rem; width: 100%; }
.vui-modal-buttons > .vui-btn { flex: 1; }

/* toast: short result message above the home bar. Lives OUTSIDE the re-rendered root (see ui.js
   showToast), so a re-render can't cut it; toggled with .visible. */
.vui-toast {
    position: fixed;
    bottom: calc(var(--vui-bottom-inset) + 1rem);
    left: 50%;
    z-index: 1000;
    max-width: 50rem;
    padding: .75rem 1.25rem;
    border: 1px solid var(--vui-accent);
    background: var(--vui-modal-bg);
    font-family: var(--vui-font-mono);
    font-size: 1rem;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, .6rem);
    transition: opacity var(--vui-fast), transform var(--vui-fast);
}

.vui-toast.visible { opacity: 1; transform: translate(-50%, 0); }
.vui-toast.bad { border-color: var(--vui-error-line); color: var(--vui-error); }

/* step connector between stacked items (boosting contract missions) */
.vui-step-line { width: 1px; height: 2rem; margin: 0 auto; background: #344143; }

/* ------------------------------------------------------------------------------- motion helpers
   Animate transform / opacity only. A page that re-renders with innerHTML must offset running
   animations with a negative delay (--vui-t: -<elapsed>ms) so a re-render resumes them. */
.vui-fade-in { animation: vui-fade-in .3s ease-out var(--vui-t, 0ms) both; }
@keyframes vui-fade-in { from { opacity: 0; translate: 0 .6rem; } to { opacity: 1; translate: 0 0; } }

.vui-pulse { animation: vui-pulse 1.4s ease-in-out infinite; }
@keyframes vui-pulse { 50% { scale: 1.12; } }

/* ==========================================================================================
   PHONE LAYER - sd-phone (portrait + fold-out) apps                    added 2026-11-11 (vision_groups)
   ------------------------------------------------------------------------------------------
   The kit above is tablet-first (80rem landscape, tab top bar + player block). An sd-phone app is a
   tall portrait screen (440x956) that folds open to a wider one (~880x956). Put class "vui-phone" on
   <html> (with "vui"). We do NOT set a root font-size here: sd-phone renders custom apps with
   fixBlur, which forces html { font-size: calc((1vh + 1vw) * 1.214) } - a width+height responsive
   rem that rescales across the fold - so we size in rem and cap a centred column. Helpers in
   template js/ui.js: tabbar(), appbar(), lockIcon(), input({hint}). These came from vision_groups.
   ========================================================================================== */

/* content column: fills the folded phone, centres on the wider fold-out instead of stretching */
.vui-phone .vui-screen { gap: 1.5rem; width: 100%; max-width: 34rem; margin: 0 auto var(--vui-bottom-inset); padding: 1rem 1.25rem; }

/* phone tab bar: drop the landscape player block, centre the small page-switch tabs */
.vui-phone .vui-topbar { margin: 0 1rem; gap: 1rem; justify-content: center; }
.vui-phone .vui-tabs { flex: 0 1 auto; justify-content: center; flex-wrap: wrap; gap: .5rem; min-width: 0; }

/* phone app bar (for sub-pages): optional back icon, mono title, optional right action */
.vui-appbar {
    display: flex; align-items: center; gap: 1rem; flex-shrink: 0; margin: 0 1.25rem; padding: .75rem 0;
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(90deg, #84d4ff00, #84d4ff59 50%, #84d4ff00) 1;
}
.vui-appbar-title { flex: 1; min-width: 0; font-family: var(--vui-font-mono); font-size: 1.5rem; letter-spacing: -.024rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* square icon button (back arrow, row action like kick/revoke); corner triangles via .vui-corners */
.vui-iconbtn {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 2.5rem; height: 2.5rem; padding: 0;
    border: 1px solid var(--vui-line-field); background: var(--vui-field); color: var(--vui-text);
    font-family: var(--vui-font-mono); font-size: 1.25rem; cursor: pointer;
    transition: border var(--vui-fast), background var(--vui-fast), text-shadow var(--vui-fast);
}
.vui-iconbtn:hover { text-shadow: 0 0 4px #ffffff80; border-color: var(--vui-accent); }

/* narrow-screen fixes: single-column grids, a modal that fits, controls that can shrink */
.vui-phone :is(.vui-grid-2, .vui-grid-21, .vui-grid-3) { grid-template-columns: 1fr; gap: 1rem; }
.vui-phone .vui-modal { width: min(100%, 26rem); padding: 2rem 1.5rem; }
.vui-phone :is(.vui-input, .vui-dropdown-head) { min-width: 0; }
.vui-phone .vui-card.phone-stack { flex-direction: column; align-items: stretch; gap: 1rem; }

/* optional-field hint: a small muted tag inside an input on the right, e.g. "OPTIONAL" */
.vui-input-suffix input { width: auto; flex: 1; min-width: 0; }
.vui-input-hint { flex-shrink: 0; color: var(--vui-muted); font-family: var(--vui-font-mono); font-size: .6875rem; letter-spacing: .04em; text-transform: uppercase; }

/* layout-neutral wrapper around a password field: silences Chromium's "password not in a form" /
   "needs autocomplete" / "needs a username field" warnings without affecting layout (see ui.js input). */
.vui-pwform { display: contents; }

/* fold-out: the screen roughly doubles in width - let the column grow and use .vui-grid-fold for 2 cols */
@media (min-width: 620px) {
    .vui-phone .vui-screen { max-width: 52rem; }
    .vui-phone .vui-grid-fold { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
}
