/* TYPOMAN studio — a quiet graphite pro-tool chrome around a hero artboard.
 * Klein blue (#0015ff) marks what is active or primary; everything else stays neutral.
 * Sections: tokens · base · top bar · buttons · panels · layers · gallery · stage · timeline ·
 * inspector + controls · popovers · font picker · curve editor · colour picker · modal ·
 * onboarding · tooltips · toasts · states · responsive · reduced motion.
 * Token names from the first shell (--bg, --panel…, --accent…) are kept for other teams.
 */
:root {
  --bg: #0a0a0c;
  --pasteboard: #0c0c0f;
  --panel: #111114;
  --panel-2: #17171b;
  --panel-3: #1e1e23;
  --panel-4: #27272d;
  --pop: #18181c;
  --line: #222228;
  --line-2: #2d2d34;
  --line-3: #3a3a42;
  --text: #f3f3f5;
  --text-2: #b6b6c0;
  --text-3: #8c8c97; /* ≥ 4.5:1 on every panel surface */
  --accent: #0015ff; /* International Klein Blue: fills */
  --accent-hi: #4757ff; /* hover fill, focus-adjacent UI (≥ 3:1 on dark) */
  --accent-press: #0010c4;
  --accent-fg: #8c98ff; /* accent as text or lines on dark (≥ 4.5:1) */
  --accent-soft: rgba(71, 87, 255, 0.16);
  --accent-ink: #ffffff;
  --focus: #8c98ff;
  --hot: #ff5a3c;
  --warn: #ffb547;
  --ok: #34d77f;
  --radius: 10px;
  --radius-s: 7px;
  --ui: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: Anton, "Bebas Neue", Impact, var(--ui);
  --left-w: 288px;
  --right-w: 328px;
  --top-h: 52px;
  --bar-h: 42px;
  --tl-h: 64px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-pop: 0 24px 60px -12px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ───────────────────────────── base ───────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { overflow: hidden; overflow: clip; } /* the app never scrolls as a page; panels scroll inside */
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 var(--ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: grid;
  grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  grid-template-areas: "top top top" "left center right";
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pop:focus-visible, .modal:focus-visible, .inspector:focus-visible, .coach:focus-visible { outline: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
kbd { font: 500 10.5px/1 var(--mono); padding: 3px 5px; border-radius: 4px; background: var(--panel-4); border: 1px solid var(--line-3); border-bottom-width: 2px; color: var(--text-2); white-space: nowrap; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.grow { flex: 1 1 auto; }
::selection { background: rgba(71, 87, 255, 0.45); }
* { scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }
::-webkit-scrollbar-track { background: transparent; }
body.scrubbing, body.scrubbing * { cursor: ew-resize !important; user-select: none; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 200; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.skip:focus { left: 8px; }

/* ───────────────────────────── top bar ───────────────────────────── */
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  min-width: 0;
  position: relative;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; user-select: none; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); overflow: hidden; display: grid; place-items: start center; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 4px 14px -4px rgba(0, 21, 255, 0.7); }
.logo b { display: block; font: 400 19px/26px var(--display); color: #fff; height: 26px; transition: transform 0.5s var(--ease-out); }
.brand:hover .logo b { transform: translateY(-26px); }
.logo.lg { width: 56px; height: 56px; border-radius: 14px; }
.logo.lg b { font-size: 40px; line-height: 56px; height: 56px; animation: rise 1.6s var(--ease-out) infinite; }
@keyframes rise { 0%, 35% { transform: translateY(0); } 60%, 100% { transform: translateY(-56px); } }
.wordmark { font: 400 21px/1 var(--display); letter-spacing: 0.035em; color: var(--text); }
.crumb { color: var(--line-3); font-size: 18px; font-weight: 300; margin: 0 -2px 0 2px; }
.project { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 0 1 auto; }
.scene-name { min-width: 60px; width: 22ch; max-width: 280px; background: transparent; border: 1px solid transparent; border-radius: 7px; padding: 6px 8px; color: var(--text); font-weight: 500; text-overflow: ellipsis; }
.scene-name:hover { border-color: var(--line-2); }
.scene-name:focus { border-color: var(--accent-hi); background: var(--panel-2); }
.save-state { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; min-width: 84px; cursor: default; }
.save-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 215, 127, 0.12); transition: background 0.2s; }
.save-state[data-status="pending"] i { background: var(--warn); box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.12); }
.save-state[data-status="error"] { color: var(--warn); }
.save-state[data-status="error"] i { background: var(--hot); box-shadow: 0 0 0 3px rgba(255, 90, 60, 0.15); }
.tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 6px; }
.split { display: inline-flex; }
.split .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 9px; }
.split .btn.caret { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 0 6px; width: 26px; }
.split .btn.caret svg { width: 14px; height: 14px; }
.remix.spin svg { animation: spin 0.6s var(--ease-out); }
@keyframes spin { from { transform: rotate(-200deg) scale(0.8); } to { transform: none; } }
.show-phone { display: none !important; }

