:root {
  /* Palette: #000000 ink, #233D4D slate, #FE7F2D orange, #EAECF0 mist. */
  --bg: #eaecf0;
  --panel: #f6f7f9;
  --panel-2: #e0e4ea;
  --panel-3: #d3d9e1;
  --border: rgba(35, 61, 77, 0.14);
  --border-strong: rgba(35, 61, 77, 0.24);
  --border-hover: rgba(35, 61, 77, 0.45);
  --text: #000000;
  --muted: #3d5363;
  --subtle: #74858f;
  --accent: #fe7f2d;
  --accent-2: #e8691a;
  --accent-light: #fe7f2d;
  --accent-ink: #000000;
  --accent-soft: rgba(254, 127, 45, 0.16);
  --blue: #233d4d;
  --green: #2e7d5b;
  --red: #c8372d;
  --amber: #a5620c;
  --stage: #233d4d;
  --stage-2: #2b4b5e;
  --on-stage: #eaecf0;
  --radius: 10px;
  --radius-sm: 7px;
  --sans: "Inter Tight", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
  --gradient: linear-gradient(var(--accent), var(--accent));
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
img { display: block; }

.icon { display: inline-flex; width: 18px; height: 18px; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 22px 16px;
  background: var(--panel);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--gradient);
  box-shadow: 0 6px 24px rgba(255, 90, 90, 0.35);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 0; height: 0; left: 3px;
  border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent;
}
.brand-name { display: flex; flex-direction: column; font-weight: 700; font-size: 15px; line-height: 1.15; }
.brand-name small { color: var(--muted); font-weight: 500; font-size: 12px; }

.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
}
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--panel-3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav a.active .icon { color: var(--accent); }

.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }
.quota { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); display: grid; gap: 10px; }
.quota-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.quota-row strong { color: var(--text); font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--gradient); border-radius: inherit; transition: width 0.4s; }
.demo-pill {
  font-size: 12px; font-weight: 600; color: var(--amber); padding: 8px 12px; border-radius: var(--radius-sm);
  background: rgba(255, 194, 75, 0.08); border: 1px solid rgba(255, 194, 75, 0.25); text-align: center;
}

.main { min-width: 0; padding: 32px 40px 64px; }
.page { max-width: 1240px; margin: 0 auto; animation: rise 0.3s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--panel-2);
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--panel-3); border-color: var(--border-hover); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--gradient); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(255, 90, 90, 0.25); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 99px; border: 1px solid var(--border-strong); background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .count { font-variant-numeric: tabular-nums; opacity: 0.7; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; background: var(--panel-3); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.running { color: var(--blue); background: rgba(91, 157, 255, 0.12); }
.badge.running::before { animation: pulse 1.2s infinite; }
.badge.done { color: var(--green); background: rgba(62, 207, 142, 0.12); }
.badge.failed { color: var(--red); background: rgba(255, 92, 102, 0.12); }
.badge.queued { color: var(--amber); background: rgba(255, 194, 75, 0.1); }
@keyframes pulse { 50% { opacity: 0.3; } }

.progress { height: 4px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--gradient); border-radius: inherit; transition: width 0.5s ease; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { padding: 18px 20px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); display: grid; gap: 6px; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat-label .icon { width: 16px; height: 16px; color: var(--subtle); }
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--subtle); font-size: 12px; }
.stat .meter { margin-top: 4px; }

.section { margin-top: 36px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section h2 { font-size: 16px; font-weight: 700; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.active-list { display: grid; gap: 10px; }
.active-row {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 16px;
  padding: 12px 16px 12px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 0.15s;
}
.active-row:hover { border-color: var(--border-strong); }
.active-thumb { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--panel-3); display: grid; place-items: center; color: var(--subtle); }
.active-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.active-info { min-width: 0; display: grid; gap: 6px; }
.active-info .top { display: flex; align-items: center; gap: 10px; }
.active-info .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.active-info .step { color: var(--muted); font-size: 12.5px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.thumb { position: relative; aspect-ratio: 4 / 5; background: var(--panel-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 0.4s; }
.card:hover .thumb img { transform: scale(1.04); }
.thumb-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--subtle); }
.thumb-empty .icon { width: 32px; height: 32px; }
.thumb .badge { position: absolute; top: 10px; left: 10px; backdrop-filter: blur(8px); background: rgba(9, 9, 12, 0.7); }
.thumb .ar { position: absolute; top: 10px; right: 10px; font: 500 11px var(--mono); padding: 3px 7px; border-radius: 6px; background: rgba(9, 9, 12, 0.7); color: var(--text); }
.thumb .dur { position: absolute; bottom: 10px; right: 10px; font: 500 11px var(--mono); padding: 3px 7px; border-radius: 6px; background: rgba(9, 9, 12, 0.75); }
.thumb .progress { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0; height: 3px; background: rgba(0, 0, 0, 0.5); }
.thumb .play {
  position: absolute; inset: 0; margin: auto; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92); color: #111; display: grid; place-items: center;
  opacity: 0; transform: scale(0.85); transition: opacity 0.2s, transform 0.2s;
}
.card:hover .thumb .play { opacity: 1; transform: none; }
.card-body { padding: 14px 16px 16px; display: grid; gap: 4px; }
.card-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-prompt { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-meta { color: var(--subtle); font-size: 12px; margin-top: 4px; }

.empty {
  display: grid; place-items: center; text-align: center; gap: 12px; padding: 56px 24px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--panel);
}
.empty .empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .empty-icon .icon { width: 26px; height: 26px; }
.empty h3 { font-size: 17px; }
.empty p { color: var(--muted); max-width: 380px; }

/* ---------- Create ---------- */
.create { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.form { padding: 24px; display: grid; gap: 22px; }
.field { display: grid; gap: 10px; }
.field-label { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; }
.field-label small { color: var(--subtle); font-weight: 400; font-size: 12.5px; }
.prompt-box { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--panel-2); transition: border-color 0.15s, box-shadow 0.15s; }
.prompt-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.prompt-box textarea { display: block; width: 100%; min-height: 150px; padding: 16px; border: 0; background: transparent; resize: vertical; outline: none; font-size: 15px; line-height: 1.6; }
.prompt-box textarea::placeholder { color: var(--subtle); }
.prompt-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px 10px 16px; border-top: 1px solid var(--border); }
.counter { font: 12px var(--mono); color: var(--subtle); }
.ideas { display: flex; gap: 8px; flex-wrap: wrap; }

.dropzone {
  display: grid; place-items: center; gap: 6px; padding: 24px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border-strong); border-radius: 12px; background: var(--panel-2); color: var(--muted);
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone .icon { width: 26px; height: 26px; color: var(--accent); }
.dropzone strong { color: var(--text); }
.ref-list { display: flex; gap: 10px; flex-wrap: wrap; }
.ref { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border-strong); }
.ref img { width: 100%; height: 100%; object-fit: cover; }
.ref button {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.75); color: #fff; display: grid; place-items: center; padding: 0;
}
.ref button .icon { width: 12px; height: 12px; }

.aspects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.aspect { position: relative; cursor: pointer; }
.aspect input { position: absolute; opacity: 0; pointer-events: none; }
.aspect-card {
  display: grid; justify-items: center; gap: 10px; padding: 16px 10px 14px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--panel-2); text-align: center; height: 100%;
  transition: border-color 0.15s, background-color 0.15s;
}
.aspect-shape { height: 46px; display: grid; place-items: center; }
.aspect-shape span { display: block; border: 2px solid var(--muted); border-radius: 5px; }
.aspect-card strong { font-size: 14px; }
.aspect-card small { color: var(--subtle); font-size: 11.5px; line-height: 1.3; }
.aspect input:checked + .aspect-card { border-color: var(--accent); background: var(--accent-soft); }
.aspect input:checked + .aspect-card .aspect-shape span { border-color: var(--accent); background: rgba(255, 122, 61, 0.15); }
.aspect input:focus-visible + .aspect-card { box-shadow: 0 0 0 3px var(--accent-soft); }

.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 4px; }
.error { color: var(--red); font-size: 13px; }
.hint { color: var(--subtle); font-size: 12.5px; }

.how { padding: 22px; display: grid; gap: 18px; position: sticky; top: 32px; }
.how h3 { font-size: 15px; }
.how-step { display: grid; grid-template-columns: 36px 1fr; gap: 12px; }
.how-num { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-3); color: var(--accent); }
.how-num .icon { width: 18px; height: 18px; }
.how-step strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.how-step p { color: var(--muted); font-size: 12.5px; }

/* ---------- Shared bits ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -150% 0; } }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-6deg); } }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@keyframes stripes { to { background-position: 22px 0; } }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
.brush { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); animation: bob 1.4s ease-in-out infinite; }
.brush .icon { width: 22px; height: 22px; }
.dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
.loading { display: grid; place-items: center; gap: 14px; min-height: 50vh; color: var(--muted); }
.mono { font-family: var(--mono); }
.rec { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; padding: 0;
  border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover:not(:disabled) { background: var(--panel-3); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn .icon { width: 17px; height: 17px; }

.input {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--panel-2); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { opacity: 0.6; }
textarea.input { resize: vertical; line-height: 1.5; }

.seg { display: flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--border); }
.seg button {
  flex: 1; height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.seg button:hover:not(:disabled) { color: var(--text); }
.seg button.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.seg button:disabled { opacity: 0.4; cursor: default; }
.seg.sm button { height: 24px; font-size: 12px; }

.kv { display: grid; gap: 2px; margin: 0; }
.kv dt { font-size: 11px; font-weight: 600; color: var(--subtle); text-transform: uppercase; letter-spacing: 0.06em; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { display: grid; gap: 4px; justify-items: center; font: 10px var(--mono); color: var(--subtle); }
.swatch i { width: 40px; height: 40px; border-radius: 9px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }

.log { font: 12px/1.55 var(--mono); }
.log-line { display: grid; grid-template-columns: 64px 1fr; gap: 6px; padding: 2px 0; color: var(--muted); animation: rise 0.25s ease-out; }
.log-line time { color: var(--subtle); }
.log-line.ok span { color: var(--green); }
.log-line.err span { color: var(--red); }
.log-line.last span::after { content: "▍"; color: var(--accent); margin-left: 4px; animation: pulse 1s infinite; }

/* ---------- Editor shell ---------- */
body.editor-mode .app { grid-template-columns: 1fr; }
body.editor-mode .sidebar { display: none; }
body.editor-mode .main { padding: 0; }

