/* ================================================================
   Ethlenos by Senotel - stylesheet
   Black / white / crimson. DARK is the default (set in app.js — an editor
   sits beside video, and bright chrome washes out the picture); light is
   opt-in via Settings. :root holds light, body.dark overrides it.
   ================================================================ */

:root {
  /* LIGHT — the landing's story section: warm paper, warm ink. Not white.
     A pure #fff page next to a #edeae2 one reads as a mistake, and warm paper
     is kinder beside video anyway. */
  --bg0: #edeae2;
  --bg1: #e7e3da;
  --bg2: #ded9ce;
  --bg3: #d3cec1;
  --line: #cdc7b9;
  --text: #111210;
  --t1: #55534b;
  --t2: #6c6960;             /* NEXT: 4.6:1 on --bg0 (was #86837a, 3.2:1) */
  --acc: #dc143c;             /* crimson — the ONE red, landing and editor */
  --acc2: #a50e2d;            /* deep crimson */
  --acc-soft: rgba(220, 20, 60, 0.10);
  --danger: #dc143c;
  --glow: #f2efe8;
  --bar: rgba(237, 234, 226, 0.86);
  --stagebg: #e4e0d6;

  /* Square, near enough. The landing is literally 0 (see .lp-plus); an app
     needs a little softening at small sizes to stop borders looking chipped,
     so 3px — crisp and drawn, never bubbly. */
  --r: 4px;
  --rs: 2px;

  /* Round 2 design scale (NO UPLOAD/round2-plan.md, stage 3). Every size in
     this file comes from these lists and nothing else: a value that is not
     on a list is the thing that makes an interface look improvised.
     Radius: 2 for small controls, 4 for buttons, tiles and panels, 8 for
     sheets and the stage. Circles use 50%. No pills. */
  --r-1: 2px;
  --r-2: 4px;
  --r-3: 8px;
  /* Type: 10 only for timeline data (durations, ruler), 11 tool labels,
     12 labels, 13 body, 15 titles in panels, 17 sheet titles, 22 and 28
     for the few screen headings. */
  --fs-10: 10px;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-15: 15px;
  --fs-17: 17px;
  --fs-22: 22px;
  --fs-28: 28px;
  /* Spacing is the 4px grid (2 and 6 only inside small controls). */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-state: 120ms;
  --t-sheet: 200ms;
  /* status colours, only ever for status, always with an icon or words */
  /* Timeline tracks: CapCut tells kinds apart by colour; ours share one
     saturation and lightness and differ only in hue, so no track shouts.
     Crimson is not a track colour: it means selected. */
  --trk-text-bg: hsla(28, 70%, 52%, 0.16);   --trk-text-line: hsla(28, 70%, 52%, 0.45);   --trk-text-ink: hsl(28, 55%, 34%);
  --trk-over-bg: hsla(48, 70%, 50%, 0.16);   --trk-over-line: hsla(48, 70%, 50%, 0.45);   --trk-over-ink: hsl(48, 55%, 30%);
  --trk-audio-bg: hsla(205, 55%, 50%, 0.16); --trk-audio-line: hsla(205, 55%, 50%, 0.45); --trk-audio-ink: hsl(205, 50%, 32%);
  --trk-music-bg: hsla(150, 40%, 45%, 0.16); --trk-music-line: hsla(150, 40%, 45%, 0.45); --trk-music-ink: hsl(150, 40%, 28%);
  --trk-fx-bg: hsla(176, 45%, 42%, 0.16);    --trk-fx-line: hsla(176, 45%, 42%, 0.45);    --trk-fx-ink: hsl(176, 50%, 26%);
  --ok: #3f9d6b;
  --warn: #c98a1b;
  --topbar-h: 48px;
  --shadow: 0 14px 34px rgba(17, 18, 16, 0.13);

  /* Switzer, the same face the landing sets. This one line does more for how
     the editor reads than any amount of spacing work: the system stack is
     what made it look like a default dark theme. It is already loaded by
     index.html for the landing, so it costs nothing extra. */
  --font: "Switzer", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.dark {
  /* DARK — the landing's ground, carried through. Warm, not blue: every step
     here is on the same hue as #111210, so the whole app reads as one room
     rather than as an app that happens to be dark. */
  --bg0: #111210;
  --bg1: #171815;
  --bg2: #1d1e1a;
  --bg3: #26271f;
  --line: #2e2f28;
  --text: #edeae2;
  --t1: #a5a298;
  --t2: #7e7c73;             /* NEXT: 4.5:1 on --bg0 (was #6e6c63, 3.6:1) */
  --acc: #dc143c;             /* was #e8244b — a third red nobody chose */
  --acc2: #a50e2d;
  --acc-soft: rgba(220, 20, 60, 0.15);
  --glow: #151613;
  --bar: rgba(17, 18, 16, 0.86);
  --stagebg: #0a0b09;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.62);
  --trk-text-ink: hsl(28, 70%, 72%);
  --trk-over-ink: hsl(48, 70%, 70%);
  --trk-audio-ink: hsl(205, 60%, 72%);
  --trk-music-ink: hsl(150, 40%, 66%);
  --trk-fx-ink: hsl(176, 45%, 66%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg0);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; color: inherit; }

.spark { color: var(--acc); }

/* feature gating (fixed at lv3: pro-only extras hidden) */
body.lv3 [data-min="4"] { display: none !important; }

/* ===================== TOP BAR ===================== */

.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: var(--bar);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}

.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; flex: 1 1 0; min-width: 0; }
.tb-right { justify-content: flex-end; }

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);          /* black mark on light, white on dark */
  cursor: pointer;
  user-select: none;
}
.logo-word {
  font-size: var(--fs-15);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}
.logo-word b { color: var(--acc); font-weight: 600; }

.project-name {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-1);
  color: var(--t1);
  font-size: var(--fs-12);
  font-weight: 500;
  padding: 4px 8px;
  max-width: 150px;
  min-width: 50px;
}
.project-name:hover { background: var(--bg2); color: var(--text); }
.project-name:focus { outline: none; background: var(--bg2); border-color: var(--acc); color: var(--text); }

/* Buttons */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: var(--r-1);
  background: transparent;
  color: var(--t1);
  transition: background-color var(--t-state) var(--ease), border-color var(--t-state) var(--ease), color var(--t-state) var(--ease);
  flex: 0 0 auto;
}
.icon-btn:hover { background: var(--bg3); color: var(--text); }
.icon-btn:active { filter: brightness(0.92); }

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--r-1);
  background: var(--acc);
  color: #fff;
  font-size: var(--fs-12);
  font-weight: 600;
  transition: background-color var(--t-state) var(--ease), border-color var(--t-state) var(--ease), color var(--t-state) var(--ease);
  flex: 0 0 auto;
}
.primary-btn:hover { filter: brightness(1.1); }
.primary-btn:active { filter: brightness(0.92); }

/* secondary / ghost share a height and radius so they line up in a .set-row
   instead of stepping up and down beside each other. */
.secondary-btn, .ghost-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-1);
  font-size: var(--fs-12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.secondary-btn:active, .ghost-btn:active { filter: brightness(0.92); }
.secondary-btn:focus-visible, .ghost-btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* Destructive, and it says so before you touch it — then says it louder once
   it is armed and waiting for the second tap. */
.danger-btn { color: var(--danger); border-color: rgba(220, 20, 60, 0.35); }
.danger-btn:hover { border-color: var(--danger); background: var(--acc-soft); }
.danger-btn.armed {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 600;
}

a.secondary-btn, a.ghost-btn { text-decoration: none; }
.secondary-btn {
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font-weight: 600;
}
.secondary-btn:hover { background: var(--bg3); border-color: var(--t2); }

.ghost-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--t1);
  font-weight: 500;
}
.ghost-btn:hover { background: var(--bg3); color: var(--text); }

.text-btn {
  background: none;
  border: none;
  color: var(--acc);
  font-size: var(--fs-12);
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--r-2);
}
.text-btn:hover { background: var(--acc-soft); }

.editor-only { display: none; }
body[data-screen="editor"] .editor-only { display: inline-flex; }
body[data-screen="editor"] input.editor-only { display: inline-block; }

/* ===================== SCREENS ===================== */

.screen { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.screen.active { display: flex; }

/* ── mode picker ── */
/* Composed like a page, not stacked like a form: room at the top, a heading
   with real size, and the same measure the landing uses. */
.modes-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: clamp(40px, 9vh, 96px) clamp(20px, 5vw, 40px) 60px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.modes-eyebrow {
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--t2);
  margin-bottom: 8px;
}
.modes-title {
  font-size: clamp(28px, 4.2vw, 44px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: clamp(24px, 5vh, 48px);
}
/* The modes are a list, not a row of matching cards with an icon in each: three
   identical boxes read as a template, and a list says these are choices of one
   kind. Each row is the whole tap target; the arrow says it goes somewhere. */
.mode-grid { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.mode-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 20px;
  column-gap: 16px;
  row-gap: 4px;
  align-items: start;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--t-state) var(--ease);
}
.mode-card::after {
  content: "";
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-top: 1.75px solid var(--t2);
  border-right: 1.75px solid var(--t2);
  transform: rotate(45deg);
  transition: border-color var(--t-state) var(--ease), transform var(--t-state) var(--ease);
}
.mode-card:hover::after { border-color: var(--text); transform: translateX(2px) rotate(45deg); }
.mode-card:active { background: var(--bg1); }
.mode-card:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.mode-card > * { grid-column: 1; }
.mode-ico { display: none; }
.mode-name { font-size: var(--fs-17); font-weight: 600; letter-spacing: -0.01em; }
.mode-desc { font-size: var(--fs-13); font-weight: 400; color: var(--t1); line-height: 1.5; max-width: 52ch; }
.mode-best { margin-top: 4px; font-size: var(--fs-12); font-weight: 400; line-height: 1.45; color: var(--t2); }
#screen-home { overflow-y: auto; }

/* ===================== LANDING ===================== */

.landing {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 24px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.landing-mark {
  width: 84px;
  height: 84px;
  object-fit: contain;
}
body.dark .landing-mark { filter: invert(1); }

.logo-img { width: 22px; height: 22px; object-fit: contain; display: block; }
body.dark .logo-img { filter: invert(1); }

.landing h1 {
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.by-senotel {
  font-size: var(--fs-11);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--t2);
  margin-top: -8px;
}

.landing-sub {
  color: var(--t1);
  font-size: var(--fs-15);
  line-height: 1.65;
  max-width: 540px;
}

.landing-feats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.feat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--bg1);
}
.feat-ico { font-size: var(--fs-22); }
.feat strong { font-size: var(--fs-13); font-weight: 600; }
.feat span { font-size: var(--fs-11); color: var(--t1); line-height: 1.5; }

.begin-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  margin-top: 12px;
  border: none;
  border-radius: var(--r-1);
  background: var(--acc);
  color: #fff;
  font-size: var(--fs-15);
  font-weight: 600;
  transition: background-color var(--t-state) var(--ease), border-color var(--t-state) var(--ease), color var(--t-state) var(--ease);
}
.begin-btn .spark { color: #fff; }
.begin-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.begin-btn:active { filter: brightness(0.92); }

.landing-hint { font-size: var(--fs-11); color: var(--t2); }

/* ===================== EDITOR ===================== */

#screen-editor { min-height: 0; }

.ai-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 16px 0;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--bg1);
  transition: border-color 0.18s ease;
}
/* The crimson arrives on focus — a response to you, not a permanent shout. */
.ai-bar:focus-within { border-color: var(--acc); }
.ai-bar input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-13);
  letter-spacing: -0.01em;
  padding: 4px 0;
}
.ai-bar input:focus { outline: none; }
.ai-bar input::placeholder { color: var(--t2); }
/* Export is the one crimson button on this screen; the prompt's button is
   the strongest neutral instead, so the two never compete. */
.ai-go {
  border: none;
  border-radius: var(--r-2);
  height: 32px;
  padding: 0 16px;
  background: var(--text);
  color: var(--bg0);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.01em;
  flex: 0 0 auto;
  transition: background 0.16s ease;
}
.ai-go:hover { background: var(--t1); }
.ai-go:disabled { background: var(--bg3); color: var(--t2); }

.fmt-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 16px 0;
}
.fmt-label {
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--t2);
}
.fmt-row .chip-row { margin: 0; gap: 6px; }
.fmt-row .chip { padding: 4px 12px; font-size: var(--fs-11); }
.fmt-spacer { flex: 1 1 auto; }

/* Find clips: how long, and from where. Plain labelled fields, one row on a
   computer, wrapping to two on a phone. */
.find-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 8px 16px 0;
}
/* From and To wrap together: a start on one line and its end on the next
   reads as two unrelated settings */
