/* style.css — turningcircle.pro app, in the landing page's design (tokens below; no colour anywhere else) */

:root {
    /* surfaces and text (from the landing page) */
    --bg: #07060F;
    --bg-raised: #0B0A1A;
    --bg-overlay: rgba(11, 10, 26, 0.86);
    --bg-input: #07060F;
    --bg-hover: rgba(255, 255, 255, 0.06);
    --bg-active: rgba(123, 61, 255, 0.16);
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --grid: rgba(255, 255, 255, 0.04);
    --grid-major: rgba(255, 255, 255, 0.075);
    --text: #EDEBFA;
    --text-muted: #A9A6C4;
    --text-faint: #8F8BB0;
    --text-soft: #C9C6E0;
    --danger-soft: rgba(255, 90, 106, 0.14);
    --danger-text: #FF8C98;
    --on-accent: #FFFFFF;
    /* accents */
    --accent-1: #2D6BFF;
    --accent-2: #7B3DFF;
    --accent-3: #D63DF5;
    --accent-4: #FF7A45;
    --accent-soft: #C9BFFF;
    --accent-gradient: linear-gradient(90deg, var(--accent-1), var(--accent-2), var(--accent-3));
    --accent-gradient-text: linear-gradient(90deg, #8FB0FF, #B79BFF, #EB9BFA);
    --button-gradient: linear-gradient(100deg, #2D6BFF 0%, #7B3DFF 60%, #A63DF2 100%);
    --glow: rgba(123, 61, 255, 0.55);
    --glow-soft: rgba(123, 61, 255, 0.16);
    --glow-blue: rgba(45, 107, 255, 0.10);
    --bubble-edge: linear-gradient(150deg, rgba(110, 155, 255, 0.85), rgba(123, 61, 255, 0.55) 45%, rgba(214, 61, 245, 0.35));
    --bubble-glow: rgba(45, 107, 255, 0.16);
    --focus: #6E9BFF;
    --danger: #FF5A6A;
    --warning: #FFB547;
    --success: #3DDC84;
    --shadow: rgba(0, 0, 0, 0.45);
    --backdrop: rgba(5, 4, 12, 0.72);
    /* shape and type */
    --radius: 16px;
    --radius-pill: 999px;
    --radius-input: 12px;
    --radius-small: 8px;
    --font-head: Outfit, Inter, system-ui, sans-serif;
    --font-body: Inter, system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --size-xs: 10px;
    --size-s: 11px;
    --size-m: 12px;
    --size-l: 13px;
    --size-xl: 15px;
    --topbar: 48px;
    --sidebar: 300px;
    --rail: 56px;
    --ease: 150ms ease;
    /* drawing (functional, apart from the brand) */
    --draw-envelope: #2FBF4A;
    --draw-envelope-fill: rgba(47, 191, 74, 0.22);
    --draw-wheels: #E5484D;
    --draw-path: rgba(255, 255, 255, 0.70);
    --draw-centre: rgba(255, 255, 255, 0.55);
    --draw-underlay: rgba(138, 135, 159, 0.55);
    --draw-ghost: #FF5A6A;
    --draw-handle: #FFFFFF;
    --draw-handle-fill: #0B0A1A;
    --draw-vehicle: rgba(255, 255, 255, 0.85);
    --draw-vehicle-fill: rgba(255, 255, 255, 0.07);
    --draw-tyre: #C9C6E0;
    --draw-position: rgba(255, 255, 255, 0.45);
    --draw-flip: #D63DF5;
    --draw-label: #A9A6C4;
    --draw-route: rgba(237, 235, 250, 0.55);
    --draw-waypoint: #C9BFFF;
    --draw-pick: #4FC3F7;
    --draw-hover: #FFD54F;
    --draw-snap: #FFD54F;
    --draw-compare: rgba(255, 255, 255, 0.70);
    --draw-old: rgba(79, 195, 247, 0.75);
    --draw-gizmo-move: #FF5A6A;
    --draw-gizmo-turn: #2FBF4A;
    --pdf-paper: #FFFFFF;
    /* steering graph leg bands: forward green, reverse red, with drifting full-height chevrons */
    --leg-fwd: rgba(47, 191, 74, 0.07);
    --leg-fwd-chevron: rgba(47, 191, 74, 0.22);
    --leg-rev: rgba(255, 90, 106, 0.08);
    --leg-rev-chevron: rgba(255, 90, 106, 0.26);
    --chevron-fwd: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='96' viewBox='0 0 36 96' preserveAspectRatio='none'%3E%3Cpath d='M12 4L24 48L12 92' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
    --chevron-rev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='96' viewBox='0 0 36 96' preserveAspectRatio='none'%3E%3Cpath d='M24 4L12 48L24 92' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
    /* manoeuvre colour tags: six muted colours */
    --tag-1: #7FA7D9;
    --tag-2: #D9A066;
    --tag-3: #A994E0;
    --tag-4: #66C2AE;
    --tag-5: #D98CB3;
    --tag-6: #BDB76B;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font-body); font-size: var(--size-m); background: var(--bg); color: var(--text); display: flex; flex-direction: column; overflow: hidden; }
b, .num, input[type="number"] { font-variant-numeric: tabular-nums; }
::selection { background: var(--bg-active); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 9000; background: var(--bg-raised); color: var(--text); padding: 8px 12px; border-radius: var(--radius-small); }
.skip:focus { left: 8px; }
a { color: var(--accent-soft); }

/* ─── TOP BAR ─── */
#topbar { height: var(--topbar); flex: 0 0 var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 12px 0 14px; background: var(--bg-raised); border-bottom: 1px solid var(--border); position: relative; z-index: 40; min-width: 0; overflow: hidden; }
.tb-logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; flex: 0 0 auto; }
.tb-logo img { display: block; }
.wordmark { font-family: var(--font-head); font-weight: 600; font-size: var(--size-xl); color: var(--text); letter-spacing: -0.01em; }
.wordmark .pro { background: var(--accent-gradient-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tb-project { flex: 0 1 220px; min-width: 90px; }
.tb-project input { width: 100%; background: transparent; border: 1px solid transparent; border-radius: var(--radius-small); color: var(--text); font: 500 var(--size-l) var(--font-body); padding: 5px 8px; }
.tb-project input:hover { border-color: var(--border); }
.tb-project input:focus { border-color: var(--focus); outline: none; background: var(--bg-input); }
.tb-drawing { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; font: var(--size-m) var(--font-mono); color: var(--text-soft); white-space: nowrap; overflow: hidden; }
.tb-drawing b { font-weight: 400; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tb-drawing .tb-scale, .tb-drawing .tb-revs { color: var(--text-faint); flex: 0 0 auto; }
/* the active manoeuvre: vehicle, speed, and "Not reached" when it cannot reach a click (as on the landing page's picture of the app) */
.tb-chips { display: flex; align-items: center; gap: 8px; min-width: 0; margin-right: 6px; font: var(--size-m) var(--font-mono); }
.tb-chip { padding: 4px 10px; border-radius: var(--radius-small); background: var(--bg-hover); color: var(--text-soft); white-space: nowrap; flex: 0 0 auto; }
.tb-chip.vehicle { flex: 0 1 auto; min-width: 0; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.tb-chip.bad { background: var(--danger-soft); color: var(--danger-text); }
.tb-centre { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.mode-pill { display: inline-flex; align-items: center; height: 26px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--bg); font: 600 var(--size-s) var(--font-mono); letter-spacing: 0.12em; }
.mode-pill span { background: var(--accent-gradient-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mode-pill:empty { visibility: hidden; }
.tb-right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; position: relative; }
#tb-menu, #mv-menu { position: fixed; z-index: 1200; display: none; min-width: 190px; background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-small); padding: 4px; box-shadow: 0 10px 30px var(--shadow); }
#tb-menu { position: absolute; right: 0; top: 40px; }
#tb-menu.visible, #mv-menu.visible { display: block; }
#tb-menu button, #mv-menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 7px 10px; cursor: pointer; font: var(--size-m) var(--font-body); border-radius: 6px; transition: background var(--ease); }
#tb-menu button:hover, #tb-menu button:focus, #mv-menu button:hover, #mv-menu button:focus { background: var(--bg-hover); outline: none; }
#tb-menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
#mv-menu button.danger { color: var(--danger); }

/* ─── LAYOUT ─── */
#app-body { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }
.panel { width: var(--sidebar); min-width: var(--sidebar); background: var(--bg-raised); display: flex; flex-direction: column; overflow-y: auto; border-right: 1px solid var(--border); transition: width var(--ease), min-width var(--ease); position: relative; z-index: 20; }
.sb-head { display: flex; justify-content: flex-end; padding: 4px 6px 0; }
body.rail-mode .sb-head { justify-content: center; }
body.rail-mode .sb-head #sb-collapse svg { transform: scaleX(-1); }
.rail { display: none; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; }
.panel-section { padding: 12px 14px; border-bottom: 1px solid var(--border); transition: opacity var(--ease); }
.panel-section.locked { opacity: 0.4; pointer-events: none; }
.panel-section.current { box-shadow: inset 2px 0 0 var(--accent-2); }
#step-place.locked, #step-drive.locked { opacity: 0.4; pointer-events: none; }
#step-place, #step-drive { margin-left: -14px; padding-left: 14px; }
#step-place.current, #step-drive.current { box-shadow: inset 2px 0 0 var(--accent-2); }
.wordmark-pro { background: var(--accent-gradient-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.section-label { font: 600 var(--size-xs) var(--font-body); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-faint); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sec-toggle { all: unset; flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; border-radius: 4px; }
.sec-toggle::after { content: ''; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--text-faint); border-bottom: 1.5px solid var(--text-faint); transform: rotate(45deg); transition: transform var(--ease); }
.panel-section { position: relative; }
/* "i": a section's longer help, in a small card under its heading */
.info-btn { flex: 0 0 auto; width: 18px; height: 18px; margin-left: 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border-strong); background: transparent; color: var(--text-muted); font: italic 600 11px Georgia, 'Times New Roman', serif; cursor: pointer; padding: 0; text-transform: none; letter-spacing: 0; }
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--text); border-color: var(--accent-2); background: var(--bg-active); }
.info-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.info-pop { position: absolute; z-index: 30; top: 36px; left: 10px; right: 10px; padding: 10px 12px; font-size: var(--size-s); color: var(--text-muted); line-height: 1.55; }
.info-pop[hidden] { display: none; }
#smooth-note[hidden] { display: none; }
.info-pop .info { margin: 0 0 6px; color: var(--text-muted); }
.info-pop .info:last-child { margin-bottom: 0; }
.info-pop .keys { margin-top: 6px; }
.sb-veh-tools { flex-wrap: wrap; }
.sb-veh-tools .btn { flex: 0 1 auto; }
body:not(.custom-active) #sb-edit-custom { display: none; }
.sec-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.collapsed .sec-toggle::after { transform: rotate(-45deg); }
.collapsed .sec-body { display: none; }
.collapsed .section-label { margin-bottom: 0; }
.step-num { display: none; }
/* collapsed to icons (narrow windows, or by the button) */
body.rail-mode .panel { width: var(--rail); min-width: var(--rail); overflow: hidden; }
body.rail-mode .panel > .panel-section, body.rail-mode .panel-footer .footer-link { display: none; }
body.rail-mode .panel-footer { padding: 8px; }
body.rail-mode #btn-export { width: 40px; height: 40px; padding: 0; margin: 0 auto; }
body.rail-mode #btn-export .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.rail-mode.rail-open .panel-footer .footer-link { display: block; }
body.rail-mode.rail-open #btn-export { width: 100%; height: 40px; padding: 0 16px; }
body.rail-mode.rail-open #btn-export .lbl { position: static; width: auto; height: auto; clip: auto; }
body.rail-mode .rail { display: flex; }
body.rail-mode .rail [data-go].active { background: var(--bg-active); color: var(--text); box-shadow: inset 2px 0 0 var(--accent-2); }
/* the section bubble: one section beside its icon, chamfered like the landing page's cards */
#rail-bubble { position: absolute; z-index: 40; left: calc(var(--rail) + 8px); width: calc(var(--sidebar) + 12px); filter: drop-shadow(0 10px 26px var(--shadow)); }
#rail-bubble[hidden] { display: none; }
#rail-bubble .rb-frame { padding: 1px; background: var(--bubble-edge);
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px)); }
#rail-bubble .rb-inner { display: flex; flex-direction: column; max-height: var(--rb-max, 70vh); background: radial-gradient(120% 70% at 0% 0%, var(--bubble-glow), transparent 55%), var(--bg-raised);
    clip-path: polygon(0 0, calc(100% - 17.5px) 0, 100% 17.5px, 100% 100%, 17.5px 100%, 0 calc(100% - 17.5px)); }
#rail-bubble .rb-body { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
#rail-bubble .rb-body > .panel-section { border-bottom: none; }
#rail-bubble .rb-nav { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; height: 24px; width: 100%; background: none; border: none; color: var(--text-muted); cursor: pointer; }
#rail-bubble .rb-nav:hover:not(:disabled) { color: var(--text); background: var(--bg-hover); }
#rail-bubble .rb-nav:disabled { opacity: 0.25; cursor: default; }
#rail-bubble .rb-nav:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
#rail-bubble .rb-nav svg { width: 18px; height: 18px; }
/* in a bubble a section is always open: no folding */
#rail-bubble .sec-toggle { pointer-events: none; cursor: default; }
#rail-bubble .sec-toggle::after { display: none; }
#rail-bubble .collapsed .sec-body { display: block; }
body.rail-mode.rail-open .panel { position: absolute; left: 0; top: 0; bottom: 0; width: var(--sidebar); min-width: var(--sidebar); overflow-y: auto; box-shadow: 10px 0 30px var(--shadow); }
body.rail-mode.rail-open .panel > .panel-section { display: block; }
body.rail-mode.rail-open .rail { display: none; }

/* ─── BUTTONS ─── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: transparent; border: 1px solid var(--border-strong); color: var(--text); border-radius: var(--radius-pill); padding: 6px 14px; font: 500 var(--size-m) var(--font-body); white-space: nowrap; cursor: pointer; transition: background var(--ease), box-shadow var(--ease), border-color var(--ease); }
.btn:hover:not(:disabled) { background: var(--bg-hover); }
.btn.primary { background: var(--button-gradient); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { box-shadow: 0 0 18px var(--glow); background: var(--button-gradient); }
.btn.active { border-color: var(--accent-2); background: var(--bg-active); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-row { display: flex; gap: 6px; margin-top: 8px; }
.btn-row .btn { flex: 1; }
.full { width: 100%; margin-top: 8px; }
.btn.full { width: 100%; margin-top: 6px; }
.btn.small { padding: 2px 10px; font-size: var(--size-s); }
.icon-btn { width: 32px; height: 32px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; background: none; border: none; color: var(--text-muted); border-radius: var(--radius-small); cursor: pointer; padding: 0; transition: background var(--ease), color var(--ease); }
.icon-btn:hover:not(:disabled) { background: var(--bg-overlay); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn svg { width: 17px; height: 17px; }
.mv-row .icon-btn svg { width: 15px; height: 15px; }

/* ─── FIELDS ─── */
input[type="number"], input[type="text"], select { width: 100%; padding: 6px 9px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-small); color: var(--text); font: var(--size-m) var(--font-body); outline: none; transition: border-color var(--ease); }
input[type="number"] { font-family: var(--font-mono); }
input:focus, select:focus { border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus); }
select option { background: var(--bg-raised); color: var(--text); }
.field { position: relative; display: inline-flex; align-items: center; }
.field input { padding-right: 46px; }
.field::after { content: attr(data-unit); position: absolute; right: 10px; color: var(--text-faint); font: var(--size-s) var(--font-mono); pointer-events: none; }
.inline { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: var(--size-m); color: var(--text-muted); }
.inline input[type="number"] { width: 100px; }
.inline .field input[type="number"] { width: 110px; }
/* toggles: checkboxes as pill switches */
.check { display: flex; align-items: center; gap: 9px; font-size: var(--size-m); color: var(--text); cursor: pointer; padding: 4px 0; line-height: 1.4; }
.check input[type="checkbox"] { -webkit-appearance: none; appearance: none; flex: 0 0 auto; width: 30px; height: 17px; border-radius: var(--radius-pill); background: var(--border-strong); position: relative; cursor: pointer; transition: background var(--ease); margin: 0; }
.check input[type="checkbox"]::after { content: ''; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--text); transition: transform var(--ease); }
.check input[type="checkbox"]:checked { background: var(--accent-gradient); }
.check input[type="checkbox"]:checked::after { transform: translateX(13px); }
.check input[type="checkbox"]:disabled { opacity: 0.4; cursor: not-allowed; }
input[type="radio"] { accent-color: var(--accent-2); }
/* segmented controls */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); padding: 2px; gap: 2px; flex: 0 0 auto; background: var(--bg); }
.seg label, .seg button { padding: 3px 12px; font: 500 var(--size-s) var(--font-body); color: var(--text-muted); cursor: pointer; border-radius: var(--radius-pill); border: none; background: none; transition: background var(--ease), color var(--ease); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg button[aria-pressed="true"] { background: var(--button-gradient); color: var(--on-accent); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); }
.seg.disabled { opacity: 0.4; }
.seg.disabled label { cursor: not-allowed; }
.sr-select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
/* sliders: thin track, gradient up to the handle */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: var(--radius-pill); outline: none; background: linear-gradient(90deg, var(--accent-1), var(--accent-2)) 0 / var(--fill, 0%) 100% no-repeat, var(--border-strong); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--accent-2); cursor: pointer; }
input[type="range"]:focus-visible { box-shadow: 0 0 0 2px var(--focus); }

