/* vuer — the ChronoSpace design kit's type (design kit/06_Fonts.zip): Supreme for everything,
   Nippo for the brand and the headings. Both are self-hosted variable fonts (one file covers
   the weights) so the strict CSP and offline/LAN use keep working — no external font origin.
   Neutral dark, subtle white borders, layered shadows, soft reveal animations.
   Layout is responsive: the toolbar wraps, panels track its height, and the
   stats panel becomes a bottom sheet on phones. */
@font-face {
  font-family: "Supreme";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/Supreme-Variable.woff2") format("woff2");
}
@font-face {
  font-family: "Supreme";
  font-style: italic;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/Supreme-VariableItalic.woff2") format("woff2");
}
@font-face {
  font-family: "Nippo";
  font-style: normal;
  font-weight: 200 700;
  font-display: swap;
  src: url("fonts/Nippo-Variable.woff2") format("woff2");
}

:root {
  /* Render native controls (the OS-drawn <select> popup + its highlighted row,
     range inputs, scrollbars) in the dark UA theme. Without this the browser
     paints the open option list with the SYSTEM theme and ignores our option
     CSS — on a light-mode OS that's white-on-white and unreadable. */
  color-scheme: dark;
  /* keyhole palette */
  --bg: #181818;                      /* stage backdrop (keyhole card tone) */
  --panel: rgba(24, 24, 24, 0.82);    /* glass panels floating over the 3D scene */
  --panel-solid: #181818;
  --panel-border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text: #f5f5f7;
  --muted: rgba(255, 255, 255, 0.5);
  --faint: rgba(255, 255, 255, 0.3);
  --btn: rgba(255, 255, 255, 0.06);
  --btn-hover: rgba(255, 255, 255, 0.1);
  --emphasis: rgba(255, 255, 255, 0.14);
  --emphasis-border: rgba(255, 255, 255, 0.22);
  --radius: 16px;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.03),
            0 4px 24px rgba(0, 0, 0, 0.4),
            0 16px 56px rgba(0, 0, 0, 0.3);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  font-family: "Supreme", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body {
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* 3D tracks: the overlay over the stage (js/tracks.js), under every control; shown only while they are on */
#trackLayer { position: fixed; inset: 0; width: 100%; height: 100%; display: none; pointer-events: none; z-index: 2; }
#trackLayer.on { display: block; }

/* Compare (split view) — OFF unless body has .compare (set only when the user
   toggles it). Both canvases share the camera; B sits on top, clipped to the
   right of the wipe (--split). B ignores pointer events so camera drags fall
   through to A; only the divider handle is grabbable. The slider is pure CSS
   (clip-path + left), so dragging never triggers a WebGL re-render. */
:root { --split: 50%; }
#stageB, #compareDivider { display: none; }   /* opt-in: shown only when B has data */
/* The split appears only once compare is on AND a B model is loaded (.has-b).
   Compare-on with no comparable file stays single-view + shows a status. */
body.compare.has-b #stageB {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  pointer-events: none; z-index: 1;
  clip-path: inset(0 0 0 var(--split));
}
body.compare.has-b #compareDivider,
body.compare.b-loading #compareDivider {   /* also while B's first file loads */
  display: block;
  position: fixed; top: 0; bottom: 0; left: var(--split);
  width: 18px; transform: translateX(-50%);
  z-index: 5; cursor: ew-resize; touch-action: none;
}
#compareDivider::before {                 /* the wipe line */
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 2px; transform: translateX(-50%);
  background: rgba(255,255,255,0.85); box-shadow: 0 0 6px rgba(0,0,0,0.6);
}
#compareHandle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 999px;
  background: rgba(24,24,24,0.92); border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f7' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 6 3 12 9 18'/%3E%3Cpolyline points='15 6 21 12 15 18'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
}
/* Bigger touch targets for the wipe on touch devices. */
@media (pointer: coarse) {
  body.compare.has-b #compareDivider { width: 34px; }
  #compareHandle { width: 44px; height: 44px; }
}

/* Per-side file labels (name · size), bottom corners, only in split view. */
#cmpLabelA, #cmpLabelB {
  display: none; position: fixed; bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 6; pointer-events: none; max-width: 44vw;
  padding: 4px 10px; border-radius: 8px; font-size: 12px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text); background: rgba(20,20,20,0.72);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
body.compare.has-b #cmpLabelA { display: block; left: calc(14px + env(safe-area-inset-left)); }
body.compare.has-b #cmpLabelB {
  display: block; right: calc(14px + env(safe-area-inset-right)); text-align: right;
}
/* Compare selector lives in the B label (bottom-right), not the toolbar. */
.cmp-select {
  -webkit-appearance: none; appearance: none; font: inherit; font-size: 12px;
  color: var(--text); background: transparent; border: none; margin: 0;
  padding: 0 15px 0 0; cursor: pointer; max-width: 40vw; pointer-events: auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f7' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right center;
}
.cmp-select option { background: #1c1c1c; color: var(--text); }
#compareStatus {
  display: none; position: fixed; bottom: calc(14px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%); z-index: 6; pointer-events: none;
  padding: 4px 12px; border-radius: 8px; font-size: 12px; color: var(--muted);
  background: rgba(20,20,20,0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
body.compare:not(.has-b) #compareStatus { display: block; }

/* Projection-center crosshair markers (positioned in px by JS). */
.center-marker {
  display: none; position: fixed; z-index: 7; pointer-events: none;
  width: 22px; height: 22px; transform: translate(-50%, -50%);
  background-repeat: no-repeat; background-position: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2354ff9f' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='7'/%3E%3Cline x1='12' y1='1' x2='12' y2='5'/%3E%3Cline x1='12' y1='19' x2='12' y2='23'/%3E%3Cline x1='1' y1='12' x2='5' y2='12'/%3E%3Cline x1='19' y1='12' x2='23' y2='12'/%3E%3C/svg%3E");
}
.center-marker.b {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300e5ff' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='7'/%3E%3Cline x1='12' y1='1' x2='12' y2='5'/%3E%3Cline x1='12' y1='19' x2='12' y2='23'/%3E%3Cline x1='1' y1='12' x2='5' y2='12'/%3E%3Cline x1='19' y1='12' x2='23' y2='12'/%3E%3C/svg%3E");
}

/* vu3 projection-sphere inset (bottom-left) + click-to-pop-out map modal. */
#sphereInset {
  position: fixed; z-index: 8; cursor: pointer;
  left: calc(14px + env(safe-area-inset-left));
  bottom: calc(48px + env(safe-area-inset-bottom));
  width: 88px; height: 88px;
  border-radius: 999px; background: rgba(20,20,20,0.35);
  box-shadow: 0 3px 16px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.18);
}
#sphereInset:hover { border-color: rgba(255,255,255,0.5); }
#sphereInset.grid { border-radius: 12px; }   /* multi-center: a grid panel, not a circle */
#sphereModal:not([hidden]) {
  position: fixed; inset: 0; z-index: 30; display: flex;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
#sphereModalInner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#sphereMapCanvas {
  max-width: 84vw; max-height: 78vh; image-rendering: pixelated;
  border-radius: 10px; box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  background: #000;
}
#sphereMapCaption { color: var(--muted); font-size: 13px; }
#sphereModalClose {
  position: absolute; top: 16px; right: 20px; z-index: 31;
  width: 40px; height: 40px; border-radius: 999px; cursor: pointer;
  background: rgba(30,30,30,0.9); color: var(--text); border: 1px solid rgba(255,255,255,0.2);
  font-size: 22px; line-height: 1;
}

/* Toolbar — wraps to extra rows on narrow screens instead of overflowing.
   js/main.js keeps --toolbar-h in sync with the (possibly wrapped) height. */
#toolbar {
  position: fixed; top: 0; left: 0; right: 0; min-height: 56px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
           10px max(14px, env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(15,15,15,0.92) 65%, rgba(15,15,15,0));
  z-index: 10; pointer-events: none;
  animation: contentFadeIn 0.9s var(--ease) 0.1s both;
}
#toolbar > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; margin-right: 6px; filter: drop-shadow(0 0 20px rgba(255,255,255,0.06)); color: inherit; text-decoration: none; border-radius: 8px; padding: 2px 4px; }
a.brand:hover { background: var(--btn); }
.logo {
  font-weight: 600; font-size: 20px; letter-spacing: -0.02em; color: var(--text);
}
.logo, .logo-er { font-family: "Nippo", "Supreme", sans-serif; }
.logo-er { font-weight: 300; font-size: 20px; letter-spacing: -0.02em; color: var(--muted); }
.spacer { flex: 1; }

