/* The demo's adaptations of its design system (css/system.css on the public
   page; the same tokens and classes inline on interactive.html). Both pages
   share these rules (projects/vr-robo/docs/rendering.md, "Stage"). */

/* Scene picker: the design system's #home pill when closed, its dense popover and
   list rows (#motions, .item) when open. */
#scenarios {
  position: absolute;
  z-index: var(--z-hint);
  top: var(--pad-top);
  right: var(--pad-right);
  width: 280px;
  border-radius: 22px;
}
#scenarios:not([open]) { width: 240px; border-radius: 999px; }
#scenarios summary { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 14px;
  cursor: pointer; list-style: none; font: 500 13px/1 var(--text); color: var(--ink); }
#scenarios summary::-webkit-details-marker { display: none; }
#scenarios summary::before { content: ""; width: 5px; height: 5px; margin: 0 4px 0 2px; flex: none;
  border: solid var(--ink2); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg);
  transition: transform 0.3s var(--ease); }
#scenarios[open] summary::before { transform: rotate(45deg); }
#scene-name { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); font-weight: 400; }
.scenario-menu { padding: 2px 8px 10px; animation: rise 0.28s var(--ease); }
#locomotion-status:not(:empty) { font: 400 12px/1.4 var(--text); color: var(--ink2); }
.scenario-options { display: flex; flex-direction: column; gap: 2px; }
.scenario-option { text-align: left; padding: 9px 10px; border: none; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--ink2); transition: background 0.2s var(--ease), color 0.2s var(--ease); }
.scenario-option strong, .scenario-option span { display: block; }
.scenario-option strong { font: 500 14px/1.25 var(--text); color: var(--ink); }
.scenario-option span { margin-top: 3px; font: 400 12px/1.3 var(--text); }
.scenario-option:hover { background: rgba(0, 0, 0, 0.04); }
.scenario-option[aria-pressed="true"], .scenario-option[aria-pressed="true"]:hover { background: var(--ink); color: rgba(255, 255, 255, 0.6); }
.scenario-option[aria-pressed="true"] strong { color: #fff; }
#scene-status { margin: 12px 10px 0; color: var(--ink2); font: 400 12px/1.45 var(--text); }
.scenario-menu > a { display: inline-block; margin: 8px 10px 0; color: var(--ink2);
  font: 400 11px/1.4 var(--mono); letter-spacing: 0.02em; text-decoration: none; }
.scenario-menu > a:hover { color: var(--ink); text-decoration: underline; }

/* View switch: the design system's segmented legend (#title .sub), at the top centre
   (owner, 2026-10-26); narrow windows give it a row under the title. */
#camera-views { position: absolute; top: var(--pad-top); left: 50%; transform: translateX(-50%);
  z-index: var(--z-chrome); display: flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: 999px; width: max-content; white-space: nowrap; }
#camera-views::before { background: linear-gradient(rgba(118, 118, 128, 0.12),
  rgba(118, 118, 128, 0.12)), var(--mat); }
