/* ═══════════════════════════════════════════════════════════════════════════
   RED360 · DESIGN SYSTEM
   One dark surface, one accent, one easing curve. Every colour below that is
   brand-specific resolves from --accent / --accent-2, which app.js writes onto
   :root from the tour's brand block — so re-skinning the whole platform is a
   data change, never a CSS change.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── tokens ──────────────────────────────────────────────────────────────── */
:root {
  --bg:        #08080B;
  --bg-1:      #0B0C10;
  --bg-2:      #101116;
  --surface:   rgba(255,255,255,.045);
  --surface-2: rgba(255,255,255,.075);
  --surface-3: rgba(255,255,255,.11);
  --line:      rgba(255,255,255,.085);
  --line-2:    rgba(255,255,255,.15);
  --line-3:    rgba(255,255,255,.24);

  --ink:   #F2F3F5;
  --ink-2: rgba(242,243,245,.68);
  --ink-3: rgba(242,243,245,.44);
  --ink-4: rgba(242,243,245,.26);

  --accent:   #FF2D46;
  --accent-2: #FF7A45;
  --accent-ink: #fff;
  --accent-soft: rgba(255,45,70,.14);
  --accent-line: rgba(255,45,70,.32);
  --accent-glow: rgba(255,45,70,.45);

  --ok: #34D399;
  --warn: #FBBF24;

  --r-xs: 8px; --r-sm: 11px; --r: 14px; --r-md: 18px; --r-lg: 24px; --r-xl: 32px;

  --sh-1: 0 1px 2px rgba(0,0,0,.5);
  --sh-2: 0 10px 30px -10px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.05) inset;
  --sh-3: 0 32px 80px -24px rgba(0,0,0,.85), 0 1px 0 rgba(255,255,255,.06) inset;
  --sh-accent: 0 12px 34px -12px var(--accent-glow);

  --e: cubic-bezier(.16,1,.3,1);
  --e-in: cubic-bezier(.5,0,.75,0);
  --e-spring: cubic-bezier(.34,1.4,.64,1);
  --t-1: .16s; --t-2: .26s; --t-3: .42s; --t-4: .72s;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: var(--font);
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --bar: 62px;
  --pad: clamp(14px, 1.4vw, 22px);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; background: none; border: none; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