.find-range { display: inline-flex; align-items: center; gap: 12px; }
.find-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--t2);
}
.find-field select,
.find-field input {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-12);
  letter-spacing: 0;
  text-transform: none;
}
.find-field input { width: 64px; font-variant-numeric: tabular-nums; }
/* Business row (0.34.0): the same fields as Find clips, sized for words */
.biz-field { flex: 1 1 150px; min-width: 0; }
.biz-field input { flex: 1 1 auto; width: auto; min-width: 0; font-variant-numeric: normal; }
.biz-wide { flex-basis: 260px; }
.find-field select:focus,
.find-field input:focus { outline: none; border-color: var(--acc); }
.find-field input.bad { border-color: var(--danger); }
.find-src {
  flex: 1 1 100px;
  min-width: 0;
  font-size: var(--fs-11);
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

/* The found clips. Same rows as the music list; the reason under each title
   is the point, so it wraps instead of being cut off. */
.clip-watch {
  display: block;
  width: 100%;
  max-height: 34vh;
  margin: 0 0 12px;
  border-radius: var(--r-1);
  background: #000;
}
.clip-row { align-items: flex-start; }
.clip-row .mus-meta { gap: 2px; }
.clip-row .snd-name { white-space: normal; }
.clip-row .snd-hear, .clip-row .snd-add { margin-top: 2px; }
.clip-why {
  font-size: var(--fs-11);
  line-height: 1.45;
  color: var(--t1);
}
.clip-row.made .snd-add { background: var(--bg0); border-color: var(--line); color: var(--t1); }

/* generation status readout — makes silent failures impossible */
.ai-status {
  flex: 0 0 auto;
  margin: 6px 16px 0;
  font-size: var(--fs-11);
  line-height: 1.6;
  color: var(--t2);
}
.ai-status b { color: var(--text); }
/* While the AI edits (0.74.3): a spinner and one line, nothing louder */
.ai-status.working { display: flex; align-items: center; gap: 10px; white-space: nowrap; cursor: default; font-size: var(--fs-13); color: var(--t2); }
.ai-status.working .aw-text { overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ai-status.working .aw-time { margin-left: auto; font-variant-numeric: tabular-nums; }
/* ldrs lineSpinner (MIT, (c) 2022 Griffin Johnston, github.com/GriffinJohnston/ldrs) */
.ldr-line-spinner { --uib-size: 16px; --uib-stroke: 2px; --uib-speed: 1s; position: relative; flex: 0 0 auto; display: inline-block; width: var(--uib-size); height: var(--uib-size); color: var(--text); }
.ldr-line-spinner i { position: absolute; top: 0; left: calc(50% - var(--uib-stroke) / 2); display: flex; align-items: flex-start; height: 100%; width: var(--uib-stroke); }
.ldr-line-spinner i::before { content: ""; height: 22%; width: 100%; border-radius: calc(var(--uib-stroke) / 2); background-color: currentColor; animation: ldr-line-pulse var(--uib-speed) ease-in-out infinite; transform-origin: center bottom; }
.ldr-line-spinner i:nth-child(1) { transform: rotate(-30deg); }
.ldr-line-spinner i:nth-child(1)::before { animation-delay: -0.0833s; }
.ldr-line-spinner i:nth-child(2) { transform: rotate(-60deg); }
.ldr-line-spinner i:nth-child(2)::before { animation-delay: -0.1667s; }
.ldr-line-spinner i:nth-child(3) { transform: rotate(-90deg); }
.ldr-line-spinner i:nth-child(3)::before { animation-delay: -0.2500s; }
.ldr-line-spinner i:nth-child(4) { transform: rotate(-120deg); }
.ldr-line-spinner i:nth-child(4)::before { animation-delay: -0.3333s; }
.ldr-line-spinner i:nth-child(5) { transform: rotate(-150deg); }
.ldr-line-spinner i:nth-child(5)::before { animation-delay: -0.4167s; }
.ldr-line-spinner i:nth-child(6) { transform: rotate(-180deg); }
.ldr-line-spinner i:nth-child(6)::before { animation-delay: -0.5000s; }
.ldr-line-spinner i:nth-child(7) { transform: rotate(-210deg); }
.ldr-line-spinner i:nth-child(7)::before { animation-delay: -0.5833s; }
.ldr-line-spinner i:nth-child(8) { transform: rotate(-240deg); }
.ldr-line-spinner i:nth-child(8)::before { animation-delay: -0.6667s; }
.ldr-line-spinner i:nth-child(9) { transform: rotate(-270deg); }
.ldr-line-spinner i:nth-child(9)::before { animation-delay: -0.7500s; }
.ldr-line-spinner i:nth-child(10) { transform: rotate(-300deg); }
.ldr-line-spinner i:nth-child(10)::before { animation-delay: -0.8333s; }
.ldr-line-spinner i:nth-child(11) { transform: rotate(-330deg); }
.ldr-line-spinner i:nth-child(11)::before { animation-delay: -0.9167s; }
.ldr-line-spinner i:nth-child(12) { transform: rotate(-360deg); }
.ldr-line-spinner i:nth-child(12)::before { animation-delay: -1.0000s; }
@keyframes ldr-line-pulse { 0%, 80%, 100% { transform: scaleY(0.75); opacity: 0; } 20% { transform: scaleY(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ldr-line-spinner i::before { animation-duration: 3s; } }
.ai-status .warn { color: var(--acc); font-weight: 600; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg2);
  color: var(--t1);
  font-size: var(--fs-12);
  font-weight: 500;
  transition: background-color var(--t-state) var(--ease), border-color var(--t-state) var(--ease), color var(--t-state) var(--ease);
}
.chip:hover { border-color: var(--t2); color: var(--text); }
.chip.selected { border-color: var(--text); background: var(--bg3); color: var(--text); font-weight: 600; }

.stage-zone {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  padding: 12px 16px 6px;
}

.preview-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.stage {
  flex: 1 1 auto;
  min-height: 140px;
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stage video, .stage img {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* The players fill the stage and play there, but are never seen: since
   0.32.0 every frame of the picture is drawn onto the layout canvas by
   renderPicture (app.js), exactly as the export draws it. They stay laid
   out (opacity 0, not display: none) because some browsers stop decoding a
   video that isn't in the page. */
#pv, #pi, #pvT, .broll-layer { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.layout-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }

/* ABOVE the fade veil (z-index 3). The veil and this layer used to share a
   z-index, and the veil comes later in the DOM — so it painted over the hook.
   A hook starts at 0.1s and the opening fade runs 0.4s, meaning the single most
   important text in the video spent most of its life behind a black curtain. */
.overlay-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
/* Position and size come from app.js (headingLayout), NOT from here — the
   same numbers drive the canvas export, so the two cannot drift. left/top are
   set inline as the CENTRE of the line, which is why the translate is
   unconditional; there are no longer per-position rules to disagree with it.
   Anton is weight 400 only: asking for 800 gets a faked bold that the canvas
   renders differently from the DOM. */
/* The box gets an EXPLICIT width from app.js and is only shifted vertically.
   It used to be placed by its centre (left + translateX(-50%)) with no width,
   which makes CSS shrink-to-fit offer it just `container − left` — half the
   picture. Long headings therefore wrapped to ~50% width no matter what
   max-width said, and the re-centring hid the cause: the line looked fine in
   the small preview and "stacked up" the moment fullscreen made it wider. */
.overlay-text {
  position: absolute;
  transform: translateY(-50%);
  text-align: center;
  font-family: "Anton", "Arial Narrow", Impact, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85);
  white-space: pre-wrap;
  line-height: 1.15;
}

.fade-veil {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}
.cap-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.stage-empty {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 32px;
  text-align: center;
  color: var(--t2);
  background: var(--stagebg);
}
.stage-empty .stage-add { margin-bottom: 12px; }
.stage-empty-title { font-size: var(--fs-15); font-weight: 500; color: #edeae2; }
.stage-empty-sub { font-size: var(--fs-13); line-height: 1.5; color: #8d8a80; max-width: 32ch; }
.stage-add {
  width: 54px;
  height: 54px;
  border: none;
  border-radius: var(--r-1);
  background: var(--acc);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--t-state) var(--ease), border-color var(--t-state) var(--ease), color var(--t-state) var(--ease);
}
.stage-add:hover { background: var(--acc2); transform: translateY(-1px); }

/* transport */
.transport {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 2px 2px;
}
.play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
}
.play-btn:hover { background: var(--acc); border-color: var(--acc); color: #fff; }

.tcode {
  font-size: var(--fs-11);
  font-variant-numeric: tabular-nums;
  color: var(--t1);
  min-width: 40px;
  text-align: center;
}

.seek {
  flex: 1 1 auto;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg3);
  border-radius: var(--r-2);
  cursor: pointer;
  min-width: 60px;
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--acc);
  border: 2px solid #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}
.seek::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--acc); border: 2px solid #fff;
}
.seek::-moz-range-progress { background: var(--acc); border-radius: var(--r-2); height: 4px; }

/* ─── Fullscreen preview (phone-friendly: exit + scrubber) ─── */
.fs-exit { display: none; }

body.previewFs #previewWrap {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #000;
  display: flex;
  flex-direction: column;
  padding: 0;
}
body.previewFs .stage {
  flex: 1 1 auto;
  border: none;
  border-radius: 0;
  background: #000;
}
body.previewFs .transport {
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom, 8px));
  gap: 16px;
  background: linear-gradient(0deg, rgba(0,0,0,0.6), transparent);
}
body.previewFs .transport .play-btn { width: 48px; height: 48px; }
body.previewFs .transport .icon-btn { width: 42px; height: 42px; }
body.previewFs .tcode { color: #fff; font-size: var(--fs-13); }
body.previewFs .seek { height: 5px; }

body.previewFs .fs-exit {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 310;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  backdrop-filter: blur(6px);
}
body.previewFs .fs-exit:active { filter: brightness(0.92); }

/* inspector */
.inspector {
  flex: 0 0 auto;
  margin: 8px 16px 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--bg1);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 20px;
  animation: rise 0.18s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.ins-title {
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--t1);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 180px;
  overflow: hidden;
}
.ins-title em { font-style: normal; color: var(--acc); }

.ins-group { display: flex; align-items: center; gap: 8px; }
.ins-group label { font-size: var(--fs-11); font-weight: 600; color: var(--t2); white-space: nowrap; }
.ins-group input[type="range"] {
  width: 110px;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg3);
  border-radius: var(--r-2);
  cursor: pointer;
}
.ins-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text);
}
.ins-group input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); border: none;
}
.ins-group output { font-size: var(--fs-11); color: var(--t1); min-width: 34px; font-variant-numeric: tabular-nums; }

.ins-group input[type="text"] {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-13);
  width: 190px;
}
.ins-group input[type="text"]:focus { outline: none; border-color: var(--acc); }
.ins-group input[type="color"] {
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--bg2);
  padding: 2px;
  cursor: pointer;
}

.ins-seg { display: flex; gap: 2px; padding: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-1); }
/* Every option takes an equal share of the track. Without this the buttons
   size to their own label, so a short word like "Light" sat as a small pill
   beside a wide empty "Dark" half. */
.ins-seg button {
  flex: 1 1 0;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--t1);
  font-size: var(--fs-12);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--r-1);
  text-align: center;
  transition: background 0.16s ease, color 0.16s ease;
}
.ins-seg button:hover:not(.active) { color: var(--text); background: var(--bg3); }
.ins-seg button.active { background: var(--bg0); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.3); }
.ins-seg button:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg2);
  color: var(--t1);
  font-size: var(--fs-11);
  font-weight: 600;
}
.fchip:hover { color: var(--text); border-color: var(--t2); }
.fchip.active { border-color: var(--text); background: var(--bg3); color: var(--text); }

.ins-toggle {
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg2);
  color: var(--t1);
  font-size: var(--fs-11);
  font-weight: 600;
  padding: 6px 12px;
}
.ins-toggle.on { border-color: var(--text); color: var(--text); background: var(--bg3); }

.ins-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--t2);
  font-size: var(--fs-13);
  width: 28px; height: 28px;
  border-radius: var(--r-2);
}
.ins-close:hover { background: var(--bg3); color: var(--text); }

.ins-meta { font-size: var(--fs-11); color: var(--t2); font-variant-numeric: tabular-nums; }

/* toolbar */
.toolbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 6px 16px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg1);
  overflow-x: auto;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }

.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 64px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-1);
  background: transparent;
  color: var(--t1);
  /* Small caps with real tracking. A 10px label set solid looks like a
     placeholder; tracked out, the same label looks specified. */
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0;
  transition: color 0.15s ease, background 0.15s ease;
}
.tool svg { opacity: 0.9; }
.tool:hover { background: var(--bg2); color: var(--text); }
.tool:hover svg { opacity: 1; }
.tool:active { transform: translateY(0.5px); }
.tool-danger:hover { color: var(--danger); }

/* media strip */
.media-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg1);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.media-strip::-webkit-scrollbar { display: none; }

.ms-add {
  flex: 0 0 auto;
  width: 74px;
  height: 52px;
  border: 1px dashed var(--line);
  border-radius: var(--r-1);
  background: transparent;
  color: var(--t2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: var(--fs-10);
  font-weight: 600;
  transition: background-color var(--t-state) var(--ease), border-color var(--t-state) var(--ease), color var(--t-state) var(--ease);
}
.ms-add:hover { border-color: var(--acc); color: var(--acc); }

.ms-item {
  position: relative;
  flex: 0 0 auto;
  width: 74px;
  height: 52px;
  border-radius: var(--r-1);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg2);
  cursor: pointer;
}
.ms-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ms-item .ms-dur {
  position: absolute;
  bottom: 3px; right: 4px;
  font-size: var(--fs-10);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: var(--r-2);
  padding: 1px 4px;
}
.ms-item .ms-plus {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  border: none;
  border-radius: var(--r-2);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: var(--fs-13);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.ms-item:hover .ms-plus { opacity: 1; }
.ms-item .ms-plus:hover { background: var(--acc); }

.ms-state {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--acc);
}
.ms-state.work { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ===================== TIMELINE ===================== */

.tl-zone {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--bg1);
  margin-top: 8px;
}

.tl-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px 6px;
  border-bottom: 1px solid var(--line);
}
.tl-time {
  font-size: var(--fs-12);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--acc);
}
.tl-hint {
  flex: 1 1 auto;
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--t2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-zoom { display: flex; align-items: center; gap: 6px; color: var(--t2); }
.tl-zoom input {
  width: 100px;
  height: 3px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg3);
  border-radius: var(--r-2);
  cursor: pointer;
}
.tl-zoom input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--t1);
}
.tl-zoom input::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--t1); border: none; }

.tl-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 0 12px;
  /* A sideways swipe moves along time and never drifts up or down (the
     browser locks a swipe to the way it started; the editor page itself
     never scrolls, CapCut, owner 2026-10-22). An up-or-down swipe moves
     through the tracks (0.34.1: they used to be cut off on phones). Two
     fingers are a pinch app.js turns into zoom, and a swipe that reaches
     the end stops there instead of going "back" in the browser. */
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
}

.tl-inner { position: relative; min-width: 100%; width: max-content; padding: 0 20px; }

/* The ruler, spaced the way CapCut spaces it: a time every ~70px or more,
   centred on its second, a dot halfway between, and nothing else. */
.ruler {
  height: 26px;
  position: relative;
  user-select: none;
  cursor: crosshair;
}
.rt {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  font-size: var(--fs-11);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--t2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}
.rdot {
  position: absolute;
  top: 12px;
  width: 3px;
  height: 3px;
  margin-left: -1px;
  border-radius: 50%;
  background: var(--t2);
  opacity: 0.7;
  pointer-events: none;
}
.snap-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  margin-left: -0px;
  background: #e8c547;
  z-index: 7;
  pointer-events: none;
}

.track { position: relative; }
.track-text {
  height: 32px;
  margin: 4px 0;
  border-radius: var(--r-1);
  background: var(--bg1);
  box-shadow: inset 0 0 0 1px var(--line);
}
/* The main track is the spine, so it is the tallest and the only one with a
   solid ground rather than a tint. */
.track-video {
  height: 64px;
  border-radius: var(--r-1);
  background: var(--bg2);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: crosshair;
}

.clip {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: var(--r-3);
  overflow: hidden;
  border: 1.5px solid var(--line);
  background: var(--bg3);
  display: flex;
  align-items: stretch;
  cursor: grab;
  touch-action: pan-x pan-y;   /* swipes scroll the timeline; a hold picks the clip up (holdToDrag) */
  min-width: 26px;
  user-select: none;
}
/* the frame strip: square pictures from inside the clip, edge to edge */
.clip .cstrip { position: absolute; inset: 0; display: flex; overflow: hidden; pointer-events: none; background: #1b1c1a; }
.clip .cstrip img { flex: 0 0 56px; width: 56px; height: 100%; object-fit: cover; display: block; }
.clip .cname, .clip .cdur, .clip .cbadge {
  position: absolute;
  max-width: calc(100% - 12px);
  padding: 1px 4px;
  border-radius: var(--r-2);
  background: rgba(17, 18, 16, 0.72);
  color: #edeae2;
  font-size: var(--fs-10);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.clip .cname { top: 4px; left: 6px; }
.clip .cbadge { bottom: 4px; left: 6px; }
.clip .cdur { top: 4px; right: 6px; font-variant-numeric: tabular-nums; }
.clip.sel .cname { left: 16px; }
.clip.sel .cdur { right: 16px; }
.clip.sel { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); z-index: 3; }
.clip.dragging { opacity: 0.75; z-index: 8; cursor: grabbing; }

.handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  touch-action: none;
  z-index: 7;   /* lanes < playhead (6) and cut squares (6) < handles; the snap line (7) comes later and stays on top */
}
.handle::after {
  content: "";
  width: 3.5px;
  height: 55%;
  border-radius: var(--r-1);
  background: #fff;
}
/* solid grips, CapCut's shape in Senotel crimson: no fade, no halo */
.handle.hl { left: 0; background: var(--acc); border-radius: var(--r-2) 0 0 var(--r-2); }
.handle.hr { right: 0; background: var(--acc); border-radius: 0 var(--r-2) var(--r-2) 0; }

