:root {
  color-scheme: dark;
  --ink: #ecf7f2;
  --muted: #8da19a;
  --faint: #60716b;
  --line: rgba(192, 232, 218, 0.13);
  --panel: rgba(10, 24, 21, 0.78);
  --panel-solid: #0b1917;
  --mint: #67f2bd;
  --mint-soft: #adffdc;
  --blue: #68a7ff;
  --danger: #ff8f8f;
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: #06100e; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: Manrope, system-ui, sans-serif;
  background:
    linear-gradient(rgba(255,255,255,.017) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.017) 1px, transparent 1px),
    radial-gradient(circle at 50% -20%, #18372e 0%, #071311 44%, #050c0b 100%);
  background-size: 38px 38px, 38px 38px, auto;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.ambient { position: fixed; border-radius: 50%; filter: blur(100px); pointer-events: none; opacity: .16; }
.ambient-one { width: 420px; height: 420px; background: #45e6ab; top: 8%; left: -260px; }
.ambient-two { width: 500px; height: 500px; background: #397fe8; bottom: -300px; right: -220px; }

.topbar {
  height: 74px;
  padding: 0 max(24px, calc((100vw - 1440px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 13, 12, .76);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid rgba(103,242,189,.38); background: rgba(103,242,189,.09); border-radius: 11px; }
.brand-mark svg { width: 22px; fill: none; stroke: var(--mint); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.product-name { margin-left: 3px; padding-left: 13px; border-left: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.api-state { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; font-weight: 700; }
.api-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px var(--mint); }
.api-state.error i { background: var(--danger); box-shadow: 0 0 12px var(--danger); }

.button { min-height: 42px; padding: 0 16px; border: 0; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; text-decoration: none; font-weight: 700; font-size: 13px; cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button-quiet { color: var(--ink); background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.button-quiet:hover { background: rgba(255,255,255,.075); border-color: rgba(255,255,255,.2); }
.button-light { color: #07110f; background: #dffbee; }
.button-danger { color: var(--danger); background: rgba(255,143,143,.055); border: 1px solid rgba(255,143,143,.22); }
.button-danger:hover { background: rgba(255,143,143,.11); border-color: rgba(255,143,143,.38); }
.button-primary { color: #04100c; background: linear-gradient(135deg, var(--mint-soft), var(--mint)); box-shadow: 0 10px 30px rgba(103,242,189,.16); }
.button-primary:hover { box-shadow: 0 13px 34px rgba(103,242,189,.24); }

.shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 58px 0 70px; position: relative; z-index: 1; }
.intro { display: grid; grid-template-columns: 1fr 390px; align-items: end; gap: 48px; margin-bottom: 36px; }
.eyebrow { margin: 0 0 14px; display: flex; align-items: center; gap: 9px; color: var(--mint); font: 500 11px/1.2 "DM Mono", monospace; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow > span { width: 19px; height: 1px; background: var(--mint); }
.intro h1 { margin: 0; font-size: clamp(40px, 5vw, 70px); line-height: .99; letter-spacing: -.06em; font-weight: 600; }
.intro h1 em { color: var(--mint); font-style: normal; }
.intro > div:first-child > p { max-width: 680px; margin: 20px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.sunset-note { display: flex; align-items: flex-start; gap: 13px; padding: 16px; border: 1px solid rgba(255,196,105,.2); background: rgba(91,63,25,.16); border-radius: 15px; }
.sunset-note svg { flex: 0 0 18px; width: 18px; fill: none; stroke: #ffc469; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sunset-note div { display: flex; flex-direction: column; gap: 4px; }
.sunset-note strong { color: #ffe2af; font-size: 12px; }
.sunset-note span { color: #ad9e85; font-size: 11px; line-height: 1.5; }

.workspace { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.03fr) minmax(430px, .97fr); gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.24); backdrop-filter: blur(20px); }
.composer { min-width: 0; padding: 26px; }
.output { min-width: 0; padding: 26px; position: sticky; top: 92px; }
.panel-heading { min-height: 35px; margin-bottom: 25px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-heading > div { display: flex; align-items: center; gap: 11px; }
.panel-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.step { color: var(--mint); font: 500 10px/1 "DM Mono", monospace; }
.secure-label { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.secure-label svg { width: 13px; fill: none; stroke: var(--mint); stroke-width: 1.6; }
.mode-labels { display: flex; align-items: center; gap: 10px; }
.generation-mode { padding: 6px 8px; color: var(--mint); background: rgba(103,242,189,.06); border: 1px solid rgba(103,242,189,.16); border-radius: 999px; font: 500 9px/1 "DM Mono", monospace; text-transform: uppercase; }
.status-pill { padding: 6px 10px; color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 999px; font: 500 10px/1 "DM Mono", monospace; text-transform: uppercase; }
.status-pill.active { color: var(--mint); border-color: rgba(103,242,189,.25); background: rgba(103,242,189,.08); }
.status-pill.failed { color: var(--danger); border-color: rgba(255,143,143,.25); background: rgba(255,143,143,.08); }

.workflow-switch { margin: -2px 0 22px; padding: 4px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(2,9,8,.38); }
.workflow-switch button { min-height: 49px; padding: 7px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 10px; cursor: pointer; text-align: left; transition: color .18s, border-color .18s, background .18s; }
.workflow-switch button span { font-size: 12px; font-weight: 800; }
.workflow-switch button small { color: var(--faint); font: 400 8px "DM Mono", monospace; text-transform: uppercase; }
.workflow-switch button.active { color: var(--mint-soft); border-color: rgba(103,242,189,.22); background: rgba(103,242,189,.075); }
.workflow-switch button.active small { color: #7eb9a2; }

.field-label, .format-field legend, .select-field > span { display: block; margin-bottom: 9px; color: #c9d8d2; font-size: 12px; font-weight: 700; }
.field-label span { color: var(--faint); font-weight: 500; }
.prompt-wrap { position: relative; }
.prompt-wrap textarea, .select-field input, .select-field textarea { width: 100%; color: var(--ink); background: rgba(2,9,8,.52); border: 1px solid var(--line); border-radius: 14px; outline: 0; transition: border-color .18s, box-shadow .18s; }
.prompt-wrap textarea { min-height: 150px; padding: 17px 17px 34px; resize: vertical; line-height: 1.6; }
textarea::placeholder, input::placeholder { color: #50615b; }
.prompt-wrap textarea:focus, .select-field input:focus, .select-field textarea:focus, .select-field select:focus { border-color: rgba(103,242,189,.48); box-shadow: 0 0 0 3px rgba(103,242,189,.07); }
.prompt-wrap > span { position: absolute; right: 13px; bottom: 10px; color: var(--faint); font: 400 10px "DM Mono", monospace; }
.prompt-starters { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.prompt-starters button { padding: 7px 10px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; font-size: 10px; cursor: pointer; }
.prompt-starters button:hover { color: var(--mint-soft); border-color: rgba(103,242,189,.3); }
.prompt-starters .structured-trigger { color: var(--mint-soft); border-color: rgba(103,242,189,.24); background: rgba(103,242,189,.045); }
.structured-trigger svg { width: 13px; height: 13px; margin-right: 5px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }

.swarm-panel { margin-top: 18px; padding: 18px; border: 1px solid rgba(103,242,189,.15); border-radius: 17px; background: linear-gradient(135deg, rgba(103,242,189,.045), rgba(104,167,255,.025)); }
.swarm-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.swarm-heading > div:first-child > strong, .swarm-duration-block strong { display: block; font-size: 11px; }
.swarm-heading p, .swarm-duration-block p { margin: 4px 0 0; color: var(--faint); font-size: 9px; line-height: 1.45; }
.swarm-tools { display: flex; align-items: flex-end; gap: 7px; }
.swarm-tools label > span { display: block; margin: 0 0 5px; color: var(--faint); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.swarm-tools select { height: 39px; padding: 0 28px 0 10px; color: var(--ink); background: rgba(2,9,8,.58); border: 1px solid var(--line); border-radius: 10px; outline: 0; font-size: 10px; }
.swarm-tools select option { background: #0b1917; }
.swarm-tools .button { min-height: 39px; padding: 0 11px; font-size: 10px; }
.swarm-directions { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.swarm-direction { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(2,9,8,.42); transition: border-color .18s, opacity .18s; }
.swarm-direction:focus-within { border-color: rgba(103,242,189,.32); }
.swarm-direction.disabled { opacity: .5; }
.swarm-direction-head { margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.swarm-direction-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.swarm-direction-title input { position: absolute; opacity: 0; }
.swarm-check { width: 17px; height: 17px; flex: 0 0 17px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; color: #06100e; background: transparent; }
.swarm-direction-title input:checked + .swarm-check { border-color: var(--mint); background: var(--mint); }
.swarm-direction-title input:checked + .swarm-check::after { content: "✓"; font-size: 11px; font-weight: 900; }
.swarm-direction-title input:focus-visible + .swarm-check { box-shadow: 0 0 0 3px rgba(103,242,189,.12); }
.swarm-direction-name { min-width: 0; color: var(--mint-soft); font-size: 10px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swarm-agent { color: var(--faint); font: 400 8px "DM Mono", monospace; text-transform: uppercase; }
.swarm-direction textarea { width: 100%; min-height: 112px; padding: 10px; resize: vertical; color: var(--ink); background: rgba(0,0,0,.18); border: 1px solid rgba(192,232,218,.09); border-radius: 9px; outline: 0; font-size: 10px; line-height: 1.5; }
.swarm-direction textarea:focus { border-color: rgba(103,242,189,.32); }
.swarm-duration-block { margin-top: 14px; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); }
.duration-chips { display: flex; gap: 6px; }
.duration-chips input { position: absolute; opacity: 0; }
.duration-chips span { min-width: 53px; height: 35px; padding: 0 9px; display: grid; place-items: center; color: var(--muted); background: rgba(2,9,8,.5); border: 1px solid var(--line); border-radius: 9px; font: 500 9px "DM Mono", monospace; cursor: pointer; }
.duration-chips input:checked + span { color: var(--mint-soft); border-color: rgba(103,242,189,.4); background: rgba(103,242,189,.08); }
.duration-chips input:focus-visible + span { box-shadow: 0 0 0 3px rgba(103,242,189,.12); }
.swarm-progress { margin-top: 14px; padding: 12px; border: 1px solid rgba(104,167,255,.18); border-radius: 11px; background: rgba(104,167,255,.045); }
.swarm-progress > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.swarm-progress span { color: var(--muted); font-size: 9px; }
.swarm-progress strong { color: var(--mint-soft); font: 500 9px "DM Mono", monospace; }
.swarm-progress .progress-track { margin: 9px 0 0; }

.storyboard-panel { margin-top: 2px; padding: 18px; border: 1px solid rgba(104,167,255,.18); border-radius: 17px; background: linear-gradient(135deg, rgba(104,167,255,.045), rgba(103,242,189,.025)); }
.storyboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.storyboard-heading strong { display: block; font-size: 11px; }
.storyboard-heading p { margin: 4px 0 0; color: var(--faint); font-size: 9px; line-height: 1.45; }
.storyboard-heading .button { min-height: 38px; padding: 0 11px; font-size: 10px; }
.storyboard-name { margin: 15px 0 12px; display: grid; gap: 6px; }
.storyboard-name span, .shot-field > span { color: var(--faint); font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.storyboard-name input, .shot-field input, .shot-field select, .shot-field textarea { width: 100%; color: var(--ink); background: rgba(2,9,8,.55); border: 1px solid var(--line); border-radius: 10px; outline: 0; }
.storyboard-name input { height: 41px; padding: 0 12px; }
.storyboard-name input:focus, .shot-field input:focus, .shot-field select:focus, .shot-field textarea:focus { border-color: rgba(103,242,189,.42); box-shadow: 0 0 0 3px rgba(103,242,189,.055); }
.storyboard-note { margin-bottom: 12px; padding: 10px 12px; display: flex; align-items: flex-start; gap: 8px; border: 1px solid rgba(255,196,105,.15); border-radius: 10px; background: rgba(91,63,25,.1); font-size: 8px; line-height: 1.45; }
.storyboard-note strong { flex: 0 0 auto; color: #e9c98f; }
.storyboard-note span { color: #94866f; }
.storyboard-shots { display: grid; gap: 10px; }
.storyboard-shot { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(2,9,8,.42); }
.storyboard-shot:focus-within { border-color: rgba(103,242,189,.25); }
.storyboard-shot-head { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.storyboard-shot-title { min-width: 0; display: flex; align-items: center; gap: 8px; }
.storyboard-shot-number { width: 23px; height: 23px; flex: 0 0 23px; display: grid; place-items: center; color: var(--mint); background: rgba(103,242,189,.08); border-radius: 7px; font: 500 8px "DM Mono", monospace; }
.storyboard-shot-title input { width: min(270px, 42vw); height: 34px; padding: 0 9px; color: var(--mint-soft); background: transparent; border: 1px solid transparent; border-radius: 8px; outline: 0; font-size: 10px; font-weight: 800; }
.storyboard-shot-title input:focus { border-color: var(--line); background: rgba(0,0,0,.16); }
.shot-actions { display: flex; gap: 4px; }
.shot-actions button { width: 28px; height: 28px; padding: 0; display: grid; place-items: center; color: var(--faint); background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.shot-actions button:hover { color: var(--mint-soft); border-color: rgba(103,242,189,.25); }
.shot-actions button:disabled { opacity: .3; cursor: not-allowed; }
.shot-actions svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shot-field { display: grid; gap: 5px; }
.shot-field textarea { min-height: 116px; padding: 11px; resize: vertical; font-size: 10px; line-height: 1.55; }
.shot-field input, .shot-field select { height: 38px; padding: 0 10px; font-size: 9px; }
.shot-field select option { background: #0b1917; }
.shot-meta { margin-top: 9px; display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.shot-structure { min-height: 38px; padding: 0 11px; white-space: nowrap; font-size: 9px; }
.batch-status { margin-top: 13px; padding: 13px; border: 1px solid rgba(104,167,255,.22); border-radius: 12px; background: rgba(104,167,255,.05); }
.batch-status-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.batch-status-head > div { display: grid; gap: 3px; }
.batch-status-head span { color: var(--faint); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.batch-status-head strong { color: var(--mint-soft); font-size: 11px; text-transform: capitalize; }
.batch-status-head code { max-width: 52%; overflow: hidden; color: var(--muted); font: 400 8px "DM Mono", monospace; text-overflow: ellipsis; white-space: nowrap; }
.batch-status .progress-track { margin: 11px 0 7px; }
.batch-status p { margin: 0; color: var(--faint); font-size: 9px; line-height: 1.45; }

.reference-block { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 18px; margin: 24px 0; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.character-block { margin: -1px 0 24px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: rgba(2,9,8,.28); }
.character-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.character-heading strong { display: block; font-size: 11px; }
.character-heading strong span { color: var(--faint); font-weight: 500; }
.character-heading p { margin: 4px 0 0; color: var(--faint); font-size: 9px; line-height: 1.45; }
.character-heading .button { min-height: 36px; padding: 0 11px; font-size: 9px; }
.character-list { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 7px; }
.character-list > p { margin: 0; color: var(--faint); font-size: 9px; }
.character-choice { position: relative; }
.character-choice input { position: absolute; opacity: 0; }
.character-choice span { min-height: 36px; padding: 0 11px; display: flex; align-items: center; gap: 7px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.018); font-size: 9px; cursor: pointer; }
.character-choice span::before { content: ""; width: 14px; height: 14px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; }
.character-choice input:checked + span { color: var(--mint-soft); border-color: rgba(103,242,189,.38); background: rgba(103,242,189,.07); }
.character-choice input:checked + span::before { content: "✓"; color: #06100e; border-color: var(--mint); background: var(--mint); font-size: 9px; font-weight: 900; }
.character-choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(103,242,189,.1); }
.character-note { margin-top: 10px; display: block; color: #52645e; font-size: 8px; line-height: 1.5; }
.field-copy .field-label { margin: 0 0 5px; }
.field-copy p { margin: 0; color: var(--faint); font-size: 10px; line-height: 1.45; }
.reference-input { display: grid; gap: 9px; }
.upload-zone { min-height: 72px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border: 1px dashed rgba(192,232,218,.23); border-radius: 14px; background: rgba(255,255,255,.018); cursor: pointer; position: relative; overflow: hidden; }
.upload-zone:hover, .upload-zone.dragging { border-color: rgba(103,242,189,.48); background: rgba(103,242,189,.035); }
.upload-zone input { position: absolute; opacity: 0; pointer-events: none; }
.upload-icon { width: 39px; height: 39px; flex: 0 0 39px; border-radius: 11px; background: rgba(103,242,189,.09); display: grid; place-items: center; }
.upload-icon svg { width: 19px; fill: none; stroke: var(--mint); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.upload-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.upload-copy strong { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-copy small { color: var(--faint); font-size: 9px; }
#referencePreview { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 9px; object-fit: contain; background: #000; }
.remove-reference { width: 25px; height: 25px; margin-left: auto; padding: 0; flex: 0 0 25px; color: var(--muted); background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.reference-fidelity { padding: 10px 12px; display: flex; align-items: flex-start; gap: 9px; border: 1px solid rgba(103,242,189,.14); border-radius: 11px; background: rgba(103,242,189,.035); cursor: pointer; }
.reference-fidelity[hidden] { display: none; }
.reference-fidelity input { margin-top: 2px; accent-color: var(--mint); }
.reference-fidelity span { display: grid; gap: 3px; }
.reference-fidelity strong { color: var(--mint-soft); font-size: 10px; }
.reference-fidelity small { color: var(--faint); font-size: 8px; line-height: 1.45; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.select-field select { width: 100%; height: 47px; padding: 0 38px 0 13px; color: var(--ink); background: rgba(2,9,8,.52); border: 1px solid var(--line); border-radius: 12px; outline: 0; cursor: pointer; }
.select-field option { background: #0b1917; }
.select-field input { height: 47px; padding: 0 13px; }
.select-field textarea { min-height: 110px; padding: 13px; resize: vertical; }
.format-field { margin: 22px 0 0; padding: 0; border: 0; }
.format-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.format-options label { min-width: 0; cursor: pointer; }
.format-options input { position: absolute; opacity: 0; }
.format-options label > span { min-height: 98px; padding: 13px 7px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.018); text-align: center; transition: border-color .18s, background .18s; }
.format-options input:checked + span { border-color: rgba(103,242,189,.5); background: rgba(103,242,189,.07); box-shadow: inset 0 0 0 1px rgba(103,242,189,.08); }
.format-options label.disabled { opacity: .36; pointer-events: none; }
.frame { display: block; width: 29px; height: 19px; border: 1.5px solid currentColor; border-radius: 3px; color: var(--faint); }
.frame.portrait { width: 14px; height: 24px; }
.format-options input:checked + span .frame { color: var(--mint); }
.format-options b { font-size: 10px; }
.format-options small { color: var(--faint); font: 400 8px "DM Mono", monospace; }
.submit-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-top: 27px; padding-top: 23px; border-top: 1px solid var(--line); }
.estimate { display: grid; grid-template-columns: auto auto; gap: 2px 11px; align-items: baseline; }
.estimate span { color: var(--muted); font-size: 10px; }
.estimate strong { color: var(--mint-soft); font: 500 14px "DM Mono", monospace; }
.estimate small { grid-column: 1 / -1; color: var(--faint); font-size: 8px; }
.submit-row .button { min-width: 175px; }

.stage { aspect-ratio: 16 / 10; min-height: 330px; display: grid; place-items: center; overflow: hidden; border-radius: 17px; border: 1px solid var(--line); background:
  linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
  linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
  radial-gradient(circle at 50% 40%, rgba(103,242,189,.08), transparent 55%), #06110f;
  background-size: 24px 24px, 24px 24px, auto, auto;
  position: relative;
}
.stage-empty, .stage-working { max-width: 310px; padding: 30px; text-align: center; }
.play-orbit { width: 94px; height: 94px; margin: 0 auto 22px; display: grid; place-items: center; border: 1px solid rgba(103,242,189,.12); border-radius: 50%; position: relative; }
.play-orbit::before, .play-orbit::after { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(103,242,189,.09); border-radius: 50%; }
.play-orbit::after { inset: 27px; }
.play-orbit span { width: 42px; height: 42px; border-radius: 50%; background: rgba(103,242,189,.1); display: grid; place-items: center; }
.play-orbit svg { width: 20px; fill: none; stroke: var(--mint); stroke-width: 1.5; stroke-linejoin: round; }
.stage strong { display: block; margin-bottom: 7px; font-size: 14px; }
.stage p { margin: 0; color: var(--faint); font-size: 11px; line-height: 1.55; }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.render-visual { width: 90px; height: 70px; margin: 0 auto 22px; display: flex; align-items: flex-end; justify-content: center; gap: 5px; }
.render-visual div { width: 10px; background: var(--mint); border-radius: 5px; animation: wave 1.1s ease-in-out infinite; box-shadow: 0 0 18px rgba(103,242,189,.25); }
.render-visual div:nth-child(1) { height: 34%; animation-delay: -.25s; }
.render-visual div:nth-child(2) { height: 78%; }
.render-visual div:nth-child(3) { height: 48%; animation-delay: -.5s; }
@keyframes wave { 0%,100% { transform: scaleY(.6); opacity: .45; } 50% { transform: scaleY(1.15); opacity: 1; } }
.progress-track { height: 4px; margin: 20px 0 8px; background: rgba(255,255,255,.07); border-radius: 999px; overflow: hidden; }
.progress-track span { height: 100%; width: 0; display: block; background: linear-gradient(90deg, var(--mint), var(--blue)); border-radius: inherit; transition: width .5s ease; }
.stage-working > small { color: var(--muted); font: 400 9px "DM Mono", monospace; }
.result-meta { margin-top: 12px; padding: 12px 2px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-meta > div:first-child { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.result-meta span { color: var(--faint); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.result-meta code { max-width: 230px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font: 400 10px "DM Mono", monospace; white-space: nowrap; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.result-actions .button { min-height: 36px; padding: 0 11px; font-size: 10px; }

.recent { margin-top: 23px; padding-top: 20px; border-top: 1px solid var(--line); }
.recent-heading { display: flex; align-items: center; justify-content: space-between; }
.recent-heading h3 { margin: 0; font-size: 11px; }
.recent-heading button { color: var(--faint); background: transparent; border: 0; font-size: 9px; cursor: pointer; }
.recent-heading button:hover { color: var(--ink); }
.recent-list { margin-top: 12px; display: grid; gap: 7px; max-height: 184px; overflow-y: auto; }
.recent-list > p { margin: 4px 0; color: var(--faint); font-size: 10px; }
.recent-item { width: 100%; padding: 10px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; color: inherit; background: rgba(255,255,255,.02); border: 1px solid transparent; border-radius: 10px; text-align: left; cursor: pointer; }
.recent-item:hover { border-color: var(--line); }
.recent-thumb { width: 34px; height: 28px; display: grid; place-items: center; color: var(--mint); border-radius: 6px; background: rgba(103,242,189,.07); font-size: 9px; }
.recent-copy { min-width: 0; }
.recent-copy strong { margin: 0 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.recent-copy small { display: block; color: var(--faint); font: 400 8px "DM Mono", monospace; }
.recent-status { color: var(--muted); font: 400 8px "DM Mono", monospace; text-transform: uppercase; }
.recent-status.completed { color: var(--mint); }
.recent-status.failed { color: var(--danger); }

.gallery-panel { margin-top: 20px; padding: 28px; }
.gallery-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.gallery-heading .eyebrow { margin-bottom: 9px; }
.gallery-heading h2 { margin: 0; font-size: 26px; letter-spacing: -.04em; }
.gallery-heading p { max-width: 640px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.gallery-controls { display: flex; align-items: flex-end; gap: 10px; }
.gallery-filter { min-width: 145px; }
.gallery-filter > span { display: block; margin-bottom: 6px; color: var(--faint); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.gallery-filter select { width: 100%; height: 42px; padding: 0 34px 0 12px; color: var(--ink); background: rgba(2,9,8,.52); border: 1px solid var(--line); border-radius: 11px; outline: 0; }
.gallery-gate, .gallery-empty { min-height: 270px; padding: 45px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.gallery-gate .dialog-icon { margin-bottom: 14px; }
.gallery-gate strong, .gallery-empty strong { font-size: 14px; }
.gallery-gate p, .gallery-empty p { max-width: 430px; margin: 7px 0 18px; color: var(--faint); font-size: 10px; line-height: 1.55; }
.gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; padding: 22px 0 4px; }
.gallery-grid:not([hidden]) { display: grid; }
.gallery-card { width: 100%; min-width: 0; padding: 0; overflow: hidden; color: inherit; background: rgba(255,255,255,.018); border: 1px solid var(--line); border-radius: 15px; text-align: left; cursor: pointer; transition: transform .18s, border-color .18s, background .18s; }
.gallery-card:hover { transform: translateY(-2px); border-color: rgba(103,242,189,.3); background: rgba(103,242,189,.025); }
.gallery-card-media { aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 42%, rgba(103,242,189,.10), transparent 60%), #050d0b; position: relative; }
.gallery-card.portrait .gallery-card-media { aspect-ratio: 4 / 5; }
.gallery-card-media img { width: 100%; height: 100%; object-fit: cover; }
.gallery-placeholder { width: 50px; height: 50px; display: grid; place-items: center; color: var(--mint); background: rgba(103,242,189,.07); border: 1px solid rgba(103,242,189,.12); border-radius: 50%; }
.gallery-placeholder svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.gallery-card-state { position: absolute; top: 10px; right: 10px; padding: 5px 7px; color: #daf8ed; background: rgba(5,13,11,.76); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; backdrop-filter: blur(8px); font: 500 8px/1 "DM Mono", monospace; text-transform: uppercase; }
.gallery-card-state.completed { color: var(--mint); }
.gallery-card-state.failed { color: var(--danger); }
.gallery-progress { position: absolute; right: 10px; bottom: 10px; left: 10px; height: 3px; overflow: hidden; background: rgba(255,255,255,.12); border-radius: 999px; }
.gallery-progress span { height: 100%; display: block; background: var(--mint); }
.gallery-card-copy { padding: 13px; display: block; }
.gallery-card-copy strong { height: 31px; margin: 0 0 9px; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 10px; line-height: 1.5; }
.gallery-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--faint); font: 400 8px "DM Mono", monospace; }
.gallery-card-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-skeleton { pointer-events: none; }
.gallery-skeleton .gallery-card-media, .gallery-skeleton .skeleton-line { background: linear-gradient(100deg, rgba(255,255,255,.025) 30%, rgba(255,255,255,.075) 50%, rgba(255,255,255,.025) 70%); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }
.gallery-skeleton .skeleton-line { height: 8px; margin: 13px; border-radius: 5px; }
.gallery-skeleton .skeleton-line.short { width: 46%; margin-top: -5px; }
@keyframes shimmer { to { background-position-x: -220%; } }
.gallery-footer { padding-top: 20px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.gallery-footer span { color: var(--faint); font: 400 9px "DM Mono", monospace; }
.gallery-retention { margin: 15px 0 0; color: #54655f; font-size: 8px; text-align: right; }

dialog { width: min(520px, calc(100% - 32px)); padding: 0; color: var(--ink); border: 1px solid rgba(192,232,218,.18); border-radius: 20px; background: var(--panel-solid); box-shadow: 0 30px 100px rgba(0,0,0,.65); }
dialog.wide-dialog { width: min(760px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(1,7,6,.74); backdrop-filter: blur(7px); }
.dialog-card { padding: 30px; position: relative; }
.dialog-close { position: absolute; top: 15px; right: 15px; width: 30px; height: 30px; color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.dialog-icon { width: 47px; height: 47px; margin-bottom: 22px; display: grid; place-items: center; border-radius: 13px; background: rgba(103,242,189,.08); }
.dialog-icon svg { width: 22px; fill: none; stroke: var(--mint); stroke-width: 1.6; }
.dialog-card h2 { margin: 0 0 10px; font-size: 24px; letter-spacing: -.04em; }
.dialog-card > p:not(.eyebrow) { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.swarm-confirm-icon svg { stroke-linejoin: round; }
.swarm-confirm-summary { margin: 20px 0 14px; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--line); border-radius: 13px; background: rgba(2,9,8,.45); }
.swarm-confirm-summary > div { padding: 4px 12px; display: flex; flex-direction: column; gap: 5px; }
.swarm-confirm-summary > div + div { border-left: 1px solid var(--line); }
.swarm-confirm-summary span { color: var(--faint); font-size: 9px; text-transform: uppercase; letter-spacing: .07em; }
.swarm-confirm-summary strong { color: var(--mint-soft); font: 500 16px "DM Mono", monospace; }
.dialog-card .confirm-note { margin: 0; color: var(--faint); font-size: 9px; }
.spritesheet-preview { width: 100%; max-height: 58vh; object-fit: contain; border: 1px solid var(--line); border-radius: 13px; background: #030807; }
.prompt-builder-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prompt-builder-grid .select-field { min-width: 0; }
.prompt-builder-grid .select-field > span { margin-bottom: 6px; font-size: 10px; }
.prompt-builder-grid .select-field textarea { min-height: 84px; }
.prompt-builder-grid .builder-wide { grid-column: 1 / -1; }
.storyboard-confirm-icon svg { stroke-linejoin: round; }
.toast { max-width: min(430px, calc(100% - 32px)); padding: 13px 16px; position: fixed; right: 22px; bottom: 22px; z-index: 50; color: var(--ink); background: #10241f; border: 1px solid rgba(103,242,189,.24); border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.4); font-size: 11px; line-height: 1.45; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,143,143,.32); }

@media (max-width: 1020px) {
  .intro { grid-template-columns: 1fr; gap: 25px; }
  .sunset-note { max-width: 600px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .output { position: static; }
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { height: 64px; padding: 0 16px; }
  .product-name, .api-state span { display: none; }
  .top-actions { gap: 9px; }
  .shell { width: min(100% - 24px, 1440px); padding: 37px 0 45px; }
  .intro h1 { font-size: 43px; }
  .intro > div:first-child > p { font-size: 14px; }
  .composer, .output { padding: 18px; border-radius: 18px; }
  .secure-label { display: none; }
  .workflow-switch button { padding: 7px 6px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 2px; }
  .workflow-switch button small { white-space: normal; }
  .reference-block { grid-template-columns: 1fr; gap: 11px; }
  .character-heading { align-items: stretch; flex-direction: column; }
  .settings-grid { grid-template-columns: 1fr; }
  .swarm-heading, .swarm-duration-block { align-items: stretch; flex-direction: column; }
  .swarm-tools { align-items: stretch; }
  .swarm-tools label { flex: 1; }
  .swarm-tools select { width: 100%; }
  .swarm-directions { grid-template-columns: 1fr; }
  .storyboard-heading { align-items: stretch; flex-direction: column; }
  .shot-meta { grid-template-columns: 78px minmax(0, 1fr); }
  .shot-structure { grid-column: 1 / -1; }
  .prompt-builder-grid { grid-template-columns: 1fr; }
  .prompt-builder-grid .builder-wide { grid-column: auto; }
  .duration-chips { display: grid; grid-template-columns: repeat(3, 1fr); }
  .duration-chips span { min-width: 0; }
  .format-options { grid-template-columns: 1fr 1fr; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .submit-row .button { min-height: 50px; }
  .stage { width: 100%; min-height: 280px; aspect-ratio: auto; }
  .result-meta { align-items: stretch; flex-direction: column; }
  .result-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .gallery-panel { padding: 18px; }
  .gallery-heading { align-items: stretch; flex-direction: column; }
  .gallery-controls { align-items: stretch; }
  .gallery-filter { flex: 1; }
  .gallery-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .gallery-card-copy { padding: 10px; }
}

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