::selection { background: var(--accent-soft); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.scroll::-webkit-scrollbar { width: 9px; height: 9px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
.scroll::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: content-box; }

/* ── type ────────────────────────────────────────────────────────────────── */
.t-display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.035em; line-height: 1.03; }
.t-h1 { font-size: clamp(2.05rem, 4vw, 3.5rem); }
.t-h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); letter-spacing: -.03em; font-weight: 600; }
.t-h3 { font-size: 1.06rem; font-weight: 600; letter-spacing: -.015em; }
.t-lead { font-size: clamp(1rem, 1.25vw, 1.14rem); color: var(--ink-2); line-height: 1.62; }
.t-body { color: var(--ink-2); font-size: .95rem; line-height: 1.68; }
.t-eyebrow {
  font-family: var(--mono); font-size: .625rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
}
.t-mono { font-family: var(--mono); font-size: .68rem; letter-spacing: .09em; color: var(--ink-3); }
.t-accent { color: var(--accent); }

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--surface-2);
  --btn-line: var(--line-2);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 42px; padding: 0 18px; border-radius: var(--r-sm);
  background: var(--btn-bg); border: 1px solid var(--btn-line);
  font-size: .875rem; font-weight: 500; letter-spacing: -.006em; color: var(--ink);
  white-space: nowrap;
  transition: background var(--t-2) var(--e), border-color var(--t-2) var(--e),
              transform var(--t-2) var(--e), box-shadow var(--t-2) var(--e), color var(--t-2) var(--e);
}
.btn::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09);
}
.btn:hover { background: var(--surface-3); border-color: var(--line-3); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn[disabled] { opacity: .38; pointer-events: none; }
.btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.btn--primary {
  --btn-bg: linear-gradient(180deg, var(--accent), color-mix(in oklab, var(--accent) 82%, #000));
  --btn-line: transparent;
  color: var(--accent-ink); font-weight: 600;
  box-shadow: var(--sh-accent);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 16px 40px -12px var(--accent-glow); filter: brightness(1.06); }
.btn--lg { height: 50px; padding: 0 26px; font-size: .95rem; border-radius: var(--r); }
.btn--sm { height: 34px; padding: 0 13px; font-size: .8rem; border-radius: var(--r-xs); gap: 7px; }
.btn--sm svg { width: 15px; height: 15px; }
.btn--quiet { --btn-bg: transparent; --btn-line: transparent; color: var(--ink-2); }
.btn--quiet:hover { --btn-bg: var(--surface); color: var(--ink); }
.btn--danger { color: #FF8A8A; }
.btn--danger:hover { background: rgba(255,80,80,.12); border-color: rgba(255,120,120,.3); }
.btn--block { width: 100%; }

.icon-btn {
  position: relative; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2);
  transition: background var(--t-2) var(--e), border-color var(--t-2) var(--e),
              color var(--t-2) var(--e), transform var(--t-2) var(--e);
}
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--ink); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.is-on { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: var(--sh-accent); }
.icon-btn--sm { width: 32px; height: 32px; border-radius: var(--r-xs); }
.icon-btn--sm svg { width: 15px; height: 15px; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px;
  padding: 0 5px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: .62rem; color: var(--ink-3); letter-spacing: .02em;
}

/* ── surfaces ────────────────────────────────────────────────────────────── */
.panel {
  background: rgba(12,13,17,.72);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: background var(--t-2) var(--e), border-color var(--t-2) var(--e), transform var(--t-2) var(--e);
}
.card:hover { background: var(--surface-2); border-color: var(--line-2); }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: .68rem; font-weight: 500; letter-spacing: .01em; color: var(--ink-2);
}
.chip--accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.stat { display: grid; gap: 3px; }
.stat b { font-size: 1.34rem; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: .72rem; color: var(--ink-3); letter-spacing: .01em; }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; }
.dl dt { font-family: var(--mono); font-size: .64rem; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); align-self: center; }
.dl dd { font-size: .875rem; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── form controls ───────────────────────────────────────────────────────── */
.field { display: grid; gap: 7px; }
.field > label { font-size: .74rem; font-weight: 500; color: var(--ink-3); letter-spacing: .01em; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r-xs);
  background: rgba(0,0,0,.28); border: 1px solid var(--line);
  font-size: .85rem; color: var(--ink);
  transition: border-color var(--t-2) var(--e), background var(--t-2) var(--e);
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); background: rgba(0,0,0,.42); }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px; }
.select option { background: #14151A; }
input[type=color] { width: 38px; height: 38px; padding: 3px; border-radius: var(--r-xs); border: 1px solid var(--line); background: rgba(0,0,0,.28); cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 6px; }
input[type=range] { -webkit-appearance: none; width: 100%; height: 22px; background: none; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 99px; background: var(--line-2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -6px; border-radius: 50%;
  background: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.6); transition: transform var(--t-1) var(--e); }
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.18); }
input[type=range]::-moz-range-track { height: 3px; border-radius: 99px; background: var(--line-2); }
input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border: none; border-radius: 50%; background: var(--ink); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-sm); background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.segmented button {
  height: 30px; padding: 0 13px; border-radius: 8px; font-size: .78rem; font-weight: 500; color: var(--ink-3);
  transition: background var(--t-2) var(--e), color var(--t-2) var(--e);
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-on { background: var(--surface-3); color: var(--ink); box-shadow: var(--sh-1); }

.switch { position: relative; width: 40px; height: 23px; border-radius: 99px; background: var(--line-2); flex: 0 0 auto; transition: background var(--t-2) var(--e); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: var(--sh-1); transition: transform var(--t-3) var(--e-spring); }
.switch.is-on { background: var(--accent); }
.switch.is-on::after { transform: translateX(17px); }

/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════════════════════ */
#app { position: fixed; inset: 0; overflow: hidden; }
.view {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--t-3) var(--e), transform var(--t-4) var(--e), filter var(--t-3) var(--e), visibility 0s linear var(--t-3);
}
.view.is-active { opacity: 1; visibility: visible; pointer-events: auto; transform: none; filter: none; transition-delay: 0s; }
.view--dash { transform: scale(1.03); filter: blur(6px); }
.view--tour { transform: scale(.985); }
.view--studio { transform: translateY(14px); }

/* the WebGL canvas lives in one place and is re-parented between screens —
   the context never restarts, so moving from the dashboard into the tour is
   instant */
#stageDash, #stageTour { position: absolute; inset: 0; }
#stageTour { cursor: grab; touch-action: none; }
#stageTour.is-grabbing { cursor: grabbing; }
#stageTour.is-placing { cursor: crosshair; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
}

/* ── brand mark ──────────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand-orb { position: relative; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: var(--sh-accent); flex: 0 0 auto; }
.brand-orb::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); }
.brand-orb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.brand-orb img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.brand-word { font-weight: 700; font-size: .92rem; letter-spacing: .015em; line-height: 1.1; }
.brand-word em { font-style: normal; color: var(--accent); }
.brand-sub { display: block; font-family: var(--mono); font-size: .55rem; letter-spacing: .22em; color: var(--ink-4); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════════════════════ */
.dash { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; }
.dash-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.dash-bg::before {
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 70%;
  background: radial-gradient(60% 70% at 62% 12%, color-mix(in oklab, var(--accent) 26%, transparent), transparent 68%);
  filter: blur(70px); opacity: .55;
}
.dash-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.026) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.026) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(80% 60% at 50% 20%, #000, transparent 78%);
  mask-image: radial-gradient(80% 60% at 50% 20%, #000, transparent 78%);
}
.dash-inner { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 44px) 80px; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  height: var(--bar); margin-bottom: clamp(18px, 3vh, 36px);
  background: linear-gradient(180deg, var(--bg) 58%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent);
  mask-image: linear-gradient(180deg, #000 62%, transparent);
}
.topbar-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.navlink {
  height: 34px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: var(--r-xs);
  font-size: .84rem; font-weight: 500; color: var(--ink-3);
  transition: color var(--t-2) var(--e), background var(--t-2) var(--e);
}
.navlink:hover { color: var(--ink); background: var(--surface); }
.navlink.is-on { color: var(--ink); background: var(--surface-2); }

.hero { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.12fr); gap: clamp(26px, 3.5vw, 54px); align-items: center; min-height: min(560px, 62vh); }
.hero-copy { max-width: 40ch; }
.hero h1 { margin: 16px 0 18px; max-width: 15ch; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.hero-meta { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line); }