.tclip {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: var(--r-2);
  background: var(--trk-text-bg);
  border: 1px solid var(--trk-text-line);
  color: var(--trk-text-ink);
  font-size: var(--fs-10);
  font-weight: 600;
  display: flex;
  align-items: center;
  padding: 0 8px;
  overflow: hidden;
  white-space: nowrap;
  cursor: grab;
  touch-action: pan-x pan-y;   /* swipes scroll the timeline; a hold picks the clip up (holdToDrag) */
  min-width: 24px;
  user-select: none;
}
.tclip.sel { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); z-index: 3; }

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--text);
  z-index: 6;
  pointer-events: none;
}
.playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: -4.5px;
  border: 5.5px solid transparent;
  border-top: 7px solid var(--text);
}


/* ===================== OVERLAY + AUDIO TRACKS =====================

   CapCut's structure, Ethlenos's palette. Each track carries its own colour so a
   glance down the timeline tells you what kind of thing is where without
   reading a single label: crimson is the footage you cut, amber sits over it,
   violet is sound. Height differences do the same job — the main track is the
   tallest because it is the spine of the edit. */

/* Every lane is drawn whether or not it holds anything — the empty lane is
   what tells you where a thing can go. Neutral, though: see the note above. */
.track-overlay {
  height: 30px;
  margin: 4px 0 2px;
  border-radius: var(--r-1);
  background: var(--bg1);
  box-shadow: inset 0 0 0 1px var(--line);
}
.track-overlay .overlay-lane {
  position: absolute;
  left: 0;
  right: 0;
  height: 30px;
  border-radius: var(--r-1);
  background: var(--bg1);
  box-shadow: inset 0 0 0 1px var(--line);
  pointer-events: none;
}
.track-audio {
  height: 30px;
  margin: 4px 0 0;
  border-radius: var(--r-1);
  background: var(--bg1);
  box-shadow: inset 0 0 0 1px var(--line);
}

.oclip, .aclip {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: var(--r-2);
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  cursor: grab;
  touch-action: pan-x pan-y;   /* swipes scroll the timeline; a hold picks the clip up (holdToDrag) */
  user-select: none;
}

/* Overlay — amber. It is a picture, so it shows its thumbnail like a clip. */
.oclip {
  min-width: 26px;
  background: var(--trk-over-bg);
  border: 1px solid var(--trk-over-line);
  color: var(--trk-over-ink);
}
.oclip img {
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  flex: 0 0 auto;
  pointer-events: none;
  opacity: 0.95;
}
.oclip .oname {
  padding: 0 6px;
  font-size: var(--fs-10);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.oclip.sel {
  border-color: var(--acc);
  box-shadow: inset 0 0 0 1px var(--acc);
  z-index: 3;
}

/* Sound — violet, and it wears a waveform so it never reads as a picture. */
.aclip {
  min-width: 22px;
  background: var(--trk-audio-bg);
  border: 1px solid var(--trk-audio-line);
  color: var(--trk-audio-ink);
  padding: 0 6px;
  gap: 6px;
}
.aclip .aname {
  font-size: var(--fs-10);
  font-weight: 600;
  pointer-events: none;
  flex: 0 0 auto;
}
.aclip .awave {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 60%;
  flex: 1 1 auto;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.55;
}
.aclip .awave i {
  width: 1.5px;
  border-radius: var(--r-1);
  background: currentColor;
  flex: 0 0 auto;
}
.aclip.sel {
  border-color: var(--acc);
  box-shadow: inset 0 0 0 1px var(--acc);
  z-index: 3;
}

/* The + at the end of the main track. Dashed, so it reads as a slot waiting to
   be filled rather than as a clip that is already there. */
.clip-add {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 40px;
  margin-left: 6px;
  border-radius: var(--r-3);
  border: 1.5px dashed var(--t2);
  background: transparent;
  color: var(--t2);
  font-size: var(--fs-17);
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.16s, color 0.16s, background 0.16s;
}
.clip-add:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: var(--acc-soft);
}

/* The playhead is fixed in the middle now, so it is permanent furniture rather
   than a marker that comes and goes — it earns a bit more presence. */
.playhead { width: 2px; }
.playhead::before {
  left: -5px;
  border: 6px solid transparent;
  border-top: 8px solid var(--acc);
}
.playhead { background: var(--acc); }

/* Dark theme: the amber and violet inks are readable on white and invisible
   on near-black, so only the TEXT colour flips — the fills and borders were
   picked to work on both and are left alone. */

/* ===================== SOUNDS SHEET =====================

   A list, not a gallery of cards. Ten sounds is something you scan down, and a
   row that is the same height as the thing it names is quicker to read than a
   tile that has to be looked AT. Name on the left, length beside it, then the
   two things you can do. */

.sheet-sub {
  font-size: var(--fs-11);
  color: var(--t2);
  font-variant-numeric: tabular-nums;
}

.snd-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 6px;
}

.snd-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-1);
  border: 1px solid transparent;
  transition: background 0.14s, border-color 0.14s;
}
.snd-row:hover { background: var(--bg1); }
.snd-row + .snd-row { border-top: 1px solid var(--line); border-radius: var(--r-1); }
.snd-row.lit { border-color: var(--trk-audio-line); background: var(--trk-audio-bg); }

.snd-name {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--text);
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.snd-dur {
  font-size: var(--fs-10);
  color: var(--t2);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.snd-hear, .snd-add {
  flex: 0 0 auto;
  cursor: pointer;
  /* Square like the rest of the product. The round PREVIEW button below is
     the exception on purpose — a play affordance is round everywhere. */
  border-radius: var(--r-1);
  border: 1px solid var(--line);
  background: var(--bg0);
  color: var(--t1);
  font-size: var(--fs-11);
  font-weight: 600;
  transition: border-color 0.14s, color 0.14s, background 0.14s, transform 0.1s;
}
.snd-hear:active, .snd-add:active { filter: brightness(0.92); }

/* Preview is a round play button — it does one obvious thing and needs no word. */
.snd-hear {
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.snd-hear svg { margin-left: 1px; }   /* a triangle looks off-centre when it is centred */
.snd-hear:hover { border-color: var(--t2); color: var(--text); }

.snd-add {
  padding: 6px 16px;
  border-color: var(--acc);
  background: var(--acc);
  color: #fff;
}
.snd-add:hover { background: var(--acc2); border-color: var(--acc2); }

/* Library, when it is being used to pick an overlay rather than to browse */
.lib-note {
  margin: 0 0 8px;
  font-size: var(--fs-11);
  color: var(--acc);
  font-weight: 600;
}
.lib-item.pickable { cursor: pointer; }
.lib-item.pickable:hover {
  border-color: var(--acc);
  box-shadow: inset 0 0 0 1px var(--acc);
}

/* ===================== SHEETS ===================== */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 10, 0.55);
  backdrop-filter: blur(3px);
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 78vh;
  overflow-y: auto;
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: var(--r-3) var(--r-3) 0 0;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  animation: sheetUp var(--t-sheet) var(--ease);
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: var(--r-2);
  background: var(--bg3);
  margin: 4px auto 16px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sheet-head h3 { font-size: var(--fs-15); font-weight: 600; }

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}
.lib-item {
  position: relative;
  aspect-ratio: 16 / 11;
  border-radius: var(--r-3);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg2);
}
.lib-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-item .li-badge {
  position: absolute;
  bottom: 4px; left: 5px;
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: var(--r-2);
  padding: 1px 4px;
}
.lib-item .li-x {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border: none;
  border-radius: var(--r-2);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: var(--fs-11);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lib-item .li-x:hover { background: var(--danger); }
.lib-empty { text-align: center; color: var(--t2); font-size: var(--fs-13); padding: 24px 0; }

/* settings sheet */
.set-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.set-group:last-of-type { border-bottom: none; }
.set-group > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-15);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.set-note { font-size: var(--fs-13); font-weight: 400; color: var(--t2); line-height: 1.5; max-width: 60ch; }
/* a two-way setting is a compact control, not a half-screen bar */
.set-group > .ins-seg { align-self: flex-start; min-width: 168px; }
.set-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.set-input {
  flex: 1 1 180px;
  height: 38px;              /* matches .secondary-btn so the row sits flush */
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-12);
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
/* ── Settings → About ──
   Subtle by design: the version is for support and debugging, so it sits at the
   bottom of Settings and never on the editing interface. */
.about-group { padding-top: 16px; }
.about-app { display: flex; align-items: center; gap: 12px; }
.about-logo { width: 30px; height: 30px; object-fit: contain; opacity: 0.9; }
body.dark .about-logo { filter: invert(1); }
.about-lines { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.about-lines strong { font-size: var(--fs-13); font-weight: 600; letter-spacing: -0.01em; }
.about-legal { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 4px; font-size: var(--fs-12); }
.about-legal a { color: var(--t1); text-decoration: underline; text-underline-offset: 3px; }
.about-legal a:hover { color: var(--text); }
.about-version {
  font-size: var(--fs-11);
  font-weight: 500;
  color: var(--t2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.set-input::placeholder { color: var(--t2); }
.set-input:focus { outline: none; border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.set-soon {
  margin-top: 16px;
  text-align: center;
  font-size: var(--fs-11);
  color: var(--t2);
}

/* ===================== EXPORT OVERLAY ===================== */

.export-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 10, 0.7);
  backdrop-filter: blur(5px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.export-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 24px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}
.export-card { text-align: left; }
.export-card h3 { font-size: var(--fs-17); font-weight: 600; margin-bottom: 16px; }
.exp-track {
  height: 4px;
  border-radius: var(--r-2);
  background: var(--bg3);
  overflow: hidden;
}
.exp-bar {
  height: 100%;
  width: 0%;
  border-radius: var(--r-2);
  background: var(--acc);
  transition: width 0.2s linear;
}
.exp-status { margin: 12px 0 20px; font-size: var(--fs-12); color: var(--t1); }
#expPct { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ===================== TOAST ===================== */

/* A toast is a one-line receipt, not a dialog: inverted so it reads against
   any picture, left-aligned, just above the tool bar. */
.toast {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: var(--r-2);
  background: var(--text);
  color: var(--bg0);
  font-size: var(--fs-13);
  font-weight: 500;
  line-height: 1.35;
  box-shadow: var(--shadow);
  z-index: 200;
  width: max-content;
  max-width: min(calc(100vw - 32px), 440px);
  text-align: left;
  animation: toastIn var(--t-sheet) var(--ease);
}
/* with a tool panel open, the bottom is the panel: the receipt moves under the top bar instead of covering the controls you are using */
body.panel-open .toast { bottom: auto; top: calc(var(--topbar-h) + 8px); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===================== SCROLLBARS ===================== */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: var(--r-2); border: 2px solid var(--bg1); }
::-webkit-scrollbar-thumb:hover { background: var(--t2); }

/* ===================== RESPONSIVE ===================== */

/* A phone's browser bars come and go; the dynamic height is the part that is
   actually on screen, so the bottom of the timeline is never under them. */
@supports (height: 100dvh) {
  body { height: 100dvh; }
}

/* Touchscreens have no hover, so what hover reveals on a computer is simply
   shown, and the trim handles are wide enough for a finger. */
@media (hover: none) {
  .ms-item .ms-plus { opacity: 1; }
}
@media (pointer: coarse) {
  .handle { width: 20px; }
}

@media (max-width: 760px) {
  .topbar { padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); gap: 6px; }
  .logo-word { font-size: var(--fs-13); }
  /* In the editor the title takes the logo's place: Back already goes home,
     and naming the video matters more than the mark. */
  body[data-screen="editor"] .logo { display: none; }
  .tb-left { gap: 4px; }
  .tb-right { flex: 0 0 auto; gap: 2px; }
  .topbar .icon-btn { width: 32px; height: 36px; }
  .project-name { flex: 1 1 auto; width: 100%; min-width: 0; max-width: none; padding: 6px 8px; font-size: var(--fs-13); color: var(--text); }
  #exportBtn { padding: 8px 12px; gap: 6px; }

  .ai-bar { margin: 8px 12px 0; }
  .fmt-row { margin: 8px 12px 0; }
  .find-row { margin: 8px 12px 0; }
  /* The edit's summary is one line on a phone (tap it for the rest): at full
     length it took 90px from the timeline after every edit (0.34.1) */
  .ai-status { margin: 6px 12px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
  .ai-status.open { white-space: normal; max-height: 30vh; overflow-y: auto; }
  .stage-zone { padding: 8px 12px 2px; }
  /* A third of the screen for the picture, the rest for the work, the split
     CapCut uses on a phone */
  /* CapCut's split on a phone: the picture takes a fixed share, the timeline
     the rest (a third of the screen or more), so editing is never squeezed */
  .stage-zone { flex: 0 0 auto; }
  .stage { flex: 0 0 auto; height: clamp(210px, 40vh, 420px); min-height: 0; }
  .tl-zone { flex: 1 0 auto; min-height: 230px; }
  /* the library strip repeats Add and the Library button; on a phone that row belongs to the timeline */
  .media-strip { display: none; }
  .transport { gap: 6px; padding-top: 6px; }
  .tcode { min-width: 36px; font-size: var(--fs-11); }

  /* The settings for what is selected open under the timeline (see
     revealInspector in app.js) */
  .inspector { order: 1; margin: 8px 12px 12px; padding: 12px 12px; gap: 12px 16px; }
  .ins-group { flex-wrap: wrap; }
  .ins-group input[type="range"] { width: 120px; }
  .ins-group input[type="text"] { width: 160px; }

  .toolbar { justify-content: flex-start; gap: 4px; padding: 4px 8px; margin-top: 6px; }
  .tool { min-width: 56px; padding: 6px 8px; gap: 4px; white-space: nowrap; }
  .media-strip { padding: 6px 12px; gap: 6px; }
  .ms-add, .ms-item { width: 62px; height: 44px; }

  .tl-zone { margin-top: 0; border-top: 0; }
  .tl-top { padding: 6px 12px; }
  .tl-hint { display: none; }
  .tl-scroll { padding: 4px 0 12px; }

  .sheet { border-radius: var(--r-3) var(--r-3) 0 0; }
  .toast { bottom: 110px; }
}

/* On phones and tablets, lanes with nothing on them fold away and give the
   room to the preview; each comes back the moment something is put on it */
@media (max-width: 1100px) {
  .track.empty { display: none; }
  .track.empty.offer { display: block; }
}

/* Room for the title on the narrowest phones */
@media (max-width: 350px) {
  #exportBtn .exp-word { display: none; }
  #exportBtn { padding: 8px 12px; }
}


/* ===================== TOLD, NOT INTERRUPTED =====================

   Two surfaces that speak for the app itself rather than for the browser. */

/* One notification language in fullscreen, compact preview and completion.
   Opaque fallback first; glass is a progressive enhancement. */
.notice-card {
  --swipe-x: 0px;
  --swipe-y: 0px;
  --notice-enter: 10px;
  position: fixed;
  z-index: 420;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 380px;
  max-width: calc(100vw - 32px);
  padding: 20px 12px 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--bg1);
  color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / 20%), 0 2px 6px rgb(0 0 0 / 8%), inset 0 1px 0 rgb(255 255 255 / 6%);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(var(--swipe-x), calc(var(--swipe-y) + var(--notice-enter)));
  transition: opacity .22s ease, transform .32s cubic-bezier(.22, 1, .36, 1), visibility .32s;
  touch-action: none;
}
@supports (backdrop-filter: blur(20px)) {
  .notice-card { background: var(--bar); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
}
.notice-card.on { --notice-enter: 0px; visibility: visible; opacity: var(--swipe-opacity, 1); pointer-events: auto; }
.notice-card.dragging { transition: none; cursor: grabbing; user-select: none; }
.fs-notice { left: 0; right: 0; margin-inline: auto; bottom: max(100px, calc(env(safe-area-inset-bottom) + 88px)); }
.done-card { top: calc(var(--topbar-h) + 96px + env(safe-area-inset-top)); right: max(20px, env(safe-area-inset-right)); }
.notice-symbol { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: var(--r-2); color: var(--t1); }
.notice-symbol svg { width: 19px; height: 19px; }
/* done is a status, so it wears the status colour, never the brand red */
.notice-success { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: transparent; }
.notice-copy { flex: 1; min-width: 0; padding-top: 1px; }
.notice-eyebrow { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--t2); font-size: var(--fs-12); line-height: 1.3; font-weight: 500; letter-spacing: 0; }
.notice-dot { display: none; }
.notice-title { display: block; font-size: var(--fs-13); font-weight: 600; line-height: 1.35; letter-spacing: -.025em; overflow-wrap: anywhere; }
.notice-detail { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; color: var(--t1); font-size: var(--fs-12); line-height: 1.55; overflow-wrap: anywhere; }
.notice-detail:empty { display: none; }
.notice-close { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; margin: -8px -4px 0 0; padding: 12px; border: 0; border-radius: var(--r-2); background: transparent; color: var(--t2); cursor: pointer; transition: background .15s, color .15s; }
.notice-close svg { width: 16px; height: 16px; }
.notice-close:hover { background: var(--bg3); color: var(--text); }
.notice-close:focus-visible, .notice-action:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.notice-action { display: inline-flex; align-items: center; gap: 16px; min-height: 44px; margin-top: 4px; color: var(--text); font-size: var(--fs-12); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.notice-action span { color: var(--acc); }
@media (max-width: 640px) {
  .notice-card { width: auto; max-width: none; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); padding: 16px 12px 16px 16px; gap: 12px; }
  .fs-notice { bottom: max(92px, calc(env(safe-area-inset-bottom) + 80px)); }
}
@media (prefers-reduced-motion: reduce) {
  .notice-card { transition: none; }
}


/* Sound search. Sits between the sheet head and the list, quiet until used. */
.snd-search { margin: 2px 0 12px; }
.snd-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg1);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-13);
  transition: border-color .16s ease;
}
.snd-search input::placeholder { color: var(--t2); }
.snd-search input:focus { outline: none; border-color: var(--acc); }
.snd-search input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.5); }
.snd-none { padding: 16px 2px; font-size: var(--fs-12); color: var(--t2); }


