/* Toy town: the look of the simulator shell. A bright diorama with chunky, outlined controls.
   Colour carries meaning: orange is the one primary action, blue is you and information, green is done and go,
   red-pink is a fault or "you wait", yellow is next, priority and attention. Nothing else uses those colours. */

/* ---------- fonts (self-hosted, subsetted; Rubik is only referenced in Russian and Arabic, so it only loads there) ---------- */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 600 800; font-display: swap;
  src: url(/simulator/fonts/bricolage-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 600 800; font-display: swap;
  src: url(/simulator/fonts/bricolage-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/simulator/fonts/dmsans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/simulator/fonts/dmsans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/simulator/fonts/rubik-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/simulator/fonts/rubik-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/simulator/fonts/rubik-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/simulator/fonts/rubik-cyrillic-ext.woff2) format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/simulator/fonts/rubik-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

/* ---------- tokens ---------- */
:root {
  --bg: #DDF0FF;
  --surface: #FFFFFF;
  --surface-2: #EDF6FF;
  --ink: #18264A;
  --ink-2: #44537C;
  --ink-3: #7C8BB0;
  --line: rgba(24, 38, 74, .18);
  --accent: #FF5A36;
  --on-accent: #FFFFFF;
  --cool: #2D7DFF;
  --go: #17A866;
  --hot: #E23B5A;
  --sun: #FFC933;
  --sky: #BFE6FF;
  /* soft tints carry small text in ink, so every label stays above 4.5:1 */
  --cool-soft: #DCE9FF;
  --go-soft: #D7F2E4;
  --hot-soft: #FBDDE3;
  --sun-soft: #FFF1C2;
  --accent-soft: #FFE2D9;
  --cool-deep: #1C5BD6;   /* white text on blue (the next-turn sign) */
  --hot-ink: #B8213F;     /* red text on white */
  --go-ink: #0E7A49;      /* green text on white */
  --outline: 2.5px;
  --shadow-panel: .3em .3em 0 var(--ink);
  --shadow-btn: .18em .18em 0 var(--ink);
  --shadow-badge: .14em .14em 0 var(--ink);
  --r-panel: 20px;
  --r-row: 12px;
  --pill: 999px;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --gutter: 1.2em;
  --bar-h: 4.6em;
  color-scheme: light;
  font-family: var(--font-body);
  font-size: clamp(14px, 1.05vw, 17px);
}
:root:lang(ru), :root:lang(ar) {
  --font-display: "Rubik", "Segoe UI", system-ui, sans-serif;
  --font-body: "Rubik", "Segoe UI", system-ui, sans-serif;
}
@media (max-width: 640px), (max-height: 500px) {
  :root { font-size: 15px; --gutter: .8em; }
}

/* ---------- base ---------- */
html, body { height: 100vh; height: 100dvh; background: #0f172a; color: var(--ink); overscroll-behavior: none; }
body { font-family: var(--font-body); line-height: 1.4; -webkit-font-smoothing: antialiased; }
body[data-page="drive"] { overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button, select, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.hidden { display: none !important; }
svg.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.18em; }
[dir="rtl"] svg.i.flip { transform: scaleX(-1); }
.t { font-family: var(--font-display); font-weight: 800; letter-spacing: -.015em; line-height: 1.05; }
.t.sub { font-weight: 600; }
.lbl { font-size: 12px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; color: var(--ink-2); line-height: 1.3; }
[dir="rtl"] .lbl, [dir="rtl"] .t { letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }
.mut { color: var(--ink-2); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
bdi.n { unicode-bidi: isolate; direction: ltr; }

/* ---------- panel ---------- */
.pnl { background: var(--surface); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: var(--r-panel); box-shadow: var(--shadow-panel); padding: 1.05em 1.15em; }
.pnl.tight { padding: .7em .8em; }
.row-in { background: var(--surface-2); border-radius: var(--r-row); padding: .6em .75em; }

/* ---------- buttons ---------- */
.tb { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 44px; padding: .5em 1.1em; border-radius: var(--pill);
  border: var(--outline) solid var(--ink); box-shadow: var(--shadow-btn); background: var(--surface); color: var(--ink);
  font-family: var(--font-display); font-weight: 800; letter-spacing: -.01em; font-size: 1.1em; line-height: 1.1; text-align: center; text-decoration: none; cursor: pointer;
  transition: transform .12s, box-shadow .12s, background-color .12s; -webkit-tap-highlight-color: transparent; }
.tb:hover { transform: translate(0, -1px); }
.tb:active, .tb.pressed { transform: translate(.12em, .12em); box-shadow: .06em .06em 0 var(--ink); }
.tb.primary { background: var(--accent); color: var(--on-accent); font-size: max(1.25em, 18.7px); padding-inline: 1.3em; }
.tb.ghost { background: var(--surface); }
.tb.clear { background: transparent; box-shadow: none; }
.tb.sm { font-size: 1em; padding: .35em .85em; }
.tb.icon { padding: 0; width: 44px; min-width: 44px; height: 44px; }
.tb.block { width: 100%; }
.tb[disabled], .tb[aria-disabled="true"] { color: var(--ink-3); border-color: var(--ink-3); box-shadow: none; cursor: default; transform: none; }
.tb svg.i { width: 1.1em; height: 1.1em; }
[dir="rtl"] .tb { letter-spacing: 0; }

/* text link button */
.lk { display: inline-flex; align-items: center; gap: .35em; min-height: 44px; padding: 0 .2em; color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 2px; background: none; border: 0; cursor: pointer; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: .4em; padding: .22em .7em; border-radius: var(--pill); background: var(--surface-2); color: var(--ink); font-size: .88em; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.chip.sun { background: var(--sun); color: var(--ink); }
.chip.go { background: var(--go-soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--go); }
.chip.hot { background: var(--hot-soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--hot); }
.chip.cool { background: var(--cool-soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--cool); }
.chip.out { background: var(--surface); border: var(--outline) solid var(--ink); box-shadow: var(--shadow-badge); }
.chip.wrap { white-space: normal; }
.chip svg.i { width: 1em; height: 1em; }
button.chip, a.chip { min-height: 44px; padding-inline: .95em; cursor: pointer; text-decoration: none; border: var(--outline) solid var(--ink); box-shadow: var(--shadow-badge); background: var(--surface); font-size: .95em; }
button.chip:active, a.chip:active { transform: translate(.12em, .12em); box-shadow: .06em .06em 0 var(--ink); }

/* ---------- mission badge ---------- */
.bdg { display: grid; place-items: center; width: 2.3em; height: 2.3em; flex: none; border-radius: 50%; position: relative;
  background: #fff; color: var(--ink); box-shadow: inset 0 0 0 .16em var(--ink), var(--shadow-badge);
  font-family: var(--font-display); font-weight: 800; font-size: 1.05em; letter-spacing: 0; font-variant-numeric: tabular-nums; line-height: 1; }
.bdg.done { background: var(--go); color: #fff; }
.bdg.done svg.i { width: 1.25em; height: 1.25em; stroke-width: 3; }
.bdg.next { background: var(--sun); color: var(--ink); }
.bdg.shut { background: var(--surface-2); color: var(--ink-3); box-shadow: inset 0 0 0 .16em var(--ink-3); }
.bdg .lock { position: absolute; inset-inline-end: -.35em; bottom: -.3em; width: 1.25em; height: 1.25em; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.bdg .lock svg.i { width: .78em; height: .78em; stroke-width: 2.6; }
@media (prefers-reduced-motion: no-preference) {
  .bdg.next.bounce { animation: tt-bounce 1.6s ease-in-out infinite; }
}
@keyframes tt-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-.28em); } }

/* ---------- place tag ---------- */
.ort { display: inline-flex; flex-direction: column; align-items: flex-start; background: var(--sun); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: .8em;
  box-shadow: .2em .2em 0 var(--ink); rotate: -1.5deg; padding: .3em .75em .35em; line-height: 1.05; text-align: start; }
.ort .t { font-size: 1.35em; white-space: nowrap; }
.ort small { display: block; align-self: stretch; font-size: .74em; font-weight: 600; border-top: 1.5px solid var(--ink); margin-top: .25em; padding-top: .22em; letter-spacing: .02em; white-space: nowrap; }
[dir="rtl"] .ort { rotate: 1.5deg; }

/* ---------- bars ---------- */
.bar { height: .55em; border-radius: var(--pill); background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1.5px var(--line); }
.bar > i { display: block; height: 100%; border-radius: var(--pill); background: var(--cool); transform-origin: left center; }
.bar > i.low { background: var(--hot); }
[dir="rtl"] .bar > i { transform-origin: right center; }

/* ---------- form controls ---------- */
.tseg { display: inline-flex; flex-wrap: wrap; gap: .3em; padding: .25em; border-radius: var(--r-row); background: var(--surface-2); }
.tseg button { min-height: 44px; padding: .3em .85em; border-radius: calc(var(--r-row) - 3px); font-weight: 600; color: var(--ink-2); border: 2px solid transparent; background: none; cursor: pointer; }
.tseg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); border-color: var(--ink); box-shadow: var(--shadow-badge); }
.sw { display: inline-flex; align-items: center; gap: .6em; min-height: 44px; cursor: pointer; font-weight: 600; background: none; border: 0; padding: 0; color: var(--ink); text-align: start; }
.sw i { width: 2.6em; height: 1.5em; border-radius: var(--pill); background: var(--surface-2); border: 2px solid var(--ink); position: relative; flex: none; transition: background-color .15s; }
.sw i::after { content: ""; position: absolute; inset-inline-start: .14em; top: 50%; width: 1em; height: 1em; margin-top: -.5em; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.sw[aria-checked="true"] i { background: var(--cool); }
.sw[aria-checked="true"] i::after { background: #fff; transform: translateX(1.05em); }
[dir="rtl"] .sw[aria-checked="true"] i::after { transform: translateX(-1.05em); }
.tt-range { width: 100%; accent-color: var(--cool); min-height: 44px; }
select.tt-sel { min-height: 44px; padding: .3em 2em .3em .8em; border: 2px solid var(--ink); border-radius: var(--r-row); background: var(--surface); color: var(--ink); font-weight: 600; }

/* ---------- licence plate ---------- */
.plate { display: inline-flex; align-items: stretch; height: 2.15em; background: #fff; color: #18264A; border: 2.5px solid var(--ink); border-radius: .4em; box-shadow: var(--shadow-badge); overflow: hidden; direction: ltr;
  font-family: var(--font-display); font-weight: 800; letter-spacing: .05em; white-space: nowrap; line-height: 1; font-variant-numeric: tabular-nums; }
.plate::before { content: "D"; display: grid; place-items: end center; padding: 0 .32em .2em; background: #1E44A8; color: #fff; font-size: .62em; letter-spacing: 0; font-family: var(--font-body); }
.plate span { display: grid; place-items: center; padding: 0 .55em; font-size: 1.02em; }

/* ---------- layers ---------- */
#scene { position: fixed; inset: 0; width: 100%; height: 100vh; height: 100dvh; display: block; outline: none; touch-action: none; }
#rain-layer { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
#tilt { position: fixed; inset: 0; z-index: 2; pointer-events: none; display: none;
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  -webkit-mask-image: linear-gradient(#000 0, transparent 26%, transparent 76%, #000 100%); mask-image: linear-gradient(#000 0, transparent 26%, transparent 76%, #000 100%); }
body[data-page="home"] #tilt, body[data-page="missions"] #tilt, body[data-page="brief"] #tilt { display: block; }
body.q-low #tilt { display: none !important; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
#pins { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }

/* ---------- top bar ---------- */
#header.topbar { position: fixed; z-index: 20; top: 0; inset-inline: 0; display: flex; align-items: center; gap: .8em; padding: calc(.8em + var(--safe-t)) calc(var(--gutter) + var(--safe-r)) .4em calc(var(--gutter) + var(--safe-l)); background: none; pointer-events: none; }
#header.topbar > * { pointer-events: auto; }
body[data-page="drive"] #header, body[data-page="boot"] #header { display: none; }
body[data-page="brief"] #header.topbar { display: flex; }
.brandtag { font-size: .92em; cursor: pointer; text-decoration: none; flex: none; min-height: 44px; justify-content: center; }
.brandtag:hover { transform: translate(0, -1px); }
.dest { display: flex; gap: .2em; padding: .25em; border-radius: var(--pill); background: var(--surface); border: var(--outline) solid var(--ink); box-shadow: var(--shadow-btn); }
.dest button { display: flex; align-items: center; gap: .45em; min-height: 44px; padding: .35em .95em; border-radius: var(--pill); font-weight: 600; color: var(--ink-2); white-space: nowrap; background: none; border: 0; cursor: pointer; }
.dest button:hover { color: var(--ink); background: var(--surface-2); }
.dest button[aria-current="page"] { background: var(--ink); color: #fff; }
.dest button svg.i { width: 1.2em; height: 1.2em; }
.topbar .me { margin-inline-start: auto; display: flex; align-items: center; gap: .55em; flex: none; }
.tt-unlock { min-height: 44px; padding: .28em .85em; font-size: .88em; white-space: nowrap; }
.tt-unlock[hidden] { display: none; }
.setbtn { display: inline-flex; align-items: center; gap: .45em; min-height: 44px; min-width: 44px; padding: .3em .85em .3em .72em; border-radius: var(--pill); background: var(--surface); border: var(--outline) solid var(--ink); box-shadow: var(--shadow-btn); font-weight: 700; color: var(--ink); cursor: pointer; }
.setbtn:active { transform: translate(.12em, .12em); box-shadow: .06em .06em 0 var(--ink); }
.setbtn b { font-weight: 700; letter-spacing: .04em; }
.header-actions, #nav, #brand-home { display: none !important; }
.modeseg { display: inline-flex; align-items: center; gap: .2em; padding: .22em; border-radius: var(--pill); background: var(--surface); border: var(--outline) solid var(--ink); box-shadow: var(--shadow-btn); flex: none; }
.mode-opt { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: .25em .72em; border-radius: var(--pill); font-size: .82em; font-weight: 700; color: var(--ink-2); white-space: nowrap; text-decoration: none; cursor: pointer; }
.mode-opt:hover:not(.active) { color: var(--ink); background: var(--surface-2); }
.mode-opt.active { background: var(--ink); color: #fff; cursor: default; }
@media (max-width: 1440px) {
  #header.topbar { flex-wrap: wrap; row-gap: .45em; }
  .modeseg { order: 4; }
}
@media (max-width: 760px) {
  #header.topbar { flex-wrap: wrap; gap: .45em .5em; padding-top: calc(.55em + var(--safe-t)); }
  .brandtag { font-size: .8em; }
  .dest { order: 3; width: 100%; justify-content: space-between; border-radius: var(--r-panel); padding: .2em; }
  .dest button { flex: 1 1 0; flex-direction: column; gap: .12em; padding: .3em .2em; font-size: 11.5px; border-radius: calc(var(--r-panel) - 5px); min-width: 0; min-height: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; line-height: 1.15; }
  .dest button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .dest button svg.i { width: 1.45em; height: 1.45em; }
  .modeseg { order: 4; width: 100%; display: grid; grid-template-columns: 1fr 1fr; border-radius: var(--r-panel); padding: .2em; }
  .mode-opt { min-height: 44px; font-size: 11.5px; line-height: 1.15; padding: .25em .45em; text-align: center; white-space: normal; border-radius: calc(var(--r-panel) - 5px); }
  .tt-unlock { min-height: 44px; padding: .2em .72em; font-size: 12.5px; }
  .setbtn { padding-inline: .68em; }
}
@media (max-width: 540px) {
  /* phones 360-540px: keep brand + Unlock + Settings cleanly on row 1 with >=44px targets and zero truncation */
  #header.topbar { gap: .36em .36em; padding-inline: calc(10px + var(--safe-l)) calc(10px + var(--safe-r)); }
  .brandtag { font-size: .72em; flex: 1 1 0; min-width: 0; max-width: max-content; rotate: 0deg; overflow: hidden; padding: .24em .54em; }
  [dir="rtl"] .brandtag { rotate: 0deg; }
  .brandtag .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .brandtag small { display: none; }
  .topbar .me { gap: .32em; flex: 0 1 auto; min-width: 0; }
  .tt-unlock { min-height: 44px; max-width: none; padding: 0 .66em; font-size: 12px; gap: .28em; flex: 0 0 auto; }
  .tt-unlock span { white-space: nowrap; }
  .setbtn { padding-inline: .52em; gap: .24em; font-size: 12px; flex: 0 0 auto; }
  #header.has-unlock .plate { display: none; }
}
@media (max-width: 440px) {
  .plate { display: none; }
  .brandtag { font-size: .66em; padding: .22em .46em; }
  .tt-unlock { min-height: 44px; max-width: none; font-size: 11.5px; padding: 0 .58em; }
  .setbtn { padding-inline: .46em; font-size: 12px; }
}
@media (max-height: 500px) and (min-width: 560px) {
  /* landscape phone: icons only in nav pill, compact mode switcher */
  #header.topbar { flex-wrap: wrap; padding-top: calc(.4em + var(--safe-t)); gap: .4em .5em; }
  .brandtag { rotate: 0deg; font-size: .78em; }
  [dir="rtl"] .brandtag { rotate: 0deg; }
  .brandtag small { display: none; }
  .dest { order: 0; width: auto; }
  .dest button { flex-direction: row; font-size: .9em; min-width: 44px; justify-content: center; padding: .3em .7em; }
  .dest button span { display: none; }
  .modeseg { order: 4; width: auto; display: inline-flex; padding: .16em; }
  .mode-opt { min-height: 36px; font-size: 11px; padding: .2em .55em; white-space: nowrap; }
}

/* ---------- pages ---------- */
#page { position: fixed; inset: 0; height: 100vh; height: 100dvh; z-index: 10; pointer-events: none; overflow: hidden; }
#page > * { pointer-events: auto; }
#page > .screen { pointer-events: none; position: absolute; inset: 0; }
#page:has(> .screen) { background: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
#page > .screen .pnl, #page > .screen button, #page > .screen a, #page > .screen input, #page > .screen select, #page > .screen .hit { pointer-events: auto; }

/* ---------- sheet: a side panel or centred card on desktop, rising from the bottom on phones ---------- */
#modal-root:has(> .sheet-wrap) { background: none; padding: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.sheet-wrap { position: fixed; inset: 0; height: 100vh; height: 100dvh; z-index: 32; display: flex; align-items: stretch; justify-content: flex-end; padding: calc(.9em + var(--safe-t)) calc(var(--gutter) + var(--safe-r)) calc(var(--gutter) + var(--safe-b)) calc(var(--gutter) + var(--safe-l)); }
.sheet-wrap.card { align-items: center; justify-content: center; }
.scrim { position: absolute; inset: 0; background: rgba(8, 14, 26, .46); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet { position: relative; display: flex; flex-direction: column; width: min(28em, 100%); max-height: 100%; padding: 0; overflow: hidden; }
.sheet-wrap.card .sheet { width: min(34em, 100%); max-height: min(46em, 100%); }
.sheet-wrap.wide .sheet { width: min(44em, 100%); }
.sheet-head { display: flex; align-items: center; gap: .7em; padding: 1em 1.15em .6em; flex: none; }
.sheet-head h2 { margin: 0; font-size: 1.65em; flex: 1; min-width: 0; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .2em 1.15em calc(1.2em + var(--safe-b)); -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.sheet-grab { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .sheet-wrap .sheet { animation: tt-in-side .22s ease-out; }
  .sheet-wrap.card .sheet { animation: tt-in-card .2s ease-out; }
}
@keyframes tt-in-side { from { transform: translateX(1.2em); opacity: 0; } }
[dir="rtl"] .sheet-wrap .sheet { animation-name: tt-in-side-rtl; }
@keyframes tt-in-side-rtl { from { transform: translateX(-1.2em); opacity: 0; } }
@keyframes tt-in-card { from { transform: translateY(.8em) scale(.98); opacity: 0; } }
@media (max-width: 768px) and (min-height: 501px) {
  .sheet-wrap, .sheet-wrap.card { align-items: flex-end; justify-content: stretch; padding: calc(2.4em + var(--safe-t)) 0 0; }
  .sheet, .sheet-wrap.card .sheet, .sheet-wrap.wide .sheet { width: 100%; max-height: 86vh; max-height: 86dvh; border-radius: var(--r-panel) var(--r-panel) 0 0; border-bottom: 0; box-shadow: 0 -8px 32px rgba(0, 0, 0, .35); transition: transform .2s ease-out; }
  .sheet-grab { display: block; width: 3.2em; height: .36em; border-radius: var(--pill); background: var(--ink-3); margin: .6em auto 0; flex: none; touch-action: none; }
  .sheet-head { padding-top: .5em; touch-action: none; }
  .sheet-body { padding-bottom: calc(1.4em + var(--safe-b)); }
  @media (prefers-reduced-motion: no-preference) {
    .sheet-wrap .sheet, .sheet-wrap.card .sheet { animation: tt-in-up .24s ease-out; }
  }
}
@media (max-height: 500px) {
  .sheet-wrap, .sheet-wrap.card { padding: calc(.5em + var(--safe-t)) calc(.8em + var(--safe-r)) calc(.5em + var(--safe-b)) calc(.8em + var(--safe-l)); }
  .sheet, .sheet-wrap.card .sheet { max-height: calc(100dvh - 1em - var(--safe-t) - var(--safe-b)); }
  .sheet-head { padding: .65em 1em .4em; }
  .sheet-head h2 { font-size: 1.35em; }
}
@keyframes tt-in-up { from { transform: translateY(40%); opacity: .4; } }

/* ---------- settings ---------- */
.set-sec { padding: .85em 0; border-top: 2px solid var(--line); }
.set-sec:first-child { border-top: 0; padding-top: .2em; }
.set-sec > .lbl { display: block; margin-bottom: .55em; }
.set-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35em .8em; padding: .3em 0; }
.set-row > .name { font-weight: 600; flex: 1 1 10em; min-width: 0; }
.set-row.stack { flex-direction: column; align-items: stretch; }
.set-row.stack > .name { flex: none; }
.set-row .tseg { flex: none; }
.set-note { font-size: .88em; color: var(--ink-2); margin: .1em 0 0; }
.tkeys { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35em .8em; font-size: .92em; align-items: center; }
.tkeys dt { color: var(--ink-2); }
.tkeys dd { margin: 0; text-align: end; }
.tkeys.tkeys-touch { grid-template-columns: minmax(0, .85fr) minmax(0, 1.35fr); gap: .5em .8em; }
.tkeys.tkeys-touch dt { color: var(--ink); font-weight: 700; }
.tkeys.tkeys-touch dd.ps-touch-desc { color: var(--ink-2); font-size: .92em; text-align: start; line-height: 1.35; }
.kbd { display: inline-block; min-width: 1.7em; padding: .08em .45em; border-radius: .4em; border: 2px solid var(--ink); background: var(--surface); box-shadow: .1em .1em 0 var(--ink); font-family: var(--font-body); font-weight: 700; font-size: .85em; line-height: 1.3; text-align: center; color: var(--ink); direction: ltr; unicode-bidi: isolate; }
.langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5em, 1fr)); gap: .4em; }
.langs a { display: flex; align-items: center; justify-content: space-between; gap: .5em; min-height: 44px; padding: .35em .75em; border-radius: var(--r-row); border: 2px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; }
.langs a[aria-current="true"] { border-color: var(--ink); background: var(--surface-2); box-shadow: var(--shadow-badge); }
.langs a small { color: var(--ink-2); font-weight: 700; letter-spacing: .06em; }

/* ---------- toast ---------- */
.toast { position: fixed; z-index: 40; left: 50%; top: calc(var(--top-h, 5em) + .5em); bottom: auto; transform: translateX(-50%) translateY(-.4em); max-width: min(34em, calc(100vw - 2em)); padding: .55em 1.1em; border-radius: var(--pill);
  background: rgba(12, 18, 30, .9); color: #f8fafc; border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-weight: 600; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.warn { background: rgba(120, 62, 8, .94); color: #fef3c7; border: 1px solid rgba(251, 191, 36, .55); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
body:not(.has-touch)[data-page="drive"] .toast { top: calc(52px + var(--safe-t)); font-size: 13.5px; }
body.has-touch[data-page="drive"] .toast { top: var(--hud-toast-top, calc(242px + var(--safe-t))); max-width: min(244px, calc(100vw - 116px)); padding: 6px 12px; font-size: 13px; line-height: 1.3; }
@media (max-height: 500px) and (min-width: 560px) {
  body.has-touch[data-page="drive"] .toast { top: var(--hud-toast-top, calc(104px + var(--safe-t))); max-width: min(340px, calc(100vw - 340px)); padding: 5px 11px; font-size: 12.5px; }
}

/* ---------- boot, could-not-start, rotate ---------- */
#boot { position: fixed; inset: 0; height: 100vh; height: 100dvh; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.1em; padding: 1.5em;
  background: radial-gradient(circle at 50% 35%, #1e293b 0%, #0f172a 72%); color: #f8fafc; transition: opacity .5s; text-align: center; }
#boot.gone { opacity: 0; pointer-events: none; }
#boot .ort { font-size: 1.35em; }
#boot .wordmark { display: block; font-weight: 700; color: #94a3b8; letter-spacing: .02em; margin: 0; }
.load-bar { width: min(22em, 80vw); height: .65em; padding: 2px; border-radius: var(--pill); background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); box-shadow: none; }
.load-bar > i { display: block; height: 100%; width: calc(var(--p, .06) * 100%); min-width: .7em; border-radius: var(--pill); background: linear-gradient(90deg, #3b82f6, #38bdf8); transition: width .35s ease-out; }
#boot-status { min-height: 1.4em; color: #cbd5e1; font-weight: 600; }
#fatal { position: fixed; inset: 0; height: 100vh; height: 100dvh; z-index: 60; display: grid; place-items: center; padding: 1.2em; background: #0f172a; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.fallback-card { max-width: 30em; display: flex; flex-direction: column; align-items: flex-start; gap: .9em; }
.fallback-card h1 { margin: 0; font-size: 2em; }
.fallback-card p { margin: 0; color: var(--ink-2); }
.fallback-card .acts { display: flex; flex-wrap: wrap; gap: .6em; margin-top: .3em; }
#rotate { position: fixed; inset: 0; height: 100vh; height: 100dvh; z-index: 45; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1.2em; padding: 1.5em; background: #0f172a; color: #f8fafc; text-align: center; font-weight: 700; font-size: 1.1em; }
#rotate::after { content: none; }
#rotate .phone { width: 3.2em; height: 5.4em; border-radius: .7em; border: 3px solid #f8fafc; background: rgba(255, 255, 255, .08); position: relative; }
@media (prefers-reduced-motion: no-preference) { #rotate .phone { animation: tt-turn 2.4s ease-in-out infinite; } }
@keyframes tt-turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }

/* ---------- pins over the town ---------- */
#pins { display: none; }
#pins.on { display: block; }
body:not([data-page="home"]):not([data-page="missions"]):not([data-page="brief"]) #pins { display: none; }
body.xe-boot #pins, body.tz-boot #pins { visibility: hidden; }
#pins .leads { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#pins .leads line { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
#pins .leads circle { fill: var(--ink); stroke: #fff; stroke-width: 1.5; }
#pins .pinset, #pins .tags { position: absolute; inset: 0; }
.pin { position: absolute; left: 0; top: 0; width: 0; height: 0; padding: 0; border: 0; background: none; color: var(--ink); pointer-events: auto; cursor: pointer; will-change: transform; }
.pin .bdg { position: absolute; left: 0; top: 0; margin: -1.15em 0 0 -1.15em; }
.pin .bdg::before { content: ""; position: absolute; inset: -.4em; border-radius: 50%; }
.pin .bdg.shut { color: var(--ink-2); }
.pin:focus-visible { outline: none; }
.pin:focus-visible .bdg { outline: 3px solid var(--ink); outline-offset: 3px; }
.pin.sel { z-index: 3; }
.pin:hover, .pin:focus-visible { z-index: 4; }
.pin.sel .bdg { box-shadow: inset 0 0 0 .16em var(--ink), 0 0 0 .2em #fff, 0 0 0 .4em var(--cool); }
.pin.dim .bdg { opacity: .5; scale: .82; }
.pin-t { position: absolute; top: -.85em; inset-inline-start: 1.55em; display: none; padding: .2em .7em; border-radius: var(--pill); background: var(--surface); color: var(--ink);
  border: 2px solid var(--ink); box-shadow: var(--shadow-badge); font-weight: 700; font-size: .9em; line-height: 1.3; white-space: nowrap; pointer-events: none; }
.pin:hover .pin-t, .pin:focus-visible .pin-t, .pin.sel .pin-t { display: block; }
.ptag { position: absolute; left: 0; top: 0; font-size: .82em; pointer-events: none; will-change: transform; }
.ptag.dim { opacity: .6; }

/* ---------- screens: shared ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .4em; }
#page > .screen .tb { pointer-events: auto; }

/* ---------- Today ---------- */
.today-col { position: absolute; inset-inline-start: calc(var(--gutter) + var(--safe-l)); bottom: calc(var(--gutter) + var(--safe-b)); width: min(34em, calc(100% - 2 * var(--gutter)));
  max-height: calc(100% - var(--top-h, 4.6em) - var(--gutter) - var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; display: flex; flex-direction: column; gap: .7em; padding: .3em .5em .5em .2em; margin: -.3em -.5em -.5em -.2em; }
.next-card { display: flex; flex-direction: column; align-items: flex-start; gap: .55em; flex: none; }
.next-card h1 { margin: 0; font-size: 2.55em; }
.next-card .tb.primary { margin-top: .3em; }
.slim { display: flex; align-items: center; gap: .8em; width: 100%; min-height: 44px; padding: .55em .9em; text-align: start; cursor: pointer; flex: none; text-decoration: none; }
.slim .ic { display: grid; place-items: center; width: 2.4em; height: 2.4em; border-radius: 50%; background: var(--surface-2); flex: none; }
.slim .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.slim b { font-family: var(--font-display); font-weight: 800; font-size: 1.1em; letter-spacing: -.01em; }
.slim small { color: var(--ink-2); font-size: .88em; }
.slim:active { transform: translate(.12em, .12em); box-shadow: .1em .1em 0 var(--ink); }
.today-col #ext-home { display: flex; flex-direction: column; gap: .7em; }
.today-col .xe-home, .today-col .tz-home { display: flex; align-items: center; gap: .8em; width: 100%; max-width: none; margin: 0; padding: .55em .9em; border-radius: var(--r-panel);
  background: var(--surface); color: var(--ink); border: var(--outline) solid var(--ink); box-shadow: var(--shadow-panel); text-align: start; font: inherit; cursor: pointer; }
.today-col .xe-home:hover, .today-col .tz-home:hover { border-color: var(--ink); }
.today-col .xe-home .art, .today-col .tz-art { width: 2.4em; height: 2.4em; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); }
.today-col .xe-home .art svg { width: 1.5em; height: 1.5em; }
.today-col .tz-art svg { width: 100%; height: 100%; }
.today-col .xe-home em, .today-col .tz-txt em { display: block; padding: 0; margin: 0 0 .1em; background: none; color: var(--ink-2); font-style: normal; font-size: 12px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }
[dir="rtl"] .today-col .xe-home em, [dir="rtl"] .today-col .tz-txt em { letter-spacing: 0; }
.today-col .xe-home b.tt, .today-col .tz-txt b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.1em; line-height: 1.15; letter-spacing: -.01em; }
.today-col .xe-home small, .today-col .tz-txt small, .today-col .xe-home .go i, .today-col .tz-go i { display: none; }
.today-col .xe-home > span:nth-child(2), .today-col .tz-txt { flex: 1; min-width: 0; }
.today-col .xe-home .go, .today-col .tz-go { grid-column: auto; margin-inline-start: auto; flex: none; }
.today-col .xe-home .go b, .today-col .tz-go b { display: inline-flex; align-items: center; gap: .35em; min-height: 36px; padding: .2em .85em; border-radius: var(--pill); background: var(--surface-2); color: var(--ink); border: 2px solid var(--ink); font-size: .9em; font-weight: 700; }
.today-col #xe-ready { display: none; }
.today-col .x-credits { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: .2em .9em; border-radius: var(--pill); background: var(--surface); color: var(--ink-2); font-size: .8em; opacity: 1; }
.ready-card { position: absolute; inset-inline-end: calc(var(--gutter) + var(--safe-r)); bottom: calc(var(--gutter) + var(--safe-b)); width: 21em; }
.rd-top { display: flex; align-items: baseline; flex-wrap: wrap; gap: .2em .7em; margin: .25em 0 .6em; }
.rd-pct { font-size: 3.1em; line-height: 1; }
.skills { list-style: none; margin: 0; padding: 0; display: grid; gap: .38em; }
.skills li { display: grid; grid-template-columns: minmax(0, 8.8em) 1fr 1.9em; align-items: center; gap: .6em; font-size: .9em; }
.skills .sk { overflow-wrap: anywhere; line-height: 1.15; }
.skills b { text-align: end; font-variant-numeric: tabular-nums; }
.weak { margin: .75em 0 .45em; font-size: .92em; font-weight: 600; }
.fine { margin: .75em 0 0; font-size: .78em; color: var(--ink-2); }
.ready-chip { display: none; }
.ready-sheet .rd-top { margin-top: 0; }

/* ---------- Town map ---------- */
.tm-chips { position: absolute; top: calc(var(--top-h, 4.6em) + .35em); inset-inline-start: calc(var(--gutter) + var(--safe-l)); display: flex; flex-wrap: wrap; gap: .45em; max-width: min(64em, calc(100% - 2 * var(--gutter))); }
.townmap.has-brief .tm-chips { max-width: calc(100% - 27em - 3 * var(--gutter)); }
.tm-chips .chip { font-size: .9em; }
.tm-stages { position: absolute; inset-inline-start: calc(var(--gutter) + var(--safe-l)); bottom: calc(var(--gutter) + var(--safe-b)); width: 19.5em; padding: .8em .75em .75em; }
.tm-stages ol { list-style: none; margin: .5em 0 0; padding: 0; display: grid; gap: .3em; }
.tm-stages button { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: .6em; width: 100%; min-height: 44px; padding: .35em .6em .35em .7em;
  border-radius: var(--r-row); border: 2px solid transparent; background: var(--surface-2); color: var(--ink); text-align: start; cursor: pointer; line-height: 1.2; }
.tm-stages button:hover { border-color: var(--line); }
.tm-stages button[aria-pressed="true"] { border-color: var(--ink); background: var(--sun-soft); box-shadow: var(--shadow-badge); }
.tm-stages .st-d { grid-column: 1; font-size: .78em; font-weight: 700; color: var(--ink-2); }
.tm-stages .st-n { grid-column: 1; font-weight: 700; }
.tm-stages .chip { grid-column: 2; grid-row: 1 / span 2; background: var(--surface); }
.tm-stages .chip.go { background: var(--go-soft); }
.tm-zoom { position: absolute; inset-inline-end: calc(var(--gutter) + var(--safe-r)); top: 50%; translate: 0 -50%; display: flex; flex-direction: column; gap: .5em; }
.townmap.has-brief .tm-zoom { inset-inline-end: calc(27em + 2 * var(--gutter) + var(--safe-r)); }
.tm-brief { position: absolute; top: calc(var(--top-h, 4.6em) + .35em); inset-inline-end: calc(var(--gutter) + var(--safe-r)); bottom: calc(var(--gutter) + var(--safe-b)); width: 27em; max-width: calc(100% - 2 * var(--gutter));
  display: flex; flex-direction: column; padding: 0; overflow: hidden; }
@media (prefers-reduced-motion: no-preference) { .tm-brief { animation: tt-in-side .22s ease-out; } [dir="rtl"] .tm-brief { animation-name: tt-in-side-rtl; } }
.tm-brief .sheet-grab { display: none; }
.br-head { display: flex; align-items: flex-start; gap: .75em; padding: 1em 1.1em .45em; flex: none; }
.br-head .bdg { font-size: 1.15em; margin-top: .15em; }
.br-head > div { flex: 1; min-width: 0; }
.br-head h2 { margin: .15em 0 0; font-size: 1.85em; overflow-wrap: anywhere; }
.br-x { margin: -.3em -.45em 0 0; flex: none; }
[dir="rtl"] .br-x { margin: -.3em 0 0 -.45em; }
.br-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: .25em 1.1em 1em; }
.br-body > .lbl { display: block; margin: 1.05em 0 .45em; }
.rules { margin: 0; padding-inline-start: 1.25em; display: grid; gap: .45em; }
.rules li { padding-inline-start: .2em; }
.rules li::marker { font-weight: 800; font-family: var(--font-display); }
.chip.de { margin: 1em 0 0; display: inline-block; white-space: normal; }
.trap { margin: .8em 0 0; padding: .65em .8em; border-radius: var(--r-row); background: var(--sun-soft); box-shadow: inset 0 0 0 2px var(--sun); }
.trap b { font-weight: 700; }
.br-acts { display: flex; flex-wrap: wrap; gap: .55em; padding: .8em 1.1em 1em; border-top: 2px solid var(--line); background: var(--surface); flex: none; }
.tm-brief.locked .barrier { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: .2em 1.1em 1.1em; }

/* ---------- Garage ---------- */
.g-title { position: absolute; top: calc(var(--top-h, 4.6em) + .4em); left: 50%; translate: -50% 0; width: max-content; max-width: calc(100% - 2 * (19em + 2 * var(--gutter))); text-align: center; }
.g-title .lbl { display: block; }
.g-title h1 { margin: .06em 0 0; font-size: 2.6em; overflow-wrap: anywhere; }
.g-line { display: none; margin: .2em 0 0; font-size: .9em; font-weight: 600; color: var(--ink-2); }
.g-panels { display: contents; }
.g-col { position: absolute; top: calc(var(--top-h, 4.6em) + .4em); width: 19em; max-height: calc(100% - var(--top-h, 4.6em) - .4em - var(--gutter) - var(--safe-b));
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: thin; display: flex; flex-direction: column; gap: .8em; padding: .1em .5em .5em .1em; margin: -.1em -.5em -.5em -.1em; }
.g-l { inset-inline-start: calc(var(--gutter) + var(--safe-l)); }
.g-r { inset-inline-end: calc(var(--gutter) + var(--safe-r)); }
.g-panels .pnl { flex: none; min-width: 0; padding: .9em 1em 1em; }
.g-panels h2.lbl { margin: 0; }
.g-list { display: grid; gap: .35em; margin-top: .55em; }
.g-list button { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: .05em .6em; width: 100%; min-height: 44px; padding: .45em .7em; border-radius: var(--r-row);
  border: 2px solid var(--line); background: var(--surface); color: var(--ink); text-align: start; cursor: pointer; line-height: 1.25; }
.g-list button:hover { border-color: var(--ink-3); }
.g-list button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.g-list b { font-family: var(--font-display); font-weight: 800; font-size: 1.08em; overflow-wrap: anywhere; }
.g-list .num { font-weight: 700; font-size: .92em; color: var(--ink-2); }
.g-list small { grid-column: 1 / -1; font-size: .84em; color: var(--ink-2); }
.g-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35em; margin-top: .55em; }
.g-two button { min-height: 44px; padding: .4em .5em; border-radius: var(--r-row); border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; line-height: 1.2;
  cursor: pointer; overflow-wrap: anywhere; hyphens: auto; }
.g-two button:hover { border-color: var(--ink-3); }
.g-two button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.g-paints { display: flex; flex-wrap: wrap; gap: .4em; margin-top: .55em; }
.g-sw { position: relative; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.g-sw::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 2.5px var(--ink); transition: scale .12s; }
.g-sw:hover::before { scale: 1.06; }
.g-sw[aria-pressed="true"]::before { box-shadow: inset 0 0 0 2.5px var(--ink), 0 0 0 2.5px var(--surface), 0 0 0 5px var(--cool); }
.g-sw.shut { cursor: default; }
.g-sw.shut::before { opacity: .38; scale: none; }
.g-sw .lock { position: absolute; inset-inline-end: 0; bottom: 0; width: 1.25em; height: 1.25em; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.g-sw .lock svg.i { width: .78em; height: .78em; stroke-width: 2.6; }
.g-note { margin: .6em 0 0; font-size: .86em; line-height: 1.35; }
.g-count { margin: .3em 0 0; font-size: 1.6em; }
/* the five check points on the car; the panels draw over them (they come after the panels for the keyboard) */
.g-hots { position: absolute; z-index: 1; inset: 0; overflow: hidden; }
.g-col, .g-panels { z-index: 2; }
.g-hot { position: absolute; z-index: 1; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; will-change: transform; -webkit-tap-highlight-color: transparent; }
.g-hot.far { z-index: 0; }
.g-hot[aria-pressed="true"] { z-index: 2; }
.g-dot { position: absolute; inset: 4px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 .16em var(--ink), var(--shadow-badge);
  font-family: var(--font-display); font-weight: 800; font-size: 1.05em; line-height: 1; transition: scale .15s, opacity .15s; }
.g-hot.done .g-dot { background: var(--surface); }
.g-hot[aria-pressed="true"] .g-dot { background: var(--sun); scale: 1.12; }
.g-ok { position: absolute; inset-inline-end: -1px; top: -1px; width: 1.2em; height: 1.2em; border-radius: 50%; background: var(--go); color: #fff; display: none; place-items: center; box-shadow: 0 0 0 2px var(--ink); }
.g-ok svg.i { width: .78em; height: .78em; stroke-width: 3.2; }
.g-hot.done .g-ok { display: grid; }
.g-hot.far .g-dot, .g-hot.far .g-ok { opacity: .55; }
.g-hot.far .g-dot { scale: .8; }
.g-hot:focus-visible { outline: none; }
.g-hot:focus-visible .g-dot { outline: 3px solid var(--ink); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .g-hot:not(.done):not(.far):not([aria-pressed="true"]) .g-dot { animation: tt-ping 2.4s ease-out infinite; }
  .g-card { animation: tt-in-card .2s ease-out; }
}
@keyframes tt-ping { 0% { box-shadow: inset 0 0 0 .16em var(--ink), var(--shadow-badge), 0 0 0 0 rgba(255, 90, 54, .55); }
  70%, 100% { box-shadow: inset 0 0 0 .16em var(--ink), var(--shadow-badge), 0 0 0 .7em rgba(255, 90, 54, 0); } }
/* the examiner's question and the model answer */
.g-card-host { position: absolute; z-index: 3; inset-inline: calc(19em + 2 * var(--gutter) + var(--safe-l)) calc(19em + 2 * var(--gutter) + var(--safe-r)); bottom: calc(var(--gutter) + var(--safe-b)); display: flex; justify-content: center; }
.g-card { position: relative; width: 36em; max-width: 100%; display: flex; align-items: flex-start; gap: .85em; padding: .9em .9em 1em 1em; }
.g-card > .bdg { margin-top: .1em; }
.g-card-b { flex: 1; min-width: 0; }
.g-card .q { margin: .3em 0 0; font-family: var(--font-display); font-weight: 800; font-size: 1.15em; line-height: 1.2; }
.g-card .a { margin: .4em 0 0; color: var(--ink-2); }
.g-card .tb.icon { flex: none; margin: -.35em -.4em 0 0; }
[dir="rtl"] .g-card .tb.icon { margin: -.35em 0 0 -.4em; }
@media (max-width: 1100px) {
  .g-col { width: 16.5em; }
  .g-title { max-width: calc(100% - 2 * (16.5em + 2 * var(--gutter))); }
  .g-card-host { inset-inline: calc(16.5em + 2 * var(--gutter) + var(--safe-l)) calc(16.5em + 2 * var(--gutter) + var(--safe-r)); }
}
@media (max-width: 900px) {
  .g-list small { display: none; }
  .g-line { display: block; }
}

/* ---------- barrier ---------- */
.barrier-sheet .sheet-head { position: absolute; top: .55em; inset-inline-end: .55em; padding: 0; z-index: 1; }
.barrier-sheet .sheet-body { padding-top: 1.15em; }
.barrier-sheet .bar-head { padding-inline-end: 3.2em; }
.barrier { display: flex; flex-direction: column; gap: .75em; }
.barrier .lead { font-size: 1em; line-height: 1.45; max-width: none; }
.bar-head { display: flex; flex-wrap: wrap; gap: .4em; }
.barrier h2 { margin: 0; font-size: 1.65em; }
.barrier .lead { margin: 0; color: var(--ink-2); }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: .3em; }
.perks li { display: flex; align-items: flex-start; gap: .5em; font-weight: 600; }
.perks svg.i { color: var(--go); stroke-width: 3; margin-top: .12em; }
.bx-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6em; }
.bx-tiers.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bx-tiers.one { grid-template-columns: minmax(0, 1fr); }
.bx-tier { display: flex; flex-direction: column; align-items: flex-start; gap: .35em; min-height: 44px; padding: .8em .85em; border-radius: var(--r-row); border: var(--outline) solid var(--ink);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-btn); text-decoration: none; transition: transform .12s, box-shadow .12s; }
.bx-tier:hover { transform: translate(0, -1px); }
.bx-tier:active { transform: translate(.12em, .12em); box-shadow: .06em .06em 0 var(--ink); }
.bx-tier.pop { background: var(--sun-soft); }
.bx-tier.best { background: var(--go-soft); }
.bx-tier.impulse { background: var(--surface); border-style: dashed; padding-block: .6em; box-shadow: none; }
.bx-tier.busy { opacity: .7; }
.bx-badge { display: inline-block; justify-self: start; padding: .15em .65em; border-radius: var(--pill); background: var(--surface-2); font-size: .8em; font-weight: 700; line-height: 1.3; }
.bx-tier.pop .bx-badge { background: var(--sun); }
.bx-tier.best .bx-badge { background: var(--surface); box-shadow: inset 0 0 0 2px var(--go); }
.bx-price { font-family: var(--font-display); font-size: 1.65em; font-weight: 800; line-height: 1; }
.bx-sub { flex: 1; font-size: .85em; color: var(--ink-2); line-height: 1.3; }
.bx-cta { display: inline-flex; align-items: center; min-height: 36px; padding: .2em .85em; border-radius: var(--pill); background: var(--ink); color: #fff; font-weight: 700; font-size: .9em; }
.bx-tier .bx-cta.tb.primary { background: var(--accent); color: var(--on-accent); font-size: .92em; min-height: 38px; padding: .25em .95em; border: var(--outline) solid var(--ink); box-shadow: var(--shadow-badge); }
.bx-tier.impulse .bx-price { font-size: 1.35em; }
.bx-tier.impulse .bx-cta { min-height: 32px; font-size: .84em; padding: .15em .75em; }
.bx-cta svg.i, .bx-go svg.i { margin-inline-start: .3em; }
.bx-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4em .8em; min-height: 44px; padding: .5em .85em; border-radius: var(--r-row); border: 2px solid var(--ink);
  background: var(--surface-2); color: var(--ink); text-decoration: none; font-weight: 600; }
.bx-row .bx-go strong { font-family: var(--font-display); font-weight: 800; }
.bar-acts { display: flex; justify-content: center; }
.trust { display: flex; align-items: flex-start; gap: .45em; margin: 0; font-size: .8em; color: var(--ink-2); }
.trust svg.i { margin-top: .12em; }
.in-panel .bx-tiers, .bx-tiers.mini { grid-template-columns: minmax(0, 1fr); }
.in-panel .bx-tier, .bx-tiers.one .bx-tier, .bx-tiers.mini .bx-tier { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .3em .7em; }
.in-panel .bx-sub, .bx-tiers.one .bx-sub, .bx-tiers.mini .bx-sub { grid-column: 1; }
.in-panel .bx-price, .bx-tiers.one .bx-price, .bx-tiers.mini .bx-price { grid-column: 2; grid-row: 1; text-align: end; }
.in-panel .bx-cta, .bx-tiers.one .bx-cta, .bx-tiers.mini .bx-cta { grid-column: 2; grid-row: 2; justify-self: end; }
/* the slim offer row at the end of a free visitor's debrief */
.bar-row { display: flex; flex-direction: column; gap: .65em; }
.bar-row > div:first-child { display: grid; gap: .15em; }
.bar-row > div:first-child b { font-family: var(--font-display); font-weight: 800; font-size: 1.1em; line-height: 1.2; }
.bar-row > div:first-child span { color: var(--ink-2); }
.lim-pill { position: fixed; top: calc(var(--top-h, 64px) + 6px); inset-inline-end: calc(var(--gutter) + var(--safe-r)); left: auto; transform: none; z-index: 22; display: inline-flex; align-items: center; gap: .38em; padding: 5px 12px;
  border-radius: var(--pill); background: rgba(12, 18, 30, .82); color: #f8fafc; border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 6px 20px rgba(0, 0, 0, .34);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
.lim-pill.low { background: rgba(185, 28, 28, .92); border-color: rgba(252, 165, 165, .45); color: #fff; }
body[data-page="drive"] .lim-pill { top: calc(12px + var(--safe-t)); left: 50%; inset-inline-end: auto; transform: translateX(-50%); }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .today-col { inset-inline: 0; bottom: 0; width: auto; margin: 0; padding: .3em var(--gutter) calc(var(--gutter) + var(--safe-b)); gap: .55em; }
  .next-card h1 { font-size: 2em; }
  .slim small { display: none; }
  .ready-card { display: none; }
  .ready-chip { display: inline-flex; align-self: flex-start; flex: none; }
  .tm-chips { inset-inline: 0; max-width: none; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x; padding: .2em var(--gutter) .45em; scrollbar-width: none; }
  .tm-chips .chip { flex: none; }
  .townmap.has-brief .tm-chips { max-width: none; }
  .tm-stages { inset-inline: 0; bottom: 0; width: auto; padding: .5em 0 calc(.55em + var(--safe-b)); border-radius: var(--r-panel) var(--r-panel) 0 0; border-bottom: 0; box-shadow: 0 -.25em 0 var(--ink); }
  .tm-stages .lbl { display: none; }
  .tm-stages ol { margin: 0; display: flex; gap: .4em; overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x; padding: .1em var(--gutter); scrollbar-width: none; }
  .tm-stages li { flex: none; }
  .tm-stages button { min-width: 9em; }
  .townmap.has-brief .tm-stages { display: none; }
  .tm-zoom { top: calc(var(--top-h, 7em) + 3.6em); translate: none; }
  .townmap.has-brief .tm-zoom { inset-inline-end: calc(var(--gutter) + var(--safe-r)); }
  .tm-brief { top: auto; inset-inline: 0; bottom: 0; width: auto; max-width: none; max-height: 47vh; max-height: 47dvh; border-radius: var(--r-panel) var(--r-panel) 0 0; border-bottom: 0; box-shadow: 0 -.25em 0 var(--ink); }
  .tm-brief.locked { max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding-bottom: var(--safe-b); }
  .tm-brief.locked .barrier { flex: 0 0 auto; overflow: visible; padding: .1em .9em .85em; }
  .tm-brief.locked .br-head { padding: .35em .9em .2em; gap: .55em; }
  .tm-brief.locked .br-head h2 { font-size: 1.22em; }
  @media (prefers-reduced-motion: no-preference) { .tm-brief, [dir="rtl"] .tm-brief { animation: tt-in-up .24s ease-out; } }
  .tm-brief .sheet-grab { display: block; }
  .br-head { padding-top: .5em; }
  .br-head h2 { font-size: 1.5em; }
  .br-acts { padding-bottom: calc(.8em + var(--safe-b)); }
  .br-acts .tb { flex: 1 1 auto; }
  .bx-tiers, .bx-tiers.two { grid-template-columns: minmax(0, 1fr); }
  .bx-tier { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .3em .7em; padding: .65em .8em; }
  .bx-sub { grid-column: 1; }
  .bx-price { grid-column: 2; grid-row: 1; text-align: end; }
  .bx-cta { grid-column: 2; grid-row: 2; justify-self: end; }
  .barrier h2 { font-size: 1.4em; }
  .br-inline { gap: .4em; }
  .br-inline .bar-head { gap: .3em; }
  .br-inline .bar-head .chip { font-size: .78em; padding: .14em .55em; }
  .br-inline h2 { font-size: 1.18em; line-height: 1.12; }
  .br-inline .lead { font-size: .85em; line-height: 1.3; }
  .br-inline .perks { gap: .16em; font-size: .85em; line-height: 1.25; }
  .br-inline .bx-tiers { gap: .38em; }
  .br-inline .bx-tier { padding: .46em .7em; gap: .15em .55em; }
  .br-inline .bx-badge { font-size: .72em; padding: .1em .5em; }
  .br-inline .bx-price { font-size: 1.32em; }
  .br-inline .bx-sub { font-size: .78em; line-height: 1.2; }
  .br-inline .bx-cta { min-height: 32px; font-size: .82em; padding: .15em .7em; }
  .br-inline .bx-tier .bx-cta.tb.primary { min-height: 36px; font-size: .86em; padding: .2em .8em; }
  .br-inline .bx-tier.impulse { padding: .36em .65em; }
  .br-inline .bx-tier.impulse .bx-price { font-size: 1.18em; }
  .br-inline .trust { font-size: .74em; line-height: 1.26; }
  .g-title { top: calc(var(--top-h, 7em) + .15em); max-width: calc(100% - 2 * var(--gutter)); }
  .g-title h1 { font-size: 1.9em; }
  .g-panels { display: grid; position: absolute; inset-inline: 0; bottom: 0; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr;
    grid-template-areas: "paint paint" "cars gear" "cars check"; gap: .5em; padding: .4em var(--gutter) calc(var(--gutter) + var(--safe-b)); }
  .g-col { display: contents; }
  .g-cars { grid-area: cars; }
  .g-gear { grid-area: gear; }
  .g-paint { grid-area: paint; display: flex; align-items: center; gap: .5em; }
  .g-check { grid-area: check; }
  .g-panels .pnl { padding: .55em .6em .6em; box-shadow: .2em .2em 0 var(--ink); }
  .g-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3em; margin-top: .4em; }
  .g-list button { grid-template-columns: minmax(0, 1fr); padding: .3em .45em; }
  .g-two { grid-template-columns: minmax(0, 1fr); margin-top: .4em; }
  .g-paints { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; margin: 0; padding: 4px; gap: .25em; scrollbar-width: none; }
  .g-note { display: none; }
  .g-count { font-size: 1.2em; margin-top: .2em; }
  .g-card-host { inset-inline: 0; bottom: 0; }
  .g-card { width: auto; flex: 1; max-height: 62%; overflow-y: auto; border-radius: var(--r-panel) var(--r-panel) 0 0; border-bottom: 0; box-shadow: 0 -.25em 0 var(--ink); padding: .9em var(--gutter) calc(1em + var(--safe-b)); }
  @media (prefers-reduced-motion: no-preference) { .g-card { animation: tt-in-up .24s ease-out; } }
}
@media (max-height: 500px) and (min-width: 600px) {
  .today-col { width: min(26em, 52%); gap: .5em; }
  .next-card { gap: .4em; }
  .next-card h1 { font-size: 1.6em; }
  .slim small { display: none; }
  .ready-card { display: none; }
  .ready-chip { display: inline-flex; align-self: flex-start; flex: none; }
  .tm-chips { inset-inline: 0; max-width: none; flex-wrap: nowrap; overflow-x: auto; padding: .2em var(--gutter) .45em; scrollbar-width: none; }
  .tm-chips .chip { flex: none; }
  .townmap.has-brief .tm-chips { max-width: none; inset-inline-end: calc(22em + var(--gutter) + var(--safe-r)); }
  .tm-stages { width: 16em; padding: .5em .6em; }
  .tm-stages .lbl { display: none; }
  .tm-stages ol { margin: 0; gap: .2em; }
  .tm-stages button { min-height: 40px; position: relative; }
  .tm-stages button::before { content: ""; position: absolute; inset: -2px -2px; }
  .tm-stages .st-d { display: none; }
  .townmap.has-brief .tm-stages { display: none; }
  .tm-brief { width: 22em; }
  .townmap.has-brief .tm-zoom { inset-inline-end: calc(22em + 2 * var(--gutter) + var(--safe-r)); }
  .br-head h2 { font-size: 1.4em; }
  .br-head .lbl { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .br-acts { flex-wrap: nowrap; padding: .55em .9em .7em; }
  .br-acts .tb { flex: 1 1 auto; min-width: 0; }
  .br-acts .tb.primary { flex: none; }
  .g-title { top: calc(var(--top-h, 3.6em) + .05em); max-width: calc(100% - 2 * (15.5em + 2 * var(--gutter))); }
  .g-title .lbl { display: none; }
  .g-title h1 { font-size: 1.5em; }
  .g-line { display: block; font-size: .82em; }
  .g-col { top: calc(var(--top-h, 3.6em) + .2em); width: 15.5em; max-height: calc(100% - var(--top-h, 3.6em) - .2em - .7em - var(--safe-b)); gap: .5em; }
  .g-panels .pnl { padding: .5em .6em .6em; }
  .g-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3em; margin-top: .35em; }
  .g-list button { grid-template-columns: minmax(0, 1fr); padding: .3em .5em; }
  .g-list small, .g-note { display: none; }
  .g-two { margin-top: .35em; }
  .g-paints { gap: .2em; margin-top: .3em; }
  .g-count { font-size: 1.15em; margin-top: .15em; }
  /* the card takes the place of the paint column while it is open, so the car keeps the middle */
  .g-card-host { top: calc(var(--top-h, 3.6em) + .2em); bottom: calc(.7em + var(--safe-b)); inset-inline: auto calc(var(--gutter) + var(--safe-r)); width: 15.5em; align-items: flex-start; }
  .garage.has-card .g-r { visibility: hidden; }
  .g-card { width: 100%; max-height: 100%; overflow-y: auto; flex-wrap: wrap; gap: .5em; padding: .6em .6em .7em .75em; }
  .g-card .g-card-b { flex-basis: 100%; order: 3; }
  .g-card .q { font-size: 1.02em; }
  .g-card .a { font-size: .92em; margin-top: .25em; }
}

/* ---------- Drive: modern translucent dark-glass HUD ---------- */
#hud {
  --hud-bg: rgba(12, 18, 30, 0.72);
  --hud-bg-hi: rgba(12, 18, 30, 0.86);
  --hud-bg-btn: rgba(15, 23, 42, 0.78);
  --hud-border: rgba(255, 255, 255, 0.14);
  --hud-border-hi: rgba(255, 255, 255, 0.28);
  --hud-text: #f8fafc;
  --hud-dim: #94a3b8;
  --hud-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
  --hud-blur: blur(12px);
  --hud-go: #22c55e;
  --hud-warn: #f59e0b;
  --hud-bad: #ef4444;
  --hud-blue: #3b82f6;
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 15;
  pointer-events: none;
  color: var(--hud-text);
  font-size: 15px;
  line-height: 1.3;
}
#hud .pnl, #hud button, #hud canvas, #hud .tt-turn, #hud .tt-dock > * { pointer-events: auto; }
#hud .pnl {
  background: var(--hud-bg);
  color: var(--hud-text);
  border: 1px solid var(--hud-border);
  border-radius: 16px;
  box-shadow: var(--hud-shadow);
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
  padding: 10px 12px;
}
#hud .lbl { color: var(--hud-dim); font-size: 11px; letter-spacing: .08em; }
[dir="rtl"] #hud .lbl { letter-spacing: 0; }
#hud kbd, #hud .tt-say kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  font: 700 11px/1.25 var(--font-body);
  text-align: center;
  direction: ltr;
  unicode-bidi: isolate;
  vertical-align: .06em;
}
body.has-touch #hud kbd { display: none !important; }

/* Sleek glass HUD buttons (>= 44x44 tap target) */
.tt-hbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  background: var(--hud-bg-btn);
  color: var(--hud-text);
  border: 1px solid var(--hud-border);
  box-shadow: var(--hud-shadow);
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
}
.tt-hbtn:hover { background: var(--hud-bg-hi); border-color: var(--hud-border-hi); }
.tt-hbtn:active { transform: scale(.96); }
.tt-hbtn:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }
.tt-hbtn svg.i { width: 18px; height: 18px; flex: none; }
.tt-pause { width: 44px; padding: 0; flex: none; }
#hud #h-finish {
  min-height: 44px;
  padding: 0 14px;
  background: rgba(30, 41, 59, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  font-size: 14px;
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
  animation: none;
}
#hud #h-finish:hover { background: rgba(37, 99, 235, 0.88); border-color: rgba(147, 197, 253, 0.5); }
#hud #h-finish.ready {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  border-color: rgba(134, 239, 172, 0.65);
  color: #032110;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.28), var(--hud-shadow);
}
@media (prefers-reduced-motion: no-preference) {
  #hud #h-finish.ready { animation: tt-ready-glow 1.3s ease-in-out infinite alternate; }
}
@keyframes tt-ready-glow { to { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.2), var(--hud-shadow); } }
#hud .tt-act-sec, #hud #h-retry {
  min-height: 44px;
  padding: 0 12px;
  background: var(--hud-bg-btn);
  border: 1px solid var(--hud-border);
  color: var(--hud-text);
  font-size: 13px;
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
}

