/* The stage: the Navigate demo and the split views, in a white, quiet studio. Chrome floats over the 3D view as
   white glass panels; the panels let clicks through except on their controls, so the room stays draggable. */
.stage {
  --s-ink: #10161c; --s-ink-2: rgba(16, 22, 28, .72); --s-ink-3: rgba(16, 22, 28, .52);
  --s-glass: rgba(255, 255, 255, .74); --s-glass-2: rgba(255, 255, 255, .95); --s-line: rgba(16, 22, 28, .08); --s-line-2: rgba(16, 22, 28, .15);
  --s-fill: rgba(16, 22, 28, .045); --s-fill-2: rgba(16, 22, 28, .08); --s-fill-3: rgba(16, 22, 28, .13);
  --s-accent: #2456e6; --ok: #1f9d5a; --warn: #c27c0e; --bad: #d14343; --ink-3: #5f6975;
  --dock-h: 50px; --gap: max(14px, env(safe-area-inset-left));
  position: relative; isolation: isolate; overflow: hidden; container-type: inline-size;
  color: var(--s-ink); font: 14px/1.45 var(--sans);
  background: radial-gradient(130% 95% at 50% 34%, #ffffff 0%, #f2f4f7 48%, #e3e8ed 100%);
  -webkit-font-smoothing: antialiased;
}
.stage.standalone { position: fixed; inset: 0; height: 100vh; height: 100dvh; }
.stage.embedded { height: clamp(min(520px, calc(100svh - 88px)), 80vh, 820px); border-radius: 22px; box-shadow: 0 30px 70px -44px rgba(16, 24, 40, .45), 0 0 0 1px rgba(16, 24, 40, .08); }
.stage-canvas { position: absolute; inset: 0; cursor: crosshair; }
.stage-canvas canvas { display: block; width: 100%; height: 100%; }
.stage[data-mode="playing"] .stage-canvas { cursor: grab; }
.stage :focus-visible { outline: 2px solid var(--s-accent); outline-offset: 2px; }
.stage button { font: inherit; color: inherit; cursor: pointer; }
.stage kbd { font: 600 .78em var(--mono); background: #fff; border: 1px solid var(--s-line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 .38em; color: var(--s-ink); }
.stage code { font: .86em var(--mono); background: var(--s-fill); border-radius: 4px; padding: .05em .3em; }
.stage .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.glass, .title-chip, .layers, .hud, .goal-chip, .result, .dock, .picker, .help, .boot-card, .pill {
  background: var(--s-glass); border: 1px solid var(--s-line); -webkit-backdrop-filter: blur(16px) saturate(1.25); backdrop-filter: blur(16px) saturate(1.25);
  box-shadow: 0 12px 32px -20px rgba(16, 24, 40, .38);
}

/* ----- floating chrome */
.chrome { position: absolute; z-index: 4; display: flex; gap: 8px; pointer-events: none; }
.chrome > * { pointer-events: auto; }
.chrome.top-left { top: max(14px, env(safe-area-inset-top)); left: var(--gap); flex-direction: column; align-items: flex-start; max-width: calc(100% - 190px); }
.chrome.top-right { top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); flex-direction: column; align-items: flex-end; }
.title-chip { display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 8px; border-radius: 14px; color: var(--s-ink); text-decoration: none; font-weight: 650; }
.title-chip:hover { text-decoration: none; border-color: var(--s-line-2); }
.title-chip small { display: block; font-weight: 450; color: var(--s-ink-3); font-size: 12px; }
.title-chip .mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #10161c; color: #fff; font-weight: 800; font-size: 13px; }
.layers { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 20px; max-width: 100%; }
.layers::-webkit-scrollbar { display: none; }
.layers button { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 0; border-radius: 999px; background: transparent; color: var(--s-ink-3); font-size: 13px; white-space: nowrap; transition: background .15s, color .15s; }
.layers button i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); opacity: .3; transition: opacity .15s, box-shadow .15s; }
.layers button[aria-pressed="true"] { color: var(--s-ink); background: var(--s-fill-2); }
.layers button[aria-pressed="true"] i { opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 25%, transparent); }
.layers button small { color: var(--s-ink-3); font-size: 11px; }
.layers button:hover { color: var(--s-ink); }
.layers .legend-btn { width: 30px; justify-content: center; padding: 6px 0; font-weight: 700; color: var(--s-ink-2); }
.phase { --c: #8aa0ad; font: 650 13px var(--sans); padding: 6px 12px; border-radius: 999px; color: #071214; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; color: var(--s-ink); font-size: 13px; text-decoration: none; }
.pill:hover { text-decoration: none; border-color: var(--s-line-2); }
.hud { position: absolute; z-index: 3; top: calc(max(14px, env(safe-area-inset-top)) + 44px); right: max(14px, env(safe-area-inset-right)); width: 236px; border-radius: 14px; padding: 8px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }

.hud div { min-width: 0; }
.hud .wide { grid-column: 1 / -1; }
.hud span { display: block; color: var(--s-ink-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; }
.hud span i { font-style: normal; text-transform: none; letter-spacing: 0; opacity: .75; }
.hud b { font: 600 13px var(--mono); overflow-wrap: anywhere; }
.hud .hot b { color: var(--bad); }

/* ----- the hint above the robot and the goal checks above the goal (placed by demo.js) */
.hint, .goal-chip { position: absolute; left: 0; top: 0; z-index: 3; will-change: transform; }
.hint { padding: 8px 14px; border-radius: 999px; background: #10161c; color: #fff; font-size: 14px; white-space: nowrap; box-shadow: 0 12px 30px -14px rgba(16, 24, 40, .55); transition: opacity .4s; pointer-events: none; }
.hint::after, .goal-chip::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -6px; width: 12px; height: 12px; transform: translateX(-50%) rotate(45deg); background: inherit; border-right: inherit; border-bottom: inherit; }
.goal-chip.below::after { bottom: auto; top: -6px; transform: translateX(-50%) rotate(225deg); }
.goal-chip.adrift::after { display: none; }
.hint::after { background: #10161c; }
.stage:not(.is-ready) .hint, .stage.picked .hint:not(.cursor-tip) { opacity: 0; }
.goal-chip { width: 300px; max-height: calc(100% - 150px); overflow: auto; border-radius: 16px; padding: 12px 14px; background: var(--s-glass-2); }
.goal-chip::after { background: var(--s-glass-2); border-color: var(--s-line); border-style: solid; border-width: 0 1px 1px 0; }
.goal-chip[data-state="block"] { border-color: rgba(209, 67, 67, .45); }
.goal-chip[data-state="staged"] { border-color: rgba(31, 157, 90, .45); }
.goal-chip p { margin: 0 0 6px; }
.gc-verdict { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; }
.gc-verdict .icon, .check .icon { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 800; color: #fff; }
.gc-verdict.pass .icon, .check.pass .icon { background: var(--ok); }
.gc-verdict.warn .icon, .check.warn .icon { background: var(--warn); }
.gc-verdict.block .icon, .check.block .icon { background: var(--bad); }
.gc-meta, .gc-note { color: var(--s-ink-2); font-size: 12.5px; }
.gc-actions, .r-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.checks { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; gap: 2px; }
.check { display: grid; grid-template-columns: 22px 72px minmax(0, 1fr); align-items: baseline; gap: 6px; font-size: 12.5px; padding: 3px 0; border-bottom: 1px dashed var(--s-line); }
.check .icon { width: 18px; height: 18px; font-size: 10px; }
.check .name { color: var(--s-ink-3); }
.check.block .label { color: #b3261e; } .check.warn .label { color: #8a5a00; }
.check .label small { display: block; color: var(--s-ink-3); font-size: 11.5px; margin-top: 2px; }
.stage .fineprint { color: var(--s-ink-3); font-size: 12px; margin: 6px 0 0; }

/* ----- buttons on the stage */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--s-line-2); background: var(--s-fill); color: var(--s-ink); font-weight: 600; font-size: 14px; transition: background .15s, transform .1s; }
.btn:hover:not(:disabled) { background: var(--s-fill-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--s-accent); border-color: var(--s-accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #1c45bd; }
.btn.ghost { background: transparent; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.go, .dk.go { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 700; }
.btn.go:hover:not(:disabled), .dk.go:hover:not(:disabled) { background: #178a4c; }
.btn.go kbd { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .35); color: #fff; }
.armed { animation: arm 1.6s ease-in-out infinite; }
@keyframes arm { 0%, 100% { box-shadow: 0 0 0 0 rgba(31, 157, 90, .45); } 50% { box-shadow: 0 0 0 9px rgba(31, 157, 90, 0); } }

/* ----- the headline splash */
.splash { position: absolute; z-index: 2; left: 50%; top: 17%; width: min(92%, 760px); transform: translate(-50%, 10px); text-align: center; opacity: 0; pointer-events: none; transition: opacity .45s ease, transform .45s ease; }
.splash.on { opacity: 1; transform: translate(-50%, 0); }
.splash b { display: block; font-size: clamp(24px, 4.4cqi, 46px); font-weight: 750; letter-spacing: -.02em; line-height: 1.1; text-shadow: 0 1px 2px rgba(255, 255, 255, .9), 0 0 28px rgba(255, 255, 255, .95); }
.splash span { display: block; margin-top: 6px; font-size: clamp(13px, 1.6cqi, 16px); color: var(--s-ink-2); text-shadow: 0 0 14px rgba(255, 255, 255, .95), 0 0 4px rgba(255, 255, 255, .9); }
.splash[data-tone="warn"] b { color: #a86400; } .splash[data-tone="bad"] b { color: #c43a3a; } .splash[data-tone="ok"] b { color: #138a4a; }

/* ----- the result */
.result { --c: var(--ok); position: absolute; z-index: 3; left: var(--gap); bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--dock-h) + 12px); width: 360px; max-height: calc(100% - 200px); overflow: auto; border-radius: 16px; padding: 14px 16px; border-left: 3px solid var(--c); }
.r-title { margin: 0 0 6px; font-size: 18px; font-weight: 750; color: var(--c); }
.r-text { margin: 0 0 10px; color: var(--s-ink-2); font-size: 13px; }
.result .facts, .split-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.result .facts div, .split-facts div { background: var(--s-fill); border-radius: 8px; padding: 5px 8px; min-width: 0; }
.result .facts span, .split-facts span { display: block; color: var(--s-ink-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.split-facts span i { font-style: normal; text-transform: none; letter-spacing: 0; opacity: .75; }
.split-facts .hot b { color: var(--bad); }
.result .facts b, .split-facts b { font: 600 12.5px var(--mono); }
.r-more { margin-top: 10px; font-size: 12.5px; color: var(--s-ink-2); }
.r-more summary { cursor: pointer; color: var(--s-ink); }
.r-more p { margin: 6px 0 0; }
.flash { position: absolute; z-index: 6; left: 50%; top: 70px; text-align: center; transform: translateX(-50%); background: #fdecec; border: 1px solid #f1c2c2; color: #8c2323; padding: 8px 14px; border-radius: 12px; font-size: 13.5px; max-width: calc(100% - 28px); }

/* ----- the dock */
.dock { position: absolute; z-index: 4; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 16px; max-width: calc(100% - 28px); }
.dk { flex: none; height: 36px; min-width: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--s-line); background: var(--s-fill); color: var(--s-ink); font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.dk:hover:not(:disabled) { background: var(--s-fill-3); }
.dk:disabled { opacity: .4; cursor: not-allowed; }
.dk.go { min-width: 64px; }
.dk.go:disabled { background: rgba(31, 157, 90, .1); border-color: rgba(31, 157, 90, .25); color: rgba(19, 120, 66, .55); opacity: 1; }
.dk.small { font: 600 12.5px var(--mono); min-width: 42px; }
.dk.room { max-width: 230px; }
.dk.room span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk.room small { color: var(--s-ink-3); font: 12px var(--mono); }
.seg { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--s-fill); border: 1px solid var(--s-line); }
.seg button { height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--s-ink-3); font-size: 13px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--s-fill-3); color: var(--s-ink); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg button[data-camera="film"][aria-pressed="true"] { background: var(--s-accent); color: #fff; }
.film-status { font-size: 11.5px; pointer-events: none; }
.film-status > span:first-child { color: var(--s-accent); }
.stage.narrow .film-status { display: none; }
.scrub { position: relative; width: clamp(140px, 26cqi, 420px); height: 36px; display: flex; align-items: center; }
.stage[data-walk="0"] .scrub, .stage[data-walk="0"] .time, .stage[data-walk="0"] [data-el="speed"], .stage[data-walk="0"] [data-el="play"] { display: none; }
.bands { position: absolute; left: 0; right: 0; top: 50%; height: 6px; transform: translateY(-50%); border-radius: 3px; background: var(--s-fill-2); }
.bands span { position: absolute; top: 0; height: 100%; opacity: .8; }
.bands i { position: absolute; top: -5px; width: 2px; height: 16px; background: var(--s-ink); opacity: .55; }
.bands i.hot { background: var(--bad); opacity: .95; }
.scrub input { position: relative; width: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; height: 36px; cursor: pointer; }
.scrub input::-webkit-slider-runnable-track { height: 6px; background: transparent; }
.scrub input::-moz-range-track { height: 6px; background: transparent; }
.scrub input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #10161c; margin-top: -5px; border: 0; box-shadow: 0 0 0 3px #fff, 0 1px 4px rgba(0, 0, 0, .3); }
.scrub input::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #10161c; border: 2px solid #fff; }
.time { flex: none; min-width: 86px; text-align: right; color: var(--s-ink-2); font-size: 12.5px; }

/* ----- the picker and the legend */
.picker, .help { position: absolute; z-index: 5; display: flex; flex-direction: column; border-radius: 18px; background: var(--s-glass-2); overflow: hidden; }
.picker { left: 50%; bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--dock-h) + 12px); transform: translateX(-50%); width: min(780px, calc(100% - 28px)); height: min(500px, calc(100% - 170px)); }
.help { left: var(--gap); top: calc(max(14px, env(safe-area-inset-top)) + 100px); width: min(440px, calc(100% - 28px)); max-height: calc(100% - 200px); }
.stage.embedded .help { top: 66px; }
.picker-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--s-line); }
.picker-head b { flex: 1; font-size: 15px; }
.x { width: 30px; height: 30px; border-radius: 8px; border: 0; background: var(--s-fill); color: var(--s-ink-2); }
.picker-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.folders { list-style: none; margin: 0; padding: 8px; overflow: auto; border-right: 1px solid var(--s-line); display: grid; align-content: start; gap: 2px; }
.folders button { width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; display: grid; gap: 2px; }
.folders button:hover { background: var(--s-fill); }
.folders button[aria-selected="true"] { background: var(--s-fill-2); }
.folders .f-name { font-weight: 600; }
.folders small { color: var(--s-ink-3); font-size: 12px; display: flex; justify-content: space-between; gap: 6px; }
.folders small kbd { font-size: 10px; }
.folders .wrong .f-name { color: #a86400; }
.mini-bar { display: flex; height: 4px; border-radius: 2px; overflow: hidden; margin-top: 5px; background: var(--s-fill); }
.mini-bar i.ok { background: var(--ok); } .mini-bar i.warn { background: var(--warn); } .mini-bar i.bad { background: var(--bad); }
.walks { min-height: 0; display: flex; flex-direction: column; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--s-line); }
.filters button { height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--s-line); background: transparent; color: var(--s-ink-2); font-size: 12.5px; }
.filters button[aria-pressed="true"] { background: #10161c; color: #fff; border-color: #10161c; }
.filters small { opacity: .7; font-family: var(--mono); }
.walks ul { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.walks li button { width: 100%; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 78px; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; font-size: 13px; }
.walks li button:hover, .walks li button:focus-visible { background: var(--s-fill); }
.walks li i { width: 10px; height: 10px; border-radius: 50%; }
.walks .w-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.walks .w-dir { display: inline-block; width: 1.1em; margin-right: 6px; text-align: center; color: var(--s-ink-2); transform: rotate(var(--turn)); }
.walks .w-grade { color: var(--s-ink-2); font-size: 12px; }
.walks .w-detail { color: var(--s-ink-3); font-size: 12px; text-align: right; white-space: nowrap; }
.walks .empty { color: var(--s-ink-3); padding: 14px; }
.help-body { padding: 12px 16px 14px; overflow: auto; font-size: 13px; }
.legend { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; color: var(--s-ink-2); }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend .ln { width: 16px; height: 3px; border-radius: 2px; flex: none; }
.legend .ln.dash { background: repeating-linear-gradient(90deg, #2a333d 0 4px, transparent 4px 7px); }
.legend .ring { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #2f74d0; flex: none; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-right: -4px; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; color: var(--s-ink-2); }
.keys dt { white-space: nowrap; } .keys dd { margin: 0; }

/* ----- booting, and the poster in the page */
.boot { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: inherit; transition: opacity .5s; }
.stage.is-ready .boot { opacity: 0; pointer-events: none; }
.boot-card { width: min(320px, calc(100% - 40px)); border-radius: 16px; padding: 16px 18px; }
.boot-card b { display: block; margin-bottom: 10px; }
.boot-card small { display: block; margin-top: 8px; color: var(--s-ink-3); font-size: 12px; }
.boot .bar { height: 6px; border-radius: 3px; background: var(--s-fill-2); overflow: hidden; }
.boot .bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: linear-gradient(90deg, #2456e6, #1f9d5a); border-radius: 3px; transition: width .25s; }
.boot.failed .bar i { background: var(--bad); }
.poster { position: absolute; inset: 0; z-index: 9; display: grid; place-items: end start; padding: clamp(18px, 4cqi, 40px); color: var(--s-ink); }
.poster.small { place-items: center; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(20deg, rgba(248, 250, 252, .96) 0%, rgba(248, 250, 252, .75) 36%, rgba(248, 250, 252, 0) 68%); }
/* The split view's poster carries its labels: keep them readable at rest. */
.poster.small::before { background: radial-gradient(60% 55% at 50% 60%, rgba(248, 250, 252, .78), rgba(248, 250, 252, .1)); }
.poster-body { position: relative; z-index: 2; text-align: left; display: grid; justify-items: start; gap: 12px; max-width: 520px; }
.poster.small .poster-body { text-align: center; justify-items: center; }
.poster-body h3 { margin: 0; font-size: clamp(22px, 3.6cqi, 34px); font-weight: 650; letter-spacing: -.025em; line-height: 1.15; }
.poster-body p { margin: 0; color: var(--s-ink-2); font-size: 14px; }
.poster .start { display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 26px 0 20px; border: 0; border-radius: 999px; background: #10161c; color: #fff; font: 650 16px var(--sans); box-shadow: 0 16px 36px -16px rgba(16, 24, 40, .6); cursor: pointer; transition: transform .15s; }
.poster .start:hover { transform: scale(1.03); }
.poster .start .tri { width: 0; height: 0; border-left: 13px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent; margin-left: 4px; }
.poster .row { display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: flex-start; align-items: center; }
.poster.small .row { justify-content: center; }
.poster a { color: var(--s-ink); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.poster small { color: var(--s-ink-2); font-size: 12px; }

/* ----- narrow stages: phones and small slots */
.stage.narrow { --dock-h: 96px; }  /* until demo.js measures the dock */
.stage.narrow .chrome.top-left { max-width: calc(100% - 100px); }
.stage.narrow .title-chip small { display: none; }
.stage.narrow .pill .t { display: none; }
/* Narrow stages: the layer pills wrap into rows across the width, so every one is in sight. */
.stage.narrow .chrome.top-left { right: 10px; left: 10px; max-width: none; }
.stage.narrow .layers { flex-wrap: wrap; border-radius: 16px; overflow: visible; }
.stage.narrow .layers button { padding: 5px 9px; font-size: 12px; gap: 6px; }
.stage.narrow.embedded .chrome.top-left { top: 52px; }
.stage.narrow .chrome.top-right { z-index: 5; flex-direction: row; align-items: center; }
.stage.narrow .help { left: 10px; right: 10px; width: auto; top: auto; bottom: calc(max(10px, env(safe-area-inset-bottom)) + var(--dock-h) + 10px); max-height: 60%; }
.stage.narrow .result .facts, .stage.narrow .result .r-more { display: none; }
.stage.narrow .result .r-text { font-size: 12.5px; }
.stage.narrow .r-actions [data-act="link"], .stage.narrow .r-actions [data-act="wrong"] { display: none; }
.stage.narrow .hud { top: auto; bottom: calc(max(10px, env(safe-area-inset-bottom)) + var(--dock-h) + 10px); right: 10px; left: auto; width: auto; max-width: 62%; grid-template-columns: 1fr 1fr; padding: 6px 8px; }
.stage.narrow .hud .wide, .stage.narrow .hud div:nth-child(4) { display: none; }
.stage.narrow .dock { left: 10px; right: 10px; transform: none; flex-wrap: wrap; justify-content: center; max-width: none; }
.stage.narrow .scrub { order: -2; flex: 1 1 60%; width: auto; }
.stage.narrow .time { order: -1; min-width: 0; }
.stage.narrow .seg button { padding: 0 8px; }
.stage.narrow .dk.room { max-width: 150px; }
.stage.narrow[data-walk="0"] { --dock-h: 50px; }
.stage.narrow .goal-chip, .stage.narrow .result { left: 10px; right: 10px; top: auto; width: auto; bottom: calc(max(10px, env(safe-area-inset-bottom)) + var(--dock-h) + 10px); transform: none !important; max-height: 55%; overflow: auto; }
.stage.narrow .goal-chip::after { display: none; }
.stage.narrow[data-mode="done"] .hud { display: none; }
.stage.narrow .picker { left: 10px; right: 10px; width: auto; transform: none; height: calc(100% - var(--dock-h) - 40px); top: 10px; bottom: auto; }
.stage.narrow .picker-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
.stage.narrow .folders { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--s-line); }
.stage.narrow .folders li { flex: none; width: 150px; }
.stage.narrow .walks li button { grid-template-columns: 10px minmax(0, 1fr) auto; }
.stage.narrow .walks .w-detail { display: none; }
.stage.narrow .splash { top: 22%; }
.stage.narrow .legend { grid-template-columns: 1fr; }
@media (prefers-reduced-motion: reduce) { .stage *, .stage *::before, .stage *::after { transition: none !important; animation: none !important; } }

/* ----- split views (closer.js) */
.stage.closer { height: clamp(440px, 64vh, 680px); }
.split-labels { position: absolute; z-index: 3; top: 14px; left: 0; right: 0; display: grid; grid-template-columns: 1fr 1fr; pointer-events: none; }
.split-labels span { justify-self: center; padding: 6px 12px; border-radius: 999px; background: var(--s-glass); border: 1px solid var(--s-line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-size: 13px; color: var(--s-ink-2); white-space: nowrap; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; }
.split-labels b { color: var(--s-ink); }
.stage.closer[data-mode="body"] .split-labels span:first-child b { color: #c2307a; }
.stage.closer[data-mode="estimate"] .split-labels span:last-child b { color: #2f74d0; }
.split-divider { position: absolute; z-index: 2; top: 0; bottom: 0; left: 50%; width: 1px; background: linear-gradient(transparent, rgba(16, 22, 28, .16) 20%, rgba(16, 22, 28, .16) 80%, transparent); pointer-events: none; }
.stage.closer.overlay .split-divider { display: none; }
.stage.closer.overlay .split-labels { grid-template-columns: auto auto; justify-content: center; gap: 8px; }
.split-facts { position: absolute; z-index: 3; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--dock-h) + 10px); width: min(720px, calc(100% - 28px)); grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px; border-radius: 14px; background: var(--s-glass); border: 1px solid var(--s-line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.stage.closer .dock .scrub { width: clamp(120px, 30cqi, 380px); }
.stage.closer .time { min-width: 150px; }
.stage.closer.narrow .split-facts { grid-template-columns: 1fr 1fr; }
.stage.closer.narrow .split-labels span { font-size: 11.5px; padding: 4px 9px; }
.stage.closer.narrow .split-labels span small { display: none; }

/* ----- the operator's three steps, above the dock until the first walk plays */
.guide { position: absolute; z-index: 3; left: 50%; transform: translateX(-50%); bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--dock-h) + 12px); display: flex; gap: 4px; margin: 0; padding: 4px; list-style: none; border-radius: 999px; background: var(--s-glass); border: 1px solid var(--s-line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); pointer-events: none; }
.guide li { display: flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border-radius: 999px; font-size: 13px; color: var(--s-ink-3); white-space: nowrap; transition: background .2s, color .2s; }
.guide li b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--s-fill-2); font-size: 11px; }
.guide li.now { color: var(--s-ink); background: var(--s-fill-2); }
.guide li.now b { background: var(--s-accent); color: #fff; }
.guide li.done { color: var(--s-ink-2); }
.guide li.done b { background: var(--ok); color: #fff; }
.stage.narrow .guide li { padding: 4px 9px 4px 5px; font-size: 12px; }
.stage[data-mode="done"] .guide, .stage[data-mode="playing"] .guide { display: none; }

/* ----- the ghost's one-time explanation, pinned above the plan body */
.ghost-tip { position: absolute; left: 0; top: 0; z-index: 3; max-width: 300px; margin: 0; padding: 9px 13px; border-radius: 12px; background: rgba(255, 236, 247, .95); color: #2b1020; font-size: 13px; box-shadow: 0 12px 30px -16px rgba(16, 24, 40, .45); border: 1px solid rgba(194, 48, 122, .18); }
.ghost-tip a { color: #b0246e; font-weight: 650; }
.ghost-tip::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -6px; width: 12px; height: 12px; transform: translateX(-50%) rotate(45deg); background: rgba(255, 236, 247, .95); }
.stage.narrow .ghost-tip { max-width: 240px; font-size: 12px; }
/* phones: Send stays in view inside the sheet; the key list is for keyboards */
.stage.narrow .goal-chip .gc-actions { position: sticky; bottom: -12px; margin: 8px -14px -12px; padding: 10px 14px 12px; background: var(--s-glass-2); border-top: 1px solid var(--s-line); }
@media (pointer: coarse) { .help .keys { display: none; } }
.stage-canvas:focus-visible { outline: 2px solid var(--s-accent); outline-offset: -4px; }

/* ----- round 4: the checks' buttons stay in view at any height; touch screens hide key hints */
.goal-chip .gc-actions { position: sticky; bottom: -12px; margin: 8px -14px -12px; padding: 10px 14px 12px; background: var(--s-glass-2); border-top: 1px solid var(--s-line); }
@media (pointer: coarse) { .btn.go kbd, .folders kbd { display: none; } }
.stage.narrow .layers button { padding: 4px 8px; font-size: 11.5px; gap: 5px; }
.stage.narrow .layers button i { width: 7px; height: 7px; }
.stage.narrow .layers .legend-btn { width: 26px; }
.stage.narrow .poster.small img { object-fit: contain; background: #eef1f4; }
.stage.closer.narrow .split-facts div:nth-child(n+3) { display: none; }

/* Loading actions remain usable before a viewer exists; failures wrap without covering their controls. */
.boot-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.boot-card small { overflow-wrap: anywhere; }
.boot-card a { color: var(--s-ink); text-decoration: underline; }
.boot.failed .bar { display: none; }
@media (pointer: coarse) {
  .stage .dk, .stage .btn, .stage .x, .stage .seg button, .stage .pill { min-height: 44px; min-width: 44px; }
  .stage .filters button { min-height: 36px; }
  .stage .layers button { min-height: 36px; }
  .stage .layers .legend-btn { min-width: 36px; }
}
/* ----- one obvious next action, every pill in sight, sheets that fit any screen */
.flash { width: max-content; }
.flash[data-tone="info"] { background: var(--s-glass-2); border-color: var(--s-line-2); color: var(--s-ink); box-shadow: 0 12px 32px -20px rgba(16, 24, 40, .38); }
.cursor-tip { font-size: 12.5px; padding: 6px 11px; }
.dk.new { padding: 0 12px; font-size: 13.5px; font-weight: 600; }
.dk.nudge { animation: nudge 1.4s ease-in-out 1; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(36, 86, 230, .45); } 35% { box-shadow: 0 0 0 7px rgba(36, 86, 230, .18); background: rgba(36, 86, 230, .1); } }
/* Narrow docks: the timeline gets its own row, the buttons the next one (New goal first, as on wide screens). */
.stage.narrow .scrub { flex: 1 1 calc(100% - 100px); }
.stage.narrow .time { min-width: 84px; }
/* Short and wide (a phone on its side): a single row of chrome and of dock; sheets on the right half. */
.stage.short .title-chip { padding: 5px; }
.stage.short .title-chip > span:last-child { display: none; }
.stage.short .chrome.top-left { flex-direction: row; align-items: flex-start; right: auto; max-width: calc(100% - 172px); }
.stage.short .layers button { padding-left: 7px; padding-right: 7px; }
.stage.demo.narrow:not(.thin) .dock { left: 50%; right: auto; transform: translateX(-50%); flex-wrap: nowrap; max-width: calc(100% - 20px); }
.stage.demo.narrow:not(.thin) .scrub { order: 0; flex: 0 1 auto; width: clamp(110px, 22cqi, 280px); }
.stage.demo.short:not(.thin) .dock .scrub { width: clamp(80px, 14cqi, 180px); }
.stage.demo.short:not(.thin) .dock .room { max-width: 140px; }
.stage.demo.narrow:not(.thin) .time { order: 0; min-width: 76px; }
.stage.demo.narrow:not(.thin) .goal-chip, .stage.demo.narrow:not(.thin) .result { left: auto; right: 10px; width: min(400px, 50%); }
.stage.demo.narrow:not(.thin) .guide { display: none; }
/* The split view's labels in one view: side by side when they fit, wrapped when they do not, never cut. */
.stage.closer.overlay .split-labels { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; padding: 0 10px; }
.stage.closer.overlay .split-labels span { max-width: 100%; white-space: normal; text-align: center; }
/* Touch screens: every control at least 36 px. */
@media (pointer: coarse) {
  .layers button { min-height: 36px; }
  .layers .legend-btn { min-width: 36px; }
  .seg { padding: 2px; }
  .seg button { height: 36px; }
  .filters button { height: 36px; padding: 0 13px; }
  .x { width: 36px; height: 36px; }
  .walks li button { min-height: 44px; }
  .btn { height: 40px; }
  .btn.small { height: 36px; }
  .pill { min-height: 36px; }
  .dk { height: 40px; min-width: 40px; }
  .r-more summary { display: flex; align-items: center; min-height: 36px; }
  .help .x, .picker .x { width: 40px; height: 40px; }
}
/* Big screens: the chrome grows with the stage (labels stay at 12 px or more). */
@container (min-width: 1800px) {
  .title-chip { font-size: 16px; } .title-chip small { font-size: 13px; }
  .layers button { font-size: 14.5px; padding: 8px 13px; }
  .phase, .pill { font-size: 14.5px; }
  .hud { width: 300px; } .hud span { font-size: 12px; } .hud b { font-size: 14.5px; }
  .goal-chip { width: 360px; } .gc-verdict { font-size: 16.5px; } .gc-meta, .gc-note, .check { font-size: 13.5px; } .check .label small { font-size: 12.5px; }
  .result { width: 420px; } .r-text { font-size: 14px; } .result .facts span, .split-facts span { font-size: 12px; } .result .facts b, .split-facts b { font-size: 14px; }
  .dk { height: 42px; font-size: 15px; } .seg button { height: 34px; font-size: 14px; } .time { font-size: 14px; } .scrub { width: clamp(220px, 22cqi, 560px); }
  .guide li { font-size: 14.5px; } .hint { font-size: 15px; } .splash span { font-size: 17px; }
  .picker { width: min(960px, calc(100% - 28px)); height: min(620px, calc(100% - 200px)); } .walks li button, .folders button { font-size: 14px; }
  .help { width: min(520px, calc(100% - 28px)); } .help-body { font-size: 14px; }
}
.gc-actions { gap: 6px; }
.gc-actions .btn { padding: 0 11px; }
@media (pointer: coarse) { .ghost-tip a { display: inline-flex; align-items: center; min-height: 36px; } }
