/* TripGeo Space site theme: holo cyan on near-black (SPEC-08 §1 palette). Site pages only: the game
   itself renders inside the Godot iframe. Dark by design; there is no light theme. */
:root {
    --bg: #06121A;
    --bg-2: #081821;
    --panel: #0C1E29;
    --panel-hi: #102735;
    --line: #173341;
    --line-2: #26495A;
    --text: #E8F6FF;
    --muted: #8FAAB8;
    --faint: #6E8C9B;
    --accent: #5FE3FF;
    --accent-2: #B8F4FF;
    --accent-ink: #03202B;
    --accent-wash: rgba(95, 227, 255, 0.10);
    --warn: #FFB547;
    --danger: #FF5C5C;
    --ok: #7CFF8A;
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --mono: "Cascadia Mono", ui-monospace, Consolas, monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; }
/* The hidden attribute always wins over a component's own display rule (bench.js and game-frame.js toggle it). */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    min-height: 100%;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
}

body {
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(95, 227, 255, 0.09), transparent 70%),
        radial-gradient(ellipse 60% 40% at 50% 115%, rgba(255, 120, 60, 0.05), transparent 70%);
    background-attachment: fixed;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }
code, pre, kbd { font-family: var(--mono); font-size: 0.92em; }
h1, h2, h3 { font-weight: 600; letter-spacing: 0.06em; line-height: 1.2; }
h1 { font-size: 1.9rem; margin: 0 0 0.6rem; text-transform: uppercase; }
h1:focus { outline: none; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; text-transform: uppercase; color: var(--accent-2); }
h3 { font-size: 0.95rem; margin: 0 0 0.5rem; color: var(--muted); text-transform: uppercase; }
p { margin: 0 0 0.8rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.85rem; }
.error, .text-danger { color: var(--danger); }
.status { color: var(--warn); }
.ok { color: var(--ok); }
.mono { font-family: var(--mono); }
.nums { font-variant-numeric: tabular-nums; }

/* ── Chrome ─────────────────────────────────────────────────────────────────────────────── */
.site-header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: 0.7rem 1.25rem; border-bottom: 1px solid var(--line); background: rgba(8, 24, 33, 0.85);
}
.brand {
    color: var(--accent); text-decoration: none; font-weight: 600; letter-spacing: 0.32em;
    font-size: 1.15rem; white-space: nowrap; text-transform: uppercase; text-shadow: 0 0 12px rgba(95, 227, 255, 0.35);
}
.site-header nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-header nav a {
    color: var(--muted); text-decoration: none; font-size: 0.82rem; font-weight: 600;
    letter-spacing: 0.12em; text-transform: uppercase;
}
.site-header nav a:hover { color: var(--accent); }
/* Sign-in (SignInControl): Google's dark button style, then the TripGeo avatar and a sign-out icon. */
.signin-btn {
    display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.42rem 0.9rem 0.42rem 0.75rem;
    background: #131314; color: #E3E3E3; border: 1px solid #8E918F; border-radius: 4px;
    font-size: 0.85rem; font-weight: 600; text-decoration: none; white-space: nowrap;
    transition: border-color 120ms ease-out, background 120ms ease-out;
}
.signin-btn:hover { background: #1E1F20; border-color: var(--accent); color: #FFFFFF; }
.signin-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.signin-g { width: 18px; height: 18px; flex: none; }
.who { display: flex; align-items: center; gap: 0.5rem; }
.who-avatar {
    position: relative; width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center;
    background: var(--panel-hi); border: 1px solid var(--line-2);
    color: var(--accent); font-weight: 600; font-size: 1rem; overflow: hidden;
}
.who-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }   /* over the initial; removed if it fails */
.who-out { margin: 0; display: flex; }
.who-signout {
    display: grid; place-items: center; width: 36px; height: 36px; padding: 0; cursor: pointer;
    background: none; border: 1px solid transparent; border-radius: 4px; color: var(--muted);
    transition: color 120ms ease-out, border-color 120ms ease-out;
}
.who-signout svg { width: 24px; height: 24px; }
.who-signout:hover { color: var(--accent); border-color: var(--line-2); }
.who-signout:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-main { max-width: 1160px; margin: 0 auto; padding: 1.75rem 1rem 3rem; }
.site-footer {
    text-align: center; color: var(--faint); font-size: 0.78rem; letter-spacing: 0.08em;
    padding: 1.5rem 1rem; border-top: 1px solid var(--line);
}

