/* Kinetape Path Studio. Patterns from Huemetry (the author's colour app):
   neutral greys (zero chroma) so the only colour on screen is signal, a
   dotted canvas, floating panels with 24px squircle corners, uppercase panel
   titles, one control height per row (32 / 24px), a side rail of icons and
   tips in three parts. Light is the default theme. */

:root {
  --space-xs: 4px; --space-sm: 8px; --space-md: 12px; --space-lg: 16px; --space-xl: 24px;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 12px; --radius-xl: 24px; --radius-pill: 999px;
  --size-control-sm: 24px; --size-control-md: 32px;
  --rail-w: 44px; --inspector-w: 288px;

  --bg: #181818; --bg-elev: #212121; --bg-input: #2a2a2a; --bg-track: #171717;
  --border: #343434; --border-strong: #515151;
  --text: #eaeaea; --text-dim: #a2a2a2; --text-label: #727272; --text-faint: #515151;
  --pill-grad-from: #2e2e2e; --pill-grad-to: #212121; --pill-border-mid: #696969; --toggle-on-fill: #141414; --dot: #313131;
  --accent: #6ea8fe; --accent-soft: rgba(110, 168, 254, 0.18);
  --good: #5cc98a; --warn: #e0a458; --bad: #e06a6a;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-float: 0 0.7px 0.7px -0.6px rgba(0,0,0,.33), 0 1.8px 1.8px -1.25px rgba(0,0,0,.31), 0 3.6px 3.6px -1.9px rgba(0,0,0,.31), 0 6.9px 6.9px -2.5px rgba(0,0,0,.29), 0 13.6px 13.6px -3.1px rgba(0,0,0,.22), 0 30px 30px -3.75px rgba(0,0,0,.11);
  --shadow-pressed: inset 0 1px 3px rgba(0, 0, 0, 0.22);
  /* The 3D views stay dark in both themes, like Huemetry's gamut charts:
     the tube, the comb and the reference read against a dark ground. */
  --view-bg: #1a1a1a;
}
:root[data-theme='light'] {
  --bg: #fafafa; --bg-elev: #ffffff; --bg-input: #f7f7f7; --bg-track: #e9e9e9;
  --border: #ebebeb; --border-strong: #c1c1c1;
  --text: #1a1a1a; --text-dim: #666666; --text-label: #b3b3b3; --text-faint: #cccccc;
  --pill-grad-from: #ffffff; --pill-grad-to: #f0f0f0; --pill-border-mid: #f4f4f4; --toggle-on-fill: #dedede; --dot: #d4d4d4;
  --accent: #629bff; --accent-soft: rgba(98, 155, 255, 0.12);
  --good: #1f9d57; --warn: #b9791e; --bad: #cf3b3b;
  --shadow: 0 4.5px 3px -2.5px rgba(0, 0, 0, 0.07), inset 0 0 0 1px #fff;
  --shadow-float: 0 0.7px 0.7px -0.6px rgba(0,0,0,.15), 0 1.8px 1.8px -1.25px rgba(0,0,0,.14), 0 3.6px 3.6px -1.9px rgba(0,0,0,.14), 0 6.9px 6.9px -2.5px rgba(0,0,0,.13), 0 13.6px 13.6px -3.1px rgba(0,0,0,.1), 0 30px 30px -3.75px rgba(0,0,0,.05);
}
/* Figma's 60% corner smoothing, as the browser can draw it (Huemetry tokens.css). */
@supports (corner-shape: superellipse(1.45)) {
  :root { --corner: superellipse(1.45); --radius-sm: calc(6px * 1.3); --radius-md: calc(10px * 1.3); --radius-lg: calc(12px * 1.3); --radius-xl: calc(24px * 1.3); }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; background: var(--bg); color: var(--text); overflow: hidden;
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px); background-size: 16px 16px;
}
.theme-switching * { transition: none !important; }
button, input { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-xs) 6px; width: calc(100% - 12px); }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- rail ---------- */
.rail {
  width: var(--rail-w); flex: 0 0 auto; margin: var(--space-sm) 0 var(--space-sm) var(--space-sm);
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); corner-shape: var(--corner);
}
.logo {
  width: 28px; height: 28px; margin: 2px 0 6px; display: grid; place-items: center;
  background: var(--text); color: var(--bg-elev); font-weight: 700; border-radius: var(--radius-sm); corner-shape: var(--corner);
  border: 0; padding: 0; font-size: 14px; cursor: pointer; transition: opacity .15s;
}
.logo:hover, .logo.on { opacity: .82; }
.icon-btn {
  width: var(--size-control-md); height: var(--size-control-md); padding: 0; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim); background: transparent; border: 0; border-radius: var(--radius-sm); corner-shape: var(--corner); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--bg-input); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.sm { width: var(--size-control-sm); height: var(--size-control-sm); }
