/* Revlica (was EngineSound) website (23 Oct): the phone app's design (engine_sound/DESIGN.md, src/ui/theme.ts). Graphite, warm ivory text,
   blue only for the main action and selection (Revlica V2, 27 Oct); text on blue is graphite (5.3:1), never ivory (2.9:1). Every status has words and a
   shape, not colour alone. Target: the Tesla screen browser in landscape; phone and desktop adapt. */
:root{color-scheme:dark;--bg:#111820;--panel:#1C2530;--panelHi:#26303D;--line:#35404D;--ink:#F3EFE6;--dim:#A9B1BB;--faint:#7D8792;--accent:#268CFF;--redline:#FF684D;--ok:#A8D5BA;--wait:#F0BE67}
*{box-sizing:border-box}[hidden]{display:none!important}
html,body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.45 -apple-system,system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;-webkit-text-size-adjust:100%}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--wait);outline-offset:2px}
.app{max-width:1480px;margin:0 auto;padding:12px 20px 24px}
.top{display:flex;align-items:center;justify-content:space-between;min-height:40px;margin-bottom:10px}
.brand{display:flex;align-items:center}.brand img{display:block;height:44px;width:auto}
.brand small{font-size:13px;font-weight:600;letter-spacing:.3px;color:var(--dim);margin-left:12px}.brand small a{color:inherit;padding:10px 0}
.acct-none{margin:0 0 10px;padding:0 4px}
@media (prefers-reduced-motion:no-preference){@view-transition{navigation:auto}} /* matches the site, which opens this page: a mismatch throws on arrival */
.run{display:inline-flex;align-items:center;gap:8px;padding:0 14px;min-height:36px;border-radius:999px;background:var(--panel);font-size:14px;font-weight:700}
.run i{width:8px;height:8px;border-radius:50%;background:var(--accent)}
.layout{display:grid;gap:16px;grid-template-columns:minmax(0,1fr)}
.side{display:grid;gap:16px;align-content:start}
@media (min-width:900px) and (orientation:landscape){.layout{grid-template-columns:minmax(0,1.3fr) minmax(360px,1fr);align-items:start}}
.card{background:var(--panel);border-radius:20px;padding:16px 18px;min-width:0}
.lab,.kicker{font-size:13px;font-weight:700;letter-spacing:1.1px;text-transform:uppercase;color:var(--dim)}
.kicker.sel{color:var(--accent)}
.small{font-size:14px;line-height:1.45;color:var(--dim);margin:12px 0 0}