.btn {
  appearance: none; border: 1px solid var(--panel-border); background: var(--btn);
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 500; letter-spacing: 0.01em;
  padding: 7px 13px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
  backdrop-filter: blur(8px);
}
.btn:hover { background: var(--btn-hover); border-color: var(--border-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:hover { background: var(--btn); border-color: var(--panel-border); }
.btn.icon { width: 38px; padding: 6px 0; display: inline-flex; align-items: center; justify-content: center; }
.btn.icon[hidden] { display: none; } /* the attribute must win over inline-flex (#btnSaveView) */
.btn.icon svg { display: block; width: 18px; height: 18px; }
/* Active toggle state (e.g. Up: Y-up) — mirrors keyhole's highlighted control. */
.btn.icon.active { background: var(--emphasis); border-color: var(--emphasis-border); color: #fff; }
.btn.icon.active:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.3); }
.btn.primary {
  background: var(--emphasis); border-color: var(--emphasis-border); color: var(--text); font-weight: 600;
}
.btn.primary:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.3); transform: translateY(-2px); }
.btn.select {
  -webkit-appearance: none; appearance: none;
  padding: 6px 28px 6px 10px; max-width: 200px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aeb0b6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 12px;
}
/* Solid menu so the open list is readable — native option lists ignore the
   translucent button background and would render white-on-white. Mirrors
   keyhole's select option styling. */
