/* ── /listings/:slug/tour — STUDIO ─────────────────────────────────────────
 *
 * CS-TOUR-04 §7 and the 10:05 ruling ("it should read like the Resolve colour
 * page"). LAYOUT AND CHROME ONLY. Not one new colour, radius, shadow or font:
 * every value here is a token from assets/css/tokens.css, and the only accent
 * in the file is --brand, on an ACTIVE or SELECTED thing.
 *
 * THE ONE EXCEPTION Dom asked for (09:20): a HIDDEN shot is a muted red dot.
 * Backend law is red = danger only; this is the single agreed exception, it is
 * a dot and never text, and it is mixed back into the surface so it reads as
 * a state rather than an alarm.
 *
 * Panels are glass — the page's own elevated surface at 82%, blurred, with a
 * hairline rim and a soft radius. Nothing is a bean: chips and buttons sit on
 * --r-btn, panels on --r-3/--r-4, exactly like the rest of the backend.
 *
 * Motion: 200–260 ms, transform and opacity only. The splitters set a
 * flex-basis once per frame from JS and are deliberately NOT transitioned — a
 * size that eases behind the pointer feels broken.
 */

/* ── The header switch: which layout the editor is wearing ─────────────── */
.te-modesw { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-sunken); border-radius: var(--r-btn); }
.te-modesw button {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: none; border: 0; border-radius: calc(var(--r-btn) - 2px);
  padding: 5px 12px; cursor: pointer;
  transition: color var(--t-base) var(--ease), background-color var(--t-base) var(--ease);
}
.te-modesw button:hover { color: var(--ink); }
.te-modesw button.is-on { background: var(--bg-elevated); color: var(--ink); box-shadow: var(--shadow-1); }
.te-modesw button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.te-studio-host[hidden] { display: none; }

/* ── The workspace ─────────────────────────────────────────────────────── */
.tst {
  --tst-node: 1;
  --tst-glass: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  --tst-ground: var(--bg-sunken);
  --tst-wall: color-mix(in srgb, var(--ink-4) 22%, transparent);
  --tst-hidden: color-mix(in srgb, var(--err) 62%, var(--bg-sunken));
  position: relative;
  margin-top: var(--sp-5);
  font-family: var(--font-sans);
  color: var(--ink);
}
.tst.is-splitting, .tst.is-dragging { user-select: none; }
.tst.is-full { background: var(--bg); padding: var(--sp-3); display: flex; flex-direction: column; height: 100%; }
.tst.is-full .tst-body { flex: 1 1 auto; min-height: 0; }
.tst-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── The toolbar ───────────────────────────────────────────────────────── */
.tst-bar {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: 0 0 var(--sp-3);
}
.tst-sp { flex: 1 1 auto; }
.tst-crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.tst-crumb i { font-style: normal; color: var(--ink-4); }
.tst-crumb-i.is-on { color: var(--ink); font-weight: 600; }
.tst-sel { display: inline-flex; align-items: center; }
.tst-input { font-size: 12px; padding: 4px 26px 4px 9px; height: auto; }
.tst-scale { display: inline-flex; align-items: center; gap: var(--sp-2); }
.tst-scale input[type="range"] { width: 96px; accent-color: var(--brand); }
.tst-tog { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.tst-tog input { accent-color: var(--brand); }
.tst-align { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-sunken); border-radius: var(--r-btn); }
.tst-align .tst-b { border: 0; background: none; padding: 4px 5px; }
.tst-align .tst-b:hover:not([disabled]) { background: var(--bg-hover); }

.tst-b {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--r-btn); padding: 6px 12px; cursor: pointer; text-decoration: none;
  transition: transform var(--t-base) var(--ease-out), color var(--t-base) var(--ease), border-color var(--t-base) var(--ease), background-color var(--t-base) var(--ease);
}
.tst-b:hover { color: var(--ink); border-color: var(--line-strong); }
.tst-b:active { transform: translateY(1px); }
.tst-b:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tst-b.is-on { border-color: var(--brand); color: var(--brand-deep); }
.tst-b[disabled] { opacity: .45; cursor: default; }
.tst-b--quiet { background: none; }
.tst-b--danger { color: var(--err); }
.tst-b--sm { font-size: 11px; padding: 4px 9px; }
.tst-b--icon { padding: 5px 7px; }
.tst-i { flex: none; }