/* The left panel runs the full height; the timeline sits under the player and inspector only. */
.editor {
  height: 100vh; display: grid; overflow: hidden; user-select: none; background: var(--bg);
  grid-template-columns: 310px minmax(0, 1fr) 320px;
  grid-template-rows: auto auto minmax(0, 1fr) minmax(270px, 38vh);
  grid-template-areas: "top top top" "busy busy busy" "left player inspector" "left timeline timeline";
  gap: 6px; padding: 0 6px 6px;
}
.ed-top { grid-area: top; margin: 0 -6px; }
.ed-busy { grid-area: busy; margin: -6px -6px 0; }
.ed-left { grid-area: left; }
.ed-player { grid-area: player; }
.ed-inspector { grid-area: inspector; }
.ed-timeline { grid-area: timeline; }
.editor input, .editor textarea { user-select: text; }
.ed-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; min-width: 0; min-height: 0; overflow: hidden; }

.ed-top {
  display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 12px;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand-mark.sm { width: 26px; height: 26px; border-radius: 8px; flex: none; }
.brand-mark.sm::after { border-left-width: 8px; border-top-width: 5px; border-bottom-width: 5px; left: 2px; }
.ed-title { display: grid; min-width: 0; line-height: 1.25; }
.ed-title strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.ed-title span { font: 11.5px var(--mono); color: var(--subtle); white-space: nowrap; }
.ed-status { display: flex; align-items: center; gap: 8px; }
.pill-dirty { font-size: 11.5px; font-weight: 600; color: var(--amber); padding: 3px 9px; border-radius: 99px; background: rgba(255, 194, 75, 0.1); border: 1px solid rgba(255, 194, 75, 0.25); }
.pill-demo { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 3px 9px; border-radius: 99px; border: 1px solid var(--border-strong); }
.presence { display: flex; align-items: center; margin-left: auto; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; margin-left: -7px; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 800; color: #0b0b0e; background: var(--c); box-shadow: 0 0 0 2px var(--panel);
  animation: rise 0.3s ease-out;
}
.avatar:first-child { margin-left: 0; }
.presence-text { margin-left: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.ed-actions { display: flex; align-items: center; gap: 8px; }
.presence:empty + .ed-actions { margin-left: auto; }
.ed-actions .btn { height: 34px; }

.ed-busy { height: 2px; background: var(--panel-3); }
.ed-busy span { display: block; height: 100%; background: var(--gradient); transition: width 0.5s ease; }
.ed-busy.idle { background: transparent; }
.ed-busy.idle span { opacity: 0; }

.ed-upper { display: contents; }

/* ---------- Left panel ---------- */
.ed-left { display: flex; flex-direction: column; }
.ed-tabs { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); padding: 4px; gap: 2px; }
.ed-tab {
  display: grid; justify-items: center; gap: 3px; padding: 7px 2px 6px; border: 0; border-radius: 8px;
  background: transparent; color: var(--subtle); font-size: 10.5px; font-weight: 600; cursor: pointer; min-width: 0;
}
.ed-tab:hover { color: var(--text); background: var(--panel-2); }
.ed-tab.active { color: var(--accent); background: var(--accent-soft); }
.ed-tab .icon { width: 18px; height: 18px; }
.ed-left-body { flex: 1; overflow: auto; padding: 12px; display: grid; align-content: start; gap: 10px; }
.lp-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; }
.lp-head h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.lp-text { color: var(--muted); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.asset { position: relative; border-radius: 8px; overflow: hidden; background: var(--panel-3); border: 1px solid var(--border); aspect-ratio: 9 / 16; }
.asset.ar-16-9 { aspect-ratio: 16 / 9; }
.asset.ar-1-1 { aspect-ratio: 1; }
.asset img { width: 100%; height: 100%; object-fit: cover; animation: fadein 0.5s ease; }
.asset.waiting { background: linear-gradient(110deg, var(--panel-2) 30%, var(--panel-3) 50%, var(--panel-2) 70%) 0 0 / 300% 100%; animation: shimmer 1.6s linear infinite; }
.asset.drawing { border-color: var(--accent); }
.asset-wait { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: var(--subtle); }
.asset-num { position: absolute; left: 5px; bottom: 5px; font: 500 10px var(--mono); padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, 0.7); }
.asset-add {
  position: absolute; right: 5px; top: 5px; width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; background: var(--accent); color: #fff; cursor: pointer;
  opacity: 0; transform: scale(0.8); transition: opacity 0.15s, transform 0.15s;
}
.asset-add .icon { width: 14px; height: 14px; }
.asset:hover .asset-add, .asset-add:focus-visible { opacity: 1; transform: none; }
@keyframes fadein { from { opacity: 0; filter: blur(8px); } }

.text-row { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 6px; padding: 3px; border-radius: 8px; }
.text-row.selected { background: var(--accent-soft); }
.text-num { font: 500 11px var(--mono); color: var(--subtle); text-align: center; }
.text-row .input { padding: 7px 9px; font-size: 13px; }

/* ---------- Player ---------- */
.ed-player { display: flex; flex-direction: column; }
.phead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); min-height: 44px; }
.phead-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pipe-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.pipe { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; color: var(--subtle); background: var(--panel-2); }
.pipe .icon { width: 11px; height: 11px; }
.pipe.done { color: var(--green); }
.pipe.active { color: #fff; background: var(--gradient); }

.pstage {
  flex: 1; min-height: 0; display: grid; place-items: center; padding: 14px; overflow: hidden;
  background: var(--stage);
}
.pstage:fullscreen { background: #000; padding: 0; }
.pframe, .pvideo {
  position: relative; max-width: 100%; max-height: 100%; border-radius: 6px; overflow: hidden; background: #000;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.pframe { container-type: inline-size; }
.pframe.ar-9-16, .pvideo.ar-9-16 { height: 100%; aspect-ratio: 9 / 16; }
.pframe.ar-1-1, .pvideo.ar-1-1 { height: 100%; aspect-ratio: 1; }
.pframe.ar-16-9, .pvideo.ar-16-9 { width: 100%; aspect-ratio: 16 / 9; }
.pframe[hidden], .pvideo[hidden] { display: none; }
.pframe.waiting { background: linear-gradient(110deg, var(--panel-2) 30%, var(--panel-3) 50%, var(--panel-2) 70%) 0 0 / 300% 100%; animation: shimmer 1.6s linear infinite; }
.pf-layer { position: absolute; inset: 0; container-type: inline-size; }
.pf-layer[hidden] { display: none; }
.pf-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: center; will-change: transform, filter; }
.pf-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
/* Mirrors composeFrame() in src/render.js so the preview matches the MP4. */
.pf-caption {
  position: absolute; left: 5%; right: 5%; bottom: 6%; padding: 0.45em 0.4em;
  font: 700 5.5cqw/1.3 Arial, Helvetica, sans-serif; color: #fff; text-align: center;
  background: rgba(0, 0, 0, 0.55); border-radius: 0.5em; paint-order: stroke fill;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.pf-caption[data-pos="top"] { top: 6%; bottom: auto; }
.pf-caption[data-pos="middle"] { top: 50%; bottom: auto; transform: translateY(-50%); }
.pf-caption[hidden] { display: none; }
.pf-state {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; padding: 18px;
  text-align: center; color: var(--muted); font-size: 12.5px;
}
.pf-state strong { color: var(--text); font-size: 14px; }
.pf-state[hidden] { display: none; }

.pbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 10px; border-top: 1px solid var(--border); }
.timecode { font: 12px var(--mono); color: var(--subtle); }
.timecode strong { color: var(--text); font-weight: 500; }
.play-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--text); color: var(--bg); transition: transform 0.1s;
}
.play-btn:active { transform: scale(0.94); }
.play-btn .icon { width: 16px; height: 16px; }
.pbar-right { justify-self: end; }