/* ─── TEXT BITS ─── */
.rows { font-size: var(--size-m); color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.rows span { display: flex; justify-content: space-between; gap: 8px; }
.rows b { color: var(--text); font-weight: 500; text-align: right; }
.info { font-size: var(--size-s); color: var(--text-faint); margin: 6px 0; line-height: 1.55; }
.info.warn { color: var(--warning); }
.info.ok { color: var(--success); }
.sub-label { font: 600 var(--size-xs) var(--font-body); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); margin: 12px 0 6px; }
.tag { font-size: var(--size-xs); color: var(--text-faint); }
/* a custom vehicle's tag and source, under its name (small, muted); nothing for a preset */
/* custom vehicles: the editor's buttons, import messages, and the details block (custom vehicles only) */
.import-msg { font-size: var(--size-s); line-height: 1.5; color: var(--text-muted); }
.import-msg:empty { display: none; }
.import-msg div { margin: 2px 0; }
.import-msg .ok { color: var(--success); }
.import-msg .bad { color: var(--danger); }
.import-msg .warn { color: var(--warning); }
.import-msg .note { color: var(--text-faint); }
.cm-field { display: flex; flex-direction: column; gap: 3px; font-size: var(--size-s); color: var(--text-muted); }
.cm-field.cm-wide { grid-column: 1 / -1; }
.cm-field textarea { resize: vertical; padding: 6px 9px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-small); color: var(--text); font: var(--size-m) var(--font-body); }
.cm-field input:invalid { border-color: var(--danger); }
#wizard.no-vehicle #wz-dup-custom { display: none; }
/* the Vehicle step: heading and four compact tools on one row, the list, a one-line source */
.veh-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.veh-head h2 { margin: 0; }
.veh-tools { display: flex; flex-wrap: nowrap; gap: 6px; }
.veh-tools .tool { gap: 5px; padding: 3px 10px; }
.veh-tools .tool svg { width: 13px; height: 13px; flex: 0 0 auto; }
.veh-pick { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.veh-pick select { flex: 1; min-width: 0; }
.edit-link { flex: 0 0 auto; background: none; border: none; padding: 4px 2px; color: var(--accent-soft); font: 500 var(--size-m) var(--font-body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
#wizard:not(.custom-vehicle) #wz-edit-custom { display: none; }
.veh-source.one-line { flex-wrap: nowrap; min-width: 0; margin-bottom: 8px; }
.veh-source.one-line .src-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.veh-source.one-line .custom-tag { flex: 0 0 auto; }
.veh-summary b { font-family: var(--font-mono); font-weight: 500; }
/* pop-ups over the wizard: the custom vehicle editor and the export dialog (the wizard dimmed and blurred behind) */
.modal.ve-modal { z-index: 1600; }
.modal-card.ve-card { width: 780px; max-width: calc(100vw - 48px); max-height: 86vh; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.ve-card > h2 { padding: 20px 24px 0; }
.ve-body { overflow-y: auto; padding: 4px 24px 12px; }
.ve-sec { padding: 12px 0; border-bottom: 1px solid var(--border); }
.ve-sec:last-of-type { border-bottom: none; }
.ve-sec .veh-diagram { height: 300px; }
.ve-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.ve-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ve-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ve-err { grid-column: 1 / -1; font-size: var(--size-s); color: var(--danger); line-height: 1.45; }
.ve-err:empty { display: none; }
#veh-editor [aria-invalid="true"] { border-color: var(--danger); }
.ve-readouts { margin-top: 8px; }
.ve-readouts b { font-family: var(--font-mono); font-weight: 500; }
.ve-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--bg-raised); }
.ve-foot .btn { padding: 8px 20px; font-size: var(--size-l); }
.modal-card.vx-card { width: 460px; }
.vx-tools { display: flex; gap: 6px; margin-bottom: 8px; }
.vx-list { max-height: 40vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-small); padding: 6px 10px; margin-bottom: 12px; }
.vx-row { padding: 5px 0; }
/* the Vehicle step before a vehicle is chosen: the list only */
#wizard.no-vehicle .veh-layout, #wizard.no-vehicle #wz-vehicle-msg { display: none; }
.veh-source { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 6px 0 2px; font-size: var(--size-xs); line-height: 1.45; color: var(--text-faint); }
.veh-source .custom-tag:not(:empty) { padding: 0 6px; border-radius: var(--radius-pill); background: var(--bg-active); color: var(--accent-soft); white-space: nowrap; }
.layer-list { max-height: 170px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-small); padding: 4px 8px; }
.layer-list .check { font-size: var(--size-s); }
.layer-list .count { margin-left: auto; color: var(--text-faint); font-family: var(--font-mono); }
.swatch { width: 14px; height: 4px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.swatch.sq { background: transparent; border: 1.5px solid var(--draw-handle); width: 7px; height: 7px; border-radius: 0; }
.sw-body { background: var(--draw-envelope); } .sw-wheels { background: var(--draw-wheels); } .sw-path { background: var(--draw-path); }
.sw-vehicle { background: var(--draw-vehicle); } .sw-flip { background: var(--draw-flip); }
.sw-pos { background: repeating-linear-gradient(90deg, var(--draw-position) 0 4px, transparent 4px 7px); }
kbd { display: inline-block; background: var(--bg); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font: 500 var(--size-xs) var(--font-mono); color: var(--text); line-height: 1.6; }
.keys { font-size: var(--size-s); color: var(--text-muted); display: grid; grid-template-columns: auto 1fr; gap: 5px 8px; align-items: center; }
.keys kbd { justify-self: start; }
.warnbox { font-size: var(--size-s); color: var(--danger); background: var(--bg-hover); border: 1px solid var(--danger); border-radius: var(--radius-small); padding: 6px 8px; margin-top: 8px; display: none; }
.warnbox.visible { display: block; }
.c-ok { color: var(--success); } .c-warn { color: var(--warning); } .c-bad { color: var(--danger); }
#leg-rows > span.current, #leg-rows > span.current b { color: var(--success); }
#leg-rows > span.bad, #leg-rows > span.bad b { color: var(--danger); }
#leg-rows .note { display: block; font-size: var(--size-xs); color: var(--text-faint); margin: -2px 0 4px 10px; font-family: var(--font-mono); }
#leg-rows .note.bad { color: var(--danger); }
#leg-rows .method { color: var(--text-faint); }
.panel-footer { position: sticky; bottom: 0; z-index: 2; display: flex; flex-direction: column; gap: 8px; background: var(--bg-raised); border-top: 1px solid var(--border); padding: 12px 14px 10px; margin-top: auto; font-size: var(--size-s); color: var(--text-faint); }
#btn-export { width: 100%; height: 40px; font-size: var(--size-l); }
#btn-export svg { width: 16px; height: 16px; }
.panel-footer a { color: var(--text-faint); text-decoration: none; }
.panel-footer a:hover { color: var(--text); }

/* ─── VIEWPORT ─── */
.viewport { flex: 1; position: relative; background: var(--bg); overflow: hidden; min-width: 0; }
#webgl-container { position: absolute; inset: 0; }
#webgl-container.crosshair { cursor: crosshair; }
#annotation-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.float { background: var(--bg-overlay); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 26px var(--shadow); }
.float.draggable { cursor: grab; }
.float.draggable :is(button, input, select, textarea, a, label, canvas) { cursor: auto; }
.float.draggable button, .float.draggable a, .float.draggable label { cursor: pointer; }
.float.dragging { cursor: grabbing; user-select: none; box-shadow: 0 14px 40px var(--shadow); }
/* hint bar: a floating pill, top centre */
#mode-bar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 4; display: none; max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 7px 16px; font-size: var(--size-m); color: var(--text-muted); border-radius: var(--radius-pill); }
#mode-bar.visible { display: block; }
/* the tip bar folds away 30 s after its instruction changes (sidebar.js), back while the mouse is near it */
#mode-bar { transition: opacity 0.5s ease, clip-path 0.5s ease; clip-path: inset(0 0 0 0 round var(--radius-pill)); }
#mode-bar.faded { opacity: 0; clip-path: inset(0 0 100% 0 round var(--radius-pill)); pointer-events: none; }
#mode-bar .dir { font: 700 var(--size-s) var(--font-mono); letter-spacing: 0.1em; margin-right: 10px; background: var(--accent-gradient-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
#mode-bar .dir.rev { background: none; color: var(--warning); }
#mode-bar kbd { margin: 0 2px; }
#mode-bar .bend-hint, .bend-hint { color: var(--accent-soft); }
/* readout: bottom left */
#info-overlay { position: absolute; bottom: 14px; left: 14px; padding: 10px 14px; font-size: var(--size-s); display: none; z-index: 3; min-width: 180px; }
#info-overlay.visible { display: block; }
#info-overlay .rows span { color: var(--text-muted); }
#info-overlay .rows b { font-family: var(--font-mono); font-weight: 500; }
#info-overlay .hint { margin-top: 6px; font-size: var(--size-xs); color: var(--text-faint); }
/* steering graph: bottom right */
#steer-panel { position: absolute; right: 14px; bottom: 14px; width: 440px; max-width: calc(100% - 230px); z-index: 3; padding: 8px 12px 8px; display: none; }
#steer-panel.visible { display: block; }
/* locked along the bottom of the drawing (the dock button), or floating and draggable as before */
.steer-tools { display: flex; gap: 4px; flex: 0 0 auto; }
#steer-dock .i-pop { display: none; }
#steer-panel.docked #steer-dock .i-pop { display: block; }
#steer-panel.docked #steer-dock .i-dock { display: none; }
#steer-panel.docked { left: 14px; right: 14px; bottom: 14px; width: auto; max-width: none; cursor: default; }
#steer-panel.docked #steer-graph { height: 110px; }
#viewport.steer-docked #info-overlay:not(.moved) { bottom: calc(var(--dock-h, 0px) + 26px); }
#steer-panel.collapsed #steer-graph, #steer-panel.collapsed .play-row, #steer-panel.collapsed .pb-readout { display: none; }
.steer-title { font: 600 var(--size-xs) var(--font-body); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.steer-title span { color: var(--text-faint); letter-spacing: 0; text-transform: none; font-weight: 400; }
.steer-title .icon-btn { width: 24px; height: 24px; }
#steer-graph { position: relative; width: 100%; height: 130px; display: block; }
.steer-graph-wrap { position: relative; }
#steer-panel.collapsed .steer-graph-wrap { display: none; }
/* leg bands behind the graph (two or more legs): soft tint, chevrons drifting the way the vehicle drives */
.steer-legs { position: absolute; inset: 0; pointer-events: none; }
.leg-band { position: absolute; overflow: hidden; border-radius: 4px; background: var(--leg-fwd); opacity: 0.75; transition: opacity 300ms ease; }
.leg-band.rev { background: var(--leg-rev); }
.leg-band.current { opacity: 1; }
.leg-band::after { content: ''; position: absolute; top: 0; bottom: 0; left: -36px; right: 0; background: var(--leg-fwd-chevron);
    -webkit-mask: var(--chevron-fwd) 0 0 / 36px 100% repeat-x; mask: var(--chevron-fwd) 0 0 / 36px 100% repeat-x;
    animation: legDriftFwd 4.4s linear infinite; }
.leg-band.rev::after { left: 0; right: -36px; background: var(--leg-rev-chevron); -webkit-mask-image: var(--chevron-rev); mask-image: var(--chevron-rev); animation-name: legDriftRev; }
@keyframes legDriftFwd { from { transform: translateX(0); } to { transform: translateX(36px); } }
@keyframes legDriftRev { from { transform: translateX(0); } to { transform: translateX(-36px); } }
.play-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.play-row .btn { padding: 3px 10px; min-width: 32px; }
.play-row input[type=range] { flex: 1; }
.play-row select { width: 62px; padding: 3px 6px; font-size: var(--size-s); }
.play-row .check { font-size: var(--size-s); }
.pb-readout { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 2px 10px; margin-top: 6px; font-size: var(--size-s) !important; }
.pb-readout b { font-family: var(--font-mono); }
/* empty state: the mark, a drop target, Open project, over the faint grid */
#empty-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 3; text-align: center;
    background-image: linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px), linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px; }