#dock[data-tlmode="keys"] #tlModeSeg { display: none; }
.icon-btn.toggle.on, .icon-btn.on { color: var(--text); background: var(--toggle-on-fill); box-shadow: var(--shadow-pressed); }

/* ---------- shell ---------- */
.shell {
  flex: 1; min-width: 0; display: grid; gap: var(--space-sm); padding: var(--space-sm);
  grid-template-columns: minmax(0, 1fr) var(--inspector-w);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: 'canvas inspector' 'dock inspector';
}
.panel {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-xl); corner-shape: var(--corner);
  padding: var(--space-md); min-width: 0; min-height: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); min-height: var(--size-control-md); padding: 0 var(--space-sm); margin-bottom: var(--space-sm); flex-wrap: wrap; }
.panel-head h2, .sec h3 {
  display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px; color: var(--text-label);
}
.head-actions { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.help-icon {
  display: inline-grid; place-items: center; width: 15px; height: 15px; border: 1.3px solid currentColor; border-radius: 50%;
  font-size: 10px; font-weight: 700; color: var(--text-label); cursor: help; text-transform: none;
}
.help-icon:hover { color: var(--text); }

.canvas-panel { grid-area: canvas; display: flex; flex-direction: column; }
.inspector { grid-area: inspector; overflow: auto; padding: var(--space-sm) var(--space-md); }
.dock { grid-area: dock; padding-bottom: var(--space-sm); position: relative; display: flex; flex-direction: column; }
.dock > .panel-head { flex: 0 0 auto; }
.dock.folded { height: auto !important; }
.dock.folded > :not(.panel-head):not(.dock-splitter) { display: none; }
.dock.folded > .panel-head { margin-bottom: 0; }
/* The dock's top edge, standing in for the gap above it (Huemetry's
   DockSplitter): the whole gap takes the drag, a short pill shows where. */
.dock-splitter {
  position: absolute; left: 0; right: 0; top: calc(-1 * var(--space-sm) - 5px); height: 18px; z-index: 2;
  cursor: row-resize; touch-action: none; display: flex; align-items: center; justify-content: center; outline: none;
}
.dock-splitter::before { content: ''; width: 48px; height: 4px; border-radius: var(--radius-pill); background: var(--border); transition: background .12s, width .12s; }
.dock-splitter:hover::before, .dock-splitter.dragging::before, .dock-splitter:focus-visible::before { width: 96px; background: var(--text-label); }

/* ---------- controls ---------- */
.btn {
  height: var(--size-control-md); padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(180deg, var(--pill-grad-from), var(--pill-grad-to)) padding-box,
              linear-gradient(90deg, var(--border-strong) 0%, var(--pill-border-mid) 33%, var(--pill-border-mid) 67%, var(--border-strong) 100%) border-box;
  border: 1px solid transparent; color: var(--text);
  border-radius: var(--radius-md); corner-shape: var(--corner); box-shadow: var(--shadow); cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(0.94); }
.btn:active { box-shadow: var(--shadow-pressed); }
.btn.primary { background: var(--text); color: var(--bg-elev); border-color: var(--text); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { color: var(--text); background: var(--bg-input); }

/* Segmented control, Huemetry's: a flat track; the chosen option is the
   glossy pill (gradient fill, gradient border, shadow). Every option carries
   the transparent 1px border and the chosen one a hair of stroke instead of a
   heavier weight, so no word moves when the choice changes. */
.seg { display: inline-flex; align-items: center; gap: 2px; height: var(--size-control-md); padding: 3px; background: var(--bg-input); border-radius: var(--radius-md); corner-shape: var(--corner); }
.seg button {
  display: inline-flex; align-items: center; justify-content: center; height: 100%; padding: 0 10px;
  border: 1px solid transparent; background: transparent; color: var(--text-faint);
  border-radius: var(--radius-sm); corner-shape: var(--corner); cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s, filter .15s;
}
.seg button:hover { color: var(--text-dim); }
.seg button.on {
  color: var(--text); -webkit-text-stroke: 0.3px currentColor;
  background: linear-gradient(180deg, var(--pill-grad-from), var(--pill-grad-to)) padding-box,
              linear-gradient(90deg, var(--border-strong) 0%, var(--pill-border-mid) 33%, var(--pill-border-mid) 67%, var(--border-strong) 100%) border-box;
  box-shadow: var(--shadow);
}
.seg button.on:hover { filter: brightness(0.94); }
.seg.sm { height: var(--size-control-sm); padding: 2px; border-radius: var(--radius-sm); }
.seg.sm button { padding: 0 8px; font-size: 12px; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; padding: 0 4px; }
/* In a track that is itself --bg-input, the track goes a step deeper. */
.field .seg, .window .seg { background: var(--bg-track); }

/* Small buttons and icon toggles (Huemetry's .btn.sm / .icon / .toggle):
   off is muted, on is pressed in. Neutral, never the accent. */
.btn.sm { height: var(--size-control-sm); padding: 0 8px; font-size: 12px; border-radius: var(--radius-sm); }
.btn.icon { width: var(--size-control-md); min-width: var(--size-control-md); padding: 0; }
.btn.sm.icon { width: var(--size-control-sm); min-width: var(--size-control-sm); }
.toggle:not(.on) { color: var(--text-dim); }
.btn.toggle.on {
  color: var(--text); box-shadow: var(--shadow-pressed);
  background: linear-gradient(var(--toggle-on-fill), var(--toggle-on-fill)) padding-box,
              linear-gradient(90deg, var(--border-strong) 0%, var(--pill-border-mid) 33%, var(--pill-border-mid) 67%, var(--border-strong) 100%) border-box;
}
.tool-group { display: flex; align-items: center; gap: 2px; padding: 2px; background: var(--bg-input); border-radius: var(--radius-md); corner-shape: var(--corner); }
.tool-group .field.sm { margin-left: 4px; background: var(--bg-elev); }

.sec { padding: var(--space-md) var(--space-xs); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--space-sm); }
.sec:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lbl { color: var(--text-dim); font-size: 12px; }
.muted, .hint { color: var(--text-dim); font-size: 12px; margin: 0; }
.hint { color: var(--text-label); }

/* A field: label inside the input's track, unit at the end (Huemetry's value fields). */
.field {
  display: flex; align-items: center; gap: 6px; height: var(--size-control-md); padding: 0 10px; min-width: 0;
  background: var(--bg-input); border: 1px solid transparent; border-radius: var(--radius-md); corner-shape: var(--corner);
}
.field:focus-within { border-color: var(--border-strong); }
.field > span { color: var(--text-label); font-size: 12px; white-space: nowrap; }
.field > em { color: var(--text-label); font-style: normal; font-size: 12px; }
.field input { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; text-align: right; font-variant-numeric: tabular-nums; }
.field input[type=text]:not(.num) { text-align: left; }
.field.sm { height: var(--size-control-sm); padding: 0 8px; border-radius: var(--radius-sm); }
.field.sm input { width: 3.5ch; flex: none; }
#camZoomField { margin-left: 6px; background: var(--bg-elev); }
#camZoomField input { width: 6ch; }
#camZoomField.off { opacity: 0.4; }
/* The label you drag (Huemetry's .k.scrubbable): a dotted underline says so
   standing still; text-decoration rather than a border, so nothing shifts. */
.scrub { cursor: ew-resize; text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-color: var(--border-strong); user-select: none; transition: color .15s, text-decoration-color .15s; }
.scrub:hover, .scrub.scrubbing { color: var(--text); text-decoration-color: var(--text); }
input.scrub-num:not(:focus):not(:disabled) { cursor: ew-resize; }
body.scrubbing, body.scrubbing * { cursor: ew-resize !important; user-select: none; }
/* Drag lock (S33): during a drag only its source takes the mouse. */
body.drag-lock { cursor: var(--drag-cursor, default); user-select: none; }
body.drag-lock * { pointer-events: none !important; }
body.drag-lock .drag-src { pointer-events: auto !important; }
.field:has(.scrub.scrubbing) input, .tl-row:has(.scrub.scrubbing) input { color: var(--text); }
.field.grow, .btn.grow { flex: 1; }
.field.color input { height: 20px; padding: 0; flex: 0 0 36px; cursor: pointer; border-radius: 4px; }
.field.color input::-webkit-color-swatch-wrapper { padding: 0; }
.field.color input::-webkit-color-swatch { border: 1px solid var(--border-strong); border-radius: 4px; }

.check { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 12px; cursor: pointer; }
.check input { accent-color: var(--text); }

.stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.stats .k { color: var(--text-label); }
.stats .ok { color: var(--good); }
.stats .bad { color: var(--bad); }
.canvas-panel { position: relative; }
/* Info card (S33): the stats over the bottom-left of the views. */
.stats-card {
  position: absolute; z-index: 3; left: calc(var(--space-md) + 8px); bottom: calc(var(--space-md) + 18px + var(--space-sm) + 8px);
  padding: 8px 10px; pointer-events: none; max-width: calc(100% - 2 * var(--space-md) - 16px);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-md); corner-shape: var(--corner); box-shadow: var(--shadow-float);
}

