:root {
  color-scheme: dark;
  --ink: #f4f5f0;
  --muted: #92999c;
  --faint: #5d666a;
  --line: #293136;
  --panel: #11171b;
  --panel-deep: #0b1013;
  --acid: #d9ff67;
  --acid-dark: #a4c53b;
  --red: #ff796d;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #080b0e; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: #080b0e; }
.topbar { height: 72px; border-bottom: 1px solid var(--line); padding: 0 5vw; display: flex; align-items: center; justify-content: space-between; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 12px; font-size: 14px; letter-spacing: .01em; }
.brand strong { font-weight: 750; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; background: var(--acid); color: #0c1007; font-weight: 850; font-size: 11px; letter-spacing: -.04em; }
.topbar-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 9px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(255,121,109,.1); }
.status-dot.is-ready { background: var(--acid); box-shadow: 0 0 0 3px rgba(217,255,103,.1); }
.divider { height: 12px; width: 1px; background: var(--line); }
.workspace { width: min(1220px, 90vw); margin: 0 auto; flex: 1; padding: 78px 0 36px; }
.intro { max-width: 680px; margin-bottom: 48px; }
.eyebrow, .kicker { color: var(--acid); font-size: 10px; font-weight: 750; letter-spacing: .2em; }
.eyebrow { margin: 0 0 20px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(42px, 6vw, 78px); line-height: .95; letter-spacing: -.055em; font-weight: 720; max-width: 700px; }
.intro-copy { color: var(--muted); font-size: 17px; line-height: 1.6; max-width: 470px; }
.studio-grid { display: grid; grid-template-columns: minmax(0, .93fr) minmax(0, 1.07fr); gap: 18px; }
.control-panel, .preview-panel { border: 1px solid var(--line); background: var(--panel); padding: 28px; min-width: 0; }
.control-panel { display: flex; flex-direction: column; }
.preview-panel { background: var(--panel-deep); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 31px; }
.panel-heading h2 { margin: 8px 0 0; font-size: 24px; letter-spacing: -.035em; }
.panel-index { color: var(--faint); font-size: 11px; border: 1px solid var(--line); padding: 5px 8px; }
.status-pill { border: 1px solid var(--line); color: var(--muted); padding: 6px 8px; font-size: 9px; letter-spacing: .13em; }
.status-pill[data-status="completed"] { color: var(--acid); border-color: var(--acid-dark); }
.status-pill[data-status="failed"] { color: var(--red); border-color: var(--red); }
.field-label { display: block; color: #c6cccb; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 10px; }
.optional { color: var(--faint); text-transform: none; letter-spacing: 0; margin-left: 4px; }
.api-settings { margin: 0 0 27px; padding: 0 0 22px; border-bottom: 1px solid var(--line); }
.api-settings .field-label:not(:first-child) { margin-top: 17px; }
.api-action-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; min-height: 32px; }
.secondary-button { height: 32px; border: 1px solid var(--line); padding: 0 11px; color: var(--ink); background: transparent; font-size: 11px; white-space: nowrap; }
.secondary-button:hover:not(:disabled) { border-color: var(--acid-dark); color: var(--acid); }
.secondary-button:disabled { opacity: .55; cursor: wait; }
.api-action-row span { color: var(--faint); font-size: 10px; line-height: 1.35; }
.save-config { display: flex; align-items: center; gap: 8px; margin-top: 13px; color: var(--muted); font-size: 11px; }
.save-config input { width: 14px; height: 14px; padding: 0; accent-color: var(--acid); }
textarea, input, select { width: 100%; color: var(--ink); background: #0b1013; border: 1px solid var(--line); border-radius: 0; outline: none; transition: border-color .2s, background .2s; }
textarea:focus, input:focus, select:focus { border-color: var(--acid-dark); background: #0d1417; }
textarea { resize: vertical; min-height: 148px; padding: 15px; line-height: 1.55; font-size: 14px; }
input, select { height: 45px; padding: 0 12px; font-size: 13px; }
select { appearance: none; background-image: none; }
.field-note { display: flex; justify-content: space-between; gap: 16px; color: var(--faint); font-size: 10px; line-height: 1.4; margin: 9px 0 27px; }
.reference-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 27px; }
.reference-empty { color: var(--faint); font-size: 10px; line-height: 1.5; }
.reference-list .reference-empty { grid-column: 1 / -1; }
.reference-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) 26px; align-items: center; gap: 8px; min-height: 50px; padding: 5px; border: 1px solid var(--line); }
.reference-item img { width: 44px; height: 38px; object-fit: cover; background: #11191d; }
.reference-token { border: 0; padding: 0; background: transparent; color: var(--acid); text-align: left; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reference-token small { display: block; margin-top: 3px; color: var(--faint); font-size: 9px; }
.reference-remove, .saved-delete { border: 0; width: 26px; height: 26px; padding: 0; color: var(--muted); background: transparent; font-size: 18px; }
.reference-remove:hover, .saved-delete:hover { color: var(--red); }
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 19px; }
.settings-row label { min-width: 0; }
.generate-button { height: 50px; border: 0; margin-top: 28px; padding: 0 16px; background: var(--acid); color: #0d1209; display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 800; letter-spacing: .02em; transition: background .2s, transform .2s; }
.generate-button:hover { background: #edff9d; transform: translateY(-1px); }
.generate-button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-arrow { font-size: 20px; font-weight: 400; }
.form-error { color: var(--red); min-height: 17px; margin: 12px 0 0; font-size: 12px; line-height: 1.4; }
.preview-stage { min-height: 377px; position: relative; overflow: hidden; display: grid; place-items: center; background: #11191d; border: 1px solid #303a3e; }
.preview-stage::before, .preview-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.preview-stage::before { background: repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(255,255,255,.025) 4px); opacity: .35; }
.preview-stage::after { width: 38%; height: 100%; left: 28%; background: rgba(217,255,103,.055); transform: skewX(-18deg); animation: scan 7s linear infinite; }
.stage-grid { position: absolute; inset: 0; opacity: .42; background-image: linear-gradient(rgba(217,255,103,.1) 1px, transparent 1px), linear-gradient(90deg, rgba(217,255,103,.1) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent); }
.stage-copy { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 13px; }
.stage-copy strong { font-size: clamp(26px, 4vw, 43px); line-height: .98; letter-spacing: -.06em; font-weight: 650; }
.stage-copy span:last-child { color: var(--muted); font-size: 11px; }
.stage-line { width: 35px; height: 2px; background: var(--acid); }
.timecode { position: absolute; z-index: 1; left: 16px; bottom: 14px; color: var(--acid); font-size: 10px; letter-spacing: .12em; }
.stage-corner { position: absolute; width: 18px; height: 18px; border-color: var(--acid); opacity: .8; z-index: 2; }
.top-left { left: 15px; top: 15px; border-top: 1px solid; border-left: 1px solid; }
.bottom-right { right: 15px; bottom: 15px; border-right: 1px solid; border-bottom: 1px solid; }
video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #050607; z-index: 3; }
.preview-stage.has-video::before, .preview-stage.has-video::after, .preview-stage.has-video .stage-grid { display: none; }
.progress-wrap { margin-top: 20px; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-bottom: 9px; }
.progress-track { height: 3px; background: #273035; overflow: hidden; }
#progress-bar { height: 100%; background: var(--acid); transition: width .45s ease; }
.output-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 21px; color: var(--faint); font-size: 10px; }
.download-link { color: var(--acid); text-decoration: none; white-space: nowrap; }
.saved-videos { margin-top: 25px; padding-top: 17px; border-top: 1px solid var(--line); }
.saved-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--faint); font-size: 10px; }
.saved-video-list { display: grid; gap: 7px; }
.saved-video-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; min-height: 36px; padding: 0 4px 0 9px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.saved-video-item span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.saved-video-item a { color: var(--acid); text-decoration: none; font-size: 10px; }
.workflow-strip { margin-top: 60px; padding-top: 19px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 23px; color: var(--muted); font-size: 11px; }
.workflow-strip > div { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.strip-number { color: var(--acid); font-size: 10px; }
.strip-rule { flex: 1; height: 1px; background: var(--line); }
.footer { width: min(1220px, 90vw); margin: auto; padding: 20px 0 26px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--faint); font-size: 10px; letter-spacing: .05em; }
@keyframes scan { from { transform: translateX(-130%) skewX(-18deg); } to { transform: translateX(330%) skewX(-18deg); } }
@media (max-width: 760px) {
  .topbar { height: 62px; padding: 0 5vw; }
  .topbar-meta span:last-child, .topbar-meta .divider { display: none; }
  .workspace { padding-top: 54px; }
  .intro { margin-bottom: 34px; }
  h1 { font-size: 48px; }
  .intro-copy { font-size: 15px; }
  .studio-grid { grid-template-columns: 1fr; }
  .control-panel, .preview-panel { padding: 21px; }
  .api-action-row { align-items: flex-start; flex-direction: column; gap: 7px; }
  .preview-stage { min-height: 300px; }
  .reference-list { grid-template-columns: 1fr; }
  .workflow-strip { gap: 10px; align-items: flex-start; }
  .workflow-strip > div { flex-direction: column; align-items: flex-start; gap: 5px; white-space: normal; line-height: 1.3; }
  .footer { flex-direction: column; gap: 8px; }
}
