/* JGStudios — Premium Dark Cinema. Design tokens first; every component uses them, so the dark (default), light
   and system themes stay consistent. Fonts are local files (web/fonts, Inter, SIL OFL 1.1): nothing is loaded from
   other hosts. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/app/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+2074, 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("/app/fonts/inter-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root {
  /* colour */
  --bg: #07080d; --bg-2: #0a0e1a; --surface: #10141f; --surface-2: #161b29; --surface-3: #1e2434; --surface-glass: rgba(16, 20, 31, .72);
  --line: rgba(255, 255, 255, .07); --line-strong: rgba(255, 255, 255, .14);
  --text: #eef0f7; --text-2: #c9cedb; --muted: #959eb4;
  --accent: #8b5cf6; --accent-2: #a855f7; --accent-soft: rgba(139, 92, 246, .16); --accent-text: #c4b5fd; --on-accent: #ffffff;
  --ok: #34d399; --warn: #fbbf24; --bad: #fb7185; --info: #60a5fa; --focus: #c4b5fd;
  --hero-ink: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35); --shadow: 0 10px 30px -12px rgba(0, 0, 0, .65); --shadow-lg: 0 30px 80px -24px rgba(0, 0, 0, .8);
  --glow: 0 0 0 1px rgba(139, 92, 246, .35), 0 12px 40px -10px rgba(139, 92, 246, .45);
  /* type */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 15px; --fs-md: 17px; --fs-lg: 20px; --fs-xl: clamp(24px, 3vw, 30px);
  --fs-hero: clamp(30px, 5vw, 54px); --lh-tight: 1.15;
  /* space, shape, motion */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --radius-sm: 10px; --radius: 16px; --radius-lg: 22px; --radius-pill: 999px;
  --ease: cubic-bezier(.2, .7, .2, 1); --fast: .16s; --slow: .45s;
  --nav-h: 64px; --page-max: 1320px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f5fa; --bg-2: #eceef7; --surface: #ffffff; --surface-2: #f3f4f9; --surface-3: #e7e9f2; --surface-glass: rgba(255, 255, 255, .8);
    --line: rgba(15, 18, 35, .08); --line-strong: rgba(15, 18, 35, .16);
    --text: #121521; --text-2: #2c3245; --muted: #586078; --accent: #7c3aed; --accent-2: #9333ea; --accent-soft: rgba(124, 58, 237, .1);
    --accent-text: #6d28d9; --ok: #047857; --warn: #a16207; --bad: #be123c; --info: #1d4ed8; --focus: #7c3aed;
    --shadow-sm: 0 1px 2px rgba(15, 18, 35, .08); --shadow: 0 10px 30px -14px rgba(15, 18, 35, .25); --shadow-lg: 0 30px 70px -30px rgba(15, 18, 35, .35);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f5fa; --bg-2: #eceef7; --surface: #ffffff; --surface-2: #f3f4f9; --surface-3: #e7e9f2; --surface-glass: rgba(255, 255, 255, .8);
  --line: rgba(15, 18, 35, .08); --line-strong: rgba(15, 18, 35, .16);
  --text: #121521; --text-2: #2c3245; --muted: #586078; --accent: #7c3aed; --accent-2: #9333ea; --accent-soft: rgba(124, 58, 237, .1);
  --accent-text: #6d28d9; --ok: #047857; --warn: #a16207; --bad: #be123c; --info: #1d4ed8; --focus: #7c3aed;
  --shadow-sm: 0 1px 2px rgba(15, 18, 35, .08); --shadow: 0 10px 30px -14px rgba(15, 18, 35, .25); --shadow-lg: 0 30px 70px -30px rgba(15, 18, 35, .35);
  color-scheme: light;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--text); font: var(--fs-base)/1.55 var(--font); overflow-x: hidden; -webkit-font-smoothing: antialiased;
  background: radial-gradient(1200px 600px at 85% -10%, rgba(139, 92, 246, .12), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(37, 99, 235, .08), transparent 60%), var(--bg); background-attachment: fixed; min-height: 100vh; }
img, video, canvas { max-width: 100%; }
[hidden] { display: none !important; }
h1 { font-size: var(--fs-xl); line-height: var(--lh-tight); margin: 0; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: var(--fs-md); margin: 0 0 var(--space-3); letter-spacing: -.01em; font-weight: 650; }
h3 { font-size: var(--fs-base); margin: 0; font-weight: 600; }
p { margin: 0 0 var(--space-2); }
a { color: var(--accent-text); text-underline-offset: 3px; }
.muted { color: var(--muted); } .small { font-size: var(--fs-sm); } .bad { color: var(--bad); } .ok { color: var(--ok); } .warn { color: var(--warn); }
.eyebrow { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { top: 8px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- top bar and navigation ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-4); height: var(--nav-h);
  padding: 0 max(var(--space-5), env(safe-area-inset-left)); background: var(--surface-glass); backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; flex: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; font-weight: 800; font-size: 13px; letter-spacing: .02em;
  color: #fff; background: linear-gradient(135deg, #6d28d9, #a855f7 60%, #ec4899); box-shadow: 0 6px 20px -6px rgba(168, 85, 247, .7); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; } .brand-text b { font-size: 16px; letter-spacing: -.01em; }
.brand-tag { font-size: 11px; color: var(--muted); white-space: nowrap; }
.topbar-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; flex: none; }
main { max-width: var(--page-max); margin: 0 auto; padding: var(--space-6) max(var(--space-5), env(safe-area-inset-left)) var(--space-7); outline: none; }