#camera-views .toggle { height: 32px; padding: 0 16px; }
#camera-views .toggle:disabled { opacity: 0.35; cursor: default; background: transparent; }
@media (max-width: 960px) { #camera-views { top: calc(var(--pad-top) + 72px); } }
@media (max-width: 640px) {
  #camera-views { top: calc(var(--pad-top) + 54px); }
  #camera-views .toggle { height: 30px; padding: 0 12px; }
}
/* Walk mode: SuperSplat's own controls (vendor/supersplat/viewer.css) take the
   bottom edge and the right-hand panels, and the robot canvas sits in its scene
   layer; the Ego and speed panels hide. */
.splat-background:not(.walking) .sse-ui { display: none; }
.splat-background.walking { pointer-events: auto; z-index: 2; }
.splat-background .sse-sceneLayer > canvas { position: absolute; inset: 0; }
body.walking #ego-preview, body.walking #locomotion-controls { display: none; }
body[data-scene]:not([data-scene="studio"]) #title h1,
body[data-scene]:not([data-scene="studio"]) #depth,
body[data-scene]:not([data-scene="studio"]) #dragHint { color: white; text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
/* Phones: title and picker share the top row and the switch takes the next;
   the open picker is the design system's narrow-screen sheet, rising above the dock
   across the width, so the robots stay in view above it. */
@media (max-width: 640px) {
  #scenarios, #scenarios:not([open]),
  body[data-session]:not([data-session="motions"]) #scenarios { top: var(--pad-top); width: min(200px, 52vw); border-radius: 999px; }
  #scenarios summary { height: 40px; }
  #scenarios[open] .scenario-menu { position: fixed; left: var(--pad-left); right: var(--pad-right);
    bottom: calc(var(--dock-bottom) + var(--dock-h) + 10px); max-height: 56dvh; overflow-y: auto;
    padding: 12px 8px; border-radius: 22px; background: var(--mat-dense);
    box-shadow: var(--mat-line), var(--lift); -webkit-backdrop-filter: var(--mat-blur); backdrop-filter: var(--mat-blur); }
  body:has(#scenarios[open]) #ego-preview { visibility: hidden; }
}
@media (max-height: 500px) and (min-width: 641px) {
  .scenario-menu { max-height: calc(100dvh - 140px); overflow-y: auto; }
}
/* Ego views: a dark monitor column at the left edge (owner, 2026-10-26),
   level with the view switch and clear of the title and session status;
   a scrolling row on phones. Feeds keep their 424:240 aspect. */
#ego-preview { position: absolute; left: var(--pad-left); bottom: calc(var(--dock-bottom) + 76px); z-index: var(--z-chrome);
  width: 256px; max-height: calc(100dvh - var(--pad-top) - var(--dock-bottom) - 180px); overflow: hidden auto;
  padding: 0 8px 8px; box-sizing: border-box; border-radius: 22px; color: #f5f5f7;
  background: rgba(22, 23, 26, .84); -webkit-backdrop-filter: saturate(160%) blur(20px); backdrop-filter: saturate(160%) blur(20px);
  box-shadow: 0 0 0 .5px rgba(255, 255, 255, .1) inset, var(--lift); }
#ego-preview[hidden], #ego-preview figure[hidden] { display: none; }
#ego-preview header { height: 44px; display: flex; align-items: center; gap: 4px; padding-left: 6px;
  font: 500 12px/1 var(--text); color: rgba(245, 245, 247, .7); }
#ego-preview header > div { display: flex; margin-left: auto; gap: 4px; }
#ego-preview button { border: 0; background: transparent; color: rgba(245, 245, 247, .6); cursor: pointer; font: 500 11px var(--text); }
#ego-preview [role="group"] button { padding: 4px 9px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(245, 245, 247, .2); }
#ego-preview [role="group"] button[aria-pressed="true"] { background: #f5f5f7; color: #1d1d1f; box-shadow: none; }
#ego-preview button:disabled { opacity: .35; cursor: default; }
#ego-preview .ego-close { width: 26px; height: 26px; border-radius: 50%; font-size: 15px; line-height: 1; }
#ego-preview button:not(:disabled):hover { color: #f5f5f7; }
#ego-preview .ego-close:hover { background: rgba(245, 245, 247, .12); }
.ego-cameras { display: flex; flex-direction: column; gap: 6px; }
#ego-preview figure { margin: 0; position: relative; flex: 0 0 auto; width: 240px; aspect-ratio: 424 / 240; border-radius: 14px;
  overflow: hidden; background: #0d0e10; box-shadow: 0 0 0 .5px rgba(255, 255, 255, .12); }
#ego-preview figcaption { position: absolute; z-index: 1; top: 6px; left: 6px; padding: 2px 7px; border-radius: 6px;
  background: rgba(13, 14, 16, .6); color: #f5f5f7; font: 500 10px/1.4 var(--mono); letter-spacing: .04em; pointer-events: none; }
#ego-preview figure > canvas { display: block; width: 100%; height: 100%; cursor: pointer; }
/* Riding along: the feed whose camera the main view uses wears a light ring. */
#ego-preview figure { cursor: pointer; transition: box-shadow 0.2s var(--ease); }
#ego-preview figure:hover { box-shadow: 0 0 0 1px rgba(245, 245, 247, .45); }
#ego-preview figure.riding { box-shadow: 0 0 0 2px #f5f5f7; }
#ego-preview figure.riding figcaption { background: #f5f5f7; color: #1d1d1f; }
#ego-preview figure.riding figcaption::after { content: " · view"; }
@media (max-width: 640px) {
  #ego-preview { left: var(--pad-left); right: var(--pad-right); bottom: calc(var(--dock-bottom) + var(--dock-h) + 10px); width: auto; }
  .ego-cameras { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; }
  #ego-preview figure { width: 168px; scroll-snap-align: start; }
}

