/* ==========================================================================
   Montiliya — design system + app shell
   Soft dark panels (the product default) with a light theme from the same tokens. Black and white first: no accent colour,
   no gradients; hierarchy comes from scale, weight and space. Red appears only for recording, problems and the Sign out row.
   Logical properties everywhere, so LTR and RTL share one stylesheet.
   ========================================================================== */

/* ---- fonts (SIL OFL, self-hosted: the screen works offline) ------------- */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2-variations'), url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('../fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations'), url('../fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 600 700; font-display: swap; src: url('../fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2') format('woff2'); }

/* ---- tokens -------------------------------------------------------------- */
:root {
  color-scheme: dark;
  /* dark is the default */
  --bg-outer: #121212;   /* the window behind the panels */
  --panel: #1c1c1c;      /* sidebar, chat, preview */
  --panel-2: #252525;    /* cards, message box */
  --panel-3: #2e2e2e;    /* active row, pressed */
  --hover: #262626;
  --ink: #ededed;
  --ink-2: #c9c9c9;
  --ink-3: #9d9d9d;      /* 6.3:1 on --panel */
  --line: #2b2b2b;
  --line-strong: #3d3d3d;
  --on-ink: #101010;     /* text on an --ink surface */
  --disabled-bg: #2a2a2a;
  --disabled-ink: #7b7b7b;
  --danger: #ff7468;
  --danger-bg: rgba(255, 116, 104, 0.13);   /* a row that is red text on a soft red (Sign out) */
  --danger-bg-hover: rgba(255, 116, 104, 0.2);
  --on-danger: #1c0806;  /* text on a --danger surface (a destructive button): 7:1 */
  --rec: #ef4a40;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.45), 0 24px 56px -16px rgba(0, 0, 0, 0.7);
  --scroll-thumb: rgba(255, 255, 255, 0.16);   /* the slim thumb of every scrollbar; there is no track */
  --scroll-thumb-hover: rgba(255, 255, 255, 0.34);
  --logo-filter: invert(1);

  --font: 'Inter', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs-xs: 0.75rem; --fs-sm: 0.8125rem; --fs-md: 0.9375rem; --fs-lg: 1.0625rem; --fs-xl: 1.25rem; --fs-h2: 1.375rem;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px;
  --gutter: max(0px, env(safe-area-inset-left, 0px));
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-full: 999px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 140ms; --t-med: 240ms; --t-slow: 420ms;
  --side-w: 296px;
  --topbar-h: 60px;
  /* one accent, used sparingly (the onboarding, the Templates Library, the dashboard's charts): selected states, the primary action of those screens, the brand's own orange */
  --accent: #ff7a1a;
  --accent-ink: #1a0b00;      /* text on an --accent surface: 9:1 */
  --accent-soft: rgba(255, 122, 26, 0.13);
  --accent-line: rgba(255, 122, 26, 0.55);
  --glow: radial-gradient(120% 80% at 50% -10%, rgba(255, 122, 26, 0.14), transparent 60%);
  /* chart series (validated with the dataviz checks on --panel): the brand orange for one series; blue / red for completed / failed */
  --s-brand: #d95926; --s-ok: #3987e5; --s-bad: #e66767;
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg-outer: #ececec;
  --panel: #ffffff;
  --panel-2: #f4f4f4;
  --panel-3: #e9e9e9;
  --hover: #f1f1f1;
  --ink: #0a0a0a;
  --ink-2: #3f3f3f;
  --ink-3: #666666;
  --line: #e4e4e4;
  --line-strong: #cbcbcb;
  --on-ink: #ffffff;
  --disabled-bg: #ececec;
  --disabled-ink: #8d8d8d;
  --danger: #c42b1f;
  --danger-bg: rgba(196, 43, 31, 0.09);
  --danger-bg-hover: rgba(196, 43, 31, 0.15);
  --on-danger: #ffffff;
  --rec: #e5342a;
  --scrim: rgba(10, 10, 10, 0.45);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.08), 0 24px 56px -16px rgba(0, 0, 0, 0.28);
  --scroll-thumb: rgba(0, 0, 0, 0.16);
  --scroll-thumb-hover: rgba(0, 0, 0, 0.36);
  --logo-filter: none;
  --accent: #d9480f;          /* 4.6:1 on white */
  --accent-ink: #ffffff;
  --accent-soft: rgba(217, 72, 15, 0.09);
  --accent-line: rgba(217, 72, 15, 0.5);
  --glow: radial-gradient(120% 80% at 50% -10%, rgba(217, 72, 15, 0.08), transparent 60%);
  --s-brand: #eb6834; --s-ok: #2a78d6; --s-bad: #e34948;
}

/* ---- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; height: 100%; background: var(--bg-outer); color: var(--ink); font-family: var(--font); font-size: var(--fs-md); line-height: 1.5;
  font-feature-settings: 'cv11', 'ss03'; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow: hidden;
  transition: background-color var(--t-med) var(--ease), color var(--t-med) var(--ease);
}
:lang(ar) { letter-spacing: 0 !important; }
body:lang(ar) { line-height: 1.65; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; flex-shrink: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
bdi { unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: inherit; }
:root[data-input='pointer'] .opt:focus-visible, :root[data-input='pointer'] dialog .btn:focus-visible { outline: none; }
:root[data-input='pointer'] .opt:focus-visible { background: var(--hover); }
.opt:focus-visible { outline-offset: -2px; }
/* scrollbars: no track, only a slim rounded thumb (a 10 px lane with a 3 px see-through edge = 4 px of thumb) that grows a little and darkens when you point at it; the same everywhere in the app */
::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { min-width: 36px; min-height: 36px; border: 3px solid transparent; border-radius: var(--r-full); background-color: var(--scroll-thumb); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { border-width: 2px; background-color: var(--scroll-thumb-hover); }
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; } }      /* Firefox has no such pseudo-elements: the standard properties give it the same look */
.skip { position: fixed; inset-inline-start: var(--s4); top: -64px; z-index: 100; background: var(--ink); color: var(--on-ink); padding: var(--s2) var(--s4); border-radius: var(--r-full); font-weight: 500; transition: top var(--t-fast); }
.skip:focus { top: var(--s3); }

/* ---- shared controls ------------------------------------------------------ */
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.mirror-rtl { transition: transform var(--t-fast) var(--ease); }
[dir='rtl'] .mirror-rtl { transform: scaleX(-1); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding-inline: var(--s5); border-radius: var(--r-full);
  font-weight: 600; font-size: var(--fs-md); white-space: nowrap; user-select: none;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn-primary, .btn-light { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover, .btn-light:hover { transform: translateY(-1px); }
.btn-primary:active, .btn-light:active { transform: translateY(0) scale(0.985); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { transform: translateY(-1px); }
.btn-accent:active { transform: translateY(0) scale(0.985); }
.btn-ghost { border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); background: var(--hover); }
/* a destructive confirmation (Delete project, Delete draft): red, and never a forward arrow */
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-danger:hover { transform: translateY(-1px); }
.btn-danger:active { transform: translateY(0) scale(0.985); }
.btn-danger .go { display: none; }
.btn[aria-disabled='true'] { background: var(--disabled-bg); color: var(--disabled-ink); cursor: not-allowed; transform: none; }
.btn .icon { width: 18px; height: 18px; stroke-width: 2.1; }
.go { transition: transform var(--t-fast) var(--ease); }
.btn-primary:not([aria-disabled='true']):hover .go { transform: translateX(3px); }
[dir='rtl'] .btn-primary:not([aria-disabled='true']):hover .go { transform: scaleX(-1) translateX(3px); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-full); border: 1px solid var(--line-strong); color: var(--ink); transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), color var(--t-fast); }
.icon-btn:hover { border-color: var(--ink); background: var(--hover); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn[aria-expanded='true'], .icon-btn[aria-pressed='true'] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.icon-btn.plain { border-color: transparent; color: var(--ink-3); }
.icon-btn.plain:hover { background: var(--hover); color: var(--ink); }
.icon-btn.plain[aria-expanded='true'] { background: var(--panel-3); color: var(--ink); border-color: transparent; }
.icon-btn.plain[aria-pressed='true'] { background: transparent; color: var(--ink); border-color: transparent; }
.icon-btn[aria-disabled='true'] { color: var(--disabled-ink); cursor: not-allowed; }
.icon-btn[aria-disabled='true']:hover { background: transparent; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-full); background: var(--ink); color: var(--on-ink); font-size: var(--fs-sm); font-weight: 650; flex: none; }
.anchor { position: relative; }