/* ===================== PAGES =====================

   Settings and the admin panel are screens, not sheets. A bottom sheet is for
   a quick choice you make and dismiss; these are places you go, read, and
   change deliberately, so they get a page's composition: room at the top, a
   heading with real size, and sections separated by rules. Same measure as the
   modes screen so the three feel like one product. */

.page-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: clamp(36px, 8vh, 88px) clamp(20px, 5vw, 40px) 72px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.page-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--t2);
  margin-bottom: 8px;
}
.page-title {
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.035em;
  margin-bottom: clamp(30px, 5vh, 52px);
}

/* Each setting is its own band with a rule above it, so the page reads as a
   list of decisions rather than a wall of controls. */
.page-wrap .set-group {
  padding: 24px 0;
  border-top: 1px solid var(--line);
  margin: 0;
}
.page-wrap .set-group:first-of-type { border-top: 0; padding-top: 0; }
.page-wrap .set-group > label {
  display: block;
  font-size: var(--fs-15);
  font-weight: 500;
  letter-spacing: -0.005em;
  margin-bottom: 4px;
}
.page-wrap .set-note {
  display: block;
  font-size: var(--fs-13);
  font-weight: 400;
  line-height: 1.5;
  color: var(--t2);
  max-width: 60ch;
  margin-top: 4px;
}
.page-wrap .set-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.page-wrap .about-group { border-top: 1px solid var(--line); }
.page-wrap .about-version { font-size: var(--fs-11); color: var(--t2); margin-top: 12px; font-variant-numeric: tabular-nums; }

/* ===================== ADMIN ===================== */

.admin-lock { max-width: 460px; }
.admin-err { margin-top: 12px; font-size: var(--fs-12); color: var(--danger); }
.admin-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.admin-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 132px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--bg1);
}
.admin-tile-v { font-size: var(--fs-28); font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.admin-tile-k { font-size: var(--fs-12); font-weight: 500; letter-spacing: 0; color: var(--t2); }
.admin-list { margin-top: 24px; }
.admin-sub { font-size: var(--fs-12); font-weight: 500; letter-spacing: 0; color: var(--t2); margin: 24px 0 12px; }
.admin-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-13);
}
.admin-row-k { color: var(--text); }
.admin-row-n { color: var(--t2); font-variant-numeric: tabular-nums; }
.admin-json {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg1);
  color: var(--t1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-11);
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow-y: auto;
}

/* .ins-seg was built for the inspector, where it sits inline in a narrow
   column. On a full-width page it stretched edge to edge and read as two
   enormous buttons, so it is pinned to its content here. */
.page-wrap .ins-seg { width: fit-content; max-width: 100%; }
.page-wrap .ins-seg:not(.seg-switch) button { min-width: 88px; }


/* ===================== AUDIO: MUSIC AND EFFECTS =====================

   Two tabs in one sheet, the way TikTok and Instagram keep music behind a
   single Sounds control. Square, per the house rules. */

.aud-tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--line);
}
.aud-tab {
  position: relative;
  padding: 12px 16px 12px;
  border: 0;
  background: transparent;
  color: var(--t2);
  font-family: inherit;
  font-size: var(--fs-11);
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  transition: color .16s ease;
}
.aud-tab:hover { color: var(--text); }
/* The active tab is marked by a rule under it, not by a filled lozenge. */
.aud-tab.active { color: var(--text); }
.aud-tab.active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: -1px;
  height: 2px;
  background: var(--acc);
}

.mus-status { min-height: 18px; margin: 0 0 8px; font-size: var(--fs-11); color: var(--t2); }
.mus-row .mus-meta { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.mus-row .snd-name { flex: 0 1 auto; }
.mus-by {
  font-size: var(--fs-10);
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mus-licence {
  margin: 16px 0 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-11);
  line-height: 1.5;
  color: var(--t2);
}

/* ===================== THE MUSIC LANE =====================

   Below sound effects, its own lane, as CapCut does it: a bed runs the whole
   length and on the effects lane it would sit behind every effect and steal
   their clicks. Neutral like the other lanes, with the brand crimson as a
   single edge rather than a fill. */
.track-music {
  height: 26px;
  margin: 4px 0 0;
  border-radius: var(--r-1);
  background: var(--bg1);
  box-shadow: inset 0 0 0 1px var(--line);
}
.mclip {
  position: absolute;
  top: 1px;
  bottom: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: var(--r-1);
  border: 1px solid var(--line);
  background: var(--trk-music-bg);
  border-color: var(--trk-music-line);
  color: var(--t1);
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.mclip::before { content: "\266A"; font-size: var(--fs-11); color: var(--trk-music-ink); }
.mclip .mname { font-size: var(--fs-10); font-weight: 600; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; }
.mclip.sel { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); color: var(--text); z-index: 3; }

/* ===================== ADD MEDIA =====================
   One sheet for every way in. The device comes first and largest because it
   is what most people use; a link sits under it because pasting is one
   gesture; the cloud services follow, and only the ones that are set up. */
.add-device {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg1);
  color: var(--text);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.add-device:hover { border-color: var(--acc); background: var(--bg2); }
.add-device:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.add-device-main { font-size: var(--fs-13); font-weight: 600; }
.add-device-sub { font-size: var(--fs-11); color: var(--t2); }
/* A phone's other ways in, under the gallery: same card, half the width */
.add-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.add-ways:has(#addCamera.hidden) #addFiles { grid-column: 1 / -1; }
.add-way {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg1);
  color: var(--text);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.add-way:hover { border-color: var(--acc); background: var(--bg2); }
.add-way:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.add-way-main { font-size: var(--fs-13); font-weight: 600; }
.add-way-sub { font-size: var(--fs-11); color: var(--t2); }

/* Your audio: a sound opens to a player and its Download */
.mine-row { cursor: pointer; }
.mine-row.lit { border-color: var(--acc); background: var(--acc-soft); }
.mine-row:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.mine-open { display: flex; flex-direction: column; gap: 12px; padding: 12px 12px 16px; }
.mine-open audio { width: 100%; height: 40px; }
.mine-dl { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.mine-fmt { flex: 1 1 160px; min-width: 0; font-size: var(--fs-11); line-height: 1.45; color: var(--t2); overflow-wrap: anywhere; }
.add-sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}
.add-src {
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg0);
  color: var(--text);
  font-size: var(--fs-12);
  font-weight: 600;
  text-align: left;
  transition: border-color 0.15s;
}
.add-src:hover { border-color: var(--t2); }
.add-src:disabled { opacity: 0.5; cursor: default; }
.add-src.on { border-color: var(--text); color: var(--text); }
.add-status { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; }
.add-status .mus-status { flex: 1 1 auto; margin: 0; }
.add-note {
  margin: 16px 0 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-11);
  line-height: 1.5;
  color: var(--t2);
}
.add-more { margin: 8px 0 0; }

/* ===================== AUDIO CLIPS =====================
   Imported audio and sound extracted from a video. Blue, so it never reads as
   a sound effect (violet), the music bed (crimson edge) or an overlay (amber).
   Same shape as a sound, and it trims like an overlay. */
.track-uaudio {
  height: 30px;
  margin: 4px 0 0;
  border-radius: var(--r-1);
  background: var(--bg1);
  box-shadow: inset 0 0 0 1px var(--line);
}
.uclip {
  position: absolute;
  top: 1px;            /* set per row by renderUserAudioTrack */
  height: 28px;
  min-width: 26px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: var(--r-2);
  overflow: hidden;
  white-space: nowrap;
  cursor: grab;
  touch-action: pan-x pan-y;   /* swipes scroll the timeline; a hold picks the clip up (holdToDrag) */
  user-select: none;
  background: var(--trk-audio-bg);
  border: 1px solid var(--trk-audio-line);
  color: var(--trk-audio-ink);
}
.uclip .uname { font-size: var(--fs-10); font-weight: 600; pointer-events: none; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.uclip .awave { display: flex; align-items: center; gap: 1px; height: 60%; flex: 1 1 auto; overflow: hidden; pointer-events: none; opacity: 0.55; }
.uclip .awave i { width: 1.5px; border-radius: var(--r-1); background: currentColor; flex: 0 0 auto; }
.uclip.sel { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); z-index: 3; }

/* An audio file in the strip and the library: it has no picture, so it shows
   what it is instead. */
.ms-item.ms-audio, .lib-item.li-audio {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  color: var(--trk-audio-ink);
}
.ms-audio svg, .li-audio svg { width: 26px; height: 26px; }
.ms-audio .ms-name {
  position: absolute;
  top: 4px; left: 5px; right: 24px;
  font-size: var(--fs-10);
  font-weight: 600;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mine-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 12px; }


/* ===================== CAPTIONS SHEET =====================

   Make them, then three tabs: how they look, what they say, which language.
   The style grid is the centre of it, so it gets the room: small moving
   previews, three across on a phone, more on a computer. */

#captionSheet { max-width: 640px; }
.cap-actions { display: flex; gap: 8px; align-items: center; margin: 0 0 6px; }
.cap-make { padding: 12px 20px; font-size: var(--fs-12); }
.cap-status { min-height: 18px; }

.cap-cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 0 12px;
  padding-bottom: 2px;
}
.cap-cats::-webkit-scrollbar { display: none; }
.cap-cat { flex: 0 0 auto; padding: 6px 12px; font-size: var(--fs-11); }

.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}
.cap-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg1);
  color: var(--t1);
  overflow: hidden;
  text-align: left;
  transition: border-color 0.15s ease;
}
.cap-tile:hover { border-color: var(--t2); }
.cap-tile.selected { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); color: var(--text); }
.cap-tile:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
/* a dark frame whatever the theme: captions are designed to sit on footage */
.cap-tile-cv {
  display: block;
  width: 100%;
  height: 64px;
  background: linear-gradient(180deg, #23251f, #0d0e0c);
}
.cap-tile-name {
  padding: 0 8px;
  font-size: var(--fs-10);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cap-pane { padding-bottom: 6px; }
.cap-field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.cap-field > label, .cap-sliders > label {
  font-size: var(--fs-11);
  font-weight: 600;
  color: var(--text);
}
.cap-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cap-inline select { flex: 1 1 180px; }
#captionSheet select,
#captionSheet textarea {
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-12);
}
#captionSheet select { height: 38px; padding: 0 12px; }
#captionSheet textarea { resize: vertical; line-height: 1.5; }
#captionSheet select:focus, #captionSheet textarea:focus { outline: none; border-color: var(--acc); }
.cap-seg { flex-wrap: wrap; }
.cap-seg button { flex: 1 0 auto; }
.cap-seg button:disabled { opacity: 0.4; cursor: default; }

.cap-sliders { gap: 12px; }
.cap-sliders > label { display: flex; flex-direction: column; gap: 6px; }
.cap-sliders output { font-weight: 500; color: var(--t2); margin-left: 6px; }
.cap-sliders input[type="range"] { width: 100%; accent-color: var(--acc); }
.cap-sliders .text-btn { align-self: flex-start; padding-left: 0; }

.cap-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.cap-toggle:first-child { padding-top: 2px; }
.cap-toggle input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--acc); flex: 0 0 auto; }
.cap-toggle span { display: flex; flex-direction: column; gap: 2px; }
.cap-toggle b { font-size: var(--fs-12); font-weight: 600; color: var(--text); }
.cap-toggle small { font-size: var(--fs-11); line-height: 1.45; color: var(--t2); }
.cap-pane .cap-toggle + .cap-field { margin-top: 16px; }

@media (min-width: 761px) {
  .cap-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
  .cap-tile-cv { height: 72px; }
}
/* three across on a phone: more styles in view, each still readable */
@media (max-width: 760px) {
  .cap-grid { grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 6px; }
  .cap-tile-cv { height: 58px; }
}

/* ===================== TIDY =====================
   Pauses, filler words and the transcript editor (app.js cutSourceSpans). */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.tidy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.tidy-row:first-of-type { border-top: 0; }