#empty-state.hidden { display: none; }
#empty-state img { opacity: 0.95; }
#empty-state .big { font: 500 20px var(--font-head); color: var(--text); }
#empty-state .small { font-size: var(--size-m); color: var(--text-muted); }
/* floating panels (top right, under the hint) */
.float-panel { position: absolute; top: 60px; right: 14px; z-index: 6; width: 280px; padding: 12px 14px; }
#scale-prompt { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 6; padding: 8px 16px; font-size: var(--size-l); color: var(--text); display: none; border-radius: var(--radius-pill); }
#scale-prompt.visible { display: block; }
#scale-prompt .sub { font-size: var(--size-s); color: var(--text-faint); margin-left: 10px; }
#scale-prompt a { color: var(--danger); }
#align-panel { border-color: var(--warning); }
#edit-readout { position: fixed; z-index: 7; pointer-events: none; padding: 4px 10px; font: var(--size-s) var(--font-mono); color: var(--text); display: none; white-space: nowrap; border-radius: var(--radius-small); border-color: var(--draw-ghost); }
#edit-readout.visible { display: block; }
#edit-readout .bad { color: var(--danger); }
#wp-menu { position: fixed; z-index: 8; display: none; background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-small); padding: 4px; font-size: var(--size-s); box-shadow: 0 6px 20px var(--shadow); }
#wp-menu.visible { display: block; }
#wp-menu .title { color: var(--text-faint); padding: 2px 6px 4px; }
#wp-menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--danger); padding: 5px 8px; cursor: pointer; font: inherit; border-radius: 6px; }
#wp-menu button:hover { background: var(--bg-hover); }
#wp-menu button:disabled { color: var(--text-faint); cursor: default; background: none; }