/* ───────────────────────────── buttons ───────────────────────────── */
.btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-weight: 600; font-size: 12.5px; white-space: nowrap; user-select: none;
  transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.14s, box-shadow 0.14s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--panel-3); border-color: var(--line-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .icon-btn:disabled { opacity: 0.38; pointer-events: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-3); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px -8px rgba(0, 21, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.btn.primary:hover { background: #2b3bff; border-color: #2b3bff; }
.btn.primary:active { background: var(--accent-press); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; gap: 6px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.wide { width: 100%; margin-top: 2px; }
.btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn kbd { margin-left: auto; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.12); color: inherit; opacity: 0.8; }
.icon-btn { width: 32px; padding: 0; background: transparent; border-color: transparent; color: var(--text-2); }
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn.on, .icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-fg); }
.link-btn { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--accent-fg); font-size: 12px; font-weight: 600; padding: 2px 0; border-radius: 4px; }
.link-btn svg { width: 14px; height: 14px; }
.link-btn:hover { color: #b3baff; text-decoration: underline; text-underline-offset: 3px; }

/* ───────────────────────────── panels ───────────────────────────── */
.panel { background: var(--panel); min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.panel.left { grid-area: left; border-right: 1px solid var(--line); }
.panel.right { grid-area: right; border-left: 1px solid var(--line); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 16px; min-height: 44px; }
.panel-head h2 { margin: 0; font-size: 11px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); }
.count { font: 500 10.5px/1 var(--mono); color: var(--text-3); padding: 3px 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); }
.hint-inline { font-size: 11px; color: var(--text-3); }
@media (hover: none) { .hint-inline { display: none; } } /* "Hover to preview" means nothing on touch */
.tabs, .sheet-handle { display: none; }
.layers-sec { flex: none; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); max-height: 44%; }
.presets-sec { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ───────────────────────────── layers ───────────────────────────── */
.layer-list { overflow-y: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.layer-row {
  position: relative; display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 6px 0 4px; border-radius: 8px;
  cursor: default; user-select: none; transition: background 0.12s, transform 0.18s var(--ease-out);
}
.layer-row:hover { background: var(--panel-2); }
.layer-row.on { background: var(--accent-soft); }
.layer-row.on::before { content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-hi); }
.layer-row:focus-visible { outline-offset: -1px; }
.layer-row.dragging { z-index: 2; background: var(--panel-3); box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.7); transition: none; cursor: grabbing; }
.reordering .layer-row:not(.dragging) { transition: transform 0.18s var(--ease-out); }
.grip { color: var(--text-3); opacity: 0; cursor: grab; display: grid; place-items: center; width: 14px; }
.grip svg { width: 14px; height: 14px; }
.layer-row:hover .grip, .layer-row.on .grip { opacity: 0.8; }
.layer-chip { flex: none; width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font-size: 15px; line-height: 1; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); background: var(--panel-3); font-synthesis: none; }
.layer-chip.lg { width: 34px; height: 34px; border-radius: 8px; font-size: 20px; }
.layer-chip.transparent { background: repeating-conic-gradient(#2a2a30 0% 25%, #1e1e23 0% 50%) 0 0 / 10px 10px; }
.layer-text { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.layer-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-name.empty { color: var(--text-3); font-style: italic; font-weight: 500; }
.layer-meta { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-row .eye { flex: none; width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); display: grid; place-items: center; opacity: 0; }
.layer-row .eye svg { width: 16px; height: 16px; }
.layer-row:hover .eye, .layer-row.hidden-layer .eye, .layer-row.on .eye { opacity: 1; }
.layer-row .eye:hover { background: var(--panel-4); color: var(--text); }
.layer-row.hidden-layer .layer-chip, .layer-row.hidden-layer .layer-text { opacity: 0.42; }
.layer-rename { flex: 1; min-width: 0; height: 26px; border: 1px solid var(--accent-hi); border-radius: 6px; background: var(--panel); padding: 0 6px; font-weight: 600; font-size: 12.5px; }
.layer-tools { display: flex; align-items: center; gap: 2px; padding: 6px 8px 8px; }
/* Layers → Timing: phones only (desktop has the timeline lanes). Bars reuse the lane styles. */
.layer-timing { display: none; }
.lt-chart { position: relative; margin: 0 16px; }
.lt-rows { display: flex; flex-direction: column; gap: 4px; }
.lt-row { display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.lt-row .layer-chip { justify-self: center; }
.lt-bar { position: relative; display: block; height: 24px; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.03); box-shadow: inset 0 0 0 1px var(--line); }
.lt-row.on .lt-bar { box-shadow: inset 0 0 0 1px var(--accent-hi); }
.lt-row.on .tl-pass { background: rgba(71, 87, 255, 0.3); box-shadow: inset 0 0 0 1px rgba(140, 152, 255, 0.6); }
.lt-row.hidden-layer { opacity: 0.45; }
.lt-row:focus-visible { outline-offset: 1px; border-radius: 6px; }
.lt-head { position: absolute; top: -3px; bottom: -3px; left: 34px; width: 1.5px; margin-left: -0.75px; background: rgba(255, 255, 255, 0.85); pointer-events: none; z-index: 2; }
.lt-scale { position: relative; height: 16px; margin: 3px 16px 0 50px; font: 500 10px/16px var(--mono); color: var(--text-3); }
.lt-scale span { position: absolute; top: 0; transform: translateX(-50%); }
.lt-scale span:first-child { transform: none; }
.lt-scale span:last-child { transform: translateX(-100%); }
.lt-for { margin: 14px 16px 6px; font-size: 12.5px; font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-ctls { display: flex; flex-direction: column; gap: 9px; padding: 0 16px 20px; }
.lt-stepper { display: inline-flex; align-items: center; gap: 4px; justify-self: start; }
.lt-cycles { min-width: 44px; text-align: center; font: 600 13px/1 var(--mono); color: var(--text); }

/* ───────────────────────────── gallery ───────────────────────────── */
.gallery { overflow-y: auto; padding: 0 12px 20px; min-height: 0; flex: 1; }
.gallery-top { position: sticky; top: 0; z-index: 2; background: var(--panel); padding: 2px 0 10px; display: flex; flex-direction: column; gap: 10px; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap > svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
.search, .fp-search {
  width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2);
  padding: 0 34px 0 32px; color: var(--text); transition: border-color 0.14s, background 0.14s;
}
.search::placeholder, .fp-search::placeholder { color: var(--text-3); }
.search:hover, .fp-search:hover { border-color: var(--line-3); }
.search:focus, .fp-search:focus { border-color: var(--accent-hi); background: var(--panel); outline: none; box-shadow: 0 0 0 3px rgba(71, 87, 255, 0.22); }
.search::-webkit-search-cancel-button { filter: invert(0.7); }
.search-kbd { position: absolute; right: 8px; pointer-events: none; }
.search:focus ~ .search-kbd, .search:not(:placeholder-shown) ~ .search-kbd { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); border-radius: 99px; padding: 0 10px; font-size: 12px; font-weight: 500; transition: background 0.14s, color 0.14s, border-color 0.14s; }
.chip:hover { color: var(--text); border-color: var(--line-3); background: var(--panel-2); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-n { font: 500 10px/1 var(--mono); opacity: 0.72; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cards > * { min-width: 0; }
.card {
  position: relative; display: flex; flex-direction: column; align-items: stretch; text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--radius); padding: 5px 5px 9px; outline-offset: 2px;
  transition: border-color 0.16s, transform 0.2s var(--ease-out), box-shadow 0.2s, background 0.16s;
}
.card-thumb { position: relative; border-radius: 6px; overflow: hidden; background: #000; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.card canvas { width: 100%; aspect-ratio: 16 / 9; display: block; transition: filter 0.2s; filter: saturate(0.92) brightness(0.92); }
.card:hover canvas, .card:focus-visible canvas, .card.on canvas { filter: none; }
.card-name { font-weight: 600; padding: 8px 4px 0; font-size: 12.5px; color: var(--text); }
.card-cat { color: var(--text-3); font-size: 11px; padding: 1px 4px 0; }
.card:hover { border-color: var(--line-3); background: var(--panel-3); transform: translateY(-1px); }
.card.on { border-color: var(--accent-hi); box-shadow: 0 0 0 1px var(--accent-hi), 0 10px 28px -10px rgba(0, 21, 255, 0.55); background: #161729; }
.card-active { position: absolute; left: 6px; top: 6px; display: none; align-items: center; gap: 3px; padding: 2px 7px 2px 4px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 650; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
.card-active svg { width: 12px; height: 12px; stroke-width: 2.4; }
.card.on .card-active { display: inline-flex; }
.card-path { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: rgba(10, 10, 12, 0.66); color: #fff; backdrop-filter: blur(4px); }
.card-path svg { width: 14px; height: 14px; }
.gallery-empty { text-align: center; color: var(--text-2); padding: 28px 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.gallery-empty p { margin: 0; }
.gallery-empty .hint { max-width: 30ch; margin: -4px 0 4px; }
.empty-ic { width: 28px; height: 28px; color: var(--accent-fg); }
.row-center { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
/* view tabs: Presets | Inspiration */
.gal-tabs { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line-2); }
.gal-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 12px; font-weight: 650; }
.gal-tabs button:hover { color: var(--text); }
.gal-tabs button.on { background: var(--panel-4); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 3px rgba(0, 0, 0, 0.45); }
.gal-tabs button:focus-visible { outline-offset: -1px; }
/* curated looks of the active preset */
.looks-strip { margin: 0 0 14px; padding: 10px; border-radius: var(--radius); background: linear-gradient(180deg, rgba(71, 87, 255, 0.12), rgba(71, 87, 255, 0.03)); border: 1px solid rgba(140, 152, 255, 0.25); }
.looks-head { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; font-size: 12px; color: var(--text-2); }
.looks-head svg { width: 15px; height: 15px; color: var(--accent-fg); }
.looks-head strong { color: var(--text); font-weight: 650; }
.looks-head .count { margin-left: auto; }
.looks-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.look-card { position: relative; display: flex; flex-direction: column; cursor: pointer; text-align: left; outline-offset: 2px; }
.look-card.mini { border-radius: 8px; padding: 3px 3px 6px; background: var(--panel-2); border: 1px solid var(--line); transition: border-color 0.16s, transform 0.2s var(--ease-out), background 0.16s; }
.look-card.mini:hover { border-color: var(--line-3); background: var(--panel-3); transform: translateY(-1px); }
.look-card.mini .card-thumb { border-radius: 5px; }
.look-card.mini canvas { width: 100%; aspect-ratio: 16 / 9; display: block; }
.look-card.mini .card-name { padding: 5px 3px 0; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cards.inspiration .card-cat { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ───────────────────────────── stage ───────────────────────────── */
.center { grid-area: center; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--pasteboard); position: relative; }
.stagebar { display: flex; align-items: center; gap: 4px; height: var(--bar-h); padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--panel); flex: none; min-width: 0; }
.format-btn { gap: 8px; color: var(--text); }
.format-btn small { font: 500 11px/1 var(--mono); color: var(--text-3); }
.format-btn svg { width: 14px; height: 14px; color: var(--text-3); }
.fmt-glyph { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; width: 16px; height: 9px; flex: none; color: var(--text-2); }
.zoom-btn { font: 500 11.5px/1 var(--mono); color: var(--text-2); gap: 4px; min-width: 84px; }
.zoom-btn svg { width: 14px; height: 14px; }
.stage-hint { font-size: 12px; color: var(--text-2); margin-left: 8px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stage-hint.loading::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-3); border-top-color: var(--accent-fg); animation: spin360 0.8s linear infinite; flex: none; }
.stage-hint.editing { color: #fff; background: var(--accent); padding: 4px 10px; border-radius: 99px; font-weight: 600; font-size: 11.5px; }
@keyframes spin360 { to { transform: rotate(360deg); } }
.stage {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  background-color: var(--pasteboard);
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1.3px);
  background-size: 22px 22px;
  background-position: center;
}
.stage.zoomed { overflow: auto; }
.stage-inner { display: grid; place-items: center; min-width: 100%; min-height: 100%; width: max-content; height: max-content; }
.frame { position: relative; }
.frame-label { position: absolute; left: 0; right: 0; bottom: calc(100% + 9px); display: flex; justify-content: space-between; gap: 12px; font: 500 11px/1 var(--mono); color: var(--text-3); white-space: nowrap; pointer-events: none; }
.frame-label span:first-child { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; font-family: var(--ui); font-weight: 600; font-size: 11.5px; }
.artboard {
  position: relative; border-radius: 1px; touch-action: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09), 0 30px 80px -24px rgba(0, 0, 0, 0.9);
  background-color: #1d1d22;
  background-image: linear-gradient(45deg, #2a2a30 25%, transparent 25%), linear-gradient(-45deg, #2a2a30 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #2a2a30 75%), linear-gradient(-45deg, transparent 75%, #2a2a30 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.artboard:focus-visible { outline-offset: 4px; }
.artboard canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: opacity 0.35s; }
.artboard.loading canvas { opacity: 0; }
.artboard.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.artboard.flash { animation: flash 0.6s var(--ease-out); }
@keyframes flash { 0% { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09), 0 0 0 0 rgba(140, 152, 255, 0.6), 0 30px 80px -24px rgba(0, 0, 0, 0.9); } 100% { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09), 0 0 0 14px rgba(140, 152, 255, 0), 0 30px 80px -24px rgba(0, 0, 0, 0.9); } }
.path-overlay { position: absolute; inset: 0; overflow: visible; pointer-events: none; z-index: 3; }
/* The preview simplified heavy effects this frame (exports never do); a paused frame redraws at full quality. */
.draft-badge { position: absolute; top: 8px; right: 8px; z-index: 4; padding: 3px 8px; border-radius: 99px; background: rgba(12, 12, 15, 0.78); border: 1px solid rgba(255, 255, 255, 0.16); color: #e6e6ec; font: 600 10.5px/1.4 var(--ui); letter-spacing: 0.02em; backdrop-filter: blur(4px); cursor: help; user-select: none; }
.editing-path .draft-badge, body.clean .draft-badge { display: none; }
.editing-path .path-overlay { pointer-events: auto; }
.editing-path .artboard { box-shadow: 0 0 0 1px var(--accent-hi), 0 30px 80px -24px rgba(0, 0, 0, 0.9); }
/* Selection: two-tone lines read on light and dark artwork alike. */
.sel-box, .hover-box { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 2; border-radius: 2px; }
.hover-box { box-shadow: 0 0 0 1px rgba(140, 152, 255, 0.9), 0 0 0 2px rgba(0, 0, 0, 0.35); }
.sel-box { opacity: 0; transition: opacity 0.15s; box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(0, 21, 255, 0.9), 0 0 0 3px rgba(0, 0, 0, 0.25); }
.artboard.hovering .sel-box, .artboard.dragging .sel-box, .artboard:focus-visible .sel-box { opacity: 1; }
.sel-box i { position: absolute; width: 7px; height: 7px; background: #fff; border: 1.5px solid var(--accent); border-radius: 1px; }
.sel-box i:nth-child(1) { left: -4px; top: -4px; } .sel-box i:nth-child(2) { right: -4px; top: -4px; }
.sel-box i:nth-child(3) { left: -4px; bottom: -4px; } .sel-box i:nth-child(4) { right: -4px; bottom: -4px; }
.sel-box:not(.movable) i { display: none; }
.artboard.dragging { cursor: move; }
.snap { position: absolute; z-index: 2; pointer-events: none; background: #ff3d8b; }
.snap.v { left: 50%; top: 0; bottom: 0; width: 1px; }
.snap.h { top: 50%; left: 0; right: 0; height: 1px; }
.guides { position: absolute; inset: 0; pointer-events: none; display: none; z-index: 2; mix-blend-mode: difference; }
.show-guides .guides { display: block; }
.guides i { position: absolute; display: block; }
.guides b { position: absolute; left: 4px; top: 3px; font: 500 9.5px/1 var(--mono); color: #fff; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.8; }
.guides .action-safe { inset: 5%; border: 1px dashed rgba(255, 255, 255, 0.6); }
.guides .title-safe { inset: 10%; border: 1px solid rgba(255, 255, 255, 0.45); }
.guides .cross { inset: 0; background: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)) center / 1px 100% no-repeat, linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)) center / 100% 1px no-repeat; }
.guides .story-top, .guides .story-bottom { left: 0; right: 0; display: none; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 6px, transparent 6px 12px); }
.guides .story-top { top: 0; height: 13%; border-bottom: 1px dashed rgba(255, 255, 255, 0.6); }
.guides .story-bottom { bottom: 0; height: 18%; border-top: 1px dashed rgba(255, 255, 255, 0.6); }
.artboard.story .guides .story-top, .artboard.story .guides .story-bottom { display: block; }
/* Empty state: one dark card, readable on any artwork colour. */
.art-empty { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.art-empty-card { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 32ch; padding: 16px 18px; border-radius: 12px; background: rgba(12, 12, 15, 0.86); border: 1px solid rgba(255, 255, 255, 0.12); color: #fff; text-align: center; backdrop-filter: blur(8px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); }
.art-empty-msg { margin: 0; font-size: 13px; line-height: 1.45; }

/* ───────────────────────────── timeline ───────────────────────────── */
/* One grid for the transport row and every lane (subgrid), so lanes line up with the ruler. */
.timeline {
  --tl-left: 228px; --tl-right: 136px; --tl-gap: 14px;
  flex: none; display: grid; grid-template-columns: var(--tl-left) minmax(0, 1fr) var(--tl-right); column-gap: var(--tl-gap); align-items: center;
  padding: 0 16px; border-top: 1px solid var(--line); background: var(--panel); min-width: 0;
}
.tl-left { display: flex; align-items: center; gap: 14px; height: var(--tl-h); min-width: 0; }
.tl-buttons { display: flex; align-items: center; gap: 4px; flex: none; }
.play { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--text); color: #0a0a0c; display: grid; place-items: center; flex: none; transition: transform 0.14s, background 0.14s, box-shadow 0.2s; box-shadow: 0 4px 14px -6px rgba(255, 255, 255, 0.4); }
.play svg { fill: currentColor; stroke: none; width: 17px; height: 17px; }
.play .i-pause { display: none; }
.play.playing .i-pause { display: block; }
.play.playing .i-play { display: none; }
.play:hover { background: #fff; transform: scale(1.05); }
.play:active { transform: scale(0.96); }
.tl-clock { display: flex; flex-direction: column; gap: 3px; flex: none; width: 86px; contain: layout paint; }
.timecode { font: 600 15px/1 var(--mono); color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.frame-no { font: 500 10.5px/1 var(--mono); color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-track { grid-column: 2; position: relative; min-width: 80px; height: 30px; cursor: ew-resize; touch-action: none; border-radius: 6px; contain: layout; }
.tl-track:focus-visible { outline-offset: 3px; }
.tl-ruler { position: absolute; left: 0; top: 4px; width: 100%; height: 22px; display: block; }
.tl-played { position: absolute; left: 0; bottom: 2px; height: 2px; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--accent-hi); border-radius: 2px; pointer-events: none; }

/* lanes: one row per layer */
.tl-lanes { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; row-gap: 4px; position: relative; padding: 8px 0 12px; border-top: 1px solid var(--line); max-height: 220px; overflow-y: auto; overflow-x: hidden; }
.tl-lanes:empty { display: none; }
.tl-lane-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; height: 26px; }
.tl-lane-label { display: flex; align-items: center; gap: 8px; min-width: 0; height: 26px; padding: 0 8px 0 4px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 12px; font-weight: 600; text-align: left; }
.tl-lane-label span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-lane-label:hover { color: var(--text); background: var(--panel-2); }
.tl-lane-row.on .tl-lane-label { color: var(--text); background: var(--accent-soft); }
.tl-lane-row.hidden-layer { opacity: 0.45; }
.layer-chip.sm { width: 20px; height: 20px; border-radius: 5px; font-size: 12px; }
.tl-lane { position: relative; height: 22px; border-radius: 6px; background: rgba(255, 255, 255, 0.03); box-shadow: inset 0 0 0 1px var(--line); cursor: grab; touch-action: none; }
.tl-lane:focus-visible { outline-offset: 2px; }
.tl-lane.dragging { cursor: grabbing; }
.tl-lane.snapped .tl-start { background: #ff3d8b; box-shadow: 0 0 0 1px rgba(255, 61, 139, 0.5); }
.tl-lane-bar { position: absolute; inset: 0; overflow: hidden; border-radius: 6px; }
.tl-pass { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; overflow: hidden; background: rgba(140, 152, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(140, 152, 255, 0.3); }
.tl-lane-row.on .tl-pass { background: rgba(71, 87, 255, 0.3); box-shadow: inset 0 0 0 1px rgba(140, 152, 255, 0.6); }
.tl-pass + .tl-pass { margin-left: 1px; }
.tl-ph { position: absolute; top: 0; bottom: 0; }
.tl-ph.in { background: linear-gradient(90deg, rgba(140, 152, 255, 0.05), rgba(140, 152, 255, 0.4)); }
.tl-ph.hold { background: rgba(255, 255, 255, 0.04); }
.tl-ph.out { background: linear-gradient(90deg, rgba(140, 152, 255, 0.4), rgba(140, 152, 255, 0.05)); }
.tl-wait { position: absolute; top: 0; bottom: 0; background: linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.22)) left center / 100% 1px no-repeat; opacity: 0.6; }
.tl-hold { position: absolute; top: 3px; bottom: 3px; border-radius: 0 4px 4px 0; display: flex; align-items: center; padding-left: 6px; overflow: hidden; background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0 3px, transparent 3px 7px); }
.tl-hold span { font: 600 9.5px/1 var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.tl-start { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); pointer-events: none; z-index: 1; }
.tl-lane-ctl { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.tl-cycles { height: 24px; width: 54px; padding: 0 6px; font: 500 11px var(--mono); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 6px; cursor: pointer; }
.tl-mode { width: 26px; height: 26px; }
.tl-vhead { position: absolute; top: 0; bottom: 0; left: calc(var(--tl-left) + var(--tl-gap)); width: 0; pointer-events: none; z-index: 3; will-change: transform; }
.tl-vhead::before { content: ""; position: absolute; left: -0.5px; top: 0; bottom: 0; width: 1.5px; background: rgba(255, 255, 255, 0.8); }
.tl-edge { position: absolute; top: -3px; bottom: -3px; width: 12px; margin-left: -6px; cursor: ew-resize; z-index: 2; border-radius: 4px; }
.tl-edge::after { content: ""; position: absolute; left: 5px; top: 3px; bottom: 3px; width: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.55); transition: background 0.12s; }
.tl-edge:hover::after, .tl-edge:focus-visible::after { background: #fff; }
.tl-playhead { position: absolute; left: 0; top: -3px; bottom: -3px; width: 0; pointer-events: none; z-index: 3; will-change: transform; }
.tl-playhead::before { content: ""; position: absolute; left: -0.5px; top: 6px; bottom: 0; width: 1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4); }
.tl-playhead i { position: absolute; left: -6px; top: 0; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); border: 1.5px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.tl-track.scrubbing .tl-playhead i { transform: scale(1.15); }
.tl-loop { grid-column: 3; justify-self: end; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: 600 12px/1 var(--mono); }
.tl-loop svg { width: 14px; height: 14px; color: var(--accent-fg); }
.tl-loop small { font: 500 10.5px/1 var(--mono); color: var(--text-3); }
.tl-loop:hover { border-color: var(--line-3); background: var(--panel-3); }

/* ───────────────────────────── inspector ───────────────────────────── */
.inspector { overflow-y: auto; height: 100%; padding-bottom: 48px; }
.insp-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 11px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.insp-id { min-width: 0; }
.insp-name { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-name.empty { color: var(--text-3); font-style: italic; }
.insp-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec { border-bottom: 1px solid var(--line); }
.sec-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; background: transparent; border: 0; text-align: left; }
.sec-head:focus-visible { outline-offset: -2px; }
.sec-idx { font: 500 10.5px/1 var(--mono); color: var(--text-3); }
.sec-title { font-size: 11px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); flex: 1; }
.sec-head:hover .sec-title { color: var(--text); }
.sec-badge { font-size: 10.5px; color: var(--text-3); }
.sec-chevron { width: 7px; height: 7px; border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3); transform: rotate(45deg) translateY(-2px); transition: transform 0.18s var(--ease-out); margin-right: 3px; }
.sec.collapsed .sec-chevron { transform: rotate(-45deg); }
.sec.collapsed .sec-body { display: none; }
.sec-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 9px; }
.slot { display: contents; }
.sub { font-size: 10.5px; font-weight: 650; color: var(--text-3); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.hint { margin: -2px 0 2px; color: var(--text-3); font-size: 12px; line-height: 1.45; }
.hint.small { font-size: 11.5px; margin: 0; }
.row-end { display: flex; justify-content: flex-end; gap: 6px; }
.preset-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.preset-name { font-weight: 650; font-size: 13.5px; margin-right: 2px; }
.tag-chip { font-size: 10.5px; font-weight: 600; color: var(--text-2); padding: 2px 7px; border-radius: 99px; background: var(--panel-3); border: 1px solid var(--line-2); }
.preset-line .link-btn { margin-left: auto; }
/* Notes in the Motion panel: photosensitivity (warn) and the Stack width-axis tip (info). */
.flash-warn, .axis-tip { display: flex; align-items: flex-start; gap: 9px; padding: 9px 11px; border-radius: 9px; font-size: 12px; line-height: 1.45; color: var(--text-2); }
.flash-warn > svg, .axis-tip > svg { width: 16px; height: 16px; margin-top: 1px; }
.flash-warn p, .axis-tip p { margin: 0; }
.flash-warn { background: rgba(255, 181, 71, 0.08); border: 1px solid rgba(255, 181, 71, 0.45); }
.flash-warn > svg, .flash-warn b { color: var(--warn); }
.flash-warn b { display: block; margin-bottom: 2px; font-weight: 650; }
.flash-warn .fw-foot { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.flash-warn .fw-foot:empty { display: none; }
.flash-warn .fw-state { color: var(--text-3); font-size: 11px; }
.flash-warn.stale { opacity: 0.7; }
.axis-tip { background: var(--accent-soft); border: 1px solid rgba(140, 152, 255, 0.3); }
.axis-tip > svg { color: var(--accent-fg); }
.axis-tip b { color: var(--text); font-weight: 650; }
.axis-fonts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.axis-fonts .btn { font-size: 13px; font-weight: 700; }
.pal-head { display: flex; align-items: center; justify-content: space-between; }
.lbl, .ctl > label { color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }

/* ── controls ── */
.ctl { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 28px; }
.ctl-range { grid-template-columns: 92px minmax(0, 1fr) 58px; }
.ctl-range .scrub { cursor: ew-resize; padding: 4px 0; }
.ctl-range .scrub:hover { color: var(--text); }
.ctl-range .scrub.scrubbing { color: var(--accent-fg); }
.num, .hex, select, textarea {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 4px 7px; min-width: 0; transition: border-color 0.14s, background 0.14s;
}
.num:hover, .hex:hover, select:hover, textarea:hover { border-color: var(--line-3); }
.num { font: 500 11.5px var(--mono); text-align: right; width: 58px; height: 26px; font-variant-numeric: tabular-nums; }
.num.wide { width: 72px; text-align: left; }
.num:focus, .hex:focus, select:focus, textarea:focus { border-color: var(--accent-hi); outline: none; background: var(--panel); box-shadow: 0 0 0 3px rgba(71, 87, 255, 0.2); }
.select-wrap { position: relative; display: flex; min-width: 0; }
select { height: 30px; width: 100%; appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer; }
.select-caret { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
optgroup, option { background: var(--panel-2); color: var(--text); }
.ctl.ctl-text { grid-template-columns: 1fr; gap: 6px; }
.ta-wrap { position: relative; }
textarea { width: 100%; resize: none; font: 600 15px/1.3 var(--ui); padding: 9px 11px; min-height: 44px; letter-spacing: 0.005em; display: block; }
textarea::placeholder { color: var(--text-3); font-weight: 500; }
.ta-count { position: absolute; right: 8px; bottom: 6px; font: 500 10px/1 var(--mono); color: var(--text-3); pointer-events: none; }
.ta-count.warn { color: var(--warn); }
.ctl-toggle input { justify-self: end; appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line-3); position: relative; cursor: pointer; transition: background 0.18s; margin: 0; }
.ctl-toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease-out); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.ctl-toggle input:checked { background: var(--accent-hi); }
.ctl-toggle input:checked::after { transform: translateX(14px); }
.seg { display: flex; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; gap: 2px; min-width: 0; }
.seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; height: 24px; border: 0; background: transparent; color: var(--text-2); border-radius: 6px; padding: 0 4px; font-size: 11.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: background 0.14s, color 0.14s; }
.seg button svg { width: 16px; height: 16px; }
.seg button:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.seg button.on { background: var(--panel-4); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 3px rgba(0, 0, 0, 0.45); }
.seg button:focus-visible { outline-offset: -1px; }
.ctl-select { position: relative; }
.ctl-select .ease-preview { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); width: 28px; height: 16px; pointer-events: none; }
.color-pair { display: flex; gap: 6px; align-items: center; min-width: 0; }
.swatch { flex: none; width: 30px; height: 28px; padding: 3px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel-2); transition: border-color 0.14s; }
.swatch:hover { border-color: var(--line-3); }
.swatch i { display: block; width: 100%; height: 100%; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.native-color { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.hex { width: 100%; height: 28px; font: 500 11.5px var(--mono); text-transform: lowercase; }
.ctl-size .size-pair { display: flex; align-items: center; gap: 6px; }
.times, .unit { color: var(--text-3); font-size: 12px; }
.field-btn { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; text-align: left; border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px; padding: 0 8px 0 10px; transition: border-color 0.14s, background 0.14s; }
.field-btn:hover { border-color: var(--line-3); background: var(--panel-3); }
.field-btn[aria-expanded="true"] { border-color: var(--accent-hi); box-shadow: 0 0 0 3px rgba(71, 87, 255, 0.2); }
.field-caret { width: 14px; height: 14px; color: var(--text-3); margin-left: auto; }
.font-btn { height: 44px; }
.font-stack { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.font-name { font-size: 17px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-meta { font-size: 10.5px; color: var(--text-3); letter-spacing: 0.02em; }
.ctl-font { grid-template-columns: 92px minmax(0, 1fr); }
.ease-btn { height: 30px; padding-left: 6px; }
.ease-thumb { width: 32px; height: 20px; border-radius: 4px; background: rgba(255, 255, 255, 0.04); flex: none; }
.ease-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palettes { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 4px; }
.pal { height: 30px; border-radius: 7px; border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; gap: 2px; padding: 0; transition: transform 0.14s var(--ease-out), border-color 0.14s; }
.pal i { width: 7px; height: 7px; border-radius: 50%; display: block; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18); }
.pal:hover { transform: translateY(-1px); border-color: var(--text-2); }
.pal.brand { box-shadow: 0 0 0 1px var(--accent-hi); border-color: var(--accent-hi); position: relative; }
.pal.brand::after { content: "★"; position: absolute; top: -6px; right: -5px; font-size: 9px; line-height: 14px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); color: #fff; text-align: center; }

/* range inputs (shared) */
input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; height: 22px; min-width: 0; margin: 0; cursor: pointer; --pct: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent-hi) var(--pct), var(--line-3) var(--pct)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: var(--line-3); }
input[type="range"]::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--accent-hi); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 3px rgba(71, 87, 255, 0), 0 1px 4px rgba(0, 0, 0, 0.6); transition: box-shadow 0.15s, transform 0.15s; }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
input[type="range"]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(71, 87, 255, 0.28), 0 1px 4px rgba(0, 0, 0, 0.6); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--focus); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--focus); }