/* ---- app shell ------------------------------------------------------------ */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); gap: var(--s2); height: 100dvh; padding: var(--s2); padding-inline: max(var(--s2), env(safe-area-inset-left, 0px)) max(var(--s2), env(safe-area-inset-right, 0px)); }
.side, .main { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); min-height: 0; min-width: 0; }

/* sidebar */
.side { display: flex; flex-direction: column; overflow: hidden; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: var(--s5) var(--s4) var(--s2) var(--s5); min-height: 64px; }
.brand { display: inline-flex; align-items: center; border-radius: var(--r-sm); min-height: 32px; }
.brand img { height: 26px; width: auto; filter: var(--logo-filter); }
.side-top-tools { display: flex; align-items: center; gap: var(--s1); }
.side-close { display: none; }
.side-search { padding: var(--s1) var(--s4) var(--s2); }
.side-search input { width: 100%; height: 40px; padding-inline: var(--s4); border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--panel-2); outline: 0; font-size: var(--fs-md); }
.side-search input::placeholder { color: var(--ink-3); opacity: 1; }
.side-search input:focus { border-color: var(--ink); }
.side-new { display: flex; align-items: center; gap: var(--s3); margin: var(--s1) var(--s2); padding: var(--s3) var(--s3); border-radius: var(--r-md); font-size: 1.0625rem; color: var(--ink); transition: background-color var(--t-fast); min-height: 48px; }
.side-new:hover { background: var(--hover); }
.side-new .icon { color: var(--ink-2); }
.side-nav { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: var(--s4); }
.side-label { margin: 0; padding: var(--s3) var(--s5) var(--s2); color: var(--ink-3); font-size: 1rem; }
.side-list { list-style: none; margin: 0; padding: 0 var(--s2) var(--s3); overflow-y: auto; flex: 1; min-height: 0; }
.side-empty { margin: 0; padding: var(--s4) var(--s5); color: var(--ink-3); font-size: var(--fs-sm); }
.proj { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s3); align-items: baseline; padding: var(--s3) var(--s3); border-radius: var(--r-md); min-height: 60px; transition: background-color var(--t-fast); }
.proj:hover { background: var(--hover); }
.proj[aria-current='page'] { background: var(--panel-3); }
.proj-title { font-size: 1.0625rem; font-weight: 500; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-time { font-size: var(--fs-sm); color: var(--ink-3); white-space: nowrap; }
.proj-sub { grid-column: 1 / -1; font-size: var(--fs-md); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.4; }
.proj.attention .proj-sub::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-inline-end: 7px; vertical-align: 1px; }
.side-foot { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4) var(--s3) var(--s5); border-top: 1px solid var(--line); min-height: 64px; }
.who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; color: var(--ink-2); }
.scrim { position: fixed; inset: 0; z-index: 45; background: var(--scrim); animation: fade var(--t-med) var(--ease); }
@keyframes fade { from { opacity: 0; } }

/* main: top bar + stage */
.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: grid; grid-template-columns: 1fr minmax(0, 2fr) 1fr; align-items: center; min-height: var(--topbar-h); padding: var(--s2) var(--s4); }
.menu-btn { display: none; justify-self: start; }
.title { grid-column: 2; text-align: center; font-size: 1.0625rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { grid-column: 3; justify-self: end; display: flex; gap: var(--s2); }
.top-actions .btn { min-height: 40px; padding-inline: var(--s5); }
.stage { position: relative; flex: 1; min-height: 0; }

/* home */
.home { position: absolute; inset: 0; overflow-y: auto; display: flex; padding: var(--s6) var(--s6) var(--s10); }
.home-inner { margin: auto; width: 100%; max-width: 760px; display: flex; flex-direction: column; align-items: center; }
.home h1 { margin: 0 0 var(--s8); font-size: clamp(1.75rem, 1.1rem + 2.6vw, 2.5rem); line-height: 1.12; font-weight: 650; letter-spacing: -0.03em; text-align: center; text-wrap: balance; }
:lang(ar) .home h1 { line-height: 1.3; font-weight: 600; }
.composer-slot { width: 100%; }
.mascot { width: 76px; aspect-ratio: 854 / 680; color: var(--ink); margin-bottom: var(--s5); cursor: default; touch-action: manipulation; }
.mascot svg { width: 100%; height: 100%; overflow: visible; }
.mascot .eyes { transform: translate(calc(var(--lx, 0) * 1px), calc(var(--ly, 0) * 1px)); transition: transform 180ms var(--ease); }
.mascot .eye { fill: var(--panel); transform-box: fill-box; transform-origin: center; transition: transform 160ms var(--ease); }
.mascot[data-state='drag'] .eye { transform: scale(1.18, 1.3); }
.mascot[data-state='listen'] .eye { animation: listen 0.9s var(--ease-in-out) infinite alternate; }
.mascot[data-state='sleep'] .eye { transform: scaleY(0.12); }
.mascot.blink .eye { animation: blink 220ms var(--ease-in-out); }
@keyframes blink { 50% { transform: scaleY(0.1); } }
@keyframes listen { from { transform: scale(1, 0.85); } to { transform: scale(1.1, 1.22); } }
.hint { margin: var(--s4) 0 0; min-height: 22px; font-size: var(--fs-sm); color: var(--ink-3); text-align: center; text-wrap: balance; }
.hint .lock { display: inline-block; vertical-align: -3px; margin-inline-end: 6px; }
.hint kbd { font: inherit; font-size: var(--fs-xs); padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel-2); color: var(--ink-2); white-space: nowrap; }
.hint .sep { margin-inline: var(--s2); opacity: 0.5; }
@media (hover: none) { .hint .kb { display: none; } }