.btn.select option, .btn.select optgroup { background: #1c1c1c; color: var(--text); }

/* FoV slider (toolbar): compact range input + degree readout. */
.btn.fov { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: default; }
.btn.fov input[type="range"] { width: 74px; accent-color: #8ab4ff; cursor: pointer; }
#fovLabel { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 26px; text-align: right; }
/* Spherical cull (?cull=): the same compact slider, shown only when the option is on. */
#cullWrap[hidden] { display: none; } /* the attribute must win over inline-flex */
#cullLabel { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 40px; text-align: right; }
#cullWrap svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
#cullWrap.active svg, #cullWrap.active #cullLabel { color: #8ab4ff; }
/* Save / Reset of the clip's saved cull (everybody's): small buttons inside the slider's pill. */
.cullBtn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; flex: none;
  background: none; border: 1px solid transparent; border-radius: 6px; color: var(--muted); cursor: pointer; }
.cullBtn[hidden] { display: none; }
.cullBtn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2); }
#cullWrap .cullBtn:hover svg { color: #8ab4ff; }
.cullBtn:disabled { opacity: 0.35; cursor: default; }
/* Its outline: the sphere around the orbit centre, shown while it is resized. */
/* The scene graph: its overlay over the stage (js/graph.js), and its panel on the right. */
#graphLayer { position: fixed; inset: 0; width: 100%; height: 100%; display: none; pointer-events: none; z-index: 2; }
#graphLayer.on { display: block; }
#graphPanel {
  position: fixed; right: max(14px, env(safe-area-inset-right)); top: 74px; width: 244px; z-index: 9;
  max-height: calc(100vh - 190px); overflow-y: auto;
  padding: 10px 12px 11px; border-radius: 12px; border: 1px solid var(--panel-border);
  background: rgba(20,20,20,0.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--text); font-size: 12px; animation: contentFadeIn 0.5s var(--ease) both;
}
#graphPanel[hidden] { display: none; }
/* The interaction timeline (a lane per relation), over the transport and as wide. */
#graphLanes {
  position: fixed; z-index: 8; left: 0; right: 0; margin: 0 auto; bottom: calc(96px + env(safe-area-inset-bottom));
  width: min(640px, calc(100vw - 260px)); min-width: 300px; max-height: 34vh; overflow-y: auto;
  padding: 8px 12px; border-radius: 14px; border: 1px solid var(--panel-border);
  background: rgba(20,20,20,0.72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--text); font-size: 11.5px;
}
#graphLanes[hidden] { display: none; }
#graphLanes .gl-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  font: inherit; font-weight: 600; color: var(--text); background: none; border: 0; padding: 0 4px 6px; cursor: pointer;
}
#graphLanes .gl-head b { font-weight: 400; opacity: 0.7; font-size: 13px; }
/* closed: a small pill over the transport's left end, the picture left clear */
#graphLanes.shut { width: max-content; min-width: 0; margin: 0; left: max(14px, calc(50vw - min(320px, 50vw - 130px))); right: auto; padding: 4px 10px; border-radius: 999px; }
#graphLanes.shut .gl-head { padding: 0; font-weight: 500; }
#graphLanes.shut .gl-head:hover { opacity: 0.8; }
#graphLanes .gl-rows { position: relative; }
#graphLanes .gl-row { display: flex; align-items: center; gap: 10px; padding: 2px 4px; border-radius: 6px; }
#graphLanes .gl-row:hover { background: var(--btn); }
#graphLanes .gl-lab { width: 190px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#graphLanes .gl-lab em { font-style: normal; font-weight: 600; }
#graphLanes .gl-track { position: relative; flex: 1; height: 10px; border-radius: 5px; background: rgba(255,255,255,0.07); cursor: pointer; }
#graphLanes .gl-track i { position: absolute; top: 1px; bottom: 1px; border-radius: 4px; opacity: 0.9; }
#graphLanes .gl-over { position: absolute; top: 31px; bottom: 8px; left: calc(12px + 4px + 190px + 10px); right: calc(12px + 4px); pointer-events: none; }
#graphLanes .gl-over u { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; border-radius: 1px; box-shadow: 0 0 4px rgba(0,0,0,0.8); }
#graphLanes .gl-rows s { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.5); margin-left: calc(4px + 190px + 10px); }
@media (max-width: 720px) { #graphLanes { display: none; } }
#graphTabs { display: flex; gap: 2px; padding: 2px; margin-bottom: 10px; border-radius: 9px; background: rgb(44,44,44); position: sticky; top: 0; z-index: 1; }
#graphTabs button { flex: 1; font: inherit; font-size: 11.5px; color: var(--text); padding: 4px 0; border: 0; border-radius: 7px; background: none; cursor: pointer; opacity: 0.6; }
#graphTabs button.on { background: var(--btn-hover); opacity: 1; font-weight: 600; }
#graphPanel [hidden] { display: none; }
#graphBody { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--panel-border); }
#graphPanel #graphLayers { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--panel-border); }
#graphPanel .g-card { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; padding: 0 4px 5px; }
#graphPanel .g-card i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
#graphPanel .g-sec { display: flex; align-items: center; gap: 7px; font-weight: 600; padding: 8px 4px 4px; }
#graphPanel .g-sec:first-child { padding-top: 0; }
#graphPanel .g-sec i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
#graphPanel .g-sec b { margin-left: auto; font-weight: 400; opacity: 0.6; font-variant-numeric: tabular-nums; }
#graphPanel .g-node.gone span { text-decoration: line-through; opacity: 0.55; }
#graphPanel .g-node.gone b { color: #ffb86b; opacity: 1; }
#graphPanel .g-ev { display: flex; gap: 9px; padding: 4px 5px; border-radius: 7px; cursor: pointer; line-height: 1.35; border-left: 2px solid transparent; }
#graphPanel .g-ev:hover { background: var(--btn); }
#graphPanel .g-ev time { flex: none; width: 46px; opacity: 0.55; font-variant-numeric: tabular-nums; }
#graphPanel .g-ev em { font-style: normal; font-weight: 600; }
#graphPanel .g-ev.next { opacity: 0.4; }
#graphPanel .g-ev.cur { background: var(--btn); border-left-color: #fff; }
#graphPanel .g-ans { padding: 8px 9px; border-radius: 9px; background: rgba(255,255,255,0.07); line-height: 1.45; }
#graphPanel .g-go { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
#graphAnswer { margin-bottom: 8px; }
#graphPanel .g-wait { opacity: 0.6; animation: gWait 1.2s ease-in-out infinite alternate; }
@keyframes gWait { from { opacity: 0.35; } to { opacity: 0.8; } }
#graphPanel .g-meta { opacity: 0.5; font-size: 10.5px; margin-top: 5px; padding: 0 4px; }
#graphPanel .g-desc { opacity: 0.8; line-height: 1.4; padding: 4px 4px 2px; }
#graphPanel .g-view { display: block; width: 100%; border-radius: 8px; margin: 6px 0 2px; }
#graphPanel .g-ev.read em { color: #f0d060; font-style: italic; }
#graphPanel .g-ev.read time::after { content: '◆'; font-size: 7px; margin-left: 3px; vertical-align: middle; opacity: 0.7; }
#graphPanel .g-found { display: flex; align-items: center; gap: 7px; padding: 3px 5px; cursor: pointer; border-radius: 7px; }
#graphPanel .g-found:hover { background: var(--btn); }
#graphPanel .g-found span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#graphPanel .g-found b { font-weight: 400; opacity: 0.55; font-variant-numeric: tabular-nums; font-size: 11px; }
#graphPanel .g-found i { width: 9px; height: 9px; border-radius: 2px; flex: none; background: #f0d060; }
#graphFound:not(:empty) { margin-top: 8px; }
#graphPanel .g-seen { opacity: 0.55; font-style: normal; font-size: 11px; margin-left: 5px; }
#graphLayers { display: flex; flex-wrap: wrap; gap: 5px; }
#graphPanel .g-node { display: flex; align-items: center; gap: 7px; padding: 2.5px 6px 2.5px 4px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; }
#graphPanel .g-node i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
#graphPanel .g-node span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#graphPanel .g-node b { font-weight: 400; font-size: 10px; opacity: 0.45; flex: none; }
#graphPanel .g-node.k-scene, #graphPanel .g-node.k-zone { font-weight: 600; }
#graphPanel .g-node.k-part { opacity: 0.8; }
#graphPanel .g-node .g-act { display: none; gap: 3px; text-decoration: none; flex: none; }
#graphPanel .g-node:hover .g-act, #graphPanel .g-node .g-act:has(.on) { display: flex; }
#graphPanel .g-node:hover b, #graphPanel .g-node:has(.g-act .on) b { display: none; }
#graphPanel .g-act button { font: inherit; font-size: 10px; color: var(--text); padding: 0 6px; border-radius: 999px; cursor: pointer; border: 1px solid var(--panel-border); background: transparent; opacity: 0.7; }
#graphPanel .g-act button:hover { opacity: 1; background: var(--btn-hover); }
#graphPanel .g-act button.on { opacity: 1; background: #fff; color: #111; border-color: #fff; }
#graphPanel .g-node.out span { opacity: 0.4; text-decoration: line-through; }
#graphPanel .g-all { margin-top: 8px; width: 100%; font: inherit; font-size: 11.5px; color: var(--text); padding: 4px 0; border-radius: 8px; cursor: pointer; border: 1px solid var(--panel-border); background: var(--btn); }
#graphPanel .g-all:hover { background: var(--btn-hover); }
#graphPanel .g-node.hot { background: var(--btn); }
#graphPanel .g-node.sel { background: var(--btn); border-color: rgba(255,255,255,0.3); }
#graphPanel .g-say { padding: 2px 4px; border-radius: 7px; cursor: pointer; line-height: 1.4; opacity: 0.9; }
#graphPanel .g-say:hover { background: var(--btn); }
#graphPanel .g-say span { font-weight: 600; }
#graphLayers button {
  font: inherit; font-size: 11px; color: var(--text); padding: 2px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--panel-border); background: transparent; opacity: 0.5;
}
#graphLayers button.on { background: var(--btn); opacity: 1; border-color: rgba(255,255,255,0.22); }
#graphPanel .g-sub { opacity: 0.55; margin: 8px 0 4px; font-size: 11px; letter-spacing: 0.02em; }
#graphPanel .g-row { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 7px; cursor: pointer; }
#graphPanel .g-row:hover { background: var(--btn); }
#graphPanel .g-row i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
#graphPanel .g-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#graphPanel .g-row em { font-style: normal; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; opacity: 0.8; flex: none; }
#graphPanel .g-row b { font-weight: 400; opacity: 0.55; margin-left: auto; flex: none; font-variant-numeric: tabular-nums; }
#graphPanel .g-kv { display: flex; justify-content: space-between; gap: 10px; padding: 1.5px 4px; }
#graphPanel .g-kv span:first-child { opacity: 0.55; }
#graphPanel .g-kv span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
#graphPanel .g-name { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; padding: 0 4px 4px; }
#graphPanel .g-name i { width: 11px; height: 11px; border-radius: 50%; flex: none; }
#graphPanel .g-note { opacity: 0.55; line-height: 1.35; padding: 0 4px; }
#graphPanel .g-note.g-warn { opacity: 0.9; color: #f0c060; padding-top: 4px; }
/* Measure (js/main.js graphMeasure*): three modes, a card per measurement, the scale under them */
#graphPage-measure .g-mode { width: 100%; box-sizing: border-box; }
#graphPage-measure .g-mode button { flex: 1; padding: 5px 0; }
#graphPage-measure .g-hint { opacity: 0.62; line-height: 1.4; padding: 2px 4px 8px; }
#graphPanel .g-mcard { display: flex; align-items: center; gap: 8px; padding: 7px 8px; margin: 0 0 6px; border-radius: 9px; background: rgba(255,255,255,0.06); }
#graphPanel .g-mcard i { width: 9px; height: 9px; border-radius: 50%; flex: none; background: rgb(140,230,255); }
#graphPanel .g-mcard .g-mval { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
#graphPanel .g-mcard .g-mcap { opacity: 0.6; font-size: 11px; line-height: 1.3; }
#graphPanel .g-mcard .g-mtext { flex: 1; min-width: 0; }
#graphPanel .g-mcard.prov .g-mval { color: #f0c060; }
#graphPanel .g-mcard button { font: inherit; color: var(--text); background: none; border: 0; opacity: 0.45; cursor: pointer; padding: 2px 4px; }
#graphPanel .g-mcard button:hover { opacity: 1; }
#graphMeasureFoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 4px 0; border-top: 1px solid var(--panel-border); margin-top: 4px; font-size: 11px; }
#graphMeasureScale { opacity: 0.6; line-height: 1.35; }
#graphMeasureScale.prov { color: #f0c060; opacity: 0.95; }
#graphMeasureFoot button { font: inherit; font-size: 11px; color: var(--text); background: rgba(255,255,255,0.08); border: 0; border-radius: 6px; padding: 3px 9px; cursor: pointer; flex: none; }
#graphMeasureFoot button[hidden] { display: none; }
@media (max-width: 720px) { #graphPanel { display: none; } }
/* A lane's legend (js/field.js): under the toolbar on the left, out of the timeline's way. */
#fieldPanel {
  position: fixed; left: max(14px, env(safe-area-inset-left)); top: 74px; width: 232px; z-index: 9;
  padding: 10px 12px 11px; border-radius: 12px; border: 1px solid var(--panel-border);
  background: rgba(20,20,20,0.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--text); font-size: 12px; animation: contentFadeIn 0.5s var(--ease) both;
}
#fieldPanel[hidden] { display: none; }
#fieldPanel .f-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
#fieldLane {
  flex: 1; min-width: 0; font: inherit; font-size: 12px; color: var(--text); padding: 3px 4px;
  border-radius: 7px; border: 1px solid var(--panel-border); background: var(--btn);
}
#fieldLane:hover { background: var(--btn-hover); }
/* a class lane: a row per class, click to isolate */
#fieldPanel .f-row {
  display: flex; align-items: center; gap: 8px; padding: 3px 5px; border-radius: 7px; cursor: pointer;
  border: 1px solid transparent;
}
#fieldPanel .f-row:hover { background: var(--btn); }
#fieldPanel .f-row.off { opacity: 0.4; }
#fieldPanel .f-row.only { border-color: rgba(255,255,255,0.22); background: var(--btn); }
#fieldPanel .f-row i { width: 11px; height: 11px; border-radius: 3px; flex: none; }
#fieldPanel .f-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#fieldPanel .f-row b { font-weight: 400; opacity: 0.6; font-variant-numeric: tabular-nums; }
#fieldPanel .f-note { margin-top: 8px; opacity: 0.55; line-height: 1.35; }
@media (max-width: 720px) { #fieldPanel { display: none; } }

/* The orbit hint (Sketchfab's "click & hold to rotate"): centred over the stage after a scene lands, the hand swaying
   between the arrows, faded out at the first drag, wheel or touch (or after a while). Never takes a pointer. */
#orbitHint {
  position: fixed; left: 50%; top: 60%; transform: translate(-50%, -50%); z-index: 4; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; text-align: center;
  font-size: 16px; font-weight: 500; line-height: 1.3; letter-spacing: 0.01em;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.7)) drop-shadow(0 0 18px rgba(0,0,0,0.5)); opacity: 0; transition: opacity 0.5s var(--ease);
}
#orbitHint[hidden] { display: none; }
#orbitHint.show { opacity: 0.95; }
#orbitHint.off { opacity: 0; }
#orbitHint svg { width: 168px; height: 67px; overflow: visible; }
#orbitHint .oh-hand { animation: ohSway 2.2s ease-in-out infinite; transform-origin: 64px 30px; }
#orbitHint .oh-arrow { animation: ohPulse 2.2s ease-in-out infinite; }
#orbitHint span { max-width: 160px; }
/* on a white stage (the culled scene): black and translucent */
#orbitHint.light { color: rgba(0, 0, 0, 0.6); filter: drop-shadow(0 1px 2px rgba(255,255,255,0.6)); }
#orbitHint.light .oh-hand path[stroke] { stroke: rgba(255,255,255,0.5); }
@keyframes ohSway { 0%, 100% { transform: translateX(-9px) rotate(-6deg); } 50% { transform: translateX(9px) rotate(6deg); } }
@keyframes ohPulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #orbitHint .oh-hand, #orbitHint .oh-arrow { animation: none; } }
#cullRing { position: fixed; border: 1.5px dashed rgba(37, 99, 235, 0.9); border-radius: 50%; transform: translate(-50%, -50%);
  pointer-events: none; opacity: 0; transition: opacity 0.4s var(--ease); z-index: 5; }