/* Project name: reads as the panel title, edits in place. */
.doc-name {
  field-sizing: content; min-width: 6ch; max-width: 40ch; height: var(--size-control-sm); padding: 0 6px; margin-left: -6px;
  border: 1px solid transparent; outline: 0; background: transparent; border-radius: var(--radius-sm); corner-shape: var(--corner);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-label); cursor: text;
  text-overflow: ellipsis;
}
.doc-name:hover { background: var(--bg-input); color: var(--text-dim); }
.doc-name:focus { background: var(--bg-input); border-color: var(--border-strong); color: var(--text); text-transform: none; letter-spacing: 0; }

/* Tools (S40): a floating bar at the foot of the views, as Figma's. */
.toolbar {
  position: absolute; z-index: 4; left: 50%; bottom: calc(var(--space-md) + 10px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 4px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); corner-shape: var(--corner); box-shadow: var(--shadow-float);
}
.tb-split { display: flex; align-items: center; }
.tb-more {
  width: 14px; height: var(--size-control-md); padding: 0; margin-left: -2px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--text-label); border-radius: var(--radius-sm); cursor: pointer;
}
.tb-more svg { width: 12px; height: 12px; }
.tb-more:hover, .tb-more.on { color: var(--text); background: var(--bg-input); }
.tb-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--border); }
.tb-actions {
  height: var(--size-control-md); padding: 0 10px 0 8px; display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--text); border-radius: var(--radius-sm); corner-shape: var(--corner); cursor: pointer; font-size: 12px;
}
.tb-actions svg { width: 16px; height: 16px; color: var(--text-dim); }
.tb-actions:hover, .tb-actions.on { background: var(--bg-input); }