/* ---- composer (shared by home and chat) ----------------------------------- */
.composer { position: relative; width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-xl); transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease); }
.composer:focus-within { border-color: var(--ink-3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent); }
.composer.shake { animation: shake 360ms var(--ease-in-out); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.composer textarea { display: block; width: 100%; min-height: 112px; max-height: 40vh; resize: none; border: 0; outline: 0; background: transparent; padding: var(--s5) var(--s6) var(--s2); font-size: 1.0625rem; line-height: 1.55; border-radius: var(--r-xl) var(--r-xl) 0 0; }
.composer textarea::placeholder { color: var(--ink-3); opacity: 1; }
.counter { position: absolute; inset-block-start: var(--s3); inset-inline-end: var(--s4); font-size: var(--fs-xs); color: var(--ink-3); pointer-events: none; }
.dropzone { position: absolute; inset: 0; z-index: 5; display: none; place-items: center; text-align: center; border-radius: inherit; background: color-mix(in srgb, var(--panel-2) 94%, transparent); border: 2px dashed var(--ink); pointer-events: none; }
.composer.dragging .dropzone { display: grid; animation: fade var(--t-fast) var(--ease); }
.dropzone strong { display: block; font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; }
.dropzone span { color: var(--ink-3); font-size: var(--fs-sm); }
.ruler { position: absolute; inset-inline: var(--s6); inset-block-end: var(--s5); height: 10px; opacity: 0.55; background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 10px); -webkit-mask: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent); mask: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent); }
.shelf { padding: var(--s2) var(--s6) var(--s3); display: flex; flex-direction: column; gap: var(--s3); }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); font-size: var(--fs-sm); color: var(--ink-3); }
.shelf-head strong { color: var(--ink); font-weight: 600; }
.shelf-earlier { margin: 0; font-size: var(--fs-sm); color: var(--ink-3); }
.clips { display: flex; flex-direction: column; gap: 2px; max-height: min(34vh, 300px); overflow-y: auto; overscroll-behavior: contain; padding: 2px; margin-inline: calc(var(--s2) * -1); }
.clip { position: relative; display: grid; grid-template-columns: 22px 28px minmax(0, 1fr) auto auto 28px; align-items: center; gap: var(--s3); min-height: 44px; padding-inline: var(--s2); border-radius: var(--r-md); content-visibility: auto; contain-intrinsic-size: 0 44px; animation: pop var(--t-med) var(--ease) both; }
.clip:hover { background: var(--hover); }
.clips.many .clip { animation: none; }
.clip .idx { color: var(--ink-3); font-size: var(--fs-xs); text-align: end; }
.clip .th { width: 28px; height: 28px; border-radius: 6px; overflow: hidden; background: var(--panel-3); }
.clip .th img, .clip .thumb-fallback { width: 100%; height: 100%; object-fit: cover; }
.clip .thumb-fallback { display: grid; place-items: center; color: var(--ink-3); }
.clip .thumb-fallback .icon { width: 14px; height: 14px; }
.clip .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.clip .dur, .clip .sz { color: var(--ink-3); font-size: var(--fs-xs); white-space: nowrap; }
.remove { position: absolute; inset-inline-end: 4px; inset-block-start: 4px; width: 24px; height: 24px; border-radius: var(--r-full); background: rgba(10, 10, 10, 0.78); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity var(--t-fast), transform var(--t-fast); }
.remove .icon { width: 12px; height: 12px; stroke-width: 2.6; }
.clip:hover .remove, .clip:focus-within .remove, .remove:focus-visible { opacity: 1; }
@media (hover: none) { .remove { opacity: 1; } }
.remove:hover { transform: scale(1.1); }
.remove:focus-visible { outline-color: #fff; outline-offset: 1px; }
.remove::after, .chip .x::after, .chip .play::after { content: ''; position: absolute; inset: -10px; }
.clip .remove { position: relative; inset: auto; opacity: 1; width: 28px; height: 28px; background: transparent; color: var(--ink-3); }
.clip .remove:hover { background: var(--line-strong); color: var(--ink); transform: none; }
.clip .remove:focus-visible { outline-color: var(--ink); outline-offset: 0; }
@media (max-width: 480px) { .clip { grid-template-columns: 20px 28px minmax(0, 1fr) auto 28px; gap: var(--s2); } .clip .sz { display: none; } }
.chip .x, .chip .play { position: relative; }
.clip.leaving { animation: out var(--t-fast) var(--ease) forwards; }
@keyframes pop { from { opacity: 0; transform: scale(0.9) translateY(6px); } }
@keyframes out { to { opacity: 0; transform: scale(0.9); } }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { display: inline-flex; align-items: center; gap: var(--s2); max-width: 100%; min-height: 36px; padding-inline: var(--s3) var(--s1); border-radius: var(--r-full); border: 1px solid var(--line-strong); background: var(--panel-3); font-size: var(--fs-sm); animation: pop var(--t-med) var(--ease) both; }
.chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; font-weight: 500; }
.chip .meta { color: var(--ink-3); }
.chip .x { width: 28px; height: 28px; border-radius: var(--r-full); display: grid; place-items: center; color: var(--ink-3); transition: background-color var(--t-fast), color var(--t-fast); }
.chip .x:hover { background: var(--line-strong); color: var(--ink); }
.chip .x .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.chip .play { width: 28px; height: 28px; border-radius: var(--r-full); display: grid; place-items: center; background: var(--ink); color: var(--on-ink); }
.chip .play .icon { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.rec { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) var(--s4) var(--s4) var(--s6); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rec); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }
.rec-time { font-weight: 600; min-width: 4ch; }
.meter { flex: 1; height: 28px; display: flex; align-items: center; gap: 3px; }
.meter i { flex: 1; max-width: 4px; height: 4px; border-radius: 2px; background: var(--ink); opacity: 0.85; transition: height 90ms linear; }
.rec-actions { display: flex; gap: var(--s2); margin-inline-start: auto; }
.bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); padding: var(--s2) var(--s4) var(--s4); }
.bar-end { margin-inline-start: auto; display: flex; align-items: center; gap: var(--s3); }
.btn-generate { min-height: 48px; padding-inline: var(--s6); font-size: var(--fs-lg); }
.send { display: none; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ink); color: var(--on-ink); transition: transform var(--t-fast) var(--ease), background-color var(--t-fast); }
.send:hover { transform: translateY(-1px); }
.send:active { transform: scale(0.94); }
.send[aria-disabled='true'] { background: var(--panel-3); color: var(--disabled-ink); cursor: not-allowed; transform: none; }
.send .icon { stroke-width: 2.2; }
.pill { display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; padding-inline: var(--s4) var(--s3); border-radius: var(--r-full); border: 1px solid var(--line-strong); font-size: var(--fs-sm); transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast); }
.pill:hover, .pill[aria-expanded='true'] { border-color: var(--ink); background: var(--hover); }
.pill:active { transform: scale(0.985); }
.pill .k { color: var(--ink-3); }
.pill .v { font-weight: 600; }
.pill .chev { width: 16px; height: 16px; color: var(--ink-3); transition: transform var(--t-fast) var(--ease); }
.pill[aria-expanded='true'] .chev { transform: rotate(180deg); }
/* in a project the box is a change request: no style pills, a round send button */
.composer.compact { border-radius: var(--r-xl); }
.composer.compact textarea { min-height: 64px; padding-top: var(--s4); }
.composer.compact .opts, .composer.compact #generate { display: none; }
.composer.compact.has-len #dur-anchor { display: block; }       /* a change request shows its length (the version's own, or the one picked for it) and its price in the menu */
/* with the Length pill the box holds four controls and Send: in a project the Length and Format pills show a glyph and the value (their names stay in what is read aloud), so the bar keeps one row */
.dur-ic { display: none; color: var(--ink-3); }
.composer.compact .dur-ic { display: block; }
.composer.compact #dur-pill .k, .composer.compact #ar-pill .k { display: none; }
.composer.compact #dur-pill { gap: var(--s1); padding-inline: var(--s3); }
.composer.compact .send { display: grid; }
.composer.compact .shelf { padding-inline: var(--s5); }