#contact-debug { display: flex; align-items: center; gap: 8px; margin: 12px 10px 0; font: 400 12px/1 var(--text); color: var(--ink); }
#contact-debug[hidden] { display: none; }
#contact-debug input { accent-color: var(--ink); }
#locomotion-session { position: absolute; top: calc(var(--pad-top) + 110px); left: var(--pad-left); z-index: var(--z-chrome); padding: 4px; border-radius: 999px; max-width: calc(100vw - 28px); }
#locomotion-session [role="tablist"] { display: flex; gap: 2px; }
#locomotion-session [role="tab"] { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 999px; cursor: pointer; color: var(--ink2); }
#locomotion-session [role="tab"][aria-selected="true"] { background: var(--page); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); }
#locomotion-session [role="tab"]:disabled { opacity: .4; cursor: default; }
#locomotion-status:not(:empty) { display: block; padding: 8px 10px; }

body[data-session]:not([data-session="motions"]) #title,
body[data-session]:not([data-session="motions"]) #dock,
body[data-session]:not([data-session="motions"]) #dragHint,
body[data-session]:not([data-session="motions"]) #splash { display: none !important; }
body[data-session]:not([data-session="motions"]) #locomotion-session { top: var(--pad-top); }

/* Locomotion controls: the design system's dock (#dock), one floating pill at the
   bottom centre with its icons, separators and slider. */
#locomotion-controls { position: absolute; bottom: var(--dock-bottom); left: 0; right: 0; margin-inline: auto;
  width: max-content; max-width: calc(100% - var(--pad-left) - var(--pad-right)); height: var(--dock-h);
  display: flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 999px; z-index: var(--z-chrome); }
#locomotion-controls[hidden] { display: none; }
#locomotion-controls :focus-visible { outline-offset: -2px; }
/* Reset view: the design system's labelled dock pill (#motionsBtn). */
#locomotion-controls .pill { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 14px 0 12px;
  border: none; border-radius: 999px; cursor: pointer; background: transparent; color: var(--ink); white-space: nowrap;
  transition: background 0.2s var(--ease); }
#locomotion-controls .pill:hover { background: rgba(0, 0, 0, 0.05); }
#locomotion-controls .pill:active { background: rgba(0, 0, 0, 0.08); }
#locomotion-controls .pill svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
/* Speed: the design system's slider row (.slider) with its mono readout (#ctx b). */
#locomotion-controls .speed { display: flex; align-items: center; gap: 0; margin-left: 6px;
  font: 500 13px/1 var(--text); color: var(--ink); white-space: nowrap; }
#locomotion-controls .speed b { margin: 0 10px 0 8px; min-width: 7ch; text-align: right;
  font: 400 11px/1 var(--mono); letter-spacing: 0.02em; color: var(--ink2);
  font-variant-numeric: tabular-nums; }
#locomotion-controls input[type=range] { margin-right: 8px; }
/* Send: the robot a click on the ground sends (point navigation), the view
   switch's segmented toggles on a tinted track. */
#locomotion-controls .send { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px;
  background: rgba(118, 118, 128, 0.12); }
#locomotion-controls .send > span { margin: 0 6px 0 8px; font: 500 13px/1 var(--text); color: var(--ink); }
#locomotion-controls .send .toggle { height: 30px; padding: 0 10px; }
@media (max-width: 900px) { :root { --dock-h: 48px; } }
@media (max-width: 640px) {
  #locomotion-controls .pill span, #locomotion-controls .speed > span, #locomotion-controls .send > span { display: none; }
  #locomotion-controls .pill { width: 40px; padding: 0; justify-content: center; }
  #locomotion-controls input[type=range] { width: 72px; }
  #locomotion-controls .send .toggle { padding: 0 8px; }
}
#locomotion-controls > * { flex: none; }
/* Narrow screens: Send shows only the chosen robot, and tapping it picks the
   next (js/locomotion.js); the speed readout leaves the slider room. Just
   above the phone layout the labels go instead. */