/* the live preview: the real engine, running, framed like a device */
.preview {
  position: relative; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4 / 3;
  border: 1px solid var(--line-2); background: var(--bg-1); box-shadow: var(--sh-3);
  isolation: isolate;
}
.preview::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 0 90px rgba(0,0,0,.5);
}
.preview-chrome { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: flex; flex-direction: column; }
.preview-top { display: flex; align-items: center; gap: 9px; padding: 14px 16px;
  font-family: var(--mono); font-size: .58rem; letter-spacing: .18em; color: var(--ink-3);
  background: linear-gradient(180deg, rgba(8,8,11,.72), transparent); }
.preview-top i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.preview-top span { margin-left: auto; color: var(--accent); }
.preview-bottom { margin-top: auto; padding: 16px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  background: linear-gradient(0deg, rgba(8,8,11,.82), transparent); }
.preview-room { font-size: 1.02rem; font-weight: 600; letter-spacing: -.02em; }
.preview-room span { display: block; font-family: var(--mono); font-size: .58rem; letter-spacing: .16em; color: var(--ink-3); margin-top: 4px; }
.preview-play { pointer-events: auto; }
.preview-loading { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: var(--bg-1);
  transition: opacity var(--t-4) var(--e); }
.preview-loading.is-done { opacity: 0; pointer-events: none; }

.section { margin-top: clamp(48px, 9vh, 96px); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.statgrid > div { background: var(--bg-1); padding: 20px 22px; }
.statgrid b { display: block; font-size: 1.55rem; font-weight: 600; letter-spacing: -.035em; }
.statgrid span { display: block; font-family: var(--mono); font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }

.roomgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 14px; }
.roomcard { display: block; width: 100%; position: relative; text-align: left; padding: 0; overflow: hidden; border-radius: var(--r-md); }
.roomcard:hover { transform: translateY(-3px); }
.roomcard-img { display: block; position: relative; aspect-ratio: 16/10; background: var(--bg-2); overflow: hidden; }
.roomcard-img canvas { width: 100%; height: 100%; display: block; opacity: 0; transform: scale(1.04); transition: opacity var(--t-4) var(--e), transform var(--t-4) var(--e); }
.roomcard-img.is-ready canvas { opacity: 1; transform: none; }
.roomcard-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(8,8,11,.6), transparent 55%); }
.roomcard-body { display: block; padding: 13px 15px 15px; }
.roomcard-body h4 { font-size: .92rem; font-weight: 600; letter-spacing: -.015em; }
.roomcard-body p { font-family: var(--mono); font-size: .6rem; letter-spacing: .1em; color: var(--ink-3); margin-top: 5px; }
.roomcard-floor { position: absolute; top: 10px; left: 10px; z-index: 1; }

.dash-foot { margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: .78rem; color: var(--ink-4); }

/* ═══════════════════════════════════════════════════════════════════════════
   TOUR VIEWER
   ═══════════════════════════════════════════════════════════════════════════ */
.tour-ui { position: absolute; z-index: 6; }

/* top bar */
#tourTop {
  top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 14px;
  padding: var(--pad) var(--pad) calc(var(--pad) + 20px);
  background: linear-gradient(180deg, rgba(8,8,11,.9) 12%, rgba(8,8,11,0));
  pointer-events: none;
}
#tourTop > * { pointer-events: auto; }
.tour-title { min-width: 0; }
.tour-title h2 { font-size: 1.02rem; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tour-title p { font-family: var(--mono); font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tour-tools { margin-left: auto; display: flex; align-items: center; gap: 7px; }

.searchbtn {
  display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px 0 13px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-3); font-size: .82rem; min-width: 180px;
  transition: background var(--t-2) var(--e), border-color var(--t-2) var(--e), color var(--t-2) var(--e);
}
.searchbtn:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--ink); }
.searchbtn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.searchbtn .kbd { margin-left: auto; }

/* side panels */
.side {
  position: absolute; top: calc(var(--bar) + 20px); bottom: 150px; width: 306px; z-index: 7;
  display: flex; flex-direction: column; padding: 0;
  transition: transform var(--t-4) var(--e), opacity var(--t-3) var(--e);
}
.side--left { left: var(--pad); }
.side--right { right: var(--pad); bottom: auto; max-height: calc(100% - var(--bar) - 190px); width: 286px; }
.side.is-hidden { opacity: 0; pointer-events: none; }
.side--left.is-hidden { transform: translateX(calc(-100% - var(--pad) - 8px)); }
.side--right.is-hidden { transform: translateX(calc(100% + var(--pad) + 8px)); }
.side-head { display: flex; align-items: center; gap: 10px; padding: 15px 16px 12px; }
.side-head h3 { font-size: .95rem; font-weight: 600; letter-spacing: -.015em; }
.side-head .icon-btn { margin-left: auto; }
.side-body { padding: 0 16px 16px; overflow-y: auto; }

.roommeta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.side-desc { font-size: .84rem; line-height: 1.68; color: var(--ink-2); }
.side-label { font-family: var(--mono); font-size: .58rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-4); margin: 18px 0 9px; }