/* popovers */
.pop { position: absolute; z-index: 40; inset-inline-start: 0; top: calc(100% + var(--s2)); min-width: 220px; padding: var(--s2); border-radius: var(--r-lg); border: 1px solid var(--line-strong); background: var(--panel-2); box-shadow: var(--shadow-pop); transform-origin: top; animation: pop-in var(--t-fast) var(--ease); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }   /* placement limits the height in a short window: the rows scroll inside the panel */
.pop.up { top: auto; bottom: calc(100% + var(--s2)); transform-origin: bottom; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.opt { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 44px; padding: var(--s2) var(--s3); border-radius: var(--r-md); text-align: start; transition: background-color var(--t-fast); }
.opt:hover, .opt:focus-visible { background: var(--hover); }
.opt .t { flex: 1; min-width: 0; }
.opt .t strong { display: block; font-weight: 600; font-size: var(--fs-md); line-height: 1.3; }
.opt .t small { display: block; color: var(--ink-3); font-size: var(--fs-sm); line-height: 1.35; text-wrap: pretty; overflow-wrap: anywhere; }
.opt .tick { width: 18px; height: 18px; color: var(--ink); opacity: 0; }
.opt[aria-checked='true'] .tick { opacity: 1; }
.opt .glyph { width: 40px; height: 40px; border-radius: var(--r-md); border: 1px solid var(--line); display: grid; place-items: center; background: var(--panel-3); color: var(--ink); flex: none; }
.opt .frame { width: 34px; height: 60px; flex: none; color: var(--ink); }
.pop-label { margin: var(--s2) var(--s3) var(--s1); font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
:lang(ar) .pop-label { text-transform: none; letter-spacing: 0; }
.pop-style { width: min(380px, calc(100vw - 32px)); }
.pop-dur { width: 188px; min-width: 188px; }
.pop-ratio { width: min(320px, calc(100vw - 32px)); }
/* output format: the frame glyph in the pill and in the menu (an outlined rectangle in the shape of the format, drawn in currentColor) */
.ar-ind { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: none; color: var(--ink); }
.ar-ind svg, .opt .ar-glyph svg { width: 100%; height: 100%; }
.opt .glyph.ar-glyph svg { width: 28px; height: 28px; }
.pop-add { width: min(360px, calc(100vw - 32px)); }
/* account menu (the gear in the sidebar footer): who is signed in, rows grouped by what they do with an icon each, a switch for dark mode, Sign out apart at the bottom.
   The card and the wells inside it swap their greys with the theme: dark = a lighter card with darker wells, light = a white card with grey wells. */
.pop.pop-settings { --card: var(--panel-2); --well: var(--panel); --lift: var(--panel-3); width: 288px; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-xl); background: var(--card); color: var(--ink); font-size: var(--fs-md); inset-inline-start: auto; inset-inline-end: 0; }
:root[data-theme='light'] .pop.pop-settings { --card: var(--panel); --well: var(--panel-2); --lift: var(--panel); }
/* (.pop.pop-settings, not .pop-settings, and every property above set on purpose: a menu that opens upward also carries the class "up", which the uploads card (.up, further down) styles as well) */
.pop-settings > * { flex: none; }
.acct-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s1) var(--s1) var(--s3); border-bottom: 1px solid var(--line); }
.acct-head .avatar { width: 44px; height: 44px; font-size: var(--fs-lg); box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--line-strong); }
.acct-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-name { font-size: var(--fs-md); font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.acct-mail { color: var(--ink-3); font-size: var(--fs-sm); line-height: 1.35; overflow-wrap: anywhere; }
.acct-group { display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: var(--r-lg); background: var(--well); }
.acct-row { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 48px; padding: 0 var(--s3); border-radius: var(--r-md); font-size: var(--fs-md); font-weight: 500; text-align: start; color: var(--ink); transition: background-color var(--t-fast), box-shadow var(--t-fast); }
.acct-row .icon { width: 22px; height: 22px; flex: none; color: var(--ink-2); }
.acct-row .t { flex: 1; min-width: 0; }
button.acct-row:hover, button.acct-row:focus-visible { background: var(--lift); box-shadow: var(--shadow-1); }
.acct-row:focus-visible, .acct-seg button:focus-visible { outline-offset: -2px; }
:root[data-input='pointer'] .acct-row:focus-visible, :root[data-input='pointer'] .acct-seg button:focus-visible { outline: none; }
.acct-seg { display: flex; flex: 1; min-width: 0; padding: 3px; border-radius: var(--r-full); background: var(--card); border: 1px solid var(--line); }
.acct-seg button { flex: 1; min-height: 32px; padding-inline: var(--s2); border-radius: var(--r-full); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-3); white-space: nowrap; transition: background-color var(--t-fast), color var(--t-fast); }
.acct-seg button:hover { color: var(--ink); }
.acct-seg button[aria-checked='true'] { background: var(--ink); color: var(--on-ink); }
:root[data-theme='light'] .acct-row .if-dark, :root:not([data-theme='light']) .acct-row .if-light { display: none; }   /* the icon shows the look you have now: a moon in the dark theme, a sun in the light one */
.acct-switch { position: relative; flex: none; width: 44px; height: 26px; border-radius: var(--r-full); background: var(--line-strong); transition: background-color var(--t-fast); }
.acct-switch::after { content: ''; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform var(--t-fast) var(--ease), background-color var(--t-fast); }
.acct-row[aria-checked='true'] .acct-switch { background: var(--ink); }
.acct-row[aria-checked='true'] .acct-switch::after { transform: translateX(18px); background: var(--on-ink); }
[dir='rtl'] .acct-row[aria-checked='true'] .acct-switch::after { transform: translateX(-18px); }
.acct-sep { height: 1px; margin-inline: var(--s1); background: var(--line); }
.acct-out { color: var(--danger); background: var(--danger-bg); }
.acct-out .icon { color: inherit; }
button.acct-out:hover, button.acct-out:focus-visible { background: var(--danger-bg-hover); box-shadow: none; }

/* ---- workspace: chat + vertical preview ----------------------------------- */
.workspace { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 40%, 520px); min-height: 0; }
.view-toggle { display: none; }
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s4) var(--s8) var(--s6); display: flex; flex-direction: column; gap: var(--s5); scroll-behavior: smooth; }
.chat-scroll > * { width: 100%; max-width: 720px; margin-inline: auto; }
.chat-input { padding: var(--s3) var(--s6) var(--s6); }
.chat-input > .composer { max-width: 720px; margin-inline: auto; }
.msg-user { align-self: flex-end; width: auto; max-width: min(85%, 560px); margin-inline: 0; margin-inline-start: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px; padding: var(--s3) var(--s4); font-size: 1.0625rem; line-height: 1.55; display: flex; flex-direction: column; gap: var(--s3); }
.msg-user p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-files { display: flex; gap: var(--s2); flex-wrap: wrap; }
.mini { width: 40px; aspect-ratio: 9 / 16; border-radius: 8px; background: var(--panel-3); border: 1px solid var(--line-strong); display: grid; place-items: center; color: var(--ink-3); overflow: hidden; }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.mini .icon { width: 16px; height: 16px; }
.msg-meta { display: flex; gap: var(--s2); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--ink-3); }
.msg-meta span { border: 1px solid var(--line-strong); border-radius: var(--r-full); padding: 1px 10px; }
.act { display: flex; align-items: flex-start; gap: var(--s3); color: var(--ink-3); font-size: 1.0625rem; line-height: 1.5; }
.act .icon { width: 18px; height: 18px; margin-top: 4px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line); }
.row .l { display: flex; align-items: center; gap: var(--s3); min-width: 0; color: var(--ink); font-size: 1.0625rem; }
.row .l span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .l .icon { color: var(--ink-3); width: 18px; height: 18px; }
.row .r { color: var(--ink-3); font-size: 1rem; white-space: nowrap; }
.answer { font-size: 1.0625rem; line-height: 1.65; color: var(--ink); }
.answer p { margin: 0 0 var(--s3); }
.answer ul { margin: 0 0 var(--s3); padding-inline-start: var(--s6); }
.answer li { margin-bottom: var(--s2); padding-inline-start: var(--s1); }
.answer strong { font-weight: 650; }
.answer.warn { display: flex; gap: var(--s3); }
.answer.warn .icon { color: var(--danger); margin-top: 3px; }
/* a draft this page is not holding: what is kept, Continue and Delete draft */
.answer.draft-panel { display: flex; gap: var(--s3); }
.answer.draft-panel > .icon { flex: none; color: var(--ink-3); margin-top: 3px; }
.draft-panel .job-actions { flex-wrap: wrap; margin-top: var(--s2); }
.rate { display: flex; gap: var(--s1); margin-inline-start: calc(var(--s2) * -1); }
.follow { display: flex; flex-direction: column; gap: var(--s1); }
.follow button { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s3); border-radius: var(--r-md); text-align: start; color: var(--ink-2); font-size: 1.0625rem; line-height: 1.45; transition: background-color var(--t-fast), color var(--t-fast); }
.follow button:hover { background: var(--hover); color: var(--ink); }
.follow .icon { width: 16px; height: 16px; margin-top: 5px; color: var(--ink-3); }
[dir='rtl'] .follow .icon { transform: scaleX(-1); }
.note { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--fs-sm); color: var(--ink-3); border: 1px dashed var(--line-strong); border-radius: var(--r-md); padding: var(--s3) var(--s4); }
.note .icon { width: 16px; height: 16px; margin-top: 2px; }