#cullRing.show { opacity: 1; transition: none; }  /* appears at once; only the fade-out animates */
.btn.select option:disabled { color: var(--muted); }
/* Solid (not translucent) highlight: a see-through white over the OS list
   composites toward white-on-white. Browsers that honor option:checked get a
   readable dark row; the rest fall back to the dark-scheme system highlight. */
.btn.select option:checked { background: #2f2f33; color: #fff; }
.badge {
  font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 8px;
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
  background: rgba(255,255,255,0.06); color: var(--muted); border: 1px solid var(--panel-border);
}

/* Stats panel — positioned below the toolbar's live height (wraps on mobile). */
.panel {
  position: fixed; top: calc(var(--toolbar-h, 56px) + 8px); right: 14px; width: 268px;
  max-height: calc(100vh - var(--toolbar-h, 56px) - 24px);
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  backdrop-filter: blur(14px); z-index: 9; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  animation: cardReveal 0.8s var(--ease) both;
}
.panel[hidden] { display: none; } /* the attribute must win over display:flex */
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; font-weight: 500; font-size: 13px; letter-spacing: -0.01em;
  border-bottom: 1px solid var(--panel-border);
}
.panel-body { overflow-y: auto; padding: 4px 0; }
.x { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 4px 8px; transition: color 0.2s var(--ease); }
.x:hover { color: var(--text); }

section[data-sec] { border-bottom: 1px solid rgba(255,255,255,0.04); }
.sec-title {
  margin: 0; padding: 10px 14px; font-size: 11.5px; font-weight: 500; color: var(--muted);
  cursor: pointer; display: flex; justify-content: space-between; text-transform: uppercase; letter-spacing: 0.08em;
}
.chev { transition: transform 0.2s var(--ease); }
section.collapsed .rows { display: none; }
section.collapsed .chev { transform: rotate(-90deg); }
.rows { padding: 0 14px 10px; }
.rows > div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-size: 12px; }
.rows span { color: var(--muted); font-weight: 300; }
.rows b {
  font-weight: 500; font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 11.5px;
  text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px;
}
/* Click a truncated value to expand it (wraps to multiple lines); click again to
   collapse. `.has-more` marks values with hidden content (truncated or summarized). */
.rows b.has-more { cursor: pointer; text-decoration: underline dotted rgba(255,255,255,0.35); text-underline-offset: 2px; }
.rows b.expand {
  white-space: normal; word-break: break-word; text-overflow: clip; max-width: 70%;
}

/* Empty state */
.empty { position: fixed; inset: 0; display: grid; place-items: center; z-index: 5; pointer-events: none; }
.empty.hidden { display: none; }
.empty-card {
  text-align: center; padding: 36px 44px; border-radius: 24px; pointer-events: auto;
  border: 1px solid var(--panel-border); background: rgba(24,24,24,0.55); backdrop-filter: blur(8px);
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
  animation: cardReveal 1.2s var(--ease) both;
}
.empty-logo {
  font-size: 46px; font-weight: 300; letter-spacing: -0.02em; color: var(--text);
  filter: drop-shadow(0 0 20px rgba(255,255,255,0.06)); margin-bottom: 10px;
}
.empty-logo span { color: var(--muted); }   /* "er" in the muted tone, like the toolbar brand */
.empty p { margin: 6px 0; font-size: 14px; font-weight: 300; }
.empty .muted { color: var(--muted); font-size: 12.5px; }
.empty code { background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 6px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.empty .primary { margin-top: 18px; }
.dragging .empty-card { border-color: var(--border-hover); background: rgba(255,255,255,0.05); }

/* Loading */
.loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; background: rgba(15,15,15,0.6); backdrop-filter: blur(4px); }
.loading[hidden] { display: none; }
/* In split view each side's loading overlay is confined to its pane, so the
   loading screen appears in the split that's actually loading (A = left of the
   wipe, B = right). Single view keeps the full-screen overlay. */
body.compare.has-b #loading,
body.compare.b-loading #loading { right: auto; width: var(--split); }
#loadingB { left: var(--split); right: 0; width: auto; }
.loading-card { text-align: center; animation: contentFadeIn 0.5s var(--ease) both; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.12); border-top-color: var(--text); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bar { width: 220px; max-width: 70vw; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin: 12px auto 0; overflow: hidden; }
#loadBar, #loadBarB { height: 100%; width: 0%; background: var(--text); transition: width 0.1s; }
#loadText, #loadTextB { font-size: 13px; font-weight: 300; color: var(--muted); max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Toasts — transient pills, keyhole's seek-flash aesthetic (rounded, blurred,
   fade in/out). Stacked below the toolbar's live height. */
.toasts {
  position: fixed; top: calc(var(--toolbar-h, 56px) + 10px); left: 50%; transform: translateX(-50%);
  z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; max-width: calc(100vw - 24px);
}
.toast {
  padding: 9px 16px; border-radius: 999px;
  background: rgba(24, 24, 24, 0.82); border: 1px solid var(--panel-border);
  color: var(--text); font-size: 13px; font-weight: 500; letter-spacing: 0.01em;
  backdrop-filter: blur(10px); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-6px); transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  max-width: 100%; text-align: center; overflow-wrap: anywhere;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255, 138, 138, 0.4); color: #ffb3b3; }

/* Version + copyright, bottom-right (keyhole's #appFooter). */
#appFooter {
  position: fixed; bottom: 6px; right: 10px; z-index: 7;
  font-size: 10.5px; font-weight: 400; letter-spacing: 0.02em; color: rgba(170, 170, 170, 0.6);
  text-align: right; pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
#appFooter:empty { display: none; }

