/* VidEdit concept: "edit bay" direction.
   Cool graphite neutrals, one marigold accent (the tally light), timecode as a first-class typographic element.
   Layout: phone = top bar + bottom tabs + sheets; >=720 icon rail; >=1280 full rail; review = 1 / 2 / 3 panes. */

:root {
  /* colour */
  --bg: #F4F5F8;
  --surface: #FFFFFF;
  --surface-2: #EEF0F4;
  --surface-3: #E4E7ED;
  --line: #DFE3EA;
  --line-strong: #C3C9D4;
  --fg: #12151C;
  --fg-2: #464E5E;
  --fg-3: #636B7B;
  --accent: #F5A524;
  --accent-hover: #E8961A;
  --on-accent: #1B1203;
  --accent-ink: #8A5600;
  --accent-soft: #FDF1DC;
  --rail-bg: #12151C;
  --rail-fg: #C9CED8;
  --rail-fg-strong: #FFFFFF;
  --rail-hover: #1E222C;
  --ok: #17804F;      --ok-soft: #E3F4EB;
  --info: #2C63D6;    --info-soft: #E5EDFC;
  --violet: #6B45D1;  --violet-soft: #EEE8FC;
  --danger: #C4302A;  --danger-soft: #FCE8E6;
  --scrim: rgba(12, 14, 19, .46);
  --shadow-1: 0 1px 2px rgba(18, 21, 28, .06), 0 1px 1px rgba(18, 21, 28, .04);
  --shadow-2: 0 6px 20px -6px rgba(18, 21, 28, .16), 0 2px 6px rgba(18, 21, 28, .06);
  --shadow-3: 0 24px 60px -12px rgba(18, 21, 28, .28), 0 6px 16px rgba(18, 21, 28, .08);
  --skeleton-a: #E9ECF1;
  --skeleton-b: #F6F7F9;

  /* type */
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --t-xs: .75rem;   /* 12 */
  --t-sm: .8125rem; /* 13 */
  --t-md: .9375rem; /* 15 */
  --t-lg: 1.0625rem;/* 17 */
  --t-xl: 1.375rem; /* 22 */
  --t-2xl: 1.75rem; /* 28 */
  --t-3xl: 2.25rem; /* 36 */
  --t-4xl: 3.25rem; /* 52 */

  /* space (4-based) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px;

  /* radius: by role, not uniform */
  --r-xs: 6px;   /* chips, tags */
  --r-sm: 10px;  /* buttons, inputs */
  --r-md: 14px;  /* cards, panels */
  --r-lg: 22px;  /* sheets, dialogs */
  --r-frame: 12px; /* video frames */
  --r-pill: 999px;

  /* motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --d-fast: 120ms; --d-med: 220ms; --d-slow: 360ms;

  --rail-w: 248px;
  --topbar-h: 64px;
  --tabbar-h: 64px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D0F14; --surface: #151821; --surface-2: #1B1F29; --surface-3: #242935;
    --line: #262B37; --line-strong: #363D4C;
    --fg: #ECEEF3; --fg-2: #B3B9C6; --fg-3: #8E96A6;
    --accent: #F7B23B; --accent-hover: #FFC157; --on-accent: #1B1203; --accent-ink: #F7B23B; --accent-soft: #2A2214;
    --rail-bg: #090B0F; --rail-fg: #AEB4C1; --rail-fg-strong: #FFFFFF; --rail-hover: #161A22;
    --ok: #46C383; --ok-soft: #12291E;
    --info: #6E9BFF; --info-soft: #141F38;
    --violet: #A68BFF; --violet-soft: #211A38;
    --danger: #FF7A70; --danger-soft: #331715;
    --scrim: rgba(0, 0, 0, .6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 8px 24px -6px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-3: 0 28px 70px -12px rgba(0, 0, 0, .7), 0 6px 16px rgba(0, 0, 0, .35);
    --skeleton-a: #1B1F29; --skeleton-b: #242935;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D0F14; --surface: #151821; --surface-2: #1B1F29; --surface-3: #242935;
  --line: #262B37; --line-strong: #363D4C;
  --fg: #ECEEF3; --fg-2: #B3B9C6; --fg-3: #8E96A6;
  --accent: #F7B23B; --accent-hover: #FFC157; --on-accent: #1B1203; --accent-ink: #F7B23B; --accent-soft: #2A2214;
  --rail-bg: #090B0F; --rail-fg: #AEB4C1; --rail-fg-strong: #FFFFFF; --rail-hover: #161A22;
  --ok: #46C383; --ok-soft: #12291E;
  --info: #6E9BFF; --info-soft: #141F38;
  --violet: #A68BFF; --violet-soft: #211A38;
  --danger: #FF7A70; --danger-soft: #331715;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 8px 24px -6px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-3: 0 28px 70px -12px rgba(0, 0, 0, .7), 0 6px 16px rgba(0, 0, 0, .35);
  --skeleton-a: #1B1F29; --skeleton-b: #242935;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--fg);
  font: 400 var(--t-md)/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; text-wrap: balance; font-optical-sizing: auto; }
p { margin: 0; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 28px; height: 28px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-2); }
.subtle { color: var(--fg-3); }
.eyebrow { font-size: var(--t-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: var(--r-sm); font-weight: 600; }
.skip:focus { top: 8px; }

:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 4px; }
[data-theme="dark"] :focus-visible { outline-color: var(--accent); }

::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none; position: relative;
  background: var(--fg);
  background: linear-gradient(135deg, #1D2230, #0B0D12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
/* play triangle with a diagonal "cut" through it */
.mark::before {
  content: ""; position: absolute; left: 10px; top: 8px; width: 13px; height: 14px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 50%, 0 100%, 0 64%, 42% 46%, 42% 38%, 0 52%);
}
.mark::after {
  content: ""; position: absolute; left: 10px; top: 8px; width: 13px; height: 14px;
  background: var(--accent);
  clip-path: polygon(0 0, 46% 23%, 46% 31%, 0 46%);
}
.wordmark { font-family: var(--font-display); font-weight: 750; font-size: 1.25rem; letter-spacing: -.035em; }