@media (min-width: 641px) and (max-width: 760px) {
  #locomotion-controls .send > span, #locomotion-controls .speed > span { display: none; }
}
@media (max-width: 520px) {
  #locomotion-controls .speed b, #locomotion-controls .send .toggle.off { display: none; }
  #locomotion-controls .sep { margin: 0 3px; }
}
@media (max-width: 360px) { #locomotion-controls input[type=range] { width: 46px; } }
@media (max-width: 319px) { #locomotion-controls input[type=range] { width: 26px; } }
@media (pointer: coarse) {
  #locomotion-controls .pill { height: 44px; }
}

/* The scan is a background layer: the invisible physics plane cannot erase it. */
.splat-background { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.splat-background .sse-viewer, .ego-splat .sse-viewer { position: relative; width: 100%; height: 100%; }
.splat-background canvas, .ego-splat canvas { display: block; width: 100%; height: 100%; }
body > canvas { position: absolute; inset: 0; z-index: 1; }
.ego-splat { opacity: 0; pointer-events: none; position: absolute; inset: 0; width: 320px; height: 181px; }

/* The public page's status line hangs under its title block as a mono counter,
   white over a scan; the page keys these rules on #demo-title. */
body:has(#demo-title) #locomotion-session { top: calc(var(--pad-top) + 78px); left: calc(var(--pad-left) + 14px);
  padding: 0; border-radius: 0; background: none; }
body:has(#demo-title) #locomotion-session::before { display: none; }
body:has(#demo-title) #locomotion-status:not(:empty) { padding: 0; }
body:has(#demo-title)[data-scene]:not([data-scene="studio"]) #locomotion-status { color: rgba(255, 255, 255, .85); text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
/* Tablets (641-960 px): the switch's row under the title moves to the left,
   with the status line beneath it, so the expanded picker at the right
   never covers it; the Ego column, also at the left, stops below them and
   scrolls. */
@media (min-width: 641px) and (max-width: 960px) {
  body:has(#demo-title) #camera-views { top: calc(var(--pad-top) + 74px); left: var(--pad-left); transform: none; }
  body:has(#demo-title) #locomotion-session { top: calc(var(--pad-top) + 124px); }
  body:has(#demo-title) #ego-preview { max-height: calc(100dvh - var(--pad-top) - var(--dock-bottom) - 240px); }
}
/* Phones: no title block (owner, 2026-10-26); the view switch takes its
   place at the top left with the status line under it, and the picker
   shrinks to its "Scene" pill at the top right. */
@media (max-width: 640px) {
  body:has(#demo-title) #demo-title { display: none; }
  body:has(#demo-title) #scenarios:not([open]), body:has(#demo-title) #scenarios { width: auto; }
  body:has(#demo-title) #scene-name { display: none; }
  body:has(#demo-title) #camera-views { top: var(--pad-top); left: var(--pad-left); transform: none; }
  body:has(#demo-title) #locomotion-session { top: calc(var(--pad-top) + 48px); left: calc(var(--pad-left) + 6px); }
}
@media (max-width: 360px) {
  body:has(#demo-title) #camera-views .toggle { padding: 0 10px; }
}
/* Feed cards are buttons: a visible focus ring, and finger-sized camera
   toggles and close on touch screens. */
#ego-preview figure:focus-visible { outline: 2px solid #f5f5f7; outline-offset: 2px; }
@media (pointer: coarse) {
  #ego-preview [role="group"] button { padding: 9px 13px; }
  #ego-preview .ego-close { width: 36px; height: 36px; }
}
/* Short landscape screens (phones turned sideways): the robots hold the
   centre, so the feeds become a slim column at the right edge, between the
   picker and the dock, without the header (Orbit closes them). */
@media (max-height: 500px) and (min-width: 641px) {
  #ego-preview { left: auto; right: var(--pad-right); top: calc(var(--pad-top) + 50px); bottom: auto;
    width: auto; max-height: calc(100dvh - var(--pad-top) - 50px - var(--dock-bottom) - var(--dock-h) - 14px);
    padding: 4px; border-radius: 16px; }
  #ego-preview header { display: none; }
  .ego-cameras { gap: 4px; }
  #ego-preview figure { width: 120px; border-radius: 10px; }
  #ego-preview figcaption { top: 4px; left: 4px; padding: 1px 5px; }
}
