/* Infia City v6: minimal editor. Black, white, Poppins. Light by day, dark by night. */
:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #0c0c0c;
  --panel-2: #141414;
  --field: #121212;
  --line: #1f1f1f;
  --line-2: #2c2c2c;
  --hover: #171717;
  --text: #e9e9e9;
  --text-2: #bdbdbd;
  --bright: #ffffff;
  --ink: #000000;
  --ink-dim: #555555;
  --dim: #8a8a8a;
  --faint: #5c5c5c;
  --track: #262626;
  --accent-hover: #dcdcdc;
  --stage: #0d0f10;
  --glass: rgba(0, 0, 0, 0.66);
  --glass-strong: rgba(0, 0, 0, 0.86);
  --glass-text: #ffffff;
  --ring: rgba(255, 255, 255, 0.3);
  --shadow: rgba(0, 0, 0, 0.7);
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
}
:root[data-ui="light"] {
  color-scheme: light;
  --bg: #e6e6e6;
  --panel: #ffffff;
  --panel-2: #f5f5f5;
  --field: #f4f4f4;
  --line: #e8e8e8;
  --line-2: #d6d6d6;
  --hover: #f3f3f3;
  --text: #1c1c1c;
  --text-2: #4a4a4a;
  --bright: #000000;
  --ink: #ffffff;
  --ink-dim: #b5b5b5;
  --dim: #707070;
  --faint: #a3a3a3;
  --track: #e3e3e3;
  --accent-hover: #2a2a2a;
  --stage: #dfe6e8;
  --glass: rgba(255, 255, 255, 0.8);
  --glass-strong: rgba(255, 255, 255, 0.94);
  --glass-text: #000000;
  --ring: rgba(0, 0, 0, 0.18);
  --shadow: rgba(0, 0, 0, 0.18);
}
.app, .panel, .toolbar, .tabs, .viewport .tabs, .lbl, .help, .hud, .node, .chip, .ed-btn, .scene-pick, .search, .tb-btn, .tb-text, .console, .joy {
  transition: background-color .6s ease, color .6s ease, border-color .6s ease;
}
html, body { height: 100%; }
.sheet-handle { display: none; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 12px/1.5 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; letter-spacing: 0.005em; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 1px solid var(--bright); outline-offset: 2px; }

.app { height: 100%; display: grid; grid-template-rows: 48px minmax(0, 1fr) auto; gap: 1px; background: var(--line); }

/* ---------- toolbar ---------- */
/* the toolbar shares the workspace's columns: brand over the Hierarchy, the scene controls over the viewport
   (play and pause centred on it, the time of day flush with its right edge), panel buttons over the Inspector */