/* ─── MODALS ─── */
.modal { position: fixed; inset: 0; z-index: 1000; background: var(--backdrop); display: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal.visible { display: flex; align-items: center; justify-content: center; }
.modal-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 400px; max-width: calc(100vw - 32px); max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px var(--shadow); }
.modal-card h2 { font: 500 18px var(--font-head); color: var(--text); margin-bottom: 8px; letter-spacing: -0.01em; }
.modal-card p { font-size: var(--size-m); color: var(--text-muted); line-height: 1.6; margin-bottom: 10px; }
.modal-card .btn-row { margin-top: 16px; }
.modal-card .btn-row .btn { padding: 9px 14px; font-size: var(--size-l); }
.terms { max-height: 38vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-small); padding: 10px 14px; margin: 10px 0 14px; font-size: var(--size-s); color: var(--text-muted); line-height: 1.6; }
.terms h3 { font: 600 var(--size-m) var(--font-head); color: var(--text); margin: 10px 0 2px; }
.derived { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-small); padding: 10px 12px; margin-top: 12px; }
.msg { font-size: var(--size-s); line-height: 1.5; margin-top: 8px; }
.msg .e { color: var(--danger); display: block; }
.msg .w { color: var(--warning); display: block; }
#export-modal .modal-card { width: 540px; }
.ex-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: var(--size-m); }
.ex-row .check { margin: 0; flex: 1; min-width: 0; }
.ex-veh { color: var(--text-faint); font-size: var(--size-s); }
#export-detail { color: var(--text-faint); font-family: var(--font-mono); font-size: var(--size-s); }

