:root {
  color-scheme: light;
  --bg: #edf1f4;
  --paper: #f8fafc;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --soft: #eef3f6;
  --line: #d2dce6;
  --line-strong: #b9c6d4;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #dff5f0;
  --charcoal: #161a22;
  --charcoal-2: #222734;
  --gold: #b7791f;
  --bad: #b42318;
  --good: #047857;
  --blue: #2563eb;
  --shadow: 0 18px 38px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 360px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
}

body.busy-active {
  overflow: hidden;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

button:hover {
  border-color: var(--line-strong);
  box-shadow: 0 7px 18px rgba(16, 24, 40, 0.10);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(4px);
  padding: 18px;
}

body.busy-active .busy-overlay {
  display: grid;
}

.busy-card {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.35);
  padding: 26px;
  text-align: center;
}

.busy-card h3 {
  margin: 14px 0 8px;
  font-size: 22px;
}

.busy-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.busy-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border: 4px solid #dbeafe;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.center-notice {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.18);
  padding: 18px;
}

.center-notice-card {
  width: min(460px, 100%);
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
  padding: 22px;
  text-align: center;
}

.center-notice-card strong {
  display: block;
  font-size: 22px;
  margin-bottom: 10px;
}

.center-notice-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  word-break: break-word;
}

.center-notice.ok .center-notice-card {
  border-color: rgba(4, 120, 87, 0.28);
}

.center-notice.ok .center-notice-card strong {
  color: var(--good);
}

.center-notice.bad .center-notice-card {
  border-color: rgba(180, 35, 24, 0.28);
}

.center-notice.bad .center-notice-card strong {
  color: var(--bad);
}

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

.shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid #cbd5e1;
  background: #fbfcfd;
  padding: 20px;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 18px;
}

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--charcoal);
  color: #fff;
  font-weight: 900;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h2,
.block h3,
.section-title h3 {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1;
}

.brand p,
.eyebrow,
.panel label,
.summary span,
.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.panel,
.block,
.render-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.045);
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.panel.compact {
  padding-bottom: 12px;
}

.panel-head,
.section-title,
.topbar,
.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-tools {
  display: flex;
  gap: 6px;
}

.panel h2 {
  font-size: 17px;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 13px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  outline: none;
  padding: 10px 11px;
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.6;
}

.small-textarea {
  min-height: 112px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

select {
  min-height: 40px;
}

.provider-editor {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.provider-editor summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 13px;
}

.provider-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

#providerTestResult,
#providerInferResult {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

#providerTestResult.ok,
#providerInferResult.ok {
  color: var(--good);
}

#providerTestResult.bad,
#providerInferResult.bad {
  color: var(--bad);
}

.provider-list,
.project-list,
.left-rail,
.stack {
  display: grid;
  gap: 10px;
}

.provider-list,
.project-list {
  margin-top: 12px;
}

.provider-row,
.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.project-card,
.provider-card {
  position: relative;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 9px;
}

.small-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

a.small-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

a.small-btn:hover {
  border-color: var(--line-strong);
  box-shadow: 0 7px 18px rgba(16, 24, 40, 0.10);
}

.soft-danger {
  min-height: 32px;
  border-color: rgba(180, 35, 24, 0.28);
  background: rgba(180, 35, 24, 0.06);
  color: var(--bad);
  padding: 0 10px;
  font-size: 12px;
}

.danger-menu {
  position: relative;
  display: inline-block;
}

.danger-menu summary {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  padding: 0 10px;
  font-size: 12px;
}

.danger-menu summary::-webkit-details-marker {
  display: none;
}

.danger-menu[open] summary {
  border-color: var(--line-strong);
}

.danger-menu[open] .soft-danger {
  margin-top: 7px;
  width: 100%;
}

.provider-meta {
  word-break: break-word;
}

.project-item {
  width: 100%;
  height: auto;
  padding: 11px;
  text-align: left;
}

.project-item strong,
.project-item span {
  display: block;
}

.project-item span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 28px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0) 260px),
    var(--bg);
}

.topbar {
  align-items: flex-start;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.16), rgba(183, 121, 31, 0.10)),
    var(--charcoal);
  padding: 20px;
  box-shadow: 0 20px 42px rgba(16, 24, 40, 0.16);
}

.topbar h2 {
  color: #fff;
  font-size: 36px;
  line-height: 1.08;
}