/* desktop sidebar (signed in, 1024 px and wider); folds to icons */
.sidebar { display: none; }
.side-item, .nav a, .sidebar-foot a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font: 550 14px/1.2 var(--font); white-space: nowrap; background: none; border: 0; cursor: pointer;
  width: 100%; text-align: left; transition: color var(--fast), background var(--fast); }
.nav a:hover, .sidebar-foot a:hover, .side-item:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.nav a[aria-current="page"], .sidebar-foot a[aria-current="page"] { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .35); }
.nav a span, .sidebar-foot a span, .side-item span { overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1024px) {
  body.signed-in { --side-w: 236px; padding-left: var(--side-w); }
  body.signed-in.side-collapsed { --side-w: 76px; }
  body.signed-in .topbar { display: none; }
  .sidebar:not([hidden]) { position: fixed; z-index: 20; inset: 0 auto 0 0; width: var(--side-w); display: flex; flex-direction: column; gap: var(--space-4);
    padding: var(--space-4) 12px; background: var(--surface-glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-right: 1px solid var(--line); overflow-y: auto; }
  .sidebar .brand { padding: 4px 6px 8px; }
  .nav { display: flex; flex-direction: column; gap: 2px; }
  .sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: var(--space-3); border-top: 1px solid var(--line); }
  .side-collapsed .sidebar .brand-text, .side-collapsed .nav a span, .side-collapsed .sidebar-foot a span, .side-collapsed .side-item span { display: none; }
  .side-collapsed .nav a, .side-collapsed .sidebar-foot a, .side-collapsed .side-item { justify-content: center; padding: 8px; }
  .side-collapsed .sidebar .brand { justify-content: center; padding: 4px 0 8px; }
}

/* phones and tablets: a bottom bar with four sections and "More" */
.bottom-nav { display: none; }
@media (max-width: 1023px) {
  .bottom-nav:not([hidden]) { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: var(--surface-glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px;
    padding: 4px; border-radius: 14px; color: var(--muted); text-decoration: none; font: 550 11px/1.1 var(--font); background: none; border: 0; cursor: pointer; min-width: 0; }
  .bottom-nav span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav a[aria-current="page"], .bottom-nav button.is-active { color: var(--accent-text); background: var(--accent-soft); }
  body.signed-in main { padding-bottom: calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
  .topbar { height: 56px; padding: 0 var(--space-4); }
  .brand-tag { display: none; }
  main { padding: var(--space-5) var(--space-4) var(--space-7); }
  body.signed-in main { padding-bottom: calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }
}
.menu-sep { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .04); color: var(--text);
  font: 600 14px/1.2 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), transform var(--fast) var(--ease), box-shadow var(--fast); }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .22); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #7c3aed, #a855f7); border-color: transparent; color: var(--on-accent); box-shadow: 0 8px 24px -10px rgba(139, 92, 246, .9); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #7c3aed, #a855f7); box-shadow: 0 12px 32px -10px rgba(168, 85, 247, 1); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .06); border-color: transparent; }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.btn-lg { min-height: 52px; padding: 12px 26px; font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
/* light theme: plain buttons get the light surface; primary, danger and ghost keep their own look */
:root[data-theme="light"] .btn:not(.btn-primary):not(.btn-ghost):not(.btn-danger) { background: var(--surface); }