/* ── Zones and splitters ───────────────────────────────────────────────── */
.tst-body { position: relative; display: flex; flex-direction: column; min-height: 420px; }
.tst-mid { display: flex; flex: 1 1 auto; min-height: 0; min-width: 0; }
.tst-centre { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; }
.tst-centre > * { flex: 1 1 auto; min-width: 0; min-height: 0; }

.tst-z {
  position: relative; min-width: 0; min-height: 0;
  background: var(--tst-glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  overflow: hidden;
}
.tst-z[hidden] { display: none; }
.tst-z-in { height: 100%; overflow: auto; padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-3); }
.tst-z--top .tst-z-in, .tst-z--bottom .tst-z-in { flex-direction: row; align-items: stretch; gap: var(--sp-4); }
.tst-z--top .tst-p, .tst-z--bottom .tst-p { flex: 1 1 0; min-width: 150px; }
.tst-z--top .tst-p[data-panel="shots"], .tst-z--bottom .tst-p[data-panel="shots"] { flex: 2.4 1 0; }
.tst-z--top .tst-p[data-panel="stage"], .tst-z--bottom .tst-p[data-panel="stage"],
.tst-z--top .tst-p[data-panel="nodes"], .tst-z--bottom .tst-p[data-panel="nodes"] { flex: 3 1 0; }

.tst-z-fold {
  position: absolute; right: 8px; top: 8px; z-index: 3;
  width: 22px; height: 22px; display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--r-1); color: var(--ink-4); cursor: pointer;
  transition: color var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.tst-z-fold:hover { color: var(--ink-2); }
.tst-z--left .tst-z-fold { transform: rotate(90deg); }
.tst-z--right .tst-z-fold { transform: rotate(-90deg); }
.tst-z--bottom .tst-z-fold { transform: rotate(180deg); }

.tst-z.is-rail { overflow: hidden; }
.tst-rail { height: 100%; display: flex; gap: var(--sp-2); padding: var(--sp-2); align-items: center; }
.tst-z--left.is-rail .tst-rail, .tst-z--right.is-rail .tst-rail { flex-direction: column; }
.tst-rail-t {
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); background: none; border: 0; cursor: pointer; padding: 6px 4px;
  transition: color var(--t-base) var(--ease);
}
.tst-z--left.is-rail .tst-rail-t, .tst-z--right.is-rail .tst-rail-t { writing-mode: vertical-rl; }
.tst-rail-t:hover { color: var(--ink); }

.tst-split { flex: none; position: relative; background: none; }
.tst-split--h { height: 10px; cursor: row-resize; }
.tst-split--v { width: 10px; cursor: col-resize; }
.tst-split[hidden] { display: none; }
.tst-split::after {
  content: ""; position: absolute; inset: 4px 0; border-radius: var(--r-round);
  background: transparent; transition: background-color var(--t-base) var(--ease);
}
.tst-split--v::after { inset: 0 4px; }
.tst-split:hover::after, .tst-split:focus-visible::after { background: var(--line-strong); }
.tst-split:focus-visible { outline: none; }
.tst-split--body::after { inset: 4px 42%; }