.eyebrow {
  color: #b8c4d1;
  font-weight: 700;
  text-transform: uppercase;
}

.top-status {
  display: flex;
  align-items: center;
  max-width: 520px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef2f7;
  padding: 8px 11px;
  font-size: 13px;
  line-height: 1.35;
}

.status-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-right: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.control-deck {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.07);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
}

.pill.ready {
  color: var(--good);
  border-color: rgba(4, 120, 87, 0.30);
  background: rgba(4, 120, 87, 0.08);
}

.pill.missing {
  color: var(--gold);
  border-color: rgba(183, 121, 31, 0.35);
  background: rgba(183, 121, 31, 0.08);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  margin-bottom: 14px;
}

.pipeline span {
  min-height: 38px;
  display: grid;
  place-items: center;
  background: #f9fbfc;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary div {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.04);
}

.summary strong {
  display: block;
  margin-top: 8px;
  color: #0b1220;
  font-size: 31px;
  line-height: 1;
}

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

.block {
  padding: 14px;
}

.block h3,
.section-title h3 {
  font-size: 18px;
}

pre {
  margin: 10px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #344054;
  line-height: 1.55;
  font-size: 13px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.mini-card strong {
  display: block;
  margin-bottom: 5px;
}

.mini-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.product-slot {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.slot-intro,
.slot-warning,
.slot-ready {
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.slot-intro {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475467;
}

.slot-warning {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.slot-ready {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.product-slot img,
.slot-placeholder {
  width: 82px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #eef3f6;
}

.slot-placeholder {
  display: grid;
  place-items: center;
  color: #667085;
  font-size: 12px;
}

.product-slot strong {
  display: block;
  margin-bottom: 5px;
}

.product-slot p {
  margin: 5px 0 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 9px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #0f766e;
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.upload-btn input {
  display: none;
}

.visual-upload-btn {
  margin-top: 0;
  min-height: 32px;
}

.character-prompt-editor {
  display: grid;
  gap: 8px;
  margin: 10px 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.character-prompt-editor label {
  margin-top: 0;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.character-prompt-editor textarea {
  min-height: 72px;
  font-size: 12px;
  line-height: 1.45;
}

.seed-assets {
  display: grid;
  gap: 9px;
  margin-top: 13px;
  border: 1px solid rgba(89, 105, 116, 0.24);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 10px;
}

.seed-assets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.asset-preview {
  display: grid;
  gap: 8px;
}

.asset-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.asset-chip {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px;
}

.asset-chip img {
  width: 54px;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  object-fit: cover;
  background: #eef3f6;
}

.asset-chip strong,
.asset-chip span {
  display: block;
}

.asset-chip span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #d8e0e8;
  margin-bottom: 9px;
}

.shot-board {
  min-width: 0;
}

.section-title {
  min-height: 42px;
  padding: 0 2px;
}

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.shots.empty {
  display: block;
}

.empty-state {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: center;
  border: 1px dashed #9aa9b8;
  border-radius: 8px;
  background: #fff;
  padding: 34px;
  min-height: 210px;
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state h3 {
  font-size: 22px;
}

.empty-state p {
  margin-top: 9px;
  color: var(--muted);
  line-height: 1.6;
}

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

.empty-frames span {
  display: block;
  aspect-ratio: 9 / 13;
  border: 1px solid rgba(16, 24, 40, 0.10);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.16), rgba(15, 118, 110, 0) 58%),
    linear-gradient(135deg, #202631, #404856);
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.16);
}

.empty-frames span:nth-child(2) {
  transform: translateY(-12px);
  background:
    linear-gradient(180deg, rgba(183, 121, 31, 0.18), rgba(183, 121, 31, 0) 58%),
    linear-gradient(135deg, #252a34, #505866);
}

.empty-frames span:nth-child(3) {
  transform: translateY(8px);
}

.shot {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.frame {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%) 0 0 / 18px 18px,
    var(--charcoal);
}

.frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.frame img,
.frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame span {
  color: #cbd5e1;
  font-size: 13px;
}

.shot-body {
  padding: 13px;
}

.shot-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.shot-title h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.badge {
  align-self: start;
  white-space: nowrap;
  border-radius: 999px;
  background: #e6edf3;
  color: #334155;
  padding: 4px 8px;
  font-size: 12px;
}

.badge.done {
  color: var(--good);
  background: rgba(4, 120, 87, 0.12);
}

.badge.processing {
  color: var(--blue);
  background: rgba(37, 99, 235, 0.11);
}

.badge.failed {
  color: var(--bad);
  background: rgba(180, 35, 24, 0.10);
}

.shot p {
  margin: 8px 0 0;
  color: #475467;
  line-height: 1.5;
  font-size: 13px;
}

.state-line {
  border-left: 3px solid rgba(15, 118, 110, 0.35);
  padding-left: 9px;
  color: #334155 !important;
}

.camera-line {
  color: #155e75 !important;
  font-size: 12px !important;
}

.commerce-line {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412 !important;
  padding: 5px 8px;
  font-size: 12px !important;
  line-height: 1.35;
}

.shot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

.error-text {
  border: 1px solid rgba(180, 35, 24, 0.16);
  border-radius: 8px;
  background: rgba(180, 35, 24, 0.08);
  color: var(--bad) !important;
  padding: 8px;
}

.progress-text {
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--blue) !important;
  padding: 8px;
}

.prompt-box {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.prompt-box summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 13px;
}

.prompt-box pre {
  max-height: 170px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.render-panel {
  margin-top: 18px;
  padding: 16px;
}

.render-panel video {
  width: 100%;
  max-height: 62vh;
  border-radius: 8px;
  background: #000;
}

.clip-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.clip-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.clip-item strong {
  display: block;
  margin-bottom: 8px;
}

.clip-item video {
  max-height: 280px;
}

.shot-dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: min(84vh, 820px);
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
}

.shot-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.dialog-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  padding: 16px;
}

.dialog-card header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.dialog-card h3 {
  margin: 0;
  font-size: 22px;
}

.dialog-meta,
.prompt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dialog-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  color: #475467;
  font-size: 12px;
}

.prompt-tabs button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  padding: 8px 10px;
}

.prompt-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#dialogPromptText {
  width: 100%;
  min-height: 360px;
  max-height: 54vh;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
  padding: 14px;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 13px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

#dialogPromptText.readonly {
  color: #cbd5e1;
  background: #111827;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
}

.hidden {
  display: none;
}

@media (max-width: 1100px) {
  .shell,
  .board-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 28px;
  }

  .summary,
  .pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .empty-state {
    grid-template-columns: 1fr;
  }

  .empty-frames {
    max-width: 260px;
  }
}

/* Studio polish: make storyboards the stage and move assets into a supporting rail. */
:root {
  --bg: #e9edf0;
  --paper: #f7f5ef;
  --panel: #fffdfa;
  --ink: #15212f;
  --muted: #6f7b86;
  --soft: #eef3f1;
  --line: #d4dde2;
  --line-strong: #aebcc5;
  --accent: #08756f;
  --accent-strong: #045f5a;
  --accent-soft: #dff4ef;
  --charcoal: #172126;
  --charcoal-2: #233037;
  --gold: #9d6a19;
  --shadow: 0 18px 42px rgba(31, 42, 55, 0.10);
}

body {
  background:
    linear-gradient(135deg, rgba(8, 117, 111, 0.09), transparent 34%),
    linear-gradient(180deg, #f4f2ec 0, #e8edf0 46%, #dfe6ea 100%);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

button {
  min-height: 36px;
  border-color: #cbd7dd;
  background: linear-gradient(180deg, #ffffff, #f5f8f8);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.76) inset;
  font-weight: 700;
}

button:hover {
  transform: translateY(-1px);
}

.primary {
  background: linear-gradient(180deg, #0b827b, #06645f);
  border-color: #06645f;
  box-shadow: 0 12px 28px rgba(8, 117, 111, 0.20);
}

.shell {
  grid-template-columns: 340px minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgba(23, 33, 38, 0.05), transparent 360px),
    transparent;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(23, 33, 38, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 253, 250, 0.96), rgba(244, 247, 247, 0.96)),
    var(--panel);
  padding: 18px;
}

.brand {
  margin-bottom: 16px;
  padding: 10px 8px;
}

.mark {
  border-radius: 8px;
  background:
    linear-gradient(145deg, #0b756f, #162029 64%),
    var(--charcoal);
  box-shadow: 0 14px 28px rgba(23, 33, 38, 0.22);
}

.brand h1 {
  font-size: 24px;
  letter-spacing: 0;
}

.panel,
.block,
.render-panel,
.shot,
.mini-card,
.product-slot {
  border-color: rgba(89, 105, 116, 0.24);
  background: rgba(255, 253, 250, 0.92);
  box-shadow: 0 12px 30px rgba(31, 42, 55, 0.08);
}

.panel {
  padding: 15px;
  margin-bottom: 14px;
}

.panel h2,
.block h3,
.section-title h3 {
  color: #0f1d2a;
  font-size: 18px;
  letter-spacing: 0;
}

input,
textarea,
select {
  border-color: #ccd7dd;
  background: #fbfcfb;
}

textarea {
  min-height: 154px;
}

.small-textarea {
  min-height: 96px;
}

.workspace {
  padding: 22px 26px 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), transparent 280px),
    transparent;
}

.topbar {
  min-height: 128px;
  border: 0;
  border-radius: 8px;
  background:
    linear-gradient(118deg, rgba(8, 117, 111, 0.35), transparent 42%),
    linear-gradient(90deg, #142127, #27353c 72%, #4a3d28);
  padding: 24px 26px;
  box-shadow: 0 24px 52px rgba(23, 33, 38, 0.22);
}

.topbar h2 {
  max-width: 860px;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0;
}

.top-status {
  align-self: start;
  min-width: min(420px, 38vw);
  background: rgba(255, 255, 255, 0.10);
}

.control-deck {
  position: sticky;
  top: 0;
  z-index: 30;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.1fr);
  align-items: center;
  border-color: rgba(89, 105, 116, 0.20);
  background: rgba(255, 253, 250, 0.92);
  backdrop-filter: blur(16px);
}

.actions {
  justify-content: flex-end;
  align-items: center;
}

.pill {
  background: #f3f6f5;
  padding: 6px 9px;
}

.pipeline {
  display: none;
}

.summary {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  max-width: 1048px;
}

.summary div {
  min-height: 76px;
  background:
    linear-gradient(180deg, #fffdfa, #f5f8f8);
  padding: 13px 14px;
}

.summary strong {
  font-size: 30px;
}

.board-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas: "stage support";
  gap: 18px;
}

.left-rail {
  grid-area: support;
  position: sticky;
  top: 116px;
  align-self: start;
  max-height: calc(100vh - 132px);
  overflow: auto;
  padding-right: 2px;
}

.shot-board {
  grid-area: stage;
}

.section-title {
  min-height: 46px;
  border-bottom: 1px solid rgba(89, 105, 116, 0.18);
  margin-bottom: 12px;
}

.section-title span {
  border-radius: 999px;
  background: #edf4f2;
  color: #50606a;
  padding: 6px 10px;
  font-weight: 700;
}

.block {
  padding: 15px;
}

.block h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.block h3::before {
  content: "";
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--gold));
}