/* Desktop default: transparent wrappers so corner & center elements anchor cleanly */
.tt-hud-top, .tt-bar, .tt-sub { display: contents; }

/* Desktop top-left: Pause + translucent Objective Card */
.tt-tl {
  position: fixed;
  top: calc(14px + var(--safe-t));
  inset-inline-start: calc(14px + var(--safe-l));
  display: flex;
  align-items: center;
  gap: 8px;
}
.tt-tl-col { display: contents; }
.tt-obj {
  position: fixed;
  top: calc(14px + var(--safe-t));
  inset-inline-start: calc(66px + var(--safe-l));
  width: 268px;
  max-width: calc(42vw - 64px);
}
.tt-obj-bar { display: none; }
.tt-obj-head .lbl { display: block; }
.tt-obj-head h2 { margin: 2px 0 0; font-size: 16px; color: #fff; overflow-wrap: anywhere; }
#hud #h-steps { display: flex; flex-direction: column; gap: 3px; list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
#hud #h-steps li { display: flex; align-items: flex-start; gap: 8px; padding: 3px 6px; margin-inline: -6px; border-radius: 8px; color: var(--hud-dim); line-height: 1.28; }
#hud #h-steps li > i { display: grid; place-items: center; width: 16px; height: 16px; flex: none; margin-top: 1px; border-radius: 50%; border: 1.5px solid rgba(148, 163, 184, 0.55); background: none; }
#hud #h-steps li > i svg.i { width: 11px; height: 11px; stroke-width: 3; opacity: 0; }
#hud #h-steps li.done { color: #cbd5e1; }
#hud #h-steps li.done > i { background: var(--hud-go); border-color: var(--hud-go); color: #042110; }
#hud #h-steps li.done > i svg.i { opacity: 1; }
#hud #h-steps li.now { background: rgba(59, 130, 246, 0.22); color: #fff; font-weight: 650; }
#hud #h-steps li.now > i { border-color: #60a5fa; background: #3b82f6; }

/* Desktop top-right: View segmented control + Next Turn below it */
.tt-tr {
  position: fixed;
  top: calc(14px + var(--safe-t));
  inset-inline-end: calc(14px + var(--safe-r));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.tt-tr-row { display: flex; align-items: center; gap: 8px; }
.tt-cam {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 12px;
  border-radius: 999px;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  box-shadow: var(--hud-shadow);
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
}
.tt-cam > .lbl { display: inline-flex; align-items: center; gap: 5px; color: #cbd5e1; }
.tt-cam .tseg { padding: 0; background: none; gap: 2px; flex-wrap: nowrap; }
.tt-cam .tseg button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 0;
  color: #cbd5e1;
  font-weight: 650;
  font-size: 13px;
  white-space: nowrap;
  transition: background-color .14s ease, color .14s ease;
}
.tt-cam .tseg button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.tt-cam .tseg button[aria-pressed="true"] { background: #2563eb; color: #fff; box-shadow: none; }
.tt-cam-btn { display: none; }
.tt-turn {
  position: fixed;
  top: calc(68px + var(--safe-t));
  inset-inline-end: calc(14px + var(--safe-r));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border-radius: 14px;
  background: rgba(29, 78, 216, 0.86);
  color: #fff;
  border: 1px solid rgba(147, 197, 253, 0.45);
  box-shadow: var(--hud-shadow);
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
  direction: ltr;
}
.tt-turn > svg.i { width: 28px; height: 28px; stroke-width: 2.5; flex: none; }
.tt-turn-b { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.tt-turn-b b { font-size: 20px; line-height: 1.05; color: #fff; }
.tt-turn-b small { font-size: 12.5px; font-weight: 600; color: #dbeafe; line-height: 1.2; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Desktop top-center: recording pill, weather chips, traffic-light repeater */
.tt-tc {
  position: fixed;
  top: calc(54px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#hud .tt-rec { min-height: 36px; background: rgba(153, 27, 27, 0.86); color: #fee2e2; border: 1px solid rgba(248, 113, 113, 0.5); box-shadow: var(--hud-shadow); cursor: pointer; }
#hud .tt-rec svg.i { color: #f87171; }
.tt-rep { display: flex; flex-direction: column; gap: 4px; padding: 5px; border-radius: 12px; background: rgba(10, 16, 28, 0.88); border: 1px solid rgba(255, 255, 255, 0.16); box-shadow: var(--hud-shadow); }
.tt-rep i { display: block; width: 15px; height: 15px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.tt-rep[data-p="red"] [data-l="red"] { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.tt-rep[data-p="amber"] [data-l="amber"], .tt-rep[data-p="redamber"] [data-l="amber"], .tt-rep[data-p="redamber"] [data-l="red"] { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.tt-rep[data-p="green"] [data-l="green"] { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
#hud .tt-tc .x-wx-chips { position: static; transform: none; display: flex; flex-direction: row; gap: 6px; }
#hud .x-wx-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  background: var(--hud-bg); color: var(--hud-text); border: 1px solid var(--hud-border); box-shadow: var(--hud-shadow);
  backdrop-filter: var(--hud-blur); -webkit-backdrop-filter: var(--hud-blur);
  font: 650 12.5px/1.25 var(--font-body);
}
#hud .x-wx-chip.cold { background: rgba(30, 58, 138, 0.8); border-color: rgba(147, 197, 253, 0.4); color: #dbeafe; }
#hud .x-wx-chip[hidden] { display: none; }
#hud .x-wx-chip.warn, #hud .x-wx-chip.esp { background: rgba(120, 53, 15, 0.86); border-color: rgba(251, 191, 36, 0.5); color: #fef3c7; }

/* Desktop bottom-center: Coach / Feedback / Passed Sign slot above cluster */
.tt-msg {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-b));
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 380px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.tt-line {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.35;
  background: var(--hud-bg-hi);
  border-radius: 14px;
}
.tt-line[data-tone="hot"] { background: rgba(127, 29, 29, 0.88); border-color: rgba(248, 113, 113, 0.55); color: #fef2f2; }
.tt-line[data-tone="sun"] { background: rgba(120, 53, 15, 0.88); border-color: rgba(251, 191, 36, 0.55); color: #fef3c7; }
.tt-line[data-tone="go"] { background: rgba(6, 78, 59, 0.88); border-color: rgba(52, 211, 153, 0.55); color: #ecfdf5; }
.tt-line[data-tone="note"] { background: rgba(15, 23, 42, 0.88); border-color: rgba(148, 163, 184, 0.35); }
.tt-say { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tt-gl {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin: 0 2px; vertical-align: -5px;
  border-radius: 6px; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff;
}
.tt-gl svg.i { width: 14px; height: 14px; }
.tt-pts { flex: none; padding: 2px 8px; border-radius: 999px; background: #ef4444; color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 13px; line-height: 1.2; }
.tt-line:not([data-tone="hot"]) .tt-pts { background: rgba(255, 255, 255, 0.18); }
.tt-sg { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; max-width: 84px; }
.tt-sg-art canvas { display: block; width: 36px; height: 36px; }
.tt-sg-name { font-size: 11px; letter-spacing: .02em; text-align: center; color: #cbd5e1; line-height: 1.15; }
@media (prefers-reduced-motion: no-preference) {
  .tt-line.pulse { animation: tt-pop .26s ease-out; }
}
@keyframes tt-pop { 0% { transform: scale(.97); } 60% { transform: scale(1.015); } }

/* Docked plugin chips inside .tt-dock in cohesive dark glass */
#hud .tt-dock { display: flex; flex-direction: column; align-items: center; gap: 5px; max-width: 100%; }
#hud .tt-dock:empty { display: none; }
#hud .tt-dock > #x-tr-chip,
#hud .tt-dock > #x-man-chip,
#hud .tt-dock > .x-wx-chip,
#hud .tt-dock > #x-mentor-chip {
  position: static !important; transform: none !important; inset: auto !important; max-width: 100% !important; margin: 0 !important;
  padding: 6px 12px !important; border-radius: 12px !important;
  background: var(--hud-bg-hi) !important; color: #f8fafc !important;
  border: 1px solid var(--hud-border-hi) !important; box-shadow: var(--hud-shadow) !important;
  backdrop-filter: var(--hud-blur) !important; -webkit-backdrop-filter: var(--hud-blur) !important;
  font: 600 13px/1.35 var(--font-body) !important; text-align: center; white-space: normal !important;
}
#hud .tt-dock > [hidden] { display: none !important; }
#hud #x-man-chip .x-hint { color: #fcd34d; font-weight: 700; }
#hud #x-man-chip .x-warn { color: #fca5a5; }
#hud .tt-dock > #xe-cap {
  position: static; transform: none; width: min(500px, 100%); padding: 8px 12px; border-radius: 14px;
  background: var(--hud-bg-hi); color: #f8fafc; border: 1px solid var(--hud-border-hi); box-shadow: var(--hud-shadow);
  backdrop-filter: var(--hud-blur); -webkit-backdrop-filter: var(--hud-blur);
}
#hud #xe-cap.hidden { display: none; }
#hud #xe-cap .who { background: rgba(245, 158, 11, 0.24); color: #fcd34d; box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.5); }
#hud #xe-cap .de { color: #fff; }
#hud #xe-cap .tr { color: #cbd5e1; }
#hud #xe-cap .rep { min-height: 44px; color: #f8fafc; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--hud-border-hi); }
#hud #xe-cap.urgent { background: rgba(127, 29, 29, 0.9); border-color: rgba(248, 113, 113, 0.6); }

/* Desktop bottom-center: Sleek translucent Instrument Cluster (always LTR like the car) */
.tt-cluster {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 18px;
  white-space: nowrap;
}
#hud .tt-cluster { padding: 7px 12px; }
.tt-sig {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05); color: rgba(148, 163, 184, 0.45); cursor: pointer;
  transition: background-color .12s, color .12s;
}
.tt-sig:hover { background: rgba(255, 255, 255, 0.12); color: #cbd5e1; }
.tt-sig svg.i { width: 22px; height: 22px; }
.tt-sig.on { color: #4ade80; background: rgba(34, 197, 94, 0.2); }
.tt-speed { display: flex; flex-direction: column; align-items: center; min-width: 50px; line-height: 1; }
.tt-speed b { font-size: 32px; line-height: .95; color: #fff; font-variant-numeric: tabular-nums; }
.tt-speed .lbl { font-size: 11px; letter-spacing: .04em; color: var(--hud-dim); margin-top: 2px; }
.tt-limit {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: #fff; color: #111827; box-shadow: inset 0 0 0 4.5px #dc2626, 0 2px 8px rgba(0, 0, 0, 0.35);
  font-family: var(--font-display); font-weight: 800; font-size: 14.5px; line-height: 1;
}
.tt-limit.over { background: #fee2e2; }
@media (prefers-reduced-motion: no-preference) { .tt-limit.over { animation: tt-throb .85s ease-in-out infinite; } }
@keyframes tt-throb { 50% { transform: scale(1.09); box-shadow: inset 0 0 0 4.5px #dc2626, 0 0 0 5px rgba(239, 68, 68, 0.45); } }
.tt-sign-mini { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 8px; background: rgba(255, 255, 255, 0.1); padding: 2px; }
.tt-sign-mini canvas { width: 100%; height: 100%; display: block; }
.tt-gear { display: flex; align-items: center; gap: 3px; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); }
.tt-gear [data-g] {
  display: grid; place-items: center; min-width: 34px; height: 38px; padding: 0 5px; border: 1px solid transparent;
  border-radius: 9px; background: none; color: #94a3b8; font: 800 15px/1 var(--font-display);
}
.tt-gear button { cursor: pointer; }
.tt-gear button:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.tt-gear span[data-g] { min-width: 28px; height: 28px; padding: 0 4px; }
.tt-gear [data-g][aria-pressed="true"], .tt-gear [data-g].on { background: #f8fafc; color: #0f172a; }
.tt-gear [data-g].hint { border-color: #fbbf24; background: rgba(245, 158, 11, 0.25); color: #fef3c7; }
@media (prefers-reduced-motion: no-preference) { .tt-gear [data-g].hint, .tt-tog.hint, .tt-gh { animation: tt-hint 1.1s ease-in-out infinite; } }
@keyframes tt-hint { 50% { transform: translateY(-2px); } }
.tt-gear.man { display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px 6px; padding: 4px 9px; min-width: 72px; }
.tt-gear.man .lbl { font-size: 11px; letter-spacing: .04em; color: var(--hud-dim); }
.tt-gear.man [data-gv] { font-size: 22px; line-height: 1; grid-row: span 2; color: #fff; }
.tt-gh { justify-self: start; padding: 1px 6px; border-radius: 999px; background: #f59e0b; color: #1c1000; font-weight: 800; font-size: 11.5px; }
.tt-gh svg.i { width: 12px; height: 12px; stroke-width: 3; vertical-align: -1px; margin-inline-end: 1px; }
.tt-rev { grid-column: 1 / -1; display: block; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.tt-rev b { display: block; height: 100%; background: var(--hud-go); transform-origin: left center; transform: scaleX(0); transition: transform .08s linear; }
.tt-rev.red b { background: var(--hud-bad); }
.tt-tog {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 56px; min-height: 44px; padding: 4px 6px; border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.06); color: #cbd5e1;
  font-weight: 650; cursor: pointer; transition: background-color .14s, color .14s, border-color .14s;
}
.tt-tog:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.tt-tog svg.i { width: 18px; height: 18px; }
.tt-tog span { font-size: 11px; line-height: 1.05; text-align: center; white-space: nowrap; }
.tt-hand[aria-pressed="true"] { background: rgba(220, 38, 38, 0.28); border-color: rgba(248, 113, 113, 0.6); color: #fecaca; }
.tt-lamp[aria-pressed="true"] { background: rgba(37, 99, 235, 0.34); border-color: rgba(96, 165, 250, 0.65); color: #dbeafe; }
.tt-tog.hint { background: rgba(245, 158, 11, 0.28); border-color: #fbbf24; color: #fef3c7; }
#hud #x-wx-fog { display: inline-grid; place-items: center; font-size: inherit; width: 44px; min-width: 44px; height: 44px; padding: 0; border-radius: 11px; border: 1px solid var(--hud-border); background: rgba(255, 255, 255, 0.06); color: #cbd5e1; cursor: pointer; }
#hud #x-wx-fog.on { background: rgba(245, 158, 11, 0.28); border-color: #fbbf24; color: #fef3c7; }
#hud #x-wx-fog svg { width: 20px; height: 20px; filter: none; }
#hud #x-wx-fog kbd { display: none; }

/* Desktop bottom-left: sleek dark circular radar Minimap + Look controls */
.tt-bl {
  position: fixed;
  bottom: calc(16px + var(--safe-b));
  inset-inline-start: calc(16px + var(--safe-l));
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 8px;
}
.tt-map-wrap { position: relative; flex: none; }
.tt-map-toggle {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#hud #h-map {
  position: static;
  display: block;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: #0f172a;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
}
.tt-map-ic { display: none; }
.tt-look > .lbl { display: block; margin: 0 2px 5px; }
.tt-lks { display: grid; grid-template-columns: repeat(2, auto); gap: 5px; }
.tt-lk {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 66px; min-height: 50px; padding: 6px 6px 5px; border-radius: 11px;
  border: 1px solid var(--hud-border); background: rgba(255, 255, 255, 0.06); color: #e2e8f0;
  cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: background-color .12s, border-color .12s;
}
.tt-lk:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.tt-lk svg.i { width: 20px; height: 20px; }
.tt-lk span { font-size: 11px; font-weight: 650; line-height: 1.1; text-align: center; }
.tt-lk kbd { position: absolute; top: -6px; inset-inline-end: -5px; }
.tt-lk[aria-pressed="true"] { background: rgba(245, 158, 11, 0.88); border-color: #fde68a; color: #1c1000; }

/* Desktop bottom-right: Finish + Retry/Takeover + Clutch X-Ray */
.tt-acts {
  position: fixed;
  bottom: calc(16px + var(--safe-b));
  inset-inline-end: calc(16px + var(--safe-r));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.tt-br {
  position: fixed;
  bottom: calc(68px + var(--safe-b));
  inset-inline-end: calc(16px + var(--safe-r));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.tt-acts-extra { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tt-acts-extra:not(:has(button:not(.hidden))) { display: none; }

/* Clutch X-ray in sleek dark-glass automotive telemetry style */
.tt-xray { width: clamp(256px, calc(50vw - 290px), 370px); padding: 10px 12px; }
.tt-xray .xr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tt-xray .xr-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--hud-border-hi); background: rgba(255, 255, 255, 0.08); color: #f8fafc;
  font: 750 12.5px/1.2 var(--font-display);
}
.tt-xray .xr-chip::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.tt-xray[data-s="bite"] .xr-chip { background: rgba(245, 158, 11, 0.25); border-color: rgba(251, 191, 36, 0.6); color: #fef3c7; }
.tt-xray[data-s="bite"] .xr-chip::before { background: #fbbf24; }
.tt-xray[data-s="lock"] .xr-chip { background: rgba(34, 197, 94, 0.22); border-color: rgba(74, 222, 128, 0.55); color: #dcfce7; }
.tt-xray[data-s="lock"] .xr-chip::before { background: #22c55e; }
.tt-xray .xray-svg { display: block; width: 100%; margin-top: 6px; direction: ltr; }
.tt-xray .xr-parts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); direction: ltr; margin-top: 3px; color: #94a3b8; font: 650 11px/1.15 var(--font-body); text-align: center; }
.tt-xray .xr-parts span { padding: 0 2px; }
.tt-xray.xr-tight .xr-parts { grid-template-columns: repeat(10, minmax(0, 1fr)); row-gap: 2px; }
.tt-xray.xr-tight .xr-parts span:nth-child(1) { grid-area: 1 / 1 / 2 / 4; text-align: left; }
.tt-xray.xr-tight .xr-parts span:nth-child(2) { grid-area: 2 / 2 / 3 / 6; }
.tt-xray.xr-tight .xr-parts span:nth-child(3) { grid-area: 1 / 4 / 2 / 8; }
.tt-xray.xr-tight .xr-parts span:nth-child(4) { grid-area: 2 / 6 / 3 / 10; }
.tt-xray.xr-tight .xr-parts span:nth-child(5) { grid-area: 1 / 8 / 2 / 11; text-align: right; }
.xray-svg .x-trk { fill: rgba(255, 255, 255, 0.08); stroke: rgba(255, 255, 255, 0.28); stroke-width: 1.8; }
.xray-svg .x-z { stroke-width: 8; }
.xray-svg .x-z-lock { stroke: #22c55e; }
.xray-svg .x-z-bite { stroke: #f59e0b; }
.xray-svg .x-z-free { stroke: #475569; }
.xray-svg .x-tick { stroke: #cbd5e1; stroke-width: 1.8; }
.xray-svg .x-cap rect { fill: rgba(255, 255, 255, 0.14); stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.4; }
.xray-svg .x-cap text { fill: #f8fafc; font: 750 11.5px var(--font-body); text-anchor: middle; }
.xray-svg .x-pad { fill: #f8fafc; }
.xray-svg .x-grv { stroke: #0f172a; stroke-width: 2; stroke-linecap: round; }
.xray-svg .x-head { fill: #334155; }
.xray-svg .x-eng { fill: #1e293b; stroke: rgba(255, 255, 255, 0.24); stroke-width: 1.5; }
.tt-xray[data-s="off"] .x-eng, .tt-xray[data-s="off"] .x-head { fill: #1e293b; opacity: .55; }
.xray-svg .x-rpm { fill: #fff; font: 800 17px var(--font-display); text-anchor: middle; }
.xray-svg .x-rpmu { fill: #94a3b8; font: 700 10px var(--font-body); text-anchor: middle; }
.xray-svg .x-crank { stroke: #94a3b8; stroke-width: 7; }
.xray-svg .x-fly { fill: #334155; stroke: #cbd5e1; stroke-width: 2; }
.xray-svg .x-fdots circle { fill: #f8fafc; }
.xray-svg .x-dsk { fill: #475569; stroke: #e2e8f0; stroke-width: 2; }
.tt-xray[data-s="bite"] .x-dsk { fill: #f59e0b; }
.tt-xray[data-s="lock"] .x-dsk { fill: #22c55e; }
.xray-svg .x-ddots circle { fill: #0f172a; }
.xray-svg .x-glow { fill: #f59e0b; opacity: 0; }
.tt-xray[data-s="bite"] .x-glow { opacity: .55; }
.xray-svg .x-shaft { stroke: #475569; stroke-width: 7; stroke-linecap: round; }
.xray-svg .x-flow { stroke: none; stroke-width: 7; stroke-dasharray: 8 6; }
.tt-xray[data-s="lock"] .x-flow { stroke: #22c55e; }
.tt-xray[data-s="bite"] .x-flow { stroke: #f59e0b; }
.tt-xray[data-n="1"] #x-fl1 { stroke: none; }
.xray-svg .x-gb { fill: #1e293b; stroke: rgba(255, 255, 255, 0.3); stroke-width: 2; }
.xray-svg .x-gear { fill: #f8fafc; font: 800 24px var(--font-display); text-anchor: middle; }
.xray-svg .x-tyre { fill: none; stroke: #e2e8f0; stroke-width: 10; }
.xray-svg .x-hub { fill: #334155; stroke: #94a3b8; stroke-width: 1.5; }
.xray-svg .x-spk line { stroke: #cbd5e1; stroke-width: 3; stroke-linecap: round; }
#hud .tt-xray .xr-why { margin: 5px 0 0; font-size: 12.5px; line-height: 1.35; color: #cbd5e1; }
#hud .tt-xray .xr-now { margin: 6px 0 0; padding: 6px 9px; border-radius: 10px; background: rgba(245, 158, 11, 0.2); border: 1px solid rgba(251, 191, 36, 0.45); font-size: 12.5px; font-weight: 600; line-height: 1.4; color: #fef3c7; }
#hud .tt-xray .xr-now b { font: 800 11px/1 var(--font-display); text-transform: uppercase; letter-spacing: .05em; margin-inline-end: 4px; color: #fcd34d; }

/* In-world teaching labels in sleek dark glass */
.w-label {
  position: absolute; left: 0; top: 0; padding: 3px 9px; border-radius: 8px;
  background: rgba(12, 18, 30, 0.82); color: #f8fafc; border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font: 700 12px/1.3 var(--font-body); white-space: nowrap; will-change: transform;
}
.w-label.react { background: rgba(120, 53, 15, 0.9); color: #fef3c7; border-color: rgba(251, 191, 36, 0.55); }
.w-label.brake { background: rgba(127, 29, 29, 0.9); color: #fecaca; border-color: rgba(248, 113, 113, 0.55); }
.w-label.blind { background: rgba(120, 53, 15, 0.88); color: #fde68a; border-color: rgba(251, 191, 36, 0.5); }

/* Cohesive dark-glass styling for manual H-gate dashboard plugin (#xc-dash) during driving */
html body[data-page="drive"] #ext-hud #xc-dash {
  background: rgba(12, 18, 30, 0.78); color: #f8fafc; border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
html body[data-page="drive"] #ext-hud #xc-dash .xc-gate .slot { stroke: rgba(148, 163, 184, 0.4); }
html body[data-page="drive"] #ext-hud #xc-dash .xc-gate text { fill: #cbd5e1; }
html body[data-page="drive"] #ext-hud #xc-dash .xc-knob circle { fill: #f8fafc; stroke: #2563eb; }
html body[data-page="drive"] #ext-hud #xc-dash .xc-knob text { fill: #0f172a; }
html body[data-page="drive"] #ext-hud #xc-note {
  background: rgba(12, 18, 30, 0.9); color: #fef3c7; border: 1px solid rgba(251, 191, 36, 0.5);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#ext-hud .xs-col { display: none; }

/* Desktop narrower windows */
@media (max-width: 1120px) {
  body:not(.has-touch) #hud { font-size: 14px; }
  body:not(.has-touch) .tt-obj { width: 228px; }
}

/* ---------- Drive: pause, the finish question, "time stopped" ---------- */
.ps-acts { display: grid; gap: .55em; margin: .2em 0 .9em; }
.ps-acts .tb { justify-content: flex-start; }
.ask-note { margin: 0 0 1em; color: var(--ink-2); font-size: 1.05em; }
.ps-rec { display: flex; flex-wrap: wrap; align-items: center; gap: .4em .8em; }
.ps-rec .set-note { flex: 1 1 12em; }
.ps-keys summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: .6em; list-style: none; border-radius: var(--r-row); }
.ps-keys summary::-webkit-details-marker { display: none; }
.ps-keys summary .lbl { margin: 0; }
.ps-keys .ps-chev { width: 1.3em; height: 1.3em; transition: transform .15s; }
.ps-keys[open] .ps-chev { transform: rotate(90deg); }
[dir="rtl"] .ps-keys:not([open]) .ps-chev { transform: scaleX(-1); }
.ps-keys .tkeys { margin-top: .4em; }
.dec-sheet .sheet-head h2 { font-size: 1.45em; }
.dec-opts { display: grid; gap: .5em; margin: .6em 0 .2em; }
.dec-o { justify-content: flex-start; text-align: start; white-space: normal; font-size: 1em; }
.dec-o.right { background: var(--go-soft); border-color: var(--go); }
.dec-o.wrong { background: var(--hot-soft); border-color: var(--hot); }
.dec-o[disabled] { cursor: default; transform: none; }
.dec-o[disabled].right, .dec-o[disabled].wrong { color: var(--ink); }
.dec-o[disabled]:not(.right):not(.wrong) { color: var(--ink-2); border-color: var(--ink-3); box-shadow: none; }
.dec-why { margin: .7em 0; line-height: 1.45; }

/* ---------- Drive: Mobile & Touch HUD (top-docked, >=75% road free, bottom ~36% clear for #touch) ---------- */
/* #touch internals are styled exclusively by src/touch-controls.css; only the visual .want halo lives here. */
#touch button.want, #hud button.want {
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.92), 0 0 14px rgba(245, 158, 11, 0.42);
}
@media (prefers-reduced-motion: no-preference) {
  #touch button.want, #hud button.want { animation: tt-want-halo 1.2s ease-in-out infinite alternate; }
}
@keyframes tt-want-halo {
  from { box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.95), 0 0 12px rgba(245, 158, 11, 0.45); }
  to { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.4), 0 0 18px rgba(245, 158, 11, 0.18); }
}

/* Mobile / touch HUD layout (phones, tablets, or any touch drive screen) */
body.has-touch #hud .tt-hud-top {
  position: fixed;
  top: calc(8px + var(--safe-t));
  inset-inline: calc(10px + var(--safe-l)) calc(10px + var(--safe-r));
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  z-index: 15;
}
body.has-touch #hud .tt-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}
body.has-touch #hud .tt-tl {
  position: static;
  order: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
body.has-touch #hud .tt-tl-col { display: flex; align-items: center; min-width: 0; }
body.has-touch #hud .tt-cluster {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  height: 44px;
  padding: 0 9px;
  gap: 7px;
  border-radius: 14px;
}
body.has-touch #hud .tt-cluster .tt-sig,
body.has-touch #hud .tt-cluster .tt-hand,
body.has-touch #hud .tt-cluster .tt-lamp,
body.has-touch #hud #x-wx-fog { display: none; }
body.has-touch #hud .tt-speed { min-width: 36px; flex-direction: row; align-items: baseline; gap: 3px; }
body.has-touch #hud .tt-speed b { font-size: 20px; line-height: 1; }
body.has-touch #hud .tt-speed .lbl { font-size: 11px; margin-top: 0; }
body.has-touch #hud .tt-limit { width: 30px; height: 30px; font-size: 12px; box-shadow: inset 0 0 0 3.5px #dc2626, 0 1px 4px rgba(0, 0, 0, 0.35); }
body.has-touch #hud .tt-sign-mini { width: 26px; height: 26px; padding: 1px; }
body.has-touch #hud .tt-gear { padding: 0; background: none; gap: 0; }
body.has-touch #hud .tt-gear [data-g]:not(.on) { display: none; }
body.has-touch #hud .tt-gear [data-g].on { min-width: 26px; height: 26px; font-size: 13.5px; border-radius: 8px; }
body.has-touch #hud .tt-gear.man { padding: 2px 6px; min-width: 40px; gap: 1px 4px; background: rgba(255, 255, 255, 0.08); }
body.has-touch #hud .tt-gear.man .lbl { display: none; }
body.has-touch #hud .tt-gear.man [data-gv] { font-size: 16px; grid-row: 1; }
body.has-touch #hud .tt-rev { height: 4px; }

/* Top-right compact cluster: Camera quick-toggle + Finish */
body.has-touch #hud .tt-tr { position: static; order: 2; align-items: center; }
body.has-touch #hud .tt-tr-row { display: flex; align-items: center; gap: 6px; }
body.has-touch #hud .tt-cam { display: none; }
body.has-touch #hud .tt-cam-btn { display: inline-flex; min-width: 44px; height: 44px; padding: 0 10px; font-size: 12.5px; }
body.has-touch #hud .tt-acts { position: static; flex-direction: row; align-items: center; gap: 6px; }
body.has-touch #hud #h-finish { min-height: 44px; padding: 0 12px; font-size: 13px; max-width: 118px; }
body.has-touch #hud #h-finish span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Single-line Active Objective Pill + Collapsible Checklist Drawer */
body.has-touch #hud kbd,
body.has-touch #ext-hud kbd { display: none !important; }
body.has-touch #hud .tt-obj {
  position: relative;
  top: auto;
  inset-inline-start: auto;
  order: 3;
  flex: 0 1 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: auto;
  max-width: min(380px, 100%);
  margin-inline: auto;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}
body.has-touch #hud .tt-obj-bar,
body.has-touch #hud .tt-obj-drawer { pointer-events: auto; }
body.has-touch #hud .tt-obj-bar {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 44px;
  padding: 6px 13px 6px 11px;
  border-radius: 999px;
  background: var(--hud-bg);
  color: var(--hud-text);
  border: 1px solid var(--hud-border);
  box-shadow: var(--hud-shadow);
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
body.has-touch #hud .tt-obj.open .tt-obj-bar { border-color: rgba(96, 165, 250, 0.6); background: var(--hud-bg-hi); }
body.has-touch #hud .tt-obj-dot { width: 8px; height: 8px; border-radius: 50%; background: #3b82f6; box-shadow: 0 0 8px rgba(59, 130, 246, 0.8); flex: none; }
body.has-touch #hud .tt-obj-bar .tt-stepn {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 750;
}
body.has-touch #hud .tt-obj-cur { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f8fafc; }
body.has-touch #hud .tt-obj-chev { flex: none; display: inline-flex; color: #94a3b8; transition: transform .18s ease; }
body.has-touch #hud .tt-obj-chev svg.i { width: 14px; height: 14px; transform: rotate(90deg); }
body.has-touch #hud .tt-obj.open .tt-obj-chev svg.i { transform: rotate(-90deg); }
body.has-touch #hud .tt-obj-drawer {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: min(320px, calc(100vw - 24px));
  max-height: 40vh;
  max-height: 40dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(12, 18, 30, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 30;
}
body.has-touch #hud .tt-obj.open .tt-obj-drawer { display: block; }

/* Sub-row below top bar: Coach banner + Collapsible Minimap + Next Turn + Compact X-Ray */
body.has-touch #hud .tt-sub {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  pointer-events: none;
}
html body.has-touch #hud .tt-msg {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: center;
  width: min(380px, 100%);
  gap: 4px;
}
body.has-touch #hud .tt-line { padding: 6px 12px; font-size: 13px; line-height: 1.32; pointer-events: none; }
body.has-touch #hud .tt-sg-art canvas { width: 28px; height: 28px; }
body.has-touch #hud .tt-bl { position: static; grid-column: 1; grid-row: 2; flex-direction: column; align-items: flex-start; gap: 6px; }
body.has-touch #hud .tt-look { display: none; }
body.has-touch #hud #h-map { width: 60px; height: 60px; }
body.has-touch #hud .tt-map-wrap.collapsed #h-map { display: none; }
body.has-touch #hud .tt-map-wrap.collapsed .tt-map-toggle {
  width: 44px; height: 44px;
  background: var(--hud-bg-btn);
  border: 1px solid var(--hud-border);
  box-shadow: var(--hud-shadow);
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
  color: #f8fafc;
}
body.has-touch #hud .tt-map-wrap.collapsed .tt-map-ic { display: grid; place-items: center; }
body.has-touch #hud .tt-map-wrap.collapsed .tt-map-ic svg.i { width: 20px; height: 20px; }

body.has-touch #hud .tt-tc { position: static; left: auto; transform: none; grid-column: 2; grid-row: 2; justify-self: center; gap: 4px; }
body.has-touch #hud .tt-br { position: static; grid-column: 3; grid-row: 2; align-items: flex-end; gap: 6px; }
body.has-touch #hud .tt-turn { position: static; padding: 6px 10px 6px 8px; gap: 7px; border-radius: 12px; }
body.has-touch #hud .tt-turn > svg.i { width: 22px; height: 22px; }
body.has-touch #hud .tt-turn-b b { font-size: 15px; }
body.has-touch #hud .tt-turn-b small { font-size: 11.5px; max-width: 110px; }
body.has-touch #hud .tt-xray {
  width: auto;
  max-width: min(210px, 58vw);
  padding: 5px 10px;
  border-radius: 999px;
}
body.has-touch #hud .tt-xray .xr-head { gap: 6px; }
body.has-touch #hud .tt-xray .xr-head .lbl { font-size: 11px; letter-spacing: .06em; }
body.has-touch #hud .tt-xray .xr-chip { font-size: 11.5px; padding: 2px 8px; }
body.has-touch #hud .tt-xray :is(.xray-svg, .xr-parts, .xr-why, .xr-now) { display: none; }
body.has-touch[data-page="drive"] .lim-pill {
  top: var(--hud-lim-top, calc(106px + var(--safe-t)));
  left: auto;
  inset-inline-end: calc(10px + var(--safe-r));
  transform: none;
  font-size: 12px;
  padding: 4px 10px;
}

/* Narrow portrait phones (360-480px): keep Row 1 ultra-crisp with zero wrapping */
@media (max-width: 480px) {
  body.has-touch #hud .tt-cam-lbl { display: none; }
  body.has-touch #hud .tt-cam-btn { width: 44px; padding: 0; }
  body.has-touch #hud #h-finish { max-width: 102px; padding: 0 10px; }
}
@media (max-width: 380px) {
  body.has-touch #hud .tt-hud-top { inset-inline: calc(8px + var(--safe-l)) calc(8px + var(--safe-r)); }
  body.has-touch #hud .tt-tl { gap: 5px; }
  body.has-touch #hud .tt-tr-row { gap: 5px; }
  body.has-touch #hud .tt-cluster { padding: 0 7px; gap: 5px; }
  body.has-touch #hud .tt-speed b { font-size: 18px; }
  body.has-touch #hud .tt-limit { width: 28px; height: 28px; font-size: 11.5px; }
  body.has-touch #hud .tt-sign-mini { display: none; }
  body.has-touch #hud #h-finish { max-width: 88px; padding: 0 9px; font-size: 12.5px; }
}

/* Landscape phones (e.g. 844x390, 667x375): single top HUD bar + slim sub-row, bottom >=36% completely open */
@media (max-height: 500px) and (min-width: 560px) {
  body.has-touch #hud .tt-hud-top { top: calc(6px + var(--safe-t)); gap: 5px; }
  body.has-touch #hud .tt-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }
  body.has-touch #hud .tt-tl { order: 0; }
  body.has-touch #hud .tt-obj {
    order: 0;
    flex: none;
    justify-self: center;
    max-width: 100%;
    margin-inline: 0;
  }
  body.has-touch #hud .tt-obj-bar { min-height: 44px; padding: 5px 12px 5px 10px; font-size: 12.5px; }
  body.has-touch #hud .tt-obj-drawer { max-height: 56vh; max-height: 56dvh; }
  body.has-touch #hud .tt-tr { order: 0; }
  body.has-touch #hud .tt-cam-lbl { display: inline; }
  body.has-touch #hud .tt-cam-btn { width: auto; padding: 0 11px; }
  body.has-touch #hud .tt-bl { grid-column: 1; grid-row: 1; }
  body.has-touch #hud #h-map { width: 54px; height: 54px; }
  html body.has-touch #hud .tt-msg { grid-column: 2; grid-row: 1; width: min(440px, 100%); }
  body.has-touch #hud .tt-line { padding: 5px 11px; font-size: 12.5px; }
  body.has-touch #hud .tt-tc { grid-column: 2; grid-row: 2; }
  body.has-touch #hud .tt-br { grid-column: 3; grid-row: 1 / span 2; gap: 4px; }
  body.has-touch #hud .tt-xray { width: auto; max-width: 196px; padding: 4px 9px; border-radius: 999px; }
  body.has-touch #hud .tt-xray .xr-head { gap: 5px; }
  body.has-touch #hud .tt-xray .xr-chip { font-size: 11px; padding: 1px 7px; }
  body.has-touch[data-page="drive"] .lim-pill { top: var(--hud-lim-top, calc(54px + var(--safe-t))); }
}

/* Also apply compact mobile HUD when a non-touch viewport is narrow or short */
@media (max-width: 768px), (max-height: 500px) {
  body:not(.has-touch) #hud .tt-hud-top {
    position: fixed;
    top: calc(8px + var(--safe-t));
    inset-inline: calc(10px + var(--safe-l)) calc(10px + var(--safe-r));
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
  }
  body:not(.has-touch) #hud .tt-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
  body:not(.has-touch) #hud .tt-tl { position: static; order: 1; }
  body:not(.has-touch) #hud .tt-tl-col { display: flex; align-items: center; }
  body:not(.has-touch) #hud .tt-cluster { position: static; left: auto; bottom: auto; transform: none; height: 44px; padding: 0 9px; gap: 7px; }
  body:not(.has-touch) #hud .tt-cluster .tt-sig,
  body:not(.has-touch) #hud .tt-cluster .tt-hand,
  body:not(.has-touch) #hud .tt-cluster .tt-lamp { display: none; }
  body:not(.has-touch) #hud .tt-speed { min-width: 36px; flex-direction: row; align-items: baseline; gap: 3px; }
  body:not(.has-touch) #hud .tt-speed b { font-size: 20px; }
  body:not(.has-touch) #hud .tt-limit { width: 30px; height: 30px; font-size: 12px; box-shadow: inset 0 0 0 3.5px #dc2626; }
  body:not(.has-touch) #hud .tt-gear [data-g]:not([aria-pressed="true"]):not(.on) { display: none; }
  body:not(.has-touch) #hud .tt-tr { position: static; order: 2; }
  body:not(.has-touch) #hud .tt-cam { display: none; }
  body:not(.has-touch) #hud .tt-cam-btn { display: inline-flex; }
  body:not(.has-touch) #hud .tt-acts { position: static; flex-direction: row; }
  body:not(.has-touch) #hud .tt-obj {
    position: relative; top: auto; inset-inline-start: auto; order: 3; flex: 0 1 100%; display: flex; flex-direction: column; align-items: center;
    width: auto; max-width: min(380px, 100%); margin-inline: auto; padding: 0; border: 0; background: none; box-shadow: none; backdrop-filter: none; pointer-events: none;
  }
  body:not(.has-touch) #hud .tt-obj-bar,
  body:not(.has-touch) #hud .tt-obj-drawer { pointer-events: auto; }
  body:not(.has-touch) #hud .tt-obj-bar {
    display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-height: 44px; padding: 6px 13px 6px 11px;
    border-radius: 999px; background: var(--hud-bg); color: var(--hud-text); border: 1px solid var(--hud-border);
    box-shadow: var(--hud-shadow); backdrop-filter: var(--hud-blur); -webkit-backdrop-filter: var(--hud-blur); font-size: 13px; font-weight: 650;
  }
  body:not(.has-touch) #hud .tt-obj-dot { width: 8px; height: 8px; border-radius: 50%; background: #3b82f6; flex: none; }
  body:not(.has-touch) #hud .tt-obj-cur { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body:not(.has-touch) #hud .tt-obj-chev svg.i { width: 14px; height: 14px; transform: rotate(90deg); }
  body:not(.has-touch) #hud .tt-obj.open .tt-obj-chev svg.i { transform: rotate(-90deg); }
  body:not(.has-touch) #hud .tt-obj-drawer {
    display: none; position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    width: min(320px, calc(100vw - 24px)); max-height: 40dvh; overflow-y: auto; padding: 12px 14px;
    border-radius: 16px; background: rgba(12, 18, 30, 0.92); border: 1px solid rgba(255, 255, 255, 0.18); z-index: 30;
  }
  body:not(.has-touch) #hud .tt-obj.open .tt-obj-drawer { display: block; }
  body:not(.has-touch) #hud .tt-sub { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 6px; }
  body:not(.has-touch) #hud .tt-msg { position: static; left: auto; bottom: auto; transform: none; grid-column: 1 / -1; grid-row: 1; justify-self: center; width: min(400px, 100%); }
  body:not(.has-touch) #hud .tt-bl { position: static; grid-column: 1; grid-row: 2; }
  body:not(.has-touch) #hud .tt-look { display: none; }
  body:not(.has-touch) #hud #h-map { width: 60px; height: 60px; }
  body:not(.has-touch) #hud .tt-map-wrap.collapsed #h-map { display: none; }
  body:not(.has-touch) #hud .tt-map-wrap.collapsed .tt-map-toggle { width: 44px; height: 44px; background: var(--hud-bg-btn); border: 1px solid var(--hud-border); color: #f8fafc; }
  body:not(.has-touch) #hud .tt-map-wrap.collapsed .tt-map-ic { display: grid; place-items: center; }
  body:not(.has-touch) #hud .tt-tc { position: static; left: auto; transform: none; grid-column: 2; grid-row: 2; justify-self: center; }
  body:not(.has-touch) #hud .tt-br { position: static; grid-column: 3; grid-row: 2; align-items: flex-end; }
  body:not(.has-touch) #hud .tt-turn { position: static; padding: 6px 10px; }
  body:not(.has-touch) #hud .tt-xray { width: 172px; padding: 7px 8px; }
  body:not(.has-touch) #hud .tt-xray :is(.xr-why, .xr-now) { display: none; }
}

/* ---------- Debrief: the town from straight above, the route, the scrubber and the result panel ---------- */
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#db-route { position: fixed; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; display: none; }
#db-route.on { display: block; }
.db-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.db-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.db-case { stroke: #fff; stroke-width: 10; }
.db-line { stroke: var(--cool); stroke-width: 5.5; }
.db-fcase { stroke: #fff; stroke-width: 15.5; }
.db-f { stroke-width: 10; }
.db-f.hot { stroke: var(--hot); }
.db-f.sun { stroke: var(--sun); }
.db-start { fill: #fff; stroke: var(--ink); stroke-width: 2.5; }
.db-dot { stroke: var(--ink); stroke-width: 2; }
.db-dot.hot { fill: var(--hot); }
.db-dot.sun { fill: var(--sun); }
.db-dot.go { fill: var(--go); }
.db-tags { position: absolute; inset: 0; }
.db-tag { position: absolute; left: 0; top: 0; width: max-content; max-width: 15em; translate: -50% calc(-100% - 13px); padding: .2em .6em .25em; border-radius: var(--r-row);
  border: 2px solid var(--ink); box-shadow: 0 0 0 2px #fff; font-size: .82em; font-weight: 700; line-height: 1.25; text-align: center; will-change: transform; }
.db-tag::after { content: ""; position: absolute; left: 50%; bottom: -6.5px; width: 9px; height: 9px; margin-left: -4.5px; background: inherit; border: 2px solid var(--ink); border-top: 0; border-left: 0; rotate: 45deg; }
.db-tag.at-b { translate: -50% 13px; }
.db-tag.at-b::after { bottom: auto; top: -6.5px; rotate: 225deg; }
.db-tag.at-r { translate: 13px -50%; }
.db-tag.at-r::after { left: -6.5px; bottom: auto; top: 50%; margin: -4.5px 0 0; rotate: 135deg; }
.db-tag.at-l { translate: calc(-100% - 13px) -50%; }
.db-tag.at-l::after { left: auto; right: -6.5px; bottom: auto; top: 50%; margin: -4.5px 0 0; rotate: -45deg; }
.db-tag b { font-variant-numeric: tabular-nums; }
.db-tag.hot { background: var(--hot-ink); color: #fff; }
.db-tag.sun { background: var(--sun); color: var(--ink); }
.db-tag.go { background: var(--go); color: var(--ink); }
.db-tag.sel { z-index: 2; box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px var(--ink); }
.db-car { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.db-car i { position: absolute; left: -16px; top: -9px; width: 32px; height: 18px; border-radius: 7px 9px 9px 7px; background: var(--accent); box-shadow: 0 0 0 2.5px #fff, 0 0 0 4.5px var(--ink), 0 4px 8px rgba(23, 32, 58, .35); }
.db-car i::before, .db-car i::after { content: ""; position: absolute; top: 3px; bottom: 3px; border-radius: 2px; background: var(--ink); }
.db-car i::before { left: 5px; width: 4px; opacity: .7; }      /* rear window */
.db-car i::after { right: 6px; width: 7px; border-radius: 3px 4px 4px 3px; }   /* windscreen, at the front */

.db-panel { position: absolute; top: calc(var(--top-h, 4.6em) + .35em); inset-inline-end: calc(var(--gutter) + var(--safe-r)); bottom: calc(var(--gutter) + var(--safe-b));
  width: 27em; max-width: 43%; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
@media (prefers-reduced-motion: no-preference) { .db-panel.in { animation: tt-in-side .22s ease-out; } [dir="rtl"] .db-panel.in { animation-name: tt-in-side-rtl; } }
.db-panel.empty { bottom: auto; }
.db-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: .85em 1.1em 1em; scrollbar-width: thin; }
.db-top { display: flex; align-items: center; justify-content: space-between; gap: .6em; }
.db-what { display: flex; flex-direction: column; min-width: 0; }
.db-what .lbl { overflow-wrap: anywhere; }
.db-what small { color: var(--ink-2); font-size: .82em; font-weight: 600; }
.db-drives { flex: none; }
.db-verdict { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .75em; margin-top: .75em; }
.db-stamp { width: 3.3em; height: 3.3em; border-radius: 50%; display: grid; place-items: center; border: var(--outline) solid var(--ink); box-shadow: var(--shadow-badge); background: var(--surface-2); color: var(--ink); }
.db-stamp svg { width: 1.65em; height: 1.65em; stroke-width: 2.6; }
.db-stamp.hot { background: var(--hot); color: #fff; }
.db-stamp.go { background: var(--go); color: #fff; }
.db-stamp.sun { background: var(--sun); }
.db-stamp.cool { background: var(--cool-soft); }
.db-vt .lbl { display: block; margin-bottom: .15em; }
.db-verdict h1 { margin: 0; font-size: 2.05em; line-height: 1.05; overflow-wrap: anywhere; }
.db-score { margin: 0; white-space: nowrap; text-align: end; line-height: 1; }
.db-score b { font-size: 2.3em; font-variant-numeric: tabular-nums; }
.db-score small { font-weight: 700; color: var(--ink-2); margin-inline-start: .1em; }
.db-lead { margin: .6em 0 0; color: var(--ink-2); }
.db-note { margin: .65em 0 0; padding: .55em .75em; border-radius: var(--r-row); background: var(--hot-soft); box-shadow: inset 0 0 0 2px var(--hot); font-weight: 600; }
.db-note.info { background: var(--surface-2); box-shadow: none; font-weight: 400; }
.db-stats { list-style: none; margin: .8em 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35em; }
.db-stats .chip { gap: .35em; font-weight: 500; }
.db-stats b { font-weight: 800; }
.db-body > h2.lbl { margin: 1.1em 0 .5em; }
.db-none { margin: 0; color: var(--ink-2); }
.db-mos { list-style: none; margin: 0; padding: 0; display: grid; gap: .45em; }
.db-mo { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .1em .65em; padding: .5em .55em .5em .65em; border-radius: var(--r-row); border: 2px solid var(--line); }
.db-mo .tm { grid-row: 1 / span 2; align-self: start; padding-top: .05em; font-family: var(--font-display); font-weight: 800; font-size: 1.12em; font-variant-numeric: tabular-nums; }
.db-mo-t { grid-column: 2; font-weight: 700; line-height: 1.25; }
.db-mo .dot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; margin-inline-end: .4em; box-shadow: 0 0 0 1.5px var(--ink); }
.db-mo .dot.hot { background: var(--hot); }
.db-mo .dot.sun { background: var(--sun); }
.db-mo .dot.go { background: var(--go); }
.db-mo small { grid-column: 2; color: var(--ink-2); font-size: .86em; line-height: 1.3; }
.db-watch { grid-column: 3; grid-row: 1 / span 2; }
.db-mo.sel { border-color: var(--ink); background: var(--surface-2); }
.db-why { grid-column: 1 / -1; margin-top: .45em; padding-top: .45em; border-top: 2px solid var(--line); font-size: .9em; }
.db-why b { display: block; font-size: .8em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
[dir="rtl"] .db-why b { letter-spacing: 0; }
.db-why p { margin: .1em 0 .45em; }
.db-body .fine { margin-top: 1.1em; }
.db-acts { flex: none; display: flex; flex-wrap: wrap; gap: .5em; padding: .75em 1.1em .9em; border-top: 2px solid var(--line); background: var(--surface); }
.db-acts .tb { flex: 1 1 auto; white-space: normal; text-align: center; }
.db-acts .tb:not(.primary) { padding-inline: .8em; }
.db-acts .tb.primary { flex-basis: 100%; }

.db-scrub { position: absolute; inset-inline-start: calc(var(--gutter) + var(--safe-l)); inset-inline-end: calc(min(27em, 43%) + 2 * var(--gutter) + var(--safe-r));
  bottom: calc(var(--gutter) + var(--safe-b)); max-width: 44em; display: flex; align-items: center; gap: .6em; padding: .4em .55em; border-radius: var(--pill); }
/* a media timeline: it runs left to right in every language (the bar keeps its place on the screen) */
[dir="rtl"] .db-scrub { flex-direction: row-reverse; }
.db-range { direction: ltr; }
.db-scrub .tm { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2.5em; text-align: center; }
.db-scrub .db-end { color: var(--ink-2); }
.db-scrub .db-play { background: var(--accent); color: #fff; }
.db-range { flex: 1; min-width: 4em; height: 44px; margin: 0; accent-color: var(--cool); cursor: pointer; }

.db-qq { margin: 0 0 .8em; font-weight: 600; font-size: 1.05em; }
.db-qa { display: grid; gap: .5em; }
.db-qa .tb { justify-content: flex-start; text-align: start; white-space: normal; }
.db-qa .tb[disabled] { color: var(--ink-2); border-color: var(--line); box-shadow: none; }
.db-qa .tb.right { color: var(--ink); background: var(--go-soft); border-color: var(--go); }
.db-qa .tb.wrong { color: var(--ink); background: var(--hot-soft); border-color: var(--hot); }
.db-qw { margin: .8em 0 0; padding: .6em .75em; border-radius: var(--r-row); background: var(--surface-2); }
.db-q .lk { margin-top: .4em; }
.db-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45em; }
.db-pick { width: 100%; display: flex; align-items: center; gap: .7em; min-height: 44px; padding: .55em .75em; border-radius: var(--r-row); border: 2px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; text-align: start; cursor: pointer; }
.db-pick:hover { border-color: var(--ink); }
.db-pick[aria-current="true"] { border-color: var(--ink); background: var(--surface-2); box-shadow: var(--shadow-badge); }
.db-pk { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.db-pk small { color: var(--ink-2); }
.db-pick .chip { flex: none; min-width: 2.7em; justify-content: center; font-variant-numeric: tabular-nums; }

/* the plugins' debrief cards (speed graph and share buttons, manoeuvre and town-rule results) on the white panel */
.db-panel .xr-panel { margin: 1.1em 0 0; padding: .8em .85em .85em; border-radius: var(--r-row); background: var(--surface-2); border: 0; }
.db-panel .xr-head h3 { font-size: 1em; }
.db-panel .xr-legend { color: var(--ink-2); font-size: .8em; }
.db-panel .xr-graph { height: 7.6em; padding: .3em; border-radius: var(--r-row); background: var(--ink); }
.db-panel .xr-note { color: #C9D3EA; }
.db-panel .xr-tail { display: block; }
.db-panel .xr-share { margin-top: .7em; }
.db-panel .xr-share .btn { all: unset; box-sizing: border-box; flex: 1 1 12em; display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 44px; padding: .45em 1em;
  border-radius: var(--pill); border: var(--outline) solid var(--ink); box-shadow: var(--shadow-btn); background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; text-align: center; }
.db-panel .xr-share .btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.db-panel .xr-share .btn svg { width: 1.15em; height: 1.15em; }
.db-panel .x-man, .db-panel .x-tr { margin-top: 1.1em; padding: .75em .85em; border-radius: var(--r-row); background: var(--surface-2); color: var(--ink); }
.db-panel .x-man h3, .db-panel .x-tr h3 { margin: 0 0 .35em; font-size: 1em; }
.db-panel .x-man li, .db-panel .x-tr li { border-bottom-color: var(--line); font-size: .92em; }
.db-panel .x-man .ok, .db-panel .x-tr .ok { color: var(--go-ink); }
.db-panel .x-man .bad, .db-panel .x-tr .bad { color: var(--hot-ink); }
.db-panel .x-man small { opacity: 1; color: var(--ink-2); }
.db-panel .bar-row { margin-top: 1.1em; padding: .85em; border-radius: var(--r-row); background: var(--surface-2); }
.db-panel .x-wx-deb { margin: 1.1em 0 0; padding: .75em .85em; border-radius: var(--r-row); background: var(--surface-2); border: 0; color: var(--ink); }
.db-panel .x-wx-deb h3 { font-size: 1em; }
.db-panel .x-wx-deb p, .db-panel .x-wx-key { opacity: 1; color: var(--ink-2); }
.db-panel .x-wx-bar { background: var(--line); }
.db-panel .x-wx-bar i { background: rgba(110, 124, 150, .55); }
.db-panel .x-wx-row.now span:first-child { color: var(--ink); }

/* the examiner's way back to its sheet while one of its faults replays: under the top bar */
body #xe-back { top: calc(var(--top-h, 4.6em) + .45em); left: auto; inset-inline-start: calc(var(--gutter) + var(--safe-l)); transform: none; min-height: 44px; padding: .4em 1em;
  border: var(--outline) solid var(--ink); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-btn); font-family: var(--font-body); font-weight: 700; }
body #xe-back:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

@media (max-width: 640px) {
  /* the scrubber sits right above the panel at the bottom, so the town keeps one open area under the top bar */
  #page > .screen.db-scr { inset: auto 0 0; display: flex; flex-direction: column; gap: .45em; }
  .db-panel { position: relative; top: auto; inset-inline: auto; bottom: auto; width: auto; max-width: none; max-height: 46vh; max-height: 46dvh;
    border-radius: var(--r-panel) var(--r-panel) 0 0; border-bottom: 0; box-shadow: 0 -.25em 0 var(--ink); }
  @media (prefers-reduced-motion: no-preference) { .db-panel.in, [dir="rtl"] .db-panel.in { animation: tt-in-up .24s ease-out; } }
  .db-scrub { position: relative; inset: auto; margin-inline: calc(var(--gutter) + var(--safe-l)) calc(var(--gutter) + var(--safe-r)); max-width: none; padding: .25em .4em; gap: .45em; }
  .db-body { padding: .7em var(--gutter) .8em; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .db-verdict { margin-top: .55em; gap: .6em; }
  .db-verdict h1 { font-size: 1.6em; }
  .db-score b { font-size: 1.9em; }
  .db-stamp { width: 2.8em; height: 2.8em; }
  .db-acts { padding: .6em var(--gutter) calc(.7em + var(--safe-b)); gap: .4em; }
  .db-acts .tb:not(.primary) { flex: 1 1 0; min-width: 0; font-size: .88em; padding: .3em .45em; gap: .3em; line-height: 1.15; }
}
@media (max-height: 500px) and (min-width: 600px) {
  .db-panel { top: calc(var(--top-h, 3.6em) + .25em); width: min(25em, 50%); max-width: 50%; }
  .db-scrub { inset-inline-end: calc(min(25em, 50%) + 2 * var(--gutter) + var(--safe-r)); padding: .25em .45em; }
  .db-body { padding: .6em .85em .8em; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .db-verdict { margin-top: .5em; }
  .db-verdict h1 { font-size: 1.5em; }
  .db-score b { font-size: 1.8em; }
  .db-stamp { width: 2.6em; height: 2.6em; }
  .db-acts { padding: .5em .85em .6em; gap: .4em; }
  .db-acts .tb.primary { font-size: 1.05em; }
  .db-acts .tb:not(.primary) { flex: 1 1 0; min-width: 0; font-size: .88em; padding: .3em .45em; gap: .3em; line-height: 1.15; }
}

/* ---------- extras: Signs guide and Stopping lab (white panels in a column over the turning town) ---------- */
.ex-scroll { position: absolute; inset: var(--top-h, 4.6em) 0 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; pointer-events: auto;
  padding: .6em calc(var(--gutter) + var(--safe-r)) calc(var(--gutter) + var(--safe-b) + .4em) calc(var(--gutter) + var(--safe-l)); }
.ex-col { max-width: 60em; margin-inline: auto; display: flex; flex-direction: column; gap: 1.15em; padding-bottom: .4em; }
/* A free visitor's countdown pill sits under the top bar at the end of the line; where the column leaves no room beside
   it, the column starts below it. */
body[data-page="signs"] .lim-pill, body[data-page="lab"] .lim-pill { top: calc(var(--top-h, 4.6em) + .35em); left: auto; transform: none; inset-inline-end: calc(var(--gutter) + var(--safe-r)); }
@media (max-width: 1240px) {
  body[data-page="signs"]:has(#lim-pill:not(.hidden)) .ex-scroll, body[data-page="lab"]:has(#lim-pill:not(.hidden)) .ex-scroll { top: calc(var(--top-h, 4.6em) + 2.7em); }
}
.ex-head h1 { font-size: clamp(1.85em, 3.3vw, 2.6em); margin: .18em 0 .3em; }
.ex-head p { margin: 0; max-width: 46em; }
.ex-col h2.t { font-size: 1.3em; margin: 0; }
.ex-note { align-self: flex-start; margin: 0; max-width: 46em; padding: .55em .85em; border-radius: var(--r-row); background: var(--surface); border: 2px solid var(--ink); font-size: .88em; color: var(--ink-2); }

.sg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8em 1.2em; margin-top: .9em; }
.sg-meter { display: flex; align-items: center; gap: .7em; flex: 1 1 14em; max-width: 24em; }
.sg-meter .bar { flex: 1; height: .7em; }
.sg-meter b { font-family: var(--font-display); font-weight: 800; }
.sg-grid { list-style: none; margin: .75em 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17.5em, 1fr)); gap: .7em; }
.sg-card { display: flex; align-items: flex-start; gap: .8em; padding: .7em .8em; border-radius: var(--r-row); background: var(--surface-2); }
.sg-card.found { box-shadow: inset 0 0 0 2px var(--go); }
.sg-art { flex: none; display: grid; place-items: center; width: 4.6em; height: 4.6em; border-radius: .8em; background: #fff; border: 2px solid var(--ink); }
.sg-art canvas { width: 80%; height: 80%; }
.sg-art.big { width: 9.5em; height: 9.5em; border-width: var(--outline); box-shadow: var(--shadow-badge); }
.sg-txt { min-width: 0; }
.sg-no { display: flex; flex-wrap: wrap; align-items: center; gap: .2em .5em; margin: 0 0 .2em; font-size: .86em; font-weight: 600; color: var(--ink-2); }
.sg-no .chip { font-size: .95em; padding-block: .05em; }
.sg-card h3 { margin: 0 0 .2em; font-family: var(--font-display); font-weight: 700; font-size: 1.06em; line-height: 1.2; }
.sg-card p.mut { margin: 0; font-size: .93em; }
.sg-quiz[hidden] { display: none; }
.sg-q { display: flex; align-items: flex-start; gap: 1.3em; }
.sg-q-body { flex: 1; min-width: 0; }
.sg-q-body h2 { margin: .15em 0 0; }
.sg-opts { display: grid; gap: .55em; margin-top: .8em; max-width: 30em; }
.sg-opt { justify-content: flex-start; text-align: start; font-size: 1.02em; }
.sg-opt[disabled] { color: var(--ink); border-color: var(--ink); box-shadow: var(--shadow-btn); opacity: .55; }
.sg-opt.right, .sg-opt.wrong { opacity: 1; }
.sg-opt.right { background: var(--go-soft); box-shadow: inset 0 0 0 2px var(--go), var(--shadow-btn); }
.sg-opt.wrong { background: var(--hot-soft); box-shadow: inset 0 0 0 2px var(--hot), var(--shadow-btn); }
.sg-why { min-height: 1.4em; margin: .8em 0 0; max-width: 34em; }
.sg-done { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8em; }
.sg-done .t { margin: 0; font-size: 1.5em; }

.lb-grid { display: grid; grid-template-columns: minmax(15em, 20em) minmax(0, 1fr); gap: 1.15em; align-items: start; }
.lb-sl { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .1em .6em; margin-bottom: .75em; }
.lb-sl label { font-weight: 700; }
.lb-sl output { font-family: var(--font-display); font-weight: 800; font-size: 1.1em; color: var(--cool-deep); }
.lb-sl input { grid-column: 1 / -1; }
.lb-seg { display: flex; width: 100%; margin-top: .55em; }
.lb-seg button { flex: 1 1 0; min-height: 44px; line-height: 1.15; }
.lb-road { position: relative; padding-top: 2.3em; }
.lb-road canvas { display: block; width: 100%; height: 6.6em; }
.lb-stop { position: absolute; top: 0; left: 50%; translate: -50% 0; padding: .15em .7em; border-radius: var(--pill); background: var(--surface); border: 2px solid var(--ink); box-shadow: var(--shadow-badge);
  font-weight: 700; font-size: .88em; white-space: nowrap; }
.lb-num { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6em; margin-top: .7em; }
.lb-num p { margin: 0; padding: .5em .7em; border-radius: var(--r-row); background: var(--surface-2); border-inline-start: .4em solid var(--sun); }
.lb-num p.br { border-inline-start-color: var(--hot); }
.lb-num p.to { border-inline-start-color: var(--cool); }
.lb-num b { display: block; font-size: 1.55em; }
.lb-num span { font-size: .86em; color: var(--ink-2); line-height: 1.2; display: block; }
.lb-insight { margin: .85em 0 0; font-weight: 600; }
.lb-rule ul { margin: .55em 0 1em; padding-inline-start: 1.2em; }
.lb-rule li { margin: .3em 0; }
@media (max-width: 760px) {
  .lb-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .ex-col { gap: .9em; }
  .sg-grid { grid-template-columns: minmax(0, 1fr); }
  .sg-q { flex-direction: column; align-items: center; text-align: center; }
  .sg-q-body { width: 100%; }
  .sg-opts { max-width: none; }
  .sg-foot .tb { width: 100%; }
  .lb-num { gap: .4em; }
  .lb-num p { padding: .45em .5em; }
  .lb-num b { font-size: 1.3em; }
}

/* ---------- the route: level map and Today's route card (src/shell/route.js) ---------- */
svg.st { display: block; width: 100%; height: 100%; fill: var(--sun); stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.rt-b { position: relative; flex: none; display: grid; place-items: center; width: calc(var(--r, 30px) * 2); height: calc(var(--r, 30px) * 2); border-radius: 50%;
  background: var(--surface); color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 .22em 0 var(--ink); font-family: var(--font-display); font-weight: 800;
  font-size: calc(var(--r, 30px) * .62); line-height: 1; }
.rt-b.done { background: #128A52; color: #fff; }
.rt-b.next { background: var(--sun); color: var(--ink); }
.rt-b.shut { background: #E3E8F2; color: #4F5D80; }
.rt-b .rt-lock { position: absolute; inset-inline-end: -5px; bottom: -5px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; }
.rt-b .rt-lock svg.i { width: 13px; height: 13px; }
.rt-st { position: absolute; left: 50%; bottom: calc(100% + 1px); transform: translateX(-50%); display: flex; align-items: flex-end; gap: 1px; pointer-events: none; }
.rt-st i { display: block; width: 17px; height: 17px; }
.rt-st i:nth-child(2) { width: 21px; height: 21px; transform: translateY(-5px); }
.rt-st i svg.st { fill: #fff; }
.rt-st i.on svg.st { fill: var(--sun); }

/* the map screen */
.route .rt-panel { position: absolute; top: calc(var(--top-h, 4.6em) + .5em); bottom: calc(var(--gutter) + var(--safe-b)); inset-inline-start: calc(var(--gutter) + var(--safe-l));
  width: min(34em, 46%); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.rt-head { display: flex; align-items: center; gap: .6em; padding: .55em .8em .55em .55em; border-bottom: var(--outline) solid var(--ink); background: var(--surface); flex: none; }
.rt-ttl { flex: 1; min-width: 0; display: grid; }
.rt-ttl h1 { margin: 0; font-size: 1.55em; }
.rt-ttl .mut { font-size: .85em; font-weight: 600; }
.rt-stars, .jr-stars { gap: .35em; font-weight: 700; flex: none; }
.rt-stars svg.st, .jr-stars svg.st { width: 1.15em; height: 1.15em; fill: var(--surface); }
.rt-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; background: #CFEDB4; outline: none; scrollbar-width: thin; }
.rt-map { position: relative; width: 100%; }
.rt-svg { position: absolute; left: 0; top: 0; display: block; }
.rd-edge, .rd-asph, .rd-dash, .rd-trail, .rd-probe { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rd-edge { stroke: var(--ink); stroke-width: 44; }
.rd-asph { stroke: #545C6E; stroke-width: 36; }
.rd-dash { stroke: #fff; stroke-width: 3.5; stroke-dasharray: 13 13; stroke-linecap: butt; }
.rd-trail { stroke: var(--sun); stroke-width: 6; }
.rd-probe { stroke: none; }
.rt-levels { list-style: none; margin: 0; padding: 0; }
.rt-plate { position: absolute; left: 50%; z-index: 2; width: min(19em, 78%); transform: translateX(-50%) rotate(-1.5deg); display: grid; justify-items: center; gap: .05em;
  padding: .5em 1em .6em; background: var(--sun); color: var(--ink); border: var(--outline) solid var(--ink); border-radius: .8em; text-align: center;
  box-shadow: inset 0 0 0 4px var(--sun), inset 0 0 0 5.5px var(--ink), .22em .22em 0 var(--ink); }
[dir="rtl"] .rt-plate { transform: translateX(-50%) rotate(1.5deg); }
.rt-plate .lbl { color: var(--ink); font-size: 11.5px; }
.rt-plate h2 { margin: 0; font-size: 1.6em; overflow-wrap: anywhere; }
.rt-plate .chip { position: absolute; top: -.8em; inset-inline-end: -.7em; background: var(--surface); border: 2px solid var(--ink); font-size: .85em; }
.rt-plate .chip.go { background: var(--go-soft); }
.rt-stamp { position: absolute; top: -.8em; inset-inline-start: -.8em; display: grid; place-items: center; width: 2.1em; height: 2.1em; border-radius: 50%; background: #128A52; color: #fff;
  border: 2.5px solid var(--ink); transform: rotate(-12deg); box-shadow: .1em .1em 0 var(--ink); }
.rt-stamp svg.i { width: 1.2em; height: 1.2em; stroke-width: 3; }
.rt-stop { position: absolute; z-index: 3; display: flex; align-items: center; gap: .65em; margin: 0; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; direction: ltr; font: inherit; text-align: left; }
.rt-stop.left { flex-direction: row-reverse; text-align: right; }
.rt-lab { display: flex; flex-direction: column; min-width: 0; padding: .3em .65em .35em; background: var(--surface); border: 2px solid var(--ink); border-radius: 12px; box-shadow: .14em .14em 0 var(--ink); line-height: 1.2; }
[dir="rtl"] .rt-lab { direction: rtl; }
.rt-lab b { font-family: var(--font-display); font-weight: 800; font-size: 1.02em; letter-spacing: -.01em; overflow-wrap: anywhere; }
.rt-lab small { display: flex; align-items: center; gap: .3em; color: var(--ink-2); font-size: .8em; font-weight: 600; }
.rt-stop.left .rt-lab small { justify-content: flex-end; }
.rt-lab small svg.i { width: 1em; height: 1em; }
.rt-stop.cur .rt-lab { background: var(--sun-soft); }
.rt-lab .here { color: var(--ink); font-weight: 800; }
.rt-stop:focus-visible { outline: none; }
.rt-stop:focus-visible .rt-b, .rt-stop:focus-visible .rt-lab { outline: 3px solid var(--cool-deep); outline-offset: 3px; }
.rt-stop:active .rt-b { transform: translateY(2px); box-shadow: 0 .08em 0 var(--ink); }
.rt-stop:hover .rt-lab { background: var(--surface-2); }
.rt-stop.cur:hover .rt-lab { background: var(--sun-soft); }
.rt-car { position: absolute; left: 0; top: 0; z-index: 4; width: 30px; height: 47px; pointer-events: none; filter: drop-shadow(0 3px 0 rgba(24, 38, 74, .35)); }
.rt-car svg, .jr-car svg { display: block; width: 100%; height: 100%; }
.rt-end { position: absolute; left: 50%; z-index: 2; transform: translateX(-50%); width: max-content; max-width: 90%; }
.rt-end .ort { font-size: .82em; align-items: center; }
.rt-end .ort .t { white-space: normal; text-align: center; }

/* Today's route card */
.jr-card { display: flex; flex-direction: column; gap: .5em; flex: none; }
.jr-top { display: flex; align-items: center; justify-content: space-between; gap: .5em; }
.jr-top .lbl { min-width: 0; }
.jr-card h1 { margin: .1em 0 0; font-size: 2.2em; }
.jr-strip { position: relative; display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 66px; margin: .15em 0 0; padding: .55em .7em .7em;
  border: 2px solid var(--ink); border-radius: 14px; background: #CFEDB4; cursor: pointer; --r: 17px; }
.jr-strip:hover { background: #C4E6AE; }
.jr-strip:active { transform: translate(.08em, .08em); }
.jr-road { position: absolute; left: .6em; right: .6em; top: 50%; height: 18px; margin-top: -10px; background: #545C6E; border-block: 2.5px solid var(--ink); border-radius: 9px; }
.jr-road::after { content: ""; position: absolute; left: 8px; right: 8px; top: 50%; height: 2.5px; margin-top: -1.25px; background: repeating-linear-gradient(90deg, #fff 0 9px, transparent 9px 18px); }
.jr-road i { position: absolute; left: 0; top: 50%; z-index: 1; height: 4px; margin-top: -2px; width: 0; background: var(--sun); border-radius: 2px; }
[dir="rtl"] .jr-road i { left: auto; right: 0; }
.jr-strip .rt-b { z-index: 2; border-width: 2.5px; box-shadow: 0 .14em 0 var(--ink); font-size: 13px; margin-top: -4px; }
.jr-strip .rt-b.next { --r: 23px; font-size: 16px; }
.jr-strip .rt-b .rt-lock { width: 17px; height: 17px; inset-inline-end: -6px; bottom: -6px; }
.jr-strip .rt-b .rt-lock svg.i { width: 10px; height: 10px; }
.jr-strip .mini { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 1px; padding: 0 4px; border-radius: 999px;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--ink); font: 700 10px/14px var(--font-body); direction: ltr; }
.jr-strip .mini svg.st { width: 9px; height: 9px; stroke-width: 2.5; }
.jr-car { position: absolute; top: 50%; z-index: 3; width: 21px; height: 33px; margin: -18px 0 0 -10.5px; transform: rotate(-90deg); left: 0; pointer-events: none; filter: drop-shadow(1px 2px 0 rgba(24, 38, 74, .35)); }
[dir="rtl"] .jr-car { transform: rotate(90deg); }
.jr-news { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35em .5em; padding: .35em .6em; border-radius: var(--r-row); background: var(--sun-soft); font-weight: 700; }
.jr-news > svg.st { width: 1.25em; height: 1.25em; }
.jr-acts { display: flex; flex-wrap: wrap; align-items: center; gap: .55em; margin-top: .2em; }
.jr-acts .tb.ghost { min-height: 48px; }

/* a stop's card */
.lv { display: grid; gap: .75em; }
.lv-top { display: flex; align-items: center; gap: .85em; }
.lv-top .rt-b { --r: 29px; }
.lv-where { display: grid; gap: .35em; min-width: 0; }
.lv-stars { min-height: 28px; display: flex; align-items: center; }
.lv-stars .rt-st { position: static; transform: none; gap: 4px; align-items: center; }
.lv-stars .rt-st i, .lv-stars .rt-st i:nth-child(2) { width: 28px; height: 28px; transform: none; }
.lv h3.lbl { margin: .25em 0 -.3em; }
.lv-acts { display: flex; flex-wrap: wrap; gap: .6em; margin-top: .2em; }
.lv .fine { margin: 0; }
.lv .barrier.in-panel { margin-top: .2em; }

@media (prefers-reduced-motion: no-preference) {
  .route:not(.calm) .rt-b.next::after, .jr-card:not(.calm) .jr-strip .rt-b.next::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--sun); animation: rt-ring 1.8s ease-out infinite; pointer-events: none; }
  .jr-card:not(.calm) .jr-strip .rt-b.next::after { inset: -6px; }
  .route:not(.calm) .rt-b.pop, .jr-card:not(.calm) .rt-b.pop { animation: rt-pop .7s .35s cubic-bezier(.3, 1.6, .5, 1) both; }
  .route:not(.calm) .rt-st.fresh i.on svg.st { animation: rt-star .55s cubic-bezier(.3, 1.7, .5, 1) both; animation-delay: calc(.9s + var(--i) * .22s); }
  .route:not(.calm) .rt-plate.fresh .rt-stamp { animation: rt-stamp .6s 1.4s cubic-bezier(.3, 1.4, .5, 1) both; }
  .jr-card:not(.calm) .jr-news { animation: tt-in-up .35s ease-out; }
}
@keyframes rt-ring { 0% { transform: scale(.92); opacity: .95; } 100% { transform: scale(1.45); opacity: 0; } }
@keyframes rt-pop { 0% { transform: scale(.55); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes rt-star { 0% { transform: scale(0) rotate(-45deg); } 70% { transform: scale(1.45) rotate(10deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes rt-stamp { 0% { transform: scale(2.6) rotate(-35deg); opacity: 0; } 60% { transform: scale(.9) rotate(-8deg); opacity: 1; } 100% { transform: scale(1) rotate(-12deg); opacity: 1; } }

@media (max-width: 640px) {
  .route .rt-panel { inset-inline: 0; top: var(--top-h, 6em); bottom: 0; width: auto; border-radius: var(--r-panel) var(--r-panel) 0 0; border-bottom: 0; box-shadow: none; }
  .rt-scroll { padding-bottom: var(--safe-b); }
  .rt-ttl h1 { font-size: 1.35em; }
  .rt-lab { padding: .25em .55em .3em; }
  .rt-lab b { font-size: .95em; }
  .jr-card h1 { font-size: 1.65em; }
  .jr-card { gap: .4em; }
}
@media (max-height: 500px) and (min-width: 600px) {
  .route .rt-panel { width: min(30em, 58%); top: calc(var(--top-h, 4.6em) + .3em); }
  .rt-head { padding-block: .35em; }
  .rt-ttl h1 { font-size: 1.25em; }
  .jr-card h1 { font-size: 1.4em; }
  .jr-card { gap: .35em; }
  .jr-strip { min-height: 58px; padding-block: .4em .6em; }
  .jr-card .chips .chip { font-size: .8em; }
}
.bx-approx { font-size: .54em; font-weight: 600; opacity: .78; white-space: nowrap; }

/* Gearbox variants in the hill-start briefing */
.br-hill-mode{display:grid;gap:5px;margin:12px 0 16px}.br-hill-mode select{width:100%;max-width:100%;font:inherit;font-weight:650;color:inherit;background:var(--paper,#fffaf0);padding:8px 10px;border:1px solid currentColor;border-radius:8px;cursor:pointer}.br-hill-mode select:focus-visible{outline:3px solid currentColor;outline-offset:2px}