/* preview */
.preview { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: var(--s4) var(--s6) var(--s5); border-inline-start: 1px solid var(--line); }
.frame-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding-block: var(--s2) var(--s4); container-type: size; }
/* the preview frame is the largest frame of the output format that fits the space, whichever dimension is the limit: 9:16 (default), 16:9 or 1:1.
   #frame[data-ratio] sets --rw / --rh (the script sets them itself only for a video of another shape); scoped to .frame-wrap because the style
   sketches in the menus are also .frame */
.frame { position: relative; width: min(100cqw, calc(100cqh * 9 / 16)); aspect-ratio: 9 / 16; border-radius: var(--r-sm); overflow: hidden; background: #000; box-shadow: 0 0 0 1px var(--line); }
.frame-wrap .frame { --rw: 9; --rh: 16; width: min(100cqw, calc(100cqh * var(--rw) / var(--rh))); aspect-ratio: var(--rw) / var(--rh); }
.frame-wrap .frame[data-ratio='16:9'] { --rw: 16; --rh: 9; }
.frame-wrap .frame[data-ratio='1:1'] { --rw: 1; --rh: 1; }
.frame video { width: 100%; height: 100%; object-fit: contain; display: block; }
.frame:fullscreen { border-radius: 0; box-shadow: none; }
.poster { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3); padding: var(--s6); text-align: center; color: #ededed; background: #0b0b0b; }
.poster .mascot { width: 34%; min-width: 56px; margin: 0; color: #ededed; }
.poster .mascot .eye { fill: #0b0b0b; }
.poster p { margin: 0; font-size: var(--fs-sm); color: #a9a9a9; max-width: 22ch; text-wrap: balance; }
/* landscape frames are short: the mascot and the note sit in a row; square ones just get a smaller mascot (while an edit runs the poster shows css/genstate.css instead) */
.frame[data-ratio='16:9'] .poster { flex-direction: row; gap: var(--s4); padding: var(--s3) var(--s5); }
.frame[data-ratio='16:9'] .poster .mascot { width: 20%; min-width: 44px; flex: none; }
.frame[data-ratio='16:9'] .poster p { text-align: start; min-width: 0; }
.frame[data-ratio='1:1'] .poster { padding: var(--s5); }
.frame[data-ratio='1:1'] .poster .mascot { width: 28%; }
.times { display: flex; justify-content: space-between; font-size: 1rem; color: var(--ink-2); padding-inline: 2px; }
.scrub { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; margin: var(--s1) 0 0; background: transparent; cursor: pointer; --p: 0%; }
.scrub::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(to right, var(--ink) var(--p), var(--line-strong) var(--p)); }
.scrub::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line-strong); }
.scrub::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--ink); }
.scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; background: var(--ink); border: 0; }
.scrub::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 0; }
.scrub:disabled { cursor: default; opacity: 0.55; }
/* media controls keep the conventional left-to-right order (start time, scrubber, controls) in RTL too */
.times, .scrub, .controls { direction: ltr; }
.controls { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; margin-top: var(--s2); }
.controls-end { justify-self: end; display: flex; align-items: center; gap: var(--s1); }
.play-btn { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: var(--ink); transition: background-color var(--t-fast), transform var(--t-fast); }
.play-btn:hover { background: var(--hover); }
.play-btn:active { transform: scale(0.94); }
.play-btn .icon { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.play-btn[aria-disabled='true'] { color: var(--disabled-ink); cursor: not-allowed; }
.play-btn[aria-disabled='true']:hover { background: transparent; }
.speed { font-size: var(--fs-md); font-weight: 600; width: 44px; }

/* versions: every finished edit of the project, in the order they were made; the one on screen is marked, each can be watched or downloaded */
.versions { flex: none; margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.versions-h { margin: 0 0 var(--s1); padding-inline: var(--s3); font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase; }
:lang(ar) .versions-h { text-transform: none; letter-spacing: 0; }
.ver-list { position: relative; margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; max-height: 148px; overflow-y: auto; overscroll-behavior: contain; }
.ver { display: flex; align-items: center; gap: var(--s1); border-radius: var(--r-md); }
.ver.on { background: var(--panel-2); }
.ver-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: var(--s1) var(--s3); border-radius: var(--r-md); text-align: start; color: var(--ink-2); transition: background-color var(--t-fast), color var(--t-fast); }
.ver-pick:hover { background: var(--hover); color: var(--ink); }
.ver.on .ver-pick { color: var(--ink); }
.ver-ic { display: grid; place-items: center; width: 20px; height: 20px; flex: none; color: var(--ink-3); }
.ver-ic .icon { width: 16px; height: 16px; }
.ver.on .ver-ic { color: var(--ink); }
.ver-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ver-t strong { font-weight: 600; font-size: var(--fs-md); }
.ver-t small { color: var(--ink-3); font-size: var(--fs-xs); }
.ver-dl { flex: none; }
/* a change request in the chat and the line that says nothing changes unless it is asked for */
.msg-meta .rev-tag { color: var(--ink-2); border-color: var(--ink-3); }
.ver-tag { margin-inline-end: var(--s1); vertical-align: 1px; }
.rev-note { margin: 0; font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.5; }

/* ---- dialog + toast ------------------------------------------------------- */
dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-xl); background: var(--panel); color: var(--ink); box-shadow: var(--shadow-pop); overflow: auto; }
dialog::backdrop { background: var(--scrim); animation: fade var(--t-med) var(--ease); }
dialog[open] { animation: dialog-in var(--t-med) var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.dlg { padding: var(--s6); }
.dlg-head { display: flex; align-items: center; gap: var(--s4); }
.dlg-head .mascot { width: 56px; margin: 0; flex: none; }
.dlg h2 { margin: 0; font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; }
.dlg-sub { margin: var(--s1) 0 0; color: var(--ink-3); font-size: var(--fs-sm); }
.dlg dl { margin: var(--s5) 0 0; display: grid; grid-template-columns: auto 1fr; gap: var(--s3) var(--s5); padding-block: var(--s4); border-block: 1px solid var(--line); font-size: var(--fs-sm); }
.dlg dt { color: var(--ink-3); }
.dlg dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.dlg-aside { color: var(--ink-3); font-weight: 400; }
.dlg dd.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-weight: 400; color: var(--ink-2); }
.notice { margin: var(--s4) 0 0; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line); font-size: var(--fs-sm); color: var(--ink-2); }
.dlg-actions { display: flex; justify-content: flex-end; gap: var(--s3); margin-top: var(--s5); }
.toasts { position: fixed; z-index: 60; inset-inline: 0; inset-block-end: max(var(--s5), env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: var(--s2); pointer-events: none; padding-inline: var(--s4); }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: var(--s3); max-width: min(520px, 100%); padding: var(--s3) var(--s4); border-radius: var(--r-lg); background: var(--ink); color: var(--on-ink); font-size: var(--fs-sm); line-height: 1.45; box-shadow: var(--shadow-pop); animation: toast-in var(--t-med) var(--ease); }
.toast .icon { margin-top: 1px; width: 18px; height: 18px; }
.toast.out { animation: toast-out var(--t-fast) var(--ease) forwards; }
/* a notice that leads somewhere ("Your video is ready" · Open): its action is the underlined word of css/billing.css (.toast .toast-act), at the end, with room to tap */
.toast-t { min-width: 0; }
.toast > .toast-act { flex: none; align-self: center; min-height: 32px; padding-inline: var(--s1); }
@media (pointer: coarse) { .toast > .toast-act { min-height: 44px; } }