/* ───────────────────────────── popovers + menus ───────────────────────────── */
.pop {
  position: fixed; z-index: 60; display: flex; flex-direction: column; max-height: calc(100vh - 16px);
  background: var(--pop); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-4px) scale(0.985); transform-origin: top right; transition: opacity 0.14s, transform 0.18s var(--ease-out);
}
.pop.in { opacity: 1; transform: none; }
.pop.out { opacity: 0; transform: translateY(-2px) scale(0.99); pointer-events: none; }
.pop-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px 14px; flex: none; }
.pop-title { font-size: 11px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); flex: 1; }
.pop-body { padding: 6px 12px 12px; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.pop-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(0, 0, 0, 0.45); }
.pop.as-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto !important; max-height: 72vh; border-radius: 16px 16px 0 0; border-bottom: 0; transform: translateY(24px); padding-bottom: env(safe-area-inset-bottom); }
.pop.as-sheet.in { transform: none; }
.menu .pop-body { padding: 6px; gap: 1px; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 5px 8px; border: 0; border-radius: 7px; background: transparent; text-align: left; color: var(--text); font-size: 12.5px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-4); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.menu-item.danger { color: var(--hot); }
.menu-item:disabled { opacity: 0.4; }
.menu-ic { width: 16px; height: 16px; display: grid; place-items: center; color: var(--text-2); flex: none; }
.menu-ic svg { width: 16px; height: 16px; }
.menu-item[aria-checked="true"] .menu-ic { color: var(--accent-fg); }
.menu-label { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.menu-label small { color: var(--text-3); font-size: 11px; }
.menu-item kbd { margin-left: 8px; }
.menu-sep { height: 1px; background: var(--line-2); margin: 5px 4px; }
.menu-heading { font-size: 10.5px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); padding: 8px 8px 4px; }