/* ---------- surfaces and layout ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.page-header p { margin: 6px 0 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-5); margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm); min-width: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.section { margin-bottom: var(--space-6); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.section-head h2 { margin: 0; font-size: var(--fs-lg); }
.section-head a { font-size: var(--fs-sm); text-decoration: none; }
.grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.cols { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
@media (max-width: 960px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.stats { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 26px; letter-spacing: -.02em; font-weight: 700; }
.list { display: flex; flex-direction: column; gap: var(--space-2); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.between { justify-content: space-between; }
.line-item { display: flex; align-items: center; gap: var(--space-3); padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2);
  border: 1px solid var(--line); min-width: 0; color: inherit; text-decoration: none; transition: border-color var(--fast), background var(--fast); }
a.line-item:hover { border-color: var(--line-strong); background: var(--surface-3); }
.line-item .grow { flex: 1; min-width: 0; } .line-item .grow > * { overflow-wrap: anywhere; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: rgba(255, 255, 255, .015); }
.empty .actions { justify-content: center; margin-top: var(--space-3); }
details.advanced { margin-top: 10px; } details.advanced summary { cursor: pointer; color: var(--muted); min-height: 32px; }
pre.code { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: 10px; padding: 10px; font-size: 12px; max-height: 320px; overflow: auto; }

/* ---------- cinematic covers ---------- */
.cover { position: relative; overflow: hidden; background: #0b0d16; isolation: isolate; }
.cover-art { position: absolute; inset: 0; background:
    radial-gradient(70% 90% at var(--x1, 20%) var(--y1, 30%), hsla(var(--h1, 265), 85%, 60%, .85), transparent 60%),
    radial-gradient(60% 80% at var(--x2, 85%) var(--y2, 75%), hsla(var(--h2, 220), 90%, 55%, .7), transparent 65%),
    radial-gradient(40% 40% at 50% 110%, hsla(var(--h3, 330), 90%, 60%, .45), transparent 70%),
    linear-gradient(160deg, #0d0f1c, #05060b); transform: scale(1.02); transition: transform var(--slow) var(--ease); }
.cover-art::after { content: ""; position: absolute; inset: 0; opacity: .22; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.cover-art .horizon { position: absolute; left: -10%; right: -10%; bottom: 18%; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); box-shadow: 0 0 24px 4px rgba(255, 255, 255, .12); }
.cover-art .glyph { position: absolute; right: 7%; top: 12%; width: 22%; aspect-ratio: 1; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: inset 0 0 40px rgba(255, 255, 255, .06); }
.cover img.thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; opacity: 0; transition: opacity var(--slow), transform var(--slow) var(--ease); }
.cover img.thumb.loaded { opacity: 1; }
.cover::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(5, 6, 11, .85)), radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, .45)); }
.cover-badges { position: absolute; z-index: 3; left: 12px; right: 12px; top: 12px; display: flex; justify-content: space-between; gap: 8px; }
.cover-badges .badge { background: rgba(8, 9, 15, .62); border-color: rgba(255, 255, 255, .14); color: #eef0f7; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.thumb-missing { display: none; }

/* project cards */
.project-card { display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform var(--fast) var(--ease), box-shadow var(--fast), border-color var(--fast); min-width: 0; }
.project-card .cover { aspect-ratio: 16 / 10; }
.project-card:hover { transform: translateY(-3px); border-color: rgba(139, 92, 246, .45); box-shadow: var(--glow); }
.project-card:hover .cover-art, .project-card:hover img.thumb { transform: scale(1.06); }
.project-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.project-card h3 { font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.project-card .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--muted); font-size: var(--fs-sm); }
.project-card .continue { color: var(--accent-text); font-weight: 600; font-size: var(--fs-sm); display: inline-flex; gap: 6px; align-items: center; }
.cards { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 300px); gap: var(--space-4); overflow-x: auto; padding: 4px 2px 14px;
  scroll-snap-type: x mandatory; scrollbar-width: thin; }
.rail > * { scroll-snap-align: start; }
@media (max-width: 760px) { .rail { grid-auto-columns: 78%; margin: 0 calc(-1 * var(--space-4)); padding-left: var(--space-4); padding-right: var(--space-4); } }