.hslist { display: grid; gap: 5px; }
.hsrow {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r-xs);
  text-align: left; color: var(--ink-2); border: 1px solid transparent;
  transition: background var(--t-2) var(--e), color var(--t-2) var(--e), border-color var(--t-2) var(--e), transform var(--t-2) var(--e);
}
.hsrow:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); transform: translateX(2px); }
.hsrow-ico { display: grid; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.hsrow-ico svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hsrow--nav .hsrow-ico { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.hsrow-txt { min-width: 0; flex: 1; }
.hsrow-txt b { display: block; font-size: .82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hsrow-txt span { display: block; font-family: var(--mono); font-size: .56rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); margin-top: 2px; }

/* floor plan */
.floorswitch { display: flex; gap: 3px; padding: 3px; background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: var(--r-sm); }
.floorswitch button { flex: 1; height: 30px; border-radius: 8px; font-size: .76rem; font-weight: 500; color: var(--ink-3); transition: var(--t-2) var(--e); }
.floorswitch button.is-on { background: var(--surface-3); color: var(--ink); }
.plan { position: relative; margin-top: 12px; }
.planfloor { display: none; }
.planfloor.is-on { display: block; animation: planIn var(--t-3) var(--e); }
@keyframes planIn { from { opacity: 0; transform: scale(.97); } }
.planfloor svg { width: 100%; height: auto; display: block; overflow: visible; }
.fp-out { fill: none; stroke: var(--line-3); stroke-width: .8; }
.fp-rm { fill: rgba(255,255,255,.028); stroke: var(--line-2); stroke-width: .45; }
.fp-hall { fill: rgba(255,255,255,.055); }
.fp-open { fill: rgba(255,255,255,.015); stroke-dasharray: 2 1.6; }
.fp-core { fill: rgba(255,255,255,.07); stroke: var(--line-2); stroke-width: .4; }
.fp-stair { stroke: var(--line-2); stroke-width: .4; fill: none; }
.fp-glaze { stroke: var(--accent); stroke-width: 1.4; opacity: .6; }
.fp-lb { fill: var(--ink-4); font-size: 2.5px; font-family: var(--font); letter-spacing: .12px; }
.pin { cursor: pointer; }
.pin-hit { fill: transparent; }
.pin-dot { fill: var(--ink-3); transition: fill var(--t-2) var(--e), r var(--t-2) var(--e); }
.pin:hover .pin-dot { fill: var(--ink); }
.pin-lbl { fill: transparent; font-size: 2.5px; text-anchor: middle; paint-order: stroke; stroke: rgba(8,8,11,.85); stroke-width: .8px; font-family: var(--mono); letter-spacing: .18px; transition: fill var(--t-2) var(--e); }
.pin:hover .pin-lbl { fill: var(--ink-2); }
.pin.is-on .pin-lbl { fill: var(--ink); }
.pin.is-on .pin-dot { fill: var(--accent); }
.pin-cone { opacity: 0; transition: opacity var(--t-3) var(--e); }
.pin.is-on .pin-cone { opacity: 1; }
.pin-ring { fill: none; stroke: var(--accent); stroke-width: .5; opacity: 0; transform-origin: center; }
.pin.is-on .pin-ring { animation: pinPulse 2.6s var(--e) infinite; }
@keyframes pinPulse { 0% { opacity: .8; r: 3; } 100% { opacity: 0; r: 8; } }
.plan-legend { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: .55rem; letter-spacing: .12em; color: var(--ink-4); }
.plan-legend i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 5px; }

/* hotspots in the scene */
#hotspots { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.hs { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; gap: 9px;
  will-change: transform; transition: opacity var(--t-2) linear; }
.hs-mark { position: relative; display: grid; place-items: center; transition: transform var(--t-3) var(--e-spring); }
.hs:hover .hs-mark { transform: scale(1.12); }
.hs:active .hs-mark { transform: scale(.96); }
.hs--nav .hs-mark { width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255,255,255,.1); border: 1.5px solid rgba(255,255,255,.62);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 8px 30px rgba(0,0,0,.5), inset 0 0 26px rgba(255,255,255,.16); }
.hs--nav .hs-mark::before { content: ""; position: absolute; inset: -10px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.4); animation: hsPulse 2.8s var(--e) infinite; }
.hs--nav:hover .hs-mark { background: rgba(255,255,255,.2); }
@keyframes hsPulse { 0% { transform: scale(.84); opacity: .9; } 100% { transform: scale(1.3); opacity: 0; } }
.hs-arrow { width: 13px; height: 13px; border-right: 2.2px solid #fff; border-top: 2.2px solid #fff;
  transform: rotate(-45deg) translate(-2px, 2px); }
.hs--info .hs-mark, .hs--image .hs-mark, .hs--video .hs-mark, .hs--doc .hs-mark, .hs--link .hs-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 22px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.4); }
.hs--info .hs-mark::before, .hs--image .hs-mark::before, .hs--video .hs-mark::before,
.hs--doc .hs-mark::before, .hs--link .hs-mark::before {
  content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 1.5px solid var(--accent);
  animation: hsPulse 3s var(--e) infinite; }
.hs-mark svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; position: relative; }
.hs-tag {
  padding: 6px 11px; border-radius: 8px; white-space: nowrap;
  background: rgba(10,11,15,.82); backdrop-filter: blur(12px); border: 1px solid var(--line-2);
  font-size: .72rem; font-weight: 500; letter-spacing: -.005em; color: var(--ink);
  opacity: 0; transform: translateY(-5px) scale(.96);
  transition: opacity var(--t-2) var(--e), transform var(--t-2) var(--e);
}
.hs--nav .hs-tag { opacity: 1; transform: none; }
.hs:hover .hs-tag, .hs:focus-visible .hs-tag { opacity: 1; transform: none; }
.is-placing .hs { outline: 1px dashed var(--line-3); outline-offset: 8px; border-radius: 14px; }