/* ───────────────────────────── font picker ───────────────────────────── */
.font-pop .pop-body { gap: 8px; padding-bottom: 0; }
.fp-top { display: flex; flex-direction: column; gap: 8px; }
.fp-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.fp-chips .chip { height: 24px; padding: 0 8px; font-size: 11.5px; }
.fp-list { overflow-y: auto; max-height: 300px; margin: 0 -12px; padding: 0 6px 6px; border-top: 1px solid var(--line); }
.fp-group { position: sticky; top: 0; z-index: 1; background: var(--pop); font-size: 10.5px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); padding: 10px 8px 4px; }
.fp-opt { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 8px; border-radius: 7px; cursor: pointer; }
.fp-opt.active { background: var(--panel-4); }
.fp-opt.current .fp-name { color: #fff; }
.fp-name { flex: 1; font-size: 18px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.fp-meta { display: inline-flex; align-items: center; gap: 5px; font: 500 10.5px/1 var(--mono); color: var(--text-3); white-space: nowrap; }
.fp-badge { font: 650 9.5px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 5px; border-radius: 4px; color: var(--accent-fg); background: var(--accent-soft); }
.fp-badge.local { color: var(--warn); background: rgba(255, 181, 71, 0.12); }
.fp-badge.axis { font: 600 9.5px/1 var(--mono); letter-spacing: 0.02em; text-transform: none; color: var(--text-2); background: var(--panel-3); }
.fp-check { width: 16px; height: 16px; color: var(--accent-fg); stroke-width: 2.2; }
.fp-empty { color: var(--text-2); font-size: 12.5px; text-align: center; margin: 14px 0; }
.fp-foot { margin: 0 -12px; padding: 10px 12px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.fp-upload { justify-content: flex-start; height: 36px; }
.fp-upload small { margin-left: auto; font: 500 10px/1 var(--mono); color: var(--text-3); }
.fp-upload.busy { opacity: 0.6; }
.fp-note { display: flex; gap: 7px; margin: 0; font-size: 11.5px; line-height: 1.4; color: var(--text-3); }
.fp-note svg { width: 14px; height: 14px; margin-top: 1px; color: var(--text-3); }

/* ───────────────────────────── curve editor ───────────────────────────── */
.curve-pop .pop-body { gap: 10px; }
.ce-graph { position: relative; width: 280px; height: 164px; align-self: center; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); touch-action: none; cursor: crosshair; }
.ce-graph canvas { display: block; }
.ce-handle { position: absolute; left: 0; top: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid var(--accent-hi); background: #fff; padding: 0; cursor: grab; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); transition: box-shadow 0.12s; }
.ce-handle:hover { box-shadow: 0 0 0 5px rgba(71, 87, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.5); }
.ce-handle.approx { background: var(--pop); border-style: dashed; border-color: rgba(255, 255, 255, 0.55); }
.ce-graph.dragging, .ce-graph.dragging .ce-handle { cursor: grabbing; }
.ce-row { display: flex; align-items: center; gap: 8px; }
.ce-name { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--text); }
.ce-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ce-field { display: flex; flex-direction: column; gap: 3px; font: 500 10px/1 var(--mono); color: var(--text-3); }
.ce-field .num { width: 100%; text-align: left; }
.ce-field .num.approx { color: var(--text-3); }
.ce-preview { display: flex; align-items: center; gap: 8px; }
.ce-track { position: relative; flex: 1; height: 22px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); }
.ce-dot, .ce-ghost { position: absolute; left: 4px; top: 3px; width: 14px; height: 14px; border-radius: 50%; }
.ce-dot { background: var(--accent-hi); box-shadow: 0 0 12px rgba(71, 87, 255, 0.7); }
.ce-ghost { background: transparent; border: 1.5px dashed rgba(255, 255, 255, 0.28); }
.ce-tabs { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.ce-tab { flex: 1; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 11px; font-weight: 600; padding: 0 2px; white-space: nowrap; }
.ce-tab:hover { color: var(--text); }
.ce-tab.on { background: var(--panel-4); color: #fff; }
.ce-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ce-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text-2); font-size: 10.5px; font-weight: 600; transition: border-color 0.14s, background 0.14s; }
.ce-tile canvas { display: block; }
.ce-tile:hover { border-color: var(--line-3); color: var(--text); }
.ce-tile.on { border-color: var(--accent-hi); background: #181a33; color: #fff; }

/* ───────────────────────────── colour picker ───────────────────────────── */
.color-pop .pop-body { gap: 10px; }
.cp-sv { position: relative; height: 150px; border-radius: 8px; cursor: crosshair; touch-action: none; background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, var(--hue, #f00)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.cp-thumb { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.4); pointer-events: none; }
.cp-hue { width: 100%; height: 14px; }
.cp-hue::-webkit-slider-runnable-track { height: 10px; border-radius: 99px; background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00) !important; }
.cp-hue::-moz-range-track { height: 10px; border-radius: 99px; background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.cp-hue::-moz-range-progress { background: transparent; }
.cp-hue::-webkit-slider-thumb { margin-top: -2px; width: 14px; height: 14px; border: 2px solid #fff; background: transparent; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.cp-row { display: flex; align-items: center; gap: 6px; }
.cp-chip { flex: none; width: 28px; height: 28px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.cp-group { display: flex; flex-direction: column; gap: 6px; }
.cp-label { font-size: 10.5px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.cp-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-sw { width: 24px; height: 24px; border-radius: 6px; border: 0; padding: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); transition: transform 0.12s var(--ease-out); }
.cp-sw:hover { transform: scale(1.1); }
.cp-sw.on { box-shadow: 0 0 0 2px var(--pop), 0 0 0 4px var(--accent-fg); }
.cp-sw.add { display: grid; place-items: center; background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-3); border: 0; }
.cp-sw.add svg { width: 14px; height: 14px; }

/* ───────────────────────────── modal ───────────────────────────── */
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(4, 4, 6, 0.6); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.16s; }
.modal-wrap.in { opacity: 1; }
.modal { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--pop); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-pop); transform: translateY(8px) scale(0.99); transition: transform 0.22s var(--ease-out); }
.modal-wrap.in .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 6px 22px; }
.modal-head h2 { margin: 0; font: 400 26px/1 var(--display); letter-spacing: 0.02em; text-transform: uppercase; }
.modal-body { padding: 10px 22px 20px; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.modal-foot .hint { margin: 0; }
/* "Install fonts?" before a project file adds fonts to this browser */
.modal.confirm-fonts { width: min(460px, 100%); }
.confirm-fonts .modal-body p { margin: 0 0 10px; line-height: 1.5; }
.cf-list { list-style: none; margin: 4px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cf-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line-2); }
.cf-list span { color: var(--text-3); font: 500 11.5px var(--mono); }
.cf-foot { justify-content: flex-end; }
.sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px 28px; }
.sc-group h3 { margin: 0 0 8px; font-size: 10.5px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-fg); }
.sc-group dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; align-items: center; }
.sc-group dt { display: flex; gap: 4px; justify-content: flex-end; min-width: 92px; }
.sc-group dd { margin: 0; color: var(--text-2); font-size: 12.5px; }