/* Keyhole reveal animations */
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes contentFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Respect reduced-motion preferences (keyhole's animations are decorative). */
@media (prefers-reduced-motion: reduce) {
  #toolbar, .panel, .empty-card, .loading-card { animation: none; }
}

/* Comfortable touch targets on touch devices */
@media (pointer: coarse) {
  .btn { min-height: 40px; padding: 9px 12px; }
  .btn.icon { width: 40px; min-height: 40px; font-size: 18px; }
  .cullBtn { width: 34px; height: 34px; }     /* the saved cull's Save / Reset: a finger's size */
  .cullBtn svg { width: 18px !important; height: 18px !important; }
  .x { font-size: 22px; padding: 6px 10px; }
  .sec-title { padding: 12px; }
}

/* Narrow screens: fewer toolbar items, bottom-sheet stats */
@media (max-width: 640px) {
  #backendBadge { display: none; }      /* still shown in the stats panel */
  .btn.select { max-width: 130px; }

  /* Stats becomes a bottom sheet — never fights the toolbar for space */
  .panel {
    top: auto; right: 0; left: 0; bottom: 0; width: 100%;
    max-height: 55vh; border-radius: var(--radius) var(--radius) 0 0;
    border-left: none; border-right: none; border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 360px) {
  .empty-card { padding: 20px 16px; }
  .empty-logo { font-size: 34px; }
  .btn { font-size: 12px; padding: 8px 9px; }
  .btn.select { max-width: 104px; }
}

/* .vu4 timeline — bottom centre, clear of the sphere inset (left) and the
   version footer / split labels (right and below). */
#timeline {
  /* Centred with left/right + auto margins, NOT translateX(-50%): the reveal
     animation's final transform would override a transform-based centring. */
  position: fixed; z-index: 8; left: 0; right: 0; margin: 0 auto;
  bottom: calc(44px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px;
  width: min(640px, calc(100vw - 260px)); min-width: 300px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--panel-border);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  animation: cardReveal 0.6s var(--ease) both;
}
#timeline[hidden] { display: none; }
#timeline .btn.icon { width: 32px; min-height: 32px; padding: 4px 0; flex: none; }
#timeline .btn.icon svg { width: 16px; height: 16px; }
/* Play/pause glyph follows the button state (no inline styles: strict CSP). */
#tlPlay.active #tlIconPlay, #tlPlay:not(.active) #tlIconPause { display: none; }
/* Readiness: a slim bar across the top of the timeline pill that fills while a clip
   buffers toward playable, then goes. No text — the bar IS the message. */
#tlReady {
  position: absolute; top: 0; left: 12px; right: 12px; height: 2px;
  border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.14);
}
#tlReady > i {
  display: block; height: 100%; width: var(--ready, 0%);
  border-radius: 999px; background: #8ab4ff; transition: width 0.25s linear;
}
/* The scrub bar carries what a video player's does: played, buffered ahead, the rest.
   `--played` / `--buffered` are set per frame in updateTimelineUI; no loading text anywhere. */
#tlSlider {
  flex: 1; min-width: 80px; cursor: pointer; accent-color: #8ab4ff;
  -webkit-appearance: none; appearance: none; height: 14px; background: transparent;
}
#tlSlider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right,
    #8ab4ff 0 var(--played, 0%),
    rgba(255, 255, 255, 0.42) var(--played, 0%) var(--buffered, 0%),
    rgba(255, 255, 255, 0.16) var(--buffered, 0%) 100%);
}
#tlSlider::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right,
    #8ab4ff 0 var(--played, 0%),
    rgba(255, 255, 255, 0.42) var(--played, 0%) var(--buffered, 0%),
    rgba(255, 255, 255, 0.16) var(--buffered, 0%) 100%);
}
#tlSlider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 12px; height: 12px; margin-top: -4px;
  border-radius: 50%; background: #8ab4ff; border: none;
}
#tlSlider::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #8ab4ff; border: none; }
#tlLabel {
  font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