.tidy-text { min-width: 0; }
.tidy-text strong { display: block; font-size: var(--fs-13); color: var(--text); }
.tidy-text p { margin: 2px 0 0; font-size: var(--fs-12); line-height: 1.45; color: var(--t1); }
.tidy-act { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
#tidySheet select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-12);
}
#tidySheet select:focus { outline: none; border-color: var(--acc); }
#tidySheet button:disabled { opacity: 0.45; cursor: default; }
.tidy-transcript {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0 4px;
  border-top: 1px solid var(--line);
}
.tidy-words {
  max-height: 38vh;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg1);
  line-height: 1.9;
  font-size: var(--fs-13);
}
.tw {
  display: inline;
  padding: 1px 2px;
  margin: 0 1px;
  border: 0;
  border-radius: var(--r-1);
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.tw:hover { background: var(--bg3); }
.tw:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.tw.struck { color: var(--t2); text-decoration: line-through; text-decoration-color: var(--acc); text-decoration-thickness: 2px; background: var(--acc-soft); }
.tidy-transcript .primary-btn { align-self: flex-start; }
.tidy-transcript .primary-btn:disabled { opacity: 0.45; box-shadow: none; cursor: default; }
.tidy-note { margin: 8px 0 0; min-height: 1em; font-size: var(--fs-12); color: var(--t1); }
@media (max-width: 480px) {
  .tidy-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .tidy-act { justify-content: flex-start; }
}

/* ===================== POST =====================
   Title, description and hashtags (app.js writePost). One panel that sits
   in the Post sheet or, while a video renders, in the export card. */
.post-panel { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.post-ask { display: flex; flex-wrap: wrap; gap: 8px; }
.post-ask .secondary-btn { flex: 1 1 auto; }
.post-panel select,
.post-panel input[type="text"],
.post-panel textarea {
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-13);
}
.post-panel select { height: 38px; padding: 0 12px; }
.post-panel textarea { width: 100%; resize: vertical; line-height: 1.5; }
.post-panel select:focus, .post-panel input:focus, .post-panel textarea:focus { outline: none; border-color: var(--acc); }
.post-out { display: flex; flex-direction: column; gap: 12px; }
.post-field { display: flex; flex-direction: column; gap: 4px; }
.post-label { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-11); font-weight: 500; letter-spacing: 0; color: var(--t2); }
.post-label .text-btn { font-size: var(--fs-12); letter-spacing: 0; text-transform: none; }
.post-out .primary-btn { align-self: flex-start; }
.post-status { min-height: 1em; font-size: var(--fs-12); color: var(--t1); }
.post-panel button:disabled { opacity: 0.45; cursor: default; }
.exp-post { margin: 20px 0 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.exp-post:empty { display: none; }
.export-card { max-height: calc(100dvh - 40px); overflow-y: auto; }
.post-files { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.post-files h4 { font-size: var(--fs-13); font-weight: 600; color: var(--text); }
.post-file-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===================== BRAND =====================
   Settings: logo, where it goes on videos, card and accent colours. */
.brand-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 12px; }
.brand-logo {
  width: 64px; height: 64px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: var(--r-1);
  background: repeating-conic-gradient(var(--bg2) 0% 25%, var(--bg1) 0% 50%) 50% / 12px 12px;
  color: var(--t2); font-size: var(--fs-11); text-align: center; overflow: hidden;
}
.brand-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-label { font-size: var(--fs-12); color: var(--t1); }
.brand-color { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-12); color: var(--t1); cursor: pointer; }
.brand-color input[type="color"] { width: 34px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-1); background: none; cursor: pointer; }
#brandMarkSeg { flex-wrap: wrap; max-width: 100%; }
#brandMarkSeg button { flex: 1 1 auto; white-space: nowrap; }

/* Clearing training data: a panel with a typed confirmation (app.js guardDatasetClear) */
.ds-guard { margin-top: 12px; padding: 16px; border: 1px solid var(--danger); border-radius: var(--r-1); background: var(--acc-soft); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.ds-guard-msg { font-size: var(--fs-13); line-height: 1.5; color: var(--text); }
.ds-guard-label { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-12); color: var(--t1); }
.ds-guard-label input { height: 38px; width: min(220px, 100%); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg2); color: var(--text); font-family: inherit; font-size: var(--fs-13); }
.ds-guard-label input:focus { outline: none; border-color: var(--danger); }
.ds-guard .danger-btn:disabled { opacity: 0.4; cursor: default; }

/* Admin → Brand (moved from Settings, 0.27.3). A 2x2 grid for the logo
   corner: four options never wrap into a ragged second row. */
.admin-brand { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.admin-brand .brand-row { margin-top: 0; }
.brand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; max-width: 360px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-1); }
.brand-grid button { border: none; background: transparent; color: var(--t1); font-size: var(--fs-12); font-weight: 600; padding: 8px 12px; border-radius: var(--r-1); }
.brand-grid button:hover:not(.active) { color: var(--text); background: var(--bg3); }
.brand-grid button.active { background: var(--text); color: var(--bg0); }
.brand-grid button:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.brand-colors { display: grid; grid-template-columns: repeat(3, max-content); gap: 12px 20px; }

/* Found clips: the name is editable in place (renderClips). Reads as the
   title it replaced until it is touched. */
.clip-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.clip-num { font-size: var(--fs-13); font-weight: 600; color: var(--t2); flex: 0 0 auto; }
.clip-title {
  flex: 1 1 auto; min-width: 0;
  padding: 2px 6px; margin-left: -6px;
  border: 1px solid transparent; border-radius: var(--r-1);
  background: transparent; color: var(--text);
  font: inherit; font-size: var(--fs-13); font-weight: 600;
}
.clip-title:hover { border-color: var(--line); }
.clip-title:focus { outline: none; border-color: var(--acc); background: var(--bg2); }

/* ===================== FONTS (fonts.js) =====================
   The font button shows the chosen font in itself; the picker is a sheet of
   names, each written in its own font, with search and groups. */
.font-btn {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  min-width: 200px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-1);
  background: var(--bg2); color: var(--text); text-align: left;
}
.font-btn:hover { border-color: var(--t2); }
.font-btn-name { font-size: var(--fs-17); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-btn-more { font-size: var(--fs-11); color: var(--t2); white-space: nowrap; }
.fp-wrap {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}
.fp-sheet {
  width: min(720px, 100%); max-height: min(78vh, 680px);
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 16px 16px;
  background: var(--bg1); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-2) var(--r) 0 0;
}
@media (min-width: 761px) { .fp-wrap { align-items: center; } .fp-sheet { border-bottom: 1px solid var(--line); border-radius: var(--r-2); } }
.fp-head { display: flex; align-items: baseline; gap: 12px; flex: 0 0 auto; }
.fp-head h3 { font-size: var(--fs-15); font-weight: 600; }
.fp-count { font-size: var(--fs-11); color: var(--t2); flex: 1; }
.fp-close { border: none; background: none; color: var(--t1); font-size: var(--fs-15); padding: 4px 8px; }
.fp-search {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-1);
  background: var(--bg2); color: var(--text); font: inherit; font-size: var(--fs-13);
}
.fp-search:focus { outline: none; border-color: var(--acc); }
.fp-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; flex: 0 0 auto; }
.fp-search { flex: 0 0 auto; }
.fp-cats .chip { flex: 0 0 auto; }
.fp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px;
  overflow-y: auto; overscroll-behavior: contain; padding-right: 2px;
  flex: 1 1 auto; min-height: 0; align-content: start;
}
.fp-tile {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  min-height: 62px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-1);
  background: var(--bg2); color: var(--text); text-align: left;
}
.fp-tile:hover { border-color: var(--t2); }
.fp-tile.selected { border-color: var(--text); background: var(--bg3); }
/* clipped sideways only: some display fonts reach far above and below their line */
.fp-name { font-size: var(--fs-17); line-height: 1.45; padding: 1px 0; max-width: 100%; white-space: nowrap; overflow-x: clip; overflow-y: visible; text-overflow: ellipsis; }
.fp-tile small { font-size: var(--fs-10); line-height: 1.35; color: var(--t2); }
.fp-extra .fp-name { font-size: var(--fs-15); font-weight: 600; }
.fp-none { grid-column: 1 / -1; color: var(--t2); font-size: var(--fs-12); padding: 20px 0; }
@media (max-width: 760px) { .fp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fp-name { font-size: var(--fs-17); } }

/* caption "Make it yours" */
.cap-look { gap: 8px; }
.look-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.look-row > span { min-width: 108px; font-size: var(--fs-12); color: var(--t1); }
.look-row input[type="color"] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg2); }
.look-row input[type="range"] { flex: 1 1 120px; accent-color: var(--acc); }
.look-row select { flex: 1 1 160px; }
.look-row .ins-seg { flex: 1 1 260px; }
.look-row output { font-size: var(--fs-11); color: var(--t2); min-width: 44px; }

/* the text panel's tabs, as CapCut's */
.ins-tabs { display: flex; gap: 2px; width: 100%; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ins-tab {
  flex: 0 0 auto; padding: 8px 12px; border: none; border-bottom: 2px solid transparent;
  background: none; color: var(--t1); font-size: var(--fs-12); font-weight: 600;
}
.ins-tab.active { color: var(--text); border-bottom-color: var(--acc); }
.ins-textarea {
  width: min(320px, 100%); padding: 8px 12px; resize: vertical;
  border: 1px solid var(--line); border-radius: var(--r-1);
  background: var(--bg2); color: var(--text); font: inherit; font-size: var(--fs-13); line-height: 1.4;
}
.ins-textarea:focus { outline: none; border-color: var(--acc); }
.ins-row { display: flex; align-items: center; gap: 8px; }
.tx-presets { display: grid; grid-template-columns: repeat(4, 64px); gap: 6px; }
.tx-preset { padding: 0; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg3); overflow: hidden; line-height: 0; }
.tx-preset canvas { width: 64px; height: 34px; display: block; }
.tx-preset:hover { border-color: var(--t2); }
@media (min-width: 761px) { .tx-presets { grid-template-columns: repeat(8, 64px); } }
.adj-grid { display: flex; flex-direction: column; gap: 6px; }
.adj-grid .ins-group label { min-width: 72px; }

/* pinching a text on the picture: the browser must leave two fingers alone */
.stage.text-on { touch-action: none; }
#exportSheet .primary-btn { width: 100%; margin-top: 6px; }
/* "+ Add text" / "+ Add audio" along an empty lane, as CapCut offers them */
.lane-add {
  position: absolute; left: 0; top: 1px; bottom: 1px;
  display: flex; align-items: center; padding: 0 12px;
  border: none; border-radius: var(--r-2);
  background: var(--bg2); color: var(--t1);
  font-size: var(--fs-12); font-weight: 500; text-align: left;
}
.lane-add:hover { color: var(--text); background: var(--bg3); }
.track-uaudio.offer, .track-text.offer { height: 34px; }
/* Text → Animation: In / Out / Loop, a grid of moving previews */
.anim-kinds { width: min(320px, 100%); }
.anim-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px;
  width: 100%; max-height: 320px; overflow-y: auto; overscroll-behavior: contain; padding: 2px;
}
.anim-tile {
  display: flex; flex-direction: column; gap: 2px; align-items: stretch; padding: 0 0 4px;
  border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg2); color: var(--t1); overflow: hidden;
}
.anim-tile canvas, .anim-none { display: block; width: 100%; height: 44px; background: var(--bg3); }
.anim-none { display: flex; align-items: center; justify-content: center; font-size: var(--fs-11); color: var(--t1); }
.anim-name { font-size: var(--fs-10); line-height: 1.25; padding: 0 4px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anim-tile:hover { border-color: var(--t2); }
.anim-tile.selected { border-color: var(--text); color: var(--text); }
/* the music clip moves and trims like the others: a swipe still scrolls the timeline, a hold picks it up */
.mclip { touch-action: pan-x pan-y; cursor: grab; }
.tclip.dragging { opacity: 0.8; z-index: 8; cursor: grabbing; }
/* Trim handles sit OUTSIDE a selected clip's edges, as CapCut's do, so the
   clip's whole body stays free to hold and move however short it is. (Inside,
   two 13px grips covered a short text completely: holding it trimmed it.) */
.clip.sel, .tclip.sel, .oclip.sel, .uclip.sel, .mclip.sel { overflow: visible; z-index: 5; }
.oclip.sel > :not(.handle), .uclip.sel > :not(.handle), .mclip.sel > :not(.handle) { max-width: 100%; overflow: hidden; }
.sel > .handle { width: 16px; }
.sel > .handle.hl { left: -17px; border-radius: var(--r-2) 0 0 var(--r-2); }
.sel > .handle.hr { right: -17px; border-radius: 0 var(--r-2) var(--r-2) 0; }
/* T25: nothing sits on a selected clip's handles. A main clip never overlaps
   another, so the selected one makes no stacking layer of its own: its body
   stays under the playhead while its handles rise above the playhead and the
   cut squares. On touch a handle's target reaches 44px out from the item's
   edge, full height (the 16px grip is only what shows); with a mouse the grip
   itself is the target. */
.clip.sel { z-index: auto; }
@media (pointer: coarse) {
  .sel > .handle::before { content: ""; position: absolute; top: 0; bottom: 0; width: 44px; }
  .sel > .handle.hl::before { right: -1px; }
  .sel > .handle.hr::before { left: -1px; }
}
.tclip .tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; pointer-events: none; }
/* Effects lane: teal, so it never reads as a clip, a sound or a text */
.track-effect { height: 30px; margin: 4px 0 2px; border-radius: var(--r-1); background: var(--bg1); box-shadow: inset 0 0 0 1px var(--line); }
.eclip {
  position: absolute; top: 1px; bottom: 1px; min-width: 26px;
  display: flex; align-items: center; padding: 0 8px;
  border-radius: var(--r-2); border: 1px solid var(--trk-fx-line); background: var(--trk-fx-bg); color: var(--trk-fx-ink);
  font-size: var(--fs-10); font-weight: 600; white-space: nowrap; overflow: hidden;
  cursor: grab; touch-action: pan-x pan-y; user-select: none;
}
.eclip .ename { overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.eclip.sel { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); overflow: visible; z-index: 5; }
.fx-grid { max-height: 52vh; }
@media (max-width: 1100px) { .track-effect.empty { display: none; } }

/* Stickers sheet */
.stk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; max-height: 52vh; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.stk-tile {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg2);
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif; font-size: var(--fs-28); line-height: 1;
}
.stk-tile:hover { border-color: var(--t2); }
.stk-shape { background: var(--bg3); }
.stk-shape canvas { width: 100%; height: 100%; display: block; }
#stickerSheet .fp-search { width: 100%; margin-bottom: 8px; }

/* Voiceover: the count-in and the take, over the picture */
.voice-rec {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 8;
  display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 16px;
  border-radius: var(--r-2); background: rgba(17, 18, 16, 0.86); color: #edeae2;
}
.voice-count { font-size: var(--fs-28); font-weight: 600; min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.voice-live { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.voice-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); animation: blink 1s ease-in-out infinite; }
.voice-stop { padding: 6px 16px; }

/* real waveforms on sound clips and the music */
.uclip .wave { position: absolute; left: 0; bottom: 3px; pointer-events: none; }
.mclip .mwave { position: absolute; left: 0; right: 0; bottom: 1px; height: 18px; display: flex; overflow: hidden; pointer-events: none; opacity: 0.9; }
.mclip { position: absolute; }
.ins-select { padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg2); color: var(--text); font: inherit; font-size: var(--fs-12); }
/* On a computer the settings panel scrolls inside itself, so a long one
   (transitions, effects, animations) never squeezes the preview to a strip */
@media (min-width: 761px) { .inspector { max-height: 38vh; overflow-y: auto; overscroll-behavior: contain; } }
/* ===================== THE EDITOR, CAPCUT'S WAY (0.33.0) =====================
   Laid out by how people hold a phone: about half the time one-handed, thumb
   on the lower screen (Hoober, 2013). So: the picture at the top to watch,
   the timeline in the middle to work on, and every tool in ONE bar at the
   bottom, under the thumb. Tool > its options > a check mark, never more.
   Every target at least 44-48px (Apple 44pt, Google 48dp), 8px apart.
   Senotel colours, CapCut's shapes: flat, quiet, no glow. */