/* ─── TOASTS: bottom centre, coloured left edge ─── */
#toast-container { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 7000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 9px 16px 9px 14px; border-radius: var(--radius-small); background: var(--bg-raised); border: 1px solid var(--border-strong); border-left: 3px solid var(--text-faint); color: var(--text); font-size: var(--size-m); opacity: 0; animation: toastIn 0.15s ease forwards; transition: opacity 0.3s; box-shadow: 0 8px 24px var(--shadow); max-width: 640px; }
.toast.warning { border-left-color: var(--warning); }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast.feedback-nudge { display: flex; align-items: center; gap: 10px; border-left-color: var(--accent-1); pointer-events: auto; }
.toast.feedback-nudge .btn { text-decoration: none; white-space: nowrap; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── WIZARD ─── */
#wizard { position: fixed; inset: 0; z-index: 1500; background: var(--backdrop); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; }
#wizard.visible { display: flex; }
#wizard.docked { background: transparent; backdrop-filter: none; pointer-events: none; justify-content: flex-end; align-items: flex-start; padding: calc(var(--topbar) + 60px) 24px 0 0; }
#wizard.docked .wizard-card { width: 400px; pointer-events: auto; }
.wizard-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); width: 880px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px var(--shadow); }
.wiz-steps { display: flex; justify-content: center; gap: 6px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.wiz-step { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font: 500 var(--size-s) var(--font-body); color: var(--text-faint); cursor: pointer; border-radius: var(--radius-pill); }
.wiz-step::before { content: ''; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--text-faint); flex: 0 0 auto; }
.wiz-step.done::before { background: var(--text-faint); }
.wiz-step.active { color: var(--text); background: var(--bg-hover); }
.wiz-step.active::before { background: var(--accent-gradient); border-color: transparent; box-shadow: 0 0 8px var(--glow); }
.wiz-step.hidden { display: none; }
#wizard.only-vehicle .wiz-step:not([data-step="2"]) { display: none; }
#wizard.only-vehicle #wz-back { visibility: hidden; }
.wiz-body { padding: 20px 24px; overflow-y: auto; }
.wiz-body section { display: none; }
.wiz-body section.active { display: block; }
.wiz-body h2 { font: 500 20px var(--font-head); color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em; }
.wiz-body p.lead { font-size: var(--size-m); color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; max-width: 70ch; }
/* Start (step 0, at start-up): import a drawing or a blank grid */
.blank-bar { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.blank-bar svg { width: 18px; height: 18px; flex: none; color: var(--accent-soft); }
.blank-bar b { font-weight: 500; white-space: nowrap; }
.blank-bar span { color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blank-bar:hover, .blank-bar:focus-visible { border-color: var(--accent-soft); background: var(--bg-active); }
@media (max-width: 700px) { .blank-bar span { display: none; } }
.wiz-foot { display: flex; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--border); align-items: center; }
.wiz-foot .spacer { flex: 1; }
.wiz-foot .btn { padding: 8px 20px; font-size: var(--size-l); }
.speed-grid { display: grid; grid-template-columns: 1fr 56px 1fr; gap: 12px; align-items: center; margin-top: 14px; }
.speed-field { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-input); padding: 12px 14px; }
.speed-field label { display: block; font: 600 var(--size-xs) var(--font-body); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); margin-bottom: 6px; }
.speed-field .field input { width: 130px; font-size: 16px; padding: 6px 54px 6px 10px; }
.speed-field .readout { font-size: var(--size-m); color: var(--text); margin-top: 8px; font-family: var(--font-mono); }
.link-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border-strong); cursor: pointer; display: flex; align-items: center; justify-content: center; justify-self: center; transition: border-color var(--ease); }
.link-btn svg { stroke: var(--text-faint); }
.link-btn.on { background: var(--bg-active); border-color: var(--accent-2); }
.link-btn.on svg { stroke: var(--text); }
.veh-layout { display: grid; grid-template-columns: 1fr 270px; gap: 16px; }
.veh-diagram { position: relative; height: 330px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-input); overflow: hidden; }
.veh-diagram svg { position: absolute; inset: 0; }
.veh-diagram input, .veh-diagram .dim-label { position: absolute; width: 62px; padding: 2px 4px; font-size: var(--size-s); text-align: center; transform: translate(-50%, -50%); background: var(--bg-raised); border-radius: 6px; }
.veh-diagram .dim-label { border: 1px solid var(--border); font-family: var(--font-mono); color: var(--text-muted); line-height: 1.5; }
.veh-diagram input.bad, .veh-diagram input[aria-invalid="true"] { border-color: var(--danger); color: var(--danger); }
.veh-side .inline .field input { width: 110px; }
.veh-side .inline input { width: 90px; }
.veh-side .inline span.lbl { flex: 1; }
select.full { width: 100%; }
#wz-source { margin-bottom: 8px; }
#wz-preset option:disabled { color: var(--text-faint); }
.drop-big { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 46px 20px; text-align: center; transition: border-color var(--ease), background var(--ease); }
.drop-big.drag-over { border-color: var(--accent-2); background: var(--bg-active); }
.drop-big .big { font: 500 17px var(--font-head); color: var(--text); margin-bottom: 12px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.thumbs button { background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-small); padding: 6px; cursor: pointer; color: var(--text-muted); font-size: var(--size-s); }
.thumbs button:hover, .thumbs button.sel { border-color: var(--accent-2); color: var(--text); }
.thumbs img { display: block; max-width: 150px; max-height: 150px; margin-bottom: 4px; background: var(--pdf-paper); }
.scale-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-input); padding: 12px 14px; margin-top: 10px; }