/* ---------- Inspector ---------- */
.ed-inspector { display: flex; flex-direction: column; }
.insp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); }
.insp-head h3 { font-size: 14px; }
.insp-actions { display: flex; gap: 2px; }
.insp-body { flex: 1; overflow: auto; padding: 4px 16px 16px; }
.insp-section { display: grid; gap: 9px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.insp-section:last-child { border-bottom: 0; }
.insp-section h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.field-top { display: flex; justify-content: space-between; align-items: baseline; }
.counter { font: 11px var(--mono); color: var(--subtle); }
.dur-row { display: grid; grid-template-columns: 1fr 70px auto; gap: 10px; align-items: center; }
.input.num { padding: 6px 8px; font-family: var(--mono); }
input[type="range"] { accent-color: var(--accent); width: 100%; }
.motion-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.motion-opt {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; text-align: left;
  border: 1px solid var(--border-strong); background: var(--panel-2); font-size: 12.5px; font-weight: 600;
}
.motion-opt:hover:not(:disabled) { border-color: var(--border-hover); }
.motion-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.motion-opt:disabled { opacity: 0.5; cursor: default; }
.motion-demo { position: relative; width: 34px; height: 26px; flex: none; border-radius: 5px; overflow: hidden; background: var(--panel-3); }
.motion-demo i { position: absolute; inset: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); clip-path: circle(28% at 50% 50%); }
.m-zoom-in i { animation: demo-zoom-in 1.8s ease-in-out infinite; }
.m-zoom-out i { animation: demo-zoom-out 1.8s ease-in-out infinite; }
.m-pan i { animation: demo-pan 1.8s ease-in-out infinite alternate; }
@keyframes demo-zoom-in { from { transform: scale(0.8); } to { transform: scale(1.35); } }
@keyframes demo-zoom-out { from { transform: scale(1.35); } to { transform: scale(0.8); } }
@keyframes demo-pan { from { transform: translateX(-28%); } to { transform: translateX(28%); } }
.insp-art { width: 100%; max-height: 160px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.swap-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.swap { width: 46px; height: 46px; padding: 0; border-radius: 7px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: none; }
.swap img { width: 100%; height: 100%; object-fit: cover; }
.swap.active { border-color: var(--accent); }
.swap:disabled { cursor: default; opacity: 0.6; }
.notice { display: flex; gap: 10px; align-items: flex-start; margin: 12px 16px 0; padding: 10px 12px; border-radius: 9px; font-size: 12.5px; color: var(--text); background: rgba(91, 157, 255, 0.1); border: 1px solid rgba(91, 157, 255, 0.25); }
.notice .icon { width: 16px; height: 16px; color: var(--blue); margin-top: 1px; }
.notice.error { background: rgba(255, 92, 102, 0.08); border-color: rgba(255, 92, 102, 0.3); }
.notice.error .icon { color: var(--red); }
.shortcuts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; color: var(--muted); font-size: 12.5px; }
.shortcuts li { display: flex; gap: 10px; align-items: center; }
kbd { min-width: 54px; text-align: center; font: 500 11px var(--mono); padding: 3px 6px; border-radius: 5px; background: var(--panel-3); border: 1px solid var(--border-strong); border-bottom-width: 2px; color: var(--text); }