/* ───────────────────────────── onboarding ───────────────────────────── */
.coach { position: fixed; z-index: 70; width: 268px; padding: 16px; border-radius: 12px; background: var(--pop); border: 1px solid var(--accent-hi); box-shadow: var(--shadow-pop), 0 0 0 4px rgba(71, 87, 255, 0.14); animation: coach-in 0.32s var(--ease-out); }
@keyframes coach-in { from { opacity: 0; transform: translateY(6px); } }
.coach-step { font: 500 10.5px/1 var(--mono); color: var(--text-3); }
.coach-step span { color: var(--accent-fg); }
.coach h3 { margin: 10px 0 6px; font: 400 24px/1 var(--display); letter-spacing: 0.02em; text-transform: uppercase; }
.coach p { margin: 0 0 14px; color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.coach-actions { display: flex; justify-content: flex-end; gap: 6px; }
.coach-ring { position: fixed; z-index: 69; pointer-events: none; border-radius: 12px; box-shadow: 0 0 0 2px var(--accent-fg), 0 0 0 6px rgba(140, 152, 255, 0.2); animation: ring 1.8s ease-in-out infinite; }
@keyframes ring { 50% { box-shadow: 0 0 0 2px var(--accent-fg), 0 0 0 10px rgba(140, 152, 255, 0.06); } }

/* ───────────────────────────── tooltips ───────────────────────────── */
.tip { position: fixed; z-index: 90; pointer-events: none; display: flex; align-items: center; gap: 8px; max-width: 280px; padding: 6px 9px; border-radius: 7px; background: #26262c; border: 1px solid #36363e; color: var(--text); font-size: 11.5px; line-height: 1.35; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); opacity: 0; transform: translateY(-2px); transition: opacity 0.12s, transform 0.12s; }
.tip.on { opacity: 1; transform: none; }
.tip kbd { background: rgba(255, 255, 255, 0.07); }

/* ───────────────────────────── toasts ───────────────────────────── */
/* Below the stage bar, so a toast never covers its hint ("Editing path…", "Loading fonts…"). */
#toasts { position: fixed; top: calc(var(--top-h) + var(--bar-h) + 10px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 85; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: #1d1d22; border: 1px solid var(--line-3); padding: 9px 10px 9px 12px; border-radius: 10px; box-shadow: 0 14px 34px -8px rgba(0, 0, 0, 0.6); font-size: 12.5px; max-width: min(520px, calc(100vw - 24px)); animation: toast-in 0.28s var(--ease-out); transition: opacity 0.25s, transform 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
.toast-ic { width: 16px; height: 16px; color: var(--accent-fg); }
.toast.error { border-color: rgba(255, 90, 60, 0.55); }
.toast.error .toast-ic { color: var(--hot); }
.toast.ok .toast-ic { color: var(--ok); }
.toast-msg { line-height: 1.4; }
.toast-act { border: 0; background: var(--panel-4); color: var(--text); font-weight: 650; font-size: 12px; padding: 5px 10px; border-radius: 6px; margin-left: 4px; }
.toast-act:hover { background: var(--line-3); }
.toast.out { opacity: 0; transform: translateY(-6px); }

/* ───────────────────────────── states ───────────────────────────── */
.boot-state { position: absolute; inset: 0; display: none; place-items: center; text-align: center; z-index: 4; background: var(--pasteboard); }
.booting .boot-state, .boot-failed .boot-state { display: grid; }
.boot-loading, .boot-error { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text-2); max-width: 36ch; padding: 20px; }
.boot-loading p, .boot-error p { margin: 0; }
.boot-error { display: none; }
.boot-failed .boot-loading { display: none; }
.boot-failed .boot-error { display: flex; }
.slow-boot .boot-loading p::after { content: " This is taking longer than usual."; }
.booting .panel > *, .booting .timeline > *, .booting .stagebar > *,
.boot-failed .panel > *, .boot-failed .timeline > *, .boot-failed .stagebar > *, .boot-failed .project, .boot-failed .tools { visibility: hidden; }
.booting .panel { background-image: linear-gradient(var(--panel-2), var(--panel-2)), linear-gradient(var(--panel-2), var(--panel-2)), linear-gradient(var(--panel-2), var(--panel-2)); background-repeat: no-repeat; background-size: calc(100% - 32px) 34px, calc(100% - 32px) 120px, calc(100% - 32px) 120px; background-position: 16px 56px, 16px 104px, 16px 236px; }
.clean-hint { display: none; }
.drop-overlay { position: fixed; inset: 10px; z-index: 95; display: grid; place-items: center; border: 2px dashed var(--accent-fg); border-radius: 16px; background: rgba(10, 10, 14, 0.82); backdrop-filter: blur(4px); text-align: center; pointer-events: none; }
.drop-overlay svg { width: 40px; height: 40px; color: var(--accent-fg); }
.drop-overlay p { margin: 10px 0 4px; font: 400 26px/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.drop-overlay small { color: var(--text-2); }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }

/* clean preview: every piece of chrome steps aside */
body.clean { grid-template-columns: 100%; grid-template-rows: 100%; grid-template-areas: "center"; }
body.clean .topbar, body.clean .panel, body.clean .stagebar, body.clean .timeline, body.clean .tabs, body.clean .sheet-handle, body.clean .frame-label,
body.clean .guides, body.clean .sel-box, body.clean .hover-box, body.clean .snap { display: none !important; }
body.clean .center, body.clean .stage { background: #050506; }
body.clean .artboard { box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.9); cursor: pointer; }
body.clean .clean-hint { display: flex; position: fixed; left: 50%; bottom: 14px; transform: translate(-50%, 8px); z-index: 20; align-items: center; gap: 10px; padding: 5px 5px 5px 12px; border-radius: 99px; background: rgba(24, 24, 28, 0.86); border: 1px solid var(--line-2); backdrop-filter: blur(8px); font-size: 12px; color: var(--text-2); opacity: 0; transition: opacity 0.3s, transform 0.3s var(--ease-out); }
body.clean .clean-hint.show, body.clean .clean-hint:hover, body.clean .clean-hint:focus-within, body.clean .center:hover ~ .clean-hint { opacity: 1; transform: translate(-50%, 0); }

/* ───────────────────────────── responsive ───────────────────────────── */
@media (max-width: 1279px) {
  :root { --left-w: 256px; --right-w: 304px; }
  .scene-name { width: 16ch; }
  .ctl { grid-template-columns: 84px minmax(0, 1fr); }
  .ctl-range { grid-template-columns: 84px minmax(0, 1fr) 54px; }
  .num { width: 54px; }
  .hint-inline { display: none; }
}
@media (max-width: 1100px) {
  :root { --left-w: 228px; --right-w: 288px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .btn.remix span, #shareBtn span { display: none; }
  .btn.remix { padding: 0 9px; }
  #shareBtn { width: 32px; padding: 0; }
  .save-state span { display: none; }
  .save-state { min-width: 0; }
  .tl-clock { width: 74px; }
  .timeline { --tl-left: 196px; --tl-right: 124px; }
}
@media (max-width: 859px) {
  /* The stage area holds a slim stage bar (44 px) above the artboard, so it is that much taller. */
  :root { --top-h: 50px; --bar-h: 44px; --stage-h: min(52vh, calc(56.25vw + 142px)); --tabs-h: 58px; --tl-h: 52px; }
  body {
    grid-template-columns: 100%;
    grid-template-rows: var(--top-h) var(--stage-h) minmax(0, 1fr) calc(var(--tabs-h) + env(safe-area-inset-bottom));
    grid-template-areas: "top" "center" "sheet" "tabs";
    transition: grid-template-rows 0.28s var(--ease-out);
  }
  body.sheet-full { --stage-h: 168px; }
  .topbar { gap: 6px; padding: 0 8px 0 10px; }
  .crumb, .project, .sep, .split .caret, .hide-phone { display: none !important; }
  .show-phone { display: inline-flex !important; }
  .wordmark { font-size: 19px; }
  .tools { gap: 2px; }
  .btn.remix span { display: none; }
  .btn.remix { padding: 0; width: 36px; border-radius: 8px !important; }
  #exportBtn { padding: 0 12px; }
  .icon-btn, .btn { height: 36px; }
  .icon-btn { width: 36px; }
  /* Phone stage bar: format and Edit path. Guides, clean preview and zoom live in the ··· menu. */
  .stagebar { padding: 0 6px; gap: 2px; }
  #guidesBtn, #cleanBtn, #zoomBtn, .format-btn small { display: none !important; }
  .stage-hint { margin-left: 2px; }
  body.sheet-full .stagebar { display: none; } /* the expanded sheet keeps the small stage for the artwork */
  .frame-label { display: none; }
  .timeline { --tl-left: auto; --tl-right: auto; --tl-gap: 8px; padding: 0 10px; }
  .tl-left { gap: 8px; }
  .tl-lanes { display: none; } /* phones edit per-layer timing in Edit → Motion → Layer timing */
  .tl-buttons .icon-btn { width: 32px; }
  .tl-clock { width: 52px; }
  .timecode { font-size: 13px; }
  .frame-no { display: none; }
  .tl-loop small, .tl-loop svg { display: none; }
  .tl-loop { padding: 0 8px; height: 30px; }
  .tl-track { height: 40px; }
  .panel.left, .panel.right { grid-area: sheet; border: 0; border-top: 1px solid var(--line); }
  body[data-tab="presets"] .panel.right, body[data-tab="layers"] .panel.right { display: none; }
  body[data-tab="edit"] .panel.left { display: none; }
  body[data-tab="presets"] .layers-sec { display: none; }
  body[data-tab="layers"] .presets-sec { display: none; }
  body[data-tab="layers"] .layers-sec { max-height: none; flex: 1; border: 0; overflow-y: auto; }
  body[data-tab="layers"] .layer-list { flex: none; overflow: visible; }
  body[data-tab="layers"] .layer-timing { display: block; border-top: 1px solid var(--line); }
  .layer-row { height: 52px; }
  .layer-row .eye, .grip { opacity: 1; }
  .panel-head { padding-top: 16px; }
  .presets-sec .panel-head { display: none; }
  .gallery-top { padding-top: 14px; }
  .insp-head { padding-top: 16px; }
  .sheet-handle { display: grid; grid-area: sheet; align-self: start; justify-self: center; z-index: 6; width: 64px; height: 18px; place-items: center; border: 0; background: transparent; padding: 0; margin-top: 1px; }
  .sheet-handle i { width: 36px; height: 4px; border-radius: 4px; background: var(--line-3); }
  .tabs { grid-area: tabs; display: flex; border-top: 1px solid var(--line); background: var(--panel); padding-bottom: env(safe-area-inset-bottom); }
  .tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--text-3); font-weight: 600; font-size: 11px; position: relative; }
  .tabs button svg { width: 20px; height: 20px; }
  .tabs button[aria-selected="true"] { color: var(--text); }
  .tabs button[aria-selected="true"]::before { content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--accent-hi); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ctl { grid-template-columns: 96px minmax(0, 1fr); min-height: 34px; }
  .ctl-range { grid-template-columns: 96px minmax(0, 1fr) 58px; }
  .num { width: 58px; height: 30px; }
  .seg button { height: 30px; }
  input[type="range"] { height: 30px; }
  input[type="range"]::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -7.5px; }
  #toasts { top: auto; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 10px); }
  .coach { width: auto; right: 12px; }
}
@media (max-width: 380px) {
  .wordmark { display: none; }
}