/* filmstrip */
#filmstrip {
  left: 0; right: 0; bottom: 0; padding: 60px var(--pad) var(--pad);
  background: linear-gradient(0deg, rgba(8,8,11,.92) 30%, transparent);
  pointer-events: none; z-index: 6;
}
.strip-wrap { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; pointer-events: auto; padding: 2px; }
.strip-wrap::-webkit-scrollbar { display: none; }
.strip-group { display: flex; gap: 8px; align-items: flex-end; flex: 0 0 auto; }
.strip-group + .strip-group { margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--line); }
.strip-item { display: block; flex: 0 0 auto; width: 116px; text-align: left; }
.strip-thumb { display: block; position: relative; width: 116px; height: 70px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-2);
  transition: border-color var(--t-2) var(--e), transform var(--t-2) var(--e), box-shadow var(--t-2) var(--e); }
.strip-thumb canvas { width: 100%; height: 100%; display: block; opacity: 0; transition: opacity var(--t-3) var(--e); }
.strip-thumb.is-ready canvas { opacity: 1; }
.strip-item:hover .strip-thumb { transform: translateY(-3px); border-color: var(--line-3); }
.strip-item.is-on .strip-thumb { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 26px -8px var(--accent-glow); }
.strip-name { display: block; font-size: .72rem; color: var(--ink-3); margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-item.is-on .strip-name { color: var(--ink); }

/* guided tour transport */
.transport {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 118px; z-index: 8;
  display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 99px;
  opacity: 0; pointer-events: none; transition: opacity var(--t-3) var(--e), transform var(--t-3) var(--e);
}
.transport.is-on { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.transport.is-off { transform: translateX(-50%) translateY(8px); }
.transport-track { position: relative; width: 108px; height: 3px; border-radius: 99px; background: var(--line-2); margin: 0 10px; overflow: hidden; }
.transport-fill { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); background: var(--accent); }
.transport-speed { font-family: var(--mono); font-size: .62rem; color: var(--ink-3); padding: 0 8px; }

/* telemetry */
.telemetry { position: absolute; left: var(--pad); bottom: 122px; z-index: 6; pointer-events: none;
  font-family: var(--mono); font-size: .6rem; letter-spacing: .13em; color: var(--ink-4); }
.sharpen { position: absolute; left: var(--pad); bottom: 142px; z-index: 6; pointer-events: none;
  font-family: var(--mono); font-size: .56rem; letter-spacing: .15em; color: var(--accent);
  opacity: 0; transition: opacity var(--t-3) var(--e); }
.sharpen.is-on { opacity: .9; }
.sharpen::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  margin-right: 7px; vertical-align: middle; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .16; } }

/* onboarding hint */
.hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 7;
  display: flex; align-items: center; gap: 11px; padding: 12px 20px; border-radius: 99px;
  font-size: .82rem; opacity: 0; pointer-events: none; transition: opacity var(--t-4) var(--e); }
.hint.is-on { opacity: 1; }
.hint svg { width: 18px; height: 18px; stroke: var(--accent); fill: none; stroke-width: 1.8; animation: sway 2.6s ease-in-out infinite; }
@keyframes sway { 0%,100% { transform: translateX(-5px); } 50% { transform: translateX(5px); } }

/* ═══════════════════════════════════════════════════════════════════════════
   OVERLAYS — media sheet, command palette, toast, loader
   ═══════════════════════════════════════════════════════════════════════════ */
.scrim { position: absolute; inset: 0; z-index: 30; background: rgba(4,4,6,.62);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity var(--t-3) var(--e), visibility 0s linear var(--t-3); }
.scrim.is-on { opacity: 1; visibility: visible; transition-delay: 0s; }

.sheet {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(468px, 94vw); z-index: 31;
  border-radius: 0; border-top: 0; border-right: 0; border-bottom: 0;
  display: flex; flex-direction: column;
  transform: translateX(102%); transition: transform var(--t-4) var(--e);
}
.sheet.is-on { transform: none; }
.sheet-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 22px 16px; }
.sheet-head h3 { font-size: 1.24rem; font-weight: 600; letter-spacing: -.028em; line-height: 1.24; }
.sheet-head .t-eyebrow { margin-bottom: 7px; }
.sheet-body { padding: 0 22px 26px; overflow-y: auto; flex: 1; }
.sheet-media { border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); margin-bottom: 18px; background: #000; }
.sheet-media img, .sheet-media video, .sheet-media iframe, .sheet-media canvas { display: block; width: 100%; border: 0; }
.sheet-media iframe { aspect-ratio: 16/9; }
.sheet-empty { display: grid; place-items: center; gap: 10px; padding: 40px 20px; text-align: center;
  border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--ink-3); font-size: .82rem; margin-bottom: 18px; }
.sheet-empty svg { width: 26px; height: 26px; stroke: var(--ink-4); fill: none; stroke-width: 1.5; }
.sheet-foot { padding: 16px 22px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }

/* command palette */
.palette {
  position: absolute; left: 50%; top: 14vh; transform: translateX(-50%) scale(.97); z-index: 32;
  width: min(620px, 92vw); max-height: 66vh; display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; visibility: hidden;
  transition: opacity var(--t-2) var(--e), transform var(--t-3) var(--e), visibility 0s linear var(--t-3);
}
.palette.is-on { opacity: 1; visibility: visible; transform: translateX(-50%) scale(1); transition-delay: 0s; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 19px; height: 19px; stroke: var(--ink-3); fill: none; stroke-width: 1.8; flex: 0 0 auto; }
.palette-input input { flex: 1; height: 26px; font-size: 1rem; letter-spacing: -.01em; }
.palette-input input:focus { outline: none; }
.palette-list { overflow-y: auto; padding: 8px; }
.palette-group { font-family: var(--mono); font-size: .56rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-4); padding: 10px 10px 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: var(--r-xs); text-align: left;
  transition: background var(--t-1) linear; }
.palette-item.is-sel { background: var(--surface-2); }
.palette-thumb { display: block; width: 46px; height: 30px; border-radius: 6px; overflow: hidden; background: var(--bg-2); flex: 0 0 auto; border: 1px solid var(--line); }
.palette-thumb canvas { width: 100%; height: 100%; display: block; }
.palette-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink-2); flex: 0 0 auto; }
.palette-ico svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.palette-txt { min-width: 0; flex: 1; }
.palette-txt b { display: block; font-size: .875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-txt span { display: block; font-size: .7rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-hint { font-family: var(--mono); font-size: .58rem; color: var(--ink-4); letter-spacing: .1em; }
.palette-foot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 16px; align-items: center;
  font-size: .68rem; color: var(--ink-4); }
.palette-foot span { display: flex; align-items: center; gap: 5px; }
.palette-empty { padding: 32px 16px; text-align: center; color: var(--ink-3); font-size: .85rem; }

/* toast */
#toast { position: absolute; left: 50%; bottom: 168px; transform: translate(-50%, 10px); z-index: 40;
  padding: 11px 18px; border-radius: 99px; font-size: .8rem; white-space: nowrap; max-width: 90vw;
  overflow: hidden; text-overflow: ellipsis; opacity: 0; pointer-events: none;
  transition: opacity var(--t-2) var(--e), transform var(--t-3) var(--e); }
#toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* loader */
#loader { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg);
  transition: opacity var(--t-4) var(--e); }
#loader.is-done { opacity: 0; pointer-events: none; }
.loader-in { width: min(400px, 84vw); text-align: center; }
.loader-mark { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 26px; }
.loader-bar { position: relative; height: 2px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.loader-fill { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px var(--accent-glow); transition: transform var(--t-2) linear; }
.loader-row { display: flex; justify-content: space-between; margin-top: 12px;
  font-family: var(--mono); font-size: .6rem; letter-spacing: .14em; color: var(--ink-4); }

/* failure */
.failure { position: absolute; inset: 0; z-index: 60; display: grid; align-content: center; justify-items: center; gap: 15px;
  padding: 40px 26px; text-align: center; background: var(--bg); overflow-y: auto; }
.failure h2 { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 600; letter-spacing: -.028em; }
.failure p { max-width: 54ch; color: var(--ink-2); font-size: .92rem; line-height: 1.7; }
.failure p b { color: var(--ink); }
.failure-act { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.failure pre { max-width: min(720px, 90vw); max-height: 34vh; overflow: auto; text-align: left; white-space: pre-wrap;
  font-family: var(--mono); font-size: .66rem; line-height: 1.7; color: var(--ink-3);
  background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }

/* ═══════════════════════════════════════════════════════════════════════════
   STUDIO (CMS)
   ═══════════════════════════════════════════════════════════════════════════ */
.studio { position: absolute; inset: 0; display: grid; grid-template-columns: 232px minmax(0,1fr); background: var(--bg); }
.studio-rail { border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg-1); }
.studio-rail-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.studio-nav { padding: 12px 10px; display: grid; gap: 2px; }
.studio-nav button { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-xs);
  font-size: .85rem; color: var(--ink-3); text-align: left; transition: var(--t-2) var(--e); }
.studio-nav button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.studio-nav button:hover { background: var(--surface); color: var(--ink); }
.studio-nav button.is-on { background: var(--surface-2); color: var(--ink); }
.studio-rail-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.studio-main { display: flex; flex-direction: column; min-width: 0; }
.studio-top { display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.studio-top h2 { font-size: 1.06rem; font-weight: 600; letter-spacing: -.02em; }
.studio-top p { font-size: .78rem; color: var(--ink-3); margin-top: 2px; }
.studio-top-act { margin-left: auto; display: flex; gap: 8px; }
.studio-body { flex: 1; overflow-y: auto; padding: 22px; }
.studio-cols { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 22px; align-items: start; }
.studio-panel { padding: 18px; }
.studio-panel h4 { font-size: .9rem; font-weight: 600; margin-bottom: 14px; }
.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.roomlist { display: grid; gap: 6px; }
.roomlist-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-xs);
  border: 1px solid transparent; text-align: left; transition: var(--t-2) var(--e); }
