:root {
  color-scheme: light;
  --ink: #25202e;
  --muted: #716b79;
  --paper: #f7f3ec;
  --card: #fffdf9;
  --line: #dfd9d1;
  --purple: #7657d6;
  --purple-dark: #5336ad;
  --purple-hover: #5336ad;
  --purple-soft: #ece6ff;
  --coral: #ef7d5b;
  --gold: #f6c96b;
  --green: #3a8669;
  --red: #b64d50;
  --shadow: 0 18px 60px rgba(39, 31, 51, .1);
  --topbar: rgba(247, 243, 236, .88);
  --field: #fff;
  --surface-hover: #ede8df;
  --surface-warm: #ece6d8;
  --surface-banner: #ebe6db;
  --surface-approved: #e5f0e9;
  --surface-danger: #fff0ef;
  --surface-consent: #fff1e9;
  --surface-chip: #eee9e2;
  --surface-ready: #e3f0e8;
  --track: #e8e2dc;
  --button-dark-bg: var(--ink);
  --button-dark-text: #fff;
  --final-bg: #25202e;
  --final-text: #fff;
  --final-muted: #bab3c2;
  --toast-error: #a94347;
  --page-glow: rgba(245, 197, 109, .16);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eeeaf3;
  --muted: #aaa3b4;
  --paper: #17141d;
  --card: #211d29;
  --line: #393342;
  --purple: #8061d8;
  --purple-dark: #b9a4ff;
  --purple-hover: #6f50c8;
  --purple-soft: #33294e;
  --coral: #ff9678;
  --gold: #e9bd62;
  --green: #71c59f;
  --red: #f17d80;
  --shadow: 0 18px 60px rgba(0, 0, 0, .32);
  --topbar: rgba(23, 20, 29, .88);
  --field: #191620;
  --surface-hover: #2a2532;
  --surface-warm: #292535;
  --surface-banner: #2b2732;
  --surface-approved: #20352c;
  --surface-danger: #3d2529;
  --surface-consent: #362821;
  --surface-chip: #302b38;
  --surface-ready: #20382e;
  --track: #37313f;
  --button-dark-bg: #eeeaf3;
  --button-dark-text: #211d29;
  --final-bg: #0f0d13;
  --final-text: #f6f2fa;
  --final-muted: #aaa3b4;
  --toast-error: #9f3f45;
  --page-glow: rgba(118, 87, 214, .13);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { min-height: 100vh; margin: 0; color: var(--ink); font: 15px/1.5 "DM Sans", sans-serif; background: radial-gradient(circle at 80% 10%, var(--page-glow), transparent 30%), var(--paper); transition: color .2s ease, background-color .2s ease; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .04; z-index: 20; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E"); }

.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid var(--line); background: var(--topbar); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font: 700 21px "Fraunces", serif; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px 11px 16px 11px; color: white; background: var(--purple); transform: rotate(-4deg); box-shadow: 3px 4px 0 #d7c9ff; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.account-control { position: relative; }
.account-menu { position: absolute; z-index: 40; top: calc(100% + 11px); right: 0; width: min(340px, calc(100vw - 24px)); padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 18px 50px rgba(30, 24, 40, .18); }
.account-menu-profile { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 11px; padding: 8px 8px 13px; border-bottom: 1px solid var(--line); }
.account-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: white; background: linear-gradient(145deg, var(--purple), var(--coral)); font: 700 19px "Fraunces", serif; }
.account-menu-profile > span:last-child { display: grid; min-width: 0; gap: 1px; }
.account-menu-profile strong, .account-menu-profile small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-profile strong { font-size: 13px; }
.account-menu-profile small { color: var(--muted); font-size: 11px; }
.account-menu-link { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 10px; border: 0; border-radius: 11px; text-align: left; background: transparent; cursor: pointer; }
.account-menu-link:hover, .account-menu-link:focus-visible { outline: none; background: var(--surface-hover); }
.account-menu-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--purple-dark); background: var(--purple-soft); font-size: 18px; }
.account-menu-link > span:nth-child(2) { display: grid; gap: 1px; }
.account-menu-link strong { font-size: 13px; }
.account-menu-link small { color: var(--muted); font-size: 11px; }
.account-menu-link > b { color: var(--muted); font-size: 17px; }
.account-menu-service { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: 8px; padding: 10px; border-radius: 11px; background: var(--surface-warm); }
.account-menu-service > span:nth-child(2) { display: grid; min-width: 0; gap: 1px; }
.account-menu-service strong { font-size: 13px; }
.account-menu-service small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.account-service-action { width: fit-content; margin-top: 5px; color: var(--purple-dark); font-size: 10px; font-weight: 700; text-underline-offset: 2px; }
.account-service-action:hover, .account-service-action:focus-visible { color: var(--purple); }
.account-menu-service > b { align-self: start; padding: 3px 6px; border-radius: 99px; color: var(--muted); background: var(--surface-chip); font-size: 9px; white-space: nowrap; }
.account-menu-service.connected > b { color: var(--green); background: var(--surface-ready); }
.account-menu-service.unavailable > b { color: var(--red); background: var(--surface-danger); }
.account-claim { margin: 7px 0 0; padding: 10px; border-radius: 10px; background: var(--surface-warm); }
.account-claim p { margin: 0 0 8px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.account-translation-requests h3 { margin: 12px 8px 6px; font-size: 11px; }
.account-translation-requests .notice { margin: 6px 0; padding: 9px; }
.account-menu-footer { margin-top: 8px; padding: 8px 8px 1px; border-top: 1px solid var(--line); }
.account-menu-footer button { padding: 3px 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.account-menu-footer button:hover, .account-menu-footer button:focus-visible { color: var(--ink); outline: none; text-decoration: underline; text-underline-offset: 3px; }
.theme-toggle { position: relative; width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--card); cursor: pointer; overflow: hidden; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--purple); }
.theme-toggle:focus-visible { outline: 3px solid rgba(118, 87, 214, .25); outline-offset: 2px; }
.theme-icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; transition: opacity .2s ease, transform .25s ease; }
.theme-icon-moon { opacity: 1; transform: rotate(0) scale(1); }
.theme-icon-sun { opacity: 0; transform: rotate(-45deg) scale(.6); }
[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: rotate(45deg) scale(.6); }
[data-theme="dark"] .theme-icon-sun { opacity: 1; transform: rotate(0) scale(1); }
.status-pill { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(246, 201, 107, .2); }
.status-pill.ready i { background: var(--green); box-shadow: 0 0 0 4px rgba(58, 134, 105, .16); }
.status-pill.error i { background: var(--red); }

.button { appearance: none; border: 0; border-radius: 11px; padding: 10px 16px; font-weight: 700; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled, .button.disabled { opacity: .5; pointer-events: none; }
.button-dark { color: var(--button-dark-text); background: var(--button-dark-bg); box-shadow: 0 5px 16px rgba(37, 32, 46, .16); }
.button-primary { color: white; background: var(--purple); box-shadow: 0 8px 24px rgba(118, 87, 214, .24); }
.button-primary:hover { background: var(--purple-hover); }
.button-secondary { color: var(--purple-dark); background: var(--purple-soft); }
.button-ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.button-danger { color: var(--red); background: var(--surface-danger); }
.button-large { padding: 14px 21px; font-size: 16px; }
.button-small { padding: 7px 11px; font-size: 12px; border-radius: 8px; }

.shell { height: calc(100vh - 72px); height: calc(100dvh - 72px); min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr) minmax(280px, 360px); grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.studio-main { min-width: 0; min-height: 0; overflow: auto; }
.director-toggle { display: none; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--card); cursor: pointer; font-weight: 700; }
.director-toggle:hover, .director-toggle:focus-visible { border-color: var(--purple); color: var(--purple-dark); background: var(--purple-soft); }
.director-toggle.has-pending { box-shadow: inset 0 0 0 2px var(--coral); }
.sidebar { border-right: 1px solid var(--line); padding: 20px 12px 16px; display: flex; flex-direction: column; min-width: 0; overflow: auto; }
.eyebrow-row { display: flex; justify-content: space-between; padding: 0 8px 13px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .11em; }
.project-list { display: grid; gap: 6px; }
.project-list-item { position: relative; min-width: 0; }
.project-item { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 10px; width: 100%; border: 0; border-radius: 11px; padding: 9px; text-align: left; background: transparent; cursor: pointer; }
.project-item > span:last-child { min-width: 0; padding-right: 20px; }
.project-item:hover, .project-item.active { background: var(--surface-hover); }
.project-item.active { box-shadow: inset 3px 0 var(--purple); }
.project-thumb { height: 38px; overflow: hidden; border-radius: 9px; display: grid; place-items: center; color: white; background: linear-gradient(145deg, var(--purple), var(--coral)); font-family: "Fraunces", serif; font-size: 18px; }
.project-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.project-item strong, .project-item small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.project-item strong { font-size: 13px; }
.project-item small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.project-delete { position: absolute; z-index: 1; top: 50%; right: 6px; width: 27px; height: 27px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-size: 20px; line-height: 1; transform: translateY(-50%); }
.project-delete:hover, .project-delete:focus-visible { color: var(--red); background: var(--surface-danger); }
.tip-card { margin-top: auto; padding: 14px; display: flex; gap: 11px; background: var(--surface-warm); border-radius: 13px; }
.tip-icon { color: var(--purple); font-size: 22px; }
.tip-card strong { font-size: 12px; }
.tip-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }

.workspace { min-width: 0; position: relative; }
.welcome-view { overflow: visible; min-height: 0; padding: 8vh clamp(35px, 6vw, 100px) 100px; }
.welcome-copy { max-width: 640px; position: relative; z-index: 2; }
.kicker { display: inline-block; color: var(--purple-dark); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; }
.welcome-copy h1 { margin: 18px 0 22px; font: 700 clamp(48px, 6vw, 82px)/.98 "Fraunces", serif; letter-spacing: -.045em; }
.welcome-copy h1 em { color: var(--purple); font-style: italic; }
.welcome-copy p { max-width: 570px; margin: 0 0 30px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.hero-art { position: absolute; width: min(46vw, 680px); aspect-ratio: 1.05; right: 0; bottom: 70px; overflow: hidden; border-radius: 50% 0 0 50%; background: linear-gradient(#edd9a2, #e89c79); }
.sun { position: absolute; width: 25%; aspect-ratio: 1; right: 18%; top: 15%; border-radius: 50%; background: #ffe8a1; box-shadow: 0 0 70px #ffe39b; }
.hill { position: absolute; border-radius: 50% 50% 0 0; }
.hill-back { width: 120%; height: 43%; left: -10%; bottom: 8%; background: #7475a1; transform: rotate(-7deg); }
.hill-front { width: 125%; height: 35%; left: -5%; bottom: -8%; background: #3f5361; transform: rotate(4deg); }
.hero-art .character { position: absolute; z-index: 2; bottom: 18%; }
.hero-art .character .head { position: absolute; display: block; width: 88px; height: 82px; left: 6px; border-radius: 50% 50% 46% 46%; }
.hero-art .character .head i { position: absolute; width: 9px; height: 9px; left: 27px; top: 33px; background: #241f34; border-radius: 50%; box-shadow: 30px 0 #241f34; }
.hero-art .character .body { position: absolute; display: block; width: 90px; height: 125px; left: 5px; top: 67px; border-radius: 47% 47% 30% 30%; }
.fox { left: 38%; width: 100px; height: 190px; }
.fox .head { background: #df704b; }
.fox .body { background: #c86042; }
.fox .ear { position: absolute; top: -17px; width: 42px; height: 60px; background: #df704b; transform: rotate(28deg); border-radius: 80% 0 40%; }
.fox .ear.right { left: 60px; transform: scaleX(-1) rotate(28deg); }
.owl { left: 62%; bottom: 25%; width: 100px; height: 180px; transform: scale(.84); }
.owl .head { background: #f7e8cd; border-radius: 50% 50% 55% 55%; }
.owl .body { background: #9a7d6b; }
.spark { position: absolute; color: #fff4b5; z-index: 4; }
.s1 { top: 20%; left: 26%; font-size: 22px; }.s2 { top: 38%; right: 13%; font-size: 17px; }.s3 { top: 17%; left: 52%; font-size: 40px; }
.feature-strip { position: absolute; left: clamp(35px, 6vw, 100px); right: clamp(35px, 6vw, 100px); bottom: 25px; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.feature-strip div { padding: 19px 15px 0 0; display: flex; gap: 10px; align-items: baseline; color: var(--muted); font-size: 12px; }
.feature-strip b { color: var(--coral); font: 600 13px "Fraunces", serif; }

.project-view { padding: 22px clamp(18px, 2.4vw, 36px) 48px; max-width: none; width: 100%; margin: 0; }
.project-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 20px; }
.project-header h1 { margin: 4px 0 2px; font: 700 clamp(24px, 3vw, 38px) "Fraunces", serif; letter-spacing: -.03em; }
.project-header p { margin: 0; color: var(--muted); }
.budget-card { position: relative; z-index: 5; width: 230px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 7px 24px rgba(39, 31, 51, .05); }
.budget-card > span, .budget-card small { color: var(--muted); font-size: 11px; }
.budget-card strong { display: block; margin: 2px 0 8px; font: 700 24px "Fraunces", serif; }
.budget-card .cost-to-finish { display: block; margin-top: 3px; color: var(--purple-dark); font-weight: 700; }
.budget-edit { margin: 7px 0 0; padding: 0; border: 0; background: none; color: var(--purple-dark); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.budget-edit:hover, .budget-edit:focus-visible { color: var(--purple); }
.budget-track { height: 5px; border-radius: 99px; overflow: hidden; background: var(--track); margin-bottom: 6px; }
.budget-track i { display: block; width: 0; height: 100%; background: var(--purple); transition: width .3s; }
.budget-details { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 7px; }
.budget-details summary { display: flex; align-items: center; justify-content: space-between; color: var(--purple-dark); font-size: 11px; font-weight: 700; cursor: pointer; list-style: none; }
.budget-details summary::-webkit-details-marker { display: none; }
.budget-details summary::after { content: "⌄"; font-size: 14px; transition: transform .2s; }
.budget-details[open] summary::after { transform: rotate(180deg); }
.budget-details .when-open { display: none; }
.budget-details[open] .when-open { display: inline; }
.budget-details[open] .when-closed { display: none; }
.budget-breakdown { position: absolute; top: calc(100% + 8px); right: -1px; width: min(310px, calc(100vw - 32px)); padding: 10px 15px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 14px 38px rgba(39, 31, 51, .14); }
.budget-breakdown-row { display: flex; justify-content: space-between; gap: 18px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.budget-breakdown-row > span { font-weight: 700; }
.budget-breakdown-row small { display: block; margin-top: 2px; font-weight: 400; }
.budget-breakdown-row strong { flex: 0 0 auto; margin: 0; font: 700 14px "Fraunces", serif; }
.budget-breakdown-note, .budget-empty { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.budget-increase-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 12px; }
.budget-increase-form .field { flex: 1 1 150px; margin: 0; }
.budget-increase-form .button { flex: 0 0 auto; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); margin-bottom: 27px; }
.steps button { position: relative; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 13px 10px 17px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.steps button b { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid var(--line); border-radius: 50%; font-size: 10px; }
.steps button.active { color: var(--purple-dark); }
.steps button.active::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--purple); }
.steps button.done b { color: white; background: var(--green); border-color: var(--green); }
.step-content { animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0 0 4px; font: 700 28px "Fraunces", serif; }
.section-heading p { margin: 0; color: var(--muted); }
.heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.heading-actions .cost-note { align-self: center; }
.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 6px 26px rgba(39, 31, 51, .04); }
.panel-body { padding: 22px; }
.panel + .panel { margin-top: 17px; }
.grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field-grid .span-two { grid-column: 1 / -1; }
.scene-cast-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.scene-cast-field legend { margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.scene-cast-field > small, .spoken-script small { color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.4; }
.character-multi-select { display: flex; flex-wrap: wrap; gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.character-choice { position: relative; cursor: pointer; }
.character-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.character-choice span { display: block; padding: 7px 11px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: var(--card); font-size: 11px; font-weight: 700; transition: .15s ease; }
.character-choice input:checked + span { border-color: var(--purple); color: var(--purple-dark); background: var(--purple-soft); box-shadow: 0 0 0 2px rgba(118, 87, 214, .08); }
.character-choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(118, 87, 214, .18); }
.empty-choice { color: var(--muted); font-size: 11px; }
.spoken-script { display: grid; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); }
.spoken-script-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.spoken-script-heading > div { display: grid; gap: 3px; }
.spoken-script-heading strong { color: var(--ink); font-size: 13px; }
.voice-timeline-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.speaker-announcement-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid rgba(118, 87, 214, .28); border-radius: 10px; background: var(--purple-soft); cursor: pointer; }
.speaker-announcement-toggle input { flex: none; width: 17px; height: 17px; margin: 1px 0 0; padding: 0; accent-color: var(--purple); }
.speaker-announcement-toggle span { display: grid; gap: 2px; }
.speaker-announcement-toggle strong { color: var(--ink); font-size: 11px; }
.speaker-announcement-toggle small { color: var(--muted); }
.voice-timeline-footer { display: grid; grid-template-columns: minmax(180px, .55fr) minmax(260px, 1fr); align-items: start; gap: 10px; }
.voice-duration-estimate { display: grid; gap: 2px; padding: 12px; border-radius: 10px; color: var(--muted); background: var(--purple-soft); }
.voice-duration-estimate b { color: var(--purple-dark); font-size: 9px; letter-spacing: .07em; text-transform: uppercase; }
.voice-duration-estimate strong { color: var(--ink); font: 700 20px "Fraunces", serif; }
.voice-auto-suggest, .narrator-settings { padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.voice-auto-suggest summary, .narrator-settings summary { color: var(--purple-dark); cursor: pointer; font-size: 11px; font-weight: 800; }
.voice-auto-suggest .field { margin-top: 10px; }
.voice-auto-suggest textarea { min-height: 78px; background: var(--field); }
.voice-auto-suggest .button { margin: 9px 7px 0 0; }
.narrator-settings .narrator-voice-fields { margin-top: 10px; }
.narrator-line { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(220px, .7fr); align-items: start; gap: 10px; }
.narrator-line textarea { min-height: 112px; background: var(--card); }
.narrator-voice-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.narrator-voice-fields small { grid-column: 1 / -1; }
.dialogue-lines { display: grid; gap: 8px; }
.dialogue-line { display: grid; grid-template-columns: auto minmax(130px, .35fr) minmax(220px, 1fr) auto; align-items: end; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.dialogue-line > label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.dialogue-voice-assignment { color: var(--purple-dark); font-size: 9px; font-weight: 600; }
.dialogue-line textarea { min-height: 58px; padding: 8px 9px; }
.speaker-announcement-line { border-color: rgba(118, 87, 214, .34); background: var(--purple-soft); }
.speaker-announcement-badge { display: block; color: var(--purple-dark); font-size: 8px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pause-line { grid-template-columns: auto minmax(180px, 1fr) minmax(130px, .35fr) auto; align-items: center; border-style: dashed; background: var(--surface-warm); }
.pause-copy { display: grid; gap: 2px; }
.pause-copy strong { color: var(--ink); font-size: 11px; }
.pause-copy small { color: var(--muted); font-size: 9px; }
.pause-line .dialogue-line-actions { padding-bottom: 0; }
.generation-prompt { margin: 14px 0; padding: 15px; }
.dialogue-drag { align-self: center; width: 28px; height: 36px; padding: 0; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: grab; font-size: 15px; font-weight: 900; letter-spacing: -3px; }
.dialogue-drag:hover, .dialogue-drag:focus-visible { color: var(--purple-dark); background: var(--purple-soft); outline: none; }
.dialogue-drag:active { cursor: grabbing; }
.dialogue-line.dragging { opacity: .48; border-color: var(--purple); box-shadow: 0 0 0 2px rgba(118, 87, 214, .1); }
.dialogue-line-actions { display: flex; gap: 4px; padding-bottom: 8px; }
.icon-button { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--field); cursor: pointer; font-weight: 800; line-height: 1; }
.icon-button:hover { color: var(--purple-dark); border-color: var(--purple); }
.icon-button.danger:hover { color: #a83c3c; border-color: #a83c3c; }
label.field { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
input[type="checkbox"] { width: auto; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
textarea { resize: vertical; min-height: 110px; line-height: 1.55; overflow-wrap: anywhere; }
input:focus, textarea:focus, select:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(118, 87, 214, .12); }
.form-actions { margin-top: 17px; display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.form-actions .cost-note { margin-right: auto; }
#confirmSpend { max-width: min(100%, 430px); white-space: normal; line-height: 1.25; text-align: center; }
.cost-note { color: var(--muted); font-size: 12px; }
.cost-note strong { color: var(--ink); }

.story-reader { padding: 20px 22px 22px; }
.story-reader-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.story-reader-head h2 { margin: 4px 0 2px; font: 700 26px "Fraunces", serif; overflow-wrap: anywhere; }
.story-reader-head p { margin: 0; color: var(--muted); font-size: 12px; }
.story-ruler { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 700; }
.story-ruler i { display: block; height: 6px; overflow: hidden; border-radius: 99px; background: var(--track); }
.story-ruler i b { display: block; height: 100%; border-radius: inherit; background: var(--purple); }
.story-beats { display: grid; gap: 9px; margin: 0 0 18px; padding: 0; list-style: none; }
.story-beats > li { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--field); box-shadow: 0 3px 12px rgba(39,31,51,.035); }
.story-beat { display: grid; grid-template-columns: 35px minmax(0, 1fr); gap: 12px; width: 100%; padding: 14px 16px 15px 13px; border: 0; background: transparent; color: inherit; }
.story-beat-marker { position: relative; display: flex; justify-content: center; align-self: stretch; min-height: 66px; }
.story-beat-marker b { position: relative; z-index: 1; display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; color: var(--purple-dark); background: var(--purple-soft); font-size: 10px; }
.story-beat-marker i { position: absolute; top: 34px; bottom: -28px; width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--purple) 24%, var(--line)); }
.story-beats > li:last-child .story-beat-marker i { display: none; }
.story-beat-copy { min-width: 0; }
.story-beat-copy header { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.story-beat time { color: var(--purple-dark); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.story-beat-copy header span { padding: 2px 6px; border-radius: 99px; color: var(--muted); background: var(--surface-chip); font-size: 9px; font-weight: 800; }
.story-beat strong { display: block; margin-bottom: 4px; font: 700 16px "Fraunces", serif; overflow-wrap: anywhere; }
.story-beat p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.58; white-space: pre-wrap; overflow-wrap: anywhere; }
button.story-beat { text-align: left; cursor: pointer; }
button.story-beat:hover, button.story-beat:focus-visible { background: color-mix(in srgb, var(--purple-soft) 70%, var(--field)); }
.story-prose { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.story-prose-box { max-height: min(52vh, 640px); overflow: auto; padding: 4px 2px 0; }
.story-tools { margin-top: 14px; }
.story-form:not(.panel) { margin-top: 14px; }
.scene-expanded .scene-script-preview { margin: 10px 0 14px; }
.story-tools > summary, .story-ai > summary { color: var(--purple-dark); cursor: pointer; font-size: 12px; font-weight: 800; }
.story-tools .field-grid, .story-ai .panel-body { margin-top: 12px; }
.story-form textarea[name="story"] { min-height: 280px; }

.approval-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 17px 0; padding: 15px 18px; border-radius: 13px; background: var(--surface-banner); }
.approval-banner strong { display: block; font-size: 13px; }
.approval-banner span { color: var(--muted); font-size: 12px; }
.approval-banner.approved { background: var(--surface-approved); }
.approval-banner.drift, .approval-banner.outdated { background: rgba(246, 201, 107, .18); box-shadow: inset 0 0 0 1px rgba(246, 201, 107, .45); }
.approval-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.scene-plan-input { margin: -8px 0 17px; padding: 12px 16px; }
.scene-plan-input summary { color: var(--purple-dark); cursor: pointer; font-size: 11px; font-weight: 800; }
.scene-plan-input p { margin: 12px 0 0; max-height: 280px; overflow: auto; color: var(--muted); font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.scene-list-item + .scene-list-item { margin-top: 0; }
.scene-list-item > .scene-card { margin: 0; }
.scene-voice-action { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: -1px 14px 0; padding: 11px 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; background: var(--field); }
.scene-voice-action > div { display: grid; gap: 2px; }
.scene-voice-action strong { font-size: 11px; }
.scene-voice-action span { color: var(--muted); font-size: 10px; }
.scene-voice-action.empty { border-color: rgba(118, 87, 214, .3); background: var(--purple-soft); }
.spoken-script.voice-editor-highlight { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(118, 87, 214, .12); }

.character-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }
.character-card { overflow: hidden; }
.character-portrait { width: 100%; aspect-ratio: 1; background: var(--purple-soft); display: grid; place-items: center; overflow: hidden; }
.character-portrait img { display: block; width: 100%; height: 100%; padding: 8px; object-fit: contain; object-position: center; }
.character-placeholder { width: 82px; height: 82px; border-radius: 50% 50% 42% 42%; display: grid; place-items: center; color: white; font: 700 35px "Fraunces", serif; background: linear-gradient(145deg, var(--purple), var(--coral)); }
.character-info { padding: 15px; }
.character-info h3 { margin: 0; font: 700 20px "Fraunces", serif; }
.character-role { color: var(--coral); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .11em; }
.character-info p { color: var(--muted); font-size: 12px; min-height: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.character-info .asset-outdated-note { min-height: 0; margin: 10px 0; padding: 8px 10px; border-radius: 8px; color: #8a5a00; background: rgba(246, 201, 107, .2); font-size: 10px; font-weight: 700; }
.character-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.character-actions > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.character-used-prompt { margin: -3px 0 12px; padding-top: 9px; border-top: 1px solid var(--line); }
.character-used-prompt summary, .prompt-used summary { color: var(--purple-dark); cursor: pointer; font-size: 10px; font-weight: 700; }
.character-used-prompt p, .prompt-used p { min-height: 0; margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; white-space: pre-wrap; }
.voice-chip { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--purple-dark); background: var(--purple-soft); border-radius: 99px; padding: 5px 9px; font-size: 10px; font-weight: 700; }
.character-voice-preview { display: grid; gap: 5px; margin: 0 0 12px; padding: 9px; border-radius: 10px; background: var(--field); }
.character-voice-preview span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.character-voice-preview audio { width: 100%; height: 32px; }
.character-voice-editor { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); }
.character-voice-editor > div { display: grid; gap: 3px; }
.character-voice-editor small, .voice-preview-note { color: var(--muted); font-size: 10px; line-height: 1.45; }
.character-voice-editor textarea { min-height: 76px; background: var(--card); }
.character-voice-editor > button { justify-self: end; }
.character-voice-preview-actions { display: flex !important; flex-wrap: wrap; justify-content: flex-end; gap: 8px !important; }
.character-voice-editor > .voice-preview-note { margin: 0; text-align: right; }
.character-voice-choice > button { align-self: start; justify-self: start; }
.saved-character-voice { display: grid; grid-template-columns: auto minmax(200px, 1fr); align-items: center; gap: 8px 12px; padding: 10px; border-radius: 10px; background: var(--card); }
.saved-character-voice > div { display: grid; gap: 2px; }
.saved-character-voice span { color: var(--muted); font-size: 9px; }
.saved-character-voice audio { width: 100%; height: 32px; }
.saved-character-voice details { grid-column: 1 / -1; }
.saved-character-voice summary { color: var(--purple-dark); cursor: pointer; font-size: 10px; font-weight: 700; }
.saved-character-voice p { min-height: 0; margin: 6px 0 0; font-size: 10px; }

.scene-list { display: grid; gap: 13px; counter-reset: scene-number; }
.scene-card { overflow: hidden; transition: opacity .16s ease, transform .16s ease, box-shadow .16s ease; }
.scene-list > .scene-card { counter-increment: scene-number; }
.scene-card-summary { display: grid; grid-template-columns: 28px 148px minmax(0, 1fr) 28px; gap: 14px; padding: 12px; align-items: center; cursor: pointer; list-style: none; }
.scene-card-summary::-webkit-details-marker { display: none; }
.scene-card-summary:focus-visible { outline: 3px solid rgba(118, 87, 214, .35); outline-offset: -3px; }
.scene-card.dragging { opacity: .55; transform: scale(.995); box-shadow: 0 16px 34px rgba(43, 34, 72, .15); }
.scene-reorder-controls { display: grid; justify-items: center; gap: 5px; }
.scene-drag-handle { width: 30px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: grab; font: 900 17px/1 sans-serif; letter-spacing: -4px; }
.scene-drag-handle:hover, .scene-drag-handle:focus-visible { color: var(--purple-dark); background: var(--purple-soft); }
.scene-drag-handle:active { cursor: grabbing; }
.scene-reorder-controls .icon-button { width: 28px; height: 28px; }
.scene-reorder-controls button:disabled { cursor: not-allowed; opacity: .3; }
.scene-preview { position: relative; min-width: 0; }
.scene-preview-toolbar { position: absolute; z-index: 2; top: 6px; right: 6px; display: flex; align-items: center; min-height: 0; padding: 0; }
.scene-preview-toolbar > span { display: none; }
.scene-preview-actions { display: flex; align-items: center; gap: 5px; }
.scene-preview-toggle { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; color: #fff; background: rgba(25,20,38,.72); box-shadow: 0 2px 7px rgba(18,13,29,.24); backdrop-filter: blur(5px); cursor: pointer; font: inherit; }
.scene-preview-toggle:hover, .scene-preview-toggle:focus-visible { background: rgba(118,87,214,.92); }
.scene-preview-toggle:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.scene-preview-toggle span { width: auto; font-size: 10px; line-height: 1; text-align: center; }
.scene-preview-toggle b { display: none; }
.scene-thumb { position: relative; aspect-ratio: 16/9; overflow: hidden; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #d7cdf6, #f1bd91); color: rgba(255,255,255,.85); font: 700 28px "Fraunces", serif; }
.scene-thumb img, .scene-thumb video { width: 100%; height: 100%; object-fit: cover; }
.scene-thumb video { background: #292532; }
.scene-preview .scene-thumb { cursor: pointer; }
.scene-preview .scene-thumb:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.scene-preview-timeline { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 6px 2px 0; cursor: default; }
.scene-preview-timeline input[type="range"] { width: 100%; min-width: 0; height: 16px; margin: 0; padding: 0; accent-color: var(--purple); cursor: ew-resize; }
.scene-preview-timeline input[type="range"]:disabled { cursor: wait; opacity: .55; }
.scene-preview-timeline input[type="range"]:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.scene-preview-timeline output { color: var(--muted); font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scene-preview-badge { position: absolute; top: 7px; left: 7px; padding: 4px 7px; border-radius: 99px; background: rgba(27, 23, 38, .78); color: #fff; font: 800 8px/1.2 sans-serif; letter-spacing: .05em; text-transform: uppercase; pointer-events: none; }
.scene-preview-badge.generating { background: rgba(118, 87, 214, .88); }
.scene-copy { min-width: 0; }
.scene-copy h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 5px; font: 700 17px "Fraunces", serif; overflow-wrap: anywhere; }
.scene-copy h3::before { content: "Scene " counter(scene-number); flex: none; padding: 3px 7px; border-radius: 99px; color: var(--purple-dark); background: var(--purple-soft); font: 800 9px/1.2 sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.scene-copy p { margin: 0 0 8px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.scene-dialogue-glance { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 4px 8px; margin: 0 0 9px; padding: 7px 9px; border-radius: 8px; background: var(--field); font-size: 10px; }
.scene-dialogue-glance-heading { display: flex; align-items: center; gap: 5px; grid-column: 1 / -1; }
.scene-dialogue-glance-heading strong { color: var(--ink); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.scene-dialogue-glance-heading em { padding: 2px 5px; border-radius: 99px; color: var(--purple-dark); background: var(--purple-soft); font-size: 7px; font-style: normal; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.scene-dialogue-glance-line { display: contents; }
.scene-dialogue-glance-line time { grid-column: 1; color: var(--purple-dark); font-size: 9px; font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.scene-dialogue-glance-line span { grid-column: 2; display: block; min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.scene-dialogue-glance-line b { color: var(--ink); font-size: 9px; white-space: nowrap; }
.scene-dialogue-glance-line i { color: var(--muted); font-style: normal; }
.scene-dialogue-glance-line i::before { content: " · "; }
.scene-dialogue-glance > small { grid-column: 2; color: var(--purple-dark); font-size: 8px; font-weight: 700; }
.scene-dialogue-glance.silent { display: block; color: var(--muted); }
.scene-card[open] .scene-dialogue-glance { display: none; }
.scene-script-preview { display: grid; gap: 3px; margin: 0 0 9px; padding: 8px 10px; border-left: 3px solid var(--purple); border-radius: 0 8px 8px 0; background: var(--field); color: var(--ink); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.scene-script-preview > strong { color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.scene-script-preview span { display: block; }
.scene-script-preview span b { color: var(--purple); }
.scene-script-preview small { color: var(--muted); }
.scene-script-preview.silent { border-left-color: var(--line); color: var(--muted); }
.scene-script-preview > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.scene-script-preview > header strong { color: var(--ink); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.scene-script-preview > header span { flex: none; padding: 3px 6px; border-radius: 99px; color: var(--purple-dark); background: var(--purple-soft); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.scene-script-lines { display: grid; gap: 5px; max-height: 230px; overflow: auto; }
.scene-script-line { display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: start; gap: 8px; padding: 7px 8px; border-radius: 7px; background: var(--card); }
.scene-script-line time { padding-top: 1px; color: var(--purple-dark); font-size: 9px; font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.scene-script-line > span { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 7px; min-width: 0; }
.scene-script-line b { color: var(--ink) !important; font-size: 10px; }
.scene-script-line em { color: var(--purple-dark); font-size: 8px; font-style: normal; font-weight: 800; text-transform: uppercase; }
.scene-script-line small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; line-height: 1.45; }
.scene-script-preview > small { margin-top: 3px; font-size: 8px; line-height: 1.4; }
.scene-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 4px 8px; border-radius: 99px; background: var(--surface-chip); color: var(--muted); font-size: 10px; font-weight: 700; }
.chip.ai { color: var(--purple-dark); background: var(--purple-soft); }
.chip.ready { color: var(--green); background: var(--surface-ready); }
.scene-progress { display: flex; flex-wrap: wrap; gap: 7px 12px; margin-top: 9px; }
.scene-progress-item { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.scene-progress-item i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent); }
.scene-progress-item b { color: inherit; font-variant-numeric: tabular-nums; }
.scene-progress-item.ready { color: var(--green); }
.scene-progress-item.missing { color: var(--red); }
.scene-progress-item.working { color: var(--purple-dark); }
.scene-progress-item.neutral { color: var(--muted); }
.scene-progress-item.outdated { color: #8a5a00; }
.scene-expand-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--purple-dark); background: var(--purple-soft); transition: transform .18s ease; }
.scene-expand-icon::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.scene-card[open] .scene-expand-icon { transform: rotate(180deg); }
.scene-expanded { padding: 0 14px 14px 54px; border-top: 1px solid var(--line); }
.scene-expanded-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 4px; }
.scene-expanded-heading > div { display: grid; gap: 2px; }
.scene-expanded-actions { display: flex !important; flex-wrap: wrap; justify-content: flex-end; gap: 7px !important; }
.scene-expanded-heading strong { font: 700 16px "Fraunces", serif; }
.scene-expanded-heading span { color: var(--muted); font-size: 10px; }
.scene-expanded .render-info { padding: 10px 0 0; }
.scene-locked-note { display: grid; gap: 3px; margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--field); }
.scene-locked-note strong { font-size: 11px; }
.scene-locked-note span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.render-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 16px; }
.render-card { overflow: hidden; }
.render-preview { position: relative; aspect-ratio: 16/9; background: #2a2633; display: grid; place-items: center; color: #fff; overflow: hidden; }
.render-preview img, .render-preview video { width: 100%; height: 100%; object-fit: cover; }
.render-preview-label { position: absolute; top: 9px; left: 9px; padding: 5px 8px; border-radius: 99px; background: rgba(27, 23, 38, .78); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; pointer-events: none; }
.video-generating-overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 5px; background: rgba(30, 25, 43, .68); backdrop-filter: blur(2px); }
.video-generating-overlay i { width: 22px; height: 22px; border: 2px solid rgba(255,255,255,.4); border-right-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.video-generating-overlay strong { font-size: 12px; }
.video-generating-overlay span { color: rgba(255,255,255,.75); font-size: 10px; text-transform: capitalize; }
.render-info { padding: 14px; }
.render-info h3 { margin: 0 0 9px; font: 700 17px "Fraunces", serif; }
.render-synopsis { margin: -3px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.video-job-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.video-job-notice > div { display: grid; gap: 2px; }
.video-job-notice strong { font-size: 11px; }
.video-job-notice span { color: var(--muted); font-size: 10px; line-height: 1.35; }
.video-job-notice.pending { border-color: rgba(118, 87, 214, .3); background: var(--purple-soft); }
.video-job-notice.ready { border-color: rgba(56, 139, 104, .3); background: var(--surface-ready); }
.video-job-notice.failed { border-color: rgba(190, 70, 70, .3); }
.video-job-notice.outdated { border-color: rgba(246, 201, 107, .5); background: rgba(246, 201, 107, .16); }
.outdated-reasons { margin: 4px 0; padding-left: 15px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.keyframe-prompt { display: grid; gap: 8px; margin: 0 0 12px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.keyframe-prompt > div { display: grid; gap: 2px; }
.keyframe-prompt label { display: grid; gap: 5px; }
.keyframe-prompt strong { font-size: 11px; }
.keyframe-prompt span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.keyframe-prompt textarea { min-height: 92px; padding: 8px 9px; background: var(--card); font-size: 11px; line-height: 1.45; }
.keyframe-prompt .button { justify-self: start; }
.keyframe-prompt details { padding-top: 7px; border-top: 1px solid var(--line); }
.keyframe-prompt summary { color: var(--purple-dark); cursor: pointer; font-size: 10px; font-weight: 700; }
.keyframe-prompt details p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; white-space: pre-wrap; }
.keyframe-prompt details small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.keyframe-provenance dl { display: grid; gap: 6px; margin: 9px 0; }
.keyframe-provenance dl div { display: grid; grid-template-columns: 86px 1fr; gap: 8px; }
.keyframe-provenance dt { color: var(--muted); font-size: 9px; font-weight: 700; }
.keyframe-provenance dd { margin: 0; color: var(--ink); font-size: 9px; line-height: 1.45; }
.keyframe-next-prompt > label { margin-top: 9px; color: var(--ink); font-size: 10px; font-weight: 700; }
.keyframe-next-prompt > small { display: block; margin-top: 5px; }
.keyframe-prompt-actions { display: flex !important; flex-wrap: wrap; gap: 7px !important; margin-top: 8px; }
.keyframe-used-prompt { margin-top: 2px; }
.render-workflow { display: grid; gap: 10px; }
.render-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.render-method { display: grid; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.render-method > label { color: var(--ink); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.render-method > div { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 7px; }
.render-method select { min-width: 0; background: var(--card); }
.render-method .button { width: 100%; min-width: 0; white-space: normal; line-height: 1.25; }
.render-method > span { font-size: 10px; line-height: 1.4; }
.render-method-help, .render-output-notice { color: var(--muted); }
.render-replacement-notice { padding: 7px 8px; border-radius: 7px; color: var(--ink); background: var(--surface-warm); }
.render-replacement-notice strong { display: block; color: var(--coral); font-size: 9px; letter-spacing: .05em; text-transform: uppercase; }
.video-prompt-used { padding-top: 7px; border-top: 1px solid var(--line); }
.video-prompt-used summary { color: var(--purple-dark); cursor: pointer; font-size: 10px; font-weight: 700; }
.video-prompt-used p { margin: 8px 0 4px; color: var(--muted); font-size: 10px; line-height: 1.5; white-space: pre-wrap; }
.video-prompt-used small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.voice-over-panel { display: grid; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.voice-duration-summary { display: grid; min-width: 165px; gap: 1px; padding: 9px 12px; border: 1px solid rgba(118, 87, 214, .28); border-radius: 11px; background: var(--purple-soft); }
.voice-duration-summary span { color: var(--purple-dark); font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.voice-duration-summary strong { color: var(--ink); font: 700 18px "Fraunces", serif; font-variant-numeric: tabular-nums; }
.voice-duration-summary small { color: var(--muted); font-size: 9px; }
.voice-over-panel.ready { border-color: rgba(56, 139, 104, .3); }
.voice-over-panel.incomplete { border-color: rgba(190, 70, 70, .3); }
.voice-over-heading { display: grid; gap: 5px; min-width: 0; }
.voice-over-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.voice-over-heading strong { font-size: 11px; }
.voice-over-message { color: var(--muted); font-size: 10px; line-height: 1.4; }
.voice-over-status, .voice-line-status { flex: none; border-radius: 99px; padding: 4px 7px; font-size: 9px; font-weight: 800; line-height: 1.3; }
.voice-over-status.ready, .voice-line-status.ready { color: var(--green); background: var(--surface-ready); }
.voice-over-status.missing, .voice-line-status.missing { color: #a83c3c; background: rgba(190, 70, 70, .1); }
.voice-over-status.empty { color: var(--muted); background: var(--surface-chip); }
.voice-over-status.preview, .voice-line-status.preview { color: var(--purple-dark); background: var(--purple-soft); }
.scene-track-player { display: grid; grid-template-columns: auto minmax(160px, 1fr); align-items: center; gap: 9px; padding: 8px; border-radius: 8px; background: var(--card); }
.scene-track-player span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.scene-track-player.empty strong { color: var(--muted); font-size: 10px; font-weight: 700; }
.scene-track-player audio, .voice-over-line audio { width: 100%; height: 32px; }
.voice-over-segments { display: grid; gap: 6px; }
.voice-over-segments > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 2px; cursor: pointer; list-style: none; }
.voice-over-segments > summary::-webkit-details-marker { display: none; }
.voice-over-segments > summary strong { font-size: 10px; }
.voice-over-segments > summary span { color: var(--muted); font-size: 9px; font-weight: 700; }
.voice-over-segments-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 2px; }
.voice-over-segments-heading strong { font-size: 10px; }
.voice-over-segments-heading span { color: var(--muted); font-size: 9px; font-weight: 700; }
.voice-over-lines { display: grid; gap: 6px; }
.voice-over-lines.empty { gap: 3px; padding: 14px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; background: var(--card); }
.voice-over-lines.empty strong { color: var(--ink); font-size: 10px; }
.voice-over-lines.empty span { color: var(--muted); font-size: 9px; }
.voice-over-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px 9px; padding: 8px; border-radius: 8px; background: var(--card); }
.voice-over-line-copy { display: flex; min-width: 0; align-items: flex-start; gap: 8px; }
.voice-over-line-copy > b { display: grid; flex: none; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; background: var(--purple); font-size: 9px; }
.voice-over-line-copy > span { display: grid; min-width: 0; gap: 2px; }
.voice-over-line-copy strong { font-size: 10px; }
.voice-over-line-copy small { overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.voice-over-line-copy em { color: var(--purple-dark); font-size: 8px; font-style: normal; font-weight: 700; }
.voice-over-line audio { grid-column: 1 / -1; }
.voice-recipe { padding-top: 7px; border-top: 1px solid var(--line); }
.voice-recipe summary { color: var(--purple-dark); cursor: pointer; font-size: 10px; font-weight: 700; }
.voice-recipe > span { display: block; padding-top: 7px; color: var(--muted); font-size: 9px; }
.voice-over-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; padding-top: 2px; }
.asset-direction-summary { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.asset-stage-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.scene-editor { display: grid; gap: 16px; }
.scene-editor-section { display: grid; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--field); }
.scene-editor-section-heading { display: grid; gap: 2px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.scene-editor-section-heading span { color: var(--ink); font: 700 16px "Fraunces", serif; }
.scene-editor-section-heading small { color: var(--muted); font-size: 10px; }
.scene-editor-section .spoken-script { padding: 0; border: 0; background: transparent; }
.inline-voice-editor { gap: 8px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.inline-voice-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inline-voice-toolbar > div { display: flex; flex-wrap: wrap; gap: 7px; }
.inline-voice-save-note { color: var(--muted); font-size: 9px; line-height: 1.4; }
.js-play-voice-segment:disabled { cursor: not-allowed; opacity: .42; }
.used-voices { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.used-voices > div:first-child { display: grid; gap: 2px; }
.used-voices > div:first-child strong { color: var(--purple-dark); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.used-voice { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: 8px; background: var(--card); }
.used-voice > div { display: flex; flex-wrap: wrap; gap: 3px 7px; font-size: 10px; }
.used-voice > div span, .used-voice small { color: var(--muted); font-size: 9px; }
.used-voice small { text-align: right; }
.voice-preview-list { display: grid; gap: 8px; margin-top: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.voice-preview-list summary { color: var(--purple-dark); cursor: pointer; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.voice-preview-list summary span { display: inline-grid; place-items: center; min-width: 19px; min-height: 19px; margin-left: 4px; border-radius: 99px; color: var(--purple-dark); background: var(--purple-soft); }
.voice-preview-list > p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.saved-voice-preview { display: grid; grid-template-columns: minmax(90px, .65fr) minmax(150px, 1fr); align-items: center; gap: 9px; }
.voice-preview-list span { display: grid; color: var(--muted); font-size: 10px; }
.voice-preview-list span b { color: var(--ink); }
.voice-preview-list audio { width: 100%; height: 32px; }
.final-card { margin-top: 18px; padding: 22px; display: grid; grid-template-columns: minmax(260px, 46%) minmax(0, 1fr); align-items: center; gap: 25px; background: var(--final-bg); color: var(--final-text); border-radius: 16px; }
.final-card h3 { margin: 0 0 4px; font: 700 23px "Fraunces", serif; }
.final-card p { margin: 0; color: var(--final-muted); }
.final-card-copy { min-width: 0; }
.final-preview { display: block; width: 100%; max-height: 360px; aspect-ratio: 16 / 9; border-radius: 12px; background: #09080b; object-fit: contain; }
.final-card-actions { display: flex; flex-wrap: wrap; margin-top: 16px; gap: 8px; }
.youtube-source { display: grid; gap: 7px; margin-top: 15px; color: var(--muted); font-size: 12px; font-weight: 700; }
.youtube-source video { width: 100%; max-height: 320px; border-radius: 12px; background: #09080b; }
.youtube-upload-notice { display: grid; gap: 5px; margin: 14px 0 18px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; }
.youtube-upload-notice.ready { border-color: rgba(56, 139, 104, .35); background: var(--surface-ready); }
.youtube-upload-notice.failed { border-color: rgba(190, 70, 70, .35); background: var(--surface-danger); }
.youtube-upload-notice.uploading { border-color: rgba(118, 87, 214, .35); background: var(--purple-soft); }
.youtube-upload-notice span, .youtube-upload-notice a { font-size: 12px; }
.youtube-progress { height: 6px; overflow: hidden; border-radius: 99px; background: var(--track); }
.youtube-progress i { display: block; height: 100%; border-radius: inherit; background: var(--purple); transition: width .25s ease; }

.cost-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.checkpoint-costs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric { padding: 18px; }
.metric span { color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin-top: 5px; font: 700 26px "Fraunces", serif; }
.cost-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cost-table th { color: var(--muted); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.cost-table th, .cost-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cost-table tr:last-child td { border-bottom: 0; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.cost-outlook { margin-bottom: 18px; padding: 16px 18px; }
.cost-outlook-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.cost-outlook-heading > div { display: grid; gap: 3px; }
.cost-outlook-heading strong { font-size: 13px; }
.cost-outlook-heading b { font: 700 22px "Fraunces", serif; white-space: nowrap; }
.cost-outlook > .cost-note { display: block; margin: 10px 0 0; }
.empty-state { padding: 55px 25px; text-align: center; }
.empty-state span { display: block; margin-bottom: 10px; color: var(--purple); font-size: 35px; }
.empty-state h3 { margin: 0 0 7px; font: 700 23px "Fraunces", serif; }
.empty-state p { max-width: 460px; margin: 0 auto 18px; color: var(--muted); }
.checkpoint-details { margin-bottom: 17px; padding: 4px 18px; }
.checkpoint-details > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.checkpoint-details > div:last-child { border-bottom: 0; }
.checkpoint-details span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.checkpoint-details strong { min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.voice-plan { margin: 22px 0 17px; }
.character-prompt-plan { margin: 22px 0 17px; }
.character-prompt-item { display: grid; gap: 8px; padding: 14px; }
.character-prompt-item + .character-prompt-item { margin-top: 9px; }
.character-prompt-item strong { font-size: 12px; }
.character-prompt-item textarea { min-height: 120px; font-size: 11px; line-height: 1.45; }
.prompt-used { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.voice-plan-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin-bottom: 10px; }
.voice-plan-heading h3 { margin: 3px 0 0; font: 700 20px "Fraunces", serif; }
.voice-plan-heading p { max-width: 560px; margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.voice-plan-heading > span { color: var(--muted); font-size: 12px; }
.voice-plan-item { padding: 15px; }
.voice-plan-item + .voice-plan-item { margin-top: 9px; }
.voice-plan-item header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.voice-plan-item header > div { display: flex; align-items: center; gap: 9px; }
.voice-plan-item header b { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: white; background: var(--purple); font-size: 10px; }
.voice-plan-item header > span { color: var(--purple-dark); background: var(--purple-soft); border-radius: 99px; padding: 4px 8px; font-size: 10px; font-weight: 700; }
.voice-plan-item dl { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0; }
.voice-plan-item dl div { display: flex; gap: 5px; min-width: 0; font-size: 10px; }
.voice-plan-item dt { color: var(--muted); font-weight: 700; text-transform: uppercase; }
.voice-plan-item dd { margin: 0; overflow-wrap: anywhere; }
.voice-plan-item p { margin: 0; padding: 11px 12px; color: var(--ink); background: var(--field); border-radius: 9px; font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.voice-plan-item > button { margin-top: 10px; }
.voice-script-field, .voice-choice-field { display: grid; gap: 5px; }
.voice-choice-field { margin-bottom: 10px; }
.voice-script-field > span, .voice-choice-field > span, .inline-voice-preview > span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.voice-choice-field small { color: var(--muted); font-size: 9px; }
.voice-script-field textarea { width: 100%; min-height: 58px; resize: vertical; }
.inline-voice-preview { display: grid; grid-template-columns: auto minmax(180px, 1fr); align-items: center; gap: 10px; margin-top: 10px; padding: 8px 10px; border-radius: 9px; background: var(--field); }
.inline-voice-preview audio { width: 100%; height: 32px; }
.voice-not-generated { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.voice-segment-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.current-scene-audio { display: grid; grid-template-columns: minmax(150px, .75fr) minmax(220px, 1fr); align-items: center; gap: 12px; margin: 16px 0; padding: 12px; }
.current-scene-audio div { display: grid; gap: 3px; }
.current-scene-audio strong { font-size: 11px; }
.current-scene-audio span { color: var(--muted); font-size: 10px; }
.current-scene-audio audio { width: 100%; height: 34px; }

.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(27, 23, 34, .58); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(680px, 100%); max-height: 90vh; overflow: auto; border-radius: 19px; padding: 28px; background: var(--card); box-shadow: var(--shadow); animation: modalIn .25s ease; }
.modal-card.modal-wide { width: min(1100px, 96vw); }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-close { position: absolute; right: 14px; top: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface-chip); cursor: pointer; font-size: 20px; }
.modal-close:disabled { display: none; }
.modal h2 { margin: 0 0 7px; font: 700 29px "Fraunces", serif; }
.modal .intro { margin: 0 0 20px; color: var(--muted); }
.auth-panel { width: min(430px, 100%); margin: 4px auto; }
.auth-heading { display: grid; justify-items: center; gap: 15px; margin: 0 0 27px; padding: 2px 34px 0; text-align: center; }
.auth-heading .brand-mark { width: 44px; height: 44px; font-size: 22px; }
.auth-heading h2 { margin: 0; font-size: clamp(26px, 5vw, 32px); line-height: 1.12; }
.auth-google { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) 20px; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 12px 17px; border: 1px solid var(--line); color: var(--ink); background: var(--field); box-shadow: 0 4px 14px rgba(39, 31, 51, .06); }
.auth-google:hover { border-color: color-mix(in srgb, var(--purple) 50%, var(--line)); background: var(--surface-hover); box-shadow: 0 7px 19px rgba(39, 31, 51, .09); }
.auth-google:focus-visible { outline: 3px solid rgba(118, 87, 214, .22); outline-offset: 2px; }
.auth-google svg { width: 20px; height: 20px; }
.auth-google span { grid-column: 2; text-align: center; }
.auth-separator { display: grid; grid-template-columns: 1fr 7px 1fr; align-items: center; gap: 10px; margin: 23px 0; }
.auth-separator::before, .auth-separator::after { content: ""; height: 1px; background: var(--line); }
.auth-separator span { width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.auth-email-option { display: grid; grid-template-columns: 20px minmax(0, 1fr) 20px; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 12px 17px; border: 1px solid var(--line); color: var(--purple-dark); background: var(--purple-soft); }
.auth-email-option:hover { background: color-mix(in srgb, var(--purple-soft) 82%, var(--purple)); box-shadow: 0 7px 19px rgba(39, 31, 51, .07); }
.auth-email-option:focus-visible { outline: 3px solid rgba(118, 87, 214, .22); outline-offset: 2px; }
.auth-email-option > span { font-size: 18px; line-height: 1; }
.auth-email-option strong { grid-column: 2; text-align: center; }
.auth-email-form { display: grid; gap: 15px; }
.auth-email-form .field { gap: 8px; font-size: 13px; }
.auth-email-form input { width: 100%; min-height: 50px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--field); outline: none; }
.auth-email-form .button { width: 100%; min-height: 50px; }
.image-viewer img { display: block; width: 100%; max-height: calc(90vh - 190px); object-fit: contain; border: 1px solid var(--line); border-radius: 13px; background: var(--field); }
.generation-progress { padding: 8px 2px 2px; }
.operation-progress { height: 8px; margin: 25px 0 12px; overflow: hidden; border-radius: 99px; background: var(--track); }
.operation-progress i { display: block; width: 3%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--coral)); transition: width .35s ease; }
.operation-progress.indeterminate i { width: 38%; animation: progressSweep 1.6s ease-in-out infinite; }
@keyframes progressSweep { from { transform: translateX(-105%); } to { transform: translateX(270%); } }
.generation-status { min-height: 21px; margin: 0 0 15px; color: var(--ink); font-size: 13px; font-weight: 700; }
.generation-stream { display: grid; gap: 8px; min-height: 0; margin-bottom: 14px; padding: 12px; }
.generation-stream header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.generation-stream header strong { font-size: 11px; }
.generation-stream header span { color: var(--muted); font-size: 9px; }
.generation-stream pre { max-height: 240px; margin: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.generation-items { display: grid; gap: 7px; margin: 0 0 18px; padding: 0; list-style: none; }
.generation-items li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--field); }
.generation-items li i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.generation-items li span, .generation-items li strong { font-size: 12px; }
.generation-items li strong { color: var(--muted); }
.generation-items li.generating i { background: var(--gold); box-shadow: 0 0 0 4px rgba(246, 201, 107, .14); }
.generation-items li.generating strong { color: var(--gold); }
.generation-items li.complete i { background: var(--green); }
.generation-items li.complete strong { color: var(--green); }
.generation-items li.failed i { background: var(--red); }
.generation-items li.failed strong { color: var(--red); }
.progress-facts { padding: 4px 18px; }
.progress-facts > div { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.progress-facts > div:last-child { border-bottom: 0; }
.progress-facts span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.progress-facts strong { font-size: 12px; }
.progress-note { margin: 15px 2px 0; color: var(--muted); font-size: 12px; }
.batch-generation-plan { display: grid; gap: 12px; margin-top: 18px; }
.batch-scene-plan { padding: 14px; }
.batch-scene-plan > header, .batch-workflow-status > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.batch-scene-plan > header > div, .batch-workflow-status > header > div { display: grid; gap: 3px; }
.batch-scene-plan > header strong, .batch-workflow-status > header strong { font-size: 13px; }
.batch-scene-plan > header span, .batch-workflow-status > header small { color: var(--muted); font-size: 10px; }
.batch-scene-plan > header b { color: var(--purple-dark); font-size: 12px; }
.batch-input { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.batch-input summary { color: var(--purple-dark); cursor: pointer; font-size: 10px; font-weight: 800; }
.batch-input > p { margin: 7px 0; color: var(--muted); font-size: 10px; }
.batch-input > textarea { min-height: 92px; margin-top: 8px; background: var(--field); font-size: 11px; }
.batch-voice-lines { display: grid; gap: 7px; margin-top: 8px; }
.batch-voice-lines label { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: start; gap: 8px; }
.batch-voice-lines label > span { padding-top: 8px; color: var(--muted); font-size: 10px; font-weight: 700; }
.batch-voice-lines textarea { min-height: 58px; font-size: 11px; }
.batch-voice-lines input { max-width: 130px; }
.batch-workflow-status { margin: 17px 0; padding: 16px; border-color: rgba(118, 87, 214, .32); }
.batch-workflow-status .operation-progress { margin: 14px 0 12px; }
.batch-workflow-status .generation-items { max-height: 245px; overflow: auto; margin-bottom: 0; }
.consent-box { display: flex !important; grid-template-columns: auto 1fr; align-items: flex-start; gap: 10px !important; padding: 13px; border-radius: 10px; background: var(--surface-consent); color: var(--ink) !important; font-weight: 500 !important; }
.consent-box input { width: auto; margin-top: 4px; }
.voice-sample-options { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 12px; }
.voice-upload, .voice-recorder { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--field); }
.voice-upload { display: grid; align-content: start; gap: 5px; cursor: pointer; }
.voice-upload strong, .voice-recorder strong { color: var(--ink); font-size: 13px; }
.voice-upload span, .voice-recorder-copy span { color: var(--muted); font-size: 11px; font-weight: 500; }
.voice-upload input { margin-top: 8px; padding: 7px; background: var(--card); }
.voice-sample-divider { display: grid; place-items: center; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.voice-recorder { display: grid; gap: 10px; }
.voice-recorder-copy { display: grid; gap: 5px; }
.voice-recorder-actions { display: flex; align-items: center; gap: 9px; }
.voice-recorder-actions .button { flex: 1; }
.recording-stop { color: #fff; background: var(--red); border-color: var(--red); }
.recording-timer { color: var(--red); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 800; }
#voiceRecordingPreview { width: 100%; height: 34px; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; width: min(460px, calc(100vw - 32px)); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 14px; padding: 13px 13px 13px 16px; color: var(--final-text); background: var(--final-bg); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(10px); transition: .25s; }
.toast.show { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
.toast.error { color: #fff; background: var(--toast-error); border-color: transparent; }
.toast-actions { display: flex; align-items: center; gap: 5px; }
.toast-actions button { min-height: 30px; padding: 5px 8px; border: 1px solid rgba(255,255,255,.22); border-radius: 7px; color: inherit; background: rgba(255,255,255,.1); cursor: pointer; font-size: 11px; font-weight: 700; }
.toast-actions button:hover { background: rgba(255,255,255,.18); }
.toast-actions button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
#closeToast { width: 30px; padding: 0; font-size: 18px; line-height: 1; }
.help-tooltip { position: fixed; z-index: 100; width: max-content; max-width: min(310px, calc(100vw - 20px)); padding: 9px 11px; color: var(--final-text); background: var(--final-bg); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); font-size: 12px; line-height: 1.45; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(3px); transition: opacity .14s ease, transform .14s ease, visibility .14s; }
.help-tooltip.show { opacity: 1; visibility: visible; transform: translateY(0); }
[data-tooltip]:focus-visible { outline: 3px solid rgba(118, 87, 214, .22); outline-offset: 2px; }
.loading { position: relative; pointer-events: none; opacity: .7; }
.loading::after { content: ""; position: absolute; width: 16px; height: 16px; right: 12px; top: calc(50% - 8px); border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  body, .theme-icon, .theme-toggle, .help-tooltip, .scene-card { transition: none; }
  .operation-progress.indeterminate i { width: 100%; animation: none; }
}

@media (max-width: 950px) {
  .hero-art { opacity: .3; width: 75vw; }
  .welcome-copy { max-width: 720px; }
  .project-header { align-items: flex-start; }
  .scene-card-summary { grid-template-columns: 32px 130px minmax(0, 1fr) 32px; gap: 12px; }
  .scene-expanded { padding-left: 60px; }
  .cost-summary { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 650px) {
  .topbar { padding: 0 16px; }
  .top-actions { gap: 9px; }
  .status-pill { display: none; }
  .welcome-view { padding: 55px 22px 110px; }
  .welcome-copy h1 { font-size: 47px; }
  .feature-strip { left: 22px; right: 22px; grid-template-columns: 1fr 1fr; }
  .feature-strip div:nth-child(n+3) { display: none; }
  .project-view { padding: 25px 16px 60px; }
  .project-header { display: grid; }
  .budget-card { width: 100%; }
  .steps button span { display: none; }
  .grid-two, .field-grid { grid-template-columns: 1fr; }
  .field-grid .span-two { grid-column: auto; }
  .approval-banner { align-items: stretch; flex-direction: column; }
  .approval-actions { justify-content: flex-start; }
  .spoken-script-heading { align-items: stretch; flex-direction: column; }
  .spoken-script-heading .button { align-self: flex-start; }
  .voice-timeline-footer { grid-template-columns: 1fr; }
  .dialogue-line { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .pause-line { grid-template-columns: auto minmax(0, 1fr); }
  .narrator-line, .narrator-voice-fields { grid-template-columns: 1fr; }
  .dialogue-line > label { grid-column: 2; }
  .dialogue-drag { grid-row: 1 / span 2; }
  .dialogue-line-actions { grid-column: 2; padding-bottom: 0; }
  .voice-sample-options { grid-template-columns: 1fr; }
  .voice-sample-divider { min-height: 12px; }
  .scene-card-summary { grid-template-columns: minmax(0, 1fr) 32px; gap: 12px; }
  .scene-reorder-controls { grid-column: 1 / -1; grid-auto-flow: column; justify-content: flex-start; }
  .scene-thumb, .scene-preview { grid-column: 1 / -1; width: 100%; }
  .scene-expanded { padding: 0 12px 12px; }
  .scene-expanded-heading { align-items: stretch; flex-direction: column; }
  .scene-expanded-heading .button { align-self: flex-start; }
  .scene-expanded-actions { justify-content: flex-start; }
  .scene-voice-action { align-items: stretch; flex-direction: column; }
  .scene-voice-action .button { align-self: flex-start; }
  .render-method > div, .saved-voice-preview { grid-template-columns: 1fr; }
  .used-voice { align-items: stretch; flex-direction: column; }
  .voice-over-title { align-items: flex-start; flex-direction: column; }
  .scene-track-player { grid-template-columns: 1fr; }
  .inline-voice-toolbar { align-items: stretch; flex-direction: column; }
  .inline-voice-toolbar > .button { align-self: flex-start; }
  .used-voice small { text-align: left; }
  .cost-table th:nth-child(2), .cost-table td:nth-child(2) { display: none; }
  .final-card { grid-template-columns: 1fr; align-items: flex-start; }
  .final-card-actions { width: 100%; justify-content: flex-start; }
  .checkpoint-details > div { grid-template-columns: 1fr; gap: 3px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; justify-content: flex-start; }
  .progress-facts > div { grid-template-columns: 1fr; gap: 3px; }
  .batch-scene-plan > header, .batch-workflow-status > header { align-items: flex-start; flex-direction: column; }
  .batch-voice-lines label { grid-template-columns: 1fr; gap: 3px; }
}
@media (max-width: 400px) {
  .brand > span:last-child { display: none; }
}

/* Story atlas */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.atlas-shell { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
.atlas-shell .sidebar { display: none; }
.atlas-home { min-height: 100%; padding: 36px clamp(20px, 3.2vw, 56px) 48px; overflow: auto; }
.atlas-intro { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); align-items: end; gap: 42px; max-width: 1440px; margin: 0 auto 34px; }
.atlas-intro h1 { margin: 12px 0 0; font: 700 clamp(48px, 6.4vw, 88px)/.92 "Fraunces", serif; letter-spacing: -.055em; }
.atlas-intro h1 em { color: var(--purple); font-style: italic; }
.atlas-intro-copy { padding-bottom: 5px; }
.atlas-intro-copy p { max-width: 480px; margin: 0 0 20px; color: var(--muted); font-size: 16px; line-height: 1.65; }
.atlas-intro-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.atlas-intro-copy .button span { margin-left: 8px; }
.atlas-toolbar { position: relative; z-index: 3; display: grid; grid-template-columns: minmax(260px, 1fr) 190px auto; gap: 10px; max-width: 1440px; margin: 0 auto 18px; padding: 9px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 10px 34px rgba(39,31,51,.07); }
.atlas-search { display: flex; align-items: center; gap: 10px; padding: 0 12px; border-right: 1px solid var(--line); }
.atlas-search > span:first-child { color: var(--purple); font-size: 25px; line-height: 1; transform: rotate(-15deg); }
.atlas-search input, .atlas-country select { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.atlas-search input { height: 42px; }
.atlas-search input::placeholder { color: var(--muted); }
.atlas-country { display: flex; align-items: center; padding: 0 8px; }
.atlas-country select { height: 42px; cursor: pointer; font-weight: 700; }
.cartoon-library { max-width: 1440px; margin: 24px auto 0; padding: clamp(20px, 2.6vw, 34px); border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
.library-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.library-heading h2 { margin: 4px 0 5px; font: 700 clamp(30px, 3vw, 42px)/1 "Fraunces", serif; letter-spacing: -.035em; }
.library-heading p { max-width: 560px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.library-count { flex: 0 0 auto; padding: 7px 11px; border-radius: 99px; color: var(--purple-dark); background: var(--purple-soft); font-size: 11px; font-weight: 800; }
.cartoon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 20px; }
.cartoon-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--field); transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.cartoon-card:hover { border-color: color-mix(in srgb, var(--purple) 42%, var(--line)); box-shadow: 0 14px 34px rgba(39,31,51,.1); transform: translateY(-2px); }
.cartoon-cover { position: relative; width: 100%; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; padding: 0; border: 0; color: #fff; background: var(--cover-bg); cursor: pointer; }
.cartoon-cover::after { content: ""; position: absolute; inset: 52% 0 0; background: linear-gradient(transparent, rgba(20,16,27,.58)); pointer-events: none; }
.cartoon-cover > img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.cartoon-card:hover .cartoon-cover > img { transform: scale(1.025); }
.cartoon-cover > span:not(.cartoon-status) { font: 700 72px/1 "Fraunces", serif; text-shadow: 0 7px 18px rgba(20,16,27,.22); }
.cartoon-cover:focus-visible { outline: 4px solid var(--purple); outline-offset: -4px; }
.cartoon-status { position: absolute; z-index: 1; left: 13px; bottom: 12px; padding: 5px 8px; border-radius: 99px; background: rgba(22,18,28,.48); backdrop-filter: blur(8px); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.cartoon-card-body { display: flex; min-height: 210px; flex-direction: column; padding: 18px; }
.cartoon-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cartoon-card-title h3 { min-width: 0; margin: 0; font: 700 22px/1.08 "Fraunces", serif; overflow-wrap: anywhere; }
.cartoon-card-title > span { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-weight: 800; }
.cartoon-meta { margin: 7px 0 13px; color: var(--muted); font-size: 10px; font-weight: 700; }
.cartoon-excerpt { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.cartoon-card-footer { display: flex; align-items: flex-end; justify-content: flex-end; gap: 10px; margin-top: auto; padding-top: 18px; }
.cartoon-card-footer .button { flex: 0 0 auto; padding: 8px 10px; font-size: 10px; }
.cartoon-card-footer .button-danger { margin-right: auto; }
.library-empty { display: grid; place-items: center; min-height: 300px; padding: 42px 20px; border: 1px dashed var(--line); border-radius: 17px; text-align: center; }
.library-empty > span { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; color: var(--purple); background: var(--purple-soft); font-size: 25px; }
.library-empty h3 { margin: 15px 0 5px; font: 700 25px "Fraunces", serif; }
.library-empty p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.lens-row { display: flex; align-items: center; gap: 14px; max-width: 1440px; margin: 0 auto 22px; }
.lens-row > span { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }
.lens-chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.lens-chips::-webkit-scrollbar { display: none; }
.lens-chips button { flex: 0 0 auto; padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.lens-chips button:hover, .lens-chips button.active { color: var(--purple-dark); border-color: rgba(118,87,214,.42); background: var(--purple-soft); }
.lens-chips button:focus-visible, .story-node:focus-visible { outline: 3px solid rgba(118,87,214,.28); outline-offset: 3px; }
.atlas-board { display: grid; grid-template-columns: minmax(540px, 1fr) minmax(360px, 390px); min-height: 620px; max-width: 1440px; margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
.story-graph { min-width: 0; display: grid; grid-template-rows: auto minmax(480px, 1fr) auto; padding: 22px 22px 16px; background: radial-gradient(circle at 30% 20%, rgba(246,201,107,.13), transparent 22%), radial-gradient(circle at 72% 66%, rgba(118,87,214,.12), transparent 28%), var(--field); }
.graph-caption { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 0 4px 13px; }
.graph-caption > div { display: grid; gap: 2px; }
.graph-caption strong { font: 600 17px "Fraunces", serif; }
.graph-caption span, .graph-caption small { color: var(--muted); font-size: 11px; }
.graph-canvas { position: relative; min-height: 500px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--line) 72%, transparent); border-radius: 18px; cursor: grab; touch-action: none; user-select: none; }
.graph-canvas.dragging { cursor: grabbing; }
.graph-viewport { position: absolute; width: 115%; height: 115%; left: -7.5%; top: -7.5%; background-image: radial-gradient(circle, color-mix(in srgb, var(--muted) 25%, transparent) 1px, transparent 1px); background-size: 23px 23px; transform-origin: center; transition: transform .12s ease-out; will-change: transform; }
.graph-canvas.dragging .graph-viewport { transition: none; }
.graph-viewport::before { content: ""; position: absolute; width: 300px; height: 300px; left: 25%; top: 17%; border: 1px solid rgba(118,87,214,.09); border-radius: 50%; }
.graph-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.graph-line { vector-effect: non-scaling-stroke; stroke-width: 1.4; opacity: .5; transition: opacity .2s; }
.graph-line.theme { stroke: var(--coral); stroke-dasharray: 3 3; }
.graph-line.character { stroke: var(--gold); stroke-width: 2; }
.graph-line.lineage { stroke: var(--purple); }
.graph-line.place { stroke: var(--green); stroke-dasharray: 1 3; }
.graph-line.dimmed { opacity: .06; }
.story-node { position: absolute; left: var(--x); top: var(--y); width: var(--size); height: var(--size); padding: 0; border: 4px solid var(--card); border-radius: 50%; color: #fff; background: var(--node-bg); box-shadow: 0 8px 22px rgba(37,32,46,.2), 0 0 0 1px var(--line); cursor: pointer; transform: translate(-50%,-50%); transition: transform .22s ease, opacity .22s ease, filter .22s ease; }
.story-node:hover, .story-node.active { z-index: 2; transform: translate(-50%,-50%) scale(1.1); }
.story-node.active { box-shadow: 0 10px 30px rgba(118,87,214,.3), 0 0 0 3px var(--purple); }
.story-node.dimmed { opacity: .12; filter: grayscale(1); pointer-events: none; }
.story-node-art { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; border-radius: inherit; font-size: calc(var(--size) * .38); text-shadow: 0 2px 5px rgba(0,0,0,.14); }
.story-node-art::after { content: ""; position: absolute; left: -15%; right: -15%; bottom: -23%; height: 46%; border-radius: 50% 50% 0 0; background: rgba(27,23,34,.24); transform: rotate(-5deg); }
.story-node-image { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.story-node:has(.story-node-image) .story-node-art::after { z-index: 2; height: 30%; background: linear-gradient(transparent, rgba(20,16,27,.5)); }
.story-node-label { position: absolute; left: 50%; top: calc(100% + 8px); width: max-content; max-width: 155px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: color-mix(in srgb, var(--card) 94%, transparent); box-shadow: 0 4px 13px rgba(39,31,51,.08); line-height: 1.2; transform: translateX(-50%); }
.story-node-label strong { display: block; font-size: 10px; font-weight: 800; }
.story-node-label small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; font-weight: 700; }
.graph-empty { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; margin: 0; color: var(--muted); background: color-mix(in srgb, var(--field) 88%, transparent); text-align: center; }
.graph-controls { position: absolute; z-index: 5; right: 12px; top: 12px; display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: 0 5px 16px rgba(39,31,51,.1); }
.graph-controls button { min-width: 34px; height: 32px; padding: 0 9px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 13px; font-weight: 800; }
.graph-controls button:last-child { border-right: 0; }
.graph-controls button:hover, .graph-controls button:focus-visible { color: var(--purple-dark); background: var(--purple-soft); }
.graph-drag-hint { position: absolute; z-index: 3; left: 12px; bottom: 10px; padding: 4px 7px; border-radius: 7px; color: var(--muted); background: color-mix(in srgb, var(--card) 88%, transparent); pointer-events: none; font-size: 9px; }
.graph-key { display: flex; flex-wrap: wrap; gap: 18px; padding: 13px 4px 0; color: var(--muted); font-size: 10px; }
.graph-key span { display: flex; align-items: center; gap: 6px; }
.graph-key b { font: inherit; }
.graph-key span.inactive { opacity: .28; }
.graph-key i { width: 19px; height: 2px; display: inline-block; background: var(--coral); }
.graph-key .key-style { background: var(--gold); }
.graph-key .key-lineage { background: var(--purple); }
.graph-key .key-place { background: var(--green); }
.story-inspector { position: relative; display: flex; flex-direction: column; padding: 22px; border-left: 1px solid var(--line); background: var(--card); }
.inspector-cover { position: relative; min-height: 190px; display: flex; align-items: flex-end; overflow: hidden; padding: 18px; border-radius: 17px; color: #fff; background: var(--cover-bg); }
.inspector-cover::before { content: ""; position: absolute; width: 140px; height: 140px; right: -20px; top: -35px; border: 1px solid rgba(255,255,255,.38); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255,255,255,.06), 0 0 0 56px rgba(255,255,255,.04); }
.cover-glyph { position: absolute; right: 27px; top: 39px; font-size: 70px; filter: drop-shadow(0 6px 7px rgba(0,0,0,.15)); }
.inspector-cover-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.inspector-cover:has(.inspector-cover-image)::after { content: ""; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent, rgba(20,16,27,.64)); }
.cover-origin { position: relative; z-index: 1; padding: 5px 8px; border-radius: 99px; background: rgba(22,18,28,.3); backdrop-filter: blur(6px); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.inspector-body { display: flex; flex: 1; flex-direction: column; padding: 19px 3px 2px; }
.inspector-body h2 { margin: 0 0 7px; font: 700 27px/1.05 "Fraunces", serif; letter-spacing: -.025em; }
.inspector-byline { margin: 0 0 16px; color: var(--muted); font-size: 11px; }
.inspector-description { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.58; white-space: pre-wrap; overflow-wrap: anywhere; }
.atlas-style-note { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); }
.atlas-style-note span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.atlas-style-note p { margin: 4px 0 0; font-size: 11px; line-height: 1.45; }
.connection-note { margin: 17px 0; padding: 12px; border-left: 3px solid var(--coral); border-radius: 0 9px 9px 0; background: var(--surface-warm); }
.connection-note > span { display: block; color: var(--coral); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.connection-note p { margin: 4px 0 0; font-size: 11px; line-height: 1.45; }
.connection-reasons { display: grid; gap: 7px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 10px; line-height: 1.4; }
.connection-reasons li { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 7px; align-items: start; }
.connection-reasons li > span { min-width: 0; overflow-wrap: anywhere; }
.connection-reasons .no-connection > span { grid-column: 1 / -1; color: var(--muted); }
.connection-dot { width: 7px; height: 7px; margin-top: 3px; border-radius: 50%; background: var(--coral); }
.connection-dot.character { background: var(--gold); }.connection-dot.lineage { background: var(--purple); }.connection-dot.place { background: var(--green); }
.story-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.story-tags span { padding: 5px 8px; border-radius: 99px; color: var(--purple-dark); background: var(--purple-soft); font-size: 10px; font-weight: 700; }
.inspector-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: auto; }
.inspector-actions .button { font-size: 12px; }
.missing-story { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 25px; max-width: 1440px; margin: 24px auto 0; padding: 23px 26px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(105deg, var(--surface-warm), var(--card)); }
.missing-story h2 { margin: 3px 0 5px; font: 700 24px "Fraunces", serif; }
.missing-story p { max-width: 760px; margin: 0; color: var(--muted); font-size: 12px; }
.missing-orbit { position: relative; width: 78px; height: 78px; display: grid; place-items: center; border: 1px dashed var(--purple); border-radius: 50%; color: var(--purple-dark); }
.missing-orbit span { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--purple-soft); font: 700 25px "Fraunces", serif; }
.missing-orbit i, .missing-orbit b { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); }
.missing-orbit i { right: -4px; top: 27px; }.missing-orbit b { left: 5px; top: 1px; background: var(--gold); }
.atlas-reader-cover { min-height: 235px; display: flex; align-items: flex-end; gap: 22px; margin: -28px -28px 24px; padding: 32px 34px; overflow: hidden; border-radius: 19px 19px 0 0; color: #fff; background: var(--cover-bg); }
.atlas-reader-cover > span { flex: 0 0 auto; font-size: 88px; filter: drop-shadow(0 7px 8px rgba(0,0,0,.14)); }
.atlas-reader-cover small { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.atlas-reader-cover h2 { margin: 5px 0 2px; color: #fff; font-size: 37px; }
.atlas-reader-cover p { margin: 0; color: rgba(255,255,255,.8); font-size: 12px; }
.atlas-reader-body > p:first-child { font: 600 18px/1.65 "Fraunces", serif; }
.provenance-note { padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.55; }

@media (max-width: 1080px) {
  .atlas-board { grid-template-columns: minmax(460px, 1fr) 350px; }
  .atlas-intro { grid-template-columns: 1.1fr .9fr; }
}
@media (max-width: 900px) {
  .atlas-board { grid-template-columns: 1fr; }
  .story-inspector { min-height: 410px; border-top: 1px solid var(--line); border-left: 0; }
  .inspector-cover { min-height: 220px; }
}
@media (max-width: 820px) {
  .atlas-home { padding-top: 35px; }
  .atlas-intro { grid-template-columns: 1fr; gap: 22px; }
  .atlas-intro-copy p { max-width: 650px; }
  .atlas-toolbar { grid-template-columns: 1fr auto; }
  .atlas-search { grid-column: 1 / -1; min-height: 44px; border-right: 0; border-bottom: 1px solid var(--line); }
  .missing-story { grid-template-columns: 80px 1fr; }
  .missing-story .button { grid-column: 2; justify-self: start; }
}
@media (max-width: 560px) {
  .atlas-home { padding: 27px 14px 50px; }
  .atlas-intro h1 { font-size: 48px; }
  .atlas-toolbar { grid-template-columns: 1fr; }
  .atlas-country { min-height: 42px; }
  .atlas-toolbar > .button { width: 100%; }
  .library-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .cartoon-library { padding: 18px; border-radius: 19px; }
  .lens-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .lens-chips { width: 100%; }
  .story-graph { min-height: 520px; padding: 15px 10px 12px; }
  .graph-canvas { min-height: 440px; }
  .story-node-label { max-width: 92px; white-space: normal; }
  .graph-key { gap: 10px; }
  .story-inspector { padding: 15px; }
  .missing-story { grid-template-columns: 1fr; padding: 20px; }
  .missing-story .button { grid-column: 1; }
}

.director-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border-left: 1px solid var(--line);
  background: var(--card);
}
.director-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--card);
}
.director-chat-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px 12px;
  min-width: 0;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.director-heading { min-width: 0; }
.director-heading strong { display: block; font: 700 18px "Fraunces", serif; }
.director-heading small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.director-views { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-chip); }
.director-view-tab {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 600 12px inherit;
  cursor: pointer;
}
.director-view-tab[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.director-view-tab:disabled { opacity: .45; cursor: not-allowed; }
.director-view-tab:focus-visible { outline: 3px solid rgba(118, 87, 214, .35); outline-offset: 2px; }
.director-body { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; min-height: 0; flex: 1; padding: 14px 16px 16px; overflow: hidden; }
.director-body.director-new { grid-template-rows: minmax(0, 1fr); overflow: auto; }
.director-log { display: grid; align-content: start; gap: 10px; min-height: 0; overflow: auto; }
.director-message { padding: 10px 12px; border-radius: 12px; background: var(--surface-chip); overflow-wrap: anywhere; }
.director-message.user { background: var(--purple-soft); }
.director-message .director-role { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.director-message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.director-proposal-card { display: grid; gap: 9px; box-shadow: inset 0 0 0 1px var(--line); }
.director-proposal-card p { margin: 0; }
.director-proposal-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.director-proposal-card .button { justify-self: start; }
.director-proposal-card small { color: var(--muted); font-size: 11px; }

.director-auto-flow, .director-execution-plan ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.director-auto-flow { margin-bottom: 16px; }
.director-auto-flow li, .director-execution-plan li { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); }
.director-auto-flow li > b, .director-execution-plan li > b { display: grid; flex: 0 0 25px; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--surface-chip); color: var(--muted); font-size: 11px; }
.director-auto-flow li.active > b, .director-execution-plan li > b { background: var(--purple-soft); color: var(--purple-dark); }
.director-auto-flow li > span, .director-execution-plan li > span { display: grid; min-width: 0; gap: 1px; }
.director-auto-flow strong, .director-execution-plan strong { color: var(--ink); font-size: 11px; }
.director-auto-flow small, .director-execution-plan small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.director-execution-plan { display: grid; gap: 10px; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-banner); }
.director-execution-plan > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.director-execution-plan > header > span { display: grid; gap: 1px; }
.director-execution-plan > header > b { color: var(--purple-dark); font-size: 13px; }
.director-execution-plan ol { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.director-review { display: grid; gap: 11px; }
.director-action { padding: 0; overflow: hidden; }
.director-action-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 17px; cursor: pointer; list-style: none; }
.director-action-head::-webkit-details-marker, .director-scene-draft summary::-webkit-details-marker { display: none; }
.director-action-head > span:first-child { display: grid; min-width: 0; gap: 2px; }
.director-action-head > .director-action-character { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 11px; }
.director-action-character > span { display: grid; min-width: 0; gap: 2px; }
.director-action-character-image, .director-character-placeholder { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--purple-soft); object-fit: cover; color: var(--purple-dark); font: 700 18px "Fraunces", serif; }
.director-action-step { color: var(--purple-dark); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.director-action-head strong { font: 700 17px "Fraunces", serif; letter-spacing: -.01em; overflow-wrap: anywhere; }
.director-action-head small { color: var(--muted); font-size: 11px; }
.director-action-body { padding: 0 17px 16px; border-top: 1px solid var(--line); }
.director-action .approval-banner { margin: 11px 0; padding: 10px 12px; }
.director-action .approval-banner strong { font-size: 11px; }
.director-action .approval-banner span { font-size: 11px; line-height: 1.4; }
.director-disclosure { flex: 0 0 9px; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .16s ease; }
.director-action[open] > .director-action-head .director-disclosure, .director-scene-draft[open] > summary .director-disclosure { transform: rotate(225deg); }
.director-removal-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; padding: 0; list-style: none; }
.director-removal-list li { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--field); color: var(--ink); font-size: 11px; font-weight: 700; }
.director-patch-fields { display: grid; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 8px; }
.director-character-comparison { display: grid; gap: 12px; margin-top: 13px; }
.director-character-comparison > header { display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: center; gap: 12px; }
.director-character-current-image { display: grid; place-items: center; width: 68px; height: 68px; border: 1px solid var(--line); border-radius: 15px; background: var(--purple-soft); object-fit: cover; color: var(--purple-dark); font: 700 23px "Fraunces", serif; }
.director-character-comparison > header > span { display: grid; gap: 1px; }
.director-character-comparison > header small, .director-character-comparison > header > span > span { color: var(--muted); font-size: 10px; }
.director-character-comparison > header strong { font: 700 18px "Fraunces", serif; }
.director-character-change-list { display: grid; gap: 9px; }
.director-character-change-row { display: grid; gap: 7px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); }
.director-character-change-row > strong { font-size: 11px; }
.director-character-change-values { display: grid; grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); align-items: stretch; gap: 8px; }
.director-character-change-values > div, .director-character-change-values > label { display: grid; align-content: start; gap: 5px; min-width: 0; margin: 0; padding: 9px; border-radius: 9px; background: var(--card); }
.director-character-change-values span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.director-character-change-values p { margin: 0; color: var(--ink); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.director-character-change-values input, .director-character-change-values textarea { width: 100%; min-width: 0; margin: 0; }
.director-character-change-values textarea { resize: vertical; }
.director-change-arrow { display: grid; place-items: center; color: var(--purple-dark) !important; font-size: 17px !important; }
.director-character-comparison > p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.director-preview { width: 100%; border-radius: 10px; margin: 8px 0 6px; background: #000; }
.director-patch-summary { display: grid; gap: 7px; margin: 0 0 8px; }
.director-patch-summary > div { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.director-patch-summary dt { color: var(--muted); font-size: 12px; }
.director-patch-summary dd { margin: 0; font-size: 13px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.director-placement { display: grid; gap: 10px; margin: 13px 0; padding: 13px; border: 1px solid color-mix(in srgb, var(--purple) 30%, var(--line)); border-radius: 13px; background: color-mix(in srgb, var(--purple-soft) 48%, var(--card)); }
.director-placement header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.director-placement header > span { display: grid; gap: 2px; }
.director-placement header strong { color: var(--ink); font: 700 16px "Fraunces", serif; }
.director-placement header small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.director-placement header > b { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; color: var(--purple-dark); background: var(--purple-soft); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.director-placement-track { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(92px, .72fr) auto minmax(0, 1fr); align-items: stretch; gap: 7px; }
.director-placement-track > span { display: grid; align-content: center; min-width: 0; gap: 2px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.director-placement-track > i { align-self: center; color: var(--purple-dark); font-style: normal; }
.director-placement-track small { color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.director-placement-track strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.director-placement-track .director-placement-new { border-color: var(--purple); background: var(--purple-soft); text-align: center; }
.director-placement-edge { color: var(--muted); font-size: 10px; font-weight: 700; text-align: center; }
.director-drafts-heading { display: grid; gap: 2px; margin: 16px 0 8px; }
.director-drafts-heading strong { font-size: 12px; }
.director-drafts-heading small { color: var(--muted); font-size: 10px; font-weight: 500; }
.director-drafts { display: grid; gap: 7px; }
.director-scene-draft { border: 1px solid var(--line); border-radius: 13px; background: var(--field); }
.director-scene-draft summary { display: grid; grid-template-columns: 25px minmax(0, 1fr) 9px; align-items: center; gap: 9px; padding: 10px 12px; cursor: pointer; list-style: none; }
.director-scene-draft[open] summary { border-bottom: 1px solid var(--line); }
.director-draft-index { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: var(--purple-dark); background: var(--purple-soft); font-size: 10px; font-weight: 800; }
.director-draft-summary { display: grid; min-width: 0; gap: 1px; }
.director-draft-summary .director-draft-position { color: var(--purple-dark); font-size: 8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.director-draft-summary strong { min-width: 0; font: 700 14px "Fraunces", serif; overflow-wrap: anywhere; }
.director-draft-summary small { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.director-draft-fields { display: grid; grid-template-columns: minmax(0, 2fr) 120px; gap: 11px; padding: 12px; }
.director-draft-fields textarea { min-height: 68px; }
.director-draft-wide { grid-column: 1 / -1; }
.director-generate-after { margin-top: 11px; padding: 11px 14px; border-radius: 13px; background: var(--surface-banner); }
.director-generate-after span { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 13px; }
.director-regeneration-scope { display: grid; gap: 9px; margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.4; }
.director-regeneration-scope header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.director-regeneration-scope header > span { display: grid; gap: 1px; }
.director-regeneration-scope header strong { color: var(--ink); font-size: 12px; }
.director-regeneration-scope header small { color: var(--muted); font-size: 10px; }
.director-regeneration-scope header b { flex: 0 0 auto; color: var(--purple-dark); font-size: 13px; }
.director-regeneration-scenes { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 8px; }
.director-regeneration-scene { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 8px; min-width: 0; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.director-regeneration-scene img, .director-scene-thumb-placeholder { display: grid; place-items: center; width: 52px; height: 42px; border-radius: 7px; background: var(--surface-chip); object-fit: cover; color: var(--muted); font-size: 8px; text-align: center; }
.director-regeneration-scene > span { display: grid; min-width: 0; gap: 2px; }
.director-regeneration-scene strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.director-regeneration-scene small { color: var(--muted); font-size: 9px; }
.director-regeneration-scope footer { color: var(--muted); font-size: 10px; }
.director-generate-after small { color: var(--muted); font-size: 11px; font-weight: 500; }
@media (max-width: 650px) {
  .director-draft-fields { grid-template-columns: 1fr; }
  .director-placement-track { grid-template-columns: 1fr; }
  .director-placement-track > i { justify-self: center; transform: rotate(90deg); }
  .director-regeneration-scenes { grid-template-columns: 1fr; }
  .director-character-change-values { grid-template-columns: 1fr; }
  .director-change-arrow { transform: rotate(90deg); }
}
.director-form { display: grid; gap: 8px; }
.director-form textarea { width: 100%; min-height: 72px; resize: vertical; }
.director-form .form-actions { margin: 0; justify-content: flex-end; }

.director-new-form { display: grid; gap: 14px; align-content: start; }
.director-new-form .field-grid { gap: 13px; }
.director-new-form textarea { width: 100%; resize: vertical; min-height: 88px; }
.director-new-form .form-actions { margin: 0; }
.director-new-form summary { color: var(--purple-dark); cursor: pointer; font-size: 11px; font-weight: 800; }
.director-new-form details > .field-grid { margin-top: 12px; }
.director-story-treatment { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
.director-story-treatment.hidden { display: none; }
.director-story-treatment legend { grid-column: 1 / -1; margin-bottom: 1px; color: var(--muted); font-size: 11px; font-weight: 800; }
.director-story-treatment label { position: relative; display: block; cursor: pointer; }
.director-story-treatment input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.director-story-treatment label > span { display: grid; height: 100%; gap: 3px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.director-story-treatment strong { color: var(--ink); font-size: 11px; }
.director-story-treatment small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.director-story-treatment input:checked + span { border-color: var(--purple); background: var(--purple-soft); box-shadow: 0 0 0 2px rgba(118, 87, 214, .08); }
.director-story-treatment input:focus-visible + span { outline: 3px solid rgba(118, 87, 214, .28); outline-offset: 2px; }
.visual-style-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.visual-style-field legend { color: var(--muted); font-size: 12px; font-weight: 700; }
.visual-style-field > p { margin: 4px 0 9px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.visual-style-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.visual-style-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--card); cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.visual-style-card:hover { transform: translateY(-1px); border-color: var(--purple); }
.visual-style-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.visual-style-card:has(input:checked) { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(118, 87, 214, .15); }
.visual-style-card:has(input:focus-visible) { outline: 3px solid rgba(118, 87, 214, .28); outline-offset: 2px; }
.visual-style-preview { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--purple-soft); }
.visual-style-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.visual-style-name { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 8px 9px; }
.visual-style-name b { min-width: 0; overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.visual-style-name small { flex: none; padding: 2px 6px; border-radius: 99px; color: var(--purple-dark); background: var(--purple-soft); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.director-smart-hint { display: flex; align-items: center; gap: 7px; }
.director-smart-hint::before { content: ''; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.director-smart-hint[data-mode="idea"]::before { background: var(--purple); }
.director-smart-hint[data-mode="story"]::before { background: var(--green); }
.director-length > span { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.director-length output { color: var(--purple-dark); font-size: 12px; font-weight: 800; }
.director-length input[type="range"] { width: 100%; margin: 5px 0 1px; accent-color: var(--purple); }
.director-mix-details { border: 1px solid var(--line); border-radius: 13px; background: var(--field); overflow: hidden; }
.director-mix-details > summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto; align-items: center; gap: 8px 12px; padding: 13px 16px; list-style: none; }
.director-mix-details > summary::-webkit-details-marker { display: none; }
.director-mix-details > summary::after { content: "⌄"; font-size: 14px; line-height: 1; transition: transform .2s; }
.director-mix-details[open] > summary::after { transform: rotate(180deg); }
.director-mix-details > summary span, .director-mix-details > summary strong { min-width: 0; overflow-wrap: anywhere; }
.director-mix-details > summary strong { color: var(--muted); font-size: 11px; line-height: 1.35; text-align: right; }
.director-mix-details[open] > summary { border-bottom: 1px solid var(--line); }

.director-mix { display: grid; min-width: 0; gap: 9px; padding: 14px 16px; background: var(--surface-banner); }
.director-mix > * { min-width: 0; }
.director-finish-options { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.director-finish-options legend { margin-bottom: 2px; color: var(--ink); font-size: 12px; font-weight: 800; }
.director-finish-choice { position: relative; display: block; cursor: pointer; }
.director-finish-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.director-finish-choice > span { display: grid; gap: 2px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.director-finish-choice strong { color: var(--ink); font-size: 12px; }
.director-finish-choice small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.director-finish-choice b { margin-top: 4px; color: var(--purple-dark); font-size: 10px; }
.director-finish-choice input:checked + span { border-color: var(--purple); background: var(--purple-soft); box-shadow: 0 0 0 2px rgba(118, 87, 214, .1); }
.director-finish-choice input:focus-visible + span { outline: 3px solid rgba(118, 87, 214, .28); outline-offset: 2px; }
.director-mix > small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }

.plan-estimate { display: grid; gap: 9px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--field); }
.plan-estimate-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: baseline; gap: 12px; }
.plan-estimate-head > div:last-child { padding-left: 12px; border-left: 1px solid var(--line); }
.plan-estimate-head strong { font: 700 20px "Fraunces", serif; }
.plan-estimate-head small { display: block; color: var(--muted); font-size: 11px; }
.plan-estimate-lines { display: grid; gap: 5px; margin: 0; }
.plan-estimate-lines > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.plan-estimate-lines dt { color: var(--muted); font-size: 12px; }
.plan-estimate-lines dd { margin: 0; font-size: 12px; font-weight: 600; }
.plan-estimate > small { color: var(--muted); font-size: 11px; line-height: 1.45; }

@media (max-width: 1180px) {
  .shell { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); }
  .shell .sidebar { display: none; }
  .atlas-shell { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); }
}
@media (max-width: 860px) {
  .shell, .atlas-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; height: auto; min-height: calc(100vh - 72px); min-height: calc(100dvh - 72px); }
  .director-toggle { display: inline-flex; align-items: center; }
  .director-pane {
    position: fixed;
    z-index: 25;
    inset: 72px 0 0 auto;
    width: min(100vw, 400px);
    height: calc(100vh - 72px);
    height: calc(100dvh - 72px);
    transform: translateX(100%);
    box-shadow: var(--shadow);
    transition: transform .2s ease;
  }
  .director-pane.open { transform: translateX(0); }
  .director-new-form .field-grid { grid-template-columns: 1fr; }
  .director-story-treatment { grid-template-columns: 1fr; }
  .director-auto-flow { grid-template-columns: 1fr; }
  .visual-style-field.span-two { grid-column: auto; }
  .story-beat { grid-template-columns: 31px minmax(0, 1fr); padding-inline: 10px 12px; }
}

@media (max-width: 390px) {
  .visual-style-grid { grid-template-columns: 1fr; }
}
.language-control{display:inline-flex;align-items:center;gap:.4rem;border:1px solid var(--line,#d8d3c8);border-radius:999px;padding:.2rem .55rem;background:var(--paper,#fff)}
.language-control select,.community-filters select{border:0;background:transparent;color:inherit;font:inherit;max-width:11rem}
.community-section{margin:1.5rem 0 2rem;padding:1.25rem;border:1px solid var(--line,#d8d3c8);border-radius:1.25rem;background:color-mix(in srgb,var(--paper,#fff) 92%,transparent)}
.community-heading{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1rem}.community-heading h2{margin:0}
.community-filters{display:flex;align-items:center;gap:.65rem}.community-filters>label:not(.language-control){border:1px solid var(--line,#d8d3c8);border-radius:999px;padding:.4rem .7rem}
.community-feed{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:1rem}
.community-card{overflow:hidden;border:1px solid var(--line,#d8d3c8);border-radius:1rem;background:var(--paper,#fff)}
.community-card img,.community-card .community-placeholder{display:block;width:100%;aspect-ratio:16/9;object-fit:cover;background:linear-gradient(135deg,#7767bd,#34466d)}
.community-card-body{padding:.85rem}.community-card h3{margin:0 0 .25rem;font-size:1rem}.community-card p{margin:.2rem 0 .75rem;font-size:.82rem;opacity:.72}
.community-card-actions{display:flex;flex-wrap:wrap;gap:.4rem}.community-card-actions button{font-size:.78rem}
.project-community-actions{margin-left:auto}
@media(max-width:760px){.top-actions .status-pill{display:none}.community-heading{align-items:flex-start;flex-direction:column}.community-filters{width:100%;flex-wrap:wrap}.language-control select{max-width:8rem}}
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 32px;
  color: var(--muted, #615f58);
  font-size: .9rem;
}

.site-footer nav { display: flex; gap: 18px; }
.site-footer a { color: inherit; }

@media (max-width: 620px) {
  .site-footer { align-items: flex-start; flex-direction: column; padding: 22px 20px; }
}