/* garage */
.garage-top{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:28px}
.badges{display:flex;gap:6px}
.badge{font-size:11px;font-weight:800;letter-spacing:.8px;border:1px solid var(--line);border-radius:999px;padding:3px 8px;color:var(--dim)}
.badge.free{color:var(--ok);border-color:var(--ok)}
.carousel{position:relative;margin:4px -18px 0}
.track{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
.track::-webkit-scrollbar{display:none}
.track.locked{overflow-x:hidden}
.slide{flex:0 0 100%;scroll-snap-align:center;scroll-snap-stop:always;padding:0 18px;min-width:0}
.slide.soon .art,.slide.soon .name,.slide.soon .tag{opacity:.55}
.art{width:100%;aspect-ratio:2.1/1;max-height:min(40vh,360px);margin:6px auto 4px;display:flex;align-items:center;justify-content:center} /* reserved before the art arrives: no layout shift (CLS 0.39 → 0, 4 Nov) */
.art picture{display:contents}
.art img{display:block;width:100%;height:100%;object-fit:contain}
.art .ph{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;color:var(--dim);font-size:56px;font-weight:800;letter-spacing:2px}
.art .ph small{font-size:13px;font-weight:600;letter-spacing:0;margin-top:4px}
.name{font-size:34px;font-weight:800;letter-spacing:-.6px;margin:0;line-height:1.15;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tag{font-size:18px;font-weight:700;color:var(--accent);margin:2px 0 0}
.arrow{position:absolute;top:calc(50% - 60px);width:64px;height:64px;border-radius:999px;border:1px solid var(--line);background:rgba(17,24,32,.82);font-size:38px;line-height:1;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0 0 6px}
.arrow.prev{left:10px}.arrow.next{right:10px}
.arrow:disabled{opacity:.3;cursor:default}
.dots{display:flex;justify-content:center;margin-top:6px}
.dots button{flex:0 1 36px;min-width:0;height:44px;border:0;background:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer}
.dots button i{width:8px;height:8px;border-radius:4px;background:var(--line);transition:width .2s}
.dots button[aria-selected=true] i{width:22px;background:var(--ink)}
.dots button.soon i{opacity:.5}
.dots button:disabled{cursor:default}
.specs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border-top:1px solid var(--line);border-bottom:1px solid var(--line);margin-top:8px}
.spec{padding:10px 0}.spec b{display:block;font-size:22px;font-weight:800;font-variant-numeric:tabular-nums}.spec span{font-size:13px;font-weight:600;color:var(--dim)}

/* drive */
/* rev counter (19 Nov): the phone app's dial (src/ui/Tach.tsx); app.ts draws the ticks per engine and turns the needle */
.dash{display:flex;align-items:center;justify-content:center;gap:18px;margin-top:4px}
.tach{flex:1;min-width:0;max-width:300px;height:auto}
.tach .rim{fill:none;stroke:var(--line);stroke-width:2}.tach .red{fill:none;stroke:var(--redline);stroke-width:6}
.tach .tick{stroke:var(--dim);stroke-width:1.4;stroke-linecap:round}.tach .tick.major{stroke:var(--ink);stroke-width:3}.tach .tick.hot{stroke:var(--redline)}
.tach text{text-anchor:middle;font-weight:700;fill:var(--ink)}.tach .num{font-size:19px}.tach .num.hot{fill:var(--redline)}
.tach .gear{font-size:70px;font-weight:800}.tach .rpm{font-size:20px;font-variant-numeric:tabular-nums}.tach .sim{font-size:11px;letter-spacing:1.4px;fill:var(--dim)}
.tach circle{fill:var(--panel);stroke:var(--line);stroke-width:2}
#tachNeedle{stroke:var(--accent);stroke-width:4.5;stroke-linecap:round;transform-origin:150px 150px;transition:transform .11s linear;opacity:0}
/* engine on: the drive view takes the page (19 Nov, Patrick): a large rev counter with this car's sound picks beside it; the garage returns on Stop */
body.running .garage{display:none}
body.running .status{font-size:20px;font-weight:700}.status[data-level=warn]{color:var(--wait)}
@media (min-width:900px) and (orientation:landscape){body.running .layout{grid-template-columns:minmax(0,1fr)}body.running .side{grid-template-columns:minmax(0,1.2fr) minmax(360px,1fr);align-items:start}body.running .tach{max-width:min(520px,52vh)}body.running .read b{font-size:84px}}
.read{min-width:0}
.read b{display:block;font-size:54px;font-weight:800;line-height:1.05;font-variant-numeric:tabular-nums;white-space:nowrap}
.read span{font-size:13px;font-weight:700;letter-spacing:1.1px;text-transform:uppercase;color:var(--dim)}
.status{display:flex;gap:10px;align-items:flex-start;min-height:48px;margin:12px 0;font-size:16px}
.status i{flex:none;width:20px;height:20px;margin-top:1px;border-radius:50%;border:2px solid var(--dim);font-style:normal;font-size:13px;font-weight:900;display:flex;align-items:center;justify-content:center}
.status[data-level=ok] i{border-color:var(--ok);color:var(--ok)}.status[data-level=ok] i::after{content:'✓'}
.status[data-level=wait] i{border-color:var(--wait);color:var(--wait)}.status[data-level=wait] i::after{content:'…'}
.status[data-level=warn] i{border-color:var(--wait);color:var(--wait);border-radius:4px}.status[data-level=warn] i::after{content:'!'}
.offer{border:1px solid var(--wait);border-radius:16px;padding:10px 12px;color:var(--wait);margin:0 0 12px}
.revpad{display:flex;align-items:center;justify-content:center;min-height:96px;margin:0 0 12px;border-radius:16px;border:2px solid var(--line);background:var(--panelHi);font-size:20px;font-weight:800;user-select:none;-webkit-user-select:none;touch-action:none;cursor:pointer}
.revpad.on{border-color:var(--accent);color:var(--accent)}
.actions{display:flex;gap:12px}
.btn{min-height:56px;border-radius:999px;border:1.5px solid var(--panelHi);background:var(--panelHi);padding:0 24px;font-size:17px;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;text-align:center}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--bg)}
.btn.stop{background:var(--ink);border-color:var(--ink);color:var(--bg)}
.btn.big{min-height:64px;font-size:19px}
.btn:disabled{opacity:.4;cursor:default}
.actions .btn{flex:1}.actions .btn.big{flex:1.6}
.btn.wide{width:100%;margin-top:12px}