/* one column that never scrolls as a whole: picture, play row, timeline, tool bar */
body[data-screen="editor"] #screen-editor { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
#screen-editor .stage-zone { flex: 1 1 auto; min-height: 180px; position: relative; top: auto; padding: 8px 12px 0; background: none; }
#screen-editor .tl-zone { flex: 0 0 auto; display: flex; flex-direction: column; min-height: 0; max-height: 42vh; overflow-y: auto; overscroll-behavior: contain; margin-top: 0; background: var(--bg0); border-top: 0; }
#screen-editor .tl-top { border-bottom: 0; padding: 4px 16px 0; }
#screen-editor .tl-time, #screen-editor .tl-hint { display: none; }

/* the play row: time | play | ease keyframe undo redo mute fullscreen.
   Round 3 (R4): Play never moves. Its column is a fixed 48, and every
   button on the right is always there (the keyframe pair is dimmed when it
   does not apply, never removed), so the right column is the same width
   with or without a selection. On a wide screen both sides are equal and
   Play sits dead centre; on a phone the right cluster needs more than half,
   so Play sits a little left of centre, but in the same place every time. */
body:not(.previewFs) .transport {
  display: grid; grid-template-columns: 1fr 48px 1fr; align-items: center;
  height: 48px; padding: 0 4px; gap: 0; position: static; background: none;
}
.tr-time { justify-self: start; padding-left: 8px; font-size: var(--fs-12); font-variant-numeric: tabular-nums; color: var(--t2); white-space: nowrap; }
.tr-time .tcode { min-width: 0; font-size: var(--fs-12); text-align: left; }
.tr-time .tcode:first-child { color: var(--text); }
.tsep { margin: 0 4px; }
.transport .play-btn { width: 48px; height: 48px; border: none; border-radius: 50%; background: none; color: var(--text); }
.transport .play-btn:hover { background: var(--bg2); color: var(--text); }
.tr-right { justify-self: end; display: flex; }
.tr-right .icon-btn { width: 44px; height: 44px; border: none; background: none; color: var(--t1); }
.tr-right .icon-btn:hover { color: var(--text); background: var(--bg1); }
.tr-right .icon-btn:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }
/* not applicable now: dimmed, still in place, a tap does nothing */
.tr-right .icon-btn[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }
/* fullscreen only plays: the keyframe pair is not shown there */
body.previewFs #kfBtn, body.previewFs #kfEaseBtn { display: none; }
/* the Undo inside a toast (round 3, R8): the toast is inverted, so the
   button takes its colours; 44 tall to hit, without making the toast taller */
