﻿:root {
  color-scheme: light;
  --ink: #151821;
  --muted: #6b7280;
  --line: #e2e5ec;
  --panel: #ffffff;
  --page: #f7f8fb;
  --accent: #6d5dfc;
  --accent-dark: #4f46e5;
  --warm: #b95e1f;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="mono"] {
  --ink: #111111;
  --muted: #666666;
  --line: #d6d6d6;
  --panel: #ffffff;
  --page: #f2f2f2;
  --accent: #111111;
  --accent-dark: #000000;
  --warm: #333333;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

body[data-theme="cinema"] {
  --ink: #f5f7fb;
  --muted: #a9b0bd;
  --line: #2b3242;
  --panel: #141923;
  --page: #0c1018;
  --accent: #8b7cff;
  --accent-dark: #c4bfff;
  --warm: #d27b38;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

body[data-theme="studio"] {
  --ink: #18202f;
  --muted: #64748b;
  --line: #d7deea;
  --panel: #ffffff;
  --page: #eef4fb;
  --accent: #08756f;
  --accent-dark: #0f4f4b;
  --warm: #b95e1f;
  --shadow: 0 14px 34px rgba(20, 31, 54, 0.08);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(1500px, calc(100% - 36px));
  margin: 0 auto;
  padding: 22px 0 32px;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  background: rgba(244, 246, 250, 0.92);
  backdrop-filter: blur(14px);
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(20, 31, 54, 0.18);
  padding: 26px;
}

.login-card h1 {
  font-size: 2rem;
}

.login-card p {
  margin: 0;
  color: var(--muted);
}

.admin-shell {
  max-width: 1180px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.admin-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.admin-wide {
  grid-column: 1 / -1;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 12px;
}

.admin-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-row strong {
  overflow-wrap: anywhere;
}

.admin-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.admin-row form {
  display: flex;
  gap: 8px;
}

.admin-row input {
  width: 110px;
}

.admin-row button,
.admin-row a {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
  padding: 0 10px;
  text-decoration: none;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.06);
  padding: 16px 18px;
}

.header-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.header-meta span {
  display: inline-grid;
  min-height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0 11px;
}

.logout-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0 11px;
}

.style-menu {
  position: relative;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 900;
}

.icon-button:hover,
.icon-button[aria-expanded="true"] {
  border-color: rgba(109, 93, 252, 0.34);
  background: rgba(109, 93, 252, 0.08);
  color: var(--accent-dark);
}

.style-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10;
  display: grid;
  width: 250px;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 45px rgba(17, 24, 39, 0.16);
  padding: 12px;
}

.model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 10px 11px;
  text-align: left;
}

.tool-model-select {
  position: relative;
  margin: -8px 0 0;
}

.model-option strong {
  font-size: 0.9rem;
}

.model-option span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.model-option.active {
  border-color: rgba(109, 93, 252, 0.34);
  background: rgba(109, 93, 252, 0.08);
}

.model-option:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.logout-button:hover {
  color: var(--ink);
}

