:root {
  --bg: #16181c;
  --bg-2: #1d2026;
  --bg-3: #262a31;
  --bg-4: #30353e;
  --line: #2e333b;
  --text: #e6e8ec;
  --text-2: #a3a9b4;
  --text-3: #6f7682;
  --accent: #ff8a3d;
  --accent-2: #ffb380;
  --accent-bg: rgba(255, 138, 61, 0.14);
  --danger: #ff5c5c;
  --radius: 8px;
  --panel-w: 300px;
  --tool-w: 52px;
  --top-h: 46px;
  --status-h: 26px;
  --tl-h: 178px;
  --tl-bar-h: 40px;
  --menu-h: 30px;
  --d2: 0px;        /* second panel column (empty = no width) */
  --panel2-w: 300px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font: 13px/1.35 system-ui, -apple-system, "Segoe UI", "Rubik", "Heebo", Arial, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#app {
  height: 100%;
  display: grid;
  grid-template-columns: var(--tool-w) var(--d2) 1fr var(--panel-w);
  grid-template-rows: var(--menu-h) var(--top-h) minmax(0, 1fr) var(--tl-h) var(--status-h);
  grid-template-areas: "menu menu menu menu" "top top top top" "tools dock2 stage panels" "timeline timeline timeline timeline" "status status status status";
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.panels-hidden #app { grid-template-columns: var(--tool-w) var(--d2) 1fr 0; }
body.panels-hidden #panels { display: none; }

/* ---------- top bar ---------- */
#topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  /* On narrow desktops / tablets (plus the buttons added at runtime) the bar scrolls
     sideways instead of widening the whole grid past the window. */
  min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
#topbar::-webkit-scrollbar { display: none; }
#topbar > * { flex-shrink: 0; }
#topbar > .project-btn, #topbar > .spacer { flex-shrink: 1; }
#topbar > .spacer { min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.brand small { color: var(--text-3); font-weight: 400; }
.logo { width: 18px; height: 18px; border-radius: 5px; background: conic-gradient(from 200deg, var(--accent), #ffd166, #4cc9f0, var(--accent)); }
.group { display: flex; align-items: center; gap: 2px; padding: 2px; background: var(--bg-3); border-radius: var(--radius); }
.spacer { flex: 1; }

.icon-btn, .text-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 6px;
  border: 0; border-radius: 6px; background: transparent; cursor: pointer;
  font-size: 16px;
}
.text-btn { font-size: 12px; color: var(--text-2); min-width: 0; padding: 0 8px; }
.icon-btn:hover, .text-btn:hover { background: var(--bg-4); }
.icon-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
.icon-btn.danger:hover { color: var(--danger); }
#zoom-label { min-width: 52px; font-variant-numeric: tabular-nums; }
#st-rot { min-width: 40px; font-variant-numeric: tabular-nums; }

.toggle { display: flex; align-items: center; gap: 6px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

/* ---------- tool bar ---------- */
#toolbar {
  grid-area: tools;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 0;
  border-inline-end: 1px solid var(--line);
  /* Never spill over the timeline when a tall bottom view (rig, graph, Xsheet) opens:
     stay inside the row, scroll if needed, with shadows showing there is more. */
  min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
  container-type: size; container-name: toolbar;
  background:
    linear-gradient(var(--bg-2) 30%, transparent) top / 100% 24px local no-repeat,
    linear-gradient(transparent, var(--bg-2) 70%) bottom / 100% 24px local no-repeat,
    radial-gradient(farthest-side at 50% 0, rgba(0,0,0,.55), transparent) top / 100% 12px scroll no-repeat,
    radial-gradient(farthest-side at 50% 100%, rgba(0,0,0,.55), transparent) bottom / 100% 12px scroll no-repeat,
    var(--bg-2);
}
#toolbar::-webkit-scrollbar { display: none; }
/* Two columns when one doesn't fit the height (set by src/ui/toolbar.js) */
body.tools-2col { --tool-w: 84px; }
body.tools-2col #toolbar .tool-groups { display: grid; grid-template-columns: repeat(2, 36px); gap: 2px; justify-items: center; }
body.tools-2col #toolbar { flex-direction: row; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 4px 2px; }
body.tools-2col #toolbar .tool-groups { flex-basis: 100%; justify-content: center; }
body.tools-2col #toolbar .tool-sep { width: 70px; flex-basis: 70px; }
#toolbar > *, .tool-groups > * { flex-shrink: 0; }
/* Short on height: smaller buttons and gaps first */
@container toolbar (max-height: 520px) {
  #toolbar .tool { width: 36px; height: 32px; }
  #toolbar .tool svg { width: 18px; height: 18px; }
  #toolbar .tool-groups { gap: 2px; }
  #toolbar .small-tool { height: 26px; }
  #toolbar .tool-sep { margin: 3px 0; }
  #toolbar .tool-color { width: 26px; height: 26px; }
}
.tool {
  width: 40px; height: 40px; border: 0; border-radius: var(--radius);
  background: transparent; cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
}
.tool svg { width: 21px; height: 21px; }
.tool:hover { background: var(--bg-3); color: var(--text); }
.tool.active { background: var(--accent-bg); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(255,138,61,.35); }
.small-tool { width: 34px; height: 30px; }
.small-tool svg { width: 17px; height: 17px; }
.small-tool.on { background: rgba(199,125,255,.15); color: #c77dff; box-shadow: inset 0 0 0 1px rgba(199,125,255,.4); }
.tool-sep { width: 26px; height: 1px; background: var(--line); margin: 6px 0; }
.tool-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--bg-4); box-shadow: 0 0 0 1px #000 inset; }

/* ---------- stage ---------- */
#stage {
  grid-area: stage;
  position: relative; overflow: hidden;
  background: #212329;
  touch-action: none;
  cursor: crosshair;
}
#stage[data-tool="hand"], #stage.space-pan { cursor: grab; }
#stage.space-pan:active, #stage[data-tool="hand"]:active { cursor: grabbing; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* the drawing screen made again after the browser took the GPU away (#view, now invisible, keeps the pen) */
.gpu-view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#stage[data-tool="fill"], #stage[data-tool="picker"] { cursor: cell; }
#stage[data-tool="lasso"] { cursor: crosshair; }
#btn-mirror.on { color: var(--accent); background: var(--accent-bg); }
.tool-options { display: flex; flex-direction: column; gap: 6px; }
.tool-hint { color: var(--text-3); font-size: 12px; line-height: 1.5; }
.tool-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.tool-actions .text-btn { background: var(--bg-3); height: 32px; color: var(--text); }
.tool-actions .text-btn:disabled { opacity: .4; cursor: default; }
#brush-cursor {
  position: absolute; left: 0; top: 0; display: none; pointer-events: none;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6);
  will-change: transform;
}
#brush-cursor.small { border-color: var(--accent); }