.toast.has-action { display: flex; align-items: center; gap: 12px; padding-right: 4px; }
.toast-act {
  min-height: 44px; min-width: 44px; margin: -10px 0; padding: 0 10px;
  border: none; border-left: 1px solid currentColor; border-radius: 0;
  background: none; color: inherit; font: inherit; font-weight: 700; cursor: pointer;
}
.toast-act:hover { text-decoration: underline; }
.toast-act:active { opacity: 0.7; }
.toast-act:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }
body:not(.previewFs) .transport .seek { display: none; }
body.previewFs .transport { display: flex; align-items: center; height: auto; }
body.previewFs .transport .seek { display: block; flex: 1 1 auto; order: 1; }
body.previewFs .transport .tr-time { order: 0; color: #fff; }
body.previewFs .transport .play-btn { order: -1; color: #fff; }
body.previewFs .transport .tr-right { order: 2; }
body.previewFs .transport #undoBtn, body.previewFs .transport #redoBtn { display: none; }
body.previewFs .tr-right .icon-btn, body.previewFs .tr-time .tcode:first-child { color: #fff; }

/* the tool bar */
.action-bar {
  flex: 0 0 auto; display: flex; align-items: stretch;
  height: calc(66px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg0); border-top: 1px solid var(--line); position: relative; z-index: 32;
}
.ab-back {
  flex: 0 0 52px; display: flex; align-items: center; justify-content: center;
  border: none; border-right: 1px solid var(--line); background: none; color: var(--text);
}
.ab-back:hover { background: var(--bg1); }
.ab-strip { flex: 1 1 auto; display: flex; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; padding: 0 4px; }
.ab-strip::-webkit-scrollbar { display: none; }
.ab-tool {
  flex: 0 0 auto; min-width: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 0 6px; border: none; border-radius: var(--r-3); background: none; color: var(--t1);
}
.ab-tool svg { color: var(--text); }
.ab-label { font-size: var(--fs-11); line-height: 1.1; white-space: nowrap; }
.ab-tool:hover { background: var(--bg1); }
.ab-tool:active { filter: brightness(0.92); }
.ab-tool.active, .ab-tool.active svg { color: var(--acc); }
@media (min-width: 761px) { .ab-strip { justify-content: center; } }

/* a tool's panel: slides up over the timeline on a phone, sits beside the picture on a computer */
#inspector.inspector {
  position: fixed; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom));
  z-index: 31; display: block; margin: 0; padding: 0; gap: 0; border: 0; border-top: 1px solid var(--line);
  border-radius: var(--r-3) var(--r-3) 0 0; background: var(--bg1);
  max-height: 46vh; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.25);
  animation: panelUp 0.18s ease;
}
#inspector.inspector.hidden { display: none; }
@keyframes panelUp { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 761px) {
  #inspector.inspector {
    left: auto; right: 16px; top: 64px; bottom: auto; width: 380px;
    max-height: calc(100vh - 64px - 66px - 24px); border: 1px solid var(--line); border-radius: var(--r-3);
  }
}
.panel-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  height: 50px; padding: 0 4px 0 20px; background: var(--bg1); border-bottom: 1px solid var(--line);
}
.panel-title { font-size: var(--fs-15); font-weight: 600; color: var(--text); }
.panel-done { width: 48px; height: 48px; border: none; background: none; color: var(--acc); display: flex; align-items: center; justify-content: center; border-radius: var(--r-3); }
.panel-done:hover { background: var(--bg2); }
.panel-body { padding: 16px 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.panel-body > .ins-group { display: flex; flex-direction: column; align-items: stretch; gap: 8px; flex-wrap: nowrap; }
.panel-body > .ins-group > label { font-size: var(--fs-12); font-weight: 500; color: var(--t1); white-space: normal; }
.panel-body .ins-group > .ins-group, .panel-body .ins-row > .ins-group { display: flex; flex-direction: row; align-items: center; gap: 12px; }
.panel-body input[type="range"] { flex: 1 1 auto; width: auto !important; min-width: 0; height: 4px; }
.panel-body input[type="range"]::-webkit-slider-thumb { width: 18px; height: 18px; background: var(--text); border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.panel-body input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; background: var(--text); border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.panel-body output { min-width: 52px; text-align: right; font-size: var(--fs-12); color: var(--text); font-variant-numeric: tabular-nums; }
/* A slider is one row, as in CapCut: name, track, value. Two rows put the
   number a thumb's width away from the thing it describes. */
.panel-body > .ins-group:has(> .ins-group > input[type="range"]) {
  display: grid;
  grid-template-columns: minmax(64px, 30%) 1fr;
  align-items: center;
  gap: 12px;
}
.panel-body > .ins-group:has(> .ins-group > input[type="range"]) > label { font-size: var(--fs-13); color: var(--t1); }
.panel-body output { min-width: 44px; }
.panel-body .ins-row { display: flex; align-items: center; gap: 12px; }
.panel-body .ins-row > .ins-group { flex: 1 1 auto; }
.panel-body .filter-chips { gap: 8px; }
.panel-body .fchip {
  min-height: 38px; padding: 8px 16px; border-radius: var(--r-3); border: 1px solid transparent;
  background: var(--bg2); color: var(--text); font-size: var(--fs-12); font-weight: 500;
}
.panel-body .fchip:hover { background: var(--bg3); }
.panel-body .fchip.active { border-color: var(--text); color: var(--text); background: var(--bg3); }
.panel-body .ins-seg { min-height: 38px; }
.panel-body .ins-seg button { min-height: 32px; font-size: var(--fs-12); }
.panel-body input[type="color"] { width: 44px; height: 38px; border-radius: var(--r-3); padding: 2px; border: 1px solid var(--line); background: var(--bg2); }
.panel-body .ins-textarea, .panel-input {
  width: 100%; padding: 12px 12px; border: 1px solid var(--line); border-radius: var(--r-3);
  background: var(--bg0); color: var(--text); font: inherit; font-size: var(--fs-15);
}
.panel-body .ins-textarea:focus, .panel-input:focus { outline: none; border-color: var(--acc); }
.panel-note { font-size: var(--fs-12); line-height: 1.45; color: var(--t2); margin: 0; }
.panel-body .anim-grid { max-height: none; }
.panel-body .font-btn { width: 100%; min-height: 48px; }
.panel-body .tx-presets { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.panel-body .ins-meta { font-size: var(--fs-12); color: var(--t2); }

/* CapCut's cut button: a small square on every cut */
.cut-btn {
  position: absolute; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  width: 22px; height: 22px; border-radius: var(--r-2); border: none;
  display: flex; align-items: center; justify-content: center;
  background: #f3f1ec; color: #111210; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}
/* a 44px fingertip target round the small square, its sides cut back where a
   selected clip's handle target begins (app.js cutButtonsFor sets --hit-l/-r) */
.cut-btn::before { content: ""; position: absolute; top: -11px; bottom: -11px; left: calc(11px - var(--hit-l, 22px)); right: calc(11px - var(--hit-r, 22px)); }
.cut-btn.on { background: var(--acc); color: #fff; }

/* the bin under the picture */
.trash-bin {
  position: absolute; transform: translate(-50%, -50%); z-index: 9; pointer-events: none;
  width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(17, 18, 16, 0.72); color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.55);
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}
.trash-bin.over { transform: translate(-50%, -50%) scale(1.28); background: var(--acc); border-color: var(--acc); }

/* "Delete this?" */
.confirm-wrap { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.5); padding: 20px; }
.confirm-wrap.hidden { display: none; }
.confirm-box { width: min(340px, 100%); padding: 24px 20px 16px; border-radius: var(--r-3); background: var(--bg1); border: 1px solid var(--line); }
.confirm-q { font-size: var(--fs-15); font-weight: 600; color: var(--text); margin: 0; }
.confirm-sub { font-size: var(--fs-13); color: var(--t2); margin: 6px 0 20px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.confirm-actions button { min-height: 46px; border-radius: var(--r-3); font-size: var(--fs-13); }
.danger-solid { background: var(--acc); border-color: var(--acc); color: #fff; }
.confirm-never { display: block; width: 100%; min-height: 44px; margin-top: 8px; text-align: center; font-size: var(--fs-13); color: var(--t1); }
.set-sub { display: block; margin-top: 16px; font-size: var(--fs-12); font-weight: 600; color: var(--t1); }

/* the top of the editor, quieter */
#screen-editor .ai-bar { margin: 8px 12px 0; }
#screen-editor .fmt-row { margin: 6px 12px 0; }
@media (max-width: 760px) {
  /* 0.34.1: the picture gives up height before the timeline does, down to
     150px, so an edit's extra rows (summary, Business brief) never push the
     timeline under the tool bar */
  #screen-editor .stage-zone { flex: 0 1 auto; min-height: 0; }
  #screen-editor .stage { height: clamp(150px, 36vh, 420px); flex: 0 1 auto; min-height: 150px; }
  #screen-editor .tl-zone { flex: 1 1 0; min-height: 190px; max-height: none; overflow: hidden; }
  /* The timeline scrolls BOTH ways: sideways along time, up and down through
     its tracks. The browser locks each swipe to the way it started, so a
     sideways swipe never drifts up or down (owner, 2026-10-22). The ruler
     stays pinned at the top while the tracks move under it. */
  #screen-editor .tl-scroll { flex: 1 1 0; min-height: 0; overflow-y: auto; touch-action: pan-x pan-y; overscroll-behavior: contain; }
  #screen-editor .ruler { position: sticky; top: 0; z-index: 4; background: var(--bg0); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
/* the right-hand buttons as narrow as a finger allows, so Play sits as near the centre as six of them let it */
.tr-right .icon-btn { width: 40px; }
@media (max-width: 760px) { #screen-editor .tl-zoom { display: none; } #screen-editor .tl-top { padding: 0; min-height: 0; } }
/* Where the panel goes on bigger screens: a tablet or small laptop gets the
   phone's slide-up panel; a wide screen gets a column of its own beside the
   picture, so it never covers the play row (CapCut desktop's right panel). */
@media (min-width: 761px) and (max-width: 1199px) {
  #inspector.inspector { left: 0; right: 0; top: auto; bottom: calc(66px + env(safe-area-inset-bottom)); width: auto; max-height: 46vh; border-radius: var(--r-3) var(--r-3) 0 0; border-width: 1px 0 0; }
}
@media (min-width: 1200px) {
  #inspector.inspector { top: 56px; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); max-height: none; width: 380px; border-radius: 0; border-width: 0 0 0 1px; box-shadow: none; }
  body.panel-open #screen-editor { padding-right: 380px; }
}
/* a short window gives the picture the room the library strip took */
@media (min-width: 761px) and (max-height: 820px) { #screen-editor .media-strip { display: none; } }
/* ccl5 (0.35.0): the beat marks on the music, a dot per beat; bigger on
   the strong beats and on the marks the user added */
.mbeats { position: absolute; left: 0; right: 0; bottom: 2px; height: 6px; pointer-events: none; }
.mbeats i { position: absolute; bottom: 0; width: 3px; height: 3px; margin-left: -1px; border-radius: 50%; background: rgba(238, 234, 226, 0.55); }
.mbeats i.strong { width: 5px; height: 5px; margin-left: -2px; background: var(--text); }
.mbeats i.mine { width: 5px; height: 5px; margin-left: -2px; background: #ffd23f; }

/* ccl3 (0.35.0): the text template sheet, a grid of designed titles */
.tmpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; padding: 4px 2px 12px; max-height: 46vh; overflow-y: auto; }
.tmpl-tile { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg1); overflow: hidden; cursor: pointer; text-align: left; }
.tmpl-tile canvas { display: block; width: 100%; aspect-ratio: 16 / 10; }
.tmpl-tile .anim-name { padding: 0 8px 8px; font-size: var(--fs-12); color: var(--t1); }
.tmpl-tile:hover, .tmpl-tile:focus-visible { border-color: var(--t2); }
.filter-grid .anim-tile canvas { object-fit: cover; }

/* ccl6 (0.36.0): things in a multi-selection carry a second, dashed edge, so a
   group reads as a group (a solid edge, never a glow) */
.msel { outline: 2px dashed rgba(238, 234, 226, 0.85); outline-offset: 1px; }

/* ccl7 (0.37.0): Adjust tabs. HSL colour dots (a solid edge when chosen, a small
   mark when changed), the curve editor and the three colour wheels */
.hsl-dots { display: flex; justify-content: space-between; gap: 6px; padding: 2px 2px 6px; }
.hsl-dot { position: relative; width: 32px; height: 32px; min-width: 32px; border-radius: 50%; border: 2px solid transparent; padding: 0; cursor: pointer; }
.hsl-dot.on { border-color: var(--text); }
.hsl-dot.changed::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--text); border: 2px solid var(--bg1); }
.curve-box { padding: 4px 0; }
.curve-cv { display: block; width: 100%; max-width: 360px; height: 200px; margin: 0 auto; border: 1px solid var(--line); border-radius: var(--r-3); touch-action: none; cursor: crosshair; }
.wheel-row { display: flex; justify-content: space-around; gap: 8px; padding: 6px 0; }
.wheel { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wheel-cv { width: 92px; height: 92px; border-radius: 50%; touch-action: none; cursor: pointer; }
.wheel-name { font-size: var(--fs-12); color: var(--t1); }

/* ccl8 (0.38.0): the mask is set on the picture with one or two fingers */
.stage.mask-on { touch-action: none; }

/* 0.38.1: a tool's panel pulls down to its title bar (and back up), so the timeline stays usable */
.panel-head { touch-action: none; cursor: grab; }
.panel-grab { position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; margin-left: -20px; border-radius: var(--r-1); background: var(--bg3); pointer-events: none; }
#inspector.inspector { transition: transform 0.18s ease; }
#inspector.inspector.min { overflow: hidden; box-shadow: none; }
#inspector.inspector.min .panel-body { display: none; }
#inspector.inspector.min .panel-head { border-bottom: 0; }

/* 0.39.0: Mask as CapCut lays it out: a row of actions, one sideways strip of shapes */
.mask-top { display: flex; gap: 8px; }
.mask-act {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-width: 64px; min-height: 58px; padding: 6px 8px; border: 1px solid transparent; border-radius: var(--r-3);
  background: var(--bg2); color: var(--text); font-size: var(--fs-11); font-weight: 500;
}
.mask-act svg { width: 20px; height: 20px; }
.mask-act.on { border-color: var(--text); color: var(--text); background: var(--bg3); }
.mask-act:disabled { opacity: 0.4; }
.mask-strip {
  display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none;
}
.mask-strip::-webkit-scrollbar { display: none; }
.mask-tile {
  flex: 0 0 auto; width: 64px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 0 6px; border: 1px solid transparent; border-radius: var(--r-3); background: var(--bg2);
  color: var(--t1); scroll-snap-align: start;
}
.mask-tile canvas { width: 40px; height: 40px; }
.mask-tile.selected { border-color: var(--text); background: var(--bg3); color: var(--text); }
.mask-name { font-size: var(--fs-11); font-weight: 500; white-space: nowrap; }
.mask-progress { display: flex; align-items: center; gap: 12px; font-size: var(--fs-12); color: var(--t1); }
.mask-bar { flex: 1 1 auto; height: 4px; border-radius: var(--r-1); background: var(--bg3); overflow: hidden; }
.mask-bar i { display: block; height: 100%; background: var(--acc); }

/* Custom: drawing the shape, full screen, on a darkened picture */
.mask-draw {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: #000;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.mask-draw-bar { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 6px; color: #eeeae2; }
.mask-draw-bar .icon-btn { color: #eeeae2; width: 48px; height: 48px; }
.mask-draw-bar .mask-draw-done { color: var(--acc); }
.mask-draw-bar .mask-draw-done:disabled { opacity: 0.35; }
.mask-draw-title { font-size: var(--fs-15); font-weight: 600; }
.mask-draw-cv { flex: 1 1 auto; width: 100%; min-height: 0; touch-action: none; cursor: crosshair; }
.mask-draw-hint { margin: 0; padding: 12px 20px 16px; text-align: center; font-size: var(--fs-13); color: #b9b4ab; }

/* ccl13: the keyframe diamond (filled on a keyframe), its ease menu, and the diamonds on the timeline */
.kf-btn.on { color: var(--acc); }
.kf-btn.on .kf-shape { fill: currentColor; }
.kf-btn.on line { display: none; }
.kf-menu {
  position: fixed; z-index: 70; display: flex; flex-direction: column; gap: 4px; min-width: 200px; padding: 8px;
  border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg1); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.kf-menu-title { padding: 4px 8px 6px; font-size: var(--fs-12); color: var(--t2); }
.kf-ease {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 8px; border: 1px solid transparent;
  border-radius: var(--r-3); background: none; color: var(--text); font-size: var(--fs-13); text-align: left;
}
.kf-ease canvas { width: 36px; height: 24px; }
.kf-ease:hover { background: var(--bg2); }
.kf-ease.on { border-color: var(--text); color: var(--text); }
.kf-dot {
  position: absolute; top: 50%; z-index: 3; width: 14px; height: 14px; margin: -6px 0 0 -6px; padding: 0;
  border: 1.5px solid #151614; background: var(--text); transform: rotate(45deg); border-radius: var(--r-1);
}

/* ccl9 (0.40.0): voice effects, in groups of tiles */
.voice-group { margin: 2px 0 -6px; font-size: var(--fs-12); font-weight: 500; color: var(--t2); }
.voice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.voice-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 68px;
  padding: 8px 4px; border: 1px solid transparent; border-radius: var(--r-3); background: var(--bg2); color: var(--text);
  font-size: var(--fs-11); font-weight: 500;
}
.voice-tile svg { width: 22px; height: 22px; color: var(--t1); }
.voice-tile.selected { border-color: var(--text); background: var(--bg3); color: var(--text); }
.voice-tile.selected svg { color: var(--text); }
/* ccl11 (0.42.0): chroma key */
.chroma-swatch { align-self: center; width: 28px; height: 28px; border-radius: var(--r-2); border: 1px solid var(--line); }
.stage.picking { cursor: crosshair; touch-action: none; }

/* ccl20 (0.50.0): the templates list */
.tpl-sheet { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: var(--bg0); color: var(--text); padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.tpl-sheet .mask-draw-bar { color: var(--text); }
.tpl-sheet .mask-draw-bar .icon-btn { color: var(--text); }
.tpl-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.tpl-card { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg1); }
.tpl-card img { width: 72px; height: 128px; object-fit: cover; border-radius: var(--r-3); flex: 0 0 auto; background: #000; }
.tpl-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 auto; }
.tpl-name { font-size: var(--fs-15); font-weight: 600; }
.tpl-meta { font-size: var(--fs-12); color: var(--t2); }
.tpl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.tpl-actions .fchip { min-height: 38px; padding: 8px 12px; border-radius: var(--r-3); border: 1px solid transparent; background: var(--bg2); color: var(--text); font-size: var(--fs-12); }
.tpl-actions .fchip.active { border-color: var(--text); color: var(--text); background: var(--bg3); }
.tpl-body > .fchip { align-self: flex-start; min-height: 40px; padding: 8px 16px; border-radius: var(--r-3); border: 1px solid var(--line); background: var(--bg2); color: var(--text); }
/* ===================== CATEGORY TABS (round 2) ===================== */
/* A sheet's groups are a scrolling row of words, as in CapCut: the chosen
   one is the bright word with a rule under it. Boxed buttons that wrap to a
   second line read as a form, not as places to look. */
#fxCats, #stkCats, #tmplCats, #capCats, #sndCats {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 20px;
  margin: 0 -16px 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
#fxCats::-webkit-scrollbar, #stkCats::-webkit-scrollbar, #tmplCats::-webkit-scrollbar, #capCats::-webkit-scrollbar, #sndCats::-webkit-scrollbar { display: none; }
:is(#fxCats, #stkCats, #tmplCats, #capCats, #sndCats) .fchip {
  flex: 0 0 auto;
  padding: 8px 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--t2);
  font-size: var(--fs-13);
  font-weight: 500;
  margin-bottom: -1px;
}
:is(#fxCats, #stkCats, #tmplCats, #capCats, #sndCats) .fchip:hover { color: var(--t1); background: none; }
:is(#fxCats, #stkCats, #tmplCats, #capCats, #sndCats) .fchip.active { color: var(--text); border-bottom-color: var(--text); background: none; }

/* The desktop editor (round 2) moved to the NEXT DESIGN section at the end
   of this file: CapCut desktop's four panels. */

/* ===================== SWITCHES (round 2) ===================== */
/* An on/off setting is a switch on the right of its row, as in every phone's
   settings: the eye reads the label, the thumb finds the control at the edge.
   It is still the two-button control underneath (Off, On), so the code that
   drives it is unchanged and a screen reader still hears both words. */
.set-group:has(> .seg-switch) {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 16px;
  row-gap: 8px;
  align-items: start;
}
.set-group:has(> .seg-switch) > * { grid-column: 1 / -1; }
.set-group:has(> .seg-switch) > label,
.set-group:has(> .seg-switch) > .set-sub { grid-column: 1; }
.set-group > .ins-seg.seg-switch { width: 46px; min-width: 0; }
.set-group > .seg-switch { grid-column: 2; align-self: start; min-width: 0; margin-top: 2px; }
.set-group > .set-sub { margin-top: 8px; font-size: var(--fs-15); font-weight: 500; color: var(--text); }
.set-group > .set-sub + .seg-switch { margin-top: 10px; }
.seg-switch {
  display: inline-flex;
  width: 46px;
  height: 28px;
  padding: 3px;
  gap: 0;
  border: 0;
  border-radius: var(--r-2);
  background: var(--bg3);
  transition: background-color var(--t-state) var(--ease);
}
.seg-switch:has(> button:last-child.active) { background: var(--acc); }
.seg-switch button {
  flex: 1 1 0;
  padding: 0;
  font-size: 0;
  border-radius: var(--r-1);
  background: transparent;
  box-shadow: none;
}
.seg-switch button.active { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.seg-switch button:hover:not(.active) { background: transparent; }

/* text to speech voices: a monogram per person (round 2) */
.voice-person { gap: 2px; }
.voice-mono {
  display: grid; place-items: center;
  width: 28px; height: 28px; margin-bottom: 4px;
  border-radius: 50%;
  background: var(--bg3);
  color: var(--text);
  font-size: var(--fs-13); font-weight: 600;
}
.voice-tile.selected .voice-mono { background: var(--text); color: var(--bg0); }
.voice-sub { font-size: var(--fs-10); color: var(--t2); }

/* =====================================================================
   NEXT DESIGN (owner, 2026-11-07): the editor and app screens rebuilt
   This file is only loaded by next/index.html; the root design is untouched.
   The same app.js drives both, so no id, class or data-* changes here: only
   how they look and where they sit.

   Systems borrowed (their system, never their brand):
   - Linear: a surface ladder (--bg0 canvas, --bg1 panels, --bg2 controls,
     --bg3 hover and pressed) with 1px hairlines doing the work shadows
     usually do. Depth by surface step, not by blur or glow.
   - Runway: the chrome steps back so the footage is the loudest thing on
     the screen: no frame round the picture, one face, small tracked labels.
   - Figma's editor: panel density for a mouse (11 to 13 px UI type, 32 px
     rows, 8 px gutters), relaxed to 44 px targets on touch.
   Placement is CapCut's (T24 spec): phone = picture, play row, timeline,
   tool bar; desktop = tool rail, media panel, player, properties panel over
   a full-width timeline. Colours are Senotel's: crimson is the one accent
   and means "selected" or "the one action"; the playhead is white (T24 R5).
   ===================================================================== */

:root {
  --line-2: #bdb6a6;                 /* the strong hairline: hover, active edges */
  --hit: 44px;                       /* touch target floor */
  --hit-fine: 24px;                  /* mouse target floor (WCAG 2.5.8) */
  --playrow-h: 48px;
  --toolbar-h: 64px;
  --ruler-h: 24px;
  --rail-w: 64px;
  --asset-w: 256px;                  /* media panel content, beside the rail */
  --props-w: 340px;
  --z-lanes: 1; --z-playhead: 6; --z-handles: 8; --z-snap: 9;
  --z-toolbar: 30; --z-scrim: 39; --z-sheet: 40; --z-toast: 50; --z-confirm: 60;
  --shadow-lift: 0 4px 12px rgba(0, 0, 0, 0.35);
}
/* set on body, where the theme sets --text, so the playhead follows the theme */
body { --sel: var(--acc); --playhead: var(--text); }
body.dark { --line-2: #3f4037; }

/* one focus ring for every control on the app screens: 2 px in the text
   colour, never a halo */
#screen-editor :is(button, input, select, [role="button"]):focus-visible,
.topbar :is(button, input):focus-visible,
#screen-modes button:focus-visible,
.page-wrap :is(button, input, a):focus-visible,
#inspector :is(button, input, select, textarea):focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ===================== TOP BAR ===================== */
/* A flat bar on the canvas colour with one hairline: chrome, not a feature. */
.topbar { height: var(--topbar-h); background: var(--bg0); backdrop-filter: none; padding: 0 12px; gap: 8px; }
body[data-screen="editor"] .logo { display: none; }   /* T24 3.1: the editor bar names the project, not the brand */
.project-name { height: 32px; padding: 0 8px; font-size: var(--fs-13); font-weight: 500; color: var(--text); max-width: 220px; }
.project-name:hover { background: var(--bg1); }
.project-name:focus { background: var(--bg1); border-color: var(--line-2); }
.topbar .icon-btn { width: 36px; height: 36px; border-radius: var(--r-2); }
.topbar .icon-btn:hover { background: var(--bg1); }
#exportBtn { height: 32px; padding: 0 14px; border-radius: var(--r-2); font-size: var(--fs-13); }
#exportBtn:hover { filter: none; background: var(--acc2); }
@media (pointer: coarse) {
  .topbar .icon-btn { width: 44px; height: 44px; }
  .project-name { height: 44px; }
  /* 36 to see, 44 to hit: the extra is transparent room round the button */
  #exportBtn { height: 36px; position: relative; }
  #exportBtn::after { content: ""; position: absolute; inset: -4px 0; }
}

/* ===================== EDITOR: SHARED ===================== */

/* The prompt: one quiet field on a panel surface, its button the strongest
   neutral so it never competes with Export. */
#screen-editor .ai-bar {
  min-height: 40px; padding: 0 4px 0 12px; gap: 8px;
  border-radius: var(--r-2); background: var(--bg1); border-color: var(--line);
}
#screen-editor .ai-bar:hover { border-color: var(--line-2); }
#screen-editor .ai-bar:focus-within { border-color: var(--text); }
#screen-editor .ai-bar input { font-size: var(--fs-13); }
#screen-editor .ai-go { height: 32px; padding: 0 14px; border-radius: var(--r-2); font-size: var(--fs-12); }

/* The mode and its switches read as a line of settings, not as buttons
   competing with the picture: a small tracked label, hairline boxes, the
   bright word when on. */
#screen-editor .fmt-row { gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
#screen-editor .fmt-row::-webkit-scrollbar { display: none; }
#screen-editor .fmt-label { font-size: var(--fs-11); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--t2); white-space: nowrap; }
#screen-editor .fmt-row .chip {
  flex: 0 0 auto; min-height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-2); background: transparent;
  color: var(--t1); font-size: var(--fs-12); font-weight: 500; white-space: nowrap;
}
#screen-editor .fmt-row .chip:hover { border-color: var(--line-2); color: var(--text); background: var(--bg1); }
#screen-editor .fmt-row .chip:is(.selected, [aria-pressed="true"]) { border-color: var(--text); color: var(--text); background: var(--bg2); }
@media (pointer: coarse) {
  #screen-editor .fmt-row .chip { min-height: 44px; }
  /* AI edit: 36 to see, 44 to hit */
  #screen-editor .ai-bar { min-height: 48px; }
  #screen-editor .ai-go { height: 36px; position: relative; }
  #screen-editor .ai-go::after { content: ""; position: absolute; inset: -4px 0; }
}

#screen-editor :is(.find-row, .biz-row) .find-field { font-size: var(--fs-12); color: var(--t1); }

/* The picture: edge to edge on the stage colour, no frame. Runway's rule:
   the footage is the only thing on this part of the screen. */
#screen-editor .stage { border: 0; border-radius: 0; background: var(--stagebg); }

/* The play row (T24 3.3): time | Play | tools, Play never moves */
body:not(.previewFs) #screen-editor .transport { height: var(--playrow-h); padding: 0 4px; }
#screen-editor .tr-time { font-size: var(--fs-12); color: var(--t1); }
#screen-editor .transport .play-btn { width: 48px; height: 48px; }
#screen-editor .transport .play-btn:hover { background: var(--bg1); }
#screen-editor .tr-right .icon-btn { border-radius: var(--r-2); }

/* the timeline */
#screen-editor .tl-zone { background: var(--bg0); }
#screen-editor .ruler { height: var(--ruler-h); }
#screen-editor .rt { top: 5px; font-size: var(--fs-11); color: var(--t2); }
#screen-editor .rdot { top: 11px; }
/* white playhead with a dark keyline so it reads on white footage too (a
   hairline edge, not a halo); crimson stays for what is selected */
#screen-editor .playhead { width: 2px; background: var(--playhead); box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.45); z-index: var(--z-playhead); }
#screen-editor .playhead::before { border-top-color: var(--playhead); }
#screen-editor .track-video { background: var(--bg1); }
#screen-editor .clip { border-radius: var(--r-2); }

/* the tool bar (phone, tablet): CapCut's, under the thumb */
#screen-editor .action-bar {
  height: calc(var(--toolbar-h) + env(safe-area-inset-bottom));
  background: var(--bg0); border-top: 1px solid var(--line); z-index: var(--z-toolbar);
}
#screen-editor .ab-back { flex: 0 0 52px; color: var(--text); }
#screen-editor .ab-tool {
  min-width: 64px; gap: 4px; padding: 0 4px;
  border-radius: var(--r-2); color: var(--t1);
  transition: background-color var(--t-state) var(--ease), color var(--t-state) var(--ease);
}
#screen-editor .ab-tool svg { width: 22px; height: 22px; color: var(--text); }
#screen-editor .ab-label { font-size: var(--fs-11); font-weight: 500; letter-spacing: 0.01em; }
#screen-editor .ab-tool:hover { background: var(--bg1); color: var(--text); }
#screen-editor .ab-tool:active { background: var(--bg2); filter: none; }
#screen-editor .ab-tool.active, #screen-editor .ab-tool.active svg { color: var(--acc); }

/* a tool's settings */
#inspector.inspector { background: var(--bg1); }
#inspector .panel-head { height: 48px; padding: 0 4px 0 16px; background: var(--bg1); border-bottom-color: var(--line); }
#inspector .panel-title { font-size: var(--fs-13); font-weight: 600; letter-spacing: 0; }
#inspector .panel-done { width: 44px; height: 44px; border-radius: var(--r-2); }
#inspector .panel-body { padding: 16px; gap: 16px; }
#inspector .panel-body > .ins-group > label { font-size: var(--fs-12); color: var(--t1); }
#inspector .panel-body .fchip, #inspector .panel-body .ins-seg button { border-radius: var(--r-2); }
#inspector .panel-body .fchip.active { border-color: var(--text); }
#inspector .panel-body :is(.ins-textarea, input[type="color"]) { border-radius: var(--r-2); }
#inspector .panel-body .ins-textarea:focus { border-color: var(--text); }

/* ===================== EDITOR: PHONE AND TABLET (CapCut mobile) =====================
   Top bar, the prompt, the picture taking every pixel that is left, the play
   row, a timeline as tall as its lanes (168 px up to 42 % of the screen), the
   tool bar. The picture gives up height first, so the tool bar is never
   pushed off (T24 2.1). */
@media (max-width: 1199px) {
  #screen-editor .ai-bar { margin: 8px 12px 0; }
  #screen-editor .fmt-row { margin: 4px 12px 0; }
  #screen-editor .stage-zone { flex: 1 1 0; min-height: 150px; padding: 8px 0 0; }
  #screen-editor .stage { flex: 1 1 auto; height: auto; min-height: 0; }
  #screen-editor .tl-zone { flex: 0 1 auto; min-height: 168px; max-height: 42vh; margin: 0; border-top: 0; overflow: hidden; display: flex; flex-direction: column; }
  #screen-editor .tl-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 0 8px; }
  #screen-editor .ruler { position: sticky; top: 0; z-index: 4; background: var(--bg0); }
  /* the strip of tools is visibly a strip: the far edge fades, so the half
     tool there says "more this way" */
  #screen-editor .ab-strip { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
  /* CapCut's sizes for a finger: main track 56 */
  #screen-editor .track-video { height: 56px; }
  #inspector.inspector { bottom: calc(var(--toolbar-h) + env(safe-area-inset-bottom)); border-radius: var(--r-3) var(--r-3) 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.28); }
}
@media (min-width: 761px) and (max-width: 1199px) {
  /* tablet: the phone layout, its tools centred at 72 wide when they fit */
  #screen-editor .ab-tool { min-width: 72px; }
  #screen-editor .ab-strip { -webkit-mask-image: none; mask-image: none; }
  #screen-editor .media-strip { display: none; }
}

/* Phone on its side (T24 2.2): two columns, the picture and play row on the
   left, the timeline over the tool bar on the right; a tool's settings open
   over the right column only, so the picture stays in view. */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 1199px) {
  body[data-screen="editor"] #screen-editor {
    display: grid;
    grid-template-columns: minmax(0, 55fr) minmax(0, 45fr);
    grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "ai tl" "fmt tl" "find tl" "biz tl" "status tl" "stage tl" "stage bar";
  }
  #screen-editor > .ai-bar { grid-area: ai; margin: 6px 8px 0 12px; }
  #screen-editor > .fmt-row { grid-area: fmt; margin: 2px 8px 0 12px; }
  #screen-editor > #findRow { grid-area: find; }
  #screen-editor > #bizRow { grid-area: biz; }
  #screen-editor > .ai-status { grid-area: status; }
  #screen-editor > .stage-zone { grid-area: stage; min-height: 0; padding: 4px 0 0; }
  #screen-editor > .tl-zone { grid-area: tl; max-height: none; min-height: 0; border-left: 1px solid var(--line); }
  #screen-editor > .action-bar { grid-area: bar; height: calc(56px + env(safe-area-inset-bottom)); border-left: 1px solid var(--line); }
  #screen-editor > .media-strip { display: none; }
  #inspector.inspector { left: 55%; right: 0; top: var(--topbar-h); bottom: 0; max-height: none; border-radius: 0; border-width: 0 0 0 1px; box-shadow: none; }
}

/* ===================== EDITOR: DESKTOP (CapCut desktop, four panels) =====================
   T24 2.4. Left: the tool rail (64) and the media panel (256). Middle: the
   prompt, then the player. Right: the properties panel (340), which never
   collapses: with nothing selected it says what goes there. Under all four,
   the timeline at full width with its toolbar. Opening or closing a panel
   never moves the picture or the timeline (no reflow). Also used on large
   touch screens held landscape (leader, 2026-11-06), with touch sizes. */
@media (min-width: 1200px) {
  body[data-screen="editor"] #screen-editor {
    display: grid;
    grid-template-columns: var(--rail-w) var(--asset-w) minmax(0, 1fr) auto var(--props-w);
    grid-template-rows: auto auto auto auto minmax(0, 1fr) clamp(220px, 34vh, 60vh);
    grid-template-areas:
      "rail asset ai fmt props"
      "rail asset find find props"
      "rail asset biz biz props"
      "rail asset status status props"
      "rail asset stage stage props"
      "tl tl tl tl tl";
    padding: 0;
  }
  /* the old layout made room for a floating panel; the panel has a column now */
  body.panel-open #screen-editor { padding-right: 0; }
  /* the properties panel's resting state: a surface and one plain line, so
     the four panels stay four panels with nothing selected */
  body[data-screen="editor"] #screen-editor::after {
    content: "Select a clip, text or sound to change it here.";
    grid-area: props; z-index: 0;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 64px 32px 0; text-align: center;
    font-size: var(--fs-12); line-height: 1.5; color: var(--t2);
    background: var(--bg1); border-left: 1px solid var(--line);
  }
  #screen-editor > .ai-bar { grid-area: ai; margin: 12px 0 0 16px; min-height: 36px; }
  #screen-editor > .ai-bar .ai-go { height: 28px; }
  #screen-editor > .fmt-row { grid-area: fmt; margin: 12px 16px 0 8px; align-self: center; }
  #screen-editor > #findRow { grid-area: find; margin: 8px 16px 0; }
  #screen-editor > #bizRow { grid-area: biz; margin: 8px 16px 0; }
  #screen-editor > .ai-status { grid-area: status; margin: 8px 16px 0; }
  #screen-editor > .stage-zone { grid-area: stage; min-height: 0; padding: 12px 16px 0; }
  #screen-editor .stage { min-height: 0; }

  /* the tool rail (CapCut's asset tabs): icon over label, 56 tall */
  #screen-editor > .action-bar {
    grid-area: rail; flex-direction: column; height: auto; min-height: 0; padding: 4px 0;
    border-top: 0; border-right: 1px solid var(--line); background: var(--bg0);
  }
  #screen-editor .ab-back { flex: 0 0 44px; width: 100%; border-right: 0; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  #screen-editor .ab-strip { flex-direction: column; justify-content: flex-start; overflow-x: hidden; overflow-y: auto; padding: 0 4px; gap: 2px; scrollbar-width: none; }
  #screen-editor .ab-tool { min-width: 0; width: 100%; min-height: 56px; padding: 6px 2px; }
  #screen-editor .ab-tool svg { width: 20px; height: 20px; }
  #screen-editor .ab-label { white-space: normal; text-align: center; line-height: 1.2; }

  /* the media panel: what was imported, as a grid you add from */
  #screen-editor > .media-strip {
    grid-area: asset; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start; gap: 8px; padding: 44px 12px 12px; position: relative;
    overflow-x: hidden; overflow-y: auto; background: var(--bg1);
    border-bottom: 0; border-right: 1px solid var(--line);
  }
  #screen-editor > .media-strip::before {
    content: "Media"; position: absolute; left: 12px; top: 0; height: 40px; display: flex; align-items: center;
    font-size: var(--fs-11); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--t2);
  }
  #screen-editor .media-strip :is(.ms-add, .ms-item) { width: auto; height: auto; aspect-ratio: 16 / 10; border-radius: var(--r-2); }
  #screen-editor .media-strip .ms-add { gap: 4px; border-color: var(--line-2); color: var(--t1); font-size: var(--fs-11); }
  #screen-editor .media-strip .ms-add:hover { border-color: var(--text); color: var(--text); background: var(--bg2); }
  #screen-editor .media-strip .ms-item:hover { border-color: var(--line-2); }
  #screen-editor .media-strip .ms-dur { font-size: var(--fs-11); font-variant-numeric: tabular-nums; }
  #screen-editor .media-strip .ms-plus { width: 24px; height: 24px; }

  /* the properties panel: in the grid, never floating over the picture */
  #inspector.inspector {
    grid-area: props; position: relative; inset: auto; z-index: 1;
    width: auto; max-height: none; min-height: 0; margin: 0;
    border: 0; border-left: 1px solid var(--line); border-radius: 0;
    box-shadow: none; animation: none; transform: none;
  }
  #inspector .panel-head { cursor: default; touch-action: auto; }
  #inspector .panel-grab { display: none; }

  /* the timeline: full width, its toolbar on top (zoom on the right) */
  #screen-editor > .tl-zone {
    grid-area: tl; display: flex; flex-direction: column; min-height: 0; max-height: none; margin: 0;
    border-top: 1px solid var(--line); background: var(--bg0); overflow: hidden;
  }
  #screen-editor .tl-top { flex: 0 0 auto; height: 40px; padding: 0 16px; justify-content: flex-end; border-bottom: 1px solid var(--line); }
  #screen-editor .tl-zoom input { width: 120px; }
  #screen-editor .tl-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 0 8px; }
  #screen-editor .ruler { position: sticky; top: 0; z-index: 4; background: var(--bg0); }
}
/* a short desktop window keeps the media panel: it is a column now and costs
   the picture no height */