#visualBible {
  max-height: 260px;
  overflow: auto;
  border-radius: 8px;
  background: #f5f7f6;
  padding: 10px;
}

.product-slot {
  grid-template-columns: 96px minmax(0, 1fr);
  background: #fff;
  padding: 11px;
}

.product-slot img,
.slot-placeholder {
  width: 96px;
}

.slot-placeholder {
  background:
    linear-gradient(135deg, rgba(8, 117, 111, 0.08), transparent 55%),
    #edf2f2;
  color: #5d6972;
  font-weight: 700;
}

.product-slot strong {
  font-size: 15px;
  line-height: 1.35;
}

.slot-intro {
  background: #eef5f3;
  color: #3f555a;
}

.slot-ready {
  background: #edf8f0;
}

.shots {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}

.shot {
  overflow: hidden;
  background: #fffdfa;
}

.frame {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(135deg, #111b21, #26333b);
}

.shot-body {
  padding: 14px 15px 15px;
}

.shot-title h4 {
  font-size: 16px;
}

.commerce-line,
.state-line,
.camera-line,
.progress-text,
.error-text {
  border-radius: 8px;
}

.project-item {
  border-color: rgba(89, 105, 116, 0.22);
  background:
    linear-gradient(90deg, rgba(8, 117, 111, 0.08), transparent 10px),
    #fff;
}

.project-item strong {
  color: #10202d;
}

.danger-menu summary {
  background: #f8faf9;
}

@media (max-width: 1380px) {
  .topbar {
    flex-direction: column;
  }

  .top-status {
    width: 100%;
    min-width: 0;
  }

  .board-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "stage"
      "support";
  }

  .left-rail {
    position: static;
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .sidebar {
    position: static;
    height: auto;
  }

  .control-deck {
    position: static;
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .workspace,
  .sidebar {
    padding: 14px;
  }

  .topbar {
    min-height: auto;
    padding: 18px;
  }

  .top-status {
    min-width: 0;
    width: 100%;
  }

  .summary,
  .left-rail {
    grid-template-columns: 1fr;
  }

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

.license-panel .panel-head strong {
  font-size: 24px;
  color: var(--accent);
}

.license-locked .license-panel {
  border-color: rgba(180, 35, 24, 0.24);
  box-shadow: 0 18px 38px rgba(180, 35, 24, 0.08);
}

.license-locked #createBtn,
.license-locked #imageBtn,
.license-locked #videoBtn {
  filter: grayscale(0.25);
}

.redeem-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.credit-records {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.credit-records p,
.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.credit-records strong,
.admin-row strong {
  color: var(--ink);
}

.app-footer {
  padding: 10px 18px 18px;
  text-align: center;
}

.app-footer button {
  min-height: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(102, 112, 133, 0.58);
  font-size: 11px;
  font-weight: 500;
  padding: 0;
}

.app-footer button:hover {
  box-shadow: none;
  transform: none;
  color: rgba(21, 33, 47, 0.72);
}

.install-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 80;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  width: min(560px, calc(100vw - 24px));
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 16px;
  background: rgba(15, 29, 42, 0.92);
  color: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.34);
  padding: 12px 12px 12px 16px;
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.install-banner strong {
  display: block;
  margin-bottom: 3px;
}

.install-banner p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.install-banner button {
  border-color: rgba(255, 255, 255, 0.24);
}

.admin-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-dialog {
  width: min(980px, calc(100vw - 24px));
  border: 0;
  padding: 0;
  background: transparent;
}

.admin-card {
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.admin-section {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.admin-section h4 {
  margin: 0;
}

.admin-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.admin-row code {
  word-break: break-all;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  body {
    background: #f6f8fb;
  }

  .brand {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(246, 248, 251, 0.92);
    backdrop-filter: blur(10px);
    padding: 10px 0;
  }

  .panel,
  .block,
  .render-panel,
  .shot {
    border-radius: 14px;
  }

  .control-deck {
    border-radius: 16px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .actions button {
    width: 100%;
  }

  .shot-board {
    min-width: 0;
  }

  .dialog-card {
    border-radius: 16px;
  }

  .redeem-row {
    grid-template-columns: 1fr;
  }

  .install-banner {
    bottom: 12px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .install-banner .icon {
    grid-column: 2;
  }
}

/* Commercial v1 visual pass */
:root {
  --bg: #eef3f5;
  --panel: rgba(255, 255, 255, 0.9);
  --accent: #096f69;
  --accent-strong: #064f4b;
  --gold: #c8942e;
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(9, 111, 105, 0.14), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(200, 148, 46, 0.13), transparent 28%),
    linear-gradient(180deg, #f7faf9 0%, #e8eff2 52%, #edf2f4 100%);
}

.shell {
  width: min(1800px, 100%);
  margin: 0 auto;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 250, 250, 0.92)),
    #fff;
}

.brand {
  border: 1px solid rgba(9, 111, 105, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.mark {
  border-radius: 14px;
}

.license-panel {
  background:
    linear-gradient(135deg, rgba(9, 111, 105, 0.10), rgba(200, 148, 46, 0.10)),
    rgba(255, 255, 255, 0.92);
}

.panel,
.block,
.summary div,
.shot,
.render-panel,
.mini-card,
.product-slot {
  border-radius: 16px;
}

.topbar {
  border-radius: 22px;
  background:
    linear-gradient(120deg, rgba(9, 111, 105, 0.58), transparent 44%),
    linear-gradient(100deg, #0d2028, #203039 66%, #42351f);
}

.control-deck {
  border-radius: 18px;
}

.actions button {
  border-radius: 12px;
}

.shots {
  align-items: start;
}

.shot {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.shot:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 46px rgba(31, 42, 55, 0.14);
}

@media (max-width: 760px) {
  .shell {
    display: block;
  }

  .sidebar {
    border-right: 0;
    padding-bottom: 4px;
  }

  .workspace {
    padding-top: 6px;
  }

  .topbar h2 {
    font-size: 30px;
  }

  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-deck {
    top: 0;
    margin-left: -4px;
    margin-right: -4px;
  }

  .shot-body {
    padding: 12px;
  }
}