/* ---------- buttons ---------- */
.btn {
  --_bg: var(--surface); --_fg: var(--fg); --_bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-sm);
  background: var(--_bg); color: var(--_fg); border: 1px solid var(--_bd);
  font-weight: 600; font-size: var(--t-md); text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease), transform var(--d-fast) var(--ease), box-shadow var(--d-fast) var(--ease);
}
.btn:hover { --_bg: var(--surface-2); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-primary { --_bg: var(--accent); --_fg: var(--on-accent); --_bd: transparent; box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 1px 2px rgba(120, 70, 0, .25); }
.btn-primary:hover { --_bg: var(--accent-hover); }
.btn-dark { --_bg: var(--fg); --_fg: var(--bg); --_bd: transparent; }
.btn-dark:hover { --_bg: var(--fg-2); }
.btn-ghost { --_bg: transparent; --_bd: transparent; }
.btn-ghost:hover { --_bg: var(--surface-2); }
.btn-danger { --_fg: var(--danger); }
.btn-danger-solid { --_bg: var(--danger); --_fg: #fff; --_bd: transparent; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: var(--t-lg); border-radius: 12px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: var(--t-sm); }
.btn-block { width: 100%; }
.btn .kbd { font: 500 11px var(--font-mono); padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,.1); }

.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; flex: none;
  border-radius: var(--r-sm); border: 0; background: transparent; color: var(--fg-2);
  cursor: pointer; text-decoration: none; position: relative;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
.icon-btn.has-dot::after { content: ""; position: absolute; top: 11px; right: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.icon-btn.no-dot::after { display: none; }

.link { color: var(--accent-ink); font-weight: 600; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- form controls ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: var(--t-sm); font-weight: 600; color: var(--fg); }
.hint { font-size: var(--t-sm); color: var(--fg-3); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface);
  transition: border-color var(--d-fast) var(--ease), box-shadow var(--d-fast) var(--ease);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--fg-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--fg-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.input.is-error { border-color: var(--danger); }
.select { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--fg-2) 50%), linear-gradient(135deg, var(--fg-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input-wrap { position: relative; }
.input-wrap .input { padding-left: 42px; }
.input-wrap > .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.input-wrap .input-end { position: absolute; right: 1px; top: 50%; transform: translateY(-50%); }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: var(--t-md); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }

/* switch */
.switch { position: relative; display: inline-flex; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; inset: -8px; opacity: 0; cursor: pointer; z-index: 1; margin: 0; width: calc(100% + 16px); height: calc(100% + 16px); }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: background var(--d-med) var(--ease); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform var(--d-med) var(--ease); }
.switch input:checked + span { background: var(--accent); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; max-width: 100%; }
.seg button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--fg-2); font-weight: 600; font-size: var(--t-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1); }
.seg .count { font: 500 11px var(--font-mono); padding: 1px 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface);
  font-size: var(--t-sm); font-weight: 600; color: var(--fg-2); cursor: pointer; white-space: nowrap;
  transition: all var(--d-fast) var(--ease);
}
.chip:hover { color: var(--fg); border-color: var(--fg-3); }
.chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip .n { font: 500 12px var(--font-mono); opacity: .7; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border-radius: var(--r-xs); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.st-processing { background: var(--info-soft); color: var(--info); }
.st-processing::before, .st-rendering::before { animation: pulse 1.4s var(--ease-in-out) infinite; }
.st-input { background: var(--accent-soft); color: var(--accent-ink); }
.st-input::before { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.st-rendering { background: var(--violet-soft); color: var(--violet); }
.st-ready { background: var(--ok-soft); color: var(--ok); }
.st-failed { background: var(--danger-soft); color: var(--danger); }
.st-uploading { background: var(--surface-2); color: var(--fg-2); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: var(--r-xs); background: var(--surface-2); color: var(--fg-2); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; }

/* progress */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--accent); transition: width 200ms linear; }
.bar.is-info > i { background: var(--info); }
.bar.is-violet > i { background: var(--violet); }
.bar.is-paused > i { background: var(--fg-3); }
.bar.is-thin { height: 4px; }
.bar.is-live > i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: sheen 1.6s linear infinite; }
@keyframes sheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* skeleton */
.sk { background: linear-gradient(90deg, var(--skeleton-a) 0%, var(--skeleton-b) 50%, var(--skeleton-a) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 6px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* card + panel */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.card-pad { padding: var(--s5); }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* banner */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.banner > .i { margin-top: 1px; }
.banner-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.banner-title { font-weight: 650; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.banner.is-warn { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.banner.is-warn > .i { color: var(--accent-ink); }
.banner.is-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.banner.is-danger > .i { color: var(--danger); }
.banner.is-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.banner.is-info > .i { color: var(--info); }
.banner.is-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.banner.is-ok > .i { color: var(--ok); }

/* ---------- app shell ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.rail { display: none; }
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  min-height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter-r) 0 var(--gutter-l);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--d-med) var(--ease);
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar-title { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 700; font-size: var(--t-lg); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.topbar-back { margin-left: -10px; }
.avatar { width: 36px; height: 36px; margin: 4px; border-radius: 50%; display: inline-grid; place-items: center; background: linear-gradient(135deg, #3A4256, #1A1E28); color: #fff; font: 600 13px var(--font-body); text-decoration: none; letter-spacing: .02em; flex: none; }
.brand-phone .wordmark { font-size: 1.125rem; }
.app.is-flow .brand-phone { display: none; }
.app:not(.is-flow) .topbar-title:empty { display: none; }

#view { display: block; outline: none; padding: var(--s4) var(--gutter-r) calc(var(--tabbar-h) + var(--s7) + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.app.is-flow #view { padding-bottom: calc(var(--s8) + env(safe-area-inset-bottom, 0px)); }
.app.has-actionbar #view { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px var(--gutter-r) calc(6px + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 52px; text-decoration: none; color: var(--fg-3); font-size: 11px; font-weight: 600; border-radius: 10px; }
.tabbar a[aria-current="page"] { color: var(--fg); }
.tabbar a[aria-current="page"] .i { stroke-width: 2.2; }
.tab-new-btn { width: 44px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.tab-new-btn .i { stroke-width: 2.4; }
.tabbar .badge { position: absolute; top: 4px; left: calc(50% + 6px); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--on-accent); font: 600 11px/18px var(--font-mono); text-align: center; }
.app.is-flow .tabbar, .app.is-bare .tabbar { display: none; }
.app.is-bare .topbar { display: none; }
.app.is-bare #view { padding: 0; }

/* page scaffolding */
.page { max-width: 1240px; margin: 0 auto; display: grid; gap: var(--s6); animation: enter var(--d-slow) var(--ease) backwards; }
.page-narrow { max-width: 720px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s4); }
.page-head h1 { font-size: var(--t-2xl); }
.page-head .lede { color: var(--fg-2); margin-top: 6px; max-width: 60ch; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title { font-size: var(--t-lg); font-family: var(--font-display); font-weight: 700; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- video frame (mock footage) ---------- */
.frame {
  position: relative; overflow: hidden; container-type: inline-size; isolation: isolate;
  aspect-ratio: 9 / 16; max-width: 100%; border-radius: var(--r-frame);
  background: var(--scene, linear-gradient(170deg, #C98E5A 0%, #8A5633 55%, #3C2416 100%));
  color: #fff;
}
.frame::before { /* window light */
  content: ""; position: absolute; inset: -10% 35% 45% -30%; z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 244, 220, .55), transparent);
}
.frame::after { /* vignette + grain-ish */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 80% at 50% 40%, transparent 55%, rgba(0,0,0,.45) 100%);
}
.frame-person { position: absolute; inset: auto 0 0 0; width: 100%; height: 88%; z-index: 0; color: var(--person, rgba(32, 20, 14, .78)); transform-origin: 50% 100%; }
.frame.is-live .frame-person { animation: breathe 4.2s var(--ease-in-out) infinite; }
@keyframes breathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-.6%) scale(1.008); } }
.frame-cap { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.frame-badge { position: absolute; z-index: 3; right: 6%; bottom: 4%; padding: 2px 6px; border-radius: 5px; background: rgba(0,0,0,.6); color: #fff; font: 500 11px var(--font-mono); }

.scene-0 { --scene: linear-gradient(170deg, #D59B62 0%, #92593A 52%, #3A2214 100%); --person: rgba(36, 20, 12, .8); }
.scene-1 { --scene: linear-gradient(170deg, #8FB8B4 0%, #4E7C7C 52%, #1D3536 100%); --person: rgba(12, 28, 30, .8); }
.scene-2 { --scene: linear-gradient(170deg, #B5A6D8 0%, #6E5E9E 52%, #2A2242 100%); --person: rgba(22, 16, 40, .8); }
.scene-3 { --scene: linear-gradient(170deg, #A9BF85 0%, #637A48 52%, #26301A 100%); --person: rgba(20, 28, 12, .8); }
.scene-4 { --scene: linear-gradient(170deg, #E0B2A0 0%, #A0644F 52%, #3D2019 100%); --person: rgba(40, 16, 12, .8); }
.scene-5 { --scene: linear-gradient(170deg, #9AB0D0 0%, #52698E 52%, #1C2638 100%); --person: rgba(12, 18, 32, .82); }
.scene-6 { --scene: linear-gradient(170deg, #D4C089 0%, #8E7A42 52%, #362C14 100%); --person: rgba(32, 26, 10, .8); }
.scene-7 { --scene: linear-gradient(170deg, #C2C7CF 0%, #727986 52%, #24272E 100%); --person: rgba(18, 20, 26, .8); }
.frame.is-silent { --scene: linear-gradient(170deg, #5A5E68, #2A2D35); }

/* Caption styles. These draw the user's video, so they carry their own content colours via --c-* vars
   (set per style/customization), not the UI theme tokens. */
.frame { --c-text: #FFFFFF; --c-accent: #FFD25C; --c-card: #FFF7E8; --c-scale: 1; --zone-y: 79%; --zone-off: 0%; }
.frame-person { transition: transform 260ms var(--ease); }
.frame.is-punch .frame-person { transform: scale(1.07); }
.frame.int-bold.is-punch .frame-person { transform: scale(1.12); }
.frame.int-calm.is-punch .frame-person { transform: scale(1.03); }
.frame-flash { position: absolute; inset: 0; z-index: 3; background: #fff; opacity: 0; pointer-events: none; }
.frame.is-flash .frame-flash { animation: flash 300ms ease-out; }
@keyframes flash { 0% { opacity: .75; } 100% { opacity: 0; } }
.cap-zone { position: absolute; left: 7%; right: 7%; top: calc(var(--zone-y) + var(--zone-off)); transform: translateY(-50%); text-align: center; transition: top 280ms var(--ease); }
.cw { color: var(--c-text); }
.cw.r-accent { color: var(--c-accent); }
.fx-glow .frame-cap { filter: drop-shadow(0 0 1.6cqw color-mix(in srgb, var(--c-accent) 70%, transparent)); }
.fx-blur .cap-zone > *, .fx-blur .gw span { animation: blur-in 260ms var(--ease) both; }
@keyframes blur-in { from { filter: blur(1.2cqw); transform: translateX(-4cqw); } }
.fx-doodles .k, .fx-doodles .hc-card b, .fx-doodles .cs span.on { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 8'%3E%3Cpath d='M1 5c6-4 10 3 16-1s10 3 16-1 10 3 16-1 8 2 10 0' fill='none' stroke='%23FF5A4F' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 50% 100%; background-size: 90% 1.8cqw; padding-bottom: 2.2cqw; }

/* Hybrid Cards */
.c-hybrid .hc-sub { font: 700 calc(6.2cqw * var(--c-scale))/1.28 var(--font-body); text-shadow: 0 .5cqw 2cqw rgba(0,0,0,.7); }
.c-hybrid .hc-sub .cw.is-on { text-decoration: underline; text-decoration-thickness: .6cqw; text-underline-offset: 1.2cqw; text-decoration-color: var(--c-accent); }
.c-hybrid .hc-card { position: absolute; left: 12%; right: 12%; top: 14%; padding: 4cqw 5cqw; border-radius: 3cqw; background: var(--c-card); color: #1A1206; box-shadow: 0 3cqw 8cqw rgba(0,0,0,.35); transform: rotate(-2deg); animation: card-in 380ms var(--ease) both; }
.c-hybrid.pl-top .hc-card { top: 46%; }
.c-hybrid .hc-card small { display: block; font: 700 3.2cqw/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: #9A5B00; margin-bottom: 1.5cqw; }
.c-hybrid .hc-card b { display: block; font: 800 calc(9.5cqw * var(--c-scale))/1 var(--font-display); letter-spacing: -.03em; }
@keyframes card-in { from { opacity: 0; transform: rotate(-6deg) translateY(4cqw) scale(.92); } }

/* Giant Word */
.c-giant .gw { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 4%; text-align: center; font: 800 calc(21cqw * var(--c-scale) * var(--fit, 1))/.9 var(--font-display); letter-spacing: -.05em; text-transform: uppercase; color: var(--c-text); text-shadow: 0 1.5cqw 6cqw rgba(0,0,0,.45); overflow-wrap: anywhere; }
.c-giant .gw span { display: inline-block; animation: punch 360ms var(--ease) both; }
.c-giant .gw .r-normal { font-size: .58em; letter-spacing: -.03em; }
.c-giant .gw .r-accent { color: var(--c-accent); }
.c-giant.int-bold .gw span { animation-duration: 260ms; }
.c-giant.int-calm .gw span { animation-name: fade-in; animation-duration: 420ms; }
@keyframes punch { from { transform: scale(1.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }

/* Showreel */
.c-showreel .sr-bar { position: absolute; left: 0; right: 0; height: 12%; background: #050505; }
.c-showreel .sr-bar.t { top: 0; } .c-showreel .sr-bar.b { bottom: 0; }
.c-showreel .sr-title { position: absolute; left: 6%; right: 6%; bottom: 19%; color: var(--c-accent); font: italic 500 calc(11cqw * var(--c-scale))/1 var(--font-display); letter-spacing: -.03em; text-shadow: 0 1cqw 5cqw rgba(0,0,0,.5); animation: rise 600ms var(--ease) both; }
.c-showreel .sr-sub { position: absolute; left: 6%; right: 6%; bottom: 3%; height: 7%; display: flex; align-items: center; color: var(--c-text); opacity: .85; font: 500 calc(3.1cqw * var(--c-scale))/1.3 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
.c-showreel:not(.fx-letterbox) .sr-sub { bottom: 6%; text-shadow: 0 .5cqw 2cqw rgba(0,0,0,.8); }
@keyframes rise { from { opacity: 0; transform: translateY(3cqw); } }

/* Card Stack */
.c-cardstack .cs { display: grid; gap: 2.2cqw; text-align: left; }
.c-cardstack .cs span { display: block; padding: 3.2cqw 4cqw; border-radius: 2.6cqw; background: var(--c-card); color: var(--c-text); font: 700 calc(6cqw * var(--c-scale))/1.12 var(--font-body); box-shadow: 0 2cqw 5cqw rgba(0,0,0,.25); }
.c-cardstack .cs span:nth-child(1):not(.on) { opacity: .6; transform: scale(.94); }
.c-cardstack .cs span:nth-child(2):not(.on) { opacity: .82; transform: scale(.97); }
.c-cardstack .cs span.on { box-shadow: inset 1.2cqw 0 0 var(--c-accent), 0 2cqw 5cqw rgba(0,0,0,.3); animation: slidein 420ms var(--ease) both; }
.c-cardstack .cs-n { font: 700 3.4cqw var(--font-mono); font-style: normal; opacity: .55; margin-right: 2cqw; }
@keyframes slidein { from { transform: translateY(8cqw); opacity: 0; } }

/* Hero Words */
.c-hero .hw { font: 700 calc(6cqw * var(--c-scale))/1.34 var(--font-body); text-shadow: 0 .5cqw 2.4cqw rgba(0,0,0,.7); }
.c-hero .hw .k { display: inline-block; font: 800 calc(10.5cqw * var(--c-scale))/1 var(--font-display); letter-spacing: -.03em; color: #111; background-color: var(--c-card); padding: .6cqw 2cqw 1.2cqw; border-radius: 1.6cqw; margin: 1cqw .4cqw; text-shadow: none; transform: rotate(-1.5deg); animation: pop 320ms var(--ease) both; }
.c-hero.int-bold .hw .k { transform: rotate(-3deg) scale(1.05); }
.c-hero.int-calm .hw .k { transform: none; animation: none; }
@keyframes pop { from { transform: scale(.6) rotate(-6deg); opacity: 0; } }

/* Kinetic Stack */
.c-kinetic .ks { display: grid; gap: .6cqw; text-transform: uppercase; }
.c-kinetic .ks div { color: var(--c-text); font: 800 calc(10cqw * var(--c-scale))/.95 var(--font-display); letter-spacing: -.04em; display: flex; justify-content: space-between; gap: 2cqw; text-shadow: 0 1cqw 4cqw rgba(0,0,0,.45); }
.c-kinetic .ks div:nth-child(even):not(.is-big) { font-weight: 500; }
.c-kinetic .ks div.is-big { justify-content: center; font-size: calc(15cqw * var(--c-scale)); }
.c-kinetic .ks .r-accent { color: var(--c-accent); }
.c-kinetic .ks span:last-child { animation: fade-in 200ms ease both; }

/* Orbit Type */
.c-orbit .ot { position: absolute; left: 50%; top: 42%; width: 104%; aspect-ratio: 1; transform: translate(-50%, -50%) rotateX(62deg); }
.c-orbit .ot svg { width: 100%; height: 100%; overflow: visible; animation: orbit 12s linear infinite; }
.c-orbit.int-bold .ot svg { animation-duration: 7s; }
.c-orbit.int-calm .ot svg { animation-duration: 20s; }
.c-orbit .ot text { font: 800 calc(7px * var(--c-scale)) var(--font-display); letter-spacing: .06em; fill: var(--c-text); }
.c-orbit .ot tspan.r-accent { fill: var(--c-accent); }
.c-orbit .ot-key { top: 14%; font: 800 calc(10cqw * var(--c-scale))/1 var(--font-display); letter-spacing: -.03em; color: var(--c-accent); text-shadow: 0 1cqw 4cqw rgba(0,0,0,.45); }
@keyframes orbit { to { transform: rotate(360deg); } }

/* ---------- sheets / dialogs ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 80; background: var(--scrim); animation: fade var(--d-med) var(--ease) both; }
.sheet {
  position: fixed; z-index: 81; left: 0; right: 0; bottom: 0;
  max-height: min(88vh, 88dvh); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-3);
  animation: sheet-up var(--d-slow) var(--ease) both;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet-grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px var(--gutter-r) 8px var(--gutter-l); flex: none; }
.sheet-head h2 { flex: 1; font-size: var(--t-xl); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px var(--gutter-r) var(--s5) var(--gutter-l); flex: 1; min-height: 0; }
.sheet-foot { display: flex; gap: 8px; padding: 12px var(--gutter-r) 12px var(--gutter-l); border-top: 1px solid var(--line); flex: none; }
.sheet-foot .btn { flex: 1; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }
@media (min-width: 720px) {
  .sheet { left: 50%; top: 50%; bottom: auto; right: auto; width: min(600px, calc(100vw - 48px)); max-height: min(84vh, 760px); transform: translate(-50%, -50%); border-radius: var(--r-lg); animation: pop var(--d-med) var(--ease) both; padding-bottom: 0; }
  .sheet.is-wide { width: min(880px, calc(100vw - 48px)); }
  .sheet-grab { display: none; }
  .sheet-head { padding: 20px 24px 8px; }
  .sheet-body { padding: 4px 24px 24px; }
  .sheet-foot { padding: 14px 24px; justify-content: flex-end; }
  .sheet-foot .btn { flex: none; }
}

/* popover menu */
.menu { position: absolute; z-index: 60; min-width: 230px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); animation: menu-in var(--d-fast) var(--ease) both; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 500; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu button.is-danger { color: var(--danger); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 6px; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* toasts */
.toasts { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--fg); color: var(--bg); box-shadow: var(--shadow-3); font-weight: 500; animation: toast-in var(--d-slow) var(--ease) both; }
.toast .i { color: var(--accent); }
.toast a, .toast button { margin-left: auto; color: var(--accent); font-weight: 650; background: none; border: 0; cursor: pointer; text-decoration: none; min-height: 32px; padding: 0 4px; white-space: nowrap; }
.toast.is-out { animation: toast-out var(--d-med) var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- SIGN IN ---------- */
.signin { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.signin-art { display: none; }
.signin-form-wrap { display: grid; align-content: center; justify-items: center; padding: calc(var(--s8) + env(safe-area-inset-top, 0px)) var(--gutter-r) calc(var(--s8) + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.signin-form { width: 100%; max-width: 400px; display: grid; gap: var(--s5); }
.signin-form h1 { font-size: var(--t-3xl); letter-spacing: -.035em; }
.signin-form .lede { color: var(--fg-2); margin-top: -8px; }
.signin-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: var(--t-sm); color: var(--fg-3); }
.signin-secure { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--fg-3); padding-top: var(--s4); border-top: 1px solid var(--line); }
.signin-phone-hero { display: flex; gap: 10px; align-items: flex-end; height: 132px; margin-bottom: 4px; }
.signin-phone-hero .frame { height: 132px; width: auto; flex: none; box-shadow: var(--shadow-2); }
.signin-phone-hero .frame:nth-child(2) { height: 112px; opacity: .9; }
.signin-phone-hero .frame:nth-child(3) { height: 92px; opacity: .75; }
.pw-toggle { width: 44px; height: 44px; }

@media (min-width: 1000px) {
  .signin { grid-template-columns: minmax(0, 1.1fr) minmax(440px, .9fr); }
  .signin-phone-hero { display: none; }
  .signin-art {
    display: grid; position: relative; overflow: hidden; align-content: space-between; gap: var(--s7);
    padding: var(--s8) var(--s9);
    background: var(--rail-bg); color: #fff;
  }
  .signin-art .wordmark { color: #fff; }
  .signin-art h2 { font-size: clamp(2.2rem, 3.4vw, 3.4rem); max-width: 14ch; line-height: 1.02; letter-spacing: -.045em; color: #fff; font-weight: 750; }
  .signin-art h2 em { font-style: normal; color: var(--accent); }
  .signin-art p { color: #AEB4C1; max-width: 44ch; margin-top: var(--s4); }
  .signin-reel { display: flex; gap: 18px; align-items: flex-end; }
  .signin-reel .frame { width: 168px; flex: none; box-shadow: 0 30px 60px -20px rgba(0,0,0,.8); }
  .signin-reel .frame:nth-child(2) { width: 140px; }
  .signin-reel .frame:nth-child(3) { width: 116px; }
  .signin-strip { display: flex; gap: 22px; color: #8E96A6; font: 500 12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; flex-wrap: wrap; }
  .signin-strip span { display: inline-flex; gap: 8px; align-items: center; }
  .signin-strip i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
}

/* ---------- PROJECTS ---------- */
.toolbar { display: grid; gap: var(--s3); }
.proj-grid { display: grid; gap: var(--s2); grid-template-columns: 1fr; list-style: none; margin: 0; padding: 0; }
.proj {
  position: relative; display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 14px; align-items: center;
  padding: 10px; padding-right: 48px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; transition: border-color var(--d-fast) var(--ease), box-shadow var(--d-med) var(--ease), transform var(--d-med) var(--ease);
}
.proj:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.proj-thumb { position: relative; border-radius: 9px; overflow: hidden; aspect-ratio: 4 / 5; }
.proj-thumb .frame { position: absolute; inset: 0; width: 100%; height: auto; aspect-ratio: auto; border-radius: 0; height: 100%; }
.proj-thumb .frame-badge { font-size: 10px; right: 4px; bottom: 4px; padding: 1px 4px; }
.proj-body { min-width: 0; display: grid; gap: 4px; }
.proj-title { font-weight: 650; font-size: var(--t-md); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proj-meta { font-size: var(--t-sm); color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.proj-foot .bar { flex: 1; min-width: 60px; max-width: 140px; height: 4px; }
.proj-time { font-size: var(--t-xs); color: var(--fg-3); }
.proj-menu { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }
.proj.is-input { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.proj-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.proj-menu { z-index: 2; }
.proj-reason { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--danger); }
.proj.is-skel { pointer-events: none; }
.proj.is-skel .proj-body { gap: 8px; }

@media (min-width: 720px) {
  .proj-grid { grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: var(--s4); }
  .proj { grid-template-columns: 1fr; align-items: stretch; padding: 8px 8px 14px; gap: 12px; }
  .proj:hover { transform: translateY(-2px); }
  .proj-thumb { aspect-ratio: 4 / 4.4; border-radius: 10px; }
  .proj-body { padding: 0 6px; }
  .proj-menu { top: 14px; right: 14px; transform: none; background: rgba(10, 12, 16, .55); color: #fff; backdrop-filter: blur(6px); width: 40px; height: 40px; }
  .proj-menu:hover { background: rgba(10, 12, 16, .8); color: #fff; }
  .proj { padding-right: 8px; }
}
.empty { display: grid; justify-items: center; text-align: center; gap: var(--s3); padding: var(--s9) var(--s5); border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); }
.empty h2 { font-size: var(--t-xl); }
.empty p { color: var(--fg-2); max-width: 44ch; }
.empty-art { display: flex; gap: 8px; align-items: flex-end; margin-bottom: var(--s2); }
.empty-art span { width: 38px; aspect-ratio: 9/16; border-radius: 6px; border: 1.5px dashed var(--line-strong); }
.empty-art span:nth-child(2) { width: 52px; border-style: solid; border-color: var(--accent); background: var(--accent-soft); display: grid; place-items: center; color: var(--accent-ink); }

.attn { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.attn-body { flex: 1; min-width: 0; }
.attn-body b { display: block; }
.attn-body span { font-size: var(--t-sm); color: var(--fg-2); }

/* ---------- NEW / UPLOAD ---------- */
.new-grid { display: grid; gap: var(--s6); }
.drop {
  position: relative; display: grid; justify-items: center; text-align: center; gap: var(--s3);
  padding: var(--s7) var(--s5); border-radius: var(--r-md); border: 1.5px dashed var(--line-strong);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box;
  transition: border-color var(--d-med) var(--ease), background var(--d-med) var(--ease);
}
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.drop h2 { font-size: var(--t-xl); }
.drop p { color: var(--fg-2); max-width: 40ch; }
.drop .formats { font: 500 12px var(--font-mono); color: var(--fg-3); letter-spacing: .02em; }
.drop-desktop { display: none; }
.drop-actions { display: grid; gap: 8px; width: 100%; max-width: 360px; margin-top: var(--s2); }
.reuse-list { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.reuse { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 8px 8px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.reuse .frame { width: 48px; border-radius: 7px; }
.reuse-body { min-width: 0; }
.reuse-body b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reuse-body span { font-size: var(--t-sm); color: var(--fg-3); }
.tips { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.tips li { display: flex; gap: 10px; align-items: flex-start; color: var(--fg-2); font-size: var(--t-sm); }
.tips .i { color: var(--ok); margin-top: 1px; }

.up { display: grid; gap: var(--s5); }
.up-file { display: flex; gap: 14px; align-items: center; }
.up-file-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--fg-2); flex: none; }
.up-file-body { min-width: 0; flex: 1; }
.up-file-body b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-pct { font: 700 var(--t-4xl)/1 var(--font-display); letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.up-pct small { font-size: .45em; letter-spacing: 0; color: var(--fg-3); margin-left: 2px; }
.up-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--t-sm); color: var(--fg-2); }
.up-stats b { color: var(--fg); font-weight: 600; }
.chunks { display: grid; grid-template-columns: repeat(auto-fill, minmax(14px, 1fr)); gap: 4px; }
.chunks i { height: 14px; border-radius: 3px; background: var(--surface-3); transition: background var(--d-med) var(--ease); }
.chunks i.is-done { background: var(--accent); }
.chunks i.is-active { background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--surface-3) 0); }
.chunks i.is-retry { background: var(--danger); }
.calm { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); color: var(--fg-2); font-size: var(--t-sm); }
.calm .i { color: var(--fg); }
.calm b { color: var(--fg); display: block; font-size: var(--t-md); margin-bottom: 2px; }

@media (min-width: 720px) {
  .drop-desktop { display: inline; }
  .drop-phone { display: none; }
  .drop { padding: var(--s9) var(--s7); min-height: 360px; align-content: center; }
  .drop-actions { grid-template-columns: 1fr 1fr; max-width: 420px; }
}
@media (min-width: 1100px) {
  .new-grid { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); align-items: start; }
}

/* ---------- PROCESSING ---------- */
.proc-grid { display: grid; gap: var(--s6); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; }
.step { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; position: relative; padding-bottom: var(--s6); }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 17px; top: 38px; bottom: 2px; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step.is-done::before { background: var(--accent); }
.step-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1.5px solid var(--line-strong); color: var(--fg-3); font: 600 14px var(--font-mono); position: relative; z-index: 1; }
.step.is-done .step-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step.is-active .step-dot { border-color: var(--accent); color: var(--accent-ink); background: var(--surface); }
.step.is-active .step-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; border-bottom-color: transparent; animation: spin 1s linear infinite; }
.step.is-failed .step-dot { background: var(--danger); border-color: var(--danger); color: #fff; }
.step-body { min-width: 0; padding-top: 6px; display: grid; gap: 4px; }
.step-title { font-weight: 650; font-size: var(--t-lg); }
.step:not(.is-done):not(.is-active):not(.is-failed) .step-title { color: var(--fg-3); }
.step-desc { color: var(--fg-2); font-size: var(--t-sm); }
.step-time { padding-top: 8px; font: 500 13px var(--font-mono); color: var(--fg-3); white-space: nowrap; }
.step-live { margin-top: 8px; display: grid; gap: 8px; }
.step-log { font: 500 12px/1.5 var(--font-mono); color: var(--fg-3); }
.proc-hero { display: grid; gap: var(--s4); }
.eta { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.eta-num { font: 700 var(--t-3xl)/1 var(--font-display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.vid-info { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; align-items: start; }
.vid-info .frame { width: 96px; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: var(--t-sm); }
.kv dt { color: var(--fg-3); }
.kv dd { margin: 0; font-family: var(--font-mono); font-size: 12.5px; color: var(--fg); overflow-wrap: anywhere; }
.notify-row { display: flex; align-items: center; gap: 14px; justify-content: space-between; min-height: 52px; }
.notify-row + .notify-row { border-top: 1px solid var(--line); }
.notify-row b { display: block; font-weight: 600; }
.notify-row span { font-size: var(--t-sm); color: var(--fg-3); }
@media (min-width: 1000px) {
  .proc-grid { grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); align-items: start; }
}

/* ---------- LANGUAGE ---------- */
.lang-card { display: grid; gap: var(--s5); padding: var(--s6); }
.lang-detect { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.lang-glyph { width: 64px; height: 64px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font: 700 24px var(--font-display); }
.lang-name { font: 750 var(--t-3xl)/1.05 var(--font-display); letter-spacing: -.035em; }
.conf { display: grid; gap: 8px; }
.conf-row { display: flex; justify-content: space-between; font-size: var(--t-sm); color: var(--fg-2); }
.conf-row b { color: var(--ok); }
.quote { padding: 14px 16px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--fg); font-size: var(--t-md); }
.quote small { display: block; margin-top: 6px; font: 500 12px var(--font-mono); color: var(--fg-3); }
.lang-actions { display: grid; gap: 8px; }
.lang-list { list-style: none; margin: 0; padding: 0; display: grid; }
.lang-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; border-radius: 10px; cursor: pointer; }
.lang-item:hover { background: var(--surface-2); }
.lang-item input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex: none; }
.lang-item .native { margin-left: auto; color: var(--fg-3); font-size: var(--t-sm); }
.lang-item .likely { font: 500 12px var(--font-mono); color: var(--fg-3); }
.lang-group { font-size: var(--t-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); padding: 16px 12px 6px; }
.lang-search { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 4px 0 8px; }
@media (min-width: 720px) {
  .lang-actions { grid-template-columns: 1fr 1fr; }
}

/* ---------- REVIEW ---------- */
.rv { display: grid; gap: var(--s4); max-width: 1600px; margin: 0 auto; animation: enter var(--d-slow) var(--ease) backwards; }
.rv-toolbar { display: none; }
.rv-player { display: none; }
.rv-mini {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); z-index: 20;
  display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: center;
  margin: calc(-1 * var(--s4)) calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l));
  padding: 10px var(--gutter-r) 12px var(--gutter-l);
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.rv-mini .frame { width: 84px; cursor: pointer; }
.rv-mini-body { min-width: 0; display: grid; gap: 6px; }
.rv-mini-line { font-size: var(--t-sm); line-height: 1.4; color: var(--fg); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.rv-mini-ctl { display: flex; align-items: center; gap: 8px; }
.rv-mini-ctl .mono { font-size: 12px; color: var(--fg-3); white-space: nowrap; }
.play-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--fg); color: var(--bg); cursor: pointer; flex: none; transition: transform var(--d-fast) var(--ease); }
.play-btn:active { transform: scale(.94); }
.scrub { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; cursor: pointer; margin: 0; min-width: 0; }
.scrub::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--surface-3) var(--p, 0%)); }
.scrub::-moz-range-track { height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--surface-3) var(--p, 0%)); }
.scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); margin-top: -6px; box-shadow: var(--shadow-1); }
.scrub::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }

.rv-transcript { min-width: 0; display: grid; gap: var(--s4); align-content: start; }
.rv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rv-head h2 { font-size: var(--t-xl); }
.rv-head .meta { font-size: var(--t-sm); color: var(--fg-3); }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.line { display: grid; grid-template-columns: 52px minmax(0, 1fr) 44px; gap: 6px; align-items: start; padding: 8px 0 8px 4px; border-radius: 12px; transition: background var(--d-med) var(--ease); }
.line.is-current { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.line-tc { font: 500 12px/24px var(--font-mono); color: var(--fg-3); padding-top: 6px; background: none; border: 0; cursor: pointer; text-align: left; min-height: 36px; padding-left: 4px; border-radius: 6px; }
.line-tc:hover { color: var(--accent-ink); }
.line-text { min-width: 0; font-size: 1.0625rem; line-height: 1.65; padding: 5px 0; overflow-wrap: anywhere; }
.w { border-radius: 4px; padding: 1px 1px; cursor: pointer; transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease); }
.w:hover { background: var(--surface-3); }
.w.is-now { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 2px var(--accent); }
.w.is-key { font-weight: 650; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 80%, transparent); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.w.is-ref { background: color-mix(in srgb, var(--accent) 20%, transparent); box-shadow: inset 0 -2px 0 var(--accent); }
.line-text[contenteditable="true"] { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; background: var(--surface); padding: 5px 8px; cursor: text; }
.line-edit { opacity: 0; transition: opacity var(--d-fast) var(--ease); }
.line:hover .line-edit, .line:focus-within .line-edit, .line.is-current .line-edit { opacity: 1; }
@media (hover: none) { .line-edit { opacity: .7; } }
.line.is-edited .line-tc::after { content: "edited"; display: block; font-size: 10px; line-height: 1; color: var(--accent-ink); letter-spacing: .04em; }

.gap { grid-column: 2 / 4; margin: 6px 6px 6px 0; padding: 12px 14px; border-radius: 12px; border: 1.5px dashed color-mix(in srgb, var(--accent) 70%, transparent); background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); display: grid; gap: 10px; }
.gap-head { display: flex; gap: 10px; align-items: flex-start; }
.gap-head .i { color: var(--accent-ink); margin-top: 2px; }
.gap-head b { display: block; font-weight: 650; }
.gap-head p { font-size: var(--t-sm); color: var(--fg-2); }
.gap-form { display: flex; gap: 8px; flex-wrap: wrap; }
.gap-form .input { flex: 1 1 180px; min-width: 0; background: var(--surface); }
.gap.is-filled { border-style: solid; border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok-soft) 70%, var(--surface)); }
.gap.is-filled .gap-head .i { color: var(--ok); }
.gap.is-skipped { opacity: .7; border-color: var(--line-strong); background: var(--surface); }
.gap.is-skipped .gap-head .i { color: var(--fg-3); }
.gap-done { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--t-sm); }
.gap-done .mono { font-size: 13px; padding: 4px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }

.rv-panel { display: none; }
.style-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.style-card { position: relative; display: grid; gap: 8px; padding: 6px 6px 10px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; transition: border-color var(--d-fast) var(--ease), transform var(--d-med) var(--ease), box-shadow var(--d-med) var(--ease); }
.style-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.style-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.style-card .frame { width: 100%; aspect-ratio: 4 / 5; border-radius: 10px; }
.style-card-name { font-weight: 650; font-size: var(--t-sm); padding: 0 4px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.style-card-line { font-size: var(--t-xs); color: var(--fg-3); padding: 0 4px; line-height: 1.35; }
.style-check { position: absolute; top: 12px; right: 12px; z-index: 5; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: none; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.style-check .i { width: 16px; height: 16px; stroke-width: 2.6; }
.style-card[aria-checked="true"] .style-check { display: grid; }
.style-detail { display: grid; gap: var(--s3); padding: var(--s4); border-radius: var(--r-md); background: var(--surface-2); }
.style-detail h3 { font-size: var(--t-xl); }
.style-detail p { color: var(--fg-2); font-size: var(--t-sm); }
.style-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.style-facts div { padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.style-facts dt { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.style-facts dd { margin: 4px 0 0; font-size: var(--t-sm); font-weight: 600; }
.sound-row { display: flex; gap: 6px; flex-wrap: wrap; }

.assets { display: grid; gap: var(--s3); }
.asset-drop { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; border: 1.5px dashed var(--line-strong); background: var(--surface); cursor: pointer; min-height: 64px; transition: border-color var(--d-fast) var(--ease); }
.asset-drop:hover { border-color: var(--accent); }
.asset-drop .i { color: var(--accent-ink); }
.asset-drop b { display: block; }
.asset-drop span { font-size: var(--t-sm); color: var(--fg-3); }
.asset { display: grid; grid-template-columns: 56px minmax(0, 1fr) 44px; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.asset-thumb { width: 56px; height: 56px; border-radius: 10px; display: grid; place-items: center; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 12px 12px; border: 1px solid var(--line); overflow: hidden; }
.asset-body { min-width: 0; display: grid; gap: 4px; }
.asset-body .input { min-height: 38px; padding: 6px 10px; font-size: var(--t-sm); }
.asset-body small { font: 500 11px var(--font-mono); color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.actionbar {
  position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
  display: flex; gap: 8px; align-items: center;
  padding: 10px var(--gutter-r) calc(10px + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px -12px rgba(0,0,0,.18);
}
.actionbar .style-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 10px 4px 4px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; text-align: left; }
.actionbar .style-pick .frame { width: 30px; border-radius: 5px; flex: none; }
.style-pick-txt { min-width: 0; display: grid; line-height: 1.2; }
.style-pick-txt small { font-size: 11px; color: var(--fg-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.style-pick-txt b { font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actionbar .btn-primary { min-height: 52px; padding: 0 20px; }
.actionbar .assets-btn { width: 52px; height: 52px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); position: relative; }
.actionbar .assets-btn .badge { position: absolute; top: -6px; right: -6px; }

/* review: tablet = player + transcript; desktop = 3 panes */
@media (min-width: 720px) {
  .rv-mini { display: none; }
  .rv { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: var(--s6); align-items: start; }
  .rv-player { display: grid; gap: var(--s3); position: sticky; top: calc(var(--topbar-h) + 16px); }
  .rv-player .frame { width: 100%; max-height: calc(100vh - 260px); width: auto; margin: 0 auto; box-shadow: var(--shadow-2); }
  .rv-controls { display: flex; align-items: center; gap: 10px; }
  .rv-controls .mono { font-size: 12px; color: var(--fg-2); white-space: nowrap; }
  .rv-note { font-size: var(--t-xs); color: var(--fg-3); text-align: center; }
}
@media (min-width: 1180px) {
  .app.is-review .actionbar { display: none; }
  .app.is-review #view { padding-bottom: var(--s6); }
  .rv { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(340px, 380px); gap: var(--s5); }
  .rv-panel { display: grid; position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 32px); grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); overflow: hidden; }
  .rv-panel-tabs { padding: 12px 12px 0; }
  .rv-panel-tabs .seg { width: 100%; }
  .rv-panel-tabs .seg button { flex: 1; justify-content: center; }
  .rv-panel-body { overflow-y: auto; padding: 14px; display: grid; gap: var(--s4); align-content: start; }
  .rv-panel-foot { padding: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; background: var(--surface); }
  .rv-panel-foot .btn { width: 100%; }
  .rv-panel-foot small { text-align: center; color: var(--fg-3); font-size: var(--t-xs); }
}

/* review toolbar lives in the top bar on tablet/desktop */
.rv-tools { display: flex; align-items: center; gap: 4px; }
.saved { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--fg-3); white-space: nowrap; }
.saved .i { width: 16px; height: 16px; color: var(--ok); }
.topbar-render { display: none; }
@media (min-width: 1180px) { .topbar-render { display: inline-flex; } }
@media (max-width: 719px) { .saved-txt { display: none; } }

/* ---------- RENDERING ---------- */
.rd-grid { display: grid; gap: var(--s6); justify-items: center; }
.rd-frame { position: relative; width: min(220px, 60vw); }
.rd-frame .frame { width: 100%; box-shadow: var(--shadow-3); }
.rd-scan { position: absolute; inset: 0; z-index: 4; border-radius: var(--r-frame); overflow: hidden; pointer-events: none; }
.rd-scan::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--done, 0%); background: transparent; border-bottom: 2px solid var(--accent); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 60%, transparent); transition: height 200ms linear; }
.rd-scan::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; top: var(--done, 0%); background: rgba(12, 14, 19, .55); backdrop-filter: grayscale(1) blur(1px); transition: top 200ms linear; }
.rd-main { width: 100%; max-width: 560px; display: grid; gap: var(--s5); }
.rd-pct { font: 750 clamp(3.5rem, 12vw, 5.5rem)/.9 var(--font-display); letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.rd-pct small { font-size: .4em; color: var(--fg-3); letter-spacing: 0; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stage { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.stage-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--fg-3); }
.stage.is-active .stage-ic { background: var(--violet-soft); color: var(--violet); }
.stage.is-done .stage-ic { background: var(--accent); color: var(--on-accent); }
.stage-body { min-width: 0; display: grid; gap: 4px; }
.stage-body b { font-weight: 650; }
.stage-body span { font-size: var(--t-sm); color: var(--fg-3); }
.stage .bar { height: 4px; margin-top: 4px; }
.stage-state { font: 500 12px var(--font-mono); color: var(--fg-3); white-space: nowrap; }
.confirm { display: grid; gap: 12px; padding: 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-soft); }
.confirm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 900px) {
  .rd-grid { grid-template-columns: auto minmax(0, 560px); justify-content: center; align-items: center; gap: var(--s9); padding-top: var(--s6); }
  .rd-frame { width: 260px; }
}

/* ---------- RESULT ---------- */
.res-grid { display: grid; gap: var(--s6); }
.res-player { display: grid; gap: var(--s3); justify-items: center; }
.res-player .frame { width: min(100%, 340px); box-shadow: var(--shadow-3); cursor: pointer; }
.res-player .rv-controls { width: min(100%, 340px); display: flex; align-items: center; gap: 10px; }
.res-player .rv-controls .mono { font-size: 12px; color: var(--fg-2); white-space: nowrap; }
.res-side { display: grid; gap: var(--s5); align-content: start; min-width: 0; }
.res-title h1 { font-size: var(--t-2xl); }
.res-specs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.res-actions { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.res-actions .btn-primary { grid-column: 1 / -1; }
.share { display: grid; gap: var(--s3); }
.share-link { display: flex; gap: 8px; }
.share-link .input { font-family: var(--font-mono); font-size: 13px; min-width: 0; }
.versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.version { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px 8px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.version:hover { border-color: var(--line-strong); }
.version[aria-current="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.version .frame { width: 40px; border-radius: 6px; }
.version-body { min-width: 0; display: grid; gap: 2px; }
.version-body b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version-body span { font-size: var(--t-xs); color: var(--fg-3); }
.version-v { font: 600 12px var(--font-mono); color: var(--fg-3); }
.report-cta { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); }
.report-cta .i { color: var(--fg-2); }
.report-cta div { flex: 1; min-width: 0; }
.report-cta b { display: block; font-weight: 600; }
.report-cta span { font-size: var(--t-sm); color: var(--fg-3); }
.issue-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.issue-grid .chip { min-height: 44px; }
@media (min-width: 900px) {
  .res-grid { grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: var(--s8); align-items: start; }
  .res-player { position: sticky; top: calc(var(--topbar-h) + 16px); }
  .res-player .frame { width: 100%; max-height: calc(100vh - 180px); width: auto; }
  .res-actions { grid-template-columns: auto auto auto; justify-content: start; }
  .res-actions .btn-primary { grid-column: auto; }
  .res-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
}

/* ---------- ACCOUNT / ACTIVITY / STATES ---------- */
.acct { display: grid; gap: var(--s5); }
.acct-section { display: grid; gap: 0; padding: 4px var(--s5); }
.acct-section > h2 { font-size: var(--t-lg); padding: var(--s4) 0 var(--s2); }
.acct-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.acct-row:first-of-type { border-top: 0; }
.acct-row > div:first-child { min-width: 0; flex: 1 1 200px; }
.acct-row b { display: block; font-weight: 600; }
.acct-row span { font-size: var(--t-sm); color: var(--fg-3); }
.acct-row .select { width: auto; min-width: 180px; }
.profile { display: flex; align-items: center; gap: 16px; padding: var(--s5); }
.profile .avatar { width: 56px; height: 56px; font-size: 18px; margin: 0; }
.profile b { display: block; font: 700 var(--t-xl) var(--font-display); letter-spacing: -.02em; }
.profile span { color: var(--fg-3); font-size: var(--t-sm); }
.usage { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
.usage:first-of-type { border-top: 0; }
.usage-row { display: flex; justify-content: space-between; gap: 12px; font-size: var(--t-sm); }
.usage-row b { font-weight: 600; }
.usage-row .mono { color: var(--fg-2); font-size: 13px; }
@media (min-width: 1000px) { .acct { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .acct > .span-2 { grid-column: 1 / -1; } }

.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed li + li { border-top: 1px solid var(--line); }
.feed a { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 4px; text-decoration: none; border-radius: 10px; }
.feed a:hover { background: var(--surface-2); }
.feed-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.feed-body { min-width: 0; }
.feed-body b { display: block; font-weight: 600; }
.feed-body span { font-size: var(--t-sm); color: var(--fg-3); }
.feed .unread b::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: middle; }
.feed time { font-size: var(--t-xs); color: var(--fg-3); white-space: nowrap; }

.states-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s3); }
.state-link { display: grid; gap: 6px; padding: var(--s4); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); text-decoration: none; transition: border-color var(--d-fast) var(--ease); }
.state-link:hover { border-color: var(--accent); }
.state-link b { font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.state-link span { font-size: var(--t-sm); color: var(--fg-3); }

.done-state { display: grid; justify-items: center; text-align: center; gap: var(--s3); padding: var(--s6) 0; }
.done-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); animation: pop-in var(--d-slow) var(--ease) both; }
.done-ic .i { width: 30px; height: 30px; stroke-width: 2.4; }
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } }

/* ---------- breakpoints for shell ---------- */
@media (min-width: 720px) {
  :root { --topbar-h: 68px; }
  .app { display: grid; grid-template-columns: 76px minmax(0, 1fr); }
  .app.is-bare { display: block; }
  .tabbar, .brand-phone { display: none !important; }
  .toasts { bottom: 24px; left: auto; right: 24px; transform: none; }
  .rail {
    display: flex; flex-direction: column; gap: var(--s4);
    position: sticky; top: 0; height: 100vh; height: 100dvh;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 12px calc(14px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    background: var(--rail-bg); color: var(--rail-fg);
  }
  .app.is-bare .rail { display: none; }
  .rail .brand { justify-content: center; color: var(--rail-fg-strong); }
  .rail .wordmark, .rail-nav span, .rail-new span, .rail-usage, .rail-proto span { display: none; }
  .rail-new { padding: 0; width: 52px; height: 48px; align-self: center; }
  .rail-nav { display: grid; gap: 4px; }
  .rail-nav a, .rail-proto { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; border-radius: 10px; text-decoration: none; color: var(--rail-fg); font-weight: 550; transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease); }
  .rail-nav a:hover, .rail-proto:hover { background: var(--rail-hover); color: var(--rail-fg-strong); }
  .rail-nav a[aria-current="page"] { background: var(--rail-hover); color: var(--rail-fg-strong); box-shadow: inset 3px 0 0 var(--accent); }
  .rail-nav .badge { position: absolute; top: 6px; right: 8px; }
  .rail-foot { margin-top: auto; display: grid; gap: var(--s3); }
  .rail :focus-visible { outline-color: var(--accent); }
  .topbar { padding-left: var(--s6); padding-right: max(var(--s6), env(safe-area-inset-right, 0px)); }
  #view { padding: var(--s6) max(var(--s6), env(safe-area-inset-right, 0px)) var(--s8) var(--s6); }
  .app.is-flow #view, .app.has-actionbar #view { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
  .topbar-title { font-size: var(--t-xl); }
  .page-head h1 { font-size: var(--t-3xl); }
  .actionbar { left: 76px; padding-left: var(--s6); padding-right: var(--s6); }
  .actionbar .style-pick { flex: 0 1 340px; margin-right: auto; }
}
@media (min-width: 1280px) {
  .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .rail { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: 16px; }
  .rail .brand { justify-content: flex-start; padding: 0 8px; }
  .rail .wordmark, .rail-nav span, .rail-new span, .rail-proto span { display: inline; }
  .rail-usage { display: grid; }
  .rail-new { width: 100%; padding: 0 16px; justify-content: flex-start; margin-top: var(--s2); }
  .rail-nav a, .rail-proto { justify-content: flex-start; padding: 0 12px; }
  .rail-nav .badge { position: static; margin-left: auto; }
  .rail-usage { gap: 8px; padding: 14px; border-radius: 12px; background: var(--rail-hover); font-size: 12px; }
  .rail-usage-row { display: flex; justify-content: space-between; gap: 8px; }
  .rail-usage .meter { background: #2A303C; }
  .rail-proto { font-size: var(--t-sm); color: #8E96A6; }
  .actionbar { left: var(--rail-w); }
  #view { padding-left: var(--s7); padding-right: max(var(--s7), env(safe-area-inset-right, 0px)); }
  .topbar { padding-left: var(--s7); padding-right: max(var(--s7), env(safe-area-inset-right, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .c-orbit .ot svg { animation: none !important; }
}