/* the status of running edits could not be read: a slim bar between the top bar and the screen, on every screen, with Retry (the page keeps trying by itself); it takes its
   own row, so it never covers a control (the Chat / Preview switch of a phone, the steps of the flow) */
.sync { flex: none; display: flex; align-items: center; justify-content: center; gap: var(--s2); padding: var(--s1) var(--s4); border-block: 1px solid var(--line); background: var(--panel-2);
  color: var(--ink-2); font-size: var(--fs-sm); white-space: nowrap; animation: fade var(--t-med) var(--ease); }
.sync[hidden] { display: none; }
.sync .icon { flex: none; color: var(--danger); }
.sync span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sync-retry { flex: none; min-height: 32px; padding-inline: var(--s3); border-radius: var(--r-full); background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: var(--fs-sm); }
.sync-retry[aria-disabled='true'] { background: var(--disabled-bg); color: var(--disabled-ink); }
@media (pointer: coarse) { .sync-retry { min-height: 40px; } }

/* why Send is off while an edit runs (one edit at a time): a line at the top of the change-request box */
.busy-note { display: flex; align-items: flex-start; gap: var(--s2); margin: 0; padding: var(--s3) var(--s5) 0; color: var(--ink-3); font-size: var(--fs-sm); line-height: 1.45; }
.busy-note[hidden] { display: none; }
.busy-note .icon { flex: none; margin-top: 2px; }
.busy-note.nudge { animation: cr-nudge 360ms var(--ease-in-out); color: var(--ink-2); }      /* the keyframes of css/create.css */

/* the card under the player: a change request being made while the earlier version stays on screen, then "Version 2 is ready" or what went wrong */
.revcard { flex: none; margin-top: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-lg); background: var(--panel-2); border: 1px solid var(--line); }
.revcard[hidden], .revcard-run[hidden], .revcard-note[hidden] { display: none; }
.revcard-note { display: flex; align-items: flex-start; gap: var(--s3); }
.revcard-ic { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--r-full); border: 1px solid var(--line-strong); color: var(--ink); }
.revcard-ic.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: var(--danger-bg); }
.revcard-ic .icon { width: 16px; height: 16px; }
.revcard-t { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; line-height: 1.4; }
.revcard-t strong { font-size: var(--fs-md); font-weight: 650; }
.revcard-t small { color: var(--ink-3); font-size: var(--fs-sm); text-wrap: pretty; }
.revcard-acts { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.revcard-acts .btn { min-height: 36px; padding-inline: var(--s4); font-size: var(--fs-sm); }
.revcard-x { flex: none; width: 32px; height: 32px; }
@media (pointer: coarse) { .revcard-acts .btn { min-height: 44px; } .revcard-x { width: 44px; height: 44px; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 1180px) { :root { --side-w: 264px; } .workspace { grid-template-columns: minmax(0, 1fr) clamp(300px, 38%, 420px); } .chat-scroll { padding-inline: var(--s6); } }
@media (max-width: 1000px) {
  /* one pane at a time: chat or preview */
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .view-toggle { display: inline-flex; justify-self: center; margin: var(--s1) 0 var(--s3); padding: 3px; border-radius: var(--r-full); border: 1px solid var(--line-strong); }
  .view-toggle button { height: 34px; padding-inline: var(--s5); border-radius: var(--r-full); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-3); }
  .view-toggle button[aria-selected='true'] { background: var(--ink); color: var(--on-ink); }
  .workspace[data-pane='chat'] .preview, .workspace[data-pane='preview'] .chat { display: none; }
  .preview { border-inline-start: 0; grid-row: 2; }
  .chat { grid-row: 2; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }
  .main { border-radius: 0; border: 0; }
  .side { position: fixed; z-index: 50; inset-block: 0; inset-inline-start: 0; width: min(320px, 86vw); border-radius: 0 var(--r-lg) var(--r-lg) 0; translate: -105% 0; visibility: hidden; transition: translate var(--t-med) var(--ease), visibility 0s linear var(--t-med); box-shadow: var(--shadow-pop); }
  [dir='rtl'] .side { border-radius: var(--r-lg) 0 0 var(--r-lg); translate: 105% 0; }
  .side.open { translate: 0 0; visibility: visible; transition: translate var(--t-med) var(--ease), visibility 0s; }
  .menu-btn, .side-close { display: inline-grid; }
  .topbar { grid-template-columns: 44px minmax(0, 1fr) auto; padding-inline: var(--s3); }
  .title { grid-column: 2; text-align: start; padding-inline: var(--s2); }
  .top-actions { grid-column: 3; }
  .home { padding: var(--s4) var(--s4) var(--s8); }
  .home-inner { margin-block: auto; }
}
@media (max-width: 640px) {
  .home h1 { margin-bottom: var(--s6); }
  .mascot { width: 64px; }
  .composer textarea { padding: var(--s4) var(--s5) var(--s2); min-height: 96px; }
  .shelf { padding-inline: var(--s5); }
  .bar { padding: var(--s2) var(--s3) var(--s3); }
  .bar-end { flex-basis: 100%; margin-inline-start: 0; }
  .btn-generate { flex: 1; min-width: 0; white-space: normal; text-align: center; line-height: 1.25; padding-block: var(--s2); }
  .composer.compact .bar-end { flex-basis: auto; margin-inline-start: auto; }
  .chat-scroll { padding: var(--s2) var(--s4) var(--s4); }
  .chat-input { padding: var(--s2) var(--s3) var(--s3); padding-bottom: max(var(--s3), env(safe-area-inset-bottom, 0px)); }
  .preview { padding: var(--s2) var(--s4) var(--s4); }
  .controls { grid-template-columns: auto minmax(0, 1fr); }
  .controls > span:first-child { display: none; }
  .rec { flex-wrap: wrap; padding-inline: var(--s5); }
  .meter { min-width: 80px; }
  .rec-actions { flex-basis: 100%; }
  .rec-actions .btn { flex: 1; }
  .dlg-actions .btn { flex: 1; }
  .top-actions .btn { padding-inline: var(--s4); }
}
@media (max-width: 480px) { .pill .k { display: none; } .pill { padding-inline: var(--s4) var(--s3); } }
@media (max-width: 400px) { .ar-pill { gap: var(--s1); padding-inline: var(--s3); } .ar-pill .chev { display: none; } }   /* phones: just the glyph and the ratio, so the follow-up box keeps one row */
@media (max-height: 560px) { .frame-wrap { padding-block: 0 var(--s2); } }


/* ---- platform: sign-in, credits, uploads, live jobs ---- */
.sprite { position: absolute; }
.app[data-auth='out'] { grid-template-columns: minmax(0, 1fr); }
.app[data-auth='out'] .side, .app[data-auth='out'] .topbar, .app[data-auth='out'] .scrim { display: none; }
.msg-user .muted { color: var(--ink-3); font-style: italic; }
.notice.warn { color: var(--danger); border-color: var(--danger); }
.signin { position: absolute; inset: 0; overflow-y: auto; display: flex; padding: var(--s6); }
.signin-card { margin: auto; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: var(--s4); padding: var(--s8) var(--s6); border-radius: var(--r-xl); background: var(--panel-2); border: 1px solid var(--line); }
.signin-card .mascot { width: 72px; margin: 0 auto var(--s2); }
.signin h1 { margin: 0; font-size: var(--fs-h2); font-weight: 650; letter-spacing: -0.02em; text-align: center; text-wrap: balance; }
.signin-sub { margin: calc(var(--s2) * -1) 0 var(--s2); color: var(--ink-3); font-size: var(--fs-md); text-align: center; text-wrap: balance; }
.field { display: flex; flex-direction: column; gap: var(--s2); font-size: var(--fs-sm); color: var(--ink-2); }
.field input { font: inherit; font-size: 1.0625rem; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: var(--s3) var(--s4); min-height: 48px; transition: border-color var(--t-fast); }
.field input:focus { outline: none; border-color: var(--ink); }
.field input::placeholder { color: var(--ink-3); }
.signin-error { margin: 0; color: var(--danger); font-size: var(--fs-sm); }
.signin-foot { margin: var(--s2) 0 0; color: var(--ink-3); font-size: var(--fs-xs); text-align: center; }
.signin .btn-primary { min-height: 48px; justify-content: center; }
.who { display: flex; flex-direction: column; gap: 2px; }
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* credits: top-right of the main bar, one quiet chip */
.top-actions { align-items: center; }
.credits { display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s4) 0 var(--s3); border-radius: var(--r-full); border: 1px solid var(--line-strong); font-size: var(--fs-md); font-weight: 600; color: var(--ink); transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.credits .icon { width: 18px; height: 18px; color: var(--ink-3); }
.credits:hover, .credits[aria-expanded='true'] { border-color: var(--ink); background: var(--hover); }
.pop-credits { width: min(300px, calc(100vw - 32px)); inset-inline-start: auto; inset-inline-end: 0; padding: var(--s4); font-size: var(--fs-sm); color: var(--ink-2); }
.pop-credits strong { display: block; font-size: var(--fs-xl); color: var(--ink); margin-bottom: var(--s2); }
.pop-credits p { margin: 0; line-height: 1.5; }
.credit-prices { margin: var(--s3) 0 0; padding: var(--s3) 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s4); }
.credit-prices dt { color: var(--ink-3); } .credit-prices dd { margin: 0; font-weight: 600; color: var(--ink); text-align: end; }
.credit-prices .cp-h { grid-column: 1 / -1; margin: 0 0 var(--s1); font-size: var(--fs-xs); color: var(--ink-3); }
.pop-credits .btn { margin-top: var(--s4); width: 100%; min-height: 40px; font-size: var(--fs-sm); }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.big { width: 72px; height: 72px; font-size: 1.5rem; }