/* Menu rows with a line under the name (main menu, brush, Actions; S40). */
.menu .mi, .flyout .mi { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; flex: 1; min-width: 0; text-align: left; }
.menu .mi small, .flyout .mi small { font-size: 11px; color: var(--text-label); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.menu button:has(.mi) { height: auto; padding: 6px 8px; }
.menu button svg, .flyout .op svg { width: 16px; height: 16px; flex: none; color: var(--text-dim); }
.menu button.on { background: var(--toggle-on-fill); }
.menu kbd { font: inherit; font-size: 11px; color: var(--text-label); margin-left: 12px; }
.main-menu { width: 280px; }
#brushMenu { width: 230px; }

/* Actions (S33, S40): a list by kind; a row with … opens its page with Apply. */
.flyout.ops { width: 270px; padding: 4px; gap: 0; }
.ops-page { display: flex; flex-direction: column; gap: 2px; }
.ops-page:not([data-page="list"]) { gap: var(--space-sm); padding: 4px 8px 8px; }
.flyout .menu-label { padding: 8px 8px 2px; font-size: 11px; color: var(--text-label); text-transform: uppercase; letter-spacing: .6px; }
.flyout .op { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.flyout .op:hover { background: var(--bg-input); }
.flyout .op .go svg { width: 14px; height: 14px; color: var(--text-label); }
.ops-page > .hint { padding: 6px 8px 4px; }
.ops-page:not([data-page="list"]) > .hint { padding: 0; }
.ops-head { display: flex; align-items: center; gap: 4px; margin: 0 -4px; }
.flyout .ops-head h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
.ops-page .btn.primary { width: 100%; }

/* Inspector sections (S40): the title folds them, as Huemetry's InspectorSection. */
.sec-toggle { all: unset; display: inline-flex; align-items: center; gap: 4px; margin-left: -4px; cursor: pointer; color: inherit; border-radius: 4px; }
.sec-toggle:hover { color: var(--text-dim); }
.sec-toggle:focus-visible { outline: 1px solid var(--border-strong); }
.sec-chev { display: inline-flex; transition: transform .15s; }
.sec-chev svg { width: 14px; height: 14px; }
.sec.folded .sec-chev { transform: rotate(-90deg); }
.sec.folded > :not(h3) { display: none !important; }
.sec.folded { gap: 0; }
.tag { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; padding: 1px 6px; border-radius: var(--radius-pill); background: var(--bg-input); color: var(--text-dim); }
.op-row { grid-template-columns: 1.25fr 1.05fr 0.9fr; gap: 6px; }
.op-row .field { padding: 0 6px 0 8px; gap: 3px; }

/* Path operations menu, opened from the rail. */
.flyout {
  position: fixed; z-index: 30; width: 260px; padding: var(--space-md); display: flex; flex-direction: column; gap: var(--space-sm);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); corner-shape: var(--corner); box-shadow: var(--shadow-float);
}
.flyout h3 { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-label); }
.flyout .row > .btn { flex: 1; }
.flyout .row > .field + .btn { flex: none; }