/* ── Controls ───────────────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.5rem 1.05rem; border: 1px solid var(--line-2); border-radius: 2px;
    background: var(--panel); color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 600;
    letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; cursor: pointer;
    transition: border-color 120ms ease-out, box-shadow 120ms ease-out, background 120ms ease-out;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px rgba(95, 227, 255, 0.25), 0 0 14px rgba(95, 227, 255, 0.15); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); color: var(--accent-ink); }
.btn-warn { border-color: rgba(255, 181, 71, 0.6); color: var(--warn); }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 0.95rem; }
.btn-sm { padding: 0.25rem 0.7rem; font-size: 0.75rem; }
.btn-icon { padding: 0.45rem 0.6rem; }

input, select, textarea {
    font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line-2);
    border-radius: 2px; padding: 0.42rem 0.6rem; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { accent-color: var(--accent); width: 1rem; height: 1rem; }

/* Panels: 1 px hairline with cyan corner brackets (SPEC-08 "angled corner brackets"). */
.panel, .card {
    position: relative; background: rgba(12, 30, 41, 0.92); border: 1px solid var(--line);
    padding: 1.1rem 1.25rem;
}
.panel::before, .panel::after, .card::before, .card::after {
    content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none;
    border: 0 solid var(--accent); opacity: 0.75;
}
.panel::before, .card::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.panel::after, .card::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.card p { color: var(--muted); margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }

.form { display: flex; flex-direction: column; gap: 0.8rem; }
.form label, .name-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.form label.check { flex-direction: row; align-items: center; gap: 0.5rem; text-transform: none; letter-spacing: 0; font-size: 0.9rem; }
.form-row { display: flex; gap: 0.6rem; align-items: end; flex-wrap: wrap; }
.form-row > label { flex: 1 1 8rem; }
.seed-field { display: flex; gap: 0.35rem; max-width: 18rem; }
.seed-field input { flex: 1; min-width: 6rem; font-family: var(--mono); }
.name-form { display: flex; gap: 0.5rem; align-items: end; flex-wrap: wrap; margin: 0.25rem 0 1.25rem; }