/* ---------- panels ---------- */
#panels {
  grid-area: panels;
  display: flex; flex-direction: column;
  min-height: 0; overflow-y: auto; overflow-x: hidden;
  background: var(--bg-2);
  border-inline-start: 1px solid var(--line);
}
.panel { border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.panel.grow { flex: 1; min-height: 220px; }
.panel-head {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px;
  font-weight: 600; font-size: 12px; letter-spacing: .02em;
  color: var(--text-2); cursor: pointer;
  background: var(--bg-2);
  position: sticky; top: 0; z-index: 1;
}
.panel-head > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-head > * { flex-shrink: 0; }
.panel-head > span { flex-shrink: 1; }
.panel-head .text-btn { height: 24px; }
.panel-toggle { width: 20px; height: 20px; border: 0; background: transparent; cursor: pointer; position: relative; }
.panel-toggle::after {
  content: ""; position: absolute; inset: 6px 5px; border: solid var(--text-3); border-width: 0 0 1.6px 1.6px;
  transform: rotate(-45deg) translate(1px, -1px);
}
.panel.collapsed .panel-toggle::after { transform: rotate(45deg); }
.panel.collapsed .panel-body { display: none; }
/* A folded panel keeps its title bar (flex:0 alone shrank it to 0 px, so a panel docked under it
   covered the bar and the folded panel looked gone). */
.panel.collapsed.grow { flex: 0 0 auto; min-height: 0; }
.panel.collapsed { flex-shrink: 0; }
.panel-body { padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.panel.grow .panel-body { flex: 1; }
/* Panel heights (src/ui/dock.js): drag a docked panel's bottom edge; double-click = automatic. */
.panel { position: relative; }
.panel.sized { flex: 0 0 var(--panel-h); height: var(--panel-h); min-height: 0; }
.panel.sized > .panel-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.panel.collapsed.sized, .in-float.sized { flex: 1 1 auto; height: auto; }
.panel.collapsed.sized { flex: 0 0 auto; }
.panel-vsize { position: absolute; left: 0; right: 0; bottom: -4px; height: 8px; z-index: 3; cursor: row-resize; touch-action: none; }
.panel-vsize::after { content: ''; position: absolute; left: 0; right: 0; top: 3px; height: 2px; background: transparent; transition: background .15s; }
.panel-vsize:hover::after, .panel-vsize.active::after, .panel-vsize:focus-visible::after { background: var(--accent); }
.panel.collapsed > .panel-vsize, .in-float > .panel-vsize, .popout .panel-vsize { display: none; }

/* colour picker */
.color-picker { display: flex; flex-direction: column; gap: 8px; direction: ltr; }
.cp-sv { position: relative; height: 140px; border-radius: 6px; overflow: hidden; touch-action: none; cursor: crosshair; }
.cp-sv canvas, .cp-hue canvas { width: 100%; height: 100%; display: block; }
.cp-knob {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none;
}
.cp-hue { position: relative; height: 14px; border-radius: 7px; overflow: hidden; touch-action: none; cursor: ew-resize; }
.cp-hknob {
  position: absolute; top: 0; bottom: 0; width: 6px; margin-left: -3px; border-radius: 3px;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none;
}
.cp-row { display: flex; gap: 8px; align-items: center; }
.color-picker { position: relative; }
.cp-m[hidden] { display: none !important; }
.cp-m { display: flex; flex-direction: column; gap: 8px; }
.cp-modebtn { min-width: 30px; height: 26px; font-size: 15px; background: var(--bg-3); border: 1px solid var(--line); }
.cp-modebtn:hover { border-color: var(--accent); }
.cp-menu { position: absolute; inset-inline: 0; z-index: 30; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 28px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 1px; direction: rtl; }
.cp-menu-title { font-size: 11px; color: var(--text-3); padding: 2px 8px 4px; }
.cp-menu button { height: 28px; padding: 0 10px; border: 0; border-radius: 5px; background: none; color: var(--text-2); text-align: start; cursor: pointer; font-size: 12.5px; }
.cp-menu button:hover, .cp-menu button:focus-visible { background: var(--bg-3); color: var(--text); outline: none; }
.cp-menu button.on { color: var(--accent-2); background: var(--accent-bg); }
.cp-disc, .cp-wheel { position: relative; width: min(100%, 240px); aspect-ratio: 1; margin: 0 auto; touch-action: none; cursor: crosshair; }
.cp-disc canvas, .cp-wheel canvas { width: 100%; height: 100%; display: block; }
.cp-dk, .cp-mark { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4); pointer-events: none; }
.cp-dk-sv { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
.cp-mark { width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.cp-mark.main { width: 22px; height: 22px; margin: -11px 0 0 -11px; border-width: 3px; }
.cp-hhead { display: flex; justify-content: center; }
.cp-hpick { height: 24px; font-size: 12px; background: var(--bg-3); color: var(--text); direction: rtl; }
.cp-vrow { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); direction: rtl; }
.cp-vrow input, .cp-val input[type=range] { direction: ltr; flex: 1; min-width: 0; height: 12px; border-radius: 6px; -webkit-appearance: none; appearance: none; outline: none; }
.cp-vrow input::-webkit-slider-thumb, .cp-val input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 1px 3px rgba(0,0,0,.4); cursor: pointer; }
.cp-vrow input::-moz-range-thumb, .cp-val input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.cp-vrow input:focus-visible, .cp-val input[type=range]:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.cp-hsw { display: flex; gap: 6px; justify-content: center; }
.cp-hswatch { width: 40px; height: 32px; border: 0; border-radius: 6px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.cp-hswatch.main { box-shadow: 0 0 0 2px var(--accent); cursor: default; }
.cp-hswatch:not(.main):hover { transform: translateY(-2px); }
.cp-hsave { height: 26px; font-size: 11.5px; background: var(--bg-3); direction: rtl; }
.cp-vals { display: flex; flex-direction: column; gap: 6px; }
.cp-val { display: grid; grid-template-columns: 14px minmax(0, 1fr) 46px 12px; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.cp-val input[type=number] { width: 46px; height: 22px; padding: 0 4px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 12px; -webkit-user-select: text; user-select: text; }
.cp-val small { color: var(--text-3); }
.cp-vsep { height: 1px; background: var(--line); margin: 2px 0; }
.cp-current { width: 30px; height: 26px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.cp-hex {
  flex: 1; height: 26px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 12px ui-monospace, Consolas, monospace; text-transform: uppercase;
  -webkit-user-select: text; user-select: text;
}
.cp-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.cp-swatch { aspect-ratio: 1; border: 0; border-radius: 4px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.cp-swatch:hover { transform: scale(1.12); }
.cp-pal-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text-3); direction: rtl; }
.cp-pal-head .text-btn { height: 24px; font-size: 11px; }
.cp-pal-empty { grid-column: 1 / -1; font-size: 11px; color: var(--text-3); direction: rtl; }

/* brush */
.brush-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.preset {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border: 0; border-radius: 6px; background: var(--bg-3); cursor: pointer;
  font-size: 11px; color: var(--text-2);
}
.preset-icon { font-size: 16px; line-height: 1; }
.preset:hover { background: var(--bg-4); }
.preset.active { background: var(--accent-bg); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(255,138,61,.4); }
/* brush library (category tabs + sample strokes) */
.brush-presets.brush-library { display: flex; flex-direction: column; gap: 6px; }
.brush-cats { display: flex; flex-wrap: wrap; gap: 3px; }
.brush-cat {
  border: 0; border-radius: 999px; padding: 3px 9px; font-size: 11px; cursor: pointer;
  background: var(--bg-3); color: var(--text-2);
}
.brush-cat:hover { background: var(--bg-4); }
.brush-cat.has-current { box-shadow: inset 0 0 0 1px rgba(255,138,61,.35); }
.brush-cat.active { background: var(--accent-bg); color: var(--accent-2); }
.brush-grid { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto; }
.brush-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 0; position: relative;
  border: 0; border-radius: 7px; padding: 4px 8px 2px; background: var(--bg-3); cursor: pointer;
  color: var(--text-2); font-size: 11px; text-align: start;
}
.brush-card:hover { background: var(--bg-4); }
.brush-card.active { background: var(--accent-bg); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(255,138,61,.4); }
.brush-card.locked { opacity: .55; }
.brush-name { display: flex; align-items: center; gap: 6px; }
.brush-name .preset-icon { font-size: 13px; }
.brush-name .pro-tag { margin-inline-start: auto; }
.brush-stroke { display: block; width: 100%; height: 40px; object-fit: contain; pointer-events: none; }
.brush-params { display: flex; flex-direction: column; gap: 2px; }
.param-group {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line);
  color: var(--text-3); font-size: 11px; cursor: pointer;
}
.param-group::before { content: "▾"; font-size: 10px; transition: transform .15s; }
.param-group.collapsed::before { transform: rotate(90deg); }
.param.folded { display: none; }
.param { display: grid; grid-template-columns: 82px minmax(0, 1fr) 44px; align-items: center; gap: 8px; min-height: 26px; }
.param input[type="number"] { width: 100%; min-width: 0; }
.param-label { color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.param-value { color: var(--text-3); font-size: 11px; text-align: left; font-variant-numeric: tabular-nums; direction: ltr; }
.param select, .param input[type="number"] {
  grid-column: span 1; height: 26px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); padding: 0 6px; font: inherit;
}
.param select { grid-column: 2 / span 2; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 22px; margin: 0; }

/* layers */
.layer-actions { display: flex; gap: 2px; }
.layer-actions .icon-btn { flex: 1; }
.layer-list {
  flex: 1; min-height: 80px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg); border-radius: 6px; padding: 3px;
}
.layer {
  display: flex; align-items: center; gap: 2px;
  height: 38px; padding: 0 4px; border-radius: 6px; cursor: pointer;
  background: var(--bg-3);
}
.layer:hover { background: var(--bg-4); }
.layer.active { background: var(--accent-bg); box-shadow: inset 0 0 0 1px rgba(255,138,61,.4); }
.layer.selected:not(.active) { background: rgba(255,138,61,.12); box-shadow: inset 0 0 0 1px rgba(255,138,61,.28); }
.layer-list { position: relative; }
.layer-list.sized { flex: 0 0 var(--list-h); height: var(--list-h); min-height: 0; }
.list-vsize { flex: 0 0 8px; margin: -3px 0; position: relative; cursor: row-resize; touch-action: none; z-index: 2; }
.list-vsize::after { content: ''; position: absolute; left: 30%; right: 30%; top: 3px; height: 2px; border-radius: 1px; background: var(--line); transition: background .15s; }
.list-vsize:hover::after, .list-vsize.active::after, .list-vsize:focus-visible::after { background: var(--accent); left: 0; right: 0; }
.layer-list.reordering .layer { cursor: grabbing; }
.layer.dragging { opacity: .45; }
.layer.drop-into { outline: 2px solid var(--accent-2); outline-offset: -2px; background: rgba(255,138,61,.14); }
.ly-drop { position: absolute; left: 4px; right: 4px; height: 3px; border-radius: 2px; background: var(--accent-2); box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; z-index: 2; }
.layer-actions [data-act="folder"].on { color: var(--accent-2); background: var(--accent-bg); box-shadow: inset 0 0 0 1px rgba(255,138,61,.45); }
.tl-name.selected:not(.active) { background: rgba(255,138,61,.1); }
.layer.hidden .layer-name { color: var(--text-3); }
.layer .icon-btn { min-width: 28px; height: 28px; color: var(--text-3); }
.layer .icon-btn svg { width: 16px; height: 16px; }
.layer .lock.on { color: var(--accent); }
.layer-name { flex: 1; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-z, .layer-op { font-size: 10px; color: var(--text-3); padding: 1px 5px; border-radius: 4px; background: var(--bg); direction: ltr; }
.layer-z { color: #7dd3fc; }
.layer-rename { flex: 1; height: 26px; border-radius: 4px; border: 1px solid var(--accent); background: var(--bg); color: var(--text); font: inherit; padding: 0 6px; -webkit-user-select: text; user-select: text; }
.layer-props { display: flex; flex-direction: column; gap: 2px; }
.layer.readonly .layer-name { color: var(--text-2); }
.layer-owner { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.layer-tag { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--bg); color: #86efac; white-space: nowrap; }
.layer-tag.ro { color: var(--text-3); }
.layer-collab { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 8px; background: var(--bg); }
.layer-collab[hidden] { display: none; }
.lc-line { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.layer-collab .text-btn { background: var(--bg-3); height: 30px; color: var(--accent-2); }
.layer-collab .text-btn:disabled { color: var(--text-3); }
.layer-history { display: flex; flex-direction: column; gap: 4px; }
.lh-title { font-size: 11px; color: var(--text-3); padding-top: 6px; border-top: 1px solid var(--line); }
.lh-list { display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow-y: auto; }
.lh-row { display: flex; align-items: center; gap: 6px; min-height: 26px; font-size: 12px; }
.lh-row.undone .lh-what { text-decoration: line-through; color: var(--text-3); }
.lh-what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-time { font-size: 10px; color: var(--text-3); white-space: nowrap; }
.lh-btn { height: 22px; font-size: 11px; padding: 0 6px; background: var(--bg-3); }
.z-hint { color: #7dd3fc; font-size: 10px; }

/* ---------- timeline ---------- */
body.timeline-collapsed { --tl-h: var(--tl-bar-h); }
body.timeline-collapsed .tl-body { display: none; }
body.timeline-collapsed #tl-collapse svg { transform: rotate(180deg); }
#timeline {
  grid-area: timeline;
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}
.tl-bar {
  display: flex; align-items: center; gap: 8px;
  height: var(--tl-bar-h); flex: none; padding: 0 8px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  white-space: nowrap;
}
.tl-bar::-webkit-scrollbar { display: none; }
/* Never squeeze a button so its label runs into the next one: the bar scrolls sideways instead */
.tl-bar > * { flex-shrink: 0; }
.tl-bar > .spacer { flex-shrink: 1; min-width: 0; }
.tl-bar { scroll-behavior: smooth; }
.tl-bar .icon-btn { min-width: 30px; height: 30px; font-size: 18px; }
.tl-bar svg { width: 16px; height: 16px; }
#tl-play { color: var(--accent); }
#tl-play .i-pause, #tl-play.playing .i-play { display: none; }
#tl-play.playing .i-pause { display: block; }
#tl-play .i-play { fill: currentColor; }
.tl-frame { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.tl-field { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12px; }
.tl-field select, .tl-field input[type="number"] {
  height: 26px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; padding: 0 4px;
}
.tl-field input[type="number"] { width: 58px; }
.tl-field.onion input[type="number"] { width: 40px; }
.tl-field input[type="checkbox"] { accent-color: var(--accent); margin: 0; }
.tl-sep { width: 1px; height: 20px; background: var(--line); flex: none; }
.text-btn.accent { color: var(--accent-2); font-weight: 600; }
.range-btn { font-size: 15px; min-width: 28px; }
.range-btn.on { color: #7dd3fc; background: rgba(125,211,252,.12); }
.tl-onion-wrap { display: flex; align-items: center; gap: 2px; }
.tl-pop {
  position: fixed; z-index: 20; bottom: calc(var(--tl-h) + var(--status-h) + 6px);
  width: 260px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.45); white-space: normal;
}
.tl-pop-title { font-weight: 600; color: var(--text-2); font-size: 12px; }
.tl-pop .param { grid-template-columns: 90px minmax(0, 1fr) 40px; }
.tl-pop input[type="number"] { height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 0 6px; font: inherit; width: 100%; }
.tl-body { flex: 1; min-height: 0; display: flex; border-top: 1px solid var(--line); }
.tl-names {
  width: 130px; flex: none; overflow: hidden;
  background: var(--bg-2); border-right: 1px solid var(--line);
  direction: rtl;
}
.tl-name-ruler { height: 22px; background: #16181c; }
.tl-name {
  height: 26px; display: flex; align-items: center; padding: 0 10px;
  border-bottom: 1px solid var(--bg-2); background: #20242a;
  color: var(--text-2); font-size: 12px; cursor: pointer;
}
.tl-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-name.active { background: #2a2620; color: var(--accent-2); }
.tl-name.hidden { color: var(--text-3); }
.tl-name-pad { height: 40px; }
.tl-names { position: relative; width: 178px; }
.tl-name { gap: 4px; padding: 0 8px 0 4px; }
.tl-name .tl-nm { flex: 1; min-width: 0; }
.tl-name .tl-row-btns { display: flex; align-items: center; gap: 1px; flex: none; overflow: visible; direction: ltr; }
.tl-rb { width: 18px; height: 18px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--text-3); font: 700 10px/1 system-ui, sans-serif; cursor: pointer; opacity: .55; }
.tl-rb svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tl-rb:hover, .tl-rb:focus-visible { opacity: 1; background: rgba(255,255,255,.08); color: var(--text); outline: none; }
.tl-rb.on { opacity: 1; color: var(--accent-2); }
.tl-rb.solo { background: #c9a227; color: #1a1408; }
.tl-rb.off { opacity: 1; color: #ff8f8f; }
.tl-rb-gap { width: 18px; }
.tl-name.muted .tl-nm { opacity: .4; }
.tl-name.in-folder { padding-inline-start: 18px; box-shadow: inset -3px 0 0 rgba(139,149,165,.35); }
.tl-name.folder { background: #252a32; font-weight: 600; }
.tl-name.drop-into { outline: 2px solid var(--accent-2); outline-offset: -2px; background: rgba(255,138,61,.14); }
.tl-name small { color: var(--text-3); font-weight: 400; }
.tl-fold { width: 16px; height: 18px; padding: 0; border: 0; background: none; color: var(--text-2); cursor: pointer; font-size: 11px; }
.tl-fold:hover { color: var(--text); }
.layer.in-folder { margin-inline-start: 16px; border-inline-start: 2px solid rgba(139,149,165,.35); }
.layer.folder-row { background: #252a32; }
.layer.folder-row .folder-meta { margin-inline-start: auto; color: var(--text-3); font-size: 11px; }
/* Pre-production: the storyboard's layers only – no folders, merging, Z depth or masks. */
body[data-workspace="preproduction"] #panel-layers .layer-props .param:has([data-k="z"]) { display: none !important; }
body[data-workspace="preproduction"] :is(#panel-layers [data-act="folder"], #panel-layers [data-act="merge"], #panel-layers [data-act="video"], .layer-mask) { display: none !important; }
.tl-name.locked .tl-nm::after { content: ''; }
.tl-name[data-layer] { cursor: grab; touch-action: none; user-select: none; }
.tl-names.reordering, .tl-names.reordering .tl-name { cursor: grabbing; }
.tl-name.dragging { opacity: .45; outline: 1px dashed var(--accent-2); outline-offset: -2px; }
.tl-menu {
  position: fixed; z-index: 1000; min-width: 250px; padding: 5px; direction: rtl;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,.5); display: flex; flex-direction: column; font-size: 13px;
}
.tl-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%;
  padding: 6px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer;
}
.tl-menu button:hover:not([disabled]), .tl-menu button:focus-visible { background: rgba(255,138,61,.16); outline: none; }
.tl-menu button[disabled] { opacity: .4; cursor: default; }
.tl-menu button.danger { color: #ff8f8f; }
.tl-menu-k { color: var(--text-3); font-size: 11px; direction: ltr; white-space: nowrap; }
.tl-menu-head { padding: 4px 10px 6px; color: var(--accent-2); font-size: 12px; font-weight: 600; }
.tl-menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.tl-menu { max-height: calc(100vh - 8px); overflow-y: auto; }
.tl-menu-row { display: flex; align-items: center; gap: 4px; padding: 3px 10px; color: var(--text); }
.tl-menu-row > span { flex: 1; white-space: nowrap; }
.tl-menu-row button { width: auto; padding: 4px 8px; border: 1px solid var(--line); justify-content: center; }
.tl-drop { position: absolute; left: 4px; right: 4px; height: 3px; border-radius: 2px; background: var(--accent-2); box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; z-index: 2; }
.tl-name.tl-sound-name { height: 40px; background: #1b2530; color: #7dd3fc; cursor: pointer; }
.tl-scroll { flex: 1; min-width: 0; overflow: auto; position: relative; touch-action: pan-x pan-y; }
.tl-canvas { position: sticky; left: 0; top: 0; display: block; }
.tl-spacer { pointer-events: none; }

/* ---------- status bar ---------- */
#statusbar {
  grid-area: status;
  display: flex; align-items: center; gap: 14px;
  padding: 0 12px;
  background: var(--bg-2); border-top: 1px solid var(--line);
  color: var(--text-3); font-size: 11px; white-space: nowrap; overflow: hidden;
}
#statusbar .sep { width: 1px; height: 12px; background: var(--line); }
#st-pos { direction: ltr; min-width: 70px; font-variant-numeric: tabular-nums; }
.pressure { display: flex; align-items: center; gap: 6px; }
.pressure-track { width: 70px; height: 5px; border-radius: 3px; background: var(--bg-4); overflow: hidden; }
#st-pressure-bar { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; float: inline-start; }
#st-pressure-val { min-width: 28px; font-variant-numeric: tabular-nums; }

/* ---------- project button & save state ---------- */
.project-btn {
  display: flex; align-items: center; gap: 8px; min-width: 110px; max-width: 300px; flex-shrink: 1;
  height: 34px; padding: 0 10px; border: 0; border-radius: var(--radius);
  background: transparent; cursor: pointer; font-weight: 600;
}
.project-btn:hover { background: var(--bg-3); }
.project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-state { display: flex; align-items: center; gap: 5px; font-weight: 400; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.save-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.save-state[data-state="saved"] .save-dot { background: #4ade80; }
.save-state[data-state="dirty"] .save-dot { background: #fbbf24; }
.save-state[data-state="saving"] .save-dot { background: #fbbf24; animation: pulse 0.8s infinite alternate; }
.save-state[data-state="error"] .save-dot, .save-state[data-state="unavailable"] .save-dot { background: var(--danger); }
.save-state[data-state="error"], .save-state[data-state="unavailable"] { color: var(--danger); }
@keyframes pulse { to { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .save-state[data-state="saving"] .save-dot { animation: none; } }

/* ---------- projects dialog ---------- */
[hidden] { display: none !important; }
.modal {
  /* Above floating panel windows (60), the storyboard reference (70) and tool flyouts (95) */
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(8, 9, 11, 0.6);
}
.modal-card {
  width: min(760px, 100%); max-height: min(720px, 100%);
  display: flex; flex-direction: column; gap: 12px; padding: 16px 18px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.modal.busy .modal-card { opacity: .7; pointer-events: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head .icon-btn { font-size: 22px; }
.pj-current { display: flex; flex-direction: column; gap: 4px; }
.pj-current label { font-size: 12px; color: var(--text-2); }
.pj-current input {
  height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; font-size: 14px;
  -webkit-user-select: text; user-select: text;
}
.pj-current input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.pj-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pj-toolbar .text-btn { background: var(--bg-3); height: 32px; color: var(--text); }
.pj-list { flex: 1; min-height: 120px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); grid-auto-rows: max-content; gap: 10px; align-content: start; }
/* (max-content rows: a card with overflow hidden may otherwise be squeezed to its picture when
   the window is short – its name and buttons disappeared below the usage bar) */
.pj-card { display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; background: var(--bg-3); border: 1px solid transparent; cursor: default; }
.pj-card > * { flex: none; }
.pj-card.current { border-color: rgba(255,138,61,.5); }
.pj-thumb { aspect-ratio: 16 / 9; background: #2a2e35; max-width: 100%; }
.pj-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pj-info { padding: 8px 10px 2px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pj-title { font-weight: 600; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-badge { font-size: 10px; font-weight: 600; color: var(--accent); background: var(--accent-bg); padding: 1px 6px; border-radius: 4px; }
.pj-meta { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pj-actions { display: flex; gap: 4px; padding: 6px 6px 8px; }
.pj-actions .text-btn { height: 28px; }
.danger-text { color: var(--danger) !important; }
.pj-empty, .pj-note { color: var(--text-3); font-size: 12px; margin: 0; }

/* ---------- account & cloud ---------- */
.account-btn { position: relative; }
.cloud-dot { position: absolute; bottom: 5px; inset-inline-end: 5px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--bg-2); background: var(--text-3); }
.cloud-dot[data-state="online"] { background: #4ade80; }
.cloud-dot[data-state="syncing"], .cloud-dot[data-state="starting"] { background: #fbbf24; }
.cloud-dot[data-state="offline"], .cloud-dot[data-state="error"] { background: var(--danger); }
.cloud-dot[data-state="off"] { display: none; }
.acc-card { width: min(420px, 100%); }
.acc-body { display: flex; flex-direction: column; gap: 10px; }
.acc-body p { margin: 0; }
.acc-body code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; direction: ltr; unicode-bidi: embed; }
.acc-form { display: flex; flex-direction: column; gap: 6px; }
.acc-form.busy { opacity: .6; pointer-events: none; }
.acc-form label { font-size: 12px; color: var(--text-2); }
.acc-form input {
  height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; font-size: 14px; text-align: left;
  -webkit-user-select: text; user-select: text;
}
.acc-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.acc-actions { display: flex; gap: 6px; margin-top: 6px; }
.acc-actions .text-btn { background: var(--bg-3); height: 34px; color: var(--text); padding: 0 14px; }
.acc-msg { padding: 8px 10px; border-radius: 8px; background: rgba(74,222,128,.1); color: #86efac; font-size: 13px; }
.acc-msg.err { background: rgba(255,92,92,.1); color: #fca5a5; }
.acc-user { display: flex; align-items: center; gap: 10px; }
.acc-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent); font-weight: 700; font-size: 17px; }
.acc-email { font-weight: 600; }
.acc-status { font-size: 12px; color: var(--text-3); }
.acc-status[data-state="online"] { color: #86efac; }
.acc-status[data-state="error"], .acc-status[data-state="offline"] { color: #fca5a5; }
.pj-where { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--bg); color: var(--text-3); }
.pj-where[data-where="synced"] { color: #86efac; }
.pj-where[data-where="upload"] { color: #fbbf24; }
.pj-where[data-where="download"], .pj-where[data-where="cloud"] { color: #7dd3fc; }

/* ---------- rooms ---------- */
.room-btn { position: relative; }
.room-btn.on { color: var(--accent); background: var(--accent-bg); }
.room-count {
  position: absolute; top: 2px; inset-inline-end: 1px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--accent); color: #1a1208; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}
.room-count[hidden] { display: none; }
.room-card { width: min(460px, 100%); }
.room-card:has(.dash-grid) { width: min(880px, 100%); }
.room-body { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.room-body p { margin: 0; }
.modal.busy .room-body { opacity: .6; pointer-events: none; }
.room-label { font-size: 12px; color: var(--text-2); }
.room-input {
  flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; -webkit-user-select: text; user-select: text;
}
.room-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.room-row { display: flex; gap: 6px; }
.room-row .text-btn, .room-primary { background: var(--bg-3); height: 36px; color: var(--text); padding: 0 14px; }
.room-primary { color: var(--accent-2); }
.room-sep { height: 1px; background: var(--line); margin: 6px 0; }
.room-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.room-live { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.2); }
.room-people { display: flex; flex-direction: column; gap: 4px; background: var(--bg); border-radius: 8px; padding: 6px; }
.room-person { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 6px; border-radius: 6px; background: var(--bg-3); }
.room-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.room-pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-pname small { color: var(--text-3); }
.room-frame { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.room-role, .room-role-txt { font-size: 12px; }
.room-role { height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 12px; }
.room-role-txt { color: var(--text-2); min-width: 54px; text-align: center; }
.room-body code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
#notices { position: fixed; top: calc(var(--top-h) + 10px); inset-inline-end: 12px; z-index: 45; display: flex; flex-direction: column; gap: 8px; max-width: min(320px, calc(100vw - 24px)); }
.notice {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 8px;
}
.notice-text { font-size: 13px; white-space: pre-line; }
.notice-actions { display: flex; gap: 6px; }
.notice-actions .text-btn { background: var(--bg-4); height: 30px; color: var(--text); }

/* ---------- class mode ---------- */
#classbar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100% - 24px); padding: 6px 8px 6px 12px; border-radius: 999px;
  background: rgba(30, 33, 39, .94); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.35);
  font-size: 12px;
}
#classbar[hidden] { display: none; }
#classbar[data-mode="demo"] { border-color: rgba(125,211,252,.6); }
#classbar[data-mode="practice"] { border-color: rgba(74,222,128,.5); }
#classbar[data-mode="critique"] { border-color: rgba(255,92,92,.6); }
.cb-info { color: var(--text); white-space: nowrap; }
.cb-modes { display: flex; gap: 2px; background: var(--bg); border-radius: 999px; padding: 2px; }
.cb-btn { border: 0; background: transparent; color: var(--text-2); height: 26px; padding: 0 10px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 12px; }
.cb-btn:hover { background: var(--bg-4); }
.cb-btn.on { background: var(--accent-bg); color: var(--accent-2); }
.cb-btn.accent { color: #fca5a5; }
.gal-card { width: min(980px, 100%); }
.gal-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.gal-tile { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: var(--bg-3); }
.gal-tile canvas { width: 100%; aspect-ratio: 16 / 9; height: auto; border-radius: 6px; background: #fff; max-width: 100%; }
.gal-info { display: flex; align-items: center; gap: 6px; min-width: 0; }
.gal-name { font-weight: 600; }
.gal-meta { margin-inline-start: auto; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.gal-tile .text-btn { background: var(--bg-4); height: 30px; }

/* ---------- export ---------- */
.ex-card { width: min(520px, 100%); }
.ex-body { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.ex-body p { margin: 0; }
.ex-formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.ex-format { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--bg-3); cursor: pointer; border: 1px solid transparent; }
.ex-format input { position: absolute; opacity: 0; pointer-events: none; }
.ex-format.on { border-color: rgba(255,138,61,.6); background: var(--accent-bg); }
.ex-format:focus-within { outline: 2px solid var(--accent); }
.ex-ft { font-weight: 600; }
.ex-fd { font-size: 11px; color: var(--text-3); }
.ex-picks { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; padding: 6px 8px; background: var(--bg); border-radius: 8px; }
.ex-row { display: flex; flex-direction: column; gap: 4px; }
.ex-progress { height: 6px; border-radius: 3px; background: var(--bg-4); overflow: hidden; }
.ex-progress[hidden] { display: none; }
.ex-bar { height: 100%; width: 0; background: var(--accent); transition: width .1s; }

/* ---------- plans ---------- */
.pro-tag { font-size: 9px; font-weight: 700; padding: 0 4px; border-radius: 3px; background: linear-gradient(90deg, #ff8a3d, #c77dff); color: #160c04; }
.preset.locked, .ex-format.locked { opacity: .55; }
.preset { position: relative; }
.preset .pro-tag { position: absolute; top: 3px; inset-inline-start: 3px; }
.tool.locked { opacity: .45; }
.plan-box { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 8px; background: var(--bg); }
.plan-now { font-weight: 600; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.plan-table th, .plan-table td { padding: 4px 6px; text-align: start; border-bottom: 1px solid var(--line); }
.plan-table th { color: var(--text-2); font-weight: 600; }
.plan-test { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.plan-test select { height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-3); color: var(--text); font: inherit; font-size: 12px; }
.room-btn.offline { color: var(--danger); }

/* ---------- effects & camera ---------- */
.layer-fx { display: flex; flex-direction: column; gap: 6px; }
.fx-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text-3); padding-top: 6px; border-top: 1px solid var(--line); }
.fx-add { height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 12px; }
.fx-item { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 8px; background: var(--bg); }
.fx-item.off { opacity: .55; }
.fx-title { display: flex; align-items: center; justify-content: space-between; }
.fx-title .text-btn { height: 22px; min-width: 22px; font-size: 15px; }
.param input[type="color"] { width: 100%; height: 24px; border: 0; padding: 0; background: transparent; }
.cam-row { display: flex; gap: 6px; }
.cam-row .text-btn { background: var(--bg-4); height: 28px; color: var(--text); flex: 1; }
#tl-camera-btn.on { color: #7dd3fc; background: rgba(125,211,252,.12); }

/* ---------- workspaces & movable panels ---------- */
body.ws-simple .adv { display: none !important; }
/* Simple brush panel: only the six basic sliders (no pressure / shape groups). */
body.ws-simple .brush-params .param-group, body.ws-simple .brush-params .param:nth-child(n+7) { display: none; }
body.panels-end #app { grid-template-areas: "menu menu menu menu" "top top top top" "panels stage dock2 tools" "timeline timeline timeline timeline" "status status status status"; grid-template-columns: var(--panel-w) 1fr var(--d2) var(--tool-w); }
body.panels-end.panels-hidden #app { grid-template-columns: 0 1fr var(--d2) var(--tool-w); }
.ws-pick select { height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-3); color: var(--text-2); font: inherit; font-size: 12px; padding: 0 6px; }
.panel-grip { display: inline-flex; width: 18px; height: 20px; align-items: center; justify-content: center; color: var(--text-3); cursor: grab; touch-action: none; }
.panel-grip svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.panel.dragging { outline: 2px solid var(--accent); outline-offset: -2px; opacity: .9; }

.my-brush { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.my-brush .room-input { height: 30px; font-size: 12px; }
.my-brush .text-btn { background: var(--bg-3); height: 30px; color: var(--text); }
.shape-kinds { grid-template-columns: repeat(3, 1fr); }
.sh-fillc { display: flex; align-items: center; gap: 6px; }

/* ---------- masks ---------- */
.layer-mask { display: flex; flex-direction: column; gap: 4px; }
.layer-mask .mk-row { grid-template-columns: 90px minmax(0, 1fr); }
.layer-mask select { height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 12px; min-width: 0; }
.layer-clip { color: #7dd3fc; font-size: 13px; padding-inline-start: 2px; }
.layer-tag.mask { color: #7dd3fc; }

/* ---------- overlays ---------- */
#toast {
  position: fixed; left: 50%; bottom: 48px; transform: translate(-50%, 12px);
  padding: 8px 14px; border-radius: 999px;
  background: rgba(30, 33, 39, .95); border: 1px solid var(--line); color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
  z-index: 1100; /* above dialogs and floating windows; it never takes clicks */
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#fatal {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--bg); color: var(--danger); font-size: 16px; text-align: center;
}
#fatal[hidden] { display: none; }

/* ---------- touch / narrow layouts ---------- */
@media (pointer: coarse) {
  .icon-btn, .text-btn { height: 38px; min-width: 38px; }
  .tool { width: 46px; height: 46px; }
  :root { --tool-w: 58px; --top-h: 52px; }
  .param { min-height: 32px; }
  input[type="range"] { height: 30px; }
}
@media (max-height: 640px) {
  :root { --tl-h: 132px; }
}
@media (max-width: 900px) {
  :root { --panel-w: 260px; }
  .save-text, .toggle span { display: none; }
  .project-btn { max-width: 180px; }
}
@media (max-width: 640px) {
  .brand { display: none; }
  body:not(.panels-hidden) #app { grid-template-columns: var(--tool-w) 0 1fr 0; }
  #panels2 { display: none !important; }
  body:not(.panels-hidden) #panels { display: none; }
  body.panels-hidden #app { grid-template-columns: var(--tool-w) 0 0 1fr; }
  body.panels-hidden #panels { display: flex; }
}

/* free transform modes */
.seg { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--bg-3); }
.seg-btn { flex: 1; border: 0; border-radius: 6px; padding: 5px 4px; font-size: 11px; background: transparent; color: var(--text-2); cursor: pointer; }
.seg-btn:hover { background: var(--bg-4); }
.seg-btn.active { background: var(--accent-bg); color: var(--accent-2); }
.warp-presets { display: flex; flex-wrap: wrap; gap: 4px; }

/* participant layer folders (rooms) */
.layer-folder {
  display: flex; align-items: center; gap: 4px; padding: 3px 4px; margin-top: 4px;
  border-radius: 6px; background: var(--bg-3); font-size: 12px; color: var(--text);
}
.layer-folder.mine { box-shadow: inset 0 0 0 1px rgba(255,138,61,.3); }
.layer-folder.hidden .folder-name { opacity: .5; text-decoration: line-through; }
.layer-folder .fold { width: 20px; font-size: 11px; }
.folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.folder-meta { font-size: 10px; color: var(--text-3); }
.layer-folder .add { font-size: 16px; line-height: 1; }
.folder-body { padding-inline-start: 10px; border-inline-start: 2px solid var(--bg-3); margin-inline-start: 8px; }

/* recent colours + palettes */
.recent-colors { display: flex; gap: 3px; flex-wrap: wrap; min-height: 16px; }
.recent-colors button { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(255,255,255,.15); cursor: pointer; padding: 0; }
.pal-label { font-size: 10px; color: var(--text-3); letter-spacing: .03em; }
.pal-bar { display: flex; gap: 4px; align-items: center; }
.pal-bar select { flex: 1; min-width: 0; }
.pal-bar .icon-btn { font-size: 13px; }

/* live brush preview (Brush Studio drawing pad) */
.brush-live { position: relative; border-radius: 8px; background: var(--bg-3); margin-bottom: 4px; }
.brush-live img { display: block; width: 100%; height: 72px; object-fit: contain; }
.brush-live-label { position: absolute; top: 4px; inset-inline-start: 8px; font-size: 10px; color: var(--text-3); letter-spacing: .03em; }
.tip-upload { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tip-upload img { width: 32px; height: 32px; border-radius: 4px; background: #fff; }

/* graph editor (layer keyframes) */
.graph-editor { display: flex; gap: 8px; height: 230px; padding: 6px 8px; border-top: 1px solid var(--bg-3); background: var(--bg); }
.ge-side { width: 250px; flex: none; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.ge-title { font-size: 12px; font-weight: 600; color: var(--text); }
.ge-prop { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 6px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.ge-prop.active { background: var(--accent-bg); color: var(--accent-2); }
.ge-prop input { width: 70px; }
.ge-name { flex: 1; }
.ge-unit { width: 18px; font-size: 10px; color: var(--text-3); }
.ge-key { border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 12px; padding: 0 2px; }
.ge-key.has { color: #b39a55; }
.ge-key.on { color: #ffd166; }
.ge-ease { display: flex; flex-wrap: wrap; gap: 3px; }
.ge-ease .text-btn { font-size: 11px; padding: 2px 6px; }
.ge-pivot { display: flex; align-items: center; gap: 4px; }
.ge-pivot input { width: 58px; }
.ge-parent { display: flex; align-items: center; gap: 6px; }
.ge-parent select { flex: 1; min-width: 0; }
.ge-path-row { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .85; }
.ge-plot { position: relative; flex: 1; min-width: 0; }
.ge-plot canvas { width: 100%; height: 100%; display: block; border-radius: 6px; cursor: crosshair; touch-action: none; }
.ge-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--text-3); pointer-events: none; }
#tl-graph-btn.on { background: var(--accent-bg); color: var(--accent-2); }
body.graph-open { --tl-h: 400px; }
body.graph-open .graph-editor { flex: none; }

/* ---------- accessibility ---------- */
:root { --ui-scale: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#view:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Interface size: the chrome zooms, the drawing area keeps its own zoom */
body.a11y-scaled #app {
  grid-template-columns: calc(var(--tool-w) * var(--ui-scale)) calc(var(--d2) * var(--ui-scale)) 1fr calc(var(--panel-w) * var(--ui-scale));
  grid-template-rows: calc(var(--menu-h) * var(--ui-scale)) calc(var(--top-h) * var(--ui-scale)) minmax(0, 1fr) calc(var(--tl-h) * var(--ui-scale)) calc(var(--status-h) * var(--ui-scale));
}
body.a11y-scaled.panels-end #app { grid-template-columns: calc(var(--panel-w) * var(--ui-scale)) 1fr calc(var(--d2) * var(--ui-scale)) calc(var(--tool-w) * var(--ui-scale)); }
body.a11y-scaled.panels-hidden #app { grid-template-columns: calc(var(--tool-w) * var(--ui-scale)) calc(var(--d2) * var(--ui-scale)) 1fr 0; }
body.a11y-scaled :is(#menubar, #topbar, #toolbar, #panels, #panels2, #timeline, #statusbar, .modal-card, #toast, #notices) { zoom: var(--ui-scale); }
/* High contrast */
body.a11y-contrast {
  --bg: #000; --bg-2: #0b0b0d; --bg-3: #1a1a1f; --bg-4: #2b2b33; --line: #8a8f99;
  --text: #fff; --text-2: #f0f0f0; --text-3: #c9cdd4; --accent: #ffa463; --accent-2: #ffd0a8; --accent-bg: rgba(255,164,99,.28);
}
body.a11y-contrast .icon-btn, body.a11y-contrast .text-btn, body.a11y-contrast .tool { box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
body.a11y-contrast .tool.active { box-shadow: inset 0 0 0 2px var(--accent); }
/* Strong focus */
body.a11y-focus :focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; box-shadow: 0 0 0 6px rgba(0,0,0,.65); }
/* Reduced motion */
body.a11y-motion *, body.a11y-motion *::before, body.a11y-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
/* Visible brush cursor */
body.a11y-cursor #brush-cursor { border: 2px solid #000 !important; box-shadow: 0 0 0 2px #fff, inset 0 0 0 1px #fff !important; }
.a11y-card { width: min(520px, 100%); }
.a11y-row span { display: flex; flex-direction: column; }
.a11y-row small { color: var(--text-3); font-size: 11px; }
.a11y-row { white-space: normal; align-items: flex-start; padding: 4px 0; }
.a11y-scale { grid-template-columns: 110px minmax(0, 1fr) 50px; }
/* Canvas settings */
.cv-card { width: min(620px, 100%); }
.cv-body { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.cv-set { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.cv-set legend { padding: 0 6px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.cv-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.cv-row > span:first-child { width: 110px; flex: none; color: var(--text-2); }
.cv-row input[type="text"], .cv-row input[type="number"], .cv-row select { height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; padding: 0 8px; }
.cv-row input[type="text"] { flex: 1; min-width: 0; }
.cv-size input { width: 90px; }
.cv-lock.on { color: var(--accent); }
.cv-meta, .cv-hint, .cv-sec { font-size: 12px; color: var(--text-3); }
.cv-warn { font-size: 12px; color: #ffd166; }
/* A picture of the canvas: left is left in every language (the buttons are built left → right) */
.cv-anchor { display: grid; grid-template-columns: repeat(3, 22px); gap: 3px; direction: ltr; }
.cv-ab { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg-3); cursor: pointer; }
.cv-ab.on { background: var(--accent); border-color: var(--accent); }
.cv-preview { padding: 4px; border-radius: 6px; background: var(--bg-3); line-height: 0; }
.cv-preview svg { width: 120px; height: 80px; stroke: none; }
.cv-foot { display: flex; justify-content: flex-start; gap: 8px; flex-direction: row-reverse; }
#st-size { cursor: pointer; text-decoration: underline dotted; }

/* ---------- team bar, chat, reactions, notes ---------- */
#teambar { position: absolute; top: 8px; inset-inline: 8px; z-index: 6; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; pointer-events: none; }
#teambar > * { pointer-events: auto; }
.tb-people, .tb-acts { display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 20px; background: rgba(22,24,28,.88); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.tb-person { display: flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border: 0; border-radius: 14px; background: none; color: var(--text); font-size: 12px; cursor: pointer; }
.tb-person:hover:not(:disabled) { background: var(--bg-3); }
.tb-person:disabled { cursor: default; opacity: .9; }
.tb-person.watched { box-shadow: inset 0 0 0 2px var(--c); }
.tb-person.hand { background: rgba(255,209,102,.15); }
.tb-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.tb-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-btn { position: relative; min-width: 28px; height: 26px; border: 0; border-radius: 13px; background: none; color: var(--text); cursor: pointer; font-size: 14px; }
.tb-btn:hover { background: var(--bg-3); }
.tb-btn.on { background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.tb-emoji { display: flex; }
.tb-e { min-width: 24px; font-size: 13px; }
.tb-badge { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; }
.tb-sep { width: 1px; height: 18px; background: var(--line); }
.tb-follow { font-size: 12px; color: #7dd3fc; padding: 0 6px; }
.tb-hands { font-size: 12px; color: #ffd166; padding: 0 4px; }
#chat { position: absolute; bottom: 10px; inset-inline-end: 10px; z-index: 7; width: min(320px, calc(100% - 20px)); max-height: 60%; display: flex; flex-direction: column; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0,0,0,.5); }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; min-height: 80px; }
.chat-msg { display: flex; flex-direction: column; gap: 1px; padding: 5px 8px; border-radius: 8px; background: var(--bg-3); font-size: 13px; max-width: 92%; align-self: flex-start; user-select: text; }
.chat-msg.mine { align-self: flex-end; background: var(--accent-bg); }
.chat-who { font-size: 11px; font-weight: 700; }
.chat-time { font-size: 10px; color: var(--text-3); align-self: flex-end; }
.chat-text a { color: #7dd3fc; }
.chat-send { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-send select { height: 30px; max-width: 90px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 12px; }
.chat-send textarea { flex: 1; min-width: 0; resize: none; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; padding: 6px; }
.team-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.team-react { position: absolute; font-size: 34px; transform: translate(-50%, -50%); animation: team-float 2.2s ease-out forwards; text-shadow: 0 4px 12px rgba(0,0,0,.4); display: flex; flex-direction: column; align-items: center; animation-duration: 3s; }
.team-react-name { font-size: 12px; font-weight: 600; color: #fff; background: rgba(0,0,0,.65); padding: 1px 7px; border-radius: 9px; white-space: nowrap; text-shadow: none; }
@keyframes team-float { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }
.note-pins { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.note-pin { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; }
.note-dot { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; background: #ff5c5c; color: #fff; font-weight: 800; font-size: 12px; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.4); }
.note-dot { display: grid; place-items: center; }
.note-pin.done .note-dot { background: #4ade80; }
.note-card { position: absolute; top: 30px; inset-inline-start: -10px; width: 240px; padding: 8px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.note-card textarea, .note-rin { width: 100%; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; padding: 6px; resize: vertical; }
.note-meta { font-size: 11px; color: var(--text-3); }
.note-text { white-space: pre-wrap; user-select: text; }
.note-reply { font-size: 12px; color: var(--text-2); border-inline-start: 2px solid var(--line); padding-inline-start: 6px; }
.note-acts { display: flex; flex-wrap: wrap; gap: 4px; }
.room-person.hand { background: rgba(255,209,102,.08); }
.room-watch.on { color: #7dd3fc; }
.lead-kind { margin-bottom: 2px; }
/* ---------- rig ---------- */
body.rig-open { --tl-h: 420px; }
.rig-panel { flex: none; display: grid; grid-template-columns: minmax(170px, 1fr) minmax(220px, 1.3fr) minmax(260px, 1.6fr); gap: 10px; height: 270px; padding: 8px; border-top: 1px solid var(--line); background: var(--bg); overflow: hidden; }
.rg-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; overflow-y: auto; }
.rg-title { font-size: 12px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.rg-nodes { flex: 1; overflow-y: auto; border-radius: 6px; background: var(--bg-2); padding: 4px; }
.rg-node { display: flex; align-items: center; gap: 6px; padding: 3px 6px; padding-inline-start: calc(6px + var(--d) * 16px); border-radius: 5px; font-size: 12px; cursor: pointer; }
.rg-node:hover { background: var(--bg-3); }
.rg-node.on { background: var(--accent-bg); color: var(--accent-2); }
.rg-ico { width: 16px; text-align: center; }
.rg-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.rg-row select, .rg-link select, .rg-link input, .rg-name { height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 12px; min-width: 0; }
.rg-ctrl { padding: 6px; border-radius: 8px; background: var(--bg-2); display: flex; flex-direction: column; gap: 4px; }
.rg-ctrl input[type="range"] { flex: 1; min-width: 80px; }
.rg-name { width: 110px; padding: 0 6px; }
.rg-link { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 11px; }
.rg-link input[type="number"] { width: 58px; }
.rg-draws { display: flex; flex-wrap: wrap; gap: 3px; }
/* Rig panel: layers & bones · properties · smart bones */
.rig-panel { grid-template-columns: minmax(250px, 1.15fr) minmax(280px, 1.2fr) minmax(280px, 1.2fr); height: 300px; gap: 0; padding: 0; }
.rig-panel > .rg-col { padding: 8px 10px; border-inline-end: 1px solid var(--line); }
.rig-panel > .rg-col:last-child { border-inline-end: 0; }
.rg-title { min-height: 26px; position: sticky; top: -8px; z-index: 1; background: var(--bg); margin-top: 2px; }
.rg-tree { display: flex; flex-direction: column; gap: 1px; padding: 4px; border-radius: 8px; background: var(--bg-2); max-height: 150px; overflow-y: auto; flex: none; }
.rg-node { min-height: 26px; border: 1px dashed transparent; }
.rg-node .rg-lname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-node.bl .rg-lname { font-weight: 600; }
.rg-node.drop { border-color: #6ee7a8; background: rgba(110,231,168,.1); }
.rg-badge { flex: none; font-size: 10.5px; padding: 1px 6px; border-radius: 9px; background: var(--bg-3); color: var(--text-3); white-space: nowrap; }
.rg-badge.b-flex, .rg-badge.b-some { background: rgba(125,211,252,.15); color: #7dd3fc; }
.rg-badge.b-bone { background: rgba(110,231,168,.15); color: #6ee7a8; }
.rg-badge.b-none { background: rgba(255,255,255,.06); }
.rg-tool { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 8px; background: var(--bg-2); border-inline-start: 3px solid var(--accent); }
.rg-tool.off { border-inline-start-color: var(--line); }
.rg-tool-top { display: flex; align-items: center; gap: 6px; }
.rg-tool-top b { font-size: 13px; color: var(--accent-2); }
.rg-tool-hint { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.rg-modes { display: flex; flex-wrap: wrap; gap: 3px; }
.rg-mode { height: 22px; padding: 0 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--text-3); font: inherit; font-size: 11px; cursor: pointer; }
.rg-mode:hover { color: var(--text); border-color: var(--text-3); }
.rg-mode.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-2); }
.rg-switch { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); cursor: pointer; padding: 2px 8px; border-radius: 12px; background: var(--bg-3); }
.rg-switch:has(input:checked) { background: rgba(255,209,102,.18); color: #ffd166; }
.rg-cons { border-radius: 8px; background: var(--bg-2); padding: 4px 8px; }
.rg-cons summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 3px 0; }
.rg-cons[open] { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.rg-cons input[type=number], .rg-link input[type=number], .rg-driver input[type=number] { width: 56px; height: 24px; font: inherit; font-size: 12px; padding: 0 4px; border-radius: 5px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.rg-bindrow > span { color: var(--text-2); }
.rg-bindrow select { flex: 1; }
.rg-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.rg-bone.pin .rg-bname { color: var(--text-2); }
.rg-bname small { color: var(--text-3); font-size: 10px; letter-spacing: .05em; }
.rg-links summary { cursor: pointer; font-size: 11.5px; color: var(--text-3); }
.rg-links[open] { display: flex; flex-direction: column; gap: 4px; }
.rg-meter { flex: 1; min-width: 60px; height: 6px; border-radius: 3px; background: var(--bg-3); overflow: hidden; }
.rg-meter i { display: block; height: 100%; background: linear-gradient(90deg, #a78bfa, #f472b6); }
.rg-rec { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(255,77,77,.12); border: 1px solid rgba(255,77,77,.5); font-size: 12px; }
.rg-rec div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rg-rec span { color: var(--text-2); }
.rg-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff4d4d; flex: none; animation: rg-blink 1s steps(2) infinite; }
@keyframes rg-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rg-dot { animation: none; } }
.rg-ctrl.rec { box-shadow: inset 3px 0 0 #ff4d4d, 0 0 0 1px rgba(255,77,77,.5); }
body.rig-recording #stage { box-shadow: inset 0 0 0 3px rgba(255,77,77,.65); }
body.rig-open { --tl-h: 450px; }
.rg-title small { font-weight: 400; color: var(--text-3); }
.rg-spacer { flex: 1; }
.rg-title .text-btn { height: 24px; background: var(--bg-3); }
.rg-title .text-btn.accent { background: var(--accent-bg); color: var(--accent-2); }
.rg-xform { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.rg-xf { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.rg-xf span { flex: 1; white-space: nowrap; }
.rg-xf input { width: 64px; height: 24px; padding: 0 4px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 5px; font: inherit; font-size: 12px; -webkit-user-select: text; user-select: text; }
.rg-xf small { color: var(--text-3); width: 14px; }
#tl-rig-btn.on { background: var(--accent-bg); color: var(--accent-2); }
/* ---------- onion skin ---------- */
.on-pick-row { display: flex; align-items: center; gap: 6px; }
.on-lbl { width: 34px; font-size: 12px; color: var(--text-2); }
.on-cells { display: flex; gap: 2px; direction: ltr; }
.on-cell { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text-2); font-size: 11px; cursor: pointer; padding: 0; }
.on-cell.on { background: var(--accent); color: #1a1208; border-color: var(--accent); font-weight: 700; }
.on-colors { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.on-colors input { width: 30px; height: 22px; border: 0; background: none; padding: 0; }
.tl-pop .seg { display: flex; }
.tl-pop .seg-btn { flex: 1; font-size: 11px; }
/* ---------- versions ---------- */
.ver-card { width: min(640px, 100%); }
.ver-new { display: flex; gap: 6px; }
.ver-new input { flex: 1; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; padding: 0 8px; }
.ver-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; }
.ver-item { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; background: var(--bg-3); }
.ver-item img, .ver-noimg { width: 80px; height: 45px; border-radius: 4px; object-fit: cover; background: #fff; flex: none; }
.ver-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ver-info small { color: var(--text-3); }

/* Menu bar + workspace switcher */
#menubar { grid-area: menu; position: relative; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 0 6px; background: #121418; border-bottom: 1px solid var(--line); min-width: 0; }
.mb-menus { display: flex; flex: none; }
.mb-top { height: 26px; padding: 0 9px; border: 0; border-radius: 5px; background: none; color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.mb-top:hover, .mb-top.open { background: var(--bg-3); color: var(--text); }
/* Workspace dropdown (menu-set selector) */
.mb-ws { position: relative; display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; justify-content: center; }
.mb-ws-label { font-size: 11px; color: var(--text-3); letter-spacing: .04em; }
.mb-ws-btn { height: 24px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-3); color: var(--text); font-size: 12px; cursor: pointer; white-space: nowrap; }
.mb-ws-btn:hover, .mb-ws-btn[aria-expanded="true"] { border-color: var(--accent); }
.mb-ws-btn b { color: var(--accent-2); }
.mb-ws-list { position: absolute; top: 28px; z-index: 90; width: 330px; max-width: 92vw; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 2px; }
.mb-wsb { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text-2); text-align: start; cursor: pointer; }
.mb-wsb:hover, .mb-wsb:focus-visible { background: var(--bg-3); color: var(--text); outline: none; }
.mb-wsb.on { background: var(--accent-bg); color: var(--text); box-shadow: inset 0 0 0 1px rgba(255,138,61,.35); }
.mb-wsb > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.mb-wsb small { color: var(--text-3); font-size: 11px; line-height: 1.4; }
.mb-ws-ico { font-size: 18px; line-height: 1; }

/* Hidden by the workspace */
.ws-off { display: none !important; }

/* Tool groups with flyouts */
.tool-groups { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tgroup { position: relative; }
.tg-tri { position: absolute; left: 3px; bottom: 3px; width: 0; height: 0; border-style: solid; border-width: 5px 0 0 5px; border-color: transparent transparent transparent currentColor; opacity: .55; pointer-events: none; }
.tool-fly { position: fixed; z-index: 95; min-width: 210px; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 1px; }
.tf-item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; border-radius: 5px; background: none; color: var(--text-2); cursor: pointer; text-align: start; }
.tf-item span { flex: 1; }
.tf-item kbd { font: 11px ui-monospace, monospace; color: var(--text-3); }
.tf-item:hover, .tf-item:focus-visible { background: var(--bg-3); color: var(--text); outline: none; }
.tf-item.on { color: var(--accent); }
.tf-item.on::before { content: '■'; font-size: 8px; margin-inline-end: -4px; }
.tool-cur { padding: 6px 8px; border-radius: 6px; background: var(--bg-3); color: var(--text-2); font-size: 12px; }

/* Text tool */
.text-pop { position: absolute; z-index: 30; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.5); }
.text-pop textarea { min-width: 220px; min-height: 60px; padding: 6px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font: inherit; -webkit-user-select: text; user-select: text; }
.text-pop .text-opts { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.text-pop .text-btn { height: 28px; background: var(--bg-3); }
.text-pop .text-btn.on, .text-pop .text-btn.accent { background: var(--accent-bg); color: var(--accent-2); }
.text-pop select, .text-pop input[type="number"] { height: 28px; background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 5px; }
.text-pop input[type="number"] { width: 58px; }

/* Floating / separate windows */
.float-win { position: fixed; z-index: 60; display: flex; flex-direction: column; min-width: 140px; min-height: 100px; max-width: 100vw; max-height: 100vh; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.55); overflow: hidden; }
/* Resize from every edge and corner (src/ui/windows.js edges) */
.fw-rs { position: absolute; z-index: 5; touch-action: none; }
.fw-rs-n, .fw-rs-s { left: 10px; right: 10px; height: 7px; cursor: ns-resize; }
.fw-rs-n { top: 0; } .fw-rs-s { bottom: 0; }
.fw-rs-e, .fw-rs-w { top: 10px; bottom: 10px; width: 7px; cursor: ew-resize; }
.fw-rs-e { right: 0; } .fw-rs-w { left: 0; }
.fw-rs-ne, .fw-rs-nw, .fw-rs-se, .fw-rs-sw { width: 14px; height: 14px; }
.fw-rs-ne { top: 0; right: 0; cursor: nesw-resize; } .fw-rs-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.fw-rs-nw { top: 0; left: 0; cursor: nwse-resize; } .fw-rs-se { bottom: 0; right: 0; cursor: nwse-resize; }
.fw-rs-se::after { content: ''; position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px; border: solid var(--text-3); border-width: 0 2px 2px 0; opacity: .6; }
.fw-head { display: flex; align-items: center; gap: 2px; height: 30px; padding: 0 4px 0 10px; background: var(--bg-3); border-bottom: 1px solid var(--line); cursor: move; touch-action: none; }
.fw-title { flex: 1; font-size: 12px; font-weight: 600; color: var(--text-2); }
.fw-head .icon-btn { min-width: 26px; height: 24px; font-size: 13px; }
.fw-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.fw-body > * { flex: 1; min-height: 0; }
.fw-body > [hidden] { display: none !important; }
.fw-body > .panel { border: 0; margin: 0; }
.fw-body > .panel > .panel-head .panel-grip, .fw-body > .panel > .panel-head .panel-toggle { display: none; }
.fw-body > .panel.collapsed > :not(.panel-head) { display: revert; }
.panel-float { min-width: 22px; height: 22px; font-size: 12px; color: var(--text-3); }
.panel-float:hover { color: var(--accent); }
.view-float { position: absolute; top: 4px; inset-inline-end: 4px; z-index: 5; min-width: 24px; height: 24px; background: var(--bg-3); }
#graph-editor, #xsheet, #drawing-lib, #rig-panel { position: relative; }
.in-float .view-float, .popout .view-float { display: none; }
/* A floated bottom view no longer takes room under the timeline */
/* A bottom view in a floating / separate window fills the window (not its docked height) */
.fw-body > :is(#graph-editor, #xsheet, #drawing-lib, #rig-panel), #popout-root > :is(#graph-editor, #xsheet, #drawing-lib, #rig-panel) { flex: 1 1 auto !important; height: auto !important; min-height: 0; max-height: none; border-top: 0; }
.float-win.view-win { min-width: 420px; min-height: 240px; }
.float-win .ge-side, #popout-root .ge-side { width: clamp(160px, 32%, 250px); }
.float-win .rig-panel, #popout-root .rig-panel { grid-template-columns: minmax(260px, 2fr) minmax(200px, 1fr) minmax(200px, 1fr); }
.fw-body > .panel > .panel-body { flex: 1; min-height: 0; overflow-y: auto; }
body.graph-floating.graph-open, body.xsheet-floating.xsheet-open, body.library-floating.lib-open, body.rig-floating.rig-open { --tl-h: 178px; }
body.popout { display: block; height: 100vh; overflow: hidden; --tl-h: 100vh; }
body.popout #popout-root { height: 100vh; display: flex; flex-direction: column; }
body.popout #popout-root > * { flex: 1; min-height: 0; display: flex !important; flex-direction: column; }

/* Artboards */
.ab-bar { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.ab-pick { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; font-size: 12px; color: var(--text-3); }
.ab-pick select { flex: 1; min-width: 0; height: 26px; background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 5px; }
.ab-bar .icon-btn { min-width: 26px; height: 26px; font-size: 14px; }
.ab-bar .text-btn.accent, .ab-card .text-btn.accent { background: var(--accent-bg); color: var(--accent-2); }
.ab-card { width: min(980px, 96vw); }
.ab-lead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 16px 10px; }
.ab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; padding: 0 16px 16px; max-height: 70vh; overflow: auto; }
.ab-tile { display: flex; flex-direction: column; gap: 6px; padding: 6px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; }
.ab-tile.cur { border-color: var(--accent); }
.ab-tile.locked { opacity: .55; }
.ab-tile canvas { width: 100%; height: auto; border-radius: 4px; background: #fff; }
.ab-info { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.ab-info small { color: var(--text-3); }
.ab-sub { color: #6ee7a8; font-size: 11px; }
.ab-acts { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ab-acts .text-btn { height: 26px; background: var(--bg-4); }
.ab-name { flex: 1 1 100%; height: 26px; padding: 0 6px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 5px; -webkit-user-select: text; user-select: text; }
.ab-acts select { height: 26px; max-width: 140px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 5px; }

/* Docking: drag ⋮⋮ to move any panel or window */
#panels2 { grid-area: dock2; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; background: var(--bg-2); border-inline-start: 1px solid var(--line); border-inline-end: 1px solid var(--line); }
body.has-dock2 { --d2: var(--panel2-w); }
body:not(.has-dock2) #panels2 { visibility: hidden; }
.dock-resize { position: fixed; z-index: 35; width: 7px; cursor: col-resize; touch-action: none; }
.dock-resize::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; background: transparent; transition: background .15s; }
.dock-resize:hover::after, .dock-resize.active::after { background: var(--accent); width: 2px; }
.dock-ghost { position: fixed; z-index: 100; pointer-events: none; padding: 6px 12px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--accent); color: var(--text); font-size: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.5); white-space: nowrap; }
.dock-ghost small { display: block; color: var(--accent-2); font-size: 11px; }
.dock-line { position: fixed; z-index: 99; height: 3px; border-radius: 2px; background: var(--accent); pointer-events: none; box-shadow: 0 0 0 3px rgba(255,138,61,.2); }
.dock-zone { position: fixed; z-index: 98; display: flex; align-items: center; justify-content: center; border: 2px dashed rgba(255,138,61,.6); border-radius: 8px; background: rgba(255,138,61,.08); color: var(--accent-2); font-size: 12px; pointer-events: none; text-align: center; padding: 6px; }
.dock-zone.hot { background: rgba(255,138,61,.22); border-style: solid; }
.panel.dock-src { opacity: .4; }
.fw-grip, .view-grip { cursor: grab; color: var(--text-3); touch-action: none; user-select: none; letter-spacing: -2px; padding: 0 4px; font-size: 13px; }
.fw-grip:hover, .view-grip:hover { color: var(--accent); }
.view-grip { position: absolute; top: 4px; inset-inline-end: 32px; z-index: 5; height: 24px; display: flex; align-items: center; border-radius: 6px; background: var(--bg-3); }
.in-float .view-grip, .popout .view-grip { display: none; }
.panel-grip { cursor: grab; }

/* Shortcuts window with a virtual keyboard */
#panel-keys .panel-body { overflow-y: auto; }
.kb { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.kb > * { flex-shrink: 0; }
.kb-top { display: flex; align-items: center; gap: 10px; }
.kb-search { flex: 1; min-width: 0; height: 30px; padding: 0 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; -webkit-user-select: text; user-select: text; }
.kb-search:focus { border-color: var(--accent); outline: none; }
.kb-practice { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.kb-practice input { accent-color: var(--accent); }
.kb-hint { margin: 0; min-height: 18px; font-size: 13px; color: var(--accent-2); font-weight: 500; }
.kb-board { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 10px; background: #111317; border: 1px solid var(--line); }
.kb-krow { display: flex; gap: 4px; }
.kb-krow:first-child { margin-bottom: 4px; }
.kb-key { position: relative; min-width: 0; height: 52px; padding: 3px 4px; border: 1px solid #2a2e36; border-radius: 6px; background: #1c1f25; color: var(--text-3); cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; text-align: start; overflow: hidden; transition: background .08s, transform .08s; box-shadow: 0 2px 0 #0a0b0d; }
.kb-key b { font-size: 12px; font-weight: 600; line-height: 1; }
.kb-key em { position: absolute; top: 3px; right: 5px; font-style: normal; font-size: 10px; color: var(--text-3); opacity: .7; }
.kb-act { font-size: 10px; line-height: 1.15; color: var(--accent-2); direction: rtl; align-self: stretch; text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-key.has { background: #26211c; border-color: rgba(255,138,61,.35); color: var(--text); }
.kb-key.kb-mod { background: #20242b; }
.kb-key.mod-on { background: var(--accent); color: #16181c; border-color: var(--accent); }
.kb-key.mod-on em { color: #16181c; }
.kb-key.sel { box-shadow: 0 0 0 2px var(--accent), 0 2px 0 #0a0b0d; }
.kb-key.pressed { transform: translateY(2px); box-shadow: none; background: var(--accent-bg); }
.kb-key:hover { border-color: var(--accent); }
.kb-mouse .kb-key { height: 40px; }
.kb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px 16px; align-items: start; }
.kb-group h4 { margin: 0 0 4px; font-size: 12px; color: var(--text-3); font-weight: 600; letter-spacing: .02em; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.kb-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.kb-row:hover { background: var(--bg-3); }
.kb-row.hit { background: var(--accent-bg); box-shadow: inset 0 0 0 1px rgba(255,138,61,.4); }
.kb-combo { display: inline-flex; align-items: center; gap: 2px; flex: none; direction: ltr; min-width: 110px; justify-content: flex-end; }
.kb-combo kbd { display: inline-block; min-width: 22px; padding: 2px 6px; border-radius: 5px; border: 1px solid #3a3f48; border-bottom-width: 2px; background: #22262d; color: var(--text); font: 600 11.5px system-ui, sans-serif; text-align: center; }
.kb-combo i { font-style: normal; color: var(--text-3); font-size: 11px; }
.kb-text { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text); line-height: 1.35; }
.kb-text small { display: block; color: var(--text-3); font-size: 11px; }

/* Undo scope (next to undo / redo) */
.undo-scope { height: 26px; margin-inline-start: 2px; padding: 0 4px; background: var(--bg-2); color: var(--text-2); border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 11.5px; cursor: pointer; }
.undo-scope.scoped { color: var(--accent-2); border-color: rgba(255,138,61,.5); background: var(--accent-bg); }

/* Effects & Presets */
#panel-fxlib .panel-body { overflow-y: auto; }
.fxl { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.fxl > * { flex-shrink: 0; }
.fxl-top { display: flex; align-items: center; gap: 6px; }
.fxl-search { flex: 1; min-width: 0; height: 28px; padding: 0 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 12.5px; -webkit-user-select: text; user-select: text; }
.fxl-search:focus { border-color: var(--accent); outline: none; }
.fxl-count { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.fxl-target { margin: 0; font-size: 11.5px; color: var(--text-3); }
.fxl-target b { color: var(--accent-2); font-weight: 600; }
.fxl-list { display: flex; flex-direction: column; gap: 2px; }
.fxl-cathead { width: 100%; display: flex; align-items: baseline; gap: 6px; height: 26px; padding: 0 4px; border: 0; border-radius: 5px; background: none; color: var(--text); cursor: pointer; text-align: start; direction: ltr; }
.fxl-cathead:hover { background: var(--bg-3); }
.fxl-cathead span { width: 10px; color: var(--text-3); }
.fxl-cathead b { font-size: 12.5px; font-weight: 600; }
.fxl-cathead small { margin-inline-start: auto; color: var(--text-3); font-size: 11px; direction: rtl; }
.fxl-items { display: flex; flex-direction: column; padding: 2px 0 6px; }
.fxl-item { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 3px 6px 3px 14px; border-radius: 6px; cursor: grab; direction: ltr; outline: none; }
.fxl-item:hover, .fxl-item:focus-visible { background: var(--bg-3); }
.fxl-item:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
.fxl-ico { width: 18px; text-align: center; color: var(--accent-2); font-size: 13px; flex: none; }
.fxl-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.fxl-text b { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fxl-text small { font-size: 11px; color: var(--text-3); direction: rtl; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fxl-fav, .fxl-add { flex: none; width: 24px; height: 24px; border: 0; border-radius: 5px; background: none; color: var(--text-3); cursor: pointer; font-size: 13px; padding: 0; }
.fxl-fav { opacity: .35; }
.fxl-fav.on { opacity: 1; color: #ffcc4d; }
.fxl-item:hover .fxl-fav { opacity: 1; }
.fxl-add { background: var(--bg-3); color: var(--accent-2); font-size: 15px; }
.fxl-add:hover { background: var(--accent-bg); }
.fxl-empty { margin: 8px 4px; font-size: 12px; color: var(--text-3); }

/* Effect Controls */
#panel-fx .panel-body { overflow-y: auto; }
body[data-workspace="effects"] #panel-fx { order: -1; flex: 3; min-height: 260px; }
body[data-workspace="effects"] #panel-layers { flex: 1; min-height: 150px; }
body[data-workspace="effects"] #panel-layers .layer-history, body[data-workspace="effects"] #panel-layers .layer-mask { display: none; }
.fxp { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.fxp > *, .fxp-stack > *, #panel-fx .panel-body > * { flex-shrink: 0; }
.fxp-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fxp-title { flex: 1; min-width: 0; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fxp-title b { color: var(--text); }
.fxp-addbtn { height: 26px; background: var(--accent-bg); color: var(--accent-2); }
.fxp-addbtn.on { box-shadow: inset 0 0 0 1px var(--accent); }
.fxp-browser { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); max-height: 260px; overflow-y: auto; }
.fxp-search { height: 26px; padding: 0 8px; background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 5px; font: inherit; font-size: 12px; -webkit-user-select: text; user-select: text; }
.fxp-catbtn { width: 100%; display: flex; align-items: baseline; gap: 6px; height: 24px; padding: 0 4px; border: 0; background: none; color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; text-align: start; direction: ltr; }
.fxp-catbtn small { color: var(--text-3); font-weight: 400; }
.fxp-catbtn:hover { color: var(--accent-2); }
.fxp-items { display: flex; flex-direction: column; padding-inline-start: 14px; }
.fxp-item { display: flex; align-items: baseline; gap: 8px; padding: 3px 6px; border-radius: 4px; font-size: 12px; cursor: grab; direction: ltr; }
.fxp-item b { font-weight: 500; }
.fxp-item span { color: var(--text-3); font-size: 11px; direction: rtl; }
.fxp-item:hover, .fxp-item:focus-visible { background: var(--bg-3); outline: none; }
.fxp-stack { position: relative; display: flex; flex-direction: column; gap: 4px; }
.fxp-empty, .fxp-hint { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.fxp-fx { border-radius: 6px; background: var(--bg); border: 1px solid var(--line); }
.fxp-fx.off .fxp-params, .fxp-fx.off .fxp-name { opacity: .45; }
.fxp-fx.dragging { opacity: .5; }
.fxp-fxhead { display: flex; align-items: center; gap: 4px; padding: 3px 4px; border-bottom: 1px solid var(--line); outline: none; }
.fxp-target { flex: none; height: 22px; max-width: 88px; padding: 0 4px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text-2); font: inherit; font-size: 11px; }
.fxp-target:not(:has(option[value="both"]:checked)) { color: var(--accent-2); border-color: var(--accent-2); }
.fxp-fxhead:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
.fxp-grip { cursor: grab; color: var(--text-3); padding: 0 2px; touch-action: none; letter-spacing: -2px; }
.fxp-twirl { border: 0; background: none; color: var(--text-2); cursor: pointer; width: 18px; padding: 0; }
.fxp-on { height: 20px; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; background: none; color: var(--text-3); font: italic 600 11px Georgia, serif; cursor: pointer; }
.fxp-on.is-on { color: var(--accent-2); border-color: rgba(255,138,61,.5); background: var(--accent-bg); }
.fxp-name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; direction: ltr; justify-content: flex-end; overflow: hidden; white-space: nowrap; font-size: 12px; }
.fxp-name small { color: var(--text-3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.fxp-animated { color: #ffcc4d; font-size: 10px; }
.fxp-fxhead .icon-btn { min-width: 22px; height: 22px; font-size: 13px; }
.fxp-params { display: flex; flex-direction: column; padding: 4px 6px 6px; gap: 2px; }
.fxp-row { display: grid; grid-template-columns: 22px 1fr auto auto; align-items: center; column-gap: 4px; row-gap: 2px; font-size: 12px; }
.fxp-row .fxp-ctrl { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; padding-inline-start: 26px; }
.fxp-watch { width: 20px; height: 20px; border: 0; border-radius: 4px; background: none; color: var(--text-3); cursor: pointer; font-size: 12px; padding: 0; filter: grayscale(1); opacity: .55; }
.fxp-watch:hover { opacity: 1; }
.fxp-watch.on { filter: none; opacity: 1; background: var(--accent-bg); box-shadow: inset 0 0 0 1px rgba(255,138,61,.5); }
.fxp-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fxp-label.scrub { cursor: ew-resize; text-decoration: underline dotted var(--text-3); text-underline-offset: 3px; }
.fxp-row.animated .fxp-label { color: var(--text); }
.fxp-nav { display: inline-flex; gap: 1px; }
.fxp-nav button, .fxp-graph { width: 18px; height: 18px; padding: 0; border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 10px; }
.fxp-nav button:disabled { opacity: .25; cursor: default; }
.fxp-nav button.on { color: #ffcc4d; }
.fxp-nav button:hover:not(:disabled), .fxp-graph:hover { color: var(--text); }
.fxp-num { width: 64px; height: 22px; padding: 0 4px; background: transparent; color: #4ea1ff; border: 1px solid transparent; border-radius: 4px; font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; -webkit-user-select: text; user-select: text; }
.fxp-num:hover, .fxp-num:focus { border-color: var(--line); background: var(--bg-3); outline: none; }
.fxp-range { flex: 1; min-width: 0; accent-color: var(--accent); }
.fxp-color { width: 40px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
.fxp-switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text-2); }
.fxp-switch input { accent-color: var(--accent); }
.fxp-drop { position: absolute; left: 0; right: 0; height: 3px; border-radius: 2px; background: var(--accent); pointer-events: none; box-shadow: 0 0 0 2px rgba(255,138,61,.25); }
.fx-summary { width: 100%; justify-content: flex-start; height: auto; min-height: 28px; padding: 4px 8px; background: var(--bg-3); text-align: start; line-height: 1.4; white-space: normal; }

/* Export background choice */
.ex-alpha .seg-btn { display: inline-flex; align-items: center; gap: 6px; }
.ex-sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); }
.ex-sw-alpha { background: repeating-conic-gradient(#cfcfcf 0 25%, #9e9e9e 0 50%) 0 0 / 7px 7px; }
#btn-alpha.on { background: var(--accent-bg); color: var(--accent); }
.blend-pick { flex: 1; min-width: 0; height: 26px; background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 5px; }

/* Room-wide timer and poll (everyone sees them) */
.room-timer { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 20px; background: rgba(22,24,28,.92); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.4); font-variant-numeric: tabular-nums; pointer-events: none; }
.room-timer b { font-size: 16px; }
.rt-label { color: var(--text-2); font-size: 12px; }
.rt-bar { width: 70px; height: 4px; border-radius: 2px; background: var(--bg-4); overflow: hidden; }
.rt-bar i { display: block; height: 100%; background: var(--accent); transition: width .5s linear; }
.room-timer.low { border-color: #ffcc4d; }
.room-timer.low b { color: #ffcc4d; }
.room-timer.over { border-color: var(--danger); }
.room-timer.over b { color: var(--danger); }
.room-poll { position: absolute; top: 56px; inset-inline-end: 12px; z-index: 25; width: 260px; max-width: calc(100% - 24px); padding: 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 10px 28px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 6px; }
.rp-q { font-weight: 600; line-height: 1.4; }
.rp-q small { color: var(--text-3); font-weight: 400; }
.rp-opts { display: flex; flex-direction: column; gap: 4px; }
.rp-opt { position: relative; display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-3); color: var(--text); cursor: pointer; overflow: hidden; text-align: start; }
.rp-opt span { flex: 1; position: relative; z-index: 1; }
.rp-opt small { position: relative; z-index: 1; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rp-opt i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--accent-bg); }
.rp-opt.on { border-color: var(--accent); }
.rp-opt:disabled { cursor: default; }
.rp-foot { display: flex; align-items: center; justify-content: space-between; color: var(--text-3); font-size: 12px; }
.rp-foot .text-btn { height: 22px; }

/* Lead dashboard */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.dash-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-width: 0; }
.dash-card h3 { margin: 0; font-size: 13px; display: flex; gap: 6px; align-items: baseline; }
.dash-card h3 small { color: var(--text-3); font-weight: 400; }
.dash-wide { margin-top: 10px; }
.dash-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dash-row .text-btn { height: 28px; background: var(--bg-3); }
.dash-row .text-btn.accent { background: var(--accent-bg); color: var(--accent-2); }
.dash-row select { height: 28px; background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 5px; }
.dash-num { width: 60px; height: 28px; background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 5px; }
.dash-big { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-inline-end: auto; }
.dash-poll { display: flex; flex-direction: column; gap: 4px; }
.dash-bar { position: relative; display: flex; justify-content: space-between; padding: 4px 8px; border-radius: 5px; background: var(--bg-3); overflow: hidden; }
.dash-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--accent-bg); }
.dash-bar span, .dash-bar small { position: relative; }
.dash-wait span { flex: 1; }
.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dash-table th { text-align: start; color: var(--text-3); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dash-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dash-table tr.away td { opacity: .55; }
.dash-acts .text-btn { height: 24px; background: var(--bg-3); }
.dash-on { color: #6ee7a8; }
.dash-idle { color: #ffcc4d; }
.dash-off { color: var(--text-3); }
.mb-pop { position: absolute; z-index: 60; min-width: 250px; padding: 4px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 40px rgba(0,0,0,.55); }
.mb-sub { top: 0; }
.mb-item { width: 100%; display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 8px; height: 28px; padding: 0 8px; border: 0; border-radius: 5px; background: none; color: var(--text); font-size: 12.5px; text-align: start; cursor: pointer; position: relative; }
.mb-item:hover:not(:disabled) { background: var(--accent-bg); color: var(--accent-2); }
.mb-item.off { color: var(--text-3); cursor: default; }
.mb-check { color: var(--accent); font-weight: 700; }
.mb-key { color: var(--text-3); font-size: 11px; }
.mb-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.mb-modal-card { width: min(640px, 100%); }
.mb-help { border-collapse: collapse; width: 100%; font-size: 13px; }
.mb-help th { text-align: start; color: var(--accent-2); padding: 6px 8px 6px 14px; vertical-align: top; white-space: nowrap; }
.mb-help td { padding: 6px 0; color: var(--text-2); border-bottom: 1px solid var(--line); }
body[data-workspace="paint"] #panel-color { box-shadow: inset 3px 0 0 #c77dff; }

/* Crew (production roles) */
.crew-bar { flex: none; display: flex; align-items: center; gap: 6px; font-size: 12px; }
.crew-job { padding: 2px 8px; border-radius: 10px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); font-weight: 600; }
.crew-frozen { color: #7dd3fc; font-weight: 600; }
.crew-tasks { height: 22px; color: #ffd166; }
.tool.crew-off, .art-btn.crew-off { opacity: .28; position: relative; }
.tool.crew-off::after { content: '🔒'; position: absolute; font-size: 9px; bottom: 2px; inset-inline-end: 2px; }
.room-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.room-tab { border: 0; background: none; color: var(--text-2); padding: 6px 12px; font-size: 13px; border-bottom: 2px solid transparent; cursor: pointer; }
.room-tab.on { color: var(--accent-2); border-bottom-color: var(--accent); font-weight: 600; }
.room-pane { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 120px; max-height: 46vh; }
.room-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.room-cursor-size { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.room-cursor-size input { width: 110px; accent-color: var(--accent); }
.room-person.away { opacity: .55; }
.room-doing { display: block; color: var(--text-3); font-size: 11px; }
.room-custom, .room-rolebox { padding: 8px 10px; border-radius: 8px; background: var(--bg-3); display: flex; flex-direction: column; gap: 6px; }
.room-rolehead { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.room-mine { font-size: 12px; color: var(--text-2); padding: 8px; border-radius: 8px; background: var(--bg-3); }
.pol-group { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.pol-title { font-size: 11px; color: var(--text-3); min-width: 54px; }
.pol-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 12px; background: var(--bg-2); font-size: 12px; cursor: pointer; }
.pol-chip input { accent-color: var(--accent); margin: 0; }
.pol-group select { height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.lead-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.lead-layers { display: flex; flex-wrap: wrap; gap: 4px; }
.lead-assign { display: flex; flex-direction: column; gap: 4px; }
.lead-arow { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 6px; align-items: center; font-size: 12px; }
.lead-arow select, .task-new select, .task-new input[type="number"] { height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; min-width: 0; }
.task-new { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-new input[type="number"] { width: 70px; }
.task-new .room-input { flex: 1 1 200px; }
.task-list { display: flex; flex-direction: column; gap: 4px; }
.task { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--bg-3); }
.task.done .task-body > div { text-decoration: line-through; color: var(--text-3); }
.task-body { flex: 1; min-width: 0; font-size: 13px; }
.task-body small { color: var(--text-3); }
.task input[type="checkbox"] { accent-color: var(--accent); }
.task-body small { display: block; }
.task-st { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--bg-2); color: var(--text-2); white-space: nowrap; text-decoration: none; display: inline-block; }
.task-open .task-st { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); }
.task-waiting { opacity: .72; }
.task.mine { outline: 1px solid var(--accent); }
.task-note { color: var(--text-2) !important; }
.task-title { cursor: pointer; border-radius: 4px; }
.task-title:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.task-details { margin-top: 6px; padding: 8px; border-radius: 6px; background: var(--bg-2); display: grid; gap: 4px; font-size: 12px; }
.td-row { display: flex; gap: 8px; } .td-row span { color: var(--text-3); min-width: 82px; } .td-row b { font-weight: 500; overflow-wrap: anywhere; }
.td-chain { margin-top: 4px; display: grid; gap: 4px; } .td-sub { color: var(--text-3); }
.td-step { padding: 4px 6px; border-inline-start: 2px solid var(--line, #444); } .td-step.cur { border-color: var(--accent); }
.td-note { color: var(--text-2); margin-top: 2px; }
.task-hand { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.task-hand .room-input { flex: 1 1 200px; }
.task-hand select { height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; min-width: 0; max-width: 100%; }

/* Animated effects */
.fx-param .param-label { display: flex; align-items: center; gap: 3px; }
.fx-key { border: 0; background: none; padding: 0 2px; font-size: 11px; color: var(--text-3); cursor: pointer; }
.fx-key.has { color: #b39a55; }
.fx-key.on { color: #ffd166; }
.fx-title .text-btn { min-width: 22px; padding: 0 4px; }
.ge-prop.fx .ge-name { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ge-wig { color: #7dd3fc; }
.ge-wiggle { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 4px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 11px; color: var(--text-2); }
.ge-wiggle label { display: flex; align-items: center; gap: 4px; }
.ge-wiggle input { width: 54px; }

/* Line Art / Colour Art switch (toolbar) */
.art-switch { display: flex; flex-direction: column; gap: 2px; padding: 2px; border-radius: 8px; background: var(--bg-3); }
.art-btn { border: 0; background: none; border-radius: 6px; height: 24px; font-size: 11px; color: var(--text-3); cursor: pointer; padding: 0; }
.art-btn.on { background: var(--accent-bg); color: var(--accent-2); font-weight: 600; }
.art-btn[data-art="color"].on { background: rgba(125,211,252,.16); color: #7dd3fc; }
.layer-kind { font-size: 12px; }
.vid-info { font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.vid-warn { font-size: 12px; color: #ffd166; }
.vid-note { font-size: 11px; color: var(--text-3); }

/* Xsheet (exposure sheet) */
#tl-xsheet-btn.on, #tl-lib-btn.on, #tl-sound-btn.on { background: var(--accent-bg); color: var(--accent-2); }
body.xsheet-open { --tl-h: 440px; }
body.xsheet-open .tl-body { display: none; }
.xsheet { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); background: var(--bg); }
.xs-head { display: flex; flex: none; overflow: hidden; background: var(--bg-3); border-bottom: 1px solid var(--line); }
.xs-head .xs-col, .xs-head .xs-fcol { height: 26px; line-height: 26px; font-size: 11px; font-weight: 600; color: var(--text-2); }
.xs-fcol { width: 46px; flex: none; text-align: center; color: var(--text-3); font-variant-numeric: tabular-nums; border-inline-end: 1px solid var(--line); }
.xs-col, .xs-cell { width: 92px; flex: none; border-inline-end: 1px solid var(--line); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 6px; }
.xs-head .xs-col { cursor: pointer; }
.xs-head .xs-col.active { color: var(--accent-2); background: var(--accent-bg); }
.xs-scroll { position: relative; flex: 1; min-height: 0; overflow: auto; outline: none; }
.xs-scroll:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
.xs-spacer { width: 1px; }
.xs-rows { position: absolute; top: 0; left: 0; }
.xs-row { position: absolute; left: 0; display: flex; height: 22px; line-height: 22px; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,.04); }
.xs-row.sec { border-bottom-color: rgba(255,255,255,.18); }
.xs-row.cur { background: rgba(255,138,61,.10); }
.xs-row.cur .xs-fcol { color: var(--accent); font-weight: 700; }
.xs-cell { position: relative; cursor: cell; color: var(--text); text-align: center; }
.xs-cell.active { background: rgba(255,255,255,.025); }
.xs-cell.sel { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-bg); }
.xs-cell b { font-weight: 700; }
.xs-cell.video { color: var(--text-3); }
.xs-hold { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--text-3); opacity: .6; }
.xs-x { color: var(--danger); font-weight: 700; }
.xs-typing { color: var(--accent-2); font-weight: 700; }
.xs-typing::after { content: '▏'; animation: xs-blink 1s steps(2) infinite; }
@keyframes xs-blink { 50% { opacity: 0; } }
.xs-cell.xs-sound, .xs-col.xs-sound { width: 70px; color: #7dd3fc; }
.xs-cell.xs-sound.on { background: rgba(125,211,252,.07); }
.xs-help { flex: none; font-size: 11px; color: var(--text-3); padding: 4px 8px; border-top: 1px solid var(--line); }

/* Drawing library (substitution) */
body.lib-open { --tl-h: 330px; }
.drawing-lib { flex: none; display: flex; gap: 8px; height: 132px; padding: 6px 8px; border-top: 1px solid var(--line); background: var(--bg); }
.lib-side { width: 150px; flex: none; display: flex; flex-direction: column; gap: 4px; }
.lib-side .text-btn { font-size: 12px; justify-content: flex-start; }
.lib-title { font-size: 12px; font-weight: 600; color: var(--text-2); }
.lib-strip { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
.lib-empty { font-size: 12px; color: var(--text-3); align-self: center; }
.lib-card { position: relative; flex: none; width: 120px; display: flex; flex-direction: column; gap: 3px; padding: 4px; border-radius: 8px; background: var(--bg-3); border: 2px solid transparent; cursor: pointer; }
.lib-card:hover { border-color: var(--bg-4); }
.lib-card.cur { border-color: var(--accent); }
.lib-card.unused canvas { opacity: .7; }
.lib-card canvas { width: 112px; height: 63px; border-radius: 4px; background: #fff; display: block; }
.lib-name { font-size: 12px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-rename { width: 100%; height: 22px; font: inherit; font-size: 12px; text-align: center; border-radius: 4px; border: 1px solid var(--accent); background: var(--bg); color: var(--text); }
.lib-star { position: absolute; top: 6px; inset-inline-end: 6px; border: 0; border-radius: 4px; background: rgba(0,0,0,.45); color: var(--text-3); font-size: 12px; line-height: 1; padding: 2px 3px; cursor: pointer; }
.lib-star.on { color: #ffd166; }

/* Sound */
.snd-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snd-meta { font-size: 11px; color: var(--text-3); }
.tl-pop-row { display: flex; flex-wrap: wrap; gap: 4px; }
.text-btn.danger-text { color: var(--danger); }

/* Lip-sync dialog */
.ls-card { width: min(820px, 100%); }
.ls-body { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.ls-step { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.ls-step select { height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.ls-note { font-size: 12px; color: var(--text-3); }
.ls-chart { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.ls-mouth { display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; gap: 2px 6px; align-items: center; padding: 6px; border-radius: 8px; background: var(--bg-3); }
.ls-letter { grid-row: span 2; font-size: 20px; font-weight: 800; color: #7dd3fc; text-align: center; }
.ls-hint { font-size: 10px; color: var(--text-3); }
.ls-mouth select { height: 24px; border-radius: 5px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 12px; min-width: 0; }
.ls-strip { display: flex; gap: 1px; overflow-x: auto; padding-bottom: 6px; }
.ls-cell { flex: none; width: 20px; height: 28px; border: 0; border-radius: 3px; background: var(--bg-3); color: var(--text-2); font-size: 11px; font-weight: 700; cursor: pointer; padding: 0; }
.ls-cell.start { background: rgba(125,211,252,.18); color: #7dd3fc; }
.ls-cell.cur { box-shadow: inset 0 0 0 2px var(--accent); }

/* ------------------------------------------------------------ storyboard & animatic */
body.sb-open { --tl-h: 380px; }
body.sb-open .tl-body { display: none; }
body.storyboard-floating.sb-open { --tl-h: 178px; }
body.storyboard-floating.sb-open .tl-body { display: flex; }
.storyboard { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); background: var(--bg); }
.sb-bar { flex: none; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 5px 8px; border-bottom: 1px solid var(--line); background: var(--bg-3); }
.sb-bar > * { flex-shrink: 0; }
.sb-bar .text-btn { font-size: 12px; }
.sb-bar .text-btn.on { color: var(--accent-2); background: var(--accent-bg); }
.sb-title { font-size: 13px; }
.sb-total { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.sb-main { flex: 1; min-height: 0; display: flex; }
.sb-strip { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 14px; overflow: auto; padding: 8px; outline: none; }
.sb-strip:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
.sb-scene { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 10px; background: var(--bg-2, rgba(255,255,255,.02)); border: 1px solid var(--line); }
.sb-scene-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; padding: 0 2px; }
.sb-scene-head b { cursor: text; }
.sb-scene-head span { color: var(--text-3); font-size: 11px; }
.sb-cards { display: flex; gap: 8px; }
.sb-card { flex: none; width: 168px; display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 8px; background: var(--bg-3); border: 2px solid transparent; cursor: pointer; }
.sb-card:hover { border-color: var(--bg-4); }
.sb-card.cur { border-color: var(--accent); }
.sb-card.dragging { opacity: .4; }
.sb-card.drop-before { box-shadow: 4px 0 0 var(--accent); }
.sb-card.drop-after { box-shadow: -4px 0 0 var(--accent); }
.sb-img { position: relative; width: 160px; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 4px; overflow: hidden; background: #fff; }
.sb-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sb-no, .sb-dur { position: absolute; bottom: 3px; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; font-variant-numeric: tabular-nums; }
.sb-no { inset-inline-start: 3px; }
.sb-dur { inset-inline-end: 3px; font-weight: 500; }
.sb-cap { font-size: 11px; color: var(--text-2); height: 2.6em; overflow: hidden; line-height: 1.3; }
.sb-add { flex: none; align-self: center; width: 44px; height: 44px; border-radius: 50%; border: 1px dashed var(--text-3); background: none; color: var(--text-2); font-size: 22px; cursor: pointer; }
.sb-add:hover { border-color: var(--accent); color: var(--accent); }
.sb-empty { max-width: 460px; font-size: 13px; color: var(--text-2); line-height: 1.5; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px; }
.sb-empty p { margin: 0; }
.sb-rename { width: 140px; font: inherit; font-size: 12px; padding: 1px 4px; border-radius: 4px; border: 1px solid var(--accent); background: var(--bg); color: var(--text); }
.sb-info { width: 280px; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-inline-start: 1px solid var(--line); overflow-y: auto; }
.sb-info:empty { display: none; }
.sb-info-head { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.sb-info-head span { font-size: 11px; color: var(--text-3); }
.sb-dur-row { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.sb-dur-row input { width: 64px; font: inherit; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.sb-field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--text-3); }
.sb-field textarea { resize: vertical; min-height: 34px; font: inherit; font-size: 12px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.sb-field textarea:focus, .sb-dur-row input:focus { outline: none; border-color: var(--accent); }

/* Xsheet: storyboard pictures and frame notes */
.xs-col.xs-sb, .xs-cell.xs-sb { width: 104px; }
.xs-cell.xs-sb { cursor: pointer; }
.xs-cell.xs-sb.start { box-shadow: inset 0 2px 0 rgba(255,255,255,.25); }
.xs-sbimg { position: absolute; left: 46px; width: 104px; z-index: 2; display: flex; align-items: flex-start; justify-content: center; overflow: hidden; cursor: pointer; border-inline-end: 1px solid var(--line); pointer-events: auto; }
.xs-sbimg img { height: 100%; max-width: 100%; object-fit: contain; background: #fff; border-radius: 3px; display: block; }
.xs-sbimg span { position: absolute; top: 2px; left: 4px; font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 3px; background: rgba(0,0,0,.6); color: #fff; }
.xs-col.xs-note, .xs-cell.xs-note { width: 200px; text-align: start; }
.xs-cell.xs-note { cursor: text; color: #fde68a; font-size: 11px; direction: rtl; }
.xs-cell.xs-note.has { background: rgba(253,230,138,.07); }
.xs-note-input { width: 100%; height: 20px; font: inherit; font-size: 11px; padding: 0 4px; border-radius: 3px; border: 1px solid var(--accent); background: var(--bg); color: var(--text); }

/* Storyboard reference window (personal, floats over the work) */
.sbref { position: fixed; z-index: 70; width: 300px; min-width: 200px; max-width: 90vw; resize: horizontal; overflow: hidden; display: flex; flex-direction: column; gap: 6px; padding: 0 0 8px; border-radius: 10px; background: var(--bg-2, #1d2026); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 12px; }
.sbref-head { display: flex; align-items: center; gap: 6px; padding: 5px 6px 5px 8px; background: var(--bg-3); cursor: move; touch-action: none; user-select: none; }
.sbref-head b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.sbref-head .seg-btn { font-size: 11px; padding: 2px 7px; }
.sbref-x { width: 24px; height: 24px; font-size: 13px; }
.sbref-pic { position: relative; margin: 0 8px; border-radius: 6px; overflow: hidden; background: #fff; }
.sbref-pic img { width: 100%; display: block; }
.sbref-no, .sbref-time { position: absolute; top: 4px; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; font-variant-numeric: tabular-nums; }
.sbref-no { inset-inline-start: 4px; }
.sbref-time { inset-inline-end: 4px; font-weight: 500; }
.sbref-cap { margin: 0 8px; color: var(--text-2); line-height: 1.35; max-height: 4.1em; overflow: hidden; }
.sbref-play, .sbref-ov { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 0 8px; }
.sbref-play .icon-btn { width: 28px; height: 26px; font-size: 13px; }
.sbref:not(.animatic) [data-a="toggle"] { opacity: .7; }
.sbref-snd { font-size: 11px; }
.sbref-ov { color: var(--text-3); font-size: 11px; border-top: 1px solid var(--line); padding-top: 6px; }
.sbref-ov .seg-btn { font-size: 11px; padding: 2px 7px; }
.sbref-ov input[type=range] { flex: 1; min-width: 60px; }
/* Pre-production: the timeline bar keeps only onion skin, Xsheet, storyboard and sound. */
body[data-workspace="preproduction"] :is(#tl-camera-btn, #tl-cam-pop, #tl-graph-btn, #tl-sbref-btn, #tl-rig-btn, #tl-lib-btn, .sbref, .sbref-pop) { display: none !important; }
/* Screen wall (src/ui/wall.js) */
.wall { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; background: rgba(12,14,18,.97); direction: rtl; color: var(--text); }
.wall-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.wall-head b { font-size: 15px; }
.wall-count, .wall-hint { color: var(--text-3); font-size: 12px; }
.wall-hint { margin-inline-start: auto; }
.wall-grid { flex: 1; min-height: 0; overflow: auto; display: grid; gap: 12px; padding: 14px; grid-template-columns: repeat(var(--n, 2), minmax(220px, 1fr)); align-content: start; }
.wall-spot { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 14px; }
.wall-spot > .wall-tile.big { flex: 1; min-width: 0; }
.wall-strip { width: 220px; flex: none; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.wall-tile { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: #1b1f26; border: 2px solid transparent; cursor: pointer; outline: none; }
.wall-tile:hover { border-color: rgba(255,255,255,.12); }
.wall-tile.sel, .wall-tile:focus-visible { border-color: var(--c, var(--accent-2)); }
.wall-pic { position: relative; border-radius: 6px; overflow: hidden; background: #fff; line-height: 0; }
.wall-pic canvas { width: 100%; height: auto; display: block; }
.wall-tile.big .wall-pic { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #0e1014; }
.wall-tile.big .wall-pic canvas { max-height: 100%; width: auto; max-width: 100%; }
.wall-cur { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px #fff, 0 0 8px rgba(0,0,0,.6); pointer-events: none; }
.wall-hand { position: absolute; top: 6px; inset-inline-start: 6px; font-size: 20px; line-height: 1; }
.wall-info { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.wall-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); align-self: center; }
.wall-role { font-size: 11px; }
.wall-doing { flex-basis: 100%; color: var(--text-3); }
.wall-acts { display: flex; gap: 4px; flex-wrap: wrap; }
.wall-acts .text-btn { font-size: 11px; padding: 3px 7px; }
.wall-strip .wall-acts { display: none; }
.room-newrole { padding: 8px; border: 1px dashed var(--line); border-radius: 8px; margin-bottom: 8px; }
.room-newrole select { max-width: 170px; }
.room-rolebox.custom .room-rolehead { display: flex; align-items: center; gap: 6px; }
.room-rolebox.custom .role-rename { flex: 1; min-width: 0; }
.role-color { width: 28px; height: 24px; padding: 0; border: 0; background: none; }
.tl-pop.sbref-pop { position: fixed; z-index: 1000; width: 290px; bottom: auto; right: auto; direction: rtl; }
.sbref-opts { display: flex; flex-direction: column; gap: 4px; }
.sbref-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.sbref-opt span { color: var(--text-3); font-size: 11px; }
.sbref-opt:hover, .sbref-opt:focus-visible { background: rgba(255,138,61,.1); outline: none; }
.sbref-opt.active { border-color: var(--accent-2); background: rgba(255,138,61,.16); }
.sbref-ov-row { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.sbref-op { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; }
.sbref-op input { flex: 1; }
.sbref-empty { padding: 4px 10px; color: var(--text-3); line-height: 1.4; }
.sbref-time, .sb-dur, .sb-total { direction: ltr; unicode-bidi: isolate; }
.sb-ex-preview { display: flex; justify-content: center; padding: 6px 0; }
.sbx-page { display: grid; gap: 4px; width: 150px; aspect-ratio: 297 / 210; padding: 14px 8px 6px; background: #fff; border-radius: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.35); direction: rtl; }
.sbx-page.portrait { width: 106px; aspect-ratio: 210 / 297; }
.sbx-page i { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.sbx-page.side i { flex-direction: row; }
.sbx-page b { flex: 1.6; border: 1px solid #333; min-height: 0; }
.sbx-page.side b { flex: 1.4; }
.sbx-page u, .sbx-page s { flex: 1; background: repeating-linear-gradient(#bbb 0 1px, transparent 1px 4px); }
.sb-sub { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--text-2); margin-top: 4px; border-top: 1px solid var(--line); padding-top: 6px; }
.sb-info select { font: inherit; font-size: 12px; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.sb-cam { display: grid; grid-template-columns: auto 1fr 1fr; gap: 3px 6px; align-items: center; font-size: 11px; color: var(--text-3); }
.sb-cam b { font-size: 11px; font-weight: 600; color: var(--text-2); text-align: center; }
.sb-cam input { width: 100%; min-width: 0; font: inherit; font-size: 12px; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.sb-mark { position: absolute; top: 3px; inset-inline-end: 3px; font-size: 10px; padding: 0 4px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; }

/* Storyboard frames always in the canvas's proportions */
.sb-img { aspect-ratio: var(--ar, 16 / 9); height: 92px; width: auto; max-width: 260px; }
.sb-card { width: auto; min-width: 72px; }
.sb-cap { width: 0; min-width: 100%; }
.sbx-page i { justify-content: flex-start; }
.sbx-page b { flex: none; aspect-ratio: var(--ar, 16 / 9); max-width: 100%; max-height: 70%; align-self: center; width: 100%; }
.sbx-page.side b { width: auto; height: 100%; max-height: 100%; }

/* Motion recording: ● next to Play; armed = dashed red frame, a take = solid + blinking REC */
#tl-rec svg circle { fill: #e03131; stroke: none; }
#tl-rec { opacity: .75; }
#tl-rec.on { opacity: 1; background: rgba(224,49,49,.18); box-shadow: inset 0 0 0 1px #e03131; }
body.recording-motion #stage { outline: 3px dashed rgba(224,49,49,.8); outline-offset: -3px; }
body.recording-take #stage { outline-style: solid; }
body.recording-motion #stage::after { content: attr(data-rec-label); position: absolute; top: 10px; inset-inline-start: 12px; color: #fff; background: rgba(224,49,49,.85); font: 700 12px system-ui, sans-serif; padding: 2px 8px; border-radius: 4px; z-index: 5; pointer-events: none; }
body.recording-take #stage::after { content: '● REC'; animation: rec-blink 1s steps(2) infinite; }
@keyframes rec-blink { 50% { opacity: .35; } }
/* Skeleton (rig panel) */
.rg-bones { display: flex; flex-direction: column; gap: 2px; max-height: 210px; overflow-y: auto; }
.rg-bone { display: grid; grid-template-columns: auto minmax(60px, 1fr) minmax(70px, 1.3fr) 40px auto; align-items: center; gap: 4px; padding: 2px 4px; padding-inline-start: calc(4px + var(--d, 0) * 12px); border-radius: 6px; font-size: 12px; }
.rg-bone.sel { background: rgba(255,138,61,.15); box-shadow: inset 0 0 0 1px rgba(255,138,61,.6); }
.rg-bname { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-bone input[type=range] { width: 100%; min-width: 0; }
.rg-ico { border: 0; background: none; cursor: pointer; opacity: .35; font-size: 12px; padding: 2px 4px; border-radius: 4px; color: var(--text); }
.rg-ico.on { opacity: 1; background: rgba(255,209,102,.18); }
.rg-ico:hover { opacity: .8; }
.rg-bprops { display: flex; flex-direction: column; gap: 4px; padding: 6px; margin-top: 4px; border-radius: 8px; background: var(--bg-3); }
.rg-bprops input[type=number], .rg-driver input[type=number] { width: 56px; font: inherit; font-size: 12px; padding: 1px 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.rg-poses { display: flex; flex-wrap: wrap; gap: 4px; }
.rg-pose { display: inline-flex; align-items: center; border-radius: 6px; background: var(--bg-3); }
.rg-hint { margin: 2px 0 4px; }
.rg-driver { flex-wrap: wrap; gap: 4px; font-size: 11px; color: var(--text-3); }
.rg-ctrl.smart { box-shadow: inset 3px 0 0 #a78bfa; }
.rg-ctrl .rg-row .text-btn { height: 24px; }
.rg-smart { color: #f472b6; }
.rg-smart { font-size: 13px; }


/* Tutorials */
.tut-picker { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.55); }
.tut-box { width: min(860px, 100%); max-height: 90vh; overflow: auto; border-radius: 14px; background: var(--bg-2, #1d2026); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.5); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.tut-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tut-head h2 { margin: 0 0 4px; font-size: 20px; }
.tut-head p { margin: 0; color: var(--text-2); font-size: 13px; }
.tut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tut-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); color: var(--text); text-align: start; cursor: pointer; font: inherit; }
.tut-card:hover, .tut-card:focus-visible { border-color: var(--accent); outline: none; }
.tut-card b { font-size: 14px; }
.tut-card small { color: var(--text-2); font-size: 12px; line-height: 1.4; }
.tut-ico { font-size: 22px; }
.tut-meta { margin-top: auto; padding-top: 6px; font-size: 11px; color: var(--text-3); }
.tut-card.done .tut-meta { color: #69db7c; }
.tut-layer { position: fixed; inset: 0; z-index: 390; pointer-events: none; }
.tut-layer.dim { background: rgba(0,0,0,.45); }
.tut-hole { position: fixed; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0,0,0,.5), 0 0 0 3px #ff8a3d, 0 0 18px 4px rgba(255,138,61,.6); transition: left .2s, top .2s, width .2s, height .2s; animation: tut-pulse 1.6s ease-in-out infinite; }
.tut-hole.big { box-shadow: 0 0 0 9999px rgba(0,0,0,.18), 0 0 0 3px #ff8a3d; animation: none; }
@keyframes tut-pulse { 50% { box-shadow: 0 0 0 9999px rgba(0,0,0,.5), 0 0 0 5px #ff8a3d, 0 0 26px 8px rgba(255,138,61,.45); } }
.tut-bubble { position: fixed; pointer-events: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2, #1d2026); color: var(--text); border: 1px solid #ff8a3d; box-shadow: 0 12px 40px rgba(0,0,0,.55); font-size: 13px; line-height: 1.5; transition: left .2s, top .2s; }
.tut-bubble.ok { border-color: #69db7c; }
.tut-top { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); }
.tut-top .icon-btn { margin-inline-start: auto; width: 24px; height: 24px; }
.tut-count { font-variant-numeric: tabular-nums; }
.tut-bar { height: 3px; border-radius: 2px; background: var(--bg-4, #333); overflow: hidden; }
.tut-bar i { display: block; height: 100%; background: #ff8a3d; transition: width .25s; }
.tut-title { font-size: 15px; }
.tut-text { margin: 0; color: var(--text-2); }
.tut-wait { margin: 0; font-size: 12px; color: #ffd166; }
.tut-bubble.ok .tut-wait { color: #69db7c; }
.tut-actions { display: flex; align-items: center; gap: 6px; }
.tut-actions .spacer { flex: 1; }
@media (prefers-reduced-motion: reduce) { .tut-hole { animation: none; transition: none; } .tut-bubble { transition: none; } }

/* Plans */
.plan-badge { font: 700 11px system-ui, sans-serif; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-3); color: var(--text-2); cursor: pointer; letter-spacing: .04em; }
.plan-badge.pro { background: linear-gradient(135deg, #ff8a3d, #f06595); color: #fff; border-color: transparent; }
.pl-modal { position: fixed; inset: 0; z-index: 420; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.55); }
.pl-box { width: min(760px, 100%); max-height: 92vh; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 14px; background: var(--bg-2, #1d2026); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.pl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pl-head h2 { margin: 0 0 4px; font-size: 20px; }
.pl-head p { margin: 0; color: var(--text-2); font-size: 13px; }
.pl-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.pl-card { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); }
.pl-card.pro { border-color: rgba(255,138,61,.6); }
.pl-card.cur { box-shadow: 0 0 0 2px var(--accent); }
.pl-card small { color: var(--text-2); font-size: 12px; line-height: 1.4; }
.pl-price { font-size: 12px; color: var(--accent-2); }
.pl-table-wrap { overflow-x: auto; }
.pl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pl-table th { text-align: start; font-size: 12px; color: var(--text-3); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.pl-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.05); }
.pl-table td:nth-child(n+2), .pl-table th:nth-child(n+2) { text-align: center; width: 120px; }
.pl-group td { font-weight: 700; color: var(--text-2); background: rgba(255,255,255,.03); font-size: 12px; }
.pl-table tr.hl td { background: rgba(255,138,61,.16); }
.pl-yes { color: #69db7c; font-weight: 700; }
.pl-no { color: var(--text-3); }
.pl-val { font-size: 12px; color: var(--text-2); }
.pl-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.pl-foot .spacer { flex: 1; }
.pl-foot select { font: inherit; padding: 2px 6px; border-radius: 6px; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
/* Plans and pricing, limit moments */
.pl-box { width: min(980px, 100%); }
.pl-box > * { flex-shrink: 0; }
.pl-box.pl-small { width: min(440px, 100%); align-items: stretch; text-align: center; }
.pl-small h2 { margin: 0; font-size: 19px; }
.pl-small p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.pl-lock-icon { font-size: 34px; line-height: 1; }
.pl-preview { padding: 10px 12px; border-radius: 10px; background: var(--bg-3); color: var(--text) !important; }
.pl-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pl-period { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line); margin-inline-start: auto; }
.pl-period button { font: inherit; font-size: 12.5px; padding: 5px 12px; border-radius: 999px; border: 0; background: none; color: var(--text-2); cursor: pointer; }
.pl-period button[aria-checked="true"] { background: var(--accent); color: #111; font-weight: 700; }
.pl-trial, .pl-edu, .pl-early { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.pl-trial { background: rgba(255,138,61,.12); border: 1px solid rgba(255,138,61,.45); }
.pl-trial span { flex: 1; min-width: 200px; }
.pl-edu { background: rgba(105,219,124,.1); border: 1px solid rgba(105,219,124,.35); }
.pl-early { background: var(--bg-3); border: 1px dashed var(--line); }
.pl-early label { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); }
.pl-sec { margin: 4px 0 -4px; font-size: 12px; letter-spacing: .06em; color: var(--text-3); font-weight: 700; }
.pl-cards { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.pl-card { gap: 6px; padding: 12px 14px; }
.pl-card > b { font-size: 15px; }
.pl-card .pl-price { font-size: 24px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.pl-card .pl-price small { font-size: 12px; font-weight: 400; color: var(--text-3); }
.pl-note { font-size: 11.5px; color: var(--accent-2); }
.pl-card select, .pl-card input[type=number] { font: inherit; font-size: 12.5px; padding: 3px 6px; border-radius: 6px; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.pl-card input[type=number] { width: 70px; }
.pl-seats { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.pl-card-foot { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.pl-cur { font-size: 12.5px; color: #69db7c; font-weight: 700; }
.lh-btn.locked { opacity: .65; }
/* Legal */
.legal-box { width: min(820px, 100%); }
.legal-tabs { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.legal-tabs button { font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: none; color: var(--text-2); cursor: pointer; }
.legal-tabs button[aria-current="true"] { background: var(--bg-3); color: var(--text); border-color: var(--accent); }
.legal-draft { margin: 0; padding: 8px 12px; border-radius: 8px; background: rgba(255,200,60,.12); border: 1px solid rgba(255,200,60,.4); font-size: 12.5px; }
.legal-doc { font-size: 14px; line-height: 1.65; max-width: 70ch; }
.legal-doc h1 { font-size: 20px; margin: 0 0 4px; }
.legal-doc h2 { font-size: 15px; margin: 16px 0 4px; }
.legal-doc p, .legal-doc li { color: var(--text-2); }
.legal-doc .legal-meta { font-size: 12px; color: var(--text-3); }
.legal-doc table { width: 100%; border-collapse: collapse; font-size: 13px; }
.legal-doc td, .legal-doc th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: start; }
.legal-doc pre { white-space: pre-wrap; font-size: 11.5px; padding: 10px; border-radius: 8px; background: var(--bg-3); }
.legal-doc a { color: var(--accent-2); }
/* Account: consent, privacy, delete */
.acc-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; color: var(--text-2); text-align: start; }
.acc-consent input { margin-top: 3px; flex: none; }
.acc-consent a { color: var(--accent-2); }
.acc-confirm { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,90,90,.5); background: rgba(255,90,90,.08); font-size: 13px; }
.acc-confirm input { font: inherit; padding: 4px 8px; border-radius: 6px; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
/* Teaching kit */
.kit-box { width: min(860px, 100%); }
.kit-level h3 { margin: 6px 0; font-size: 15px; color: var(--accent-2); }
.kit-level ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.kit-level li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; padding: 6px 10px; border-radius: 8px; background: var(--bg-3); font-size: 13.5px; color: var(--text-2); }
.kit-level li.ready { color: var(--text); }
.kit-level li small { color: var(--text-3); }
.kit-actions { display: flex; gap: 6px; }
.kit-actions a { text-decoration: none; }
/* Growth: invitation, gallery */
.gr-msg { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; line-height: 1.5; padding: 8px 10px; border-radius: 8px; background: var(--bg); color: var(--text); border: 1px solid var(--line); resize: vertical; text-align: start; }
.gr-row { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); text-align: start; }
.gr-row input { font: inherit; padding: 5px 8px; border-radius: 6px; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
@media (max-width: 560px) { .pl-head { flex-wrap: wrap; } .pl-period { margin-inline-start: 0; } .pl-table td:nth-child(n+2), .pl-table th:nth-child(n+2) { width: 80px; } }

/* Text panel */
.txt-panel { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 30; width: min(330px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 10px; border-radius: 12px; background: var(--bg-2, #1d2026); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 12px; }
.txt-head { display: flex; align-items: center; gap: 6px; }
.txt-head span { color: var(--text-3); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txt-head .icon-btn { width: 24px; height: 24px; }
.txt-panel textarea { width: 100%; min-height: 54px; resize: vertical; font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); box-sizing: border-box; }
.txt-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.txt-row .spacer { flex: 1; }
.txt-row label { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.txt-panel input[type=number] { width: 58px; font: inherit; font-size: 12px; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.txt-panel input[type=color] { width: 30px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
.txt-panel select { font: inherit; font-size: 12px; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.txt-font { flex: 1; min-width: 0; }
.txt-up { cursor: pointer; }
.txt-preview { padding: 6px 8px; border-radius: 8px; background: var(--bg-3); font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txt-sub { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text-2); border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
.txt-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.txt-presets .text-btn { font-size: 11px; padding: 3px 7px; background: var(--bg-3); border-radius: 6px; }
.txt-anims { display: flex; flex-direction: column; gap: 6px; }
.txt-anim { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 8px; background: var(--bg-3); }
.txt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.txt-grid label { display: flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 11px; justify-content: space-between; }
.txt-grid small { color: var(--text-3); width: 14px; }
.txt-foot { border-top: 1px solid var(--line); padding-top: 6px; }

/* Drawing guides panel */
#btn-guides.on { color: var(--accent-2); background: var(--accent-bg); }
.gd-panel { position: fixed; z-index: 300; width: 320px; max-width: calc(100vw - 16px); max-height: calc(100vh - 80px); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; background: var(--bg-2, #1d2026); border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(0,0,0,.5); font-size: 12px; }
.gd-head { display: flex; align-items: center; justify-content: space-between; }
.gd-head .icon-btn { width: 24px; height: 24px; }
.gd-sub { font-weight: 700; color: var(--text-2); border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
.gd-sub small { font-weight: 400; color: var(--text-3); }
.gd-types { display: flex; }
.gd-types .seg-btn { flex: 1; font-size: 13px; }
.gd-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gd-row label { display: inline-flex; align-items: center; gap: 4px; }
.gd-row input[type=number] { width: 50px; font: inherit; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.gd-row select { font: inherit; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.gd-range { display: flex; align-items: center; gap: 6px; }
.gd-range input { flex: 1; }
.gd-comp { display: flex; flex-wrap: wrap; gap: 4px; }
.txt-head { cursor: move; user-select: none; touch-action: none; }
.txt-preview { min-height: 30px; line-height: 1.3; }
.txt-cat { font-size: 11px; color: var(--text-3); margin-top: 2px; }
#stage[data-tool="move"] { cursor: default; }

/* Camera capture window (Animation → מצלמה) */
.cam-win { position: absolute; top: 10px; inset-inline-start: 10px; z-index: 32; width: min(300px, calc(100% - 20px)); display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: var(--bg-2, #1d2026); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 12px; }
.cam-head { display: flex; align-items: center; justify-content: space-between; }
.cam-head .icon-btn { width: 24px; height: 24px; }
.cam-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-2); }
.cam-row select { flex: 1; min-width: 0; font: inherit; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.cam-row input[type=range] { flex: 1; }
.cam-shoot { font: 700 14px system-ui, sans-serif; padding: 8px; border-radius: 999px; border: 0; background: var(--accent, #ff8a3d); color: #fff; cursor: pointer; }
.cam-shoot:disabled { opacity: .4; cursor: default; }
.cam-err { margin: 0; padding: 6px 8px; border-radius: 8px; background: rgba(224,49,49,.12); color: #ffa8a8; line-height: 1.5; }
#stage.cam-flash::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.55); pointer-events: none; z-index: 6; }

/* ---------- UI polish ---------- */
/* Consistent, quiet feedback on hover and press */
.icon-btn, .text-btn, .tool, .rg-mode, .tf-item, .mb-wsb, .rg-node, .rg-bone { transition: background-color .12s ease, color .12s ease, box-shadow .12s ease, transform .08s ease; }
.icon-btn:active:not(:disabled), .text-btn:active:not(:disabled), .tool:active { transform: translateY(1px); }
.tool:hover:not(.active) { background: var(--bg-3); color: var(--text); }
.text-btn:disabled { opacity: .4; cursor: default; background: transparent !important; }
.text-btn.accent { color: var(--accent-2); }
.text-btn.accent:hover:not(:disabled) { background: rgba(255,138,61,.24); }
/* Thin scrollbars that don't fight the panels */
* { scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #424955; }
/* Fields: one focus style everywhere */
input[type="number"]:focus-visible, input[type="text"]:focus-visible, input:not([type]):focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 2px rgba(255,138,61,.25); }
input[type="number"] { font-variant-numeric: tabular-nums; }
select { cursor: pointer; }
/* Keyframe diamonds: clearer states */
.fx-key { transition: color .12s, transform .12s; }
.fx-key.on { transform: scale(1.12); }
/* Panel headings breathe a little more */
.rg-title { letter-spacing: .01em; }
/* Toasts read better over busy drawings */
#toast { backdrop-filter: blur(6px); }
@media (prefers-reduced-motion: reduce) { .icon-btn, .text-btn, .tool, .rg-mode, .tf-item, .mb-wsb, .rg-node, .rg-bone, .fx-key { transition: none; } }
/* System "reduce motion": same effect as the in-app setting (body.a11y-motion) for blinking
   REC / cursor, floating reactions, toasts and smooth scrolling. Durations, not "none", so
   end states still apply. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- LTR languages ----------
   Several pieces sit inside a deliberately LTR box (colour picker, timeline body, effect
   lists, keyboard map) and switch back to RTL for their Hebrew text. When the interface
   language is LTR (html[dir="ltr"], set by src/i18n), they must follow the page instead. */
html[dir="ltr"] :is(.cp-menu, .cp-hpick, .cp-vrow, .cp-hsave, .cp-pal-head, .cp-pal-empty, .tl-names, .tl-menu,
  .kb-act, .fxl-cathead small, .fxl-text small, .fxp-item span, .xs-cell.xs-note, .wall, .tl-pop.sbref-pop, .sbx-page) { direction: ltr; }
html[dir="ltr"] .tl-name.in-folder { box-shadow: inset 3px 0 0 rgba(139,149,165,.35); }
html[dir="ltr"] .param-value { text-align: right; }
/* The ⋯ / right-click menu of a layer or folder (src/ui/layermenu.js) */
.layer .more { min-width: 24px; opacity: .55; margin-inline-start: auto; }
.layer:hover .more, .layer.active .more, .layer .more:focus-visible { opacity: 1; }
.layer .layer-name { flex: 0 1 auto; }
.tl-rb.more { font-weight: 700; letter-spacing: -1px; }
.lmenu { position: fixed; z-index: 9000; min-width: 230px; max-width: min(320px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto; padding: 4px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0,0,0,.45); font-size: 13px; }
.lm-head { padding: 6px 10px 4px; color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm-item { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.lm-item:hover:not(:disabled), .lm-item:focus-visible { background: var(--bg-4); }
.lm-item:disabled { opacity: .4; cursor: default; }
.lm-item.danger { color: #ff7a7a; }
.lm-check { width: 14px; flex: none; color: var(--accent-2); }
.lm-arrow { margin-inline-start: auto; color: var(--text-3); }
.lm-sub { margin-inline-start: 14px; padding-inline-start: 6px; border-inline-start: 1px solid var(--line); }
.lm-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.lm-note { padding: 4px 10px; color: var(--text-3); font-size: 12px; }
.lm-rename { display: flex; gap: 6px; padding: 4px 6px; }
.lm-rename input { flex: 1; min-width: 0; font: inherit; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }

/* Projects window: how much each project weighs and how full the cloud space is */
.pj-size { white-space: nowrap; }
.pj-usage { display: grid; gap: 6px; padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; background: var(--bg-3); font-size: 12px; color: var(--text-2); }
.pj-usage:empty { display: none; }
.pj-usage b { color: var(--text); font-weight: 600; }
.pj-usage-pct { color: var(--text-3); font-variant-numeric: tabular-nums; }
.pj-usage-bar { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.pj-usage-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.pj-usage-bar.high span { background: #f5b04c; }
.pj-usage-bar.full span { background: #ff6b6b; }

/* Main and second colour in the tool bar: the main one in front, the second behind it; X, a click
   on either, or ⇄ swaps them. */
.tool-colors { position: relative; width: 44px; height: 44px; flex: none; }
.tool-colors .tool-color, .tool-colors .tool-color2 { position: absolute; padding: 0; cursor: pointer; border-radius: 50%; }
.tool-colors .tool-color { width: 30px; height: 30px; top: 0; inset-inline-start: 0; z-index: 2; }
.tool-colors .tool-color2 { width: 24px; height: 24px; bottom: 0; inset-inline-end: 0; z-index: 1; border: 2px solid var(--bg-4); box-shadow: 0 0 0 1px #000 inset; }
.tool-colors .tool-swap { position: absolute; top: -2px; inset-inline-end: -2px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); font-size: 12px; line-height: 18px; cursor: pointer; }
.tool-colors .tool-swap:hover { color: var(--text); }
.tool-colors button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@container toolbar (max-height: 520px) {
  .tool-colors { width: 38px; height: 38px; }
  .tool-colors .tool-color { width: 26px; height: 26px; }
  .tool-colors .tool-color2 { width: 20px; height: 20px; }
}

/* Free plan: Pro brush settings are visible but greyed out and read-only (src/ui/panels.js). */
.param.pro-locked, .pro-locked { opacity: .45; filter: grayscale(1); cursor: not-allowed; }
.param.pro-locked input, .param.pro-locked select, .pro-locked button { pointer-events: none; }
.param-group.locked { color: var(--text-3); }

/* 3D camera window (src/ui/campanel.js) */
.cam-panel { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(260px, 1.4fr) minmax(210px, 1fr); gap: 10px; height: 250px; padding: 6px 8px; border-top: 1px solid var(--bg-3); background: var(--bg); overflow: hidden; }
body.cam-open { --tl-h: 420px; }
body.cam-open .cam-panel { flex: none; }
.cm-col { min-width: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.cm-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; padding-bottom: 2px; }
.cm-spacer { flex: 1; }
.cm-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.cm-label { flex: 0 0 auto; min-width: 92px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-row input[type="range"] { flex: 1; min-width: 60px; accent-color: var(--accent); }
.cm-row input[type="number"] { width: 64px; padding: 2px 4px; border-radius: 5px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: inherit; }
.cm-unit { color: var(--text-3); min-width: 14px; }
.cm-acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cm-map { overflow: hidden; }
.cm-canvas { flex: 1; min-height: 120px; width: 100%; border-radius: 6px; background: var(--bg-2); cursor: grab; touch-action: none; }
.cm-canvas:active { cursor: grabbing; }
.cm-map .tool-hint { font-size: 11px; margin: 0; }
#tl-camera-btn.on { background: var(--accent-bg); color: var(--accent-2); }
.ge-target { display: inline-flex; margin-inline-start: auto; }
.ge-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
@media (max-width: 900px) { .cam-panel { grid-template-columns: 1fr; height: auto; max-height: 60vh; overflow-y: auto; } }
/* the camera window floating: the timeline keeps its normal height, the window fills its frame */
body.camera-floating.cam-open { --tl-h: 178px; }
.float-win .cam-panel { height: 100%; border-top: 0; }
.cam-panel { position: relative; }