/* ---------- Timeline ---------- */
.ed-timeline { display: flex; flex-direction: column; }
.tl-toolbar { display: flex; align-items: center; gap: 2px; padding: 5px 8px; border-bottom: 1px solid var(--border); }
.tl-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 6px; }
.tl-hint { margin-left: 10px; font-size: 12px; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-zoom { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.tl-zoom input { width: 110px; }
.tl-area { flex: 1; min-height: 0; display: grid; grid-template-columns: 74px minmax(0, 1fr); }
.tl-heads { display: grid; grid-template-rows: 22px 56px 28px 44px 30px; align-content: start; gap: 6px; padding-top: 4px; border-right: 1px solid var(--border); }
.tl-head { display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 11.5px; font-weight: 600; color: var(--subtle); }
.tl-head .icon { width: 15px; height: 15px; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; position: relative; }
.tl-content { position: relative; display: grid; grid-template-rows: 22px 56px 28px 44px 30px; gap: 6px; padding-top: 4px; min-height: 100%; }
.tl-ruler { position: relative; cursor: ew-resize; border-bottom: 1px solid var(--border); }
.tl-ruler i { position: absolute; bottom: 0; width: 1px; height: 4px; background: var(--border-strong); }
.tl-ruler i.major { height: 9px; background: var(--subtle); }
.tl-ruler b { position: absolute; top: 1px; margin-left: 4px; font: 400 10px var(--mono); color: var(--subtle); }
.tl-lane { position: relative; }
.lane-empty { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--subtle); }

.tclip {
  position: absolute; top: 0; bottom: 0; border-radius: 7px; overflow: hidden; cursor: grab; touch-action: none;
  background: var(--panel-3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: box-shadow 0.15s, opacity 0.15s;
}
.tclip-strip { position: absolute; inset: 0; background-repeat: repeat-x; background-size: auto 100%; background-position: left center; opacity: 0.95; }
.tclip::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, 0.55), transparent 45%); pointer-events: none; }
.tclip-label { position: absolute; z-index: 1; left: 7px; right: 14px; top: 5px; display: flex; gap: 6px; font: 500 10.5px var(--mono); color: #fff; white-space: nowrap; overflow: hidden; }
.tclip-motion { opacity: 0.75; }
.tclip-dur { margin-left: auto; }
.tclip:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }
.tclip.selected { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 1px var(--accent); }
.tclip.dragging { z-index: 5; cursor: grabbing; opacity: 0.85; box-shadow: inset 0 0 0 2px var(--accent), 0 10px 30px rgba(0, 0, 0, 0.6); transition: none; }
.tclip-handle {
  position: absolute; z-index: 2; right: 0; top: 0; bottom: 0; width: 9px; cursor: ew-resize;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25));
}
.tclip-handle::after { content: ""; position: absolute; right: 3px; top: 50%; width: 2px; height: 18px; margin-top: -9px; border-radius: 2px; background: #fff; opacity: 0.7; }
.tclip.selected .tclip-handle { background: linear-gradient(90deg, transparent, rgba(255, 122, 61, 0.6)); }
.tclip.st-pending { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.tclip.st-pending .tclip-strip { display: none; }
.tclip.st-drawing { background: linear-gradient(110deg, var(--panel-2) 30%, rgba(254, 127, 45, 0.28) 50%, var(--panel-2) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
.tclip.st-rendering .tclip-busy { position: absolute; inset: 0; z-index: 1; background: repeating-linear-gradient(-45deg, rgba(255, 77, 141, 0.28) 0 8px, transparent 8px 16px) 0 0 / 200% 100%; animation: stripes 1s linear infinite; }
.tclip.st-drawing .tclip-busy { position: absolute; z-index: 1; right: 7px; bottom: 7px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: spin 0.8s linear infinite; }
.tclip-done { position: absolute; z-index: 1; right: 6px; bottom: 6px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #07140d; }
.tclip-done .icon { width: 11px; height: 11px; }

.tblock {
  position: absolute; top: 0; bottom: 0; padding: 0 9px; border-radius: 7px; border: 0; cursor: pointer; text-align: left;
  background: rgba(192, 132, 252, 0.16); box-shadow: inset 0 0 0 1px rgba(192, 132, 252, 0.35); color: #e3cffd;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tblock:hover { background: rgba(192, 132, 252, 0.24); }
.tblock.selected { box-shadow: inset 0 0 0 2px #c084fc; }
.tblock.empty { background: transparent; box-shadow: none; border: 1px dashed var(--border-strong); color: var(--subtle); font-weight: 500; }

.tl-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; z-index: 6; }
.tl-playhead::before { content: ""; position: absolute; top: 0; left: -6px; width: 14px; height: 16px; background: #fff; clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%); }
.drop-marker { position: absolute; top: 32px; height: 58px; width: 4px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); z-index: 7; pointer-events: none; }

/* ---------- Agent cursors ---------- */
.cursor-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.agent-cursor {
  position: absolute; left: 0; top: 0; display: flex; align-items: flex-start;
  transition: transform 0.95s cubic-bezier(0.45, 0.05, 0.2, 1), opacity 0.35s;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5)); animation: cursor-in 0.35s ease-out;
}
.agent-arrow { display: block; width: 22px; height: 22px; margin: -3px 0 0 -4px; transition: transform 0.15s; }
.agent-tag {
  margin: 14px 0 0 -2px; padding: 3px 9px; border-radius: 99px 99px 99px 4px; background: var(--c); color: #0b0b0e;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.agent-cursor.click .agent-arrow { transform: scale(0.82); }
.agent-cursor.click::before {
  content: ""; position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--c); animation: ripple 0.4s ease-out forwards;
}
.agent-cursor.leaving { opacity: 0; }
@keyframes cursor-in { from { opacity: 0; } }
@keyframes ripple { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 70; max-width: min(520px, calc(100vw - 32px));
  padding: 11px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 13px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none;
  transform: translate(-50%, 12px); transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .editor { grid-template-columns: 260px minmax(0, 1fr) 290px; }
  .presence-text { display: none; }
}
@media (max-width: 1100px) {
  .create { grid-template-columns: 1fr; }
  .how { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ed-actions .btn:not(.primary) { display: none; }
  .tl-hint { display: none; }
}
@media (max-width: 900px) {
  .editor {
    height: auto; min-height: 100vh; overflow: visible;
    grid-template-columns: 1fr; grid-template-rows: auto;
    grid-template-areas: "top" "busy" "player" "timeline" "left" "inspector";
  }
  .ed-player { min-height: 62vh; }
  .ed-left { max-height: 360px; }
  .ed-timeline { height: 250px; }
  .ed-status, .presence { display: none; }
  .ed-actions { margin-left: auto; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: 12px;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand-name { display: none; }
  .nav { display: flex; gap: 2px; flex: 1; }
  .nav a { padding: 8px 10px; font-size: 13px; gap: 6px; }
  .nav a .icon { display: none; }
  .nav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .sidebar-foot { margin: 0; }
  .quota { display: none; }
  .demo-pill { padding: 4px 8px; font-size: 11px; }
  .main { padding: 20px 16px 48px; }
  .aspects { grid-template-columns: 1fr 1fr 1fr; }
  .aspect-card small { display: none; }
  .form { padding: 18px; }
  .stat-value { font-size: 24px; }
  .ed-title strong { max-width: 140px; }
  .ed-title span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Editor tools ---------- */
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.wide { width: 100%; }
.btn.recording, .tool-btn.recording { background: var(--red); border-color: var(--red); color: #fff; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; }
.btn-row .btn { flex: 1; height: 34px; }
.insp-body > .btn.wide { margin-top: 12px; }
.rec-label { color: var(--red); }

.insp-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--border); }
.insp-tabs button {
  padding: 8px 4px 9px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
  box-shadow: inset 0 -2px 0 transparent;
}
.insp-tabs button:hover { color: var(--text); }
.insp-tabs button.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.preset-grid.compact { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.preset {
  display: grid; gap: 5px; padding: 0 0 6px; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden;
  background: var(--panel-2); color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: center; cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.preset:hover:not(:disabled) { color: var(--text); border-color: var(--border-hover); }
.preset.active { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px var(--accent); }
.preset:disabled { opacity: 0.5; cursor: default; }
.preset-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; background: var(--panel-3); container-type: inline-size; }
.preset-grid.compact .preset { font-size: 10.5px; }
.preset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.text-preset .preset-thumb { background: linear-gradient(135deg, #4b5d7a, #a46a8f); }
.text-sample { padding: 0.1em 0.35em; border-radius: 0.3em; font-weight: 700; line-height: 1.2; paint-order: stroke fill; }

.trans-demo i, .trans-demo b { position: absolute; inset: 0; }
.trans-demo i { background: linear-gradient(135deg, var(--accent), var(--accent-2)); animation: demo-swap 2.4s infinite; }
.trans-demo b { background: linear-gradient(135deg, #5b9dff, #3ecf8e); animation: demo-swap 2.4s -1.2s infinite; }
.t-fade { background: #000; }
.t-flash { background: #fff; }
.t-cut i, .t-cut b { animation-timing-function: steps(1); }
@keyframes demo-swap { 0%, 40% { opacity: 1; } 50%, 90% { opacity: 0; } 100% { opacity: 1; } }

.color-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel); background: var(--dot); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; padding: 0; }
.color-dot.active { box-shadow: 0 0 0 2px var(--accent); }
.color-dot:disabled { cursor: default; opacity: 0.5; }
.color-input { width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; }

.slider-row { display: grid; grid-template-columns: 78px 1fr 44px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.slider-value { font: 11.5px var(--mono); color: var(--text); text-align: right; }
.toggle { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }

.audio-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--border); }
.audio-row.in-use { border-color: rgba(62, 207, 142, 0.5); }
.audio-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-3); color: var(--muted); }
.audio-icon .icon { width: 16px; height: 16px; }
.audio-meta { display: grid; min-width: 0; }
.audio-meta strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-meta span { font: 11px var(--mono); color: var(--subtle); }

.tool-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
}
.tool-btn:hover:not(:disabled) { color: var(--text); }
.tool-btn:disabled { opacity: 0.4; cursor: default; }
.tool-btn .icon { width: 15px; height: 15px; }
.tool-btn + .tool-btn { margin-left: 4px; }
.tool-btn.recording span { font-family: var(--mono); }

.tclip-tag { padding: 0 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.2); }
.tclip-trans { position: absolute; z-index: 2; left: -1px; bottom: 6px; width: 9px; height: 9px; transform: rotate(45deg); border: 1.5px solid #fff; background: #000; }
.tclip-trans.t-flash { background: #fff; border-color: #000; }

.lane-music, .lane-voice { border-radius: 7px; }
.lane-add {
  position: absolute; left: 0; top: 0; bottom: 0; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px;
  border: 1px dashed var(--border-strong); border-radius: 7px; background: transparent; color: var(--subtle); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.lane-add:hover { color: var(--text); border-color: var(--border-hover); }
.lane-add .icon { width: 13px; height: 13px; }
.ablock {
  position: absolute; top: 0; bottom: 0; padding: 0; border: 0; border-radius: 7px; overflow: hidden; cursor: pointer; text-align: left; touch-action: none;
}
.ablock.music { background: rgba(62, 207, 142, 0.14); box-shadow: inset 0 0 0 1px rgba(62, 207, 142, 0.4); }
.ablock.voice { background: rgba(91, 157, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(91, 157, 255, 0.45); cursor: grab; }
.ablock.voice.recording { background: rgba(255, 92, 102, 0.18); box-shadow: inset 0 0 0 1px var(--red); }
.ablock.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.wave { position: absolute; left: 0; top: 2px; height: 26px; opacity: 0.9; pointer-events: none; }
.ablock-label {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 5px; margin: 6px 0 0 6px; padding: 1px 6px; max-width: calc(100% - 12px);
  border-radius: 4px; background: rgba(9, 9, 12, 0.7); font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ablock-label .icon { width: 11px; height: 11px; }
.ablock-label em { font-style: normal; color: var(--subtle); font-family: var(--mono); }
.ablock-fade { position: absolute; right: 0; top: 0; bottom: 0; background: linear-gradient(90deg, transparent, rgba(9, 9, 12, 0.7)); pointer-events: none; }

/* ---------- Studio "Buat" panel ---------- */
.create-panel { display: grid; gap: 10px; }
.prompt-input { min-height: 92px; font-size: 14px; line-height: 1.55; }
.chip.sm { height: 26px; padding: 0 10px; font-size: 11.5px; }
.dropzone.compact { padding: 14px; gap: 4px; font-size: 12.5px; }
.dropzone.compact .icon { width: 22px; height: 22px; }
.create-panel .ref-list:empty { display: none; }
.create-panel .ref { width: 62px; height: 62px; }
.aspect-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.aspect-pick button {
  display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--muted);
}
.aspect-pick button strong { color: var(--text); font-size: 13px; }
.aspect-pick button small { font-size: 10.5px; color: var(--subtle); }
.aspect-pick button.active { border-color: var(--accent); background: var(--accent-soft); }
.aspect-pick button.active .aspect-shape span { border-color: var(--accent); }
.aspect-pick .aspect-shape { height: 30px; }
.create-panel .error:empty { display: none; }
.hint.center { text-align: center; }
.steps { margin: 0; padding-left: 18px; display: grid; gap: 10px; color: var(--muted); font-size: 12.5px; }
.steps strong { color: var(--text); }
.create-foot {
  position: sticky; bottom: -12px; margin: 0 -12px -12px; padding: 12px; display: grid; gap: 8px;
  background: linear-gradient(transparent, var(--panel) 14px); border-top: 1px solid var(--border);
}
.create-panel .ideas { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.create-panel .chip.sm { display: block; min-width: 0; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }

/* ---------- Editor AI (assistant) ---------- */
.ed-top { position: relative; z-index: 20; }
.ed-top-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: none; }
.ed-top-right { display: flex; align-items: center; gap: 10px; flex: none; margin-left: auto; }
.ed-top-right .presence { margin-left: 0; }
.ed-top-right .ed-actions { margin-left: 0; }
.assist-bar {
  position: relative; flex: 1; min-width: 220px; max-width: 560px; margin: 0 auto; height: 38px;
  display: flex; align-items: center; gap: 8px; padding: 0 4px 0 12px; border-radius: 11px;
  background: var(--panel-2); border: 1px solid var(--border-strong); transition: border-color 0.15s, box-shadow 0.15s;
}
.assist-bar > .icon { width: 17px; height: 17px; color: var(--accent-2); flex: none; }
.assist-bar:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(255, 77, 141, 0.14); }
.assist-bar.disabled { opacity: 0.6; }
.assist-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: 13px; }
.assist-input::placeholder { color: var(--subtle); }
.assist-send { width: 30px; height: 30px; flex: none; border: 0; border-radius: 8px; display: grid; place-items: center; background: var(--gradient); color: #fff; cursor: pointer; }
.assist-send .icon { width: 15px; height: 15px; }
.assist-bar.disabled .assist-send { pointer-events: none; filter: grayscale(1); }
.assist-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); display: none; padding: 8px; gap: 2px;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 11px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.assist-bar:focus-within .assist-menu { display: grid; }
.assist-menu-title { padding: 2px 8px 6px; font-size: 11px; font-weight: 700; color: var(--subtle); text-transform: uppercase; letter-spacing: 0.05em; }
.assist-menu button { padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; cursor: pointer; }
.assist-menu button:hover { background: var(--panel-3); color: var(--text); }

.assist-status {
  position: fixed; z-index: 55; top: 64px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 13px;
  background: rgba(23, 23, 30, 0.96); border: 1px solid rgba(255, 77, 141, 0.45); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: rise 0.25s ease-out;
}
.assist-status[hidden] { display: none; }
.assist-avatar { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--gradient); color: #fff; }
.assist-avatar .icon { width: 18px; height: 18px; }
.assist-text { flex: 1; min-width: 0; display: grid; gap: 4px; }
.assist-text strong { font-size: 13px; line-height: 1.4; }
.assist-text span { font-size: 12px; color: var(--muted); }
.assist-text .progress { height: 3px; }

.editor.assisting .ed-top-left, .editor.assisting .ed-top-right, .editor.assisting .assist-bar,
.editor.assisting .ed-left, .editor.assisting .ed-player, .editor.assisting .ed-inspector, .editor.assisting .ed-timeline { pointer-events: none; }
.editor.assisting .ed-panel { border-color: rgba(198, 255, 61, 0.3); }
.agent-cursor.actor { z-index: 2; }
.agent-cursor.actor .agent-arrow { width: 26px; height: 26px; }
.agent-cursor.actor .agent-arrow svg { width: 26px; height: 26px; }
.agent-cursor.holding .agent-arrow { transform: scale(0.85); }
.agent-cursor.holding::before {
  content: ""; position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--c); opacity: 0.35;
}
textarea.typing { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(255, 77, 141, 0.18); }
@media (max-width: 1280px) {
  .assist-bar { min-width: 160px; }
}
@media (max-width: 900px) {
  .ed-top { flex-wrap: wrap; height: auto; padding: 8px 12px; row-gap: 8px; }
  .assist-bar { order: 3; flex-basis: 100%; max-width: none; }
}

/* ---------- Editor AI chat & music ---------- */
.chat-panel { display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.chat-thread { flex: 1; min-height: 120px; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.bubble { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; animation: rise 0.2s ease-out; }
.bubble.ai { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.user { align-self: flex-end; background: var(--gradient); color: #fff; border-bottom-right-radius: 4px; }
.bubble small { display: block; margin-top: 4px; font-size: 11px; color: var(--subtle); }
.bubble.pending { color: var(--muted); }
.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-chips[hidden] { display: none; }
.chat-chips .chip { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-form { display: grid; gap: 8px; position: sticky; bottom: -12px; margin: 0 -12px -12px; padding: 10px 12px 12px; background: var(--panel); border-top: 1px solid var(--border); }
.chat-input { resize: none; font-size: 13.5px; }
.chat-new { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); order: 10; }
.chat-new:hover { color: var(--text); }
.chat-new .icon { width: 14px; height: 14px; }
.chat-note[hidden] { display: none; }
.mood-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mood { display: grid; gap: 2px; padding: 9px 6px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--panel-2); cursor: pointer; text-align: center; }
.mood strong { font-size: 12.5px; }
.mood small { font: 10.5px var(--mono); color: var(--subtle); }
.mood:hover:not(:disabled) { border-color: var(--accent-2); }
.mood:disabled { opacity: 0.5; cursor: default; }

/* ---------- Editor AI dock (bottom of the left panel) ---------- */
.ai-dock { position: relative; display: grid; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--panel); }
.ai-dock[hidden] { display: none; }
.ai-dock .assist-bar {
  flex: none; min-width: 0; max-width: none; margin: 0; height: auto; display: grid;
  grid-template-columns: 1fr auto; grid-template-areas: "label label" "input send"; gap: 6px 8px; padding: 9px 9px 9px 12px;
}
.ai-dock .assist-label { grid-area: label; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.05em; }
.ai-dock .assist-label .icon { width: 14px; height: 14px; }
.ai-dock .assist-input { grid-area: input; height: auto; resize: none; line-height: 1.45; font-size: 13px; }
.ai-dock .assist-send { grid-area: send; align-self: end; width: 34px; height: 34px; }
.ai-dock .assist-menu { top: auto; bottom: calc(100% + 6px); }
.ai-dock .assist-status { position: static; transform: none; width: auto; padding: 10px; gap: 10px; box-shadow: none; animation: rise 0.2s ease-out; }
.ai-dock .assist-status .assist-avatar { width: 28px; height: 28px; border-radius: 8px; }
.ai-dock .assist-status .btn.sm { padding: 0 8px; }
.ed-left { min-height: 0; }
.ed-left-body { min-height: 0; }

/* ---------- Text animation & effects ---------- */
.pf-caption .ghost { visibility: hidden; }
.pf-caption { transform-origin: center; }
.pf-fx { position: absolute; inset: 0; pointer-events: none; }
.pf-fx[hidden] { display: none; }
.pf-fx.vignette { background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.6) 100%); }
.pf-fx.grain {
  opacity: 0.22; mix-blend-mode: overlay; animation: grain 0.4s steps(3) infinite;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes grain { 33% { background-position: 37px 61px; } 66% { background-position: -53px 19px; } }
.pf-fx.letterbox { background: linear-gradient(#000 0 9%, transparent 9% 91%, #000 91%); }
.anim-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.anim-opt { display: grid; justify-items: center; gap: 4px; padding: 8px 2px 7px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
.anim-opt:hover:not(:disabled) { color: var(--text); }
.anim-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.anim-opt:disabled { opacity: 0.5; cursor: default; }
.anim-demo { font: 800 15px Impact, "Arial Black", sans-serif; color: var(--text); height: 20px; display: grid; place-items: center; }
.a-fade { animation: demo-fade 1.8s infinite; }
.a-slide { animation: demo-slide 1.8s infinite; }
.a-pop { animation: demo-pop 1.8s infinite; }
.a-typewriter { animation: demo-type 1.8s steps(3) infinite; overflow: hidden; white-space: nowrap; }
.a-words { animation: demo-fade 0.9s steps(2) infinite; }
.a-karaoke { background: linear-gradient(90deg, #ffd84d 50%, var(--text) 50%) 100% 0 / 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: demo-karaoke 1.8s linear infinite; }
@keyframes demo-fade { 0% { opacity: 0; } 30%, 100% { opacity: 1; } }
@keyframes demo-slide { 0% { opacity: 0; transform: translateY(8px); } 30%, 100% { opacity: 1; transform: none; } }
@keyframes demo-pop { 0% { transform: scale(0.5); } 12% { transform: scale(1.15); } 20%, 100% { transform: scale(1); } }
@keyframes demo-type { 0% { width: 0; } 60%, 100% { width: 1.6em; } }
@keyframes demo-karaoke { to { background-position: 0 0; } }
.text-sample[data-anim="pop"] { animation: demo-pop 2.4s infinite; }
.text-sample[data-anim="slide"] { animation: demo-slide 2.4s infinite; }
.fx-toggle { padding: 8px 0; }
.fx-toggle span { display: grid; }
.fx-toggle strong { font-size: 13px; color: var(--text); }
.fx-toggle small { font-size: 11.5px; color: var(--subtle); }
[data-seg="textFont"] { flex-wrap: wrap; }
[data-seg="textFont"] button { flex: 1 0 30%; }

/* ---------- Music volume line ---------- */
.lane-music .ablock { height: 44px; }
.envelope { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.envelope svg { position: absolute; left: 0; top: 0; overflow: visible; }
.envelope polyline { fill: none; stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.6; stroke-linejoin: round; }
.ablock.editing { cursor: crosshair; }
.ablock.editing .envelope polyline { stroke: #fff; stroke-width: 2; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.8)); }
.env-point {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: #fff; border: 2px solid var(--green); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4); pointer-events: auto; cursor: grab;
}
.ablock:not(.editing) .env-point { pointer-events: none; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; }
.env-tip {
  position: absolute; z-index: 8; transform: translateX(-50%); padding: 3px 7px; border-radius: 6px;
  background: var(--text); color: var(--bg); font: 600 11px var(--mono); pointer-events: none; white-space: nowrap;
}
.env-tip[hidden] { display: none; }
.lane-music .ablock-label { position: absolute; left: 6px; bottom: 3px; margin: 0; z-index: 1; }

/* ---------- Output format ---------- */
.pframe.ar-4-5, .pvideo.ar-4-5 { height: 100%; aspect-ratio: 4 / 5; }
.asset.ar-4-5 { aspect-ratio: 4 / 5; }
.pf-media { position: absolute; inset: 0; transform-origin: center; will-change: transform, filter; }
.pf-media .pf-art { transform: none; will-change: auto; }
.pf-bg { display: none; }
.pframe.fit-blur .pf-bg { display: block; transform: scale(1.25); filter: blur(14px) brightness(0.72); }
.pframe.fit-blur .pf-media .pf-art:not(.pf-bg) { object-fit: contain; }
.phead { flex-wrap: wrap; row-gap: 6px; }
.format-picker { display: flex; gap: 6px; align-items: center; margin: 0 auto; }
.format-picker .seg button { display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; }
.fmt-shape { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; opacity: 0.8; }
.fmt-9-16 { width: 7px; height: 12px; }
.fmt-4-5 { width: 9px; height: 11px; }
.fmt-1-1 { width: 10px; height: 10px; }
.fmt-16-9 { width: 14px; height: 8px; }
.aspect-pick { grid-template-columns: repeat(4, 1fr); }
.aspect-pick button small { font-size: 10px; }

/* ---------- Big catalogues: grouped tiles ---------- */
.tiles { display: grid; gap: 12px; }
.tile-group h5 { margin: 2px 0 7px; font-size: 11px; font-weight: 700; color: var(--subtle); text-transform: uppercase; letter-spacing: 0.06em; }
.tile-scroll { max-height: 300px; overflow: auto; padding-right: 4px; margin-right: -4px; }
.preset-grid.compact .preset-thumb { aspect-ratio: 1; }
.tt { position: relative; overflow: hidden; background: #000; }
.tt i { position: absolute; inset: 0; }
.tt-out { background: linear-gradient(135deg, #ff7a3d, #ff4d8d); }
.tt-in { background: linear-gradient(135deg, #5b9dff, #3ecf8e); }
.tt-in::after { content: ""; position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(255, 255, 255, 0.55); }
.tt-flash { opacity: 0; z-index: 3; }
.font-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.font-opt {
  height: 34px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--panel-2);
  color: var(--muted); font-size: 14px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.font-opt:hover:not(:disabled) { color: var(--text); }
.font-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.font-opt:disabled { opacity: 0.5; cursor: default; }
.tclip-trans { left: auto; right: -6px; bottom: 50%; margin-bottom: -5px; z-index: 3; background: var(--accent-2); border-color: #fff; }
.pf-layer { transform-origin: center; }

/* ---------- Uploaded media ---------- */
.media-drop { width: 100%; font: inherit; }
.media-drop:disabled { cursor: progress; opacity: 0.75; }
.asset-kind { position: absolute; right: 5px; bottom: 5px; display: inline-flex; align-items: center; gap: 3px; padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, 0.7); font: 500 10px var(--mono); }
.asset-kind .icon { width: 10px; height: 10px; }
.pf-video { object-fit: cover; }
.pframe.fit-blur .pf-video { object-fit: contain; }
.pf-art[hidden] { display: none; }
.tclip-tag.video { background: var(--accent-2); color: #fff; }

/* =====================================================================
   Editorial theme: cream paper, ink type, one orange accent, dark stage.
   ===================================================================== */
::selection { background: var(--accent); color: #fff; }
body { letter-spacing: -0.005em; }

/* Type: big quiet grotesk headlines, small uppercase mono labels. */
.page-head h1, .empty h3 { font-weight: 500; letter-spacing: -0.035em; }
.page-head h1 { font-size: clamp(34px, 4.4vw, 56px); line-height: 0.98; }
.page-head p { font-size: 15px; }
.lp-head h4, .insp-section h4, .tile-group h5, .kv dt, .section h2, .field-label, .stat-label, .phead-label,
.ed-tab, .insp-tabs button, .tl-head, .assist-label, .assist-menu-title, .quota-row, .pipe {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 500;
}
.lp-head h4, .insp-section h4, .tile-group h5 { font-size: 10.5px; color: var(--muted); }
.ed-tab, .insp-tabs button { font-size: 10px; }
.tl-head { font-size: 10px; }
.section h2 { font-size: 12px; color: var(--muted); }
.stat-value { font-weight: 500; letter-spacing: -0.04em; font-size: 40px; }

/* Buttons: solid accent with mono caps; quiet outlines otherwise. */
.btn { border-radius: var(--radius-sm); background: transparent; border-color: var(--border-strong); font-weight: 500; transition: background-color 0.2s var(--ease), border-color 0.2s, transform 0.2s var(--ease), color 0.2s; }
.btn:hover { background: var(--panel); border-color: var(--border-hover); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: none; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; }
.btn.primary:hover { background: var(--accent-2); filter: none; }
.btn.primary:disabled { background: var(--panel-3); color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); }
.icon-btn:hover:not(:disabled) { background: var(--panel-2); }
.chip { border-color: var(--border-strong); }
.chip.active { background: var(--text); color: var(--bg); }
.seg { background: var(--panel-2); border-color: transparent; }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 0 rgba(35, 61, 77, 0.08), 0 0 0 1px var(--border); }

/* Underline sweep for text links. */
.nav a, .chat-new, .ed-wordmark {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.35s var(--ease), color 0.2s;
}
.nav a:hover, .chat-new:hover { background-size: 100% 1px; }

/* Panels: flat paper with hairlines. */
.ed-panel, .panel, .stat, .card, .quota, .active-row, .empty { background: var(--panel); border-color: var(--border); box-shadow: none; }
.input, .prompt-box, .dropzone, .aspect-pick button, .audio-row, .mood, .anim-opt, .font-opt, .motion-opt, .preset { background: var(--panel); }
.input:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.preset { transition: transform 0.25s var(--ease), border-color 0.15s, color 0.15s; }
.preset:hover:not(:disabled) { transform: translateY(-2px); }

/* Shell. */
.sidebar { background: var(--bg); border-right-color: var(--border); }
.nav a { border-radius: 0; padding: 8px 2px; margin: 0 10px; }
.nav a:hover { background-color: transparent; }
.nav a.active { background-color: transparent; box-shadow: none; color: var(--text); background-size: 100% 1px; }
.nav a.active .icon { color: var(--accent); }
.brand-mark { background: var(--accent); box-shadow: none; border-radius: 6px; }

/* Editor header: links left, wordmark centred, actions right. */
.ed-top { background: var(--bg); border-bottom: 1px solid var(--border); height: 58px; }
.ed-top .brand-mark { display: none; }
.ed-wordmark {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-weight: 700; font-size: 19px; letter-spacing: -0.04em; white-space: nowrap;
}
.ed-wordmark:hover { background-size: 100% 1px; }
.ed-wordmark sup { font-size: 9px; font-family: var(--mono); font-weight: 500; margin-left: 2px; color: var(--accent); }
.ed-title strong { font-weight: 600; letter-spacing: -0.02em; }
.ed-title span { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em; font-size: 10.5px; }
.pill-dirty, .pill-demo { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; border-radius: 4px; }
.pill-dirty { color: var(--accent-2); background: var(--accent-soft); border-color: transparent; }
.badge { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; border-radius: 4px; }
.ed-busy span { background: var(--accent); }
@media (max-width: 1280px) { .ed-wordmark { display: none; } }

/* The dark stage frames the video like a piece on a wall. */
.pstage { background: var(--stage); color: var(--on-stage); }
.pframe.waiting { background: linear-gradient(110deg, var(--stage-2) 30%, #35596e 50%, var(--stage-2) 70%) 0 0 / 300% 100%; }
.pf-state { color: rgba(234, 236, 240, 0.65); }
.pf-state strong { color: var(--on-stage); font-weight: 500; letter-spacing: -0.02em; font-size: 17px; }
.brush { background: rgba(254, 127, 45, 0.16); }
.pframe, .pvideo { border-radius: 2px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); }
.play-btn { background: var(--text); color: var(--bg); transition: transform 0.2s var(--ease), background-color 0.2s; }
.play-btn:hover { background: var(--accent); color: #fff; transform: scale(1.06); }
.timecode { color: var(--subtle); }
.pipe.active { background: var(--accent); color: #fff; }
.pipe.done { color: var(--green); }

/* Blank project: an editorial hero instead of an empty frame. */
.stage-hero { display: none; }
.pstage.blank .pframe { display: none; }
.pstage.blank { place-items: stretch; }
.pstage.blank .stage-hero {
  display: grid; align-content: end; gap: 22px; width: 100%; height: 100%; padding: clamp(20px, 4vw, 48px);
  animation: settle 0.9s var(--ease) both;
}
.stage-hero h2 { font-size: clamp(36px, 5.4vw, 80px); line-height: 0.95; font-weight: 500; letter-spacing: -0.045em; color: var(--on-stage); }
.stage-hero h2 span { color: rgba(234, 236, 240, 0.42); }
.stage-hero .hero-row { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.stage-hero p { max-width: 330px; font: 500 11px/1.6 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: rgba(234, 236, 240, 0.7); }
.stage-hero .hero-cta {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; background: var(--accent); color: #fff;
  border: 0; height: 46px; padding: 0 26px; border-radius: 6px; cursor: pointer; transition: background-color 0.2s, transform 0.2s var(--ease);
}
.stage-hero .hero-cta:hover { background: var(--accent-2); transform: translateY(-2px); }

/* Timeline on paper: orange playhead, readable lanes. */
.tl-playhead { background: var(--accent); }
.tl-playhead::before { background: var(--accent); }
.tl-ruler i.major { background: var(--muted); }
.tclip { box-shadow: inset 0 0 0 1px rgba(35, 61, 77, 0.12); border-radius: 5px; }
.tclip.selected { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 1px var(--accent); }
.tclip.st-pending { box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.tblock { background: rgba(35, 61, 77, 0.1); box-shadow: inset 0 0 0 1px rgba(35, 61, 77, 0.3); color: #233d4d; border-radius: 5px; }
.tblock:hover { background: rgba(35, 61, 77, 0.16); }
.tblock.selected { box-shadow: inset 0 0 0 2px var(--blue); }
.ablock { border-radius: 5px; }
.ablock.music { background: rgba(31, 138, 85, 0.1); box-shadow: inset 0 0 0 1px rgba(31, 138, 85, 0.35); }
.ablock.voice { background: rgba(47, 102, 214, 0.1); box-shadow: inset 0 0 0 1px rgba(47, 102, 214, 0.35); }
.envelope polyline, .ablock.editing .envelope polyline { stroke: var(--text); filter: none; }
.drop-marker { background: var(--accent); box-shadow: none; }
.tclip-trans { background: var(--accent); border-color: var(--panel); }

/* Left panel and chat. */
.ed-tab.active { color: var(--accent); background: var(--accent-soft); }
.bubble.ai { background: var(--bg); border-color: var(--border); }
.bubble.user { background: var(--text); color: var(--bg); }
.ai-dock .assist-bar { background: var(--bg); border-color: var(--border-strong); }
.ai-dock .assist-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ai-dock .assist-label { color: var(--accent); }
.assist-send { background: var(--accent); }
.assist-menu { background: var(--panel); box-shadow: 0 18px 40px rgba(35, 61, 77, 0.16); }
.ai-dock .assist-status { background: var(--bg); border-color: rgba(254, 127, 45, 0.4); color: var(--text); }
.assist-avatar { background: var(--accent); }
.notice { background: rgba(47, 102, 214, 0.07); border-color: rgba(47, 102, 214, 0.25); }
.toast { background: var(--text); color: var(--bg); border-radius: 6px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; }
kbd { background: var(--panel-2); border-color: var(--border-strong); }

/* Entrance: panels settle in one after another. */
@keyframes settle { from { opacity: 0; transform: translateY(14px); } }
.editor > .ed-top, .ed-left, .ed-player, .ed-inspector, .ed-timeline { animation: settle 0.7s var(--ease) both; }
.ed-left { animation-delay: 0.05s; }
.ed-player { animation-delay: 0.12s; }
.ed-inspector { animation-delay: 0.18s; }
.ed-timeline { animation-delay: 0.24s; }
.page > * { animation: settle 0.7s var(--ease) both; }
.page > *:nth-child(2) { animation-delay: 0.06s; }
.page > *:nth-child(3) { animation-delay: 0.12s; }
.page > *:nth-child(4) { animation-delay: 0.18s; }
/* Theme fixes */
.ed-tab { font-size: 9px; letter-spacing: 0.02em; padding-left: 0; padding-right: 0; }
.ed-tab span { white-space: nowrap; overflow: hidden; text-overflow: clip; max-width: 100%; }
.stage-hero h2 { font-size: clamp(30px, 3.9vw, 60px); }
.pstage.blank .stage-hero { align-content: end; overflow: hidden; }
.ablock-fade { background: linear-gradient(90deg, transparent, rgba(35, 61, 77, 0.22)); }
.thumb .ar, .thumb .dur { color: #fff; }
.stat-label .icon { color: var(--accent); }
.ed-tabs { grid-template-columns: repeat(7, auto); justify-content: space-between; }
.ed-tab { padding: 7px 5px 6px; }

/* ---------- Claude-style palette touches ---------- */
/* Serif display type for the big moments; sans for the interface. */
.page-head h1, .stage-hero h2, .ed-wordmark, .empty h3, .stat-value, .brand-name { font-family: var(--serif); }
.page-head h1 { font-weight: 500; letter-spacing: -0.025em; }
.stage-hero h2 { font-weight: 400; letter-spacing: -0.03em; }
.stat-value { font-weight: 400; letter-spacing: -0.02em; }
.ed-wordmark { font-weight: 600; letter-spacing: -0.02em; font-size: 21px; }
.ed-wordmark sup { color: var(--accent-light); }
.tl-playhead, .tl-playhead::before { background: var(--accent-light); }
.tclip.selected { box-shadow: inset 0 0 0 2px var(--accent-light), 0 0 0 1px var(--accent-light); }
.ed-tab.active { color: var(--accent); }
.btn.primary { font-weight: 600; }
.stage-hero h2 span { color: rgba(234, 236, 240, 0.45); }
.bubble.user { background: var(--panel-3); color: var(--text); }
.chip.active { background: var(--text); color: var(--panel); }
input[type="range"] { accent-color: var(--accent-light); }

/* Brand logo: the Forward Ant */
.brand-logo { width: 40px; height: 40px; flex: none; margin: -2px; }
.ed-wordmark { display: inline-flex; align-items: center; gap: 8px; }
.ed-logo { width: 30px; height: 30px; }

/* ---------- Palette: ink, slate, orange, mist ---------- */
/* Black on orange reads far better than white on orange, so accent buttons use ink text. */
.btn.primary, .stage-hero .hero-cta, .assist-send, .pipe.active, .asset-add { color: var(--accent-ink); }
.btn.primary:hover, .stage-hero .hero-cta:hover { background: var(--accent-2); color: var(--accent-ink); }
.assist-avatar { color: var(--accent-ink); }
.play-btn:hover { color: var(--accent-ink); }
.tclip-tag.video, .tclip-trans { color: var(--accent-ink); }
.bubble.user { background: var(--blue); color: var(--on-stage); }
.chip.active { background: var(--blue); color: var(--on-stage); border-color: var(--blue); }
.seg button.active { box-shadow: 0 0 0 1px var(--border); }
.ed-tab.active { color: var(--text); background: var(--accent-soft); }
.ed-tab.active .icon { color: var(--accent-2); }
.toast { background: var(--blue); color: var(--on-stage); }
.stage-hero h2 span { color: rgba(234, 236, 240, 0.5); }
::selection { background: var(--accent); color: #000; }

/* =====================================================================
   Dark theme base (recoloured by clipora.css).
   Later rules here override the earlier light theme.
   ===================================================================== */
:root {
  --bg: #0a0a0a;
  --panel: #141414;
  --panel-2: #1c1c1c;
  --panel-3: #222222;
  --panel-4: #2b2b2b;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --border-hover: rgba(198, 255, 61, 0.45);
  --text: #f2f3f2;
  --muted: #a6aba9;
  --subtle: #6d7370;
  --accent: #c6ff3d;
  --accent-2: #a6e02a;
  --accent-light: #c6ff3d;
  --accent-ink: #000000;
  --accent-soft: rgba(198, 255, 61, 0.12);
  --accent-glow: 0 0 0 1px rgba(198, 255, 61, 0.35), 0 10px 30px -8px rgba(198, 255, 61, 0.45);
  --blue: #a6e02a;
  --green: #c6ff3d;
  --red: #ff6b6b;
  --amber: #ffc857;
  --stage: #050505;
  --stage-2: #111111;
  --on-stage: #f2f3f2;
  --display: "Sora", "Inter Tight", system-ui, sans-serif;
  --gradient: linear-gradient(135deg, #c6ff3d, #a6e02a);
  --radius: 14px;
  --radius-sm: 9px;
}

html { background: var(--bg); }
body {
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(198, 255, 61, 0.13), transparent 60%),
    radial-gradient(700px 500px at 105% 110%, rgba(22, 153, 118, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
}
/* A whisper of film grain over everything. */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
::selection { background: var(--accent); color: var(--accent-ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Display type in Sora. */
.page-head h1, .stage-hero h2, .ed-wordmark, .empty h3, .stat-value, .brand-name,
.home-hero h1, .home-section h2, .home-final h2, .home-brand, .home-steps h3, .home-feature h3 { font-family: var(--display); }
.page-head h1 { font-weight: 700; letter-spacing: -0.04em; }
.stat-value { font-weight: 600; letter-spacing: -0.04em; }
.ed-wordmark { font-weight: 700; letter-spacing: -0.04em; }

/* Surfaces: layered charcoal with a lit top edge. */
.ed-panel, .panel, .stat, .card, .quota, .active-row, .empty {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 40%), var(--panel);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 40px -24px rgba(0, 0, 0, 0.8);
}
.input, .prompt-box, .dropzone, .aspect-pick button, .audio-row, .mood, .anim-opt, .font-opt, .motion-opt, .preset, .text-row .input {
  background: var(--panel-2); border-color: var(--border-strong);
}
.input:focus, .prompt-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dropzone:hover, .dropzone.over { background: var(--accent-soft); border-color: var(--accent); }

/* Buttons. */
.btn { background: var(--panel-2); border-color: var(--border-strong); color: var(--text); }
.btn:hover { background: var(--panel-3); border-color: var(--border-hover); }
.btn.primary, .stage-hero .hero-cta, .assist-send {
  background: var(--gradient); color: var(--accent-ink); border-color: transparent; box-shadow: var(--accent-glow);
}
.btn.primary:hover, .stage-hero .hero-cta:hover { background: linear-gradient(135deg, #3ee0b4, #c6ff3d); color: var(--accent-ink); box-shadow: 0 0 0 1px rgba(198, 255, 61, 0.55), 0 14px 36px -8px rgba(198, 255, 61, 0.6); }
.btn.primary:disabled { background: var(--panel-3); color: var(--subtle); box-shadow: none; }
.icon-btn { color: var(--muted); }
.icon-btn:hover:not(:disabled) { background: var(--panel-3); color: var(--text); }
.chip { background: transparent; color: var(--muted); border-color: var(--border-strong); }
.chip:hover { color: var(--text); border-color: var(--border-hover); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg { background: var(--stage-2); border: 1px solid var(--border); }
.seg button { color: var(--subtle); }
.seg button.active { background: var(--panel-4); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.badge { background: var(--panel-3); }
.badge.done { color: var(--accent); background: var(--accent-soft); }
.progress, .meter { background: var(--panel-3); }
.progress span, .meter span { background: var(--gradient); box-shadow: 0 0 12px rgba(198, 255, 61, 0.6); }
kbd { background: var(--panel-3); border-color: var(--border-strong); color: var(--text); }
.toast { background: var(--panel-4); color: var(--text); border: 1px solid var(--border-hover); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6); }
.toast.error { background: #3a1414; border-color: rgba(255, 107, 107, 0.5); color: #ffd6d6; }
.notice { background: rgba(198, 255, 61, 0.07); border-color: rgba(198, 255, 61, 0.25); color: var(--text); }
.notice .icon { color: var(--accent); }
.pill-dirty { color: var(--amber); background: rgba(255, 200, 87, 0.1); }
.pill-demo, .demo-pill { color: var(--amber); background: rgba(255, 200, 87, 0.08); border-color: rgba(255, 200, 87, 0.25); }

/* Shell. */
.sidebar { background: rgba(12, 12, 12, 0.7); backdrop-filter: blur(14px); border-right-color: var(--border); }
.nav a { color: var(--muted); }
.nav a.active { color: var(--text); }
.nav a.active .icon { color: var(--accent); filter: drop-shadow(0 0 6px rgba(198, 255, 61, 0.6)); }
.brand-name small { color: var(--subtle); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; font-size: 9.5px; }

/* Editor. */
.editor { background: transparent; }
.ed-top { background: rgba(10, 10, 10, 0.72); backdrop-filter: blur(16px); border-bottom-color: var(--border); }
.ed-wordmark sup { color: var(--accent); }
.ed-tabs { border-bottom-color: var(--border); }
.ed-tab { color: var(--subtle); }
.ed-tab:hover { color: var(--text); background: var(--panel-3); }
.ed-tab.active { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.ed-tab.active .icon { color: var(--accent); }
.insp-tabs button.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.ed-player { background: var(--panel); }
.pstage {
  background:
    radial-gradient(60% 70% at 50% 45%, rgba(198, 255, 61, 0.09), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--stage);
}
.pframe, .pvideo { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 60px -20px rgba(198, 255, 61, 0.35); }
.pframe.waiting { background: linear-gradient(110deg, #111 30%, #1d2a25 50%, #111 70%) 0 0 / 300% 100%; }
.play-btn { background: var(--gradient); color: var(--accent-ink); box-shadow: var(--accent-glow); }
.play-btn:hover { background: linear-gradient(135deg, #3ee0b4, #c6ff3d); color: var(--accent-ink); }
.pipe { background: var(--panel-3); }
.pipe.active { background: var(--gradient); color: var(--accent-ink); box-shadow: 0 0 14px rgba(198, 255, 61, 0.5); }
.timecode strong { color: var(--accent); }
.stage-hero h2 { color: var(--text); font-weight: 700; letter-spacing: -0.045em; }
.stage-hero h2 span { background: linear-gradient(90deg, #c6ff3d, #9af5d8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stage-hero p { color: var(--muted); }
.brush { background: var(--accent-soft); color: var(--accent); }

/* Timeline. */
.ed-timeline { background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 30%), var(--panel); }
.tl-toolbar, .tl-heads { border-color: var(--border); }
.tl-ruler { border-bottom-color: var(--border); }
.tl-ruler i { background: rgba(255, 255, 255, 0.12); }
.tl-ruler i.major { background: rgba(255, 255, 255, 0.3); }
.tl-ruler b, .tl-head { color: var(--subtle); }
.tl-playhead, .tl-playhead::before { background: var(--accent); }
.tl-playhead { box-shadow: 0 0 10px rgba(198, 255, 61, 0.8); }
.tclip { background: var(--panel-3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.tclip.selected { box-shadow: inset 0 0 0 2px var(--accent), 0 0 18px -2px rgba(198, 255, 61, 0.6); }
.tclip.st-pending { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.tclip.st-drawing { background: linear-gradient(110deg, #161616 30%, #1f3a31 50%, #161616 70%) 0 0 / 300% 100%; }
.tclip-tag.video, .tclip-trans { background: var(--accent); color: var(--accent-ink); border-color: var(--panel); }
.tblock { background: rgba(198, 255, 61, 0.08); box-shadow: inset 0 0 0 1px rgba(198, 255, 61, 0.25); color: #a7f3dc; }
.tblock:hover { background: rgba(198, 255, 61, 0.14); }
.tblock.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.tblock.empty { color: var(--subtle); border-color: var(--border-strong); }
.ablock.music { background: rgba(198, 255, 61, 0.08); box-shadow: inset 0 0 0 1px rgba(198, 255, 61, 0.3); }
.ablock.voice { background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.ablock.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.ablock-fade { background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.45)); }
.envelope polyline, .ablock.editing .envelope polyline { stroke: #f2f3f2; }
.env-point { border-color: var(--accent); }
.lane-add { color: var(--subtle); border-color: var(--border-strong); }
.lane-add:hover { color: var(--accent); border-color: var(--accent); }
.drop-marker { background: var(--accent); box-shadow: 0 0 12px var(--accent); }

/* Left panel, chat, inspector. */
.bubble.ai { background: var(--panel-2); border-color: var(--border); }
.bubble.user { background: var(--gradient); color: var(--accent-ink); }
.ai-dock { background: var(--panel); border-top-color: var(--border); }
.ai-dock .assist-bar { background: var(--stage-2); border-color: var(--border-strong); }
.ai-dock .assist-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 30px -10px rgba(198, 255, 61, 0.6); }
.ai-dock .assist-label { color: var(--accent); }
.ai-dock .assist-status { background: var(--stage-2); border-color: rgba(198, 255, 61, 0.4); color: var(--text); }
.assist-avatar { background: var(--gradient); color: var(--accent-ink); }
.assist-menu { background: var(--panel-2); border-color: var(--border-strong); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7); }
.preset.active, .anim-opt.active, .font-opt.active, .motion-opt.active, .aspect-pick button.active, .swap.active {
  border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent), 0 0 20px -6px rgba(198, 255, 61, 0.6);
}
.preset:hover:not(:disabled), .anim-opt:hover:not(:disabled), .font-opt:hover:not(:disabled), .motion-opt:hover:not(:disabled) { border-color: var(--border-hover); }
.how-num { background: var(--accent-soft); color: var(--accent); }
.asset { background: var(--panel-3); border-color: var(--border); }
.asset-add { background: var(--accent); color: var(--accent-ink); }
.text-row.selected { background: var(--accent-soft); }
.motion-demo { background: var(--panel-4); }
.motion-demo i { background: var(--gradient); }
.tt-out { background: linear-gradient(135deg, #2b2b2b, #444); }
.tt-in { background: linear-gradient(135deg, #c6ff3d, #a6e02a); }
.text-preset .preset-thumb { background: linear-gradient(135deg, #1a1a1a, #0f3a2e); }
input[type="range"] { accent-color: var(--accent); }
.log { color: var(--muted); }
.log-line.ok span { color: var(--accent); }

/* Dashboard. */
.card:hover { border-color: var(--border-hover); box-shadow: 0 0 0 1px rgba(198, 255, 61, 0.25), 0 24px 50px -20px rgba(198, 255, 61, 0.35); }
.stat-label .icon { color: var(--accent); }
.stat-value { color: var(--text); }
.stat:first-child { background: linear-gradient(160deg, rgba(198, 255, 61, 0.18), rgba(22, 153, 118, 0.04) 60%), var(--panel); border-color: rgba(198, 255, 61, 0.25); }
.thumb { background: var(--panel-3); }
.active-thumb { background: var(--panel-3); }

.brand-name { gap: 3px; font-size: 17px; letter-spacing: -0.03em; }
.brand-name small { line-height: 1.2; }
.thumb .badge, .thumb .badge.done { background: rgba(0, 0, 0, 0.72); color: var(--accent); }

/* =====================================================================
   App (dashboard + editor) in the same editorial language:
   square corners, hairlines, flat mint, no glow or gradients.
   ===================================================================== */
:root {
  --radius: 0px; --radius-sm: 0px;
  --border: rgba(241, 241, 239, 0.14); --border-strong: rgba(241, 241, 239, 0.24); --border-hover: #c6ff3d;
  --gradient: #c6ff3d; --accent-glow: none; --bg: #000; --panel: #000; --panel-2: #0b0b0b; --panel-3: #161616; --panel-4: #222222;
  --wide: "Archivo", "Arial Black", sans-serif;
}
body { background: #000; }
body::after { opacity: 0.05; }
.ed-panel, .panel, .stat, .card, .quota, .active-row, .empty { background: #000; box-shadow: none; border: 1px solid var(--border); }
.page-head h1 { font-family: var(--wide); font-weight: 900; font-stretch: 125%; font-variation-settings: "wdth" 125; text-transform: uppercase; letter-spacing: -0.035em; font-size: clamp(44px, 6vw, 92px); line-height: 0.85; }
.page-head p { font: 500 12.5px "IBM Plex Mono", monospace; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: var(--wide); font-weight: 900; font-stretch: 125%; color: var(--accent); }
.stat:first-child { background: var(--accent); border-color: var(--accent); }
.stat:first-child, .stat:first-child * { color: #000 !important; }
.btn.primary, .stage-hero .hero-cta, .assist-send, .play-btn { background: var(--accent); box-shadow: none; color: #000; }
.btn.primary:hover, .stage-hero .hero-cta:hover, .play-btn:hover { background: #f1f1ef; color: #000; box-shadow: none; }
.btn { font-family: "IBM Plex Mono", monospace; text-transform: uppercase; font-size: 12px; letter-spacing: 0.02em; }
.chip.active { background: var(--accent); color: #000; }
.card { transition: border-color 0.25s, transform 0.35s cubic-bezier(.2,.7,.2,1); }
.card:hover { box-shadow: none; border-color: var(--accent); transform: translateY(-3px); }
.sidebar { background: #000; backdrop-filter: none; }
.nav a { font-family: "IBM Plex Mono", monospace; text-transform: uppercase; font-size: 12.5px; }
.nav a.active { background: var(--accent); color: #000; }
.nav a.active .icon { color: #000; filter: none; }
.progress span, .meter span { box-shadow: none; }

/* Editor */
.ed-top { background: #000; backdrop-filter: none; }
.ed-wordmark { font-family: var(--wide); font-weight: 900; font-stretch: 125%; text-transform: uppercase; letter-spacing: -0.02em; font-size: 19px; }
.ed-tab.active { background: var(--accent); color: #000; box-shadow: none; }
.ed-tab.active .icon { color: #000; }
.pstage { background: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px) 0 0 / 28px 28px, linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px) 0 0 / 28px 28px, #050505; }
.pframe, .pvideo { box-shadow: 0 0 0 1px rgba(255,255,255,0.14); }
.stage-hero h2 { font-family: var(--wide); font-weight: 900; font-stretch: 125%; text-transform: uppercase; letter-spacing: -0.035em; line-height: 0.88; }
.stage-hero h2 span { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--accent); }
.tl-playhead { box-shadow: none; }
.tclip.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.preset.active, .anim-opt.active, .font-opt.active, .motion-opt.active, .aspect-pick button.active, .swap.active { box-shadow: inset 0 0 0 1px var(--accent); }
.bubble.user { background: var(--accent); }
.ai-dock .assist-bar:focus-within { box-shadow: none; }
.input:focus, .prompt-box:focus-within { box-shadow: none; }
.toast { border-radius: 0; box-shadow: none; }

/* Videos picked in the Create panel */
.ref video { width: 100%; height: 100%; object-fit: cover; display: block; background: #111; }
.ref-tag { position: absolute; left: 4px; bottom: 4px; padding: 1px 5px; background: var(--accent); color: #000; font: 600 9.5px "IBM Plex Mono", monospace; text-transform: uppercase; }

/* Editor header: a plain text link back to the dashboard. */
.ed-back {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px 0 2px; margin-right: 6px;
  border-right: 1px solid var(--border); font: 500 11.5px "IBM Plex Mono", monospace; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; transition: color 0.2s;
}
.ed-back span { color: var(--accent); transition: transform 0.25s cubic-bezier(.2,.7,.2,1); }
.ed-back:hover { color: var(--text); }
.ed-back:hover span { transform: translateX(-3px); }

/* Redraws must not replay entrance animations (they read as flicker). */
.bubble.seen, .page.again, .page.again > *, .asset img { animation: none; }

/* AI Editor pointer: the control it aims at lights up, then visibly presses. */
.agent-hover { outline: 2px solid #c6ff3d !important; outline-offset: 2px; transition: outline-color 0.15s, transform 0.12s, filter 0.12s; }
.agent-press { transform: scale(0.93) !important; filter: brightness(1.35); }
.agent-cursor.actor.click::before { left: -16px; top: -16px; width: 32px; height: 32px; border-width: 3px; animation-duration: 0.5s; }
.agent-cursor.actor.click::after {
  content: ""; position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--c); opacity: 0.9; animation: ripple 0.35s ease-out forwards;
}

/* Create panel: AI voice option */
.check-row { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.voice-pick[hidden] { display: none; }
/* Anything scrolled into view in the Create panel stops above the sticky "Create video" footer. */
.create-panel > * { scroll-margin-bottom: 130px; }
.bubble.notice-bubble { border-color: rgba(255, 200, 87, 0.45); background: rgba(255, 200, 87, 0.08); }
.bubble.notice-bubble strong { color: var(--amber); }

/* ---------- account + social ---------- */
.account { display: grid; gap: 8px; }
.account-name { margin: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-link { font-size: 12px; color: var(--muted); text-decoration: none; }
.social-link:hover { color: #c6ff3d; }
.login-gate { min-height: 70vh; display: grid; place-items: center; }
.quota[hidden], .account[hidden] { display: none; }