/* ───────────────────────────── reduced motion ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .brand:hover .logo b { transform: none; }
  .logo.lg b { animation: none; }
}

/* Text panel: italic switch (disabled when the family has no true italic), OpenType feature chips */
.ctl-toggle.disabled label { color: var(--text-3); }
.ctl-toggle.disabled input { opacity: 0.4; cursor: not-allowed; }
.ctl-feats { align-items: start; }
.ctl-feats .lbl { padding-top: 5px; }
.feat-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.feat-chip { font: 600 11px/1 var(--ui); color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 99px; padding: 5px 9px; cursor: pointer; }
.feat-chip:hover { color: var(--text); border-color: var(--text-3); }
.feat-chip.on { background: var(--text); color: #000; border-color: var(--text); }
.feat-chip:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 1px; }

/* Layers: track matte badge on a row, and the toolbar button's on state */
.matte-badge { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; vertical-align: -2px; }
.matte-badge svg { width: 12px; height: 12px; flex: none; }
.matte-badge.matted { color: var(--accent-fg); }
.layer-tools .icon-btn.on { color: var(--accent-fg); background: rgba(91, 114, 255, 0.14); }

/* Gallery: starter templates (their own aspect, letterboxed in the card) */
.card-aspect { position: absolute; right: 6px; bottom: 6px; font: 600 9.5px/1 var(--mono); letter-spacing: .04em; color: #fff; background: rgba(0, 0, 0, 0.55); padding: 3px 5px; border-radius: 4px; pointer-events: none; }

/* Curve editor: Curve / Spring mode */
.ce-mode { display: block; }
.ce-mode .seg { width: 100%; }
.ce-mode .seg button { flex: 1; }
.ce-spring { display: flex; flex-direction: column; gap: 6px; }
.ce-spring .hint { margin: 0; }
.ce-graph.spring { cursor: default; }

/* Transform keys: chips in the panel, diamonds on the selected timeline lane */
.tk-head { display: flex; flex-direction: column; gap: 8px; }
.tk-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tk-list[hidden] { display: none; }
.tk-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px 0 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text-2); font: 600 11px/1 var(--mono); cursor: pointer; }
.tk-chip svg { width: 11px; height: 11px; }
.tk-chip.on { border-color: var(--accent-hi); color: #fff; background: rgba(91, 114, 255, 0.18); }
.tk-chip.on svg { fill: currentColor; }
.tk-actions { gap: 6px; }
.tl-key { position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; padding: 0; border: 1.5px solid #fff; background: var(--panel); transform: rotate(45deg); border-radius: 2px; cursor: ew-resize; z-index: 3; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.tl-key.on { background: var(--accent-hi); }
.tl-key:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

/* Motion: stagger distribution preview (ticks = start times, hue = order) */
.spread-row { min-height: 22px; }
.spread-preview { width: 100%; height: 22px; display: block; border-radius: 5px; background: var(--panel-2); }