@media (min-width: 1200px) and (max-height: 820px) { #screen-editor > .media-strip { display: grid; } }
/* large touch screens get the four panels with finger-sized targets */
@media (min-width: 1200px) and (pointer: coarse) {
  #screen-editor .ab-tool { min-height: 60px; }
  #screen-editor .media-strip .ms-plus { width: 44px; height: 44px; }
}

/* ===================== APP SCREENS: MODES, SETTINGS, ADMIN ===================== */
/* The same system as the editor: canvas, hairline bands, one heading size. */
.page-title { font-size: clamp(28px, 3.2vw, 36px); font-weight: 600; letter-spacing: -0.025em; }
.page-wrap .set-group > label { font-size: var(--fs-15); font-weight: 600; }
.page-wrap :is(.secondary-btn, .ghost-btn) { height: 36px; border-radius: var(--r-2); font-size: var(--fs-13); }
.page-wrap .secondary-btn { background: var(--bg1); }
.page-wrap .secondary-btn:hover { background: var(--bg2); border-color: var(--line-2); }
@media (pointer: coarse) { .page-wrap :is(.secondary-btn, .ghost-btn) { height: 44px; } }

/* 0.91.0 Ethlenos mark: three clips on three tracks make the E; the crimson clip is the cut */
.brand-mark { display: inline-block; flex: none; width: 1.25em; height: 1.25em; margin-right: 0.38em; vertical-align: -0.27em; }
.brand-mark .bm-cut { transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.brand-word { font-weight: 600; letter-spacing: -0.035em; text-transform: none; }
.logo-word { display: inline-flex; align-items: center; letter-spacing: 0; }
.logo:hover .bm-cut { transform: translateX(1.5px); }

/* 0.91.1 About shows the Ethlenos mark inline: no invert filter, ink follows the theme */
svg.about-logo { color: var(--text); filter: none !important; opacity: 1; }

/* 0.93.0 Add media in the editor: the same tiles as the shared Add videos sheet (addsheet.js) */
#addSheet.add-dressed .add-device,#addSheet.add-dressed .add-way{display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;column-gap:14px;align-items:center;text-align:left}
#addSheet.add-dressed .add-device .ea-ic,#addSheet.add-dressed .add-way .ea-ic{grid-row:1 / span 2;width:48px;height:48px;border-radius:14px}
#addSheet.add-dressed .add-device .ea-ic svg,#addSheet.add-dressed .add-way .ea-ic svg{width:24px;height:24px}
#addSheet.add-dressed .add-sources{display:grid;grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:6px 8px}
#addSheet.add-dressed .add-sources.hidden{display:none}
#addSheet.add-dressed .add-src{display:flex;flex-direction:column;align-items:center;gap:8px;padding:8px 2px 6px;border:0;border-radius:14px;background:none;color:var(--text);font-size:var(--fs-13,13px);font-weight:500;text-align:center}
#addSheet.add-dressed .add-src.hidden{display:none}
#addSheet.add-dressed .add-src:hover,#addSheet.add-dressed .add-src.on{background:var(--surface-2,rgba(127,127,127,.08))}
#addSheet .ea-ic{display:grid;place-items:center;width:58px;height:58px;border-radius:17px}
#addSheet .ea-ic-gallery,#addSheet .ea-ic-computer{background:linear-gradient(160deg,#ef3b58,#c8102e 62%,#a50d27)}
#addSheet .ea-ic-camera,#addSheet .ea-ic-files{background:linear-gradient(160deg,#3b3833,#1b1a17)}
body.dark #addSheet .ea-ic-camera,body.dark #addSheet .ea-ic-files{background:linear-gradient(160deg,#45423c,#2a2824)}
#addSheet .ea-ic-brand{background:var(--surface-2,#f4f2ed);border:1px solid var(--border,#e7e4dd)}