/* settings */
.row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 0;border-top:1px solid var(--line)}
.lab+.row{border-top:0}
.row.col{flex-direction:column;align-items:stretch}
.row-t b{font-size:16px}.row-t small{display:block;font-size:14px;color:var(--dim);margin-top:2px}
.seg{display:flex;background:var(--bg);border-radius:999px;padding:4px;flex:none}
.seg button{min-height:48px;min-width:76px;border:0;border-radius:999px;background:none;font-weight:700;cursor:pointer;padding:0 14px}
.seg button[aria-checked=true]{background:var(--ink);color:var(--bg)}
input[type=range]{width:100%;height:48px;accent-color:var(--accent);margin:0}
.switch{position:relative;flex:none;width:76px;height:48px}.switch input{position:absolute;opacity:0;width:100%;height:100%;margin:0;cursor:pointer}
.switch span{position:absolute;inset:0;border-radius:999px;background:var(--line);transition:background .2s;pointer-events:none}
.switch span::after{content:'';position:absolute;top:5px;left:5px;width:38px;height:38px;border-radius:50%;background:var(--ink);transition:transform .2s}
.switch input:checked+span{background:var(--accent)}.switch input:checked+span::after{transform:translateX(28px)}
.switch input:focus-visible+span{outline:3px solid var(--wait);outline-offset:2px}