.roomlist-item:hover { background: var(--surface); border-color: var(--line); }
.roomlist-item.is-on { background: var(--surface-2); border-color: var(--line-2); }
.roomlist-thumb { display: block; width: 54px; height: 34px; border-radius: 7px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); flex: 0 0 auto; }
.roomlist-thumb canvas { width: 100%; height: 100%; display: block; }
.roomlist-txt { min-width: 0; flex: 1; }
.roomlist-txt b { display: block; font-size: .84rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roomlist-txt span { display: block; font-family: var(--mono); font-size: .56rem; letter-spacing: .1em; color: var(--ink-4); margin-top: 2px; }
.drop {
  display: grid; place-items: center; gap: 8px; padding: 22px; border-radius: var(--r);
  border: 1px dashed var(--line-2); text-align: center; color: var(--ink-3); font-size: .8rem;
  transition: var(--t-2) var(--e); cursor: pointer;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.drop svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.code { font-family: var(--mono); font-size: .68rem; line-height: 1.8; color: var(--ink-2); white-space: pre-wrap; word-break: break-word;
  background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; max-height: 300px; overflow: auto; }
.hs-edit { display: grid; grid-template-columns: 92px 1fr auto; gap: 7px; align-items: center; padding: 8px; border-radius: var(--r-xs);
  border: 1px solid var(--line); background: var(--surface); }
.hs-edit + .hs-edit { margin-top: 7px; }
.hs-edit.is-sel { border-color: var(--accent); background: var(--accent-soft); }
.studio-preview { position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16/10; background: var(--bg-2); }
.studio-preview .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-4); font-size: .8rem; }

/* mobile dock — the phone's route into the panels */
.mobile-dock { display: none; position: absolute; left: var(--pad); right: var(--pad); bottom: 118px; z-index: 9;
  gap: 8px; justify-content: center; }
.mobile-dock .btn { backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(12,13,17,.72); }
.hint-short { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1180px) {
  .side--left { width: 272px; }
  .side--right { width: 250px; }
}
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { max-width: none; }
  .preview { aspect-ratio: 16/10; }
  .studio { grid-template-columns: 1fr; }
  .studio-rail { position: absolute; inset: 0 auto 0 0; width: 232px; z-index: 5; transform: translateX(-100%);
    transition: transform var(--t-3) var(--e); box-shadow: var(--sh-3); }
  .studio-rail.is-on { transform: none; }
  .studio-cols { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .hide-sm { display: none !important; }
  #tourTop .brand-word { display: none; }
  .tour-title h2 { font-size: .95rem; }
  .tour-tools { gap: 6px; }
  .icon-btn { width: 38px; height: 38px; }
}
@media (max-width: 420px) { .hide-xs { display: none !important; } }
@media (max-width: 860px) {
  .mobile-dock { display: flex; }
  .hint-full { display: none; }
  .hint-short { display: inline; }
  .hint { max-width: 82vw; text-align: center; }
  .side {
    position: absolute; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 62vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0; border-left: 0; border-right: 0; border-bottom: 0;
    transform: translateY(102%); z-index: 25;
  }
  .side--right { max-height: 62vh; }
  .side.is-open { transform: none; }
  .side.is-hidden { transform: translateY(102%); }
  .side::before { content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 99px; background: var(--line-3); }
  .side-head { padding-top: 22px; }
  #filmstrip { padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom)); }
  .strip-item, .strip-thumb { width: 96px; }
  .strip-thumb { height: 60px; }
  .telemetry, .sharpen { display: none; }
  .transport { bottom: 106px; }
  #toast { bottom: 150px; }
  .searchbtn { min-width: 0; padding: 0 12px; }
  .searchbtn span, .searchbtn .kbd { display: none; }
  .sheet { top: auto; width: auto; left: 0; right: 0; max-height: 82vh; border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-left: 0; border-right: 0; transform: translateY(102%); }
  .palette { top: 6vh; max-height: 80vh; }
  .dash-inner { padding-bottom: 48px; }
  .topbar { gap: 10px; }
  .navlink { padding: 0 10px; font-size: .8rem; }
}
@media (max-width: 560px) {
  .hero-meta { gap: 18px; }
  .roomgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .tour-title p { display: none; }
  .brand-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .06s !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOUCH & MOTION
   Hover is a lie on a touchscreen — iOS latches :hover after a tap, which is
   why a tapped drop-zone stayed lit. Everything hover-driven is neutralised
   below the (hover: none) query and replaced with press feedback.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (hover: none) {
  .btn:hover { background: var(--btn-bg); border-color: var(--btn-line); transform: none; box-shadow: none; filter: none; }
  .btn--primary:hover { box-shadow: var(--sh-accent); }
  .icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink-2); transform: none; }
  .icon-btn.is-on:hover { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
  .card:hover, .roomcard:hover { background: var(--surface); border-color: var(--line); transform: none; }
  .strip-item:hover .strip-thumb { transform: none; border-color: var(--line); }
  .strip-item.is-on:hover .strip-thumb { border-color: var(--accent); }
  .hsrow:hover { background: none; color: var(--ink-2); border-color: transparent; transform: none; }
  .roomlist-item:hover { background: none; border-color: transparent; }
  .roomlist-item.is-on:hover { background: var(--surface-2); border-color: var(--line-2); }
  .studio-nav button:hover { background: none; color: var(--ink-3); }
  .studio-nav button.is-on:hover { background: var(--surface-2); color: var(--ink); }
  .navlink:hover { background: none; color: var(--ink-3); }
  .navlink.is-on:hover { background: var(--surface-2); color: var(--ink); }
  .searchbtn:hover { background: var(--surface); border-color: var(--line); color: var(--ink-3); }
  .drop:hover { border-color: var(--line-2); background: none; color: var(--ink-3); }
  .drop.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
  .hs:hover .hs-mark { transform: none; }
  .hs--nav:hover .hs-mark { background: rgba(255,255,255,.1); }
  .pin:hover .pin-dot { fill: var(--ink-3); }
  .pin.is-on:hover .pin-dot { fill: var(--accent); }
  .input:hover, .select:hover, .textarea:hover { border-color: var(--line); }

  /* press states carry the feedback instead */
  .btn:active { transform: scale(.97); filter: brightness(1.12); }
  .icon-btn:active { transform: scale(.9); background: var(--surface-2); }
  .card:active, .roomcard:active { transform: scale(.985); background: var(--surface-2); }
  .hsrow:active, .roomlist-item:active, .studio-nav button:active { background: var(--surface-2); }
  .strip-item:active .strip-thumb { transform: scale(.96); }
  .drop:active { border-color: var(--accent); background: var(--accent-soft); }
}