/* ── One panel ─────────────────────────────────────────────────────────── */
.tst-p { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.tst-p-head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 4px 2px 6px 0; cursor: grab; user-select: none; flex: none;
}
.tst-p-head:active { cursor: grabbing; }
.tst-p-t { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.tst-p-n { font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.tst-p-grip { margin-left: auto; display: flex; flex-direction: column; gap: 2px; opacity: .5; }
.tst-p-grip i { display: block; width: 12px; height: 1px; background: var(--ink-4); }
.tst-p-fold {
  width: 18px; height: 18px; display: grid; place-items: center;
  background: none; border: 0; padding: 0; color: var(--ink-4); cursor: pointer;
  transition: transform var(--t-base) var(--ease);
}
.tst-p.is-shut .tst-p-fold { transform: rotate(-90deg); }
.tst-p.is-shut .tst-p-body { display: none; }
.tst-p-body { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--sp-3); overflow: auto; }
.tst-p-body.tst-hold { flex: 1 1 auto; overflow: hidden; gap: 0; }
.tst-z--top .tst-p-body, .tst-z--bottom .tst-p-body { flex: 1 1 auto; }

/* The four adopted panels are the Simple flow's own controls, so they keep
   their own spacing — this only stops them stretching the section. */
.tst-p-body > .te-step-body { margin-top: 0; gap: var(--sp-4); }
.tst-p-body .te-f input[type="range"] { width: 110px; }
.tst-p-body .te-layouts { grid-template-columns: 1fr 1fr; }

/* ── Where a dragged panel can land ────────────────────────────────────── */
.tst-drops { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.tst-drop {
  position: absolute; display: grid; place-items: center; pointer-events: auto;
  border: 1px dashed var(--line-strong); border-radius: var(--r-3);
  background: color-mix(in srgb, var(--bg-elevated) 55%, transparent);
  opacity: 0; transition: opacity var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.tst-drops:not([hidden]) .tst-drop { opacity: 1; }
.tst-drop span { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.tst-drop.is-over { border-color: var(--brand); border-style: solid; }
.tst-drop.is-over span { color: var(--brand-deep); }
.tst-drop--top { left: 22%; right: 22%; top: 0; height: 18%; }
.tst-drop--bottom { left: 22%; right: 22%; bottom: 0; height: 18%; }
.tst-drop--left { left: 0; top: 18%; bottom: 18%; width: 20%; }
.tst-drop--right { right: 0; top: 18%; bottom: 18%; width: 20%; }

/* THE BRIDGE — the wire leaving a node and arriving at its handle on the
   sphere. Drawn over everything, hit by nothing. */
.tst-bridge { position: absolute; left: 0; top: 0; z-index: 30; pointer-events: none; overflow: visible; }
.tst-bridge-w { fill: none; stroke: var(--brand); stroke-width: 1.4; opacity: .5; stroke-dasharray: 5 5; }
.tst-bridge-w--obj { stroke: var(--ink-4); opacity: .38; }

/* ── The page tabs along the bottom edge ───────────────────────────────── */
.tst-tabs {
  display: flex; align-items: center; gap: 2px; padding: var(--sp-2) 0 0;
}
.tst-tab {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-3);
  background: none; border: 0; border-radius: var(--r-btn); padding: 6px 14px; cursor: pointer;
  transition: color var(--t-base) var(--ease), background-color var(--t-base) var(--ease);
}
.tst-tab:hover { color: var(--ink); background: var(--bg-hover); }
.tst-tab.is-on { color: var(--ink); background: var(--bg-sunken); }
.tst-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tst-tabs-n { font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

/* ── The two sheets: keyboard, and the live preview ────────────────────── */
.tst-sheet { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: var(--sp-5); }
.tst-sheet[hidden] { display: none; }
.tst-sheet::before { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 62%, transparent); backdrop-filter: blur(6px); }
.tst-sheet-in {
  position: relative; max-width: 560px; width: 100%; max-height: 100%; overflow: auto;
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--r-4); box-shadow: var(--shadow-3); padding: var(--sp-5);
}
.tst-sheet-in--full { max-width: 1100px; height: 100%; display: flex; flex-direction: column; padding: var(--sp-4); }
.tst-sheet-h { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.tst-sheet-h b { font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.tst-keys { margin: 0; display: grid; gap: 6px; }
.tst-keys > div { display: flex; gap: var(--sp-4); align-items: baseline; }
.tst-keys dt { flex: 0 0 130px; font-size: 12px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.tst-keys dd { margin: 0; font-size: 12px; color: var(--ink-2); }
.tst-prev-frame { flex: 1 1 auto; min-height: 0; border-radius: var(--r-3); overflow: hidden; background: var(--bg-sunken); }
.tst-prev-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ── THE STAGE ─────────────────────────────────────────────────────────── */
.tst-stagepane { display: flex; min-width: 0; min-height: 0; }
.tst-stage {
  display: flex; gap: var(--sp-2); min-width: 0; flex: 1 1 auto; min-height: 0;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--r-3); padding: var(--sp-2); position: relative;
}
.tst-stage-mid { position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.tst-stage-slot { flex: 1 1 auto; min-height: 0; display: flex; }

/* The stage itself is the Simple flow's viewer, borrowed. In here it fills the
   height it is given instead of holding a 16:9 box. */
.tst-stage-slot .te-stage { flex: 1 1 auto; min-width: 0; gap: 0; }
.tst-stage-slot .te-stage-bar, .tst-stage-slot .te-stage-hint { display: none; }
.tst-stage-slot .te-viewer { aspect-ratio: auto; flex: 1 1 auto; height: auto; min-height: 0; border-radius: var(--r-2); }

.tst-peek {
  position: relative; flex: 0 0 26%; min-width: 0;
  border-radius: var(--r-2); overflow: hidden; background: var(--bg-sunken);
  cursor: pointer; opacity: .78;
  transition: opacity var(--t-base) var(--ease);
}
.tst-peek:hover { opacity: 1; }
.tst-peek[hidden] { display: none; }
.tst-peek-in { position: absolute; inset: 0; }
.tst-peek-lbl {
  position: absolute; left: 10px; bottom: 10px; z-index: 3; pointer-events: none;
  font-size: 12px; font-weight: 600; color: var(--ink);
  background: var(--tst-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--r-btn); padding: 4px 10px;
}
.tst-peekgrip { position: absolute; top: 0; bottom: 0; width: 10px; cursor: col-resize; z-index: 5; }
.tst-peekgrip--l { left: 0; }
.tst-peekgrip--r { right: 0; }
.tst-peekgrip::after { content: ""; position: absolute; inset: 30% 4px; border-radius: var(--r-round); background: transparent; transition: background-color var(--t-base) var(--ease); }
.tst-peekgrip:hover::after { background: var(--line-strong); }

/* The toolbar floats over the photo — it belongs to the photo, not the page. */
.tst-tools {
  position: absolute; left: 12px; top: 12px; z-index: 8;
  display: flex; gap: 2px; padding: 3px;
  background: var(--tst-glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow-2);
}
.tst-tool {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: 0; border-radius: var(--r-1); padding: 5px 10px; cursor: pointer;
  transition: color var(--t-base) var(--ease), background-color var(--t-base) var(--ease);
}
.tst-tool:hover { color: var(--ink); }
.tst-tool.is-on { background: var(--brand); color: var(--brand-ink); }
.tst-tool:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ── GUIDES: the horizon, the rulers, and the live height ──────────────── */
.tst-guides { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden; }
.tst-g { position: absolute; pointer-events: none; will-change: transform; }
.tst-g--hz, .tst-g--h, .tst-g--live { left: 0; right: 0; top: 0; }
.tst-g--v { top: 0; bottom: 0; left: 0; width: 0; }
.tst-g i { position: absolute; }
.tst-g--hz i, .tst-g--h i, .tst-g--live i { left: 0; right: 0; top: 0; border-top: 1px solid var(--line-strong); }
.tst-g--v i { top: 0; bottom: 0; left: 0; border-left: 1px dashed var(--line-strong); }
.tst-g--hz i { border-top-style: solid; opacity: .9; }
.tst-g--h i { border-top-style: dashed; }
.tst-g--live i { border-top: 1px dashed var(--brand); opacity: .9; }
.tst-g b {
  position: absolute; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ink-2); background: var(--tst-glass); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-1); padding: 1px 6px; white-space: nowrap;
}
.tst-g--hz b, .tst-g--h b, .tst-g--live b { right: 12px; top: -10px; }
.tst-g--live b { color: var(--brand-ink); background: var(--brand); border-color: transparent; }
.tst-g--v b { left: 6px; top: 10px; }
.tst-g--hz, .tst-g--h, .tst-g--v { pointer-events: auto; cursor: grab; }
.tst-g--hz:active, .tst-g--h:active, .tst-g--v:active { cursor: grabbing; }
.tst-g--hz:hover i, .tst-g--h:hover i, .tst-g--v:hover i { border-color: var(--brand); }
.tst-g-x {
  position: absolute; width: 16px; height: 16px; display: grid; place-items: center;
  font: inherit; font-size: 12px; line-height: 1; color: var(--ink-3); cursor: pointer;
  background: var(--tst-glass); border: 1px solid var(--line); border-radius: var(--r-round); padding: 0;
  opacity: 0; transition: opacity var(--t-base) var(--ease), color var(--t-base) var(--ease);
}
.tst-g--h .tst-g-x { right: 62px; top: -8px; }
.tst-g--v .tst-g-x { left: -8px; top: 34px; }
.tst-g:hover .tst-g-x { opacity: 1; }
.tst-g-x:hover { color: var(--err); }

.tst-stagebar {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-2) 2px 0;
}
.tst-say {
  position: absolute; left: 12px; bottom: 46px; z-index: 8; margin: 0; max-width: 60%;
  font-size: 12px; color: var(--ink);
  background: var(--tst-glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--r-2); padding: 7px 11px; box-shadow: var(--shadow-2);
}
.tst-say[hidden] { display: none; }

/* ── THE NODE CANVAS ───────────────────────────────────────────────────── */
.tst-nodepane { display: flex; min-width: 0; min-height: 0; }
.tst-nd { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; min-width: 0; gap: var(--sp-2); }
.tst-nd-bar { position: relative; display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.tst-hint, .tst-count { font-size: 11px; color: var(--ink-4); }
.tst-menu {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30;
  display: flex; flex-direction: column; min-width: 158px; padding: 4px;
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--r-2); box-shadow: var(--shadow-3);
}
.tst-menu.is-at { top: 0; left: 0; }
.tst-menu[hidden] { display: none; }
.tst-menu-i {
  font: inherit; font-size: 13px; color: var(--ink-2); text-align: left;
  display: flex; align-items: center; gap: var(--sp-2);
  background: none; border: 0; border-radius: var(--r-1); padding: 7px 10px; cursor: pointer;
  transition: background-color var(--t-base) var(--ease), color var(--t-base) var(--ease);
}
.tst-menu-i:hover { background: var(--bg-hover); color: var(--ink); }

/* GREY GROUND, BRIGHTER GREY WALLS (Dom 09:10). The ground is the sunken
   surface with a faint dot grid; the walls are the storey's own plan image,
   drawn under the nodes at low contrast and hideable. */
.tst-nd-canvas {
  position: relative; flex: 1 1 auto; min-height: 130px; overflow: hidden;
  background: var(--tst-ground); border: 1px solid var(--line-soft); border-radius: var(--r-2);
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 22px 22px;
}
.tst-nd-canvas.is-panning { cursor: grabbing; }
.tst-nd-canvas.is-dropping { outline: 1px dashed var(--brand); outline-offset: -3px; }
.tst-nd-canvas:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.tst-plan {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none;
  opacity: .3; filter: grayscale(1) contrast(.5) brightness(1.5); will-change: transform;
}
.tst-plan[hidden] { display: none; }
.tst-nd-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; will-change: transform; }
.tst-wires { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; width: 1px; height: 1px; }
.tst-wire { fill: none; stroke: var(--ink-4); stroke-width: 1.5; pointer-events: none; }
.tst-wire-hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.tst-wire.is-on { stroke: var(--brand); stroke-width: 2.4; }
.tst-wire.is-target { stroke: var(--brand); stroke-width: 3; stroke-dasharray: 7 5; }
.tst-wire.is-live { stroke: var(--brand); stroke-dasharray: 4 4; }
.tst-wire--tether { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 4; }
.tst-wire--tether.is-draft { stroke: var(--brand); }
.tst-wire-hit:hover + .tst-wire { stroke: var(--ink-2); stroke-width: 2.2; }
.tst-arrow { fill: var(--ink-4); pointer-events: none; }
.tst-arrow.is-on { fill: var(--brand); }
.tst-marq {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; z-index: 6;
  border: 1px solid var(--brand); background: var(--brand-soft); border-radius: var(--r-1);
}
.tst-marq[hidden] { display: none; }

/* ── One node ──────────────────────────────────────────────────────────── */
.tst-n {
  position: absolute; left: 0; top: 0; transform-origin: 0 0;
  width: calc(148px * var(--tst-node)); cursor: grab;
  background: var(--tst-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow-1);
  padding: 5px; display: flex; flex-direction: column; gap: 4px;
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease), opacity var(--t-base) var(--ease);
}
.tst-n:active { cursor: grabbing; }
.tst-n:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tst-n--shot { height: calc(104px * var(--tst-node)); }
.tst-n--shot.is-cur { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.tst-n.is-sel { border-color: var(--brand); box-shadow: var(--shadow-2); }
.tst-n.is-target { border-color: var(--brand); box-shadow: var(--shadow-2); }
.tst-n.is-hidden { opacity: .42; }
.tst-n.is-hidden .tst-n-no { background: var(--tst-hidden); color: var(--bg-elevated); }
.tst-n-img { width: 100%; flex: 1 1 auto; min-height: 0; object-fit: cover; border-radius: var(--r-1); background: var(--bg-sunken); }
.tst-n-foot { display: flex; align-items: center; gap: 5px; min-width: 0; }
.tst-n-no {
  flex: none; min-width: 17px; text-align: center; font-size: 10px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ink-2); background: var(--bg-sunken);
  border-radius: var(--r-1); padding: 1px 4px;
}
.tst-n-t { font-size: 11px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tst-n-badge { flex: none; margin-left: auto; color: var(--ink-4); display: inline-flex; }
.tst-n-port {
  position: absolute; top: 50%; width: 11px; height: 11px; margin-top: -5.5px;
  border-radius: var(--r-round); background: var(--bg-elevated); border: 2px solid var(--ink-4);
  cursor: crosshair; z-index: 2;
  transition: border-color var(--t-base) var(--ease), transform var(--t-base) var(--ease-out);
}
.tst-n-port:hover { border-color: var(--brand); transform: scale(1.25); }
.tst-n-port--in { left: -6px; }
.tst-n-port--out { right: -6px; border-color: var(--brand-deep); }
.tst-n--obj {
  width: calc(116px * var(--tst-node)); height: calc(46px * var(--tst-node));
  padding: 5px 8px; justify-content: center; gap: 2px;
}
.tst-n--obj .tst-n-k { display: flex; align-items: center; gap: 4px; font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-4); }
.tst-n--obj .tst-n-o { font-size: 11px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tst-n.is-unplaced, .tst-n.is-draft { border-style: dashed; border-color: var(--brand); }

.tst-mini {
  position: absolute; right: 10px; bottom: 10px; z-index: 4; cursor: pointer;
  background: var(--tst-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow-1);
}

/* ── SHOTS ─────────────────────────────────────────────────────────────── */
.tst-find { display: block; flex: none; }
.tst-find .input { width: 100%; font-size: 13px; }
.tst-grps { display: flex; flex-direction: column; gap: var(--sp-3); min-height: 0; }
.tst-grp { display: flex; flex-direction: column; gap: var(--sp-2); }
.tst-grp-h {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%;
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3); background: none; border: 0; padding: 4px 2px; cursor: pointer; text-align: left;
  border-radius: var(--r-1);
  transition: color var(--t-base) var(--ease), background-color var(--t-base) var(--ease);
}
.tst-grp-h:hover { color: var(--ink); }
.tst-grp-h.is-drop { background: var(--brand-soft); color: var(--brand-deep); }
.tst-grp-h svg { transition: transform var(--t-base) var(--ease); }
.tst-grp.is-shut .tst-grp-h svg { transform: rotate(-90deg); }
.tst-grp.is-shut .tst-grp-b { display: none; }
.tst-grp-h i { margin-left: auto; font-style: normal; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.tst-grp-b { display: flex; flex-direction: column; gap: 4px; }

.tst-shot {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 5px 6px; border-radius: var(--r-2); cursor: pointer;
  border: 1px solid transparent; touch-action: manipulation;
  transition: background-color var(--t-base) var(--ease), border-color var(--t-base) var(--ease), transform var(--t-base) var(--ease-out);
}
.tst-shot:hover { background: var(--bg-hover); }
.tst-shot.is-on { border-color: var(--brand); background: var(--brand-soft); }
.tst-shot-grip {
  flex: none; min-width: 20px; text-align: center; cursor: grab;
  font-size: 11px; font-weight: 700; color: var(--ink-4); font-variant-numeric: tabular-nums;
}
.tst-shot-img { flex: none; width: 46px; height: 26px; object-fit: cover; border-radius: var(--r-1); background: var(--bg-sunken); }
.tst-shot-main { min-width: 0; display: flex; flex-direction: column; }
.tst-shot-n { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tst-shot-sub { font-size: 11px; color: var(--ink-4); }
.tst-badge {
  flex: none; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-2); background: var(--bg-sunken); border-radius: var(--r-1); padding: 2px 6px;
}
.tst-star, .tst-hide {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--r-1); color: var(--ink-4); cursor: pointer;
  transition: color var(--t-base) var(--ease), transform var(--t-base) var(--ease-out), opacity var(--t-base) var(--ease);
}
.tst-star { margin-left: auto; }
.tst-star:hover, .tst-hide:hover { color: var(--ink-2); transform: scale(1.08); }
.tst-star.is-on { color: var(--brand-deep); }
.tst-hide { opacity: .55; }
.tst-shot:hover .tst-hide { opacity: 1; }