/* Segmented choice (S/M/L, difficulty): radio inputs styled as buttons. */
.seg { position: relative; display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-2); width: fit-content; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { margin: 0; padding: 0.38rem 0.75rem; cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--muted); letter-spacing: 0.06em; text-transform: none; border-left: 1px solid var(--line-2); }
.seg label:first-of-type { border-left: 0; }
.seg input:checked + label { background: var(--accent-wash); color: var(--accent); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── Home ───────────────────────────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 3.5rem 0 2.25rem; }
.hero-title {
    margin: 0; font-size: clamp(2.6rem, 10vw, 5.6rem); font-weight: 300; letter-spacing: 0.32em;
    padding-left: 0.32em; /* optically centre the tracked word */
    color: var(--accent); line-height: 1; text-transform: uppercase;
    text-shadow: 0 0 24px rgba(95, 227, 255, 0.35), 0 0 2px rgba(184, 244, 255, 0.6);
}
.hero-rule { width: min(28rem, 70%); height: 1px; margin: 1.1rem auto 0.9rem; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0.6; }
.hero-tag { font-family: var(--mono); font-size: 0.8rem; color: var(--faint); letter-spacing: 0.2em; text-transform: uppercase; }
.hero-sub { max-width: 40rem; margin: 1.1rem auto 1.75rem; color: var(--muted); font-size: 1.1rem; }
.hero-cta { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.hero-compact { padding: 2.25rem 0 1.25rem; }
.hero-compact .hero-title { font-size: clamp(2rem, 7vw, 4.4rem); letter-spacing: 0.24em; padding-left: 0.24em; }
.hero-compact .hero-sub { margin-bottom: 0.5rem; }

/* Project cards: a screenshot, the name (its link covers the whole card) and a line or two. */
.proj-group { margin-top: 2rem; }
.proj-head { display: flex; align-items: center; gap: 0.9rem; font-size: 0.85rem; letter-spacing: 0.18em; color: var(--faint); }
.proj-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.proj {
    position: relative; display: flex; flex-direction: column; background: rgba(12, 30, 41, 0.92);
    border: 1px solid var(--line); transition: border-color 120ms ease-out, box-shadow 120ms ease-out, transform 120ms ease-out;
}
.proj::before, .proj::after {
    content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none; z-index: 1;
    border: 0 solid var(--accent); opacity: 0.75;
}
.proj::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.proj::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.proj:hover, .proj:focus-within {
    border-color: var(--accent); transform: translateY(-2px);
    box-shadow: 0 0 0 1px rgba(95, 227, 255, 0.25), 0 6px 22px rgba(95, 227, 255, 0.12);
}
.proj-shot {
    display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #000;
    border-bottom: 1px solid var(--line); filter: brightness(0.9); transition: filter 120ms ease-out;
}
.proj:hover .proj-shot, .proj:focus-within .proj-shot { filter: none; }
.proj-body { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.7rem 0.85rem 0.85rem; flex: 1; }
.proj-title { margin: 0; font-size: 0.95rem; letter-spacing: 0.1em; color: var(--text); }
.proj-title a { color: inherit; text-decoration: none; }
.proj-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }   /* the whole card is the link */
.proj-title a:focus-visible { outline: none; }
.proj:has(.proj-title a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.proj-tag { font-family: var(--mono); font-size: 0.68rem; color: var(--accent); letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.85; }
.proj-blurb { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.84rem; line-height: 1.45; }
.proj-links { position: relative; z-index: 2; display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: auto; padding-top: 0.55rem; }
.proj-more { margin: 1.5rem 0 0; text-align: center; }
.members-note { margin-top: 2rem; }
.members-note p { margin-bottom: 0.9rem; }
.members-note p:last-child { margin-bottom: 0; }
.rnd-intro { max-width: 46rem; margin: 0 0 1.1rem; color: var(--muted); font-size: 0.95rem; line-height: 1.55; }
/* Visitors' gallery of the members' projects: the cards' screenshots and corner brackets, nothing else.
   Each opens the viewer (gallery.js). */
.dev-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.dev-shot {
    position: relative; display: block; width: 100%; margin: 0; padding: 0; font: inherit; cursor: zoom-in;
    border: 1px solid var(--line); border-radius: 0; background: #000; overflow: hidden;
    transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
.dev-shot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* pictures to click through, not to select or drag: quick clicks would otherwise paint them selection blue */
.dev-gallery, .viewer { user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.dev-gallery img, .viewer img { -webkit-user-drag: none; }
.dev-shot::before, .dev-shot::after {
    content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none; z-index: 1;
    border: 0 solid var(--accent); opacity: 0.75;
}
.dev-shot::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.dev-shot::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.dev-shot img {
    display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover;
    filter: saturate(0.9) brightness(0.88); transition: filter 160ms ease-out, transform 300ms ease-out;
}
.dev-shot:hover, .dev-shot:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(95, 227, 255, 0.25), 0 6px 22px rgba(95, 227, 255, 0.12); }
.dev-shot:hover img, .dev-shot:focus-visible img { filter: none; transform: scale(1.04); }

/* The R&D viewer: one picture large on a dark screen, previous / next at the sides, the count and Back below. */
.viewer {
    width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
    background: rgba(3, 10, 15, 0.94); color: var(--text); overflow: hidden;
}
.viewer::backdrop { background: rgba(3, 10, 15, 0.7); }
.viewer[open] { display: grid; grid-template-rows: 1fr auto; place-items: center; }
.viewer-frame {
    margin: 0; width: 100%; height: 100%; display: grid; place-items: center; padding: 1.25rem 4.5rem 0.5rem;
    min-height: 0; box-sizing: border-box;
}
.viewer-img {
    display: block; width: min(1600px, 100%, calc((100dvh - 7rem) * 16 / 9)); height: auto;
    aspect-ratio: 16 / 9; object-fit: contain; background: #000;
    border: 1px solid var(--line-2); box-shadow: 0 0 0 1px rgba(95, 227, 255, 0.15), 0 18px 60px rgba(0, 0, 0, 0.6);
}
.viewer-nav {
    position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; padding: 0;
    display: grid; place-items: center; cursor: pointer; border-radius: 50%;
    background: rgba(12, 30, 41, 0.85); border: 1px solid var(--line-2); color: var(--text);
    transition: color 120ms ease-out, border-color 120ms ease-out;
}
.viewer-prev { left: 1rem; }
.viewer-next { right: 1rem; }
.viewer-nav svg, .viewer-close svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.viewer-nav svg { width: 26px; height: 26px; }
.viewer-bar { display: flex; align-items: center; gap: 1.25rem; padding: 0.6rem 1rem 1.1rem; }
.viewer-count { font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.14em; color: var(--muted); font-variant-numeric: tabular-nums; }
.viewer-close {
    display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.95rem; cursor: pointer;
    background: var(--panel); border: 1px solid var(--line-2); border-radius: 4px; color: var(--text);
    font: inherit; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
    transition: color 120ms ease-out, border-color 120ms ease-out;
}
.viewer-close svg { width: 16px; height: 16px; }
.viewer-nav:hover, .viewer-close:hover { color: var(--accent); border-color: var(--accent); }
.viewer-nav:focus-visible, .viewer-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) {
    .viewer-frame { padding: 1rem 0.5rem 0.5rem; }
    .viewer-nav { top: auto; bottom: 0.7rem; transform: none; width: 44px; height: 44px; }
    .viewer-prev { left: 1rem; }
    .viewer-next { right: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .proj, .proj-shot, .dev-shot, .dev-shot img, .viewer-nav, .viewer-close { transition: none; }
    .proj:hover, .proj:focus-within { transform: none; }
    .dev-shot:hover img, .dev-shot:focus-visible img { transform: none; }
}

.route { display: flex; flex-wrap: wrap; gap: 0.25rem 0; margin: 2.5rem 0 1.5rem; font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; color: var(--faint); justify-content: center; }
.route span { white-space: nowrap; }
.route span + span::before { content: "\2192"; margin: 0 0.6rem; color: var(--line-2); }
.route .hot { color: var(--warn); }

.status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.status-list li { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; font-size: 0.9rem; }
.status-list .k { min-width: 9rem; color: var(--faint); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.05rem 0.45rem; border: 1px solid currentColor; }
.pill-ok { color: var(--ok); }
.pill-warn { color: var(--warn); }
.pill-off { color: var(--faint); }

/* ── Lobby / room ───────────────────────────────────────────────────────────────────────── */
.lobby-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .lobby-grid { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--faint); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.keys th { width: 13rem; color: var(--accent); font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0; text-transform: none; font-weight: 400; }
.keys td.pad { color: var(--muted); width: 11rem; }

.code { font-family: var(--mono); color: var(--muted); font-size: 0.85em; letter-spacing: 0.12em; }
.state { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; padding: 0.08rem 0.45rem; border: 1px solid currentColor; text-transform: uppercase; }
.state-lobby { color: var(--accent); }
.state-starting { color: var(--warn); }
.state-ingame { color: var(--ok); }
.state-ended { color: var(--faint); }

.join-code { display: flex; gap: 0.5rem; margin-top: 1rem; }
.join-code input { width: 8rem; text-transform: uppercase; font-family: var(--mono); letter-spacing: 0.12em; }

.crew { list-style: none; margin: 0 0 1rem; padding: 0; }
.crew li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.55rem 0.25rem; border-bottom: 1px solid var(--line); }
.crew-who { display: flex; align-items: center; gap: 0.85rem; }
.crew-name { font-weight: 600; }
.crew li.me .crew-name { color: var(--accent); }
.crew-livery { font-size: 0.78rem; color: var(--faint); }
.crew-ready { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; }
.crew-ready.yes { color: var(--ok); }
.crew-ready.no { color: var(--faint); }
.crew li.empty { color: var(--faint); font-style: italic; }
.actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.livery { width: 56px; height: 34px; flex: none; }

.settings-line { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; color: var(--muted); font-size: 0.9rem; margin-bottom: 0.9rem; }
.settings-line b { color: var(--text); font-weight: 600; }

/* ── Game page (GameLayout, static SSR) ─────────────────────────────────────────────────── */
.game-shell { position: fixed; inset: 0; background: #000; overflow: auto; }
.game-frame { width: 100%; height: 100%; border: 0; display: block; }
.game-bar { position: fixed; top: 0.5rem; right: 0.5rem; z-index: 10; display: flex; gap: 0.4rem; }
.game-bar form { margin: 0; }
.game-btn {
    padding: 0.25rem 0.6rem; border: 1px solid rgba(95, 227, 255, 0.25); cursor: pointer; font: inherit;
    background: rgba(6, 18, 26, 0.6); color: var(--text); border-radius: 2px; text-decoration: none; font-size: 0.78rem;
}
.game-btn:hover { background: rgba(6, 18, 26, 0.9); border-color: var(--accent); color: var(--text); }
.game-message {
    position: relative; max-width: 46rem; margin: 10vh 1rem; padding: 1.5rem;
    background: var(--panel); border: 1px solid var(--line);
}
@media (min-width: 48rem) { .game-message { margin: 10vh auto; } }
.game-message h1 { font-size: 1.4rem; }
.cmd { background: var(--bg); border: 1px solid var(--line); padding: 0.75rem; overflow-x: auto; white-space: pre-wrap; word-break: break-all; font-size: 0.8rem; }
.spinner { display: inline-block; width: 0.9rem; height: 0.9rem; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; vertical-align: -2px; margin-right: 0.5rem; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ── Test bench (/bench, bench.js) ──────────────────────────────────────────────────────── */
.bench-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 980px) { .bench-grid { grid-template-columns: 1fr; } }
.bench-frame-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--line); }
.bench-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.bench-frame-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 0.9rem; text-align: center; padding: 1rem; }
.bench-url { margin-top: 0.5rem; font-family: var(--mono); font-size: 0.75rem; color: var(--faint); word-break: break-all; }
.bench-only, .form .bench-only { display: none; }
.bench-only.on, .form .bench-only.on { display: flex; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.5rem; }
.tile { background: var(--bg-2); border: 1px solid var(--line); padding: 0.5rem 0.65rem; }
.tile .label { font-size: 0.7rem; color: var(--faint); letter-spacing: 0.06em; }
.tile .value { font-size: 1.25rem; font-weight: 600; color: var(--text); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value.small-value { font-size: 0.95rem; }
.tile .unit { font-size: 0.75rem; color: var(--muted); font-weight: 400; margin-left: 0.15rem; }

.chart { position: relative; }
.chart canvas { display: block; width: 100%; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.chart-title { font-size: 0.8rem; color: var(--muted); }
.legend { display: flex; gap: 0.9rem; font-size: 0.75rem; color: var(--muted); }
.legend .key { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 0.35rem; }
.chart-tip {
    position: absolute; pointer-events: none; z-index: 5; display: none; min-width: 7rem;
    background: rgba(6, 18, 26, 0.96); border: 1px solid var(--line-2); padding: 0.4rem 0.55rem;
    font-size: 0.75rem; color: var(--muted); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.chart-tip .tv { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip .row { display: flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.chart-tip .key { display: inline-block; width: 10px; height: 2px; }
.metric-switch { display: inline-flex; border: 1px solid var(--line-2); }
.metric-switch > button, .metric-switch > a {
    background: none; border: 0; border-radius: 0; color: var(--muted); font: inherit; font-size: 0.75rem; font-weight: 600;
    padding: 0.2rem 0.55rem; cursor: pointer; text-decoration: none; letter-spacing: 0.04em; text-transform: none;
}
.metric-switch > * + * { border-left: 1px solid var(--line-2); }
.metric-switch > [aria-pressed="true"] { background: var(--accent-wash); color: var(--accent); }
.metric-switch > a:hover { color: var(--accent); }

.gen-table td.bar-cell { width: 40%; }
.share { height: 6px; background: var(--accent); border-radius: 0 2px 2px 0; min-width: 1px; opacity: 0.85; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; }
.shots figure { margin: 0; background: var(--bg-2); border: 1px solid var(--line); }
.shots img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.shots figcaption { font-size: 0.72rem; color: var(--muted); padding: 0.25rem 0.4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-note { color: var(--faint); font-size: 0.85rem; margin: 0; }
details > summary { cursor: pointer; color: var(--muted); font-size: 0.8rem; margin-top: 0.5rem; }

.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .compare-grid { grid-template-columns: 1fr; } }
.delta-up { color: var(--danger); }
.delta-down { color: var(--ok); }
.svg-chart { width: 100%; height: auto; display: block; }
.svg-chart text { font-family: var(--font); }

/* Blazor framework UI (kept from the template). */
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred."; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--ok); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }

/* ── Model workshop (/workshop, workshop.js) ─────────────────────────────────────────────── */
/* the workshop wants the width: the viewer is the point of the page */
.site-main:has(.ws) { max-width: 1560px; }
.ws { display: grid; grid-template-columns: 250px minmax(0, 1fr) 310px; gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .ws { grid-template-columns: 220px minmax(0, 1fr); } .ws-info { grid-column: 1 / -1; } }
@media (max-width: 760px) { .ws { grid-template-columns: 1fr; } }
.ws-list { padding: 0.9rem 0.8rem; max-height: 80vh; overflow-x: hidden; overflow-y: auto; }
.ws-group + .ws-group { margin-top: 1.1rem; }
.ws-group h3 { margin: 0 0 0.15rem; color: var(--accent-2); }
.ws-group-blurb { margin: 0 0 0.5rem; line-height: 1.35; }
.ws-tiles { display: grid; gap: 0.35rem; }
.ws-tile {
    display: grid; gap: 0.05rem; text-align: left; width: 100%; padding: 0.45rem 0.6rem; overflow: hidden;
    background: var(--bg-2); border: 1px solid var(--line); color: var(--text); font: inherit; cursor: pointer;
    position: relative;
}
.ws-tile:hover { border-color: var(--line-2); background: var(--panel-hi); }
.ws-tile.on { border-color: var(--accent); background: var(--accent-wash); }
.ws-tile[data-group="foundry"] { border-left: 3px solid #ffb547; }
.ws-tile[data-group="brood"] { border-left: 3px solid #ff5c3c; }
.ws-tile[data-group="player"] { border-left: 3px solid var(--accent); }
.ws-tile-name { font-weight: 600; letter-spacing: 0.04em; }
.ws-tile-role { font-size: 0.74rem; color: var(--faint); }
.ws-tile-tag { position: absolute; top: 0.4rem; right: 0.5rem; font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--warn); }
.ws-frame-wrap { position: relative; aspect-ratio: 16 / 10; max-height: 78vh; width: 100%; background: #070c10; border: 1px solid var(--line); }
.ws-canvas { position: absolute; inset: 0; }
.ws-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.ws-thumb { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; object-fit: cover; background: #0e1820; border-bottom: 1px solid var(--line); margin: -0.45rem -0.6rem 0.3rem; width: calc(100% + 1.2rem); max-width: none; }
.ws-tile-text { display: grid; }
.ws-frame-wrap:fullscreen { aspect-ratio: auto; }
.ws-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.ws-toolbar { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.55rem; }
.ws-sep { width: 1px; height: 1.2rem; background: var(--line-2); margin: 0 0.25rem; }
.ws-label { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--faint); text-transform: uppercase; }
.btn.on, .chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ws-info { padding: 1rem 1.1rem; }
.ws-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.ws-head h2 { margin: 0; font-size: 1.2rem; }
.ws-blurb { color: var(--muted); font-size: 0.92rem; margin: 0.6rem 0 0.8rem; }
.ws-stats { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.ws-stats th { text-align: left; font-weight: 400; color: var(--faint); padding: 0.18rem 0.5rem 0.18rem 0; white-space: nowrap; }
.ws-stats td { text-align: right; padding: 0.18rem 0; }
.ws-stats tr + tr { border-top: 1px solid var(--line); }
.ws-block { margin-top: 1rem; }
.ws-block h3 { margin: 0 0 0.4rem; }
.ws-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.chip {
    font: inherit; font-size: 0.78rem; padding: 0.22rem 0.6rem; background: var(--bg-2); color: var(--text);
    border: 1px solid var(--line-2); cursor: pointer; letter-spacing: 0.03em;
}
.chip:hover { border-color: var(--accent); }
.ws-livery {
    width: 36px; height: 26px; padding: 0; cursor: pointer; border: 2px solid var(--line-2);
    background: linear-gradient(115deg, var(--a) 0 46%, var(--b) 46% 74%, var(--c) 74%);
}
.ws-livery:hover { border-color: var(--accent-2); }
.ws-livery.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* ── Weapons workshop (/weapons, workshop/weapons.js) ───────────────────────────────────── */
.wk { grid-template-columns: 240px minmax(0, 1fr) 340px; }
@media (max-width: 1100px) { .wk { grid-template-columns: 220px minmax(0, 1fr); } }
@media (max-width: 760px) { .wk { grid-template-columns: 1fr; } }
.wk-tile { grid-template-columns: auto 1fr; align-items: center; gap: 0.55rem; }
.wk-swatch { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle, #fff 0 28%, var(--b) 30% 45%, var(--a) 70%, transparent 72%); box-shadow: 0 0 10px var(--a); }
.wk-edited { position: absolute; top: 0.35rem; right: 0.5rem; font-size: 0.6rem; color: var(--warn); }
.wk-hud { position: absolute; left: 0.6rem; bottom: 0.5rem; font-family: var(--mono); font-size: 0.72rem; color: var(--muted); pointer-events: none; text-shadow: 0 0 4px #000; }
.wk-select { padding: 0.2rem 0.4rem; font-size: 0.8rem; }
.wk-inline { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--muted); }
.wk-inline input[type="range"] { width: 90px; }
.wk-info { max-height: 82vh; overflow-y: auto; }
.wk-actions { margin: 0.7rem 0 0.3rem; }
.wk-file { display: inline-block; }
.wk-sec { border-top: 1px solid var(--line); padding: 0.4rem 0; }
.wk-sec summary { cursor: pointer; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-2); padding: 0.2rem 0; }
.wk-fields { display: grid; gap: 0.3rem; padding: 0.35rem 0 0.2rem; }
.wk-field { display: grid; grid-template-columns: 6.2rem 1fr 4.2rem; align-items: center; gap: 0.4rem; font-size: 0.78rem; }
.wk-field:has(select), .wk-field:has(input[type="checkbox"]) { grid-template-columns: 6.2rem 1fr; }
.wk-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.wk-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.wk-field input[type="color"] { width: 100%; height: 1.5rem; padding: 0; border: 1px solid var(--line-2); background: none; }
.wk-field output { text-align: right; font-size: 0.72rem; color: var(--text); }

/* the Solar Trip's voyage list (/solartrip) */
.tour-voyages { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 0.35rem 1rem; }
.tour-voyages label.check { align-items: baseline; }