/* ── scrolling ───────────────────────────────────────────────────────────── */
.scroll, .dash, .strip-wrap, .studio-body, .sheet-body, .side-body, .palette-list {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* scroll-behavior stays off: it only affects programmatic scrolls, where it
   makes scrollIntoView lag. Wheel and touch smoothness comes from keeping
   paint and layout work off the scroll, below. */
.dash { scroll-padding-top: 80px; scrollbar-gutter: stable; }
/* keep long lists off the main thread and out of layout when far away */
.roomgrid, .strip-wrap, .roomlist { contain: layout paint; }
/* promote to their own layer WITHOUT touching transform — .sheet, .side and
   .palette are hidden by a transform, and overwriting it leaves them on
   screen swallowing clicks */
.panel, .side, .sheet, .palette, .preview { will-change: transform, opacity; backface-visibility: hidden; }
.strip-item, .roomcard, .hs { will-change: transform; }

/* iOS: the layout viewport is taller than the visible one, and focusing an
   input scrolls the whole fixed shell out of view. dvh + a resizing keyboard
   pins it. */
#app { height: 100vh; height: 100dvh; }
@supports (-webkit-touch-callout: none) {
  #app { min-height: -webkit-fill-available; }
}

/* blur is the most expensive thing on a phone GPU — halve it there */
@media (max-width: 900px) {
  .panel { backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%); }
  .icon-btn, .mobile-dock .btn { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .grain::after { display: none; }
  .dash-bg::after { opacity: .6; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   STUDIO ON A PHONE
   ═══════════════════════════════════════════════════════════════════════════ */
.studio-scrim {
  position: absolute; inset: 0; z-index: 4; background: rgba(4,4,6,.6);
  opacity: 0; visibility: hidden; transition: opacity var(--t-3) var(--e), visibility 0s linear var(--t-3);
}
.studio-scrim.is-on { opacity: 1; visibility: visible; transition-delay: 0s; }
.studio-top {
  position: sticky; top: 0; z-index: 3;
  background: linear-gradient(180deg, var(--bg-1) 82%, rgba(11,12,16,.86));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
#btnRailToggle { display: none; }
@media (max-width: 1000px) {
  #btnRailToggle { display: grid; }
  .studio-rail { width: min(268px, 84vw); }
}
@media (max-width: 620px) {
  .studio-body { padding: 14px; }
  .studio-panel { padding: 14px; }
  .form-row { grid-template-columns: 1fr; }
  .hs-edit { grid-template-columns: 1fr; gap: 8px; }
  .hs-edit > div { justify-content: flex-end; }
  .studio-top { padding: 12px 14px; gap: 10px; }
  .studio-top h2 { font-size: .98rem; }
  .studio-top p { display: none; }
  .studio-top-act #saveState { display: none; }
  .studio-preview { aspect-ratio: 4/3; }
  .dl { grid-template-columns: 1fr auto; }
  .sheet-head { padding: 18px 16px 12px; }
  .sheet-body { padding: 0 16px 20px; }
  .sheet-foot { padding: 14px 16px 18px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLL CONTAINMENT
   A flex or grid item defaults to min-height:auto, so a child with
   overflow:auto grows to fit its content instead of scrolling — the panel
   silently spills past the viewport and nothing moves. Every scroll container
   in the product needs its track floored at zero.
   ═══════════════════════════════════════════════════════════════════════════ */
.studio { min-height: 0; overflow: hidden; }
.studio-main { min-height: 0; min-width: 0; overflow: hidden; }
.studio-body { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.studio-rail { min-height: 0; overflow-y: auto; }
.side { min-height: 0; }
.side-body { flex: 1 1 auto; min-height: 0; }
.sheet { min-height: 0; }
.sheet-body { flex: 1 1 auto; min-height: 0; }
.palette { min-height: 0; }
.palette-list { flex: 1 1 auto; min-height: 0; }
.view, #app { min-height: 0; }

/* the dock has to outrank the sheets it opens, and step above them when one
   is up, so Details ⇄ Plan is one tap rather than close-then-open */
.mobile-dock { z-index: 26; transition: bottom var(--t-3) var(--e), opacity var(--t-2) var(--e); }
.mobile-dock.is-raised { bottom: calc(62vh + 12px); }