/* test tools (the v3 diagnostic, unchanged inside) */
.tools{margin-top:22px}
.tools>h2{font-size:22px;font-weight:700;margin:0}
.tool{background:var(--panel);border-radius:16px;margin:10px 0;padding:0 16px}
.tool>summary{min-height:56px;display:flex;align-items:center;font-weight:700;cursor:pointer}
.tool[open]>summary{border-bottom:1px solid var(--line)}
.tool>section{padding:4px 0 14px}
.tool h3{font-size:16px;margin:16px 0 4px}
.tools .grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:12px 0}
.tools .grid .card{background:var(--bg);border:1px solid var(--line);border-radius:12px;padding:12px;min-height:104px}
.tools .value{display:block;font-size:26px;font-weight:700;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.tools .label{font-size:14px;color:var(--dim)}
.tools small,.tools .muted{color:var(--dim)}
.tools .controls{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:12px 0}
.tools button{min-height:50px;padding:0 18px;border:1px solid var(--line);border-radius:999px;background:var(--panelHi);cursor:pointer}
.tools button.primary{background:var(--accent);border-color:var(--accent);color:var(--bg);font-weight:700}
.tools button:disabled{opacity:.45;cursor:default}
.tools label{display:inline-flex;align-items:center;gap:8px}
.tools input[type=number],.tools input[type=text],.tools select,.tools textarea{background:var(--bg);border:1px solid var(--line);border-radius:8px;padding:9px;max-width:100%}
.tools input[type=number]{width:110px}
.tools input[type=range]{width:170px;height:auto}
.tools #locationStatus,.tools #audioStatus{color:var(--wait)}
.tools #flash{min-height:95px;display:flex;align-items:center;justify-content:center;border:2px solid var(--line);border-radius:10px;font-size:26px;font-weight:650}
.tools #flash.on{background:var(--ink);color:var(--bg)}
.tools textarea{width:100%;height:220px;font:14px/1.4 ui-monospace,monospace}
.tools pre{font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap;overflow-wrap:anywhere}
.tools a{color:var(--ok)}
.tools audio{width:100%;max-width:420px}
.tools footer{margin:16px 0 0;font-size:14px;color:var(--dim)}
@media (max-width:950px){.tools .grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:650px){.tools .grid{grid-template-columns:repeat(2,minmax(0,1fr))}.app{padding:10px 16px 20px}.read b{font-size:40px}.name{font-size:28px}.arrow{width:52px;height:52px;font-size:32px}.actions{flex-wrap:wrap}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}}
@media (max-width:650px){.settings .row{flex-direction:column;align-items:stretch}.settings .seg{width:100%}.settings .seg button{flex:1;min-width:0}}
.row.col .seg{width:100%}.row.col .seg button{flex:1}
.tonenow{margin:2px 0 10px;display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}.tonenow .tl{color:var(--dim);font-size:14px}.tonenow b{color:var(--accent);font-size:22px}.tonenow small{color:var(--dim);font-size:14px}
.tones{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:4px;background:var(--bg);border-radius:18px;padding:4px}
.tones button{min-height:56px;border:0;border-radius:14px;background:none;color:inherit;cursor:pointer;text-align:left;padding:8px 14px;display:flex;flex-direction:column;justify-content:center}
.tones button b{font-size:16px}.tones button small{color:var(--dim);font-size:13px}
.tones button[aria-checked=true]{background:var(--ink);color:var(--bg)}.tones button[aria-checked=true] small{color:var(--bg);opacity:.75}

/* P2: first-run intro and the privacy/credits panel */
.about{margin-top:16px}.intro{margin:0 0 16px}body.running .intro{display:none}.small a{color:var(--ink)}.links a{display:inline-block;padding:10px 0}.intro h2{font-size:22px;margin:0 0 6px}.intro .btn{margin-top:12px}
.about>summary{min-height:48px;display:flex;align-items:center;font-weight:700;cursor:pointer}.about h3{font-size:15px;margin:14px 0 2px}.about p{white-space:pre-line}

/* A6: Revlica account card */
/* the account lives in the top right corner (18 Nov, Patrick): one button, the card opens under it */
.top-r{display:flex;align-items:center;gap:10px}.acct{position:relative}
.acct summary{display:inline-flex;align-items:center;min-height:44px;padding:0 18px;border-radius:999px;border:1.5px solid var(--line);font-size:15px;font-weight:700;cursor:pointer;list-style:none;white-space:nowrap}
.acct summary::-webkit-details-marker{display:none}.acct[open] summary{background:var(--panelHi);border-color:var(--panelHi)}
.acct-panel{position:absolute;right:0;top:calc(100% + 8px);z-index:20;width:min(440px,calc(100vw - 32px));border:1px solid var(--line);box-shadow:0 18px 40px rgba(0,0,0,.45)}
@media (max-width:650px){.brand img{height:36px}.brand small{display:none}.run{padding:0 10px;font-size:13px}.acct summary{padding:0 14px}}
.acct-row{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}.acct-row input{flex:1 1 220px;min-height:50px;border-radius:12px;border:1px solid var(--line);background:var(--bg);color:inherit;font-size:18px;padding:0 14px}
/* Before the script fills the Garage (4 Nov, measured CLS 0.39 on a throttled phone): reserve the slide (art box + name/tag), the dots,
   the specs and the note at their measured heights, so nothing below jumps when the first car arrives. */
.track:empty{padding-bottom:90px}.track:empty::before{content:'';display:block;width:calc(100% - 36px);aspect-ratio:2.1/1;max-height:min(40vh,360px);margin:6px auto 4px}
.dots:empty{min-height:44px}.specs:empty{min-height:77px}#carNote:empty{min-height:41px}