/* ---------- views ---------- */
.views { flex: 1; min-height: 0; display: grid; gap: var(--space-sm); }
.views.layout-1 { grid-template: 1fr / 1fr; }
.views.layout-2 { grid-template: 1fr / 1fr 1fr; }
.views.layout-4 { grid-template: 1fr 1fr / 1fr 1fr; }
.vp { position: relative; min-width: 0; min-height: 0; background: var(--view-bg); border-radius: var(--radius-lg); corner-shape: var(--corner); overflow: hidden; outline: 1.5px solid transparent; outline-offset: -1.5px; }
.vp.active { outline-color: rgba(255, 255, 255, 0.18); }
.vp canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.vp select, .vp .vpbtn {
  position: absolute; top: 8px; height: var(--size-control-sm); padding: 0 8px; font: inherit; font-size: 12px; color: #d8d8d8;
  background: rgba(40, 40, 40, 0.85); border: 1px solid #3a3a3a; border-radius: var(--radius-sm); corner-shape: var(--corner); cursor: pointer;
}
.vp select { left: 8px; }
.vp .vpbar { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.vp .vpbar .vpbtn { position: static; display: inline-flex; align-items: center; padding: 0 6px; }
.vp .vpbar .vpbtn[hidden] { display: none; }
.status { margin-top: var(--space-sm); padding: 0 var(--space-sm); min-height: 18px; font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.err, .hint.err { color: var(--bad); }
.status:empty { display: none; }

/* ---------- timeline ---------- */
.time { min-width: 92px; font-variant-numeric: tabular-nums; color: var(--text-dim); font-size: 12px; text-align: center; }
.timeline { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 236px 1fr 14px 208px; gap: var(--space-sm); padding: 0 var(--space-xs); }
.timeline.insp-closed { grid-template-columns: 236px 1fr 14px 0; }
.tl-labels { align-self: start; display: grid; grid-template-rows: 22px repeat(4, 30px); }
/* Transport beside the Timeline title, in the panel head */
.dock > .panel-head > h2 { margin-right: 0; }
.tl-transport { display: flex; align-items: center; gap: 2px; margin-right: auto; }
.tl-transport .time { min-width: 0; padding: 0 6px; white-space: nowrap; }
.tl-transport .time b { font-weight: 600; color: var(--text); }
/* Key inspector, on the right as in the Value Editor */
.tl-insp-toggle { align-self: stretch; width: 14px; padding: 0; border: 0; background: transparent; color: var(--text-label); font-size: 14px; cursor: pointer; border-radius: var(--radius-sm); }
.tl-insp-toggle:hover { background: var(--bg-input); color: var(--text); }
.tl-insp { min-height: 0; overflow: auto; font-size: 12px; }
.timeline.insp-closed .tl-insp { display: none; }
.tl-insp-empty { margin: 0; padding: var(--space-sm) 2px; color: var(--text-label); }
.tl-insp-body { display: flex; flex-direction: column; gap: 6px; padding-bottom: var(--space-sm); }
.tl-insp-body[hidden] { display: none; }
.tl-insp-title { color: var(--text-dim); font-weight: 600; padding-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-insp-side { display: flex; flex-direction: column; gap: 4px; }
.tl-insp-head { color: var(--text-label); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.tl-insp .seg.sm { display: flex; width: 100%; }
.tl-insp .seg.sm button { flex: 1; padding: 0 4px; }
.tl-insp .field { padding: 0 6px; gap: 4px; }
.tl-insp .field > span { min-width: 58px; }
.tl-insp .field.sm input { flex: 1; width: 100%; }
.tl-insp .field.sm input:disabled { opacity: 0.5; }
.tl-row { display: grid; grid-template-columns: 24px 24px 1fr 24px 72px 14px; align-items: center; gap: 4px; font-size: 12px; color: var(--text-dim); }
.tl-row input { height: var(--size-control-sm); width: 100%; padding: 0 6px; text-align: right; border: 0; outline: 0; background: var(--bg-input); border-radius: var(--radius-sm); corner-shape: var(--corner); font-variant-numeric: tabular-nums; }
.tl-row em { font-style: normal; color: var(--text-label); }
.tl-row > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tl-row .watch.on { color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.tl-row .key { visibility: hidden; }
.tl-row.animated .key { visibility: visible; }
.tl-row .key.on { color: var(--text); }
.tl-row .vis { visibility: hidden; }
.dock.graph .tl-row .vis { visibility: visible; color: var(--curve); }
.dock.graph .tl-row .vis.off { color: var(--text-faint); }
.dock.graph #tlCanvas { cursor: default; }
#tlCanvas { width: 100%; height: 100%; min-height: 142px; display: block; cursor: ew-resize; }

/* ---------- modal windows ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(0, 0, 0, 0.28); }
.window {
  width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-xl); corner-shape: var(--corner);
  box-shadow: var(--shadow-float); padding: var(--space-md);
}
.window.help { width: min(640px, calc(100vw - 32px)); }
.window table { border-collapse: collapse; font-size: 12px; margin: 0 var(--space-sm) var(--space-sm); }
.window td { padding: 5px 10px 5px 0; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.window td:first-child { color: var(--text); white-space: nowrap; }
.proj-body { display: grid; grid-template-columns: 340px 1fr; gap: var(--space-md); min-height: 0; overflow: auto; }
.proj-form .sec { padding-top: var(--space-sm); }
.proj-stage { display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; }
#refStage { width: 100%; aspect-ratio: 16 / 10; background: var(--view-bg); border-radius: var(--radius-lg); corner-shape: var(--corner); cursor: move; display: block; }
.window.video { width: min(440px, calc(100vw - 32px)); }
.vid-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.vid-row .seg button:disabled { opacity: 0.4; cursor: default; }
.vid-progress { height: 4px; border-radius: 2px; background: var(--bg-track); overflow: hidden; }
.vid-progress > div { height: 100%; width: 0; background: var(--text); }
.proj-foot { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-md) var(--space-sm) var(--space-xs); border-top: 1px solid var(--border); margin-top: var(--space-sm); }

/* ---------- tip ---------- */
.tip {
  position: fixed; z-index: 40; max-width: 280px; padding: 8px 10px; pointer-events: none; font-size: 12px;
  background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-md); corner-shape: var(--corner);
  box-shadow: var(--shadow-float);
}
.tip b { display: block; font-weight: 600; }
.tip span { display: block; color: var(--text-dim); margin-top: 2px; }
.tip kbd { display: inline-block; margin-top: 4px; font: inherit; font-size: 11px; color: var(--text-dim); background: var(--bg-input); padding: 1px 6px; border-radius: 4px; }

@media (max-width: 1000px) {
  .dock-splitter { display: none; }
  .shell { grid-template-columns: 1fr; grid-template-rows: minmax(420px, 1fr) auto auto; grid-template-areas: 'canvas' 'dock' 'inspector'; overflow: auto; }
}

/* ---------- effects (S34) ----------
   Huemetry's effect cards: a row per effect (icon, name over a summary,
   a clock when it moves, eye and menu on hover); open, its numbers, its
   Mask and its Motion. */
#fxSec h3 .btn { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text-dim); gap: 4px; }
.fx-clock { display: flex; align-items: center; gap: 2px; }
.fx-clock .field.sm input { width: 4ch; }
.fx-time { margin-left: 6px; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.fx-list { display: flex; flex-direction: column; gap: 4px; }
.fx-list:empty { display: none; }
.fx-card { border-radius: var(--radius-md); corner-shape: var(--corner); background: transparent; transition: background .15s; }
.fx-card.open, .fx-card:hover { background: var(--bg-input); }
.fx-card.off .fx-name, .fx-card.off .fx-ico { opacity: .4; }
.fx-head { display: flex; align-items: center; gap: 4px; min-height: 40px; padding: 4px 4px 4px 2px; cursor: pointer; user-select: none; }
.fx-head .fx-chev { color: var(--text-label); display: inline-flex; }
.fx-ico { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--bg-elev); color: var(--text-dim); flex: none; }
.fx-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.fx-name b { font-weight: 500; font-size: 13px; }
.fx-name small { color: var(--text-label); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-timer { color: var(--text-dim); display: inline-flex; }
.fx-head .fx-hover { display: none; }
.fx-card:hover .fx-hover, .fx-card.off .fx-eye { display: inline-flex; }
.fx-body { padding: 2px 8px 10px; display: flex; flex-direction: column; gap: var(--space-sm); }
.fx-body .field { background: var(--bg-elev); }
.fx-body .seg { background: var(--bg-elev); }
.fx-sub { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-label); }
.fx-sub .spacer { flex: 1; }
.fx-mrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px; align-items: center; }
.fx-mrow .fx-mname { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-mrow > .grid2, .fx-mrow > .seg { grid-column: 1 / -1; }
.fx-nums { display: grid; grid-template-columns: 1fr; gap: 4px; }
.fx-mrow + .fx-mrow { border-top: 1px solid var(--border); padding-top: 6px; }
.fx-body .field.sm input { width: 100%; flex: 1; }
.fx-body .grid2 { gap: 4px; }

/* A small menu beside its button (effect kinds, a card's actions, Motion's values). */
.menu {
  position: fixed; z-index: 40; min-width: 160px; padding: 4px; display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-md); corner-shape: var(--corner); box-shadow: var(--shadow-float);
}
.menu button { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--text); }
.menu button:hover { background: var(--bg-input); }
.menu button:disabled { opacity: .4; cursor: default; background: transparent; }
.menu button.danger { color: var(--bad); }
.menu hr { margin: 4px 0; width: 100%; }
.menu .menu-label { padding: 4px 8px 2px; font-size: 11px; color: var(--text-label); text-transform: uppercase; letter-spacing: .6px; }

/* CSS gradient preview (S36): the colours the tube uses, mixed in OKLCH. */
.grad-head { display: flex; align-items: center; gap: var(--space-sm); }
.grad-strip { flex: 1; height: 20px; border-radius: 4px; border: 1px solid var(--border-strong); }