/* ─── CLOSED BETA GATE (Part D page) ─── */
/* closed beta sign-in page: full screen over the faint grid, terms on the right, access on the left */
.signin { position: fixed; inset: 0; z-index: 6000; display: none; overflow-y: auto; background: var(--bg); color: var(--text); }
.signin.visible { display: block; }
.si-grid { position: fixed; inset: 0; pointer-events: none;
    background-image: radial-gradient(ellipse 55% 45% at 50% 48%, var(--glow-soft), transparent 70%), radial-gradient(ellipse 35% 30% at 30% 60%, var(--glow-blue), transparent 70%),
        linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px), linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 120px 120px, 120px 120px, 24px 24px, 24px 24px; }
.si-wrap { position: relative; min-height: 100%; display: flex; align-items: center; padding: 40px 24px; }
.si-row { display: flex; flex-direction: row-reverse; align-items: stretch; gap: 32px; width: 100%; max-width: 1200px; margin: 0 auto; }
.si-panel { position: relative; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 24px 70px var(--shadow); }
.si-access { flex: 0 1 460px; min-width: 0; margin: 0 auto; padding: 36px 32px 24px; display: flex; flex-direction: column; }
.si-agree { margin: 14px 0 0; font-size: var(--size-s); line-height: 1.5; color: var(--text-muted); }
#beta-terms-version { font: var(--size-s) var(--font-mono); color: var(--text-faint); white-space: nowrap; }
.si-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 34px; }
.si-mark { width: 36px; height: 36px; filter: drop-shadow(0 0 10px var(--glow)); }
.si-brand .wordmark { font-size: 18px; }
.si-pill { margin-left: auto; padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); font: 600 var(--size-xs) var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-soft); white-space: nowrap; }
.si-access h1 { font: 500 30px/1.15 var(--font-head); letter-spacing: -0.02em; }
.si-sub { margin: 10px 0 26px; font-size: 14px; line-height: 1.55; color: var(--text-muted); }
.si-label { font: 600 var(--size-xs) var(--font-body); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-faint); margin-bottom: 8px; }
.si-code { display: flex; gap: 8px; }
.si-code input[type="text"] { flex: 1; min-width: 0; height: 56px; padding: 0 16px; border-radius: var(--radius-input); font: 500 21px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; }
.si-code input[type="text"]::placeholder { color: var(--text-faint); }
.si-code input[type="text"]:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--bg-active); }
.si-code .btn { height: 56px; border-radius: var(--radius-input); padding: 0 16px; }
.si-enter { margin-top: 22px; width: 100%; height: 48px; font-size: var(--size-xl); }
.si-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; margin-top: 16px; }
.si-link { background: none; border: none; padding: 2px 0; font: var(--size-m) var(--font-body); color: var(--text-muted); text-decoration: none; cursor: pointer; }
.si-link:hover { color: var(--text); }
.si-foot { margin-top: auto; padding-top: 24px; text-align: center; font-size: var(--size-s); color: var(--text-faint); }
.si-changes { position: fixed; z-index: 6100; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 440px; max-width: calc(100vw - 32px); max-height: 70vh; overflow-y: auto; padding: 18px 20px; }
.si-changes[hidden] { display: none; }
.si-changes-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.si-changes h3 { font: 500 var(--size-xl) var(--font-head); }
.si-changes ul { margin-left: 16px; font-size: var(--size-m); line-height: 1.55; color: var(--text-muted); }
.si-changes li { margin: 4px 0; }
.si-changes .refs { color: var(--success); }
/* stacked (phones and narrow windows): terms first, read on the page scroll */
@media (max-width: 899px) {
    .si-wrap { padding: 16px; align-items: flex-start; }
    .si-row { flex-direction: column; gap: 16px; }
    .si-access { flex: none; width: 100%; }
    .si-access { padding: 26px 20px 20px; }
    .si-access h1 { font-size: 26px; }
}
.beta-msg { display: none; font-size: var(--size-m); color: var(--danger); margin: 6px 0; }
.beta-msg.visible { display: block; }
body.beta-locked #wizard { visibility: hidden; }
/* the page starts locked (app.html): nothing but the sign-in page is drawn until a code is accepted, so the tool
   never shows while the page loads; beta.js unlocks it (straight away when config.js has the beta off) */