/* the reference video box: above the text, a quiet dashed rectangle until a video is chosen */
.ref { padding: var(--s4) var(--s5) 0; }
.ref-empty { display: flex; align-items: center; justify-content: center; gap: var(--s2); width: 100%; min-height: 56px; padding: var(--s3) var(--s4); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--ink-3); font-size: var(--fs-md); font-weight: 500; transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.ref-empty .icon { width: 20px; height: 20px; stroke-width: 2; }
.ref-empty:hover, .ref-empty:focus-visible, .ref.over .ref-empty { border-color: var(--ink); color: var(--ink); background: var(--hover); }
.ref.over .ref-empty { border-style: solid; }
.ref-card { display: flex; align-items: center; gap: var(--s3); min-height: 64px; padding: var(--s2) var(--s2) var(--s2) var(--s2); padding-inline: var(--s2); border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--panel); }
.ref.over .ref-card { border-color: var(--ink); }
.ref-card[hidden], .ref-empty[hidden] { display: none; }
.ref-thumb { flex: none; width: 36px; aspect-ratio: 9 / 16; border-radius: var(--r-sm); overflow: hidden; background: var(--panel-3); display: grid; place-items: center; color: var(--ink-3); }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-thumb .icon { width: 16px; height: 16px; }
.ref-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ref-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); font-weight: 600; text-align: start; unicode-bidi: plaintext; }
.ref-meta { font-size: var(--fs-xs); color: var(--ink-3); }
.ref-bar { display: block; height: 3px; margin-top: 3px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.ref-bar[hidden] { display: none; }
.ref-bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width var(--t-fast) linear; }
.ref[data-state='error'] .ref-meta { color: var(--danger); }
.ref-actions { flex: none; display: flex; align-items: center; gap: var(--s1); }
.ref-actions .btn { min-height: 40px; padding-inline: var(--s4); font-size: var(--fs-sm); }
.ref-error { margin: var(--s2) 0 0; color: var(--danger); font-size: var(--fs-sm); }
.ref-error[hidden] { display: none; }
.composer .ref + textarea { padding-top: var(--s4); }
.composer.over-ref .dropzone { display: none; }
@media (pointer: coarse), (max-width: 640px) { .ref-empty { min-height: 56px; } .ref-actions .btn { min-height: 44px; } }
@media (max-width: 400px) { .ref { padding-inline: var(--s3); } .ref-actions .btn { padding-inline: var(--s3); } }

/* the segmented control (the profile's language choice) */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; border-radius: var(--r-full); border: 1px solid var(--line-strong); background: var(--panel); }
.seg-opt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 52px; padding: var(--s2); border-radius: var(--r-full); font-size: var(--fs-sm); font-weight: 600; line-height: 1.2; text-align: center; text-wrap: balance; color: var(--ink-3); transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.seg-opt small { font-size: var(--fs-xs); font-weight: 500; opacity: 0.85; }
.seg-opt:hover { color: var(--ink); background: var(--hover); }
.seg-opt[aria-checked='true'] { background: var(--ink); color: var(--on-ink); }
.seg.flat .seg-opt { min-height: 44px; flex-direction: row; gap: var(--s2); }
.dlg-note { margin: var(--s2) 0 0; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.5; }