.toolbar { display: grid; grid-template-columns: 250px minmax(0, 1fr) 340px; column-gap: 1px; align-items: center; padding: 0; background: var(--panel); }
.toolbar > .tb-brand { padding-left: 14px; }
.tb-stage { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; padding: 0 6px; }
.tb-stage .tb-left-tools { justify-self: start; margin-left: 0; }
.tb-time { justify-self: end; display: flex; align-items: center; min-width: 0; }
.toolbar > .tb-right { padding-right: 14px; }
.tb-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--bright); min-width: 0; }
.tb-mark { width: 30px; height: auto; color: var(--bright); flex: none; }
.tb-title { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.tb-title b { font-weight: 500; font-size: 13px; letter-spacing: 0.01em; }
.tb-file { color: var(--faint); }
.tb-left-tools { display: flex; gap: 2px; align-items: center; min-width: 0; margin-left: 6px; }
.toolbar .tb-center { justify-self: center; display: flex; gap: 2px; }
.tb-btn { height: 30px; min-width: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 10px; background: transparent; border: 0; border-radius: 999px; cursor: pointer; color: var(--text); }
.tb-btn svg { width: 12px; height: 12px; }
.tb-btn:hover { background: var(--hover); }
.tb-btn.is-play { padding: 0 16px 0 13px; background: var(--bright); color: var(--ink); font-weight: 500; }
.tb-btn.is-play:hover { background: var(--accent-hover); }
.tb-btn.is-play[aria-pressed="true"] { background: transparent; color: var(--bright); box-shadow: inset 0 0 0 1px var(--bright); }
.tb-btn[aria-pressed="true"]:not(.is-play) { background: var(--panel-2); color: var(--bright); }
.tb-right { display: flex; justify-content: flex-end; align-items: center; gap: 2px; min-width: 0; }
.tb-field { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px 0 10px; border-radius: 999px; color: var(--dim); }
.tb-field:hover { background: var(--hover); }
.tb-field svg { width: 14px; height: 14px; flex: none; }
.tb-field select { background: transparent; border: 0; color: var(--text); padding: 0 2px; cursor: pointer; }
.tb-field select option { background: var(--panel); color: var(--text); }
.tb-field input[type="range"] { width: 96px; margin: 0; accent-color: var(--bright); }
.tb-field output { width: 58px; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.tb-icon { width: 32px; height: 30px; display: inline-grid; place-items: center; background: transparent; border: 0; border-radius: 999px; cursor: pointer; color: var(--dim); }
.tb-icon svg { width: 14px; height: 14px; }
.tb-icon:hover { background: var(--hover); color: var(--bright); }
.tb-icon[aria-pressed="true"], .tb-icon[aria-expanded="true"] { color: var(--bright); background: var(--panel-2); }
#soundBtn[aria-pressed="false"] .waves { opacity: 0.25; }
.tb-text { height: 30px; padding: 0 14px; background: transparent; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tb-text:hover { border-color: var(--dim); }
.tb-text[aria-expanded="true"] { background: var(--bright); color: var(--ink); border-color: var(--bright); }
.only-narrow { display: none !important; }

/* ---------- panels ---------- */
.workspace { display: grid; grid-template-columns: 250px minmax(0, 1fr) 340px; gap: 1px; min-height: 0; background: var(--line); }
.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tabs { display: flex; align-items: center; gap: 0; height: 38px; padding: 0 14px; flex: none; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: 7px; height: 100%; padding: 0; margin-right: 18px; border: 0; background: transparent; color: var(--faint); font-size: 10.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; }
button.tab { cursor: pointer; }
button.tab:hover { color: var(--text); }
.tab svg { width: 12px; height: 12px; }
.tab.is-active { color: var(--bright); box-shadow: inset 0 -1px 0 var(--bright); }
.tab-spacer { flex: 1; }
.panel-tools { padding: 10px 12px 6px; }
.search { width: 100%; box-sizing: border-box; height: 30px; background: var(--field); border: 1px solid var(--line); border-radius: 999px; color: var(--text); padding: 0 14px; }
.search::placeholder { color: var(--faint); }
.search:focus { outline: none; border-color: var(--dim); }
.x { background: transparent; border: 0; color: var(--dim); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.x:hover { color: var(--bright); }

/* ---------- hierarchy ---------- */
.tree { overflow: auto; padding: 4px 6px 14px; flex: 1; }
.node { display: flex; align-items: center; gap: 7px; height: 28px; padding-right: 10px; border-radius: 6px; white-space: nowrap; color: var(--text); cursor: pointer; }
.node:hover { background: var(--hover); }
.node[aria-selected="true"] { background: var(--bright); color: var(--ink); }
.node[aria-selected="true"] .ico, .node[aria-selected="true"] .meta { color: var(--ink-dim); }
.node .fold { width: 14px; height: 14px; display: grid; place-items: center; color: var(--faint); flex: none; background: transparent; border: 0; padding: 0; cursor: pointer; }
.node .fold svg { width: 7px; height: 7px; transition: transform .12s; }
.node[aria-expanded="false"] .fold svg { transform: rotate(-90deg); }
.node .ico { width: 14px; height: 14px; flex: none; color: var(--faint); display: grid; place-items: center; }
.node .ico svg { width: 13px; height: 13px; }
.node .dotc { display: none; }
.node .nm { overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; max-width: 70%; }
.node .meta { margin-left: auto; padding-left: 10px; color: var(--faint); font-size: 11px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.node.is-scene { font-weight: 500; color: var(--bright); cursor: default; }
.node.is-scene:hover { background: transparent; }
.node.is-scene .ico { color: var(--bright); }

/* ---------- viewport ---------- */
.viewport { background: var(--panel); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.viewport .tabs { background: var(--panel); }
.vp-meta { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 11px; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--stage); }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#gl.is-hover { cursor: pointer; }
#gl[data-drag="orbit"] { cursor: grabbing; }
#gl[data-drag="look"] { cursor: crosshair; }
#gl[data-drag="pan"] { cursor: move; }
.app[data-play="true"] #gl { cursor: grab; }
.gizmo-label { position: absolute; top: 94px; right: 36px; color: var(--glass-text); opacity: .8; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; pointer-events: none; }
.app[data-play="true"] .gizmo-label, .app[data-play="true"] .labels { display: none; }

.labels { position: absolute; inset: 0; pointer-events: none; }
.lbl { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 0; padding: 5px 11px; border-radius: 999px; background: var(--glass); color: var(--glass-text); font-size: 11px; font-weight: 500; white-space: nowrap; pointer-events: auto; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); will-change: transform; }
.lbl i { display: none; }
.lbl::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 9px; background: var(--glass-text); opacity: .5; }
.lbl:hover { background: var(--glass-strong); }
.lbl.is-hero { background: var(--bright); color: var(--ink); font-size: 12px; padding: 6px 14px; }
.lbl.is-hero::after { background: var(--bright); opacity: 1; }
.lbl.is-selected { box-shadow: 0 0 0 1px var(--glass-text); }
.lbl.is-hero.is-selected { box-shadow: 0 0 0 3px var(--ring); }

.help { position: absolute; left: 12px; bottom: 12px; width: min(330px, calc(100% - 24px)); background: var(--glass-strong); color: var(--glass-text); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line-2); border-radius: 12px; z-index: 3; }
.help-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 10px 6px 16px; color: var(--bright); font-weight: 500; }
.help dl { margin: 0; padding: 0 16px 12px; display: grid; }
.help dl div { display: grid; grid-template-columns: 108px 1fr; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); }
.help dt { color: var(--dim); }
.help dd { margin: 0; }