/* A HIDDEN SHOT (Dom 09:20): a muted red dot with its photo number, in a row
   under the last visible thumbnail, so the order is never lost. Red here and
   nowhere else in the backend — and never as text. */
.tst-dots { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 0 4px 28px; }
.tst-dot {
  width: 20px; height: 20px; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: color-mix(in srgb, var(--tst-hidden) 24%, transparent);
  border: 1px solid color-mix(in srgb, var(--tst-hidden) 55%, transparent);
  border-radius: var(--r-round);
  transition: transform var(--t-base) var(--ease-out), background-color var(--t-base) var(--ease);
}
.tst-dot i {
  font-style: normal; font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.tst-dot:hover { transform: scale(1.14); background: color-mix(in srgb, var(--tst-hidden) 38%, transparent); }
.tst-dot:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* In the bottom (or top) zone the panel is a horizontal CLIP STRIP. */
.tst-shots.is-strip { overflow: auto hidden; }
.tst-shots.is-strip .tst-grps { flex-direction: row; gap: var(--sp-5); align-items: flex-start; }
.tst-shots.is-strip .tst-grp { min-width: 0; }
.tst-shots.is-strip .tst-grp-b { flex-direction: row; align-items: flex-start; flex-wrap: wrap; gap: 6px; max-height: 128px; overflow: auto; }
.tst-shots.is-strip .tst-shot { flex-direction: column; align-items: flex-start; width: 138px; gap: 4px; padding: 6px; }
.tst-shots.is-strip .tst-shot-img { width: 100%; height: 62px; }
.tst-shots.is-strip .tst-shot-grip { position: absolute; }
.tst-shots.is-strip .tst-shot { position: relative; }
.tst-shots.is-strip .tst-shot-grip {
  left: 8px; top: 8px; background: var(--tst-glass); border-radius: var(--r-1); padding: 0 4px; color: var(--ink-2);
}
.tst-shots.is-strip .tst-star { position: absolute; right: 4px; top: 4px; margin: 0; }
.tst-shots.is-strip .tst-hide { position: absolute; right: 26px; top: 4px; }
.tst-shots.is-strip .tst-badge { position: absolute; left: 8px; bottom: 40px; }
.tst-shots.is-strip .tst-dots { padding: 0; flex-direction: column; max-height: 118px; }
.tst-shots.is-strip .tst-find { min-width: 150px; }

/* ── INSPECTOR ─────────────────────────────────────────────────────────── */
.tst-insp { gap: var(--sp-4); }
.tst-f { display: flex; align-items: center; gap: var(--sp-2); font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.tst-f--wide { flex-direction: column; align-items: stretch; gap: 5px; }
.tst-f--wide .input { width: 100%; }
.tst-f--tight { gap: 5px; flex-wrap: nowrap; }
.tst-f--tight input[type="range"] { width: 84px; flex: none; }
.tst-f-l { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.tst-f input[type="range"] { flex: 1 1 90px; accent-color: var(--brand); }
.tst-f b { font-variant-numeric: tabular-nums; color: var(--ink); min-width: 42px; text-align: right; }
.tst-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tst-chip {
  font: inherit; font-size: 12px; color: var(--ink-2);
  background: var(--bg-elevated); border: 1px solid var(--line); border-radius: var(--r-btn);
  padding: 4px 9px; cursor: pointer;
  transition: color var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.tst-chip:hover { color: var(--ink); border-color: var(--line-strong); }
.tst-chip.is-on { border-color: var(--brand); color: var(--brand-deep); }
.tst-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tst-chk { display: flex; align-items: center; gap: var(--sp-2); font-size: 12px; color: var(--ink-2); }
.tst-chk input { accent-color: var(--brand); }
.tst-lede { margin: 0; font-size: 12px; color: var(--ink-2); }
.tst-lede--warn { color: var(--brand-deep); }
.tst-tip { margin: -2px 0 0; font-size: 11px; color: var(--ink-4); }
.tst-none { margin: 0; font-size: 12px; color: var(--ink-4); }
.tst-mini-t { font-size: 11px; color: var(--ink-4); }
.tst-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 4px; max-height: 260px; overflow: auto; }
.tst-pick {
  position: relative; padding: 0; background: none; border: 2px solid transparent; border-radius: var(--r-1);
  cursor: pointer; overflow: hidden; line-height: 0;
  transition: border-color var(--t-base) var(--ease), transform var(--t-base) var(--ease-out);
}
.tst-pick img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.tst-pick:hover { transform: translateY(-1px); }
.tst-pick.is-on { border-color: var(--brand); }
.tst-pick-n {
  position: absolute; right: 3px; top: 3px; min-width: 15px; line-height: 15px; text-align: center;
  font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--brand-ink); background: var(--brand); border-radius: var(--r-round);
}
.tst-pick:not(.is-on) .tst-pick-n { display: none; }

/* ── Small screens. The Studio is DESKTOP-FIRST (Dom 09:30); on a narrow
 *    screen the zones stack instead of fighting for width, and the workspace
 *    still works with one hand rather than pretending to be a desktop. ──── */
@media (max-width: 1100px) {
  .tst-mid { flex-direction: column; }
  .tst-z--left, .tst-z--right { width: auto !important; flex: 0 0 auto !important; max-height: 300px; }
  .tst-split--v { width: auto; height: 10px; cursor: row-resize; }
  .tst-split--v::after { inset: 4px 0; }
  .tst-z--top .tst-z-in, .tst-z--bottom .tst-z-in { flex-direction: column; }
  .tst-bar { gap: var(--sp-2); }
  .tst-peek { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tst *, .tst-drop { transition-duration: 1ms !important; }
}