/* reference style report (collapsed in the result card) */
.refrep { margin-top: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); font-size: var(--fs-sm); }
.refrep summary { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); cursor: pointer; font-weight: 600; list-style: none; min-height: 44px; }
.refrep summary::-webkit-details-marker { display: none; }
.refrep summary .icon { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.refrep summary small { margin-inline-start: auto; color: var(--ink-3); font-weight: 500; text-align: end; }
.refrep ul { list-style: none; margin: 0; padding: 0 var(--s4) var(--s2); display: grid; }
.refrep li { display: grid; gap: 2px; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.refrep-h { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.refrep-d, .refrep-w { color: var(--ink-3); overflow-wrap: anywhere; }
.refrep-w { font-size: var(--fs-xs); }
.refrep-f { margin: 0; padding: 0 var(--s4) var(--s3); font-size: var(--fs-xs); color: var(--ink-3); }
.refrep li.s-not_supported .tag, .refrep li.s-not_reproduced .tag { color: var(--danger); border-color: var(--danger); }

/* profile settings */
.profile { position: absolute; inset: 0; overflow-y: auto; padding: var(--s6) var(--s6) var(--s12); }
.profile-inner { margin-inline: auto; width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: var(--s5); }
.profile h1 { margin: 0 0 var(--s1); font-size: var(--fs-h2); font-weight: 650; letter-spacing: -0.02em; }
.card { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s6); border-radius: var(--r-xl); background: var(--panel-2); border: 1px solid var(--line); }
.card h2 { margin: 0; font-size: var(--fs-lg); font-weight: 650; }
.card h3 { margin: var(--s2) 0 0; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.field select { font: inherit; font-size: 1.0625rem; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: var(--s3) var(--s4); min-height: 48px; }
.field select:focus, .field input[readonly]:focus { outline: none; border-color: var(--ink); }
.field input[readonly] { color: var(--ink-3); background: transparent; }
.prof-avatar-row { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.prof-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.prof-actions .btn { min-height: 44px; }
.prof-balance { margin: 0; display: flex; align-items: baseline; gap: var(--s3); color: var(--ink-3); font-size: var(--fs-sm); }
.prof-balance strong { font-size: 2rem; letter-spacing: -0.02em; color: var(--ink); }
.prof-note { margin: 0; color: var(--ink-3); font-size: var(--fs-sm); line-height: 1.55; text-wrap: pretty; }
.usage { margin: 0; padding: 0; list-style: none; max-height: 320px; overflow-y: auto; }
.usage li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.usage .u-t { color: var(--ink); overflow-wrap: anywhere; } .usage .u-d { grid-column: 1; color: var(--ink-3); font-size: var(--fs-xs); }
.usage .u-n { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 600; }
.usage .empty { display: block; color: var(--ink-3); border-top: 1px solid var(--line); }
@media (max-width: 640px) { .credits .unit { display: none; } .profile { padding: var(--s4) var(--s4) var(--s10); } .card { padding: var(--s5) var(--s4); } .credits { padding-inline: var(--s3); } }

.up { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line); font-size: var(--fs-sm); color: var(--ink-2); }
.up-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); color: var(--ink); }
.up-head strong { font-weight: 600; }
.up-pct, .up-sub { color: var(--ink-3); }
.up-sub, .up-note, .up-more { margin: 0; }
.up-note { color: var(--ink-2); }
.up-note.warn { color: var(--danger); }
.up > .up-total { height: 4px; }
.up.empty .up-head, .up.empty .up-total, .up.empty .up-sub, .up.empty .up-all, .up.empty .up-actions { display: none; }
.up-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: var(--s3) var(--s3); content-visibility: auto; contain-intrinsic-size: 0 auto 28px; }
.up-row .icon { width: 18px; height: 18px; color: var(--ink-3); }
.up-row .ic { display: grid; place-items: center; }
.up-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-row .pct { color: var(--ink-3); }
.up-row[data-state='done'] .icon { color: var(--ink); }
.up-row[data-state='failed'] .icon, .up-row[data-state='failed'] .up-msg { color: var(--danger); }
.up-row[data-state='done'] .up-bar, .up-row[data-state='queued'] .up-bar, .up-row[data-state='skipped'] .up-bar { display: none; }
.up-row[data-state='skipped'], .up-row[data-state='queued'] { opacity: 0.65; }
.up-msg { grid-column: 2 / -1; color: var(--ink-3); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.up-btns { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: var(--s2); }
.up-btns .btn, .up-fail-actions .btn, .up-actions .btn { min-height: 40px; padding-inline: var(--s4); font-size: var(--fs-sm); }
.up-failed { display: flex; flex-direction: column; gap: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.up-fail-list, .up-list, .up-active { display: flex; flex-direction: column; gap: var(--s3); }
.up-fail-list, .up-list { max-height: 240px; overflow-y: auto; overscroll-behavior: contain; }
.up-fail-actions, .up-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.up-all > summary { cursor: pointer; color: var(--ink-3); font-size: var(--fs-sm); min-height: 28px; display: flex; align-items: center; }
.up-all[open] > summary { margin-bottom: var(--s2); }
@media (pointer: coarse), (max-width: 640px) { .up-btns .btn, .up-fail-actions .btn, .up-actions .btn { min-height: 44px; } .up-all > summary { min-height: 44px; } }
.up-bar { grid-column: 2 / -1; height: 3px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.up-bar i { display: block; height: 100%; width: var(--p, 0%); background: var(--ink); transition: width var(--t-fast) linear; }
.act.live { color: var(--ink); }
.act.live .icon { animation: pulse 1.4s ease-in-out infinite; }
.act.todo { opacity: 0.45; }
.act .step { margin-inline-start: auto; color: var(--ink-3); font-size: var(--fs-sm); white-space: nowrap; padding-inline-start: var(--s3); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.job-actions { display: flex; gap: var(--s2); }
.answer .retry { margin-top: var(--s2); }
.answer .retry .muted { color: var(--ink-3); font-size: var(--fs-sm); }
.answer .retry .job-actions { margin-top: var(--s2); }
.job-actions .btn { min-height: 40px; font-size: var(--fs-sm); }
.tag { display: inline-block; border: 1px solid var(--line-strong); border-radius: var(--r-full); padding: 1px 10px; font-size: var(--fs-xs); color: var(--ink-3); }
.hint.strong { color: var(--ink); font-weight: 600; }
.clip.known { animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint .credit { color: var(--ink-2); }
@media (max-width: 640px) { .signin { padding: var(--s4); } .signin-card { padding: var(--s6) var(--s4); } }

/* touch: 44px targets on touch devices and phone widths (declared last so it wins over the component rules) */
@media (pointer: coarse), (max-width: 640px) {
  .icon-btn { width: 44px; height: 44px; }
  .pill { min-height: 44px; }
  .send { width: 44px; height: 44px; }
  .brand { min-height: 44px; }
  .top-actions .btn { min-height: 44px; }
  .view-toggle button { position: relative; }
  .view-toggle button::after { content: ''; position: absolute; inset: -5px -2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .ver.on { outline: 2px solid Highlight; outline-offset: -2px; }
  .btn-primary, .btn-light, .send, .view-toggle button[aria-selected='true'] { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}

/* ---- errors and recovery (batch 3) */
.answer.fx .fx-credit { color: var(--ink-2); }
.answer.fx .fx-kept { font-weight: 600; }
.fx-tech { margin-top: var(--s2); font-size: var(--fs-sm); color: var(--ink-3); }
.fx-tech summary { cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; }
.fx-tech code { display: block; margin-top: var(--s2); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2); color: var(--ink-2);
  font-size: var(--fs-xs); white-space: pre-wrap; overflow-wrap: anywhere; text-align: start; unicode-bidi: plaintext; }
@media (pointer: coarse) { .fx-tech summary { min-height: 44px; } }
.signin-note { margin: 0; padding: var(--s3) var(--s4); border: 1px solid var(--line-strong); border-radius: var(--r-md); color: var(--ink); font-size: var(--fs-sm); line-height: 1.5; }
.notfound { position: absolute; inset: 0; display: grid; place-items: center; padding: var(--s8) var(--s4); overflow-y: auto; }
.nf-card { display: flex; flex-direction: column; align-items: center; gap: var(--s4); max-width: 420px; text-align: center; }
.nf-card .icon { width: 40px; height: 40px; color: var(--ink-3); }
.nf-card h1 { margin: 0; font-size: var(--fs-xl, 1.5rem); outline: none; }
.nf-card p { margin: 0; color: var(--ink-2); line-height: 1.5; }
.pv-error { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3); padding: var(--s4); background: var(--panel);
  color: var(--ink); text-align: center; }
.pv-error[hidden] { display: none; }
.pv-error p { margin: 0; font-size: var(--fs-sm); }