.hud { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; padding: 9px 20px; border-radius: 999px; background: var(--glass); color: var(--glass-text); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); white-space: nowrap; max-width: calc(100% - 24px); box-sizing: border-box; z-index: 3; }
.hud-breath { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 300; min-width: 130px; }
.hud-breath i { width: 12px; height: 12px; border-radius: 50%; background: var(--glass-text); box-shadow: 0 0 16px var(--ring); }
.hud-tip { margin: 0; color: var(--glass-text); opacity: .62; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }

.fade { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .36s ease; z-index: 4; }
.fade.is-on { opacity: 1; }
.loading { position: absolute; inset: 0; z-index: 10; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--panel); color: var(--faint); letter-spacing: .14em; text-transform: uppercase; font-size: 10px; transition: opacity .6s; }
.loading .logo { width: 160px; height: auto; color: var(--bright); animation: breathe-logo 2.4s ease-in-out infinite; }
@keyframes breathe-logo { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.loading.is-done { opacity: 0; pointer-events: none; }
.fallback { position: absolute; inset: 0; z-index: 11; display: grid; place-content: center; gap: 8px; padding: 24px; background: var(--panel); text-align: center; }
.fallback p { max-width: 50ch; margin: 0 auto; color: var(--dim); }

/* ---------- inspector ---------- */
.insp { overflow: auto; flex: 1; padding-bottom: 22px; }
.obj-head { display: grid; grid-template-columns: 18px 1fr; gap: 3px 10px; padding: 16px 18px 12px; align-items: center; }
.obj-head .cube { width: 18px; height: 18px; color: var(--dim); }
.obj-head .cube svg { width: 18px; height: 18px; }
.obj-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.obj-name input[type="checkbox"] { margin: 0; accent-color: var(--bright); order: 2; }
.obj-name .name { flex: 1; min-width: 0; color: var(--bright); font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-meta { grid-column: 2; color: var(--faint); font-size: 11px; }

.comp { border-top: 1px solid var(--line); }
.comp > summary { list-style: none; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 18px; cursor: pointer; color: var(--dim); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.comp > summary:hover { color: var(--bright); }
.comp > summary::-webkit-details-marker { display: none; }
.comp > summary .caret { width: 7px; height: 7px; color: var(--faint); transition: transform .12s; flex: none; order: 3; margin-left: auto; }
.comp:not([open]) > summary .caret { transform: rotate(-90deg); }
.comp > summary .cico { display: none; }
.comp > summary .kind { color: var(--faint); font-weight: 400; letter-spacing: .06em; text-transform: none; }
.comp > summary .kebab { display: none; }
.comp-body { padding: 2px 18px 18px; display: grid; gap: 12px; }

.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); font-weight: 500; }
.eyebrow i { display: none; }
.i-title { margin: 0; font-weight: 500; font-size: 26px; line-height: 1.12; letter-spacing: -0.02em; color: var(--bright); text-wrap: balance; }
.i-title em { font-style: normal; font-weight: 300; color: var(--bright); }
.i-summary { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.7; font-weight: 300; }
.i-note { margin: 0; color: var(--dim); font-size: 11.5px; line-height: 1.6; }
.fields { display: grid; gap: 0; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 36px; }
.fields .row { border-bottom: 1px solid var(--line); padding: 7px 0; }
.row > .k { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v { color: var(--bright); overflow-wrap: anywhere; line-height: 1.5; }
a.v { color: var(--bright); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
a.v:hover { text-decoration-color: var(--bright); }
.status { display: inline-flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bright); }
.meter { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; height: auto; background: none; border: 0; }
.meter i { position: static; display: block; height: 3px; background: var(--bright); border-radius: 2px; box-shadow: 0 0 0 0; }
.meter::before { content: ""; grid-column: 1; grid-row: 1; height: 3px; background: var(--track); border-radius: 2px; }
.meter i { grid-column: 1; grid-row: 1; justify-self: start; max-width: 100%; }
.meter span { padding: 0; line-height: 1; color: var(--bright); font-variant-numeric: tabular-nums; font-weight: 500; font-size: 11.5px; }
.copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.slider { display: grid; grid-template-columns: minmax(0, 1fr) 58px; gap: 10px; align-items: center; }
.slider input { width: 100%; margin: 0; accent-color: var(--bright); }
.slider .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-size: 11.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; cursor: pointer; font-size: 11.5px; }
.chip:hover { border-color: var(--dim); }
.chip[aria-pressed="true"] { background: var(--bright); color: var(--ink); border-color: var(--bright); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text); }
.check input { margin: 0; accent-color: var(--bright); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 16px; background: transparent; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; color: var(--bright); font-weight: 500; }
.ed-btn:hover { border-color: var(--dim); }
.ed-btn svg { width: 11px; height: 11px; }
.ed-btn.is-primary { background: var(--bright); color: var(--ink); border-color: var(--bright); }
.ed-btn.is-primary:hover { background: var(--accent-hover); }
.link-btn { border: 0; background: none; color: var(--dim); cursor: pointer; padding: 0; text-align: left; }
.link-btn:hover { color: var(--bright); }
.children { display: grid; gap: 0; border-top: 1px solid var(--line); }
.child { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 2px; background: transparent; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; }
.child:hover b { text-decoration: underline; text-underline-offset: 3px; }
.child i { display: none; }
.child b { font-weight: 500; color: var(--bright); }
.child span { color: var(--faint); font-size: 11.5px; }
.sub-label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); font-weight: 500; margin-top: 4px; }
.tips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tips div { padding: 10px 0; display: grid; gap: 1px; }
.tips b { color: var(--bright); font-weight: 500; }
.tips span { color: var(--faint); font-size: 11px; line-height: 1.35; }
.xyz { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.xyz span { display: flex; align-items: center; gap: 5px; min-width: 0; }
.xyz em { font-style: normal; color: var(--faint); font-size: 10.5px; }
.xyz .v { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; font-size: 11.5px; }

.scene-picks { display: grid; gap: 6px; }
.scene-pick { display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: auto auto; gap: 1px 14px; align-items: center; padding: 6px 12px 6px 6px; border-radius: 12px; border: 1px solid var(--line-2); background: transparent; cursor: pointer; text-align: left; }
.scene-pick:hover { border-color: var(--dim); }
.scene-pick[aria-pressed="true"] { border-color: var(--bright); background: var(--panel-2); }
.scene-pick .sw { grid-row: 1 / span 2; width: 64px; height: 36px; border-radius: 8px; object-fit: cover; display: block; background: var(--panel-2); }
.scene-pick b { color: var(--bright); font-weight: 500; }
.scene-pick .h { color: var(--faint); font-size: 11px; }
.sw-garden { background: radial-gradient(ellipse 40% 30% at 50% 62%, #3e9c98 60%, transparent 62%), linear-gradient(180deg, #a9d6cc 0 35%, #6f9a55 35% 100%); }
.sw-alpine { background: linear-gradient(135deg, transparent 45%, #f3f7fa 45% 55%, transparent 55%), linear-gradient(225deg, transparent 45%, #dfe9ef 45% 55%, transparent 55%), linear-gradient(180deg, #9cb7cc 0 40%, #6f7b85 40% 70%, #eef3f6 70%); }
.sw-desert { background: linear-gradient(180deg, #f3c9a4 0 34%, #c8643c 34% 50%, #d98a55 50% 60%, #e5c592 60%); }

/* ---------- console: a status line that opens into the log ---------- */
.console { height: 170px; }
.console.is-collapsed { height: 38px; }
.console .tabs { gap: 12px; }
.con-last { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }
.console:not(.is-collapsed) .con-last { visibility: hidden; }
.con-btn { height: 24px; padding: 0 12px; background: transparent; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; font-size: 11px; color: var(--text); }
.con-btn:hover { border-color: var(--dim); }
.con-count { color: var(--faint); font-size: 11px; }
.log { list-style: none; margin: 0; padding: 4px 8px; overflow: auto; flex: 1; font-size: 11.5px; }
.log li { display: grid; grid-template-columns: 12px 64px minmax(0, 1fr); gap: 8px; align-items: start; padding: 4px 8px; border-radius: 6px; color: var(--text-2); }
.log li:hover { background: var(--hover); }
.log li .lv { width: 5px; height: 5px; margin-top: 7px; border-radius: 50%; background: var(--faint); }
.log li.warn .lv { background: var(--bright); border-radius: 0; transform: rotate(45deg); }
.log li.ok .lv { background: var(--bright); }
.log li time { color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- narrow screens ---------- */
@media (max-width: 1500px) { .tb-file { display: none; } }
@media (max-width: 1360px) { #homeBtn { display: none; } .tb-field input[type="range"] { width: 80px; } }
@media (max-width: 1240px) { .tb-title { display: none; } .tb-field.time output { display: none; } .tb-left-tools .tb-field svg { display: none; } .tb-left-tools .tb-field { padding: 0 6px; } }
@media (max-width: 1300px) { .workspace { grid-template-columns: 220px minmax(0, 1fr) 308px; } .toolbar { grid-template-columns: 220px minmax(0, 1fr) 308px; } }
@media (max-width: 900px), (max-height: 520px) {
  .app { grid-template-rows: 48px minmax(0, 1fr); }
  .toolbar { grid-template-columns: auto auto 1fr; column-gap: 14px; padding: 0 14px; }
  .toolbar > .tb-brand, .toolbar > .tb-right { padding: 0; }
  .tb-stage { display: contents; }
  .tb-time { display: none; }
  .tb-left-tools { display: none; }
  .console { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); position: relative; }
  .only-narrow { display: inline-block !important; }
  .wide-only, #homeBtn { display: none !important; }
  .tb-btn-label { display: none; }
  .tb-btn.is-play { padding: 0 11px; }
  .hierarchy, .inspector { position: absolute; z-index: 6; box-shadow: 0 16px 50px var(--shadow); }
  .hierarchy { left: 0; top: 0; bottom: 0; width: min(290px, 86%); transform: translateX(-105%); transition: transform .22s ease; }
  .hierarchy.is-open { transform: none; }
  /* inspector becomes a bottom sheet: peek, half, full (JS sets the translate) */
  .inspector { left: 0; right: 0; top: 12px; bottom: 0; max-height: none; display: flex; flex-direction: column; border-radius: 18px 18px 0 0; transform: translateY(110%); transition: transform .34s cubic-bezier(.2, .8, .2, 1); will-change: transform; }
  .inspector.is-dragging { transition: none; }
  .inspector .tabs { cursor: grab; touch-action: none; }
  .sheet-handle { display: block; flex: none; height: 18px; cursor: grab; touch-action: none; }
  .sheet-handle i { display: block; width: 38px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--line-2); }
  .inspector .insp { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .inspector[data-sheet="peek"] .insp { overflow: hidden; }
  .hud-tip, .gizmo-label { display: none; }
}
@media (max-width: 480px) { .tb-title { display: none; } }
@media (prefers-reduced-motion: reduce) { .hierarchy, .inspector, .loading { transition: none; } .loading .logo { animation: none; opacity: 1; } }

/* phone held sideways: the inspector slides in from the right instead */
@media (max-height: 520px) and (orientation: landscape) {
  .app { grid-template-rows: 44px minmax(0, 1fr); }
  .viewport .tabs { height: 32px; }
  .inspector { top: 0; left: auto; right: 0; width: min(360px, 46%); border-radius: 0; transform: translateX(105%); }
  .sheet-handle { display: none; }
  .inspector .tabs { cursor: default; }
  .hud { top: 10px; bottom: auto; padding: 6px 16px; }
  .joy { width: 104px; height: 104px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
/* touch: no double-tap zoom, no rubber-banding, no long-press callouts on the scene */
html, body { overscroll-behavior: none; }
body { touch-action: manipulation; }
.stage { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* ---------- theme toggle ---------- */
#themeBtn .t-auto, #themeBtn .t-light, #themeBtn .t-dark, #themeBtn .t-device { display: none; }
#themeBtn[data-mode="auto"] .t-auto, #themeBtn[data-mode="light"] .t-light, #themeBtn[data-mode="dark"] .t-dark, #themeBtn[data-mode="device"] .t-device { display: block; }

/* ---------- touch joystick (Play mode) ---------- */
.joy { position: absolute; left: calc(20px + env(safe-area-inset-left, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); width: 116px; height: 116px; border-radius: 50%; background: var(--glass); opacity: .88; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px var(--ring); z-index: 5; touch-action: none; }
.joy::before { content: ""; position: absolute; inset: 30%; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--ring); }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: var(--glass-text); box-shadow: 0 6px 18px var(--shadow); transition: transform .12s ease; }
.joy.is-active .joy-knob { transition: none; }
.look-hint { position: absolute; right: 22px; bottom: 40px; color: var(--glass-text); opacity: .55; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; pointer-events: none; z-index: 5; }
@media (max-width: 900px), (max-height: 520px) {
  .app[data-play="true"] .hud { top: 14px; bottom: auto; }
}

/* ---------- inspector toggle ---------- */
.toggle-row { cursor: pointer; align-items: center; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; justify-self: end; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--track); transition: background-color .2s ease; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--dim); transition: transform .2s ease, background-color .2s ease; }
.switch input:checked + i { background: var(--bright); }
.switch input:checked + i::after { transform: translateX(14px); background: var(--ink); }
.switch input:focus-visible + i { outline: 2px solid var(--bright); outline-offset: 2px; }


/* ---------- Serenity page (covers the scene area) ---------- */
.story { position: absolute; inset: 0; z-index: 8; overflow-y: auto; overscroll-behavior: contain; background: var(--panel); color: var(--text); cursor: pointer; container-type: inline-size; animation: story-in .45s ease both; }
.story:focus { outline: none; }
@keyframes story-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.story-inner { max-width: 1060px; margin: 0 auto; padding: clamp(28px, 7cqw, 72px) clamp(20px, 6cqw, 64px) 40px; }
.story-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-areas: "head head" "copy orb"; column-gap: clamp(24px, 5cqw, 64px); align-items: center; }
.story-head { grid-area: head; }
.story-copy { grid-area: copy; }
.story-eyebrow { margin: 0 0 12px; color: var(--dim); font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }
.story-title { margin: 0; color: var(--bright); font-size: clamp(56px, 15cqw, 140px); font-weight: 300; line-height: .92; letter-spacing: -0.05em; }
.story-lede { margin: 28px 0 0; color: var(--bright); font-size: clamp(19px, 2.8cqw, 26px); font-weight: 400; line-height: 1.35; letter-spacing: -0.01em; }
.story-body { margin: 18px 0 0; max-width: 54ch; color: var(--text-2); font-size: 15px; font-weight: 300; line-height: 1.7; }
.story-orb { grid-area: orb; position: relative; display: grid; place-items: center; aspect-ratio: 1; width: min(100%, 340px); justify-self: center; margin-top: 18px; }
.story-orb i { width: 62%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 36% 32%, #ffffff 0%, #fbfbfa 38%, #eeeeeb 72%, #e2e2de 100%); box-shadow: 0 0 90px rgba(255, 255, 255, .42), 0 0 24px rgba(255, 255, 255, .55), 0 18px 60px rgba(0, 0, 0, .10); animation: story-breathe 8s ease-in-out infinite; }
:root[data-ui="light"] .story-orb i { box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 22px 70px rgba(0, 0, 0, .12), 0 0 30px rgba(255, 255, 255, .9); }
.story-orb::before { content: ""; position: absolute; inset: 4%; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-2); }
.story-orb span { position: absolute; bottom: -2%; color: var(--dim); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.story-orb .in { animation: story-in-label 8s linear infinite; }
.story-orb .out { animation: story-out-label 8s linear infinite; }
@keyframes story-breathe { 0%, 100% { transform: scale(.72); } 50% { transform: scale(1); } }
@keyframes story-in-label { 0%, 48% { opacity: 1; } 52%, 100% { opacity: 0; } }
@keyframes story-out-label { 0%, 48% { opacity: 0; } 52%, 100% { opacity: 1; } }
.story-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(36px, 7cqw, 64px); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.story-stats div { display: grid; gap: 6px; align-content: start; padding: 22px 18px 22px 0; }
.story-stats div + div { padding-left: 18px; border-left: 1px solid var(--line); }
.story-stats b { color: var(--bright); font-size: clamp(24px, 3.3cqw, 34px); font-weight: 300; letter-spacing: -0.03em; }
.story-stats span { color: var(--dim); font-size: 12.5px; line-height: 1.45; }
.story h3 { margin: 0 0 14px; color: var(--dim); font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }
.story-steps { margin-top: clamp(36px, 6cqw, 56px); }
.story-steps ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 4cqw, 36px); }
.story-steps li { display: grid; gap: 8px; align-content: start; }
.story-steps em { font-style: normal; color: var(--faint); font-size: 12px; letter-spacing: .1em; }
.story-steps b { color: var(--bright); font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.story-steps span { color: var(--text-2); font-size: 14px; font-weight: 300; line-height: 1.65; }
.story-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 4cqw, 36px); margin-top: clamp(36px, 6cqw, 56px); padding-top: clamp(24px, 5cqw, 40px); border-top: 1px solid var(--line); }
.story-cols p { margin: 0; color: var(--text-2); font-size: 14px; font-weight: 300; line-height: 1.7; }
.story-close { margin: clamp(40px, 7cqw, 64px) 0 0; text-align: center; color: var(--faint); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
@container (max-width: 820px) {
  .story-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-stats div:nth-child(3) { padding-left: 0; border-left: 0; }
  .story-stats div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .story-cols { grid-template-columns: 1fr; }
  .story-cols > div + div { padding-top: 22px; border-top: 1px solid var(--line); }
}
@container (max-width: 620px) {
  .story-hero { grid-template-columns: 1fr; grid-template-areas: "head" "orb" "copy"; }
  .story-orb { width: min(70%, 240px); margin-top: 26px; }
  .story-steps ol { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .story, .story-orb i, .story-orb span { animation: none; }
  .story-orb .out { display: none; }
}
@media (max-width: 520px) { .viewport .vp-meta { display: none; } }

.stats-hud { position: fixed; left: 50%; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,.75); color: #fff; font: 500 11px/1.4 var(--font); pointer-events: none; white-space: nowrap; }

/* ---------- Serenity page: scene cards ---------- */
.story-scenes { margin-top: clamp(36px, 6cqw, 56px); }
.scene-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 2.4cqw, 22px); }
.scene-card { display: grid; gap: 6px; align-content: start; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.scene-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); transition: transform .35s ease, box-shadow .35s ease; }
.scene-card:hover img { transform: translateY(-3px); box-shadow: 0 14px 30px var(--shadow); }
.scene-card b { margin-top: 8px; color: var(--bright); font-size: 16px; font-weight: 500; }
.scene-card span { color: var(--text-2); font-size: 13.5px; font-weight: 300; line-height: 1.55; }
@container (max-width: 620px) { .scene-cards { grid-template-columns: 1fr; } }

/* ---------- loading bar ---------- */
.load-bar { width: 180px; height: 3px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.load-bar i { display: block; width: 100%; height: 100%; background: var(--bright); transform: scaleX(0); transform-origin: left center; }
#loadLabel { min-height: 1.4em; }

/* ---------- first-visit tour ---------- */
.tour { position: fixed; inset: 0; z-index: 60; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.58), inset 0 0 0 2px var(--glass-text); pointer-events: none; transition: left .35s cubic-bezier(.2,.8,.2,1), top .35s cubic-bezier(.2,.8,.2,1), width .35s cubic-bezier(.2,.8,.2,1), height .35s cubic-bezier(.2,.8,.2,1); }
.tour.is-centered .tour-spot { left: 50%; top: 50%; width: 0; height: 0; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.58); }
.tour-card { position: fixed; box-sizing: border-box; padding: 20px 20px 16px; border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,.35), inset 0 0 0 1px var(--line-2); transition: left .35s cubic-bezier(.2,.8,.2,1), top .35s cubic-bezier(.2,.8,.2,1); }
.tour.is-centered .tour-card { left: 50% !important; top: 50% !important; width: min(420px, calc(100vw - 32px)) !important; transform: translate(-50%, -50%); padding: 28px 28px 20px; }
.tour-count { min-height: 14px; color: var(--faint); font-size: 10.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.tour-card h2 { margin: 4px 0 8px; color: var(--bright); font-size: 19px; font-weight: 500; letter-spacing: -0.01em; }
.tour.is-centered .tour-card h2 { font-size: 24px; }
.tour-card p { margin: 0 0 16px; color: var(--text-2); font-size: 14px; font-weight: 300; line-height: 1.6; }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-spacer { flex: 1; }
.tour-skip { border-color: transparent !important; color: var(--dim); }
.tour-replay { margin-top: 12px; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } }

/* v23 prefab view: breadcrumb bar over the viewport while a landmark is open on its own */
.iso-bar { position: absolute; top: 12px; left: 12px; z-index: 3; display: flex; align-items: center; gap: 2px; max-width: calc(100% - 24px); padding: 4px; border-radius: 999px; background: var(--glass-strong); color: var(--glass-text); border: 1px solid var(--line-2); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 12px; animation: isoIn .25s ease; }
.iso-bar[hidden], .iso-parent[hidden] { display: none; }
.iso-bar svg { width: 14px; height: 14px; flex: none; }
.iso-parent { display: inline-flex; align-items: center; gap: 2px; }
.iso-crumb { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px 0 8px; border: 0; border-radius: 999px; background: transparent; color: inherit; font: inherit; cursor: pointer; opacity: .72; white-space: nowrap; }
.iso-crumb:hover, .iso-crumb:focus-visible { background: var(--glass); opacity: 1; }
.iso-chev { opacity: .4; }
.iso-cur { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 0 6px; color: var(--bright); }
.iso-cur b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iso-mode { display: inline-flex; flex: none; margin-left: 6px; padding: 2px; border-radius: 999px; background: var(--glass); }
.iso-mode button { height: 24px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 11px; cursor: pointer; opacity: .7; }
.iso-mode button[aria-pressed="true"] { background: var(--bright); color: var(--ink); opacity: 1; }
.app[data-play="true"] .iso-bar { display: none; }
@keyframes isoIn { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .iso-bar { animation: none; } }
@media (max-width: 480px) { .iso-bar { font-size: 11px; } .iso-crumb { padding: 0 8px 0 6px; } #isoBack span, .iso-bar > .iso-chev, .iso-parent { display: none; } }

/* v25: content cards without the "Name (Script)" header */
.comp-plain .comp-body { padding-top: 18px; }
/* v25: forms (Post Office message, Serenity updates) */
.i-form { display: grid; gap: 10px; }
.i-form label { display: grid; gap: 5px; }
.i-form label > span { color: var(--dim); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.i-form input, .i-form textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-size: 13px; font-weight: 400; line-height: 1.5; resize: vertical; }
.i-form input::placeholder, .i-form textarea::placeholder { color: var(--dim); opacity: .7; }
.i-form input:focus, .i-form textarea:focus { outline: none; border-color: var(--bright); }
.i-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.i-form-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.i-form button[disabled] { opacity: .5; cursor: progress; }
.form-status { color: var(--dim); font-size: 12px; line-height: 1.5; min-width: 0; flex: 1 1 160px; }
.form-status[data-state="ok"] { color: var(--text); }
.form-status[data-state="err"] { color: #e07b6e; }
.i-form-topic { display: inline-flex; align-items: center; gap: 8px; justify-self: start; padding: 4px 6px 4px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text); font-size: 12px; }
.i-form-topic[hidden] { display: none; }
.i-form-topic button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--dim); cursor: pointer; font: inherit; }
.i-form-topic button:hover { background: var(--line); color: var(--text); }
.i-form-note { margin: 0; color: var(--dim); font-size: 11.5px; line-height: 1.5; }
.story-cta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(18px, 4cqw, 48px); align-items: start; margin-top: clamp(36px, 6cqw, 56px); padding: clamp(22px, 4cqw, 36px); border: 1px solid var(--line-2); border-radius: 18px; cursor: auto; }
.story-cta h3 { margin: 0 0 10px; }
.story-cta p { margin: 0; color: var(--text-2); font-size: 14px; font-weight: 300; line-height: 1.7; }
.story-cta .i-form input { font-size: 14px; padding: 12px 14px; }
@media (max-width: 900px) { .story-cta { grid-template-columns: 1fr; } }
.story-cta .i-form-note { font-size: 12px; line-height: 1.5; color: var(--dim); }
.story-note { margin: 14px 0 0; color: var(--dim); font-size: 12.5px; line-height: 1.6; }
/* v27: university logos in the Research Lab */
.logo-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 2px; }
.logo-tile { position: relative; aspect-ratio: 2.4 / 1; border-radius: 7px; background: #ffffff; border: 1px solid var(--line-2); overflow: hidden; }
.logo-tile img { position: absolute; inset: 6px 7px; width: calc(100% - 14px); height: calc(100% - 12px); object-fit: contain; object-position: center; display: block; }
:root[data-ui="dark"] .logo-tile { background: #e8e8e6; border-color: transparent; opacity: .82; }
.logo-tile.is-text { display: grid; place-items: center; padding: 4px; background: transparent; border-color: var(--line-2); opacity: 1; color: var(--text-2); font-size: 10px; line-height: 1.3; text-align: center; }