.studio-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.model-rail {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.rail-section {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
}

.tool-link {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 10px 11px;
  text-align: left;
}

.tool-link span {
  font-weight: 850;
}

.tool-link small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.tool-link.active {
  border-color: rgba(109, 93, 252, 0.24);
  background: linear-gradient(135deg, rgba(109, 93, 252, 0.11), rgba(8, 117, 111, 0.06));
  box-shadow: inset 3px 0 0 var(--accent);
}

.tool-link:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.style-card {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 12px;
  text-align: left;
}

.style-card strong {
  font-size: 0.95rem;
}

.style-card span,
.rail-stat span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.style-card.active {
  border-color: rgba(109, 93, 252, 0.34);
  background: rgba(109, 93, 252, 0.08);
  box-shadow: inset 3px 0 0 var(--accent);
}

body[data-theme="mono"] .style-card.active {
  border-color: #111;
  background: #eeeeee;
}

.rail-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.rail-stat strong {
  font-size: 0.86rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(410px, 470px) minmax(620px, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

body[data-theme="cinema"] .app-header,
body[data-theme="cinema"] .rail-section,
body[data-theme="cinema"] .panel,
body[data-theme="cinema"] .login-card,
body[data-theme="cinema"] .live-status,
body[data-theme="cinema"] .task-meta div,
body[data-theme="cinema"] .response-details,
body[data-theme="cinema"] .form-section,
body[data-theme="cinema"] .section-heading,
body[data-theme="cinema"] .cost-row,
body[data-theme="cinema"] input,
body[data-theme="cinema"] textarea,
body[data-theme="cinema"] .style-card,
body[data-theme="cinema"] .tool-link,
body[data-theme="cinema"] .ghost-button,
body[data-theme="cinema"] .header-meta span,
body[data-theme="cinema"] .logout-button {
  background-color: var(--panel);
  color: var(--ink);
}

body[data-theme="cinema"] .live-status dl div,
body[data-theme="cinema"] .rail-stat,
body[data-theme="cinema"] .segmented span,
body[data-theme="cinema"] .mode-tabs button,
body[data-theme="cinema"] .model-tabs button,
body[data-theme="cinema"] .preview-tabs button {
  background: #0f141d;
  color: var(--ink);
}

.form-panel,
.result-panel {
  padding: 18px;
}

.form-panel {
  position: sticky;
  top: 18px;
}

.brand-row,
.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  max-width: none;
  font-size: 1.75rem;
  letter-spacing: 0;
}

h2 {
  font-size: 1.2rem;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(15, 118, 110, 0.08);
  padding: 7px 11px;
  font-size: 0.83rem;
  font-weight: 700;
}

.model-note {
  max-width: 440px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading div {
  display: grid;
  gap: 3px;
}

.section-heading strong {
  font-size: 0.95rem;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.model-chip {
  display: inline-grid;
  min-height: 30px;
  place-items: center;
  border: 1px solid rgba(109, 93, 252, 0.24);
  border-radius: 999px;
  background: rgba(109, 93, 252, 0.08);
  color: var(--accent-dark) !important;
  white-space: nowrap;
  padding: 0 10px;
}

.model-tabs,
.mode-tabs,
.preview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-tabs {
  margin: -8px 0 20px;
}

.model-tabs button,
.offline-model,
.mode-tabs button,
.preview-tabs button {
  display: inline-grid;
  min-height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  padding: 0 12px;
}

.model-tabs button.active,
.mode-tabs button.active,
.preview-tabs button.active {
  border-color: rgba(109, 93, 252, 0.34);
  background: rgba(109, 93, 252, 0.09);
  color: var(--accent-dark);
}

.offline-model {
  background: #f3f4f6;
  color: #8a909b;
  cursor: not-allowed;
  text-decoration: line-through;
}

form {
  display: grid;
  gap: 12px;
}

.form-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 14px;
}

label,
fieldset {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

label span,
legend,
.input-mode > span {
  font-size: 0.88rem;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.12);
}

textarea {
  min-height: 178px;
  resize: vertical;
  padding: 14px;
  line-height: 1.45;
}

input {
  min-height: 46px;
  padding: 0 12px;
}

select {
  min-height: 46px;
  width: 100%;
  border: 1px solid rgba(109, 93, 252, 0.28);
  border-radius: 8px;
  background: rgba(109, 93, 252, 0.08);
  color: var(--accent-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  outline: none;
  padding: 0 12px;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.12);
}

.category-select {
  gap: 7px;
}

.input-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.media-inputs {
  display: grid;
  gap: 12px;
}

.upload-box {
  min-height: 132px;
  align-content: center;
  justify-items: center;
  border: 1px dashed #adb5c3;
  border-radius: 8px;
  background: #fbfcff;
  cursor: pointer;
  padding: 18px;
  text-align: center;
}

.upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-box strong {
  color: var(--ink);
}

.upload-box span {
  color: var(--muted);
  font-weight: 600;
}

.image-preview {
  display: grid;
  gap: 8px;
  margin: 0;
}

.image-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
}

.image-preview figcaption {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.4;
}

.field-note.is-warning {
  color: #9a4b13;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

fieldset:last-child .segmented {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented label {
  display: block;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.segmented input:checked + span {
  border-color: rgba(109, 93, 252, 0.5);
  background: var(--accent);
  color: #fff;
}

.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(185, 94, 31, 0.26);
  border-radius: 8px;
  background: rgba(185, 94, 31, 0.08);
  padding: 12px 14px;
  color: #6b3b16;
  font-weight: 800;
}

.cost-row strong {
  color: #8c3f12;
  font-size: 1.1rem;
}

.primary-button,
.ghost-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 18px rgba(109, 93, 252, 0.22);
  font-size: 0.98rem;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.preview-tabs {
  margin-bottom: 14px;
}

.live-status {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.live-status > div:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.live-status strong {
  overflow-wrap: anywhere;
}

.live-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #9ca3af;
}

.live-status[data-state="active"] .live-dot {
  background: #2dd4bf;
  box-shadow: 0 0 0 6px rgba(45, 212, 191, 0.16);
  animation: pulse 1200ms ease-in-out infinite;
}

.live-status[data-state="success"] .live-dot {
  background: #16a34a;
}

.live-status[data-state="error"] .live-dot {
  background: var(--danger);
}

.live-status dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.live-status dl div {
  min-width: 0;
  border: 1px solid rgba(217, 221, 229, 0.82);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
}


button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.video-stage {
  position: relative;
  display: grid;
  min-height: 640px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(109, 93, 252, 0.16), transparent 36%),
    #0f1117;
  place-items: center;
}

body[data-theme="mono"] .video-stage {
  background: #111;
}

body[data-theme="cinema"] .video-stage {
  background:
    radial-gradient(circle at center, rgba(139, 124, 255, 0.16), transparent 38%),
    #05070b;
}

body[data-theme="studio"] .video-stage {
  background:
    linear-gradient(135deg, rgba(8, 117, 111, 0.14), transparent 36%),
    #101827;
}

.video-stage video {
  width: 100%;
  height: 100%;
  max-height: 560px;
  object-fit: contain;
  background: #000;
}

.empty-state,
.loading-state,
.error-state {
  display: grid;
  gap: 10px;
  max-width: 380px;
  padding: 24px;
  color: #e5e7eb;
  text-align: center;
  justify-items: center;
}

.empty-state strong,
.loading-state strong,
.error-state strong {
  font-size: 1.35rem;
}

.empty-state span,
.loading-state span,
.error-state span {
  color: #b8c0ce;
}

.spinner {
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
  border: 4px solid rgba(255, 255, 255, 0.22);
  border-top-color: #2dd4bf;
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

.progress-state {
  width: min(420px, calc(100% - 48px));
}

.progress-shell {
  position: relative;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b7cff, #2dd4bf, #fbbf24);
  transition: width 500ms ease;
}

.progress-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.26), transparent);
  animation: shimmer 1400ms linear infinite;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  width: 100%;
  color: #d7dde8;
  font-size: 0.82rem;
  font-weight: 800;
}

.video-stage.is-loading {
  background:
    radial-gradient(circle at center, rgba(109, 93, 252, 0.2), transparent 38%),
    #101827;
}

.video-stage.has-error {
  background:
    radial-gradient(circle at center, rgba(180, 35, 24, 0.18), transparent 42%),
    #1b1114;
}

.error-state strong {
  color: #fecaca;
}

.output-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.download-button {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--warm);
  color: #fff;
  font-weight: 900;
  padding: 0 14px;
  text-decoration: none;
}

.download-button:hover {
  background: #8c3f12;
}

.task-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.task-meta div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fafbfc;
}

dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 0;
  min-height: 22px;
  overflow-wrap: anywhere;
  font-weight: 700;
}

pre {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
  padding: 14px;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.response-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.response-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  list-style-position: inside;
  padding: 12px 14px;
  text-transform: uppercase;
}

.response-details pre {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.is-error {
  color: var(--danger);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.25);
  }
}

@media (max-width: 1120px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }

  .model-rail {
    position: static;
    grid-template-columns: 1fr 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .form-panel {
    position: static;
  }
}

@media (max-width: 860px) {
  .model-rail {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-meta {
    justify-content: flex-start;
  }

  .workspace,
  .grid,
  .task-meta,
  .live-status dl {
    grid-template-columns: 1fr;
  }

  .input-mode {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-row,
  .result-header {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    max-width: none;
    font-size: 1.7rem;
  }

  .video-stage {
    min-height: 360px;
  }

  .form-panel {
    position: static;
  }
}

