:root {
  --ink: #e8eefc;
  --muted: #9aa6bf;
  --line: rgba(186, 206, 255, 0.18);
  --glass: rgba(10, 16, 28, 0.72);
  --card: rgba(16, 24, 40, 0.78);
  --blue: #4c8dff;
  --ok: #3dbe7a;
  --warn: #d7a15a;
  color-scheme: dark;
  font-family: Inter, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  color: var(--ink);
  position: relative;
  isolation: isolate;
  background: #05070d;
}
body::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: -10px;
  background: url("../images/background.png") center/cover no-repeat;
  filter: blur(7px);
  opacity: .88;
  transform: scale(1.02);
  pointer-events: none;
}
body::after { content: ""; position: fixed; z-index: 0; inset: 0; background: linear-gradient(115deg, rgba(5, 9, 18, .16), rgba(5, 9, 18, .28) 42%, rgba(5, 9, 18, .2)); pointer-events: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}
.sidebar { padding: 18px 8px; display: flex; flex-direction: column; align-items: center; }
.logo { margin: 6px 0 22px; font-weight: 700; letter-spacing: -0.04em; }
.nav {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 18px;
  padding: 12px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.nav.active, .nav:hover { color: white; background: rgba(76, 141, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(120, 170, 255, 0.35); }
.sidebar .nav[hidden] { display: none !important; }
.ico { width: 22px; height: 22px; display: grid; place-items: center; }
.ico svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; }

.login { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(420px, calc(100% - 32px)); padding: 28px; display: grid; gap: 12px; }
.login-card h1 { margin: 0; font-size: 28px; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.auth-switch button { border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); padding: 8px 12px; }
.auth-switch button.active { color: #111; background: #fff; border-color: #fff; }
.accounts-page { display: flex; flex-direction: column; gap: 14px; height: calc(100vh - 52px); min-height: 0; overflow: hidden; }
.code-bar { display: flex; align-items: end; gap: 8px; }
.code-bar label { margin: 0; }
.code-bar input { width: 88px; }
.account-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.code-drawer { flex: 0 1 auto; min-height: 0; border-top: 1px solid rgba(191,207,222,.22); padding-top: 10px; }
.code-drawer summary { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 4px; cursor: pointer; list-style: none; font-weight: 650; }
.code-drawer summary::-webkit-details-marker { display: none; }
.code-drawer summary svg { width: 14px; height: 14px; fill: currentColor; transition: transform .16s ease; }
.code-drawer[open] summary svg { transform: rotate(90deg); }
.code-drawer .code-count { color: var(--muted); font-size: 13px; font-weight: 450; }
.code-drawer[open] { display: flex; flex-direction: column; max-height: min(42vh, 360px); }
.code-scroll { min-height: 0; overflow-y: auto; display: grid; gap: 8px; margin-top: 8px; padding-right: 4px; }
.code-row { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); }
.code-row > div, .code-row li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.code-row > div span, .code-row li, .code-row .sub { color: var(--muted); font-size: 13px; }
.code-row ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.code-row time { white-space: nowrap; }
.account-table { display: grid; }
.account-head, .account-summary { display: grid; grid-template-columns: 28px minmax(0, 1.8fr) minmax(88px, .7fr) minmax(88px, .6fr) minmax(96px, .7fr); gap: 12px; align-items: center; }
.account-summary strong, .account-summary span, .account-head span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-head { padding: 0 12px 8px; color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.account-block { border-top: 1px solid rgba(191,207,222,.22); }
.account-summary { width: 100%; padding: 14px 12px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.account-summary svg { width: 14px; height: 14px; fill: currentColor; transition: transform .16s ease; }
.account-summary[aria-expanded="true"] svg { transform: rotate(90deg); }
.account-panel { padding: 4px 12px 18px 40px; }
.account-controls, .password-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 12px; }
.account-controls label, .password-row label { margin: 0; min-width: 120px; }
.account-check { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.account-total { margin: 0 0 12px; font-weight: 650; }
.account-films { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 14px; }
.account-film { display: grid; gap: 6px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.account-film video { width: 100%; height: auto; display: block; object-fit: contain; background: #05080e; border-radius: 10px; }
.account-film[data-ratio="9:16"] video { aspect-ratio: 9 / 16; }
.account-film[data-ratio="16:9"] video { aspect-ratio: 16 / 9; }
.account-film[data-ratio="1:1"] video { aspect-ratio: 1; }
.account-film strong, .account-film span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-film span { color: var(--muted); font-size: 13px; }
.watch-dialog { width: max-content; max-width: calc(100% - 24px); margin: auto; padding: 18px; color: var(--ink); border-radius: 18px; background: linear-gradient(145deg, #182026, #0d141a); }
.watch-dialog video { display: block; width: auto; max-width: calc(100vw - 64px); background: #000; border-radius: 12px; object-fit: contain; }
.watch-dialog[data-ratio="9:16"] video { height: min(78vh, 760px); aspect-ratio: 9 / 16; }
.watch-dialog[data-ratio="16:9"] video { width: min(92vw, 1100px); height: auto; aspect-ratio: 16 / 9; }
.watch-dialog[data-ratio="1:1"] video { width: min(78vh, 720px); aspect-ratio: 1; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
input, textarea, select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 18, 0.55);
  padding: 12px 14px;
}
textarea { min-height: 92px; resize: vertical; }
.btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 10px 14px;
}
.btn.light { background: white; color: #111827; border-color: white; font-weight: 650; }
.btn.danger { color: #ffb4b4; }
.error { color: #ff9b9b; min-height: 1.2em; margin: 0; }
#main { min-width: 0; }
.page, .create-layout { width: 100%; }
.page { min-height: calc(100vh - 36px); padding: 22px; }
.page h1 { margin: 0 0 6px; font-size: 34px; }
.sub { color: var(--muted); margin: 0 0 18px; }

.create-layout { display: grid; grid-template-columns: minmax(300px, 25%) minmax(0, 1fr); gap: 12px; height: calc(100vh - 36px); min-height: 620px; }
.create-layout > #side { min-height: 0; overflow-y: auto; }
.panel { padding: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.preview-frame, .status-ring { border-radius: 22px; background: rgba(0,0,0,0.35); min-height: 180px; display: grid; place-items: center; position: relative; overflow: hidden; }
.status-ring { min-height: 245px; }
video { width: 100%; max-height: 520px; object-fit: cover; background: #142033; border-radius: 18px; }
.player { display: grid; gap: 8px; }
.changes-pending { display: grid; gap: 9px; padding: 12px; margin-bottom: 12px; border: 1px solid rgba(255,190,90,.4); border-radius: 10px; background: rgba(155,100,25,.14); font-size: 13px; }
.changes-pending p { margin: 0; }
.export { margin-top: 12px; width: 100%; }
.ring {
  width: 148px; height: 148px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(#4c8dff calc(var(--p) * 1%), rgba(255,255,255,0.08) 0);
}
.ring span { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: #121826; font-size: 28px; font-weight: 700; }
.steps { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; font-size: 13px; }
.steps li { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.steps li.completed { color: var(--ok); }
.steps li.running { color: #8eb6ff; }
.steps li.failed { color: #e7b0b0; }
.meta { display: grid; gap: 8px; font-size: 13px; color: var(--muted); margin-top: 12px; }
.meta div { display: flex; justify-content: space-between; gap: 12px; }
.meta b { color: var(--ink); font-weight: 600; text-align: right; }
.actions { display: flex; gap: 8px; }
.prompt {
  border-radius: 18px; padding: 14px 16px; background: rgba(255,255,255,0.03);
  border: 1px solid var(--line); white-space: pre-wrap; color: #d5def2; line-height: 1.45;
}
.brief { margin-top: 8px; }
.brief summary, .scene-detail summary, .tech summary { cursor: pointer; color: var(--muted); }
.brief .prompt { max-height: 7.5em; overflow: auto; margin-top: 8px; }
.title-row, .head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.title-row h1 { font-size: clamp(21px, 2vw, 30px); margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-heading { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.project-heading .rename-btn { flex: 0 0 auto; }
.title-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.workspace-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.workspace-intro { flex: 0 0 auto; }
.workspace-scenes { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.hermes-wait, .hermes-reply { margin: 0 0 8px; white-space: pre-wrap; }
.tech pre { white-space: pre-wrap; font-size: 12px; margin: 6px 0 0; color: var(--muted); }
.scene-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.scene-kicker { margin-top: 4px; }
.scene-detail { margin-top: 6px; font-size: 12px; }
.scene-detail p, .script { margin: 6px 0 0; color: var(--ink); white-space: pre-wrap; }
.badge { border-radius: 999px; padding: 6px 10px; background: rgba(76,141,255,0.18); color: #b9d2ff; font-size: 13px; }
.composer { display: flex; gap: 8px; align-items: center; margin: 8px 0; position: relative; }
.composer input { flex: 1; border-radius: 999px; }
#chat-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "plus field send" "hint hint hint";
  align-items: end;
  gap: 8px;
}
#chat-form .plus { grid-area: plus; }
#chat-form textarea {
  grid-area: field;
  min-height: 72px;
  max-height: 200px;
  border-radius: 18px;
  line-height: 1.4;
  resize: vertical;
  white-space: pre-wrap;
  overflow: auto;
}
#chat-form button[type="submit"] { grid-area: send; }
#chat-form .composer-hint { grid-area: hint; position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.plus { width: 42px; height: 42px; border-radius: 50%; background: rgba(76,141,255,0.22); border-color: rgba(142,182,255,0.7); font-size: 22px; line-height: 1; }
.menu {
  position: absolute; left: 0; top: 52px; width: 280px; padding: 8px; z-index: 3;
}
.menu button { width: 100%; text-align: left; background: transparent; border: 0; border-radius: 12px; padding: 10px; }
.menu button:hover { background: rgba(255,255,255,0.05); }
.menu small { display: block; color: var(--muted); }
.debug-dock { margin-top: 16px; padding: 16px; }
.debug-dock pre { white-space: pre-wrap; font-size: 12px; max-height: 220px; overflow: auto; background: rgba(0,0,0,0.25); border-radius: 12px; padding: 10px; }
.debug-dock form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 8px 0; }
.debug-dock h3 { margin: 14px 0 6px; font-size: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { border-radius: 999px; padding: 4px 8px; background: rgba(76,141,255,0.16); font-size: 12px; }
.scenes-head { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-content: start; }
.scene, .add-scene, .char, .add-char {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px; min-height: 0; position: relative;
}
.scene .menu { top: 36px; right: 8px; left: auto; width: 190px; }
.scene header, .char header { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.scene h3, .char h3 { margin: 8px 0 4px; font-size: 15px; }
.scene p, .char p { margin: 0; color: var(--muted); font-size: 13px; }
.thumb {
  width: 100%; height: clamp(80px, 7vw, 126px); object-fit: cover; border-radius: 12px; background: linear-gradient(160deg, #243044, #101722);
  margin-bottom: 8px;
}
.scene-visual { position: relative; }
.reference-label { position: absolute; left: 7px; bottom: 15px; border-radius: 7px; padding: 3px 6px; background: rgba(5, 8, 16, 0.78); color: #dce7ff; font-size: 11px; }
.scene h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-purpose { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene .scene-kicker { margin-top: 5px; color: #a9c5ff; font-size: 12px; }
.add-scene, .add-char { display: grid; place-items: center; text-align: center; color: var(--muted); border-style: dashed; }
.library-row, .voice {
  display: grid; grid-template-columns: 120px 1fr auto auto; gap: 12px; align-items: center;
  padding: 10px; border-radius: 16px; background: rgba(255,255,255,0.03); margin-bottom: 8px;
}
.voice { grid-template-columns: auto 1fr auto; }
.pill { border-radius: 999px; padding: 4px 8px; font-size: 12px; background: rgba(61,190,122,0.15); color: #8ee0b4; }
.pill.busy { background: rgba(76,141,255,0.18); color: #b9d2ff; }
.pill.draft { background: rgba(255,255,255,0.06); color: var(--muted); }
.providers, .defaults { display: grid; gap: 10px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.key-row { display: grid; grid-template-columns: 180px 1fr auto; gap: 8px; align-items: center; }
.key-row input { letter-spacing: 0.12em; }
.char-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.style-picks { display: flex; gap: 8px; }
.style-picks button.selected { box-shadow: inset 0 0 0 1px #8eb6ff; }
.wizard { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr); gap: 14px; }
.wizard-shots { display: flex; flex-wrap: wrap; gap: 8px; }
.wizard-shots .ph { width: 88px; height: 88px; object-fit: cover; border-radius: 14px; background: linear-gradient(160deg, #243044, #101722); }
.steps-top { display: flex; gap: 18px; color: var(--muted); margin-bottom: 14px; }
.steps-top .on { color: white; }
.note { font-size: 12px; color: var(--muted); text-align: right; }

.start-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.prompt-box { display: grid; gap: 10px; min-width: 0; }
.start-composer { margin: 0; }
.sub.inline { margin: 0; }
.project-meta { margin: 8px 0 0; }
.field-label { margin: 0; color: var(--muted); font-size: 14px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); padding: 8px; }
.seg button.selected { box-shadow: inset 0 0 0 1px #8eb6ff; background: rgba(76,141,255,0.18); }
.notice { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); }
.notice span { color: var(--muted); font-size: 13px; }
.media-row { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.media-card {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  width: min(280px, 100%); padding: 6px; border-radius: 16px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
}
.media-card .ph { width: 56px; height: 56px; margin: 0; max-height: 56px; border-radius: 12px; object-fit: cover; background: linear-gradient(160deg, #243044, #101722); }
.media-card strong, .media-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card span { color: var(--muted); font-size: 12px; }
.media-card .remove { width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); }
.char { display: grid; gap: 6px; align-content: start; min-height: 0; }
.char .avatar { width: 100%; height: 112px; object-fit: cover; border-radius: 14px; background: linear-gradient(160deg, #243044, #101722); }
.char .quiet { font-size: 11px; letter-spacing: 0.02em; }
.char p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.char .voice { color: #b9d2ff; font-size: 12px; -webkit-line-clamp: 1; }
.char-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.char-actions .btn { padding: 6px 10px; }
.library-row > div { min-width: 0; }
.library-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-row .thumb, img.thumb, video.thumb { width: 120px; height: 72px; object-fit: cover; margin: 0; }
.pill.failed { background: rgba(255, 120, 120, 0.12); color: #e7b0b0; }
.debug-list { margin-top: 14px; }
.debug-list summary, .advanced summary { cursor: pointer; color: var(--muted); }
.advanced { margin-top: 12px; }

/* Framepilot visual system, tuned to the supplied glass-and-navy references. */
:root {
  --ink: #eef3ff;
  --muted: #9eacc3;
  --line: rgba(195, 207, 222, .24);
  --glass: rgba(9, 15, 20, .8);
  --card: rgba(13, 20, 27, .84);
  --blue: #5ca7ff;
  --ok: #54dc91;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}
body { background-color: #080b10; }
.shell { grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 26px 20px; min-height: 100vh; }
.sidebar, .page, .panel, .workspace-intro, .workspace-scenes { background: linear-gradient(145deg, rgba(12, 18, 23, .82), rgba(8, 13, 18, .8)); border-color: rgba(199, 211, 225, .31); box-shadow: 0 18px 52px rgba(0, 0, 0, .32), inset 0 1px rgba(255,255,255,.06); backdrop-filter: blur(28px) saturate(75%); }
.sidebar { height: calc(100vh - 26px); min-height: 0; position: sticky; top: 26px; border-radius: 16px; padding: 5px 6px 14px; align-items: center; overflow: hidden; background: linear-gradient(155deg, rgba(11,16,20,.9), rgba(8,13,17,.91)); border-color: rgba(190,205,219,.4); box-shadow: inset 0 1px rgba(255,255,255,.13), inset 0 0 18px rgba(145,185,225,.05), 0 12px 30px rgba(0,0,0,.3); backdrop-filter: blur(24px) saturate(75%); }
.sidebar .logo { flex: 0 0 72px; width: 116px; height: 72px; display: flex; align-items: center; justify-content: center; padding: 0; margin: 0 0 7px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.logo img { display: block; width: 100%; max-width: 100%; max-height: 42px; object-fit: contain; }
.sidebar .logo img { flex: 0 0 156px; width: 156px; max-width: none; max-height: 52px; transform: none; }
.login-card > .logo { display: flex; justify-content: center; margin: 0 auto 4px; width: min(220px, 100%); }
.sidebar nav { flex: none; width: 100%; height: auto; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 14px; }
.sidebar .nav { flex: 0 0 102px; width: 116px; height: 102px; min-height: 102px; justify-content: center; padding: 12px 2px; gap: 7px; border: 1px solid transparent; border-radius: 12px; color: #f1f1f1; font-size: 16.5px; font-weight: 450; letter-spacing: 0; line-height: 1.25; text-shadow: 0 1px 3px rgba(255,255,255,.14); }
.sidebar .nav.active { justify-content: center; padding: 12px 2px; gap: 7px; color: #f6f8fc; background: linear-gradient(145deg, rgba(77,104,131,.47), rgba(42,58,74,.58)); border-color: rgba(148,208,255,.94); box-shadow: 0 0 0 1px rgba(195,226,255,.18), 0 0 18px rgba(83,173,255,.36), inset 0 0 16px rgba(205,230,255,.14), inset 0 1px rgba(255,255,255,.2); }
.sidebar .nav:hover:not(.active) { color: #fff; background: linear-gradient(145deg, rgba(77,104,131,.25), rgba(42,58,74,.25)); border-color: rgba(148,208,255,.62); box-shadow: 0 0 12px rgba(83,173,255,.2), inset 0 0 12px rgba(205,230,255,.08); }
.sidebar .nav.active:hover { background: linear-gradient(145deg, rgba(91,119,146,.58), rgba(47,65,82,.64)); }
.sidebar .ico, .sidebar .ico svg, .sidebar .ico img { width: 40px; height: 40px; }
.sidebar .nav:first-child .ico, .sidebar .nav:first-child .ico svg { width: 40px; height: 40px; }
.sidebar .ico svg { fill: currentColor; stroke: none; }
.sidebar .ico img { display: block; object-fit: contain; }
.sidebar .nav .ico, .sidebar .nav .nav-label { transition: filter .18s ease, color .18s ease, text-shadow .18s ease; }
.sidebar .nav:hover .ico, .sidebar .nav.active .ico { filter: drop-shadow(0 0 2px rgba(219,241,255,.55)) drop-shadow(0 0 5px rgba(105,190,255,.42)); }
.sidebar .nav:hover .nav-label, .sidebar .nav.active .nav-label { color: #fff; text-shadow: 0 0 3px rgba(224,243,255,.42), 0 0 8px rgba(105,190,255,.4); }
#main { min-width: 0; }
.page { min-height: calc(100vh - 52px); padding: 22px; border-radius: 16px; }
.page h1 { font-size: clamp(27px, 2.25vw, 38px); letter-spacing: -.035em; }
.sub { color: #aab8ce; line-height: 1.5; }
.btn { border-color: rgba(205, 221, 247, .37); border-radius: 11px; background: linear-gradient(155deg, rgba(229,239,255,.16), rgba(151,177,218,.055)); box-shadow: inset 0 1px rgba(255,255,255,.13), 0 5px 18px rgba(0,0,0,.12); backdrop-filter: blur(12px); transition: border-color .16s ease, transform .16s ease, background .16s ease, box-shadow .16s ease; }
.btn:hover { border-color: rgba(185, 213, 255, .72); background: linear-gradient(155deg, rgba(150,194,255,.24), rgba(95,143,214,.12)); box-shadow: inset 0 1px rgba(255,255,255,.18), 0 6px 20px rgba(52,108,190,.2); transform: translateY(-1px); }
.btn.light { color: #101a2a; background: linear-gradient(#fff, #e7edf8); border-color: #fff; box-shadow: 0 4px 14px rgba(180, 210, 255, .14); }
input, textarea, select { background: rgba(7, 13, 23, .55); border-color: rgba(184, 205, 238, .23); border-radius: 10px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: rgba(135, 185, 255, .8); box-shadow: 0 0 0 3px rgba(91, 151, 239, .13); }
.create-layout { grid-template-columns: minmax(330px, 25%) minmax(0, 1fr); gap: 12px; height: calc(100vh - 52px); min-height: 650px; }
.create-layout > #side { padding: 14px; border-radius: 16px; }
.workspace-main { gap: 12px; }
.workspace-intro, .workspace-scenes { border-radius: 16px; padding: 18px; }
.title-row h1 { font-size: clamp(24px, 2vw, 34px); }
.workspace-intro { position: relative; z-index: 2; padding: 25px 24px 23px; }
.workspace-intro #plus-menu { z-index: 20; border-color: rgba(191,207,222,.36); background: linear-gradient(145deg, rgba(19,27,34,.97), rgba(10,17,23,.97)); box-shadow: 0 16px 35px rgba(0,0,0,.4), inset 0 1px rgba(255,255,255,.08); }
.project-heading { gap: 12px; }
.project-heading .rename-btn { display: grid; place-items: center; width:34px; height:34px; padding: 5px; border: 0; border-radius: 9px; color: #f7faff; background: transparent; filter: drop-shadow(0 0 3px rgba(214,237,255,.2)); }
.project-heading .rename-btn:hover, .project-heading .rename-btn:focus-visible { color: #fff; background: rgba(161, 198, 239, .11); filter: drop-shadow(0 0 6px rgba(169,216,255,.64)); outline: none; }
.project-heading .rename-btn svg { width: 23px; height: 23px; fill: currentColor; }
.new-project-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 8px 17px; border-radius: 999px; font-size: 14px; white-space: nowrap; box-shadow: 0 0 15px rgba(149,200,255,.28), 0 4px 12px rgba(0,0,0,.18); }
.new-project-btn:hover, .new-project-btn:focus-visible { box-shadow: 0 0 20px rgba(149,200,255,.54), 0 4px 12px rgba(0,0,0,.2); }
.new-project-btn span { font-size: 23px; font-weight: 350; line-height: .8; }
.brief-fold { margin-top: 17px; }
.brief-toggle { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 0; border: 0; background: transparent; color: #d5deea; font-size: 13px; font-weight: 650; }
.brief-toggle svg { width: 14px; height: 14px; fill: currentColor; transition: transform .16s ease; }
.brief-fold.is-collapsed .brief-toggle svg { transform: rotate(-90deg); }
.brief-fold.is-collapsed .project-brief { display: none; }
.project-brief { margin-top: 0; max-height: 8.7em; overflow: auto; padding: 15px 17px; border-color: rgba(185, 203, 222, .32); border-radius: 15px; background: rgba(5, 10, 14, .62); color: #e2e7ef; font-size: 16px; line-height: 1.55; }
.scene-icon { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 999px; }
.scene-icon svg { width: 16px; height: 16px; fill: currentColor; }
.scene-icon[aria-pressed="true"] { color: #fff; border-color: rgba(156, 208, 255, .8); box-shadow: 0 0 12px rgba(125, 180, 239, .28); }
.workspace-intro #chips:empty { display: none; }
.workspace-intro #chips:not(:empty) { margin-top: 12px; }
.workspace-intro #chat-form { align-items: center; gap: 12px; margin: 21px 0 0; }
.workspace-intro #chat-form .plus { width: 55px; height: 55px; padding: 0 0 4px; border: 1px solid rgba(205,225,247,.55); border-radius: 50%; color: #fff; background: linear-gradient(145deg, rgba(67,84,103,.7), rgba(28,41,56,.8)); box-shadow: inset 0 1px rgba(255,255,255,.25), inset 0 0 11px rgba(214,235,255,.09), 0 0 11px rgba(138,190,246,.15); font-size: 39px; font-weight: 300; line-height: 1; }
.workspace-intro #chat-form .plus:hover, .workspace-intro #chat-form .plus:focus-visible { border-color: #c5e4ff; box-shadow: inset 0 1px rgba(255,255,255,.32), 0 0 15px rgba(138,190,246,.38); outline: none; }
.workspace-intro #chat-form textarea { height: 58px; min-height: 58px; max-height: 200px; padding: 16px 22px; border: 1px solid rgba(183,205,232,.47); border-radius: 30px; background: rgba(8,18,29,.64); box-shadow: inset 0 2px 8px rgba(0,0,0,.17); color: #f5f7fb; font-size: 16px; line-height: 24px; }
.workspace-intro #chat-form textarea::placeholder { color: #aeb8c7; opacity: 1; }
.workspace-intro #chat-form .chat-send { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 122px; height: 58px; padding: 0 20px; border: 1px solid rgba(194,225,255,.96); border-radius: 999px; background: linear-gradient(180deg, #fff, #e9f2ff); box-shadow: 0 0 15px rgba(118,188,255,.36), 0 5px 13px rgba(3,20,39,.22); font-size: 17px; }
.workspace-intro #chat-form .chat-send:hover, .workspace-intro #chat-form .chat-send:focus-visible { background: #fff; box-shadow: 0 0 20px rgba(118,188,255,.58), 0 5px 13px rgba(3,20,39,.23); }
.workspace-intro #chat-form .chat-send svg { width: 21px; height: 21px; fill: currentColor; }
.preview-frame, .status-ring { border-radius: 14px; background: rgba(5, 9, 16, .55); border: 1px solid rgba(205, 220, 243, .2); }
.preview-frame { min-height: 0; }
.player { min-height: 0; justify-items: center; }
.film-frame { position: relative; display: grid; place-items: center; width: min(100%, calc((100vh - 190px) * var(--preview-width-factor, .5625))); aspect-ratio: var(--preview-aspect, 9/16); overflow: hidden; border-radius: 11px; background: #03060c; }
.player video { display: block; width: 100%; height: 100%; max-height: none; object-fit: cover; background: #03060c; border-radius: inherit; cursor: pointer; }
.preview-play-overlay { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); display: grid; place-items: center; width: 72px; height: 72px; padding-left: 5px; border: 1px solid rgba(255,255,255,.7); border-radius: 50%; color: #fff; background: rgba(9,16,27,.68); backdrop-filter: blur(8px); font-size: 26px; box-shadow: 0 8px 28px rgba(0,0,0,.28); }
.preview-play-overlay:hover { background: rgba(67,119,191,.62); transform: translate(-50%,-50%) scale(1.04); }
.preview-play-overlay.is-hidden { display: none; }
.preview-controls { position: absolute; inset: auto 0 0; padding: 28px 12px 8px; color: #f7faff; background: linear-gradient(transparent, rgba(0, 0, 0, .84)); }
.preview-timeline { display: flex; gap: 3px; width: 100%; height: 12px; align-items: center; }
.preview-timeline-segment { position: relative; flex-basis: 0; height: 5px; min-width: 0; padding: 0; border: 0; border-radius: 3px; background: linear-gradient(to right, #e8f4ff var(--segment-progress), rgba(241, 247, 255, .46) var(--segment-progress)); cursor: pointer; transition: height .15s, background-color .15s; }
.preview-timeline-segment:hover, .preview-timeline-segment:focus-visible { height: 8px; outline: 1px solid rgba(255,255,255,.8); outline-offset: 2px; }
.preview-control-row { display: flex; align-items: center; min-height: 26px; gap: 9px; font-size: 12px; text-shadow: 0 1px 5px #000; }
.preview-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.preview-control-button { display: grid; place-items: center; width: 28px; height: 28px; padding: 4px; border: 0; background: transparent; color: #fff; filter: drop-shadow(0 0 3px rgba(225,240,255,.46)); }
.preview-control-button:hover, .preview-control-button:focus-visible { color: #d4eaff; filter: drop-shadow(0 0 6px rgba(184,221,255,.88)); }
.preview-control-button svg { width: 17px; height: 17px; fill: currentColor; }
.preview-control-button.is-muted { opacity: .5; }
.preview-fullscreen { margin-left: auto; }
.film-frame:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
.film-frame:fullscreen video { width: 100%; height: 100%; max-height: none; object-fit: contain; border-radius: 0; }
.film-frame:fullscreen .preview-controls { padding: 50px 24px 20px; }
.export { display: flex; align-items: center; justify-content: center; justify-self: stretch; gap: 10px; min-height: 56px; border-radius: 11px; border-color: rgba(210, 228, 250, .48); background: linear-gradient(135deg, rgba(42, 56, 73, .85), rgba(16, 25, 37, .88)); color: #f7faff; font-size: 17px; font-weight: 500; text-decoration: none; text-shadow: 0 0 6px rgba(213, 233, 255, .4); box-shadow: inset 0 1px rgba(255,255,255,.13), inset 0 0 16px rgba(178,210,247,.1), 0 0 12px rgba(125,180,239,.13); }
.export svg { width: 21px; height: 21px; fill: currentColor; filter: drop-shadow(0 0 4px rgba(207,231,255,.55)); }
.export:hover, .export:focus-visible { color: #fff; border-color: rgba(156, 208, 255, .8); box-shadow: inset 0 1px rgba(255,255,255,.17), inset 0 0 18px rgba(178,210,247,.17), 0 0 17px rgba(125,180,239,.32); }
.workspace-scenes { position: relative; z-index: 1; display: flex; flex-direction: column; }
.workspace-scenes.scene-menu-active { z-index: 3; }
.workspace-scenes .grid { position: relative; margin-top: 12px; gap: 14px var(--scene-col-gap, 44px); --scene-col-gap: 44px; padding: 6px 8px 10px; }
.scenes-head { margin-top: 0; }
.scenes-label { display: flex; align-items: center; gap: 11px; color: #f5f8fc; font-size: 17px; }
.scenes-label svg { width: 24px; height: 24px; fill: currentColor; filter: drop-shadow(0 0 4px rgba(203,227,250,.26)); }
.scenes-head .scene-generate { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 999px; color: #f7faff; font-size: 13px; font-weight: 600; white-space: nowrap; background: linear-gradient(140deg, rgba(63,80,99,.55), rgba(25,36,51,.75)); box-shadow: inset 0 1px rgba(255,255,255,.15), 0 0 12px rgba(145,197,247,.13); }
.scenes-head .scene-generate span { font-size: 20px; line-height: .8; filter: drop-shadow(0 0 4px rgba(208,234,255,.6)); }
.grid { grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; }
.scene, .add-scene, .char, .add-char { border-radius: 12px; border-color: rgba(189, 205, 222, .29); background: linear-gradient(145deg, rgba(14, 21, 27, .86), rgba(9, 15, 20, .85)); box-shadow: inset 0 1px rgba(255,255,255,.06), 0 5px 16px rgba(0,0,0,.16); backdrop-filter: blur(18px) saturate(75%); }
.scene-cell { position: relative; min-width: 0; }
.scene { display: flex; flex-direction: column; padding: 0; position: relative; cursor: grab; user-select: none; transition: transform .22s ease, opacity .22s ease; }
.scene[draggable="false"] { cursor: default; }
.scene.studio-pending { background: linear-gradient(145deg, rgba(92, 48, 12, .94), rgba(36, 20, 8, .92)); border-color: rgba(240, 162, 74, .9); }
.scene.studio-pending .scene-footer { background: rgba(240, 162, 74, .18); }
.scene.studio-moved { background: linear-gradient(145deg, rgba(12, 58, 36, .94), rgba(8, 28, 18, .92)); border-color: rgba(92, 196, 138, .9); }
.scene.studio-moved .scene-footer { background: rgba(92, 196, 138, .16); }
.scene.is-dragging, .scene.is-settling { transform: scale(.82); opacity: .62; transition: none; }
.scene-ghost { position: absolute; top: -2000px; left: 0; z-index: 0; pointer-events: none; }
.scene-grip { position: absolute; top: 7px; left: 50%; z-index: 3; display: flex; gap: 4px; transform: translateX(-50%); padding: 5px 8px; border-radius: 999px; background: rgba(4, 10, 18, .78); box-shadow: 0 1px 5px rgba(0,0,0,.35); pointer-events: none; }
.scene-grip span { width: 4px; height: 4px; border-radius: 50%; background: #fff; }
.scene-slot { position: absolute; z-index: 4; width: 12px; margin-left: -6px; border-radius: 10px; background: rgba(142, 182, 255, .22); box-shadow: inset 0 0 0 2px rgba(198, 220, 255, .82); opacity: 0; pointer-events: none; transition: width .16s ease, margin .16s ease, background .16s ease, opacity .16s ease; }
.grid.is-reordering .scene-slot { opacity: 1; }
.scene-slot.is-target { width: 28px; margin-left: -14px; background: rgba(142, 182, 255, .5); box-shadow: 0 0 0 4px rgba(142, 182, 255, .22), inset 0 0 0 2px #e7f1ff; }
.grid.is-reordering .scene-insert { opacity: 0; pointer-events: none; }
.scene-insert { position: absolute; z-index: 5; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(201,222,245,.55); border-radius: 50%; color: #fff; background: #1b2836; font-size: 20px; line-height: 1; opacity: 0; transform: translate(-50%, -50%); cursor: pointer; }
.scene-insert.is-near, .scene-insert:hover, .scene-insert:focus-visible { opacity: 1; }
@media (hover: none) {
  .workspace-scenes .grid { --scene-col-gap: 56px; column-gap: 56px; }
  .scene-insert { width: 44px; height: 44px; }
}
.scene-visual { cursor: grab; }
.scene-studio-dialog label.duration-auto input { width: 18px; height: 18px; padding: 0; }
.studio-checks { display: grid; gap: 8px; max-height: 220px; overflow: auto; }
.scene-studio-dialog label.studio-check { display: grid; grid-template-columns: 42px minmax(0, 1fr) 22px; align-items: center; gap: 10px; }
.scene-studio-dialog label.studio-check.duration-auto { grid-template-columns: 22px minmax(0, 1fr); }
.scene-studio-dialog input:disabled, .scene-studio-dialog textarea:disabled { opacity: .45; }
.studio-apply-dialog { width: min(480px, calc(100% - 24px)); }
.studio-apply-dialog::backdrop { background: rgba(4, 8, 15, .72); backdrop-filter: blur(4px); }
.studio-apply-dialog h2 { margin: 0; font-size: 22px; line-height: 1.25; }
.studio-apply-dialog .sub { margin: 0; line-height: 1.45; }
.studio-apply-dialog .actions { justify-content: flex-end; }
.scope-choices { display: grid; gap: 8px; }
.studio-apply-dialog label.scope-choice {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(191, 207, 222, .28);
  border-radius: 14px;
  background: rgba(255, 255, 255, .03);
  color: var(--ink);
  cursor: pointer;
}
.studio-apply-dialog label.scope-choice:hover { border-color: rgba(191, 207, 222, .5); }
.studio-apply-dialog label.scope-choice:has(input:checked) {
  border-color: rgba(142, 182, 255, .9);
  background: rgba(76, 141, 255, .14);
}
.studio-apply-dialog label.scope-choice input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: #8eb6ff;
}
.studio-apply-dialog label.scope-choice span { display: grid; gap: 3px; min-width: 0; }
.studio-apply-dialog label.scope-choice strong { color: #f4f7fc; font-size: 14px; font-weight: 650; line-height: 1.3; }
.studio-apply-dialog label.scope-choice small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.studio-check img, .studio-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; background: rgba(255,255,255,.06); }
.studio-check span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-check input { justify-self: end; margin: 0; }
.visual-prompt { display: grid; gap: 8px; padding: 10px; border: 1px dashed rgba(191,207,222,.35); border-radius: 14px; }
.visual-prompt.drop-active { border-color: rgba(163, 210, 255, .9); }
.visual-prompt-head { display: flex; align-items: center; justify-content: space-between; }
.visual-prompt-head label { margin: 0; }
.visual-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.visual-thumbs figure { position: relative; width: 72px; margin: 0; }
.visual-thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.visual-thumbs figcaption { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visual-thumbs button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; }
.scene-studio-dialog, .studio-apply-dialog { width: min(640px, calc(100% - 24px)); max-height: calc(100vh - 24px); margin: auto; padding: 22px; overflow: auto; color: var(--ink); border-radius: 18px; background: linear-gradient(145deg, #182026, #0d141a); }
.scene-studio-dialog form, .studio-apply-dialog form { display: grid; gap: 12px; }
.scene-studio-dialog label, .studio-apply-dialog label { display: grid; gap: 6px; }
.scene.menu-open { z-index: 4; }
.scene-visual { position: relative; overflow: hidden; border-radius: 11px 11px 0 0; }
.scene .thumb { display: block; width: 100%; height: clamp(88px, 6vw, 126px); margin: 0; border: 0; border-radius: inherit; object-fit: cover; object-position: center 12%; }
.scene-number, .scene-duration { position: absolute; top: 6px; padding: 4px 7px; border: 1px solid rgba(255,255,255,.22); border-radius: 7px; color: #fff; background: rgba(4,10,18,.76); box-shadow: 0 1px 5px rgba(0,0,0,.35); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.scene-number { left: 6px; }
.scene-duration { right: 6px; }
.scene-footer { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-height: 34px; padding: 3px 7px 5px; }
.scene h3 { min-width: 0; margin: 0; color: #f4f7fc; font-size: 14px; font-weight: 600; line-height: 1.25; }
.scene .scene-menu { flex: 0 0 24px; width: 24px; height: 27px; padding: 0; border: 0; border-radius: 6px; color: #e9f2ff; background: transparent; font-size: 23px; line-height: 1; cursor: pointer; }
.scene .scene-menu:hover, .scene .scene-menu:focus-visible { color: #fff; background: rgba(168,204,244,.17); text-shadow: 0 0 7px rgba(160,218,255,.7); outline: none; }
.scene .menu, .scene-options.scene-menu-floating { top: calc(100% - 5px); right: 5px; left: auto; width: 220px; max-height: min(70vh, 420px); overflow-y: auto; z-index: 40; padding: 8px; border: 1px solid rgba(191,207,222,.36); border-radius: 18px; background: linear-gradient(145deg, rgba(19,27,34,.97), rgba(10,17,23,.97)); box-shadow: 0 14px 30px rgba(0,0,0,.42); }
.scene-options.scene-menu-floating { position: fixed; top: 0; right: auto; bottom: auto; }
.scene-options .danger { color: #ffb5b5; }
.workspace-main.scenes-expanded .workspace-intro { display: none; }
.workspace-main.scenes-expanded .scene .thumb,
.workspace-scenes:fullscreen .scene .thumb,
.workspace-scenes.scenes-cover .scene .thumb { height: 210px; }
.workspace-main.scenes-expanded .grid,
.workspace-scenes:fullscreen .grid,
.workspace-scenes.scenes-cover .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.workspace-scenes:fullscreen,
.workspace-scenes.scenes-cover { width: 100%; height: 100%; overflow: auto; padding: 28px; box-sizing: border-box; background: #0b1116; }
.workspace-scenes.scenes-cover { position: fixed; inset: 0; z-index: 50; }
.scenes-size { padding: 8px 12px; border-radius: 999px; font-size: 13px; }
.add-scene { min-height: 135px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border-style: dashed; }
.add-scene-plus { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 3px; border: 1px solid rgba(201,222,245,.5); border-radius: 50%; color: #fff; background: linear-gradient(145deg, rgba(66,83,103,.55), rgba(26,40,55,.67)); box-shadow: inset 0 1px rgba(255,255,255,.19), 0 0 12px rgba(146,201,250,.13); font-size: 34px; font-weight: 300; line-height: 1; }
.add-scene strong { color: #f5f8fc; font-size: 14px; font-weight: 600; }
.add-scene small { color: #aab8ca; font-size: 12px; }
.add-scene:hover .add-scene-plus, .add-scene:focus-visible .add-scene-plus { border-color: #b8dcff; box-shadow: 0 0 14px rgba(146,201,250,.33); }
.scene-info-dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 32px); margin: auto; padding: 24px; overflow: auto; color: var(--ink); border-color: rgba(202,217,232,.42); border-radius: 16px; background: linear-gradient(145deg, #182026, #0d141a); }
.scene-info-dialog::backdrop { background: rgba(4,8,15,.72); backdrop-filter: blur(4px); }
.scene-editor-dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100vh - 24px); margin: auto; padding: 22px; overflow: auto; color: var(--ink); border-radius: 18px; background: linear-gradient(145deg, #182026, #0d141a); }
.scene-editor-dialog::backdrop { background: rgba(4,8,15,.76); backdrop-filter: blur(5px); }
.scene-editor-dialog form { display: grid; gap: 13px; }
.scene-editor-dialog h2 { margin: 0; }
.scene-editor-dialog .sub { margin: 0; line-height: 1.4; }
.scene-editor-dialog label { display: grid; gap: 6px; color: #e5edf7; font-size: 14px; }
.scene-editor-dialog input, .scene-editor-dialog select, .scene-editor-dialog textarea { width: 100%; min-width: 0; padding: 10px 12px; }
.scene-editor-dialog textarea { resize: vertical; }
.scene-editor-dialog .actions { justify-content: flex-end; flex-wrap: wrap; }
.scene .menu .danger { color: #ffb5b5; }
.scene .menu button:disabled, .add-scene:disabled { cursor: not-allowed; opacity: .48; }
.scene-info-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.scene-info-head h2 { margin: 0; font-size: 22px; line-height: 1.3; }
.scene-info-close { flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid rgba(210,227,249,.3); border-radius: 9px; background: rgba(255,255,255,.07); color: #f7faff; font-size: 25px; line-height: 1; }
.scene-info-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin: 0; }
.scene-info-grid div { min-width: 0; }
.scene-info-grid dt { margin-bottom: 3px; color: #9eafc5; font-size: 12px; }
.scene-info-grid dd { margin: 0; color: #f0f4fa; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.scene-info-script { margin-top: 20px; padding-top: 17px; border-top: 1px solid rgba(207,225,247,.19); }
.scene-info-script h3 { margin: 0 0 8px; font-size: 14px; }
.scene-info-script p { margin: 0; color: #e3eaf4; line-height: 1.5; white-space: pre-wrap; }
.badge, .pill { border: 1px solid rgba(173, 200, 243, .22); }
.badge { border-radius: 999px; }
.ring { background: conic-gradient(#5ca7ff calc(var(--p) * 1%), rgba(255,255,255,.09) 0); }
.status-ring { padding: 20px 14px; }
.status-ring > div { width: 100%; text-align: center; }
.meta { text-align: left; }
.start-page { min-height: calc(100vh - 52px); display: grid; place-items: center; padding: 34px; }
.start-form { width: min(100%, 1352px); display: grid; gap: 14px; transform: translate(21px, -13px); }
.start-bar { display: grid; grid-template-columns: 58px minmax(0, 1fr) 207px; align-items: center; gap: 18px; min-height: 104px; padding: 21px 23px; border: 1px solid rgba(208, 220, 232, .62); border-radius: 20px; background: linear-gradient(110deg, rgba(17, 25, 31, .73), rgba(8, 15, 21, .72)); box-shadow: inset 0 1px rgba(255,255,255,.15), inset 0 0 20px rgba(183,211,247,.055), 0 12px 30px rgba(0,0,0,.26); backdrop-filter: blur(24px) saturate(75%); }
.start-bar.drop-active { border-color: rgba(163, 210, 255, .9); box-shadow: 0 0 0 2px rgba(105, 181, 253, .22), inset 0 1px rgba(255,255,255,.15), 0 12px 30px rgba(0,0,0,.26); }
.start-attachment { position: relative; width: 58px; height: 58px; }
.start-plus { width: 58px; height: 58px; display: grid; place-items: center; padding: 0 0 5px; border: 1px solid rgba(201, 218, 240, .56); border-radius: 50%; color: #fff; background: linear-gradient(145deg, rgba(64, 82, 102, .67), rgba(27, 40, 55, .79)); box-shadow: inset 0 1px rgba(255,255,255,.28), inset 0 0 13px rgba(195,220,250,.1), 0 4px 15px rgba(0,0,0,.26); font-size: 42px; font-weight: 300; line-height: 1; }
.start-plus:hover, .start-plus:focus-visible { border-color: #bce1ff; box-shadow: 0 0 15px rgba(119,192,255,.3), inset 0 1px rgba(255,255,255,.34); outline: none; }
.start-attachment .menu { top: 68px; }
.start-bar textarea[name="prompt"] { width: 100%; height: 58px; min-height: 58px; max-height: 240px; padding: 16px 26px; resize: none; overflow-y: auto; border: 1px solid rgba(179, 198, 222, .44); border-radius: 30px; color: #f4f7fc; background: rgba(10, 19, 31, .58); box-shadow: inset 0 2px 10px rgba(0,0,0,.16); font-size: 17px; line-height: 24px; white-space: pre-wrap; }
.start-bar textarea[name="prompt"]::placeholder { color: #b7bfcb; opacity: 1; }
.start-bar textarea[name="prompt"]:focus { border-color: rgba(163, 210, 255, .8); box-shadow: 0 0 0 2px rgba(105, 181, 253, .13), inset 0 2px 10px rgba(0,0,0,.16); }
.start-submit { width: 207px; height: 58px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 16px; border: 2px solid rgba(157, 211, 255, .96); border-radius: 999px; color: #101d2d; background: linear-gradient(180deg, #fff, #e7f1ff); box-shadow: 0 0 19px rgba(106, 184, 255, .52), 0 6px 15px rgba(13, 49, 82, .3), inset 0 1px rgba(255,255,255,.95); font-size: 18px; font-weight: 650; white-space: nowrap; }
.start-submit:hover, .start-submit:focus-visible { background: #fff; box-shadow: 0 0 24px rgba(106, 184, 255, .74), 0 6px 15px rgba(13, 49, 82, .34); outline: none; }
.start-submit svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.start-form #draft-chips:empty, .start-form #start-error:empty { display: none; }
.start-form #draft-chips { padding: 0 8px; }
.start-form #start-error { padding: 8px 12px; border-radius: 10px; background: rgba(70, 17, 24, .78); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 1100px) {
  .start-page { padding: 24px; }
  .start-form { transform: translateY(-13px); }
  .start-bar { grid-template-columns: 58px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .start-submit { grid-column: 1 / -1; justify-self: end; }
}
@media (max-width: 600px) {
  .start-page { min-height: calc(100vh - 130px); padding: 12px; }
  .start-bar { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; padding: 12px; border-radius: 16px; }
  .start-attachment, .start-plus { width: 48px; height: 48px; }
  .start-plus { font-size: 36px; }
  .start-bar textarea[name="prompt"] { padding: 14px 16px; font-size: 15px; }
  .start-submit { width: 100%; }
}
.seg button { border-color: rgba(190,210,240,.22); }
.seg button.selected { border-color: #80b7ff; box-shadow: inset 0 0 0 1px #80b7ff; background: rgba(76,141,255,.23); }

/* Library and reusable character cards */
.library-row { grid-template-columns: minmax(180px, 250px) minmax(0,1fr) minmax(130px,170px) auto; gap: 18px; min-height: 124px; margin: 10px 0; padding: 10px 14px; border: 1px solid rgba(186,203,221,.22); background: linear-gradient(115deg, rgba(16,24,30,.89), rgba(9,16,22,.88)); border-radius: 13px; }
.library-row .thumb, img.thumb, video.thumb { width: 100%; height: 100px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); }
.library-row strong { font-size: 19px; margin-bottom: 8px; }
.library-row .sub { margin: 0; }
.library-row > div:last-child { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.library-menu { top: calc(100% + 8px); right: 0; left: auto; width: 220px; }
.library-menu.opens-up { top: auto; bottom: calc(100% + 8px); }
.library-row .more, .library-row .open { min-width: 46px; min-height: 44px; }
.library-row .open { min-width: 100px; }
.pill { padding: 9px 13px; text-align: center; border-radius: 10px; color: #c7d4eb; background: rgba(139,157,188,.12); }
.pill:not(.busy):not(.draft):not(.failed) { color: #85e3ad; background: rgba(45,151,91,.19); border-color: rgba(79,202,127,.25); }
.pill.busy { color: #8ec2ff; background: rgba(47,125,218,.2); }
.char-grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.char { padding: 10px; gap: 6px; }
.char .avatar { height: clamp(140px, 17vw, 245px); object-fit: cover; border-radius: 10px; }
.char header { display: block; color: var(--ink); font-size: 15px; }
.char header strong { display: block; font-size: 17px; }
.char header .quiet { position: absolute; top: 18px; right: 18px; border: 1px solid rgba(255,255,255,.2); background: rgba(7,12,20,.62); backdrop-filter: blur(8px); border-radius: 8px; padding: 5px 9px; }
.char p { line-height: 1.4; }
.char-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 6px; }
.char-actions .btn { padding: 8px 5px; }
.char-actions .use { color: #142034; }
.char-actions .delete-character { grid-column: 1 / -1; border-color: rgba(255,155,155,.28); background: rgba(115,36,47,.12); }
.char-actions .delete-character:hover { border-color: rgba(255,155,155,.62); background: rgba(145,45,57,.25); }
.add-char { min-height: 330px; }

/* Character identity and voice workflow */
.wizard-page, .voice-page { padding: 20px; }
.wizard-heading { display: flex; justify-content: space-between; gap: 24px; align-items: start; }
.wizard-heading .sub { max-width: 800px; margin: 0; }
.wizard-tagline { text-align: right; margin: 4px 0; }
.wizard-tagline strong, .wizard-tagline span { display: block; }
.wizard-tagline span { color: var(--muted); font-size: 13px; margin-top: 5px; }
.wizard-progress { list-style: none; display: grid; grid-template-columns: repeat(3,1fr); gap: 0; padding: 0 7%; margin: 22px 0; }
.wizard-progress li { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.wizard-progress li::after { content: ""; position: absolute; z-index: 0; left: calc(50% + 45px); right: -50%; top: 19px; height: 1px; background: rgba(183,204,238,.28); }
.wizard-progress li:last-child::after { display: none; }
.wizard-progress b { z-index: 1; display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid rgba(188,209,244,.42); background: #111d2e; border-radius: 50%; color: #dce7fa; }
.wizard-progress li.active b { color: #102039; background: #8fc6ff; border-color: #8fc6ff; box-shadow: 0 0 18px rgba(98,168,255,.25); }
.wizard-progress li.completed b { color: #c8e2ff; border-color: rgba(143,198,255,.65); background: rgba(71,128,190,.24); }
.wizard-progress li.completed strong { color: var(--ink); }
.wizard-progress span, .wizard-progress small { display: block; }
.wizard-progress small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.wizard { grid-template-columns: 1fr; }
.wizard-form { display: grid; grid-template-columns: minmax(0,1.75fr) minmax(250px,.7fr); gap: 14px; align-items: start; }
.wizard-form-column { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wizard-identity-form .wizard-form-column { grid-template-columns: 1fr; }
.wizard-reference-form { display: grid; grid-template-columns: minmax(0,1.75fr) minmax(250px,.7fr); gap: 14px; align-items: start; }
.wizard-reference-form > .references-panel { margin: 0; }
.wizard-step-actions { display: flex; gap: 8px; }
.wizard-step-actions > button { flex: 1; }
.wizard-form-column > .panel:first-child { grid-column: 1; grid-row: 1; }
.wizard-form-column > .panel { border-radius: 13px; padding: 16px; }
.wizard-form-column label { margin: 10px 0; }
.wizard-form-column textarea { min-height: 95px; }
.style-field { display: grid; gap: 8px; }
.style-picks { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.style-picks button { min-height: 42px; border: 1px solid var(--line); background: rgba(255,255,255,.035); border-radius: 10px; }
.style-picks button.selected { border-color: #90c2ff; background: rgba(78,139,220,.2); box-shadow: inset 0 0 0 1px rgba(144,194,255,.7); }
.references-panel { grid-column: 2; grid-row: 1; }
.references-panel .upload-tile { position: relative; display: grid; place-items: center; gap: 5px; min-height: 150px; padding: 18px; border: 1px dashed rgba(176,204,246,.42); border-radius: 12px; background: rgba(6,13,23,.33); text-align: center; color: var(--ink); font-size: 24px; overflow: hidden; }
.references-panel .upload-tile.drag-over { border-color: #8fc6ff; background: rgba(71,132,212,.19); box-shadow: inset 0 0 26px rgba(91,160,245,.12); }
.upload-tile strong { font-size: 15px; }
.upload-tile span { color: var(--muted); font-size: 12px; }
.upload-tile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.wizard-side { position: sticky; top: 18px; display: grid; gap: 10px; }
.wizard-side #wizard-preview { display: block; margin: 0; border-radius: 13px; padding: 14px; }
.wizard-shots { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.wizard-shots .ph { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; }
.wizard-side #wizard-preview > .wizard-shots:has(.ph:only-child) .ph { aspect-ratio: 4 / 3; }
.wizard-side #wizard-preview h3 { margin: 12px 0 4px; font-size: 21px; }
.wizard-side #wizard-preview p { margin: 4px 0; }
.wizard-next { display: flex; justify-content: space-between; align-items: center; padding: 13px 17px; }
.voice-top { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 12px; }
.voice-top .wizard-progress { margin: 0; padding: 0; }
.wizard-progress.compact li { gap: 7px; }
.wizard-progress.compact b { flex-basis: 34px; width: 34px; height: 34px; }
.wizard-progress.compact li::after { top: 16px; left: calc(50% + 32px); }
.wizard-progress.compact small { font-size: 10px; }
.voice-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin: 22px 0 14px; }
.voice-heading h1 { margin: 0 0 5px; }
.voice-heading .sub { max-width: 860px; margin: 0; }
.voice-heading > span { white-space: nowrap; color: var(--muted); }
.voice-heading > span strong { color: var(--ink); font-size: 18px; margin-left: 7px; }
.voice-layout { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.85fr); gap: 14px; }
.voice-picker, .voice-preview { min-width: 0; }
.voice-search { display: grid; grid-template-columns: minmax(0,1fr) 145px; gap: 10px; margin-bottom: 10px; }
.voice-filter { width: 100%; min-width: 0; padding: 10px 13px; border: 1px solid rgba(184,205,238,.23); border-radius: 10px; background: rgba(7,13,23,.55); color: #dce6f7; }
.voice-filter option { color: #e5edf9; background: #111a29; }
.voice-empty { padding: 16px; border: 1px solid rgba(186,208,243,.19); border-radius: 12px; }
.voice { grid-template-columns: 46px minmax(0,1fr) 110px; gap: 10px; padding: 12px; border: 1px solid rgba(186,208,243,.19); background: rgba(10,18,30,.52); margin-bottom: 7px; }
.voice.is-selected { border-color: rgba(145,198,255,.63); background: rgba(36,65,97,.28); }
.voice > .play { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 50%; }
.voice > .play svg { width: 21px; height: 21px; margin-left: 2px; }
.voice p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.voice .pick { min-width: 90px; padding: 9px 8px; white-space: nowrap; font-size: 14px; }
.voice .pick.selected { color: #f7fbff; font-weight: 700; border-color: rgba(142,199,255,.9); background: linear-gradient(145deg, rgba(83,143,210,.5), rgba(24,58,103,.55)); box-shadow: inset 0 1px rgba(255,255,255,.25), 0 0 16px rgba(91,164,241,.28); }
.voice-preview { display: grid; gap: 10px; align-content: start; }
.voice-preview > .panel, .voice-preview #wizard-preview { margin: 0; padding: 13px; border-radius: 13px; }
.voice-preview #wizard-preview .wizard-shots .ph { width: 100%; height: clamp(120px, 10vw, 180px); aspect-ratio: 4/3; }
.voice-player { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.voice-player #voice-preview-play { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 50%; }
.voice-player #voice-preview-play svg { width: 19px; height: 19px; margin-left: 2px; }
.voice-player #voice-preview-play:disabled { cursor: default; opacity: .48; }
.auto-voice { display: flex; grid-template-columns: auto 1fr; align-items: start; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.auto-voice input { width: 18px; margin-top: 4px; }
.auto-voice strong, .auto-voice small { display: block; }
.auto-voice small { color: var(--muted); margin-top: 4px; }
.voice-save { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 48px; border-radius: 13px; box-shadow: 0 0 16px rgba(172,211,255,.25), inset 0 1px rgba(255,255,255,.85); }
.voice-save:hover { box-shadow: 0 0 24px rgba(172,211,255,.45), inset 0 1px rgba(255,255,255,.95); }
.voice-save svg { width: 21px; height: 21px; }

/* Settings panels */
.settings-page { display: grid; grid-template-rows: auto auto 1fr; gap: 14px; align-content: start; }
.settings-page > .head-row { padding: 0 2px 10px; border-bottom: 1px solid rgba(190,210,242,.14); }
.settings-top { display: grid; grid-template-columns: 1fr 1.1fr; gap: 14px; }
.settings-top > .panel, .settings-page > .defaults { border-radius: 13px; }
.settings-top > .panel { padding: 17px; }
.settings-top h2, .defaults h2 { display: flex; align-items: center; gap: 12px; font-size: 20px; margin: 0 0 14px; }
.settings-top h2 > span:last-child, .defaults h2 > span:last-child { display: grid; gap: 4px; }
.settings-top h2 small, .defaults h2 small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.settings-icon { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid rgba(190,210,242,.2); border-radius: 10px; background: rgba(255,255,255,.04); font-size: 24px; }
.providers { gap: 8px; }
.provider-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; min-height: 62px; border: 1px solid rgba(185,207,242,.18); border-radius: 11px; background: rgba(7,14,25,.28); }
.provider-mark { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.08); font-size: 19px; font-weight: 700; }
.provider-info { flex: 1; min-width: 0; }
.provider-info strong, .provider-info small { display: block; }
.provider-info small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.provider-status { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.provider-status i { width: 9px; height: 9px; border-radius: 50%; background: #77849a; }
.provider-status.is-connected i { background: #44db89; box-shadow: 0 0 9px rgba(68,219,137,.4); }
.provider-arrow { font-size: 25px; color: var(--muted); }
.defaults { border-radius: 13px; align-content: start; }
.defaults { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 14px; }
.defaults h2 { grid-column: 1 / -1; margin-bottom: 8px; }
.defaults label { grid-template-columns: 38px 148px minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }
.defaults label select { width: 100%; min-width: 0; }
.defaults label::before { content: "◈"; display: grid; place-items: center; width: 35px; height: 35px; border-radius: 9px; background: rgba(255,255,255,.05); color: #9bc8ff; font-size: 19px; }
.defaults label:nth-of-type(1)::before { content: "✳"; color: #f2a244; }
.defaults label:nth-of-type(2)::before { content: "▥"; color: #eb6090; }
.defaults label:nth-of-type(3)::before { content: "◉"; color: #d4e7ff; }
.defaults label:nth-of-type(4)::before { content: "▤"; color: #c8d7ee; }
.defaults button[type=submit] { justify-self: end; min-width: 180px; }
.api-card .key-row { grid-template-columns: minmax(130px,.5fr) minmax(150px,1fr) auto; gap: 8px; align-items: center; margin: 10px 0 0; }
.api-card > .sub { margin: 2px 0 8px; font-size: 11px; }
.api-card .key-row input { height: 40px; }
.api-card .test { white-space: nowrap; padding: 8px; font-size: 12px; }
.api-card .key-row + .sub { margin: 2px 0 9px; font-size: 11px; }
.reference-content { display: grid; grid-template-columns: minmax(180px,.8fr) minmax(0,1.7fr); gap: 10px; }
.wizard-reference-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; align-content: start; }
.wizard-reference { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid rgba(255,255,255,.13); border-radius: 9px; }
.reference-empty { grid-column: 1 / -1; display: grid; place-items: center; min-height: 105px; margin: 0; padding: 10px; border: 1px dashed rgba(176,204,246,.3); border-radius: 10px; color: var(--muted); text-align: center; font-size: 12px; }

@media (max-width: 1400px) and (min-width: 1101px) {
  .grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .char-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 1100px) {
  .shell { grid-template-columns: 130px minmax(0,1fr); padding: 14px 20px; }
  .create-layout { height: auto; grid-template-columns: 1fr; }
  .create-layout > #side { min-height: 0; }
  .wizard-form { grid-template-columns: 1fr; }
  .wizard-reference-form { grid-template-columns: 1fr; }
  .wizard-side { position: static; }
  .voice-layout { grid-template-columns: 1fr; }
  .char-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library-row { grid-template-columns: 180px minmax(0,1fr) auto; }
  .library-row .pill { grid-column: 2; }
  .library-row > div:last-child { grid-column: 3; grid-row: 1 / span 2; }
}
@media (max-width: 720px) {
  .shell { padding: 9px; }
  .sidebar { border-radius: 13px; }
  .nav { min-height: 54px; }
  .page { min-height: calc(100vh - 90px); }
  .wizard-form-column { grid-template-columns: 1fr; }
  .wizard-form-column > .panel:first-child, .references-panel { grid-column: 1; grid-row: auto; }
  .wizard-tagline { display: none; }
  .wizard-progress { padding: 0; gap: 5px; }
  .wizard-progress li { justify-content: start; gap: 6px; }
  .wizard-progress small { display: none; }
  .voice-top { grid-template-columns: 1fr auto; }
  .voice-top .wizard-progress { grid-column: 1 / -1; grid-row: 2; }
  .voice-heading { flex-direction: column; }
  .library-row { grid-template-columns: 90px minmax(0,1fr) auto; gap: 9px; min-height: 90px; padding: 8px; }
  .library-row .thumb, img.thumb, video.thumb { height: 70px; }
  .library-row strong { font-size: 15px; }
  .library-row .pill { grid-column: 2; justify-self: start; }
  .library-row > div:last-child { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; }
  .char-grid { grid-template-columns: 1fr; }
  .char .avatar { height: 220px; }
  .defaults label { grid-template-columns: 1fr; gap: 6px; }
  .key-row { grid-template-columns: 1fr; }
  .settings-top, .defaults { grid-template-columns: 1fr; }
  .defaults h2 { grid-column: 1; }
  .defaults label { grid-template-columns: 30px 1fr; }
  .defaults label::before { grid-row: span 2; }
  .defaults button[type=submit] { grid-column: 1 / -1; }
  .reference-content { grid-template-columns: 1fr; }
  .upload-tile { min-height: 115px !important; }
}
dialog.preflight {
  width: min(440px, calc(100% - 32px));
  margin: auto;
  padding: 22px;
  color: var(--ink);
  max-height: calc(100vh - 32px);
  overflow: auto;
}
dialog.preflight::backdrop { background: rgba(5, 8, 16, 0.72); }
.preflight h2 { margin: 0 0 14px; font-size: 20px; }
.preflight dl { margin: 0; display: grid; gap: 8px; }
.preflight dl div { display: flex; justify-content: space-between; gap: 16px; }
.preflight dt { color: var(--muted); }
.preflight dd { margin: 0; font-weight: 650; }
.preflight .actions { margin-top: 16px; justify-content: flex-end; }
#preflight-price { margin: 14px 0 0; }


.media-card.has-analysis { align-items: start; }
.media-card .analysis-status { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.media-card .analysis-status.ok { color: #9ed0a8; }
.media-card .analysis-status.error { color: #e7b0b0; }
.media-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.btn.compact { padding: 4px 8px; font-size: 12px; border-radius: 10px; }
.media-card.analyzing .media-actions { opacity: 0.7; }
dialog.analysis-consent,
dialog.blueprint-modal {
  width: min(520px, calc(100% - 32px));
  margin: auto;
  padding: 22px;
  color: var(--ink);
  max-height: calc(100vh - 32px);
  overflow: auto;
}
dialog.analysis-consent::backdrop,
dialog.blueprint-modal::backdrop { background: rgba(5, 8, 16, 0.72); }
.analysis-consent h2,
.blueprint-modal h2 { margin: 0 0 12px; font-size: 20px; }
.analysis-consent p { margin: 0 0 10px; line-height: 1.45; }
.analysis-consent .actions,
.blueprint-modal .actions { margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px; }
.blueprint-body { display: grid; gap: 14px; }
.blueprint-section h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); font-weight: 650; }
.blueprint-section p,
.blueprint-section li { margin: 0; line-height: 1.45; }
.blueprint-section ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }

@media (max-width: 1550px) and (min-width: 1101px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1300px) and (min-width: 1101px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .create-layout, .split, .wizard, .char-grid, .start-grid { grid-template-columns: 1fr; }
  .create-layout { height: auto; min-height: 0; }
  .create-layout > #side, .workspace-scenes { overflow: visible; }
  .workspace-intro .title-row { align-items: flex-start; }
  .workspace-intro .project-heading h1 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shell { grid-template-columns: 130px minmax(0, 1fr); }
  .sidebar { height: calc(100vh - 14px); top: 14px; }
  .char-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .shell { display: block; padding: 10px; }
  .sidebar { height: auto; position: relative; top: auto; flex-direction: row; justify-content: space-between; gap: 8px; padding: 8px; margin-bottom: 10px; overflow: visible; }
  .sidebar .logo { flex: 0 0 104px; width: 104px; height: 54px; margin: 0 8px; }
  .sidebar .logo img { flex: 0 0 104px; width: 104px; max-height: 40px; }
  .sidebar nav { width: auto; height: auto; flex: 1; flex-direction: row; justify-content: space-around; gap: 4px; min-width: 0; overflow-x: auto; }
  .sidebar .nav, .sidebar .nav:first-child { flex: 0 0 58px; width: 58px; min-height: 54px; height: 54px; justify-content: center; padding: 5px 2px; gap: 3px; border-width: 1px; border-radius: 10px; font-size: 11px; letter-spacing: 0; }
  .sidebar .nav:nth-child(n) { margin-top: 0; }
  .sidebar .nav:nth-child(3), .sidebar .nav:nth-child(4) { padding-top: 5px; gap: 3px; }
  .sidebar .nav.active { padding: 5px 2px; gap: 3px; }
  .sidebar .ico, .sidebar .ico svg, .sidebar .ico img { width: 20px; height: 20px; }
  .sidebar .nav:first-child .ico, .sidebar .nav:first-child .ico svg { width: 20px; height: 20px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .title-row { align-items: start; }
  .title-actions { flex-direction: column; align-items: end; }
  .panel, .page { padding: 12px; }
  .create-layout { min-height: 0; }
}
@media (max-width: 450px) {
  .sidebar .logo { display: none; }
  .sidebar nav { width: 100%; justify-content: space-around; }
  .grid { grid-template-columns: 1fr; }
  .title-row { flex-wrap: wrap; }
  .title-actions { flex-direction: row; }
  .scene-actions { justify-content: start; }
  .scenes-head { align-items: start; flex-direction: column; gap: 10px; }
  #chat-form { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "plus field" "hint hint" "send send"; }
  #chat-form button[type="submit"] { justify-self: end; }
}

@media (max-width: 720px) {
  .shell, #main, .page, .create-layout, .workspace-main, .workspace-intro, .workspace-scenes { min-width: 0; }
  .page, .workspace-intro, .workspace-scenes, .create-layout > #side { padding: 14px; }
  .accounts-page { height: auto; min-height: 0; overflow: visible; }
  .account-scroll { max-height: 70vh; }
  .page .head-row { align-items: flex-start; flex-wrap: wrap; }
  .page .head-row > * { min-width: 0; }
  .page h1 { font-size: 25px; }
  .start-page { padding: 12px 0; }
  .start-form { width: 100%; transform: none; }
  .start-bar { min-width: 0; }
  .start-bar textarea[name="prompt"] { min-width: 0; height: 128px; min-height: 128px; resize: vertical; }
  .start-submit { grid-column: 1 / -1; width: 100%; }
  .workspace-intro .title-row { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; }
  .workspace-intro .project-heading { width: 100%; min-width: 0; }
  .workspace-intro .project-heading h1 { display: block; overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; font-size: clamp(20px, 6vw, 27px); }
  .workspace-intro .title-actions { flex-direction: row; align-items: center; justify-content: space-between; min-width: 0; }
  .workspace-intro .project-brief { font-size: 14px; max-height: 8em; }
  .workspace-intro #chat-form { display: grid; grid-template-columns: 50px minmax(0,1fr); grid-template-areas: "plus field" "send send"; gap: 10px; margin-top: 16px; }
  .workspace-intro #chat-form .plus { width: 50px; height: 50px; align-self: start; }
  .workspace-intro #chat-form textarea { min-width: 0; height: 120px; min-height: 120px; padding: 13px 17px; resize: vertical; border-radius: 22px; }
  .workspace-intro #chat-form .chat-send { justify-self: stretch; width: 100%; height: 50px; }
  .scenes-head { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .scene-actions { justify-content: flex-start; }
  .char-grid { grid-template-columns: minmax(0,1fr); }
  .char { min-width: 0; }
  .char .avatar { height: min(68vw, 260px); }
  .char-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .char-actions .use { grid-column: 1 / -1; }
  .char-actions .btn { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .settings-top, .defaults { grid-template-columns: minmax(0,1fr); }
  .settings-top > .panel, .settings-page > .defaults { min-width: 0; padding: 14px; }
  .settings-top h2, .defaults h2 { align-items: flex-start; font-size: 18px; }
  .settings-top h2 small, .defaults h2 small { overflow-wrap: anywhere; }
  .provider-row { flex-wrap: wrap; }
  .provider-status { flex: 0 0 calc(100% - 48px); margin-left: 48px; }
  .provider-arrow { display: none; }
  .api-card .key-row { grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
  .api-card .key-row > span { grid-column: 1 / -1; }
  .api-card .key-row input { min-width: 0; }
  .defaults label { grid-template-columns: 30px minmax(0,1fr); min-width: 0; }
  .defaults label select, .defaults label input { min-width: 0; max-width: 100%; }
  .library-row { grid-template-columns: 90px minmax(0,1fr); min-width: 0; }
  .library-row .pill { grid-column: 1; grid-row: 2; }
  .library-row > div:last-child { grid-column: 2; grid-row: 2; flex-direction: row; justify-content: flex-end; min-width: 0; }
  .library-row .open { min-width: 70px; }
  .library-row .sub { overflow-wrap: anywhere; }
  .scene-editor-dialog { padding: 16px; }
}
@media (max-width: 380px) {
  .api-card .key-row { grid-template-columns: minmax(0,1fr); }
  .api-card .key-row > span { grid-column: 1; }
  .api-card .key-row .test { justify-self: start; }
  .library-row { grid-template-columns: 75px minmax(0,1fr); }
  .library-row .thumb { width: 75px; }
  .library-row > div:last-child { flex-wrap: wrap; }
}