body.beta-locked > :not(#beta-gate) { visibility: hidden; }

/* ─── BETA FEEDBACK ─── */
#feedback-modal { z-index: 3000; }
#fb-zoom, #fb-permission { z-index: 3100; }
.fb-card { width: 580px; }
.fb-card textarea, #fb-copy-text { width: 100%; margin-top: 6px; padding: 7px 9px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-small); color: var(--text); font: var(--size-m) var(--font-body); resize: vertical; outline: none; }
.fb-card textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus); }
.fb-question { font-size: var(--size-m); color: var(--text); margin: 12px 0 4px; }
.fb-choices { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.fb-choices .btn { flex: 1; }
.btn.fb-choice.selected, #fb-pick-none.selected { background: var(--bg-active); border-color: var(--accent-2); color: var(--text); }
.fb-steps { font-size: var(--size-m); color: var(--text); margin: 6px 0 6px 18px; }
.fb-status { font-size: var(--size-m); color: var(--accent-soft); margin: 6px 0; }
.fb-pairs { list-style: none; font-size: var(--size-m); color: var(--text); margin: 6px 0; }
.fb-pairs li { margin: 3px 0; }
.fb-shots { display: flex; gap: 8px; margin: 8px 0; }
.fb-shots figure { flex: 1; margin: 0; border: 2px solid var(--border-strong); border-radius: var(--radius-small); padding: 4px; text-align: center; }
.fb-shots figure.chosen { border-color: var(--accent-2); }
.fb-shots img { width: 100%; height: 150px; object-fit: contain; background: var(--bg); cursor: zoom-in; display: block; }
.fb-shots figcaption .btn { width: 100%; margin-top: 4px; }
.fb-captured { margin: 10px 0; font-size: var(--size-s); color: var(--text-muted); }
.fb-captured summary { cursor: pointer; color: var(--text); }
.fb-captured pre { max-height: 180px; overflow: auto; font: var(--size-xs) var(--font-mono); background: var(--bg); padding: 6px; border-radius: var(--radius-small); margin-top: 6px; white-space: pre-wrap; }
.fb-zoom-card { width: auto; max-width: 92vw; }
.fb-zoom-card img { max-width: 88vw; max-height: 74vh; display: block; background: var(--bg); }
#feedback-modal.docked { background: none; backdrop-filter: none; pointer-events: none; justify-content: flex-end; align-items: flex-start; padding: calc(var(--topbar) + 14px) 16px 0 0; }
#feedback-modal.docked .modal-card { pointer-events: auto; width: 330px; border-color: var(--draw-pick); }
body.beta-locked #feedback-modal { visibility: hidden; }

/* ─── MANOEUVRE LIST ─── */
#mv-list { display: flex; flex-direction: column; gap: 3px; }
.mv-row { display: flex; align-items: center; gap: 3px; padding: 3px 4px; border-radius: var(--radius-small); border: 1px solid transparent; cursor: pointer; font-size: var(--size-m); color: var(--text); transition: background var(--ease), border-color var(--ease); }
.mv-row:hover { background: var(--bg-hover); }
.mv-row.active { background: var(--bg-active); border-color: var(--accent-2); }
.mv-row.hidden-m .mv-text, .mv-row.hidden-m .mv-note { display: block; font-size: var(--size-xs); color: var(--warning); white-space: normal; line-height: 1.35; }
.mv-legs { opacity: 0.5; }
.mv-row.drop-target { border-color: var(--draw-pick); }
.mv-row.dragging { opacity: 0.5; }
.icon-btn[aria-pressed="true"][data-act="lock"] { color: var(--warning); }
.mv-num { width: 16px; text-align: right; color: var(--text-faint); font: var(--size-s) var(--font-mono); }
.mv-tag { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }
.mv-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; margin-left: 4px; }
.mv-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-veh { font-size: var(--size-xs); color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-legs { font: var(--size-xs) var(--font-mono); color: var(--text-faint); white-space: nowrap; }
.mv-rename { flex: 1; min-width: 0; padding: 2px 6px; }

/* ─── BEND RADIUS ─── */
#bend-card { position: fixed; z-index: 30; display: none; min-width: 210px; padding: 9px 12px; font-size: var(--size-m); color: var(--text-muted); cursor: pointer; border-radius: var(--radius-input); }
#bend-card.visible { display: block; }
#bend-card b { color: var(--text); font-family: var(--font-mono); font-weight: 500; }
#bend-card .bc-row { display: flex; gap: 14px; align-items: center; }
#bend-card .bc-row + .bc-row { margin-top: 3px; }
#bend-card .bc-note { margin-top: 4px; color: var(--danger); font-weight: 600; }
#bend-card .bc-range { font-size: var(--size-xs); color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }
#bend-card .bc-hint { margin-top: 4px; font-size: var(--size-xs); color: var(--text-faint); }
#bend-card input { width: 76px; padding: 2px 6px; font: var(--size-m) var(--font-mono); }
#bend-card select { width: auto; padding: 2px 4px; font-size: var(--size-s); }
#bend-pill { position: fixed; z-index: 31; display: none; pointer-events: none; transform: translateX(-50%); padding: 4px 11px; font-size: var(--size-s); color: var(--text); white-space: nowrap; border-radius: var(--radius-pill); }
#bend-pill.visible { display: block; }
/* Ctrl + scroll: how far the vehicle is turned ("+12°"), by it; red a moment at a limit */
#turn-tag { position: fixed; z-index: 31; display: none; pointer-events: none; transform: translateX(-50%); padding: 2px 8px; font: 500 var(--size-s) var(--font-mono); color: var(--text); white-space: nowrap; border-radius: var(--radius-pill); }
#turn-tag.visible { display: block; }
#turn-tag.limit { color: var(--danger); border-color: var(--danger); }

/* under 1100 px the sidebar collapses to icons (app.js sets rail-mode) */
@media (max-width: 1499px) {
    .tb-drawing .tb-revs { display: none; }
}
@media (max-width: 1279px) {
    .tb-chip.vehicle { display: none; }
}
@media (max-width: 1199px) {
    .tb-chip.steer { display: none; }
}
@media (max-width: 1099px) {
    .tb-drawing { display: none; }
    .tb-chip.speed { display: none; }
    .tb-project { flex-basis: 150px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