#tlFps { font-size: 11px; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) {
  #timeline { width: calc(100vw - 28px); min-width: 0; bottom: calc(56px + env(safe-area-inset-bottom)); }
  #tlFps { display: none; }
}
@media (prefers-reduced-motion: reduce) { #timeline { animation: none; } }

/* 3D / 4D model-list switch, left of the model picker. */
.btn.select.kind { max-width: 64px; padding-right: 22px; font-weight: 500; }
/* the scene read every few seconds (scripts/vu4_moments.py): the narrative over the Events feed, a chapter heading, a change the model saw */
#graphPanel .g-narrative { font-size: 12px; opacity: 0.7; padding: 2px 5px 8px; border-bottom: 1px solid var(--panel-border); margin-bottom: 4px; }
#graphPanel .g-ev.chap { margin-top: 6px; border-top: 1px solid var(--panel-border); padding-top: 7px; }
#graphPanel .g-ev.chap em { font-weight: 700; letter-spacing: 0.01em; }
#graphPanel .g-ev.chap.next { opacity: 0.55; }
#graphPanel .g-desc.g-now { cursor: pointer; }
/* an answer's moments on the transport (js/main.js graphTransportMarks): a block per touch, a tick per moment, under the scrub bar; blinking while the playhead is inside one */
#tlMarks { position: absolute; bottom: 4px; height: 4px; pointer-events: none; }
#tlMarks[hidden] { display: none; }
#tlMarks i { position: absolute; top: 0; height: 100%; min-width: 3px; border-radius: 2px; background: rgb(255,138,92); opacity: 0.8; pointer-events: auto; cursor: pointer; transform-origin: center bottom; }
#tlMarks i.tick { width: 3px; margin-left: -1.5px; }
#tlMarks i:hover { opacity: 1; }
#tlMarks i.on { opacity: 1; animation: tlBlink 1s ease-in-out infinite; box-shadow: 0 0 7px 2px rgba(255,138,92,0.75); }
@keyframes tlBlink { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(2.4); opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { #tlMarks i.on { animation: none; } }

/* ---- The 4D tutorial (js/tutorial.js): the overlay of arrows and tags over the stage, the pill that opens it, the
   guide panel. The panel's buttons are TILES — rounded gradient cards with a glyph and a label under them (the views
   of the thing, its parts coloured by kind) — and the guide's words sit on a white card. */
#tutLayer { position: fixed; inset: 0; width: 100%; height: 100%; display: none; pointer-events: none; z-index: 3; }
#tutLayer.on { display: block; }
#tutPill {
  position: fixed; z-index: 9; right: max(18px, env(safe-area-inset-right)); bottom: calc(112px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 9px; padding: 10px 18px 10px 14px; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0.01em; color: #111;
  background: #fff; border: 1px solid rgba(255,255,255,0.6); box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  animation: contentFadeIn 0.6s var(--ease) both; transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
#tutPill:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(0,0,0,0.45); }
#tutPill svg { width: 17px; height: 17px; }
#tutPill[hidden] { display: none; }
#tutPanel {
  --tile-green: linear-gradient(135deg, #a6dc8a 0%, #4f9d5e 100%);
  --tile-yellow: linear-gradient(135deg, #f3d35c 0%, #e0a21f 100%);
  --tile-teal: linear-gradient(135deg, #8fe3d6 0%, #2f9c92 100%);
  --tile-red: linear-gradient(135deg, #f7a48a 0%, #d6473a 100%);
  --tile-violet: linear-gradient(135deg, #cbb4f5 0%, #7c5cc9 100%);
  --tile-pink: linear-gradient(135deg, #f7b4d2 0%, #d2528f 100%);
  --tile-grey: linear-gradient(135deg, #cfd6e0 0%, #7b8794 100%);
  position: fixed; right: max(14px, env(safe-area-inset-right)); top: 74px; width: 270px; z-index: 9;
  max-height: calc(100vh - 150px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 12px 13px 12px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.78); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  color: #141414; font-size: 12px; line-height: 1.4; animation: contentFadeIn 0.5s var(--ease) both;
  box-shadow: 0 10px 34px rgba(0,0,0,0.35); color-scheme: light;
}
#tutPanel[hidden] { display: none; }
#tutPanel .t-head { display: flex; align-items: flex-start; gap: 8px; }
#tutPanel .t-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#tutPanel .t-title b { font-family: "Nippo", "Supreme", sans-serif; font-size: 19px; font-weight: 600; letter-spacing: 0; line-height: 1.1; }
#tutPanel .t-title small { font-size: 10.5px; color: #6b7280; }
#tutPanel .t-x { font: inherit; font-size: 22px; line-height: 1; color: #111; background: none; border: 0; cursor: pointer; opacity: 0.55; padding: 0 2px; }
#tutPanel .t-x:hover { opacity: 1; }
/* a tile: the gradient card, a glyph or a number on it, its label under it */
#tutPanel .t-tile { display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 0; border: 0; background: none; color: #1a1a1a; font: inherit; cursor: pointer; text-align: left; min-width: 0; }
#tutPanel .t-tile .t-face {
  position: relative; display: flex; align-items: center; justify-content: center; height: 46px; border-radius: 11px;
  background: var(--tile-grey); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12), 0 2px 8px rgba(0,0,0,0.25);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
#tutPanel .t-tile:hover .t-face { transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2), 0 8px 20px rgba(0,0,0,0.35); }
#tutPanel .t-tile.on .t-face { box-shadow: 0 0 0 2.5px #111, inset 0 0 0 2px #fff, 0 8px 20px rgba(0,0,0,0.25); }
#tutPanel .t-tile .t-face svg { width: 17px; height: 17px; stroke: rgba(255,255,255,0.95); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tutPanel .t-tile .t-face b { font-family: "Nippo", "Supreme", sans-serif; font-size: 15px; font-weight: 500; color: rgba(255,255,255,0.96); letter-spacing: 0.02em; }
#tutPanel .t-tile .t-face em { position: absolute; right: 6px; bottom: 4px; font-style: normal; font-size: 7px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.75); }
#tutPanel .t-tile span { font-size: 11px; font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
#tutPanel .t-tile.on span { color: #000; }
#tutPanel .t-tile.k-part .t-face { background: var(--tile-green); }
#tutPanel .t-tile.k-control .t-face, #tutPanel .t-tile.k-power .t-face { background: var(--tile-yellow); }
#tutPanel .t-tile.k-sensor .t-face { background: var(--tile-teal); }
#tutPanel .t-tile.k-safety .t-face { background: var(--tile-red); }
#tutPanel .t-tile.k-payload .t-face { background: var(--tile-violet); }
#tutPanel .t-tile.k-accessory .t-face { background: var(--tile-pink); }
#tutPanel .t-tile.k-view .t-face { background: var(--tile-green); height: 38px; }
#tutPanel .t-tile.k-view span { font-size: 10.5px; font-weight: 500; color: #333; }
#tutPanel .t-views { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
#tutPanel .t-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 7px; border-top: 1px solid rgba(0,0,0,0.08); padding-top: 10px; }
#tutPanel .t-sec { grid-column: 1 / -1; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #6b7280; padding: 6px 0 0; }
#tutPanel .t-sec:first-child { padding-top: 0; }
/* the guide's words: a white card popped up on the LEFT, the controls staying on the right */
#tutInfo { position: fixed; left: max(14px, env(safe-area-inset-left)); top: 74px; width: 360px; z-index: 9; max-height: calc(100vh - 150px); overflow-y: auto; transition: top 0.35s var(--ease); }   /* its top is set by the page: centred on the panel's middle */
#tutInfo[hidden] { display: none; }
#tutInfo .t-card { animation: tutPop 0.45s var(--ease) both; transform-origin: 0 0; }
#tutInfo .t-card.again { animation: tutPop2 0.45s var(--ease) both; }
@keyframes tutPop { from { opacity: 0; transform: translateX(-18px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes tutPop2 { from { opacity: 0; transform: translateX(-18px) scale(0.96); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) { #tutInfo { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); left: 10px; right: 10px; width: auto; max-height: 40vh; } }
#tutInfo .t-card { padding: 12px 14px 11px; border-radius: 14px; background: #fff; color: #141414; border-left: 5px solid #fff; box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
#tutInfo .t-card h3 { margin: 0 0 4px; font-family: "Nippo", "Supreme", sans-serif; font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 8px; color: #111; }
#tutInfo .t-card h3 i { width: 11px; height: 11px; border-radius: 50%; flex: none; }
#tutInfo .t-card h3 em { font-family: "Supreme", sans-serif; font-style: normal; font-weight: 500; font-size: 10px; color: #6b7280; margin-left: auto; text-transform: uppercase; letter-spacing: 0.08em; }
#tutInfo .t-card p { margin: 0 0 8px; color: #222; font-size: 14.5px; line-height: 1.5; }
#tutInfo .t-card p:last-child { margin-bottom: 0; }
#tutInfo .t-card .t-warn { padding: 7px 9px; border-radius: 9px; background: #fff4e0; color: #7a4a00; font-size: 12.5px; border: 1px solid #f5d9a3; }
#tutInfo .t-card .t-src { font-size: 11px; color: #6b7280; }
#tutInfo .t-card .t-src a { color: #0a66c2; }
/* what the model saw: crops of the rig views around the pixel it pointed at */
#tutInfo .t-seen { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(0,0,0,0.08); }
#tutInfo .t-seen-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 2px; }
#tutInfo .t-seen figure { margin: 0; flex: none; width: 120px; cursor: zoom-in; }
#tutInfo .t-seen canvas { display: block; width: 120px; height: 120px; border-radius: 9px; background: #e8e8ec; box-shadow: 0 2px 8px rgba(0,0,0,0.18); }
#tutInfo .t-seen figcaption { font-size: 10px; color: #6b7280; margin-top: 3px; line-height: 1.25; }
#tutPanel .t-nav { display: flex; align-items: center; justify-content: center; gap: 10px; }
#tutPanel .t-nav button {
  width: 30px; height: 26px; padding: 0; font: inherit; font-size: 17px; line-height: 1; color: #fff; background: #111;
  border: 0; border-radius: 999px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.25); transition: transform 0.2s var(--ease);
}
#tutPanel .t-nav button:hover { transform: translateY(-1px); }
#tutPanel .t-nav span { font-variant-numeric: tabular-nums; color: #555; font-size: 12px; min-width: 60px; text-align: center; }
#tutPanel .t-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border-top: 1px solid rgba(0,0,0,0.08); padding-top: 10px; font-size: 11px; color: #333; }
#tutPanel .t-foot button { font: inherit; font-size: 11px; color: #111; padding: 3px 10px; border-radius: 999px; cursor: pointer; border: 1px solid rgba(0,0,0,0.18); background: transparent; }
#tutPanel .t-foot button:hover { background: rgba(0,0,0,0.06); }
#tutPanel .t-foot button.on { background: #111; color: #fff; border-color: #111; }
#tutPanel .t-foot .t-note { width: 100%; color: #6b7280; }
@media (max-width: 720px) { #tutPanel { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); left: 10px; right: 10px; width: auto; max-height: 46vh; } #tutPill { bottom: calc(100px + env(safe-area-inset-bottom)); } }

/* ---- ASK: the chat about the 4D scene, in the shape everybody knows (a GPT-like thread) ----------------------
   The launcher (#chatBar) floats over the timeline; the chat (#chat) takes the right half of the screen and the
   stage keeps the left half (body.chat-open). Dark, one centred column, the user's words in a grey bubble on the
   right, the answer as plain text on the left, a rounded composer with a round send button at the foot. */
#chatBar {
  position: fixed; z-index: 8; left: 0; right: 0; margin: 0 auto;
  bottom: calc(44px + env(safe-area-inset-bottom) + 58px);
  width: min(640px, calc(100vw - 260px)); min-width: 300px;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 14px; border-radius: 999px;
  background: rgba(33, 33, 33, 0.86); border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  color: var(--text); font: inherit; font-size: 14px; cursor: text; text-align: left;
  box-shadow: var(--shadow); animation: cardReveal 0.6s var(--ease) both;
}
#chatBar[hidden] { display: none; }
#chatBar:hover { border-color: rgba(255, 255, 255, 0.24); background: rgba(40, 40, 40, 0.92); }
#chatBar > svg { width: 18px; height: 18px; flex: none; color: #ececec; }
#chatBarText { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #b4b4b4; }
#chatBarText[hidden] { display: none; }
#chatBar kbd { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: #8e8e8e; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 5px; padding: 1px 6px; }
#chatBarLit { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: #ececec; background: rgba(255, 138, 92, 0.14); border: 1px solid rgba(255, 138, 92, 0.3); border-radius: 999px; padding: 3px 4px 3px 10px; }
#chatBarLit[hidden] { display: none; }
#chatBarLit i { width: 8px; height: 8px; border-radius: 50%; background: rgb(255, 138, 92); flex: none; animation: tlBlink 1s ease-in-out infinite; }
#chatBarLit em { font-style: normal; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chatBarLit button { flex: none; font: inherit; font-size: 15px; line-height: 1; color: #d0d0d0; background: none; border: 0; width: 20px; height: 20px; cursor: pointer; border-radius: 50%; }
#chatBarLit button:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }

#chat {
  /* a translucent black card over the timeline, centred: its size is the user's (--chat-w/--chat-h, dragged
     at the edges) or the whole screen (.big); the timeline stays in view under it, the scene shows through */
  position: fixed; right: calc(72px + env(safe-area-inset-right)); z-index: 12;   /* at rest on the right, compact: the scene in the middle stays in view */
  bottom: calc(44px + env(safe-area-inset-bottom) + 62px);
  width: min(var(--chat-w, 560px), calc(100vw - 32px)); height: min(var(--chat-h, 340px), calc(100vh - var(--toolbar-h, 56px) - 130px));
  display: flex; flex-direction: column; box-sizing: border-box;
  background: rgba(8, 8, 8, 0.64); color: #ececec; font-size: 15px;
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 18px;
  -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.3);
  animation: chatIn 0.3s var(--ease) both;
  /* the card steps aside when it would cover what an answer highlights (chatDodge): a slide, not a jump */
  translate: var(--chat-x, 0px) var(--chat-y, 0px); transition: translate 0.4s var(--ease);
}
#chat.resizing, #chat.big { translate: 0 0; }
#chat.duck { height: min(var(--chat-h, 340px), 220px); }   /* no place clears the highlighted things: the card ducks to a strip (the latest answer) */
#chat.big { right: max(16px, env(safe-area-inset-right)); width: calc(100vw - 32px); height: calc(100vh - var(--toolbar-h, 56px) - 130px); }
#chat.resizing { animation: none; transition: none; user-select: none; }
#chat .c-rz { position: absolute; z-index: 2; }
#chat .c-rz.n { top: -5px; left: 18px; right: 18px; height: 10px; cursor: ns-resize; }
#chat .c-rz.w { top: 18px; bottom: 18px; left: -5px; width: 10px; cursor: ew-resize; }
#chat .c-rz.nw { top: -6px; left: -6px; width: 18px; height: 18px; cursor: nwse-resize; }
#chat.big .c-rz { display: none; }
#chatSize .c-shrink, #chat.big #chatSize .c-grow { display: none; }
#chat.big #chatSize .c-shrink { display: block; }
#chat[hidden] { display: none; }
@keyframes chatIn { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.c-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px 4px 10px; min-height: 48px; box-sizing: border-box; flex: none; }
.c-model { flex: 1; display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-radius: 10px; font-size: 16px; }
.c-model b { font-weight: 600; letter-spacing: -0.01em; }
.c-model span { font-size: 12px; color: #8e8e8e; }
.c-ib { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 0; background: none; color: #b4b4b4; cursor: pointer; }
.c-ib:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.c-ib svg { width: 18px; height: 18px; }
.c-ib[hidden] { display: none; }
#chatScroll { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0 14px; }
#chatEmpty { max-width: 720px; margin: 0 auto; padding: 7% 24px 0; text-align: center; box-sizing: border-box; }
#chat.big #chatEmpty { padding-top: 14vh; }
#chat.big #chatHello { font-size: 28px; }
#chatEmpty[hidden] { display: none; }
#chatHello { font-size: 24px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 22px; color: #ececec; line-height: 1.25; }
#chatHello[hidden] { display: none; }
#chatNone { color: #b4b4b4; line-height: 1.55; font-size: 14px; }
#chatNone[hidden] { display: none; }
#chatNone code { font-size: 13px; background: rgba(255, 255, 255, 0.08); padding: 1px 6px; border-radius: 5px; }
#chatChips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
#chatChips button { font: inherit; font-size: 13.5px; color: #ececec; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.14); background: transparent; cursor: pointer; }
#chatChips button:hover { background: rgba(255, 255, 255, 0.08); }
#chatThread { max-width: 820px; margin: 0 auto; padding: 0 20px; display: flex; flex-direction: column; gap: 20px; box-sizing: border-box; }
#chatThread .g-q { align-self: flex-end; max-width: 78%; padding: 9px 16px; border-radius: 22px; background: #2f2f2f; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
#chatThread .g-q.find { background: rgba(240, 208, 96, 0.14); color: #f5dd7a; }
#chatThread .g-a { align-self: stretch; display: grid; grid-template-columns: 26px 1fr; column-gap: 12px; row-gap: 10px; line-height: 1.6; animation: contentFadeIn 0.35s var(--ease) both; }
#chatThread .g-a::before { content: ''; grid-column: 1; grid-row: 1; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffffff 0, #d8d8d8 45%, #7a7a7a 100%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
#chatThread .g-a > * { grid-column: 2; }
#chatThread .g-a .g-text { white-space: pre-wrap; overflow-wrap: anywhere; }
#chatThread .g-a.g-wait .g-text { color: #b4b4b4; animation: gWait 1.2s ease-in-out infinite alternate; }
#chatThread .g-steps { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: #8e8e8e; }
#chatThread .g-steps:empty { display: none; }
#chatThread .g-steps div { display: flex; align-items: center; gap: 8px; }
#chatThread .g-steps div::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #5a5a5a; flex: none; }
#chatThread .g-steps div.now { color: #d8d8d8; }
#chatThread .g-steps div.now::before { background: #ececec; animation: gWait 0.9s ease-in-out infinite alternate; }
#chatThread .g-things { display: flex; flex-wrap: wrap; gap: 6px; }
#chatThread .g-things button { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; color: #ececec; padding: 5px 12px 5px 9px; border-radius: 999px; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.04); }
#chatThread .g-things button:hover, #chatThread .g-things button.on { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.3); }
#chatThread .g-things button i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
#chatThread .g-things button.gold i { border-radius: 2px; background: #f0d060; }
#chatThread .g-things button.gold { color: #f5dd7a; }
#chatThread .g-things button.time { color: #9fd3ff; }
#chatThread .g-things button.look { color: #ffb399; }
#chatThread .g-things button.look i { border-radius: 50%; background: rgb(255, 138, 92); box-shadow: 0 0 0 2px rgba(255, 138, 92, 0.3); }
#chatThread .g-things button b { font-weight: 400; opacity: 0.55; font-size: 11.5px; }
#chatThread .g-meta { color: #8e8e8e; font-size: 12px; }
#chatThread .g-strip-wrap { margin-top: 2px; }
#chatThread .g-strip-cap { font-size: 12.5px; color: #b4b4b4; margin-bottom: 5px; }
#chatThread .g-strip { position: relative; height: 18px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
#chatThread .g-strip i { position: absolute; top: 2px; bottom: 2px; min-width: 3px; border-radius: 2px; background: rgb(255, 138, 92); cursor: pointer; }
#chatThread .g-strip i:hover { background: #ffc3a6; }
#chatThread .g-strip b { position: absolute; top: 0; bottom: 0; left: var(--now); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 4px rgba(0, 0, 0, 0.8); pointer-events: none; }
#chatThread .g-strip-ticks { display: flex; justify-content: space-between; font-size: 10px; color: #8e8e8e; margin-top: 3px; }
.c-composer { flex: none; padding: 6px 14px 10px; }
#chatForm { max-width: 820px; margin: 0 auto; }
.c-box { background: rgba(48, 48, 48, 0.85); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 24px; padding: 8px 8px 6px 16px; display: flex; flex-direction: column; gap: 6px; }
.c-box:focus-within { border-color: rgba(255, 255, 255, 0.24); }
#chatInput { width: 100%; box-sizing: border-box; resize: none; font: inherit; font-size: 15px; line-height: 1.45; color: #ececec; background: none; border: 0; outline: none; padding: 4px 0; max-height: 160px; }
#chatInput::placeholder { color: #8e8e8e; }
#chatInput:disabled { color: #6a6a6a; }
.c-tools { display: flex; align-items: center; gap: 8px; }
#chatMode { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); }
#chatMode button { font: inherit; font-size: 12px; color: #b4b4b4; padding: 4px 12px; border: 0; border-radius: 999px; background: none; cursor: pointer; }
#chatMode button.on { background: rgba(255, 255, 255, 0.14); color: #fff; }
#chatMode button[data-mode="find"].on { color: #f5dd7a; }
#chatMode button[hidden] { display: none; }
#chatFrame { flex: 1; text-align: right; font-size: 12px; color: #8e8e8e; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chatSend { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 0; background: #ffffff; color: #0d0d0d; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
#chatSend svg { width: 18px; height: 18px; }
#chatSend:disabled { background: #676767; color: #2f2f2f; cursor: default; }
#chatForm.find #chatSend { background: #f5dd7a; }
.c-foot { max-width: 820px; margin: 6px auto 0; text-align: center; font-size: 11px; color: #8e8e8e; line-height: 1.4; }
#chat:not(.big) .c-foot { display: none; }

/* a phone: the card is the screen above the timeline */
@media (max-width: 700px) { #chat, #chat.big { width: calc(100vw - 16px); height: calc(100vh - var(--toolbar-h, 56px) - 120px); border-radius: 14px; } #chat .c-rz { display: none; } #chatSize { display: none; } #chatThread .g-q { max-width: 86%; } }
@media (max-width: 640px) { #chatBar { width: calc(100vw - 28px); min-width: 0; bottom: calc(56px + env(safe-area-inset-bottom) + 56px); } #chatBar kbd { display: none; } #chatHello { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { #chat, #chatBar, #chatThread .g-a { animation: none; } #chat { transition: none; } #chatBarLit i { animation: none; } }

/* ---- ChronoSpace 4D: the Studio layout ---------------------------------------------------------------------
   The world model is the page. Over it: the composer docked at the bottom (the primary control), the timeline as
   a thinner pill just above it, the answer card above that, a module tray at the right edge, the conversations
   rail at the left, and a settings sheet under the gear for everything that used to crowd the toolbar. */
#dock { position: fixed; z-index: 9; left: 0; right: 0; margin: 0 auto; bottom: calc(14px + env(safe-area-inset-bottom)); width: min(820px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: center; gap: 6px; animation: cardReveal 0.6s var(--ease) both; }
#dock[hidden] { display: none; }
#dock .c-composer { width: 100%; padding: 0; box-sizing: border-box; }
#dock #chatForm { max-width: none; }
#dock .c-box { background: rgba(14, 14, 14, 0.78); border: 1px solid rgba(255, 255, 255, 0.16); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow); padding: 10px 10px 8px 18px; }
#dock .c-box:focus-within { border-color: rgba(255, 255, 255, 0.34); }
#dock #chatInput { font-size: 16px; }
#dock .c-foot { display: block; margin: 0; font-size: 11px; color: rgba(255, 255, 255, 0.45); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
/* the status strip over the composer: what the last answer lit */
#chatBar { position: static; display: flex; margin: 0 0 4px; width: auto; min-width: 0; bottom: auto; padding: 0; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; animation: none; cursor: default; }
#chatBar[hidden] { display: none; }
#chatBar:hover { background: none; border: 0; }
#chatBar > svg, #chatBar kbd { display: none; }
#chatBarLit { background: rgba(8, 8, 8, 0.72); border-color: rgba(255, 138, 92, 0.45); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); max-width: min(720px, calc(100vw - 48px)); }
/* the timeline, inside the world view and secondary to the composer: a thinner pill in the dock, just above the composer */
#dock #timeline { position: static; margin: 0 auto; bottom: auto; width: min(660px, 80%); min-width: 0; padding: 4px 8px; background: rgba(14, 14, 14, 0.62); animation: none; }
#timeline .btn.icon { width: 28px; min-height: 28px; }
#timeline .btn.icon svg { width: 14px; height: 14px; }
#tlLabel { font-size: 11px; }
/* the answer card rises above the timeline; its composer is the dock's */
#chat { bottom: calc(22px + env(safe-area-inset-bottom) + var(--dock-h, 150px)); height: min(var(--chat-h, 340px), calc(100vh - var(--toolbar-h, 56px) - var(--dock-h, 150px) - 40px)); }
#chat.big { height: calc(100vh - var(--toolbar-h, 56px) - var(--dock-h, 150px) - 40px); }
#chat #chatScroll { padding-bottom: 10px; }
/* the module tray: the optional overlays, at the right edge, vertically centred; empty when the clip has none */
#tray { position: fixed; z-index: 9; right: max(12px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 14px; background: rgba(14, 14, 14, 0.62); border: 1px solid var(--panel-border); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
#tray:not(:has(.btn:not([hidden]))) { display: none; }
#tray .btn.icon { width: 36px; min-height: 36px; }
/* the settings sheet: the legacy controls, grouped, under the gear */
#settings { position: fixed; z-index: 13; right: max(14px, env(safe-area-inset-right)); top: calc(var(--toolbar-h, 56px) + 8px); width: min(420px, calc(100vw - 28px)); max-height: calc(100vh - var(--toolbar-h, 56px) - 24px); overflow-y: auto; box-sizing: border-box; padding: 10px 14px 12px; border-radius: 16px; background: rgba(10, 10, 10, 0.86); border: 1px solid rgba(255, 255, 255, 0.12); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); color: var(--text); font-size: 13px; animation: contentFadeIn 0.25s var(--ease) both; }
#settings[hidden] { display: none; }
#settings .s-head { display: flex; align-items: center; justify-content: space-between; font-size: 15px; margin-bottom: 6px; }
#settings .s-sec { padding: 8px 0; border-top: 1px solid var(--panel-border); }
#settings .s-lab { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
#settings .s-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#settings .s-row .btn.select { max-width: 100%; }
#settings #modelPicker { flex: 1; min-width: 160px; }
#settings .s-foot { font-size: 11.5px; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--panel-border); line-height: 1.4; }
/* the conversations rail: over the left edge, translucent, out of the way until asked for */
#rail { position: fixed; z-index: 11; left: 0; top: var(--toolbar-h, 56px); bottom: 0; width: min(288px, 86vw); box-sizing: border-box; padding: 10px 10px calc(12px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 8px; background: rgba(8, 8, 8, 0.72); border-right: 1px solid rgba(255, 255, 255, 0.1); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: #ececec; font-size: 13.5px; animation: railIn 0.28s var(--ease) both; }
#rail[hidden] { display: none; }
@keyframes railIn { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
#rail .r-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; font-size: 14px; }
#rail .r-new { display: flex; align-items: center; gap: 8px; font: inherit; color: #ececec; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
#rail .r-new:hover { background: rgba(255, 255, 255, 0.14); }
#rail .r-new svg { width: 16px; height: 16px; }
#railList { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
#railList .r-sec { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #8e8e8e; padding: 10px 6px 4px; }
#railList .r-item { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 9px; cursor: pointer; color: #d8d8d8; }
#railList .r-item:hover { background: rgba(255, 255, 255, 0.08); }
#railList .r-item.on { background: rgba(255, 255, 255, 0.14); color: #fff; }
#railList .r-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#railList .r-item small { color: #8e8e8e; font-size: 10.5px; flex: none; }
#railList .r-item button { flex: none; font: inherit; font-size: 14px; line-height: 1; color: #8e8e8e; background: none; border: 0; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; opacity: 0; }
#railList .r-item:hover button { opacity: 1; }
#railList .r-item button:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
#railList .r-empty { color: #8e8e8e; padding: 8px 6px; line-height: 1.45; }
/* the wordmark */
.logo { font-weight: 700; } .logo-er { font-weight: 300; color: var(--text); }
@media (max-width: 700px) { #dock #timeline { width: 100%; } #chat, #chat.big { height: calc(100vh - var(--toolbar-h, 56px) - var(--dock-h, 150px) - 40px); } #tray { right: 6px; } #dock .c-foot { display: none; } }
@media (prefers-reduced-motion: reduce) { #dock, #rail, #settings { animation: none; } }