/* ---------- hero ---------- */
.hero { position: relative; border-radius: 28px; overflow: hidden; min-height: clamp(320px, 42vw, 440px); display: flex; align-items: flex-end;
  margin-bottom: var(--space-6); box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.hero .cover { position: absolute; inset: 0; }
.hero .cover::after { background: linear-gradient(90deg, rgba(5, 6, 11, .92) 0%, rgba(5, 6, 11, .55) 45%, rgba(5, 6, 11, .1) 100%),
  linear-gradient(0deg, rgba(5, 6, 11, .85), transparent 55%); }
.hero-content { position: relative; z-index: 3; padding: clamp(24px, 4.5vw, 56px); max-width: 680px; color: var(--hero-ink); }
.hero-content h1 { font-size: var(--fs-hero); letter-spacing: -.035em; line-height: 1.04; margin: 10px 0 14px; font-weight: 750; }
.hero-content p { color: rgba(238, 240, 247, .78); font-size: var(--fs-md); max-width: 520px; }
.hero-content .actions { margin-top: var(--space-5); }
.hero-content .btn:not(.btn-primary) { color: #fff; border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .06); }
.hero .eyebrow { color: #d8ccff; }
.hero-letterbox::before, .hero-letterbox::after { content: ""; position: absolute; left: 0; right: 0; height: 10px; background: #000; z-index: 2; opacity: .55; }
.hero-letterbox::before { top: 0; } .hero-letterbox::after { bottom: 0; }
.hero-side { position: absolute; z-index: 3; right: clamp(16px, 3vw, 32px); bottom: clamp(16px, 3vw, 32px); display: flex; gap: 10px; }
.glass { background: rgba(10, 12, 20, .55); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius); padding: 12px 16px; color: #eef0f7; }
.glass b { display: block; font-size: 22px; letter-spacing: -.02em; } .glass span { font-size: var(--fs-xs); color: rgba(238, 240, 247, .7); }
@media (max-width: 760px) { .hero { border-radius: var(--radius-lg); min-height: 380px; } .hero-side { position: static; padding: 0 24px 24px; } .hero { flex-direction: column; align-items: stretch; justify-content: flex-end; } }

/* ---------- badges, chips, progress, stages ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, .05); color: var(--text-2); border: 1px solid var(--line); white-space: nowrap; }
.badge-accent { color: var(--accent-text); background: var(--accent-soft); border-color: rgba(139, 92, 246, .35); }
.badge-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.badge-bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--text-2); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip-ok .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); } .chip-warn .dot { background: var(--warn); } .chip-bad .dot { background: var(--bad); }
.chip-info .dot { background: var(--info); } .chip-accent .dot { background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.progress { height: 6px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, .08); overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #7c3aed, #c084fc); border-radius: inherit; transition: width var(--slow) var(--ease); }
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.stages li { display: flex; align-items: center; gap: 12px; font-size: 14px; padding: 7px 10px; border-radius: 12px; color: var(--muted); }
.stages .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: rgba(255, 255, 255, .06); color: var(--muted); flex: none; }
.stages .done { color: var(--text-2); } .stages .done .mark { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.stages .active { color: var(--text); font-weight: 600; background: var(--accent-soft); } .stages .active .mark { background: var(--accent); color: #fff; }
.stages .failed .mark { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); min-width: 0; }
.field label { font-weight: 600; font-size: 14px; color: var(--text-2); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
input, textarea, select { width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: rgba(255, 255, 255, .03); color: var(--text); font: inherit; transition: border-color var(--fast), box-shadow var(--fast), background var(--fast); }
textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
select option { background: var(--surface); color: var(--text); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); background: rgba(255, 255, 255, .05); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input[type=checkbox], input[type=radio] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--accent); }
input[type=file] { padding: 9px 12px; }
.choices { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.choice { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .025); text-align: left; cursor: pointer; color: var(--text); font: inherit; min-height: 44px;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast), transform var(--fast) var(--ease); text-decoration: none; }
.choice:hover:not(:disabled) { border-color: rgba(139, 92, 246, .5); background: rgba(139, 92, 246, .06); }
.choice[aria-pressed="true"], .choice[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.choice:disabled { opacity: .45; cursor: not-allowed; }
.choice b { font-size: 15px; } .choice span { font-size: 13px; color: var(--muted); }
.type-card { padding: 0; overflow: hidden; }
.type-card .cover { aspect-ratio: 16 / 9; }
.type-card .type-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.type-card:hover { transform: translateY(-3px); box-shadow: var(--glow); }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; border-radius: var(--radius); background: var(--surface-2);
  border: 1px solid var(--line); cursor: pointer; }
.check-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 32px 16px; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color var(--fast), background var(--fast); display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }

/* ---------- wizard ---------- */
.wizard { display: grid; gap: var(--space-5); grid-template-columns: 240px minmax(0, 1fr) 300px; align-items: start; }
.wizard-main .card { padding: clamp(20px, 3vw, 32px); }
.wizard-aside { position: sticky; top: calc(var(--nav-h) + 16px); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--nav-h) + 16px); }
.steps li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; font-size: 14px; color: var(--muted); }
.steps li[aria-current="step"] { background: var(--accent-soft); color: var(--text); font-weight: 650; }
.steps li.done { color: var(--text-2); }
.steps .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .06); font-size: 11px; font-weight: 700; flex: none; }
.steps li[aria-current="step"] .n { background: var(--accent); color: #fff; }
.steps li.done .n { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.wizard-nav { display: flex; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); flex-wrap: wrap; }
.price { font-size: 34px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.summary dl { margin: 0; display: grid; gap: 10px; }
.summary dt { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.summary dd { margin: 0 0 2px; font-weight: 550; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .wizard { grid-template-columns: minmax(0, 1fr) 280px; } .wizard .steps-wrap { grid-column: 1 / -1; }
  .steps { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: thin; }
  .steps li { flex: none; padding: 6px 12px; background: rgba(255, 255, 255, .04); border-radius: var(--radius-pill); } }
@media (max-width: 820px) { .wizard { grid-template-columns: minmax(0, 1fr); } .wizard-aside { position: static; } }

/* ---------- tabs and studio workspace ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: var(--space-5); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 44px; padding: 8px 14px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  font: 600 14px var(--font); cursor: pointer; transition: color var(--fast), border-color var(--fast); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.workspace { display: grid; gap: var(--space-5); grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
.workspace .tabs { flex-direction: column; border: 0; gap: 2px; position: sticky; top: calc(var(--nav-h) + 16px); margin: 0; overflow: visible; }
.workspace .tab { text-align: left; border: 0; border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.workspace .tab[aria-selected="true"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 960px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workspace .tabs { flex-direction: row; position: static; overflow-x: auto; border-bottom: 1px solid var(--line); gap: 4px; }
  .workspace .tab { border-radius: 0; border-bottom: 2px solid transparent; padding: 8px 12px; }
  .workspace .tab[aria-selected="true"] { background: none; box-shadow: none; border-bottom-color: var(--accent); }
}
.studio-banner { position: relative; border-radius: var(--radius-lg); overflow: hidden; min-height: 220px; display: flex; align-items: flex-end; margin-bottom: var(--space-5);
  border: 1px solid var(--line); box-shadow: var(--shadow); }
.studio-banner .cover { position: absolute; inset: 0; }
.studio-banner .cover::after { background: linear-gradient(0deg, rgba(5, 6, 11, .95), rgba(5, 6, 11, .35) 70%, rgba(5, 6, 11, .2)); }
.studio-banner .banner-body { position: relative; z-index: 3; padding: clamp(18px, 3vw, 32px); width: 100%; display: flex; flex-wrap: wrap; gap: var(--space-4);
  align-items: flex-end; justify-content: space-between; color: #fff; }
.studio-banner h1 { font-size: clamp(26px, 4vw, 40px); letter-spacing: -.03em; }
.studio-banner .meta { color: rgba(238, 240, 247, .75); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-sm); }
.studio-banner .chip { color: #fff; }
.studio-banner .btn:not(.btn-primary) { color: #fff; border-color: rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .06); }
.studio-banner .banner-progress { width: min(320px, 100%); }
.studio-banner .banner-progress .progress { background: rgba(255, 255, 255, .14); }

/* shots and scenes */
.shots { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.shot { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; min-width: 0;
  transition: border-color var(--fast), transform var(--fast) var(--ease), box-shadow var(--fast); }
.shot:hover { border-color: rgba(139, 92, 246, .4); transform: translateY(-2px); box-shadow: var(--shadow); }
.shot .cover, .shot-media { aspect-ratio: 16 / 9; }
.shot-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.shot-body dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; }
.shot-body dt { color: var(--muted); } .shot-body dd { margin: 0; overflow-wrap: anywhere; color: var(--text-2); }
.scene-text { color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.timecode { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* people */
.portrait { width: 72px; height: 72px; border-radius: 20px; flex: none; overflow: hidden; display: grid; place-items: center; font-weight: 800; font-size: 26px; color: #fff; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.avatar { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; position: relative; overflow: hidden; }
.avatar > span, .portrait > span, .character-hero .art > span { position: relative; z-index: 3; }
.character-hero { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: var(--space-5); margin-bottom: var(--space-5); align-items: stretch; }
.character-hero .art { position: relative; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4 / 5; display: grid; place-items: center; border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); }
.character-hero .art > span { font-size: clamp(64px, 10vw, 120px); font-weight: 800; color: rgba(255, 255, 255, .92); letter-spacing: -.04em; text-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.character-hero .art img.photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.character-hero .info { display: flex; flex-direction: column; gap: var(--space-3); justify-content: flex-end; }
.character-hero h1 { font-size: clamp(30px, 4.5vw, 48px); letter-spacing: -.03em; }
.character-hero .canonical { color: var(--text-2); font-size: var(--fs-md); max-width: 640px; }
.capabilities { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.capability { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.capability b { font-size: 14px; }
@media (max-width: 760px) { .character-hero { grid-template-columns: minmax(0, 1fr); } .character-hero .art { aspect-ratio: 16 / 11; } }
.character-card .cover { aspect-ratio: 4 / 3; }
.character-card .cover > .initial { position: absolute; z-index: 3; left: 16px; bottom: 10px; font-size: 54px; font-weight: 800; letter-spacing: -.04em; color: rgba(255, 255, 255, .9); }

.player video { width: 100%; border-radius: var(--radius); background: #000; max-height: 70vh; display: block; }
.timeline { display: flex; height: 56px; border-radius: 14px; overflow: hidden; background: var(--surface-2); gap: 2px; padding: 2px; }
.timeline span { display: grid; place-items: center; font-size: 12px; border-radius: 10px; background: linear-gradient(180deg, rgba(139, 92, 246, .45), rgba(139, 92, 246, .2));
  min-width: 26px; overflow: hidden; color: #fff; font-weight: 600; }
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- loading, toasts, dialogs ---------- */
.skeleton-block { display: grid; gap: 12px; padding: 8px 0; }
.skeleton { height: 16px; border-radius: 8px; background: linear-gradient(90deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .09), rgba(255, 255, 255, .04));
  background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skeleton.tall { height: 220px; border-radius: var(--radius-lg); }
@keyframes shimmer { to { background-position: -200% 0; } }
#view > * { animation: enter .35s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
.toasts { position: fixed; z-index: 60; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
@media (max-width: 1023px) { body.signed-in .toasts { bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); left: 16px; right: 16px; } }
.toast { padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  border-left: 3px solid var(--ok); animation: enter .25s var(--ease) both; }
.toast-bad { border-left-color: var(--bad); } .toast-warn { border-left-color: var(--warn); }
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(3, 4, 8, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.modal, .drawer { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; border-radius: var(--radius-lg) 0 0 var(--radius-lg); width: min(360px, 92vw); max-height: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 20px 0; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 14px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; flex-wrap: wrap; }
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-list a[aria-current="page"] { background: var(--accent-soft); }
.menu-list a { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 14px; border-radius: 14px; color: var(--text); text-decoration: none; }
.menu-list a:hover { background: var(--surface-2); }

/* ---------- sign-in ---------- */
.auth { max-width: 440px; margin: 8vh auto 0; }
.auth .card { padding: 32px; box-shadow: var(--shadow-lg); }

/* ---------- 3D viewer (Phase 14.1) ---------- */
.viewer3d { position: relative; width: 100%; height: min(62vh, 560px); min-height: 280px; border-radius: var(--radius-lg); overflow: hidden;
  background: radial-gradient(80% 80% at 50% 30%, #1d2236, #0a0c14); touch-action: none; margin-bottom: var(--space-3); border: 1px solid var(--line); }
.viewer3d-canvas { display: block; width: 100% !important; height: 100% !important; }
.viewer3d-wait { padding: 16px; }
.viewer3d.checker { background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%),
  linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.viewer3d-tools .row { margin-bottom: 8px; } .viewer3d-tools select { width: auto; margin-left: 6px; min-height: 38px; padding-top: 6px; padding-bottom: 6px; }
.viewer3d-tools label { display: flex; align-items: center; font-size: 13px; color: var(--text-2); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; margin-right: 6px; }
.material { margin-bottom: 4px; }
.row input[type=file] { flex: 1; min-width: 180px; }
.inner { background: var(--surface-2); box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Project Studio workspace (Phase 18) ---------- */
.studio-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.studio-title { flex: 1 1 320px; min-width: 0; }
.studio-title h1 { font-size: clamp(22px, 3vw, 30px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-title .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }
.back-link { font-size: var(--fs-sm); text-decoration: none; color: var(--muted); }
.back-link:hover { color: var(--text); }
.studio-progress { display: flex; align-items: center; gap: 10px; flex: 0 1 220px; }
.studio-progress .progress { flex: 1; }
.budget-pill { display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 14px; border-radius: var(--radius-pill); background: var(--accent-soft);
  border: 1px solid rgba(139, 92, 246, .35); color: var(--text); text-decoration: none; font-size: var(--fs-sm); white-space: nowrap; }
.budget-pill b { font-size: 16px; }
.studio { display: grid; gap: var(--space-5); grid-template-columns: 200px minmax(0, 1fr); align-items: start; }
.studio > .tabs { flex-direction: column; border: 0; gap: 2px; position: sticky; top: calc(var(--nav-h) + 16px); margin: 0; overflow: visible; }
.studio > .tabs .tab { text-align: left; border: 0; border-radius: 12px; padding: 10px 14px; }
.studio > .tabs .tab[aria-selected="true"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.studio-body { min-width: 0; }
.studio-main { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.studio-side { display: flex; flex-direction: column; gap: var(--space-4); position: sticky; top: calc(var(--nav-h) + 16px); }
.studio-side .card { margin: 0; }
.inspector-card h2 { font-size: var(--fs-md); }
.inspector-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
@media (max-width: 1280px) { .studio-main { grid-template-columns: minmax(0, 1fr); } .studio-side { position: static; } }
@media (max-width: 960px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
  .studio > .tabs { flex-direction: row; position: static; overflow-x: auto; border-bottom: 1px solid var(--line); gap: 4px; }
  .studio > .tabs .tab { border-radius: 0; border-bottom: 2px solid transparent; padding: 8px 12px; }
  .studio > .tabs .tab[aria-selected="true"] { background: none; box-shadow: none; border-bottom-color: var(--accent); }
  .studio-top { padding: var(--space-4); }
  .studio-progress { flex-basis: 100%; }
}
.stage { margin-bottom: var(--space-5); }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.stage-head h2 { margin: 0; }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); }
.segmented button { min-height: 36px; padding: 6px 14px; border-radius: var(--radius-pill); border: 0; background: none; color: var(--muted); font: 600 13px var(--font); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.media-preview { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #05060b; aspect-ratio: 16 / 9; border: 1px solid var(--line); }
.media-preview > .cover { position: absolute; inset: 0; }
.media-preview video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.media-play { position: absolute; z-index: 4; inset: 0; margin: auto; width: 76px; height: 76px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(10, 12, 20, .55); color: #fff; font-size: 26px; cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: grid; place-items: center; transition: transform var(--fast) var(--ease), background var(--fast); }
.media-play:hover { transform: scale(1.06); background: rgba(124, 58, 237, .75); }
.media-play-icon { margin-left: 4px; }
.media-empty { position: absolute; z-index: 4; left: 0; right: 0; bottom: 16px; text-align: center; color: rgba(238, 240, 247, .8); font-size: var(--fs-sm); }
.media-preview.is-audio { aspect-ratio: auto; background: var(--surface-2); border-radius: var(--radius); }
.media-preview.is-audio .media-play { position: static; width: auto; height: 44px; border-radius: var(--radius-pill); font-size: 14px; display: inline-flex; gap: 8px;
  padding: 0 16px; margin: 0; background: var(--accent-soft); border-color: rgba(139, 92, 246, .4); color: var(--text); backdrop-filter: none; }
.media-preview.is-audio audio { width: 100%; display: block; }
.shot .media-preview { border-radius: 0; border: 0; }
.scene-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 168px; gap: 10px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
.strip-item { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-align: left; cursor: pointer; font: inherit; transition: border-color var(--fast), transform var(--fast) var(--ease); }
.strip-item:hover { border-color: rgba(139, 92, 246, .45); }
.strip-item[aria-selected="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, var(--glow); }
.strip-thumb .cover { aspect-ratio: 16 / 9; border-radius: 10px; }
.strip-meta { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; padding: 0 4px 2px; }
.strip-dot { position: absolute; top: 12px; right: 12px; z-index: 5; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 2px rgba(0, 0, 0, .5); }
.dot-ready { background: var(--ok); } .dot-generating { background: var(--accent-2); } .dot-failed { background: var(--bad); }
.audio-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.audio-row .grow { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.audio-row .media-preview { flex: 1 1 220px; }
.takes { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.take { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.take.is-active { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.take .grow { flex: 1; min-width: 0; }
.script-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.tracks { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.track { display: grid; grid-template-columns: 90px minmax(480px, 1fr); gap: 10px; align-items: center; }
.track-name { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.track-lane { position: relative; height: 34px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.track.ruler .track-lane { height: 22px; background: none; border: 0; }
.tick { position: absolute; top: 2px; font-size: 11px; color: var(--muted); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.tick:first-child { transform: none; }
.clip { position: absolute; top: 3px; bottom: 3px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 650; color: #fff;
  overflow: hidden; background: rgba(139, 92, 246, .55); border: 1px solid rgba(255, 255, 255, .12); }
.clip.is-ready { background: linear-gradient(180deg, rgba(139, 92, 246, .75), rgba(109, 40, 217, .6)); }
.clip.is-pending { background: rgba(255, 255, 255, .08); color: var(--muted); }
.clip.is-generating { background: rgba(168, 85, 247, .35); }
.clip.is-failed { background: color-mix(in srgb, var(--bad) 45%, transparent); }
.clip.is-voice, .legend.is-voice { background: color-mix(in srgb, var(--ok) 45%, transparent); }
.clip.is-over, .legend.is-over { background: color-mix(in srgb, var(--warn) 55%, transparent); }
.clip.is-music { background: rgba(96, 165, 250, .35); }
.clip.is-sfx { background: rgba(244, 114, 182, .55); min-width: 3px; }
.legend { display: inline-block; width: 14px; height: 10px; border-radius: 3px; }
.estimate-price { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin-bottom: 12px; }
.estimate .kv { margin-bottom: 10px; }

/* vertical (9:16) pictures are shown whole over the cover art, never stretched or cut to a sliver */
.cover.is-vertical img.thumb { object-fit: contain; }

/* Character Studio: gallery, look, projects, Character Lock */
.char-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-5); }
.ref-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.ref-gallery .ref { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.ref-gallery .cover { aspect-ratio: 3 / 4; border-radius: var(--radius); }
.ref-gallery img.thumb { object-fit: cover; }
.lock-explainer { margin-top: var(--space-5); padding: var(--space-4); border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface-2); }
.lock-explainer h3 { margin-bottom: 6px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin: var(--space-3) 0; }
ul.plain { margin: 0; padding-left: 18px; color: var(--text-2); font-size: var(--fs-sm); display: grid; gap: 4px; }
@media (max-width: 960px) { .char-grid, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
/* the picture keeps to its column: a stretched row height must not widen a 4:5 box over the text */
.character-hero .art { width: 100%; align-self: start; min-width: 0; }
/* notices and the credit history */
.notice { padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); margin-bottom: var(--space-4); font-size: var(--fs-sm); }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.tx .grow > b + .badge { margin-left: 8px; }
.tx-after { min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }

/* Auto AI: settings, the AI Production Plan table (cards on phones), details */
.ai-plan { display: grid; gap: var(--space-4); }
.ai-settings { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.ai-settings > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
.ai-settings .segmented { margin: 6px 0; }
.strategy-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 6px; }
.strategy-choices .choice.is-main { grid-column: 1 / -1; }
.strategy-choices .choice.is-legacy { padding: 10px 14px; opacity: .85; }
.strategy-choices .choice.is-legacy b { font-size: var(--fs-sm); }
.strategy-choices .choice span, .mode-choices .choice span { font-size: var(--fs-sm); color: var(--muted); }
.mode-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ai-budget { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ai-plan-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ai-plan-head h2 { margin: 0; }
.ai-plan-head .check-row { margin-left: auto; }
.ai-plan .notes { margin: 0; padding-left: 18px; color: var(--text-2); font-size: var(--fs-sm); display: grid; gap: 4px; }
.ai-totals dd b { font-size: var(--fs-md); }
.table-wrap { overflow-x: auto; }
.ai-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.ai-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ai-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ai-table tbody tr:hover { background: rgba(255, 255, 255, .02); }
.ai-table .model-cell { display: flex; flex-direction: column; gap: 2px; }
.ai-table .why { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ai-table td .badge { margin: 0 4px 4px 0; }
.ai-table .row-action { text-align: right; white-space: nowrap; }
.line-item.blocked { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.ai-details h3 { margin-top: var(--space-4); }
.ai-details ul.warn { color: var(--warn); }
.ai-details code { font-size: 12px; word-break: break-all; }
.ai-details details summary { cursor: pointer; margin-top: var(--space-4); }
.review { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line); }
@media (max-width: 1100px) { .ai-settings { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .strategy-choices, .mode-choices { grid-template-columns: minmax(0, 1fr); }
  .ai-table thead { display: none; }
  .ai-table, .ai-table tbody, .ai-table tr, .ai-table td { display: block; width: 100%; }
  .ai-table tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 4px; margin-bottom: 10px; }
  .ai-table td { border: 0; padding: 6px 10px; }
  .ai-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
  .ai-table .row-action { text-align: left; }
  .ai-plan-head .check-row { margin-left: 0; }
  .ai-totals { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ai-totals dd { margin-bottom: 10px; }
  .ai-details .kv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}


.nle-grid { display:grid;grid-template-columns:minmax(150px,1fr) minmax(240px,2fr) minmax(180px,1fr);gap:16px; }
.nle-grid > * {min-width:0}.nle video {width:100%;max-height:360px}.nle-library {max-height:450px;overflow:auto}.nle-scroll {overflow-x:auto;position:relative;margin-top:16px}.nle-track {min-width:800px}.nle-track-title {display:flex;gap:12px;align-items:center;padding:8px}.nle-lane {height:64px;position:relative;background:var(--surface-2);border-bottom:1px solid var(--border)}.nle-clip {position:absolute;top:5px;height:52px;overflow:hidden;touch-action:none;white-space:nowrap}.nle-playhead {position:absolute;height:100%;width:2px;background:var(--accent);z-index:2;pointer-events:none}.nle-properties input {width:100%}@media(max-width:800px){.nle-grid {grid-template-columns:minmax(0,1fr)}.nle-library {max-height:160px}.nle button {min-height:44px}.nle video{max-height:220px}}

.nle-track-title {position:sticky;left:0;width:max-content;min-width:280px;background:var(--surface-2);z-index:3}@media(max-width:800px){.nle-preview {order:-1}.nle-properties {max-height:360px;overflow:auto}}
.nle-tracks {width:max-content;min-width:100%}.nle-grid {align-items:start}.nle-properties {max-height:450px;overflow:auto}.nle-library .line-item {min-width:0;gap:8px;flex-wrap:wrap}.nle-library .line-item span {min-width:0;flex:1;overflow-wrap:anywhere}@media(max-width:800px){.nle-properties {max-height:360px}}
.nle-waveform {position:absolute;inset:0;width:100%;height:100%;object-fit:fill;opacity:.55;pointer-events:none}.nle-export {margin-top:16px}.nle-export .line-item {flex-wrap:wrap;gap:10px}.nle-preview [data-composite] {margin-top:10px;min-height:44px}
.nle-proxy-status {display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:8px 0}.nle-preview .nle-proxy-status:empty {display:none}
