:root {
  --bg: #0c0c0f;
  --bg-elevated: #14141a;
  --surface: #1a1a22;
  --surface-hover: #22222c;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eceae6;
  --text-muted: #9a9690;
  --accent: #d4a853;
  --accent-dim: rgba(212, 168, 83, 0.15);
  --accent-glow: rgba(212, 168, 83, 0.35);
  --danger: #e85d5d;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  /* 主内容区宽度与内边距：全站与「短剧剧本设计」工作台一致 */
  --page-max-width: 1280px;
  --page-pad-x: 1.5rem;
  --page-pad-y: 1.25rem;
  --page-pad-bottom: 3rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 通用显隐（按钮、外挂层等；区块级仍可用 .app-view.is-hidden / .panel.is-hidden） */
.is-hidden {
  display: none !important;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* 首页：鉴权完成前不展示主界面，避免未登录闪屏 */
html.auth-pending .app {
  visibility: hidden;
}

/* 侧栏 + 多视图壳层 */
.app.app-with-sidebar {
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
  min-height: 100vh;
  flex-direction: row;
  align-items: stretch;
}

.app-sidebar {
  width: 15.5rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 0.85rem;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.2);
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.35rem;
}

.app-sidebar-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #8b6914);
  box-shadow: 0 0 16px var(--accent-glow);
  flex-shrink: 0;
}

.app-sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.app-sidebar-title {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-sidebar-tagline {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.app-nav-item {
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.app-nav-item:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.app-nav-item.is-active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 0 0 1px rgba(212, 168, 83, 0.12);
}

a.app-nav-item {
  text-decoration: none;
  color: inherit;
  display: block;
  box-sizing: border-box;
}

/* 侧栏当前页占位（非链接） */
span.app-nav-item {
  cursor: default;
}

.app-stage {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--page-pad-y) var(--page-pad-x) var(--page-pad-bottom);
  position: relative;
}

.app-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 0;
}

.app-view.is-hidden {
  display: none;
}

/**
 * 主内容居中列：max-width 与剧本设计工作台一致，全站页面复用。
 * 带侧栏时在 .app-stage / .analysis-stage 内再包本层。
 */
.page-inner {
  max-width: var(--page-max-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
  min-height: 0;
}

.view-home-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 100%;
}

.view-home-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-home-lead {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 36rem;
  line-height: 1.5;
}

.view-home-top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.home-hero {
  max-width: 100%;
  padding: 1.5rem 0 0;
}

.home-hero-kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.home-hero-title {
  margin: 0.5rem 0 0;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.home-hero-desc {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 40rem;
}

.home-cards {
  margin-top: 1.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}

.home-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1.15rem 1.2rem;
  text-align: left;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: border-color 0.15s, transform 0.12s;
}

a.home-card {
  text-decoration: none;
}

.home-card:hover {
  border-color: rgba(212, 168, 83, 0.35);
  transform: translateY(-1px);
}

.home-card-secondary {
  opacity: 0.92;
}

.home-card-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.home-card-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.home-card-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(212, 168, 83, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(80, 120, 200, 0.06), transparent);
}

.app {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: var(--page-pad-y) var(--page-pad-x) var(--page-pad-bottom);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar-brand-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
}

.brand-text-block {
  min-width: 0;
  max-width: min(100%, 40rem);
  flex: 1;
}

.brand-project-name-wrap.project-name-bar {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0.2rem 0 0;
}

.project-name-display {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  font-family: var(--mono);
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0.15rem 0.35rem;
  margin: 0 -0.35rem;
  border-radius: var(--radius-sm);
  border: 1px dashed transparent;
  line-height: 1.4;
}

.project-name-display:hover {
  border-color: var(--border);
  background: var(--surface);
}

.project-name-input {
  width: min(100%, 36rem);
  min-width: 10rem;
  margin: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  outline: none;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-shrink: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #8b6914);
  box-shadow: 0 0 24px var(--accent-glow);
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 0.45rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.topbar-user {
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.steps {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.step:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
}

.step:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.step.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.step.is-done .step-num {
  background: var(--accent-dim);
  color: var(--accent);
}

.step-num {
  width: 1.65rem;
  height: 1.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 600;
}

.step.is-active .step-num {
  background: var(--accent);
  color: #1a1408;
}

.step-connector {
  width: 1.5rem;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel.is-hidden {
  display: none;
}

.panel-head {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.panel-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.panel-head-with-action {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.panel-head-with-action h2 {
  flex: 1 1 auto;
  min-width: 6rem;
}

.panel-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.panel-desc-tight {
  margin-top: 0.25rem;
  margin-bottom: 0;
  max-width: 42rem;
}

.script-panel-inner {
  position: relative;
  min-height: 6rem;
  border-radius: var(--radius-sm);
}

.script-panel-inner.is-regenerating {
  pointer-events: none;
}

.script-panel-inner.is-regenerating::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.07) 40%,
    rgba(255, 200, 120, 0.14) 50%,
    rgba(255, 255, 255, 0.07) 60%,
    transparent 100%
  );
  background-size: 220% 100%;
  animation: script-opening-shimmer 1.05s ease-in-out infinite;
}

@keyframes script-opening-shimmer {
  0% {
    background-position: 130% 0;
  }
  100% {
    background-position: -130% 0;
  }
}

/* 导演剧本：双击区块进入编辑 */
.script-editable-host {
  cursor: text;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
}

.script-editable-host:hover .script-editable-body {
  background: rgba(255, 255, 255, 0.03);
}

.script-editable-body {
  border-radius: inherit;
  min-height: 1.5em;
}

textarea.script-editable-textarea {
  display: block;
  width: 100%;
  min-height: 10rem;
  box-sizing: border-box;
  margin: 0;
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.45;
  padding: 0.55rem 0.65rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--accent-dim, #6b8cce);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.panel-desc {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.panel-body {
  padding: 1.5rem;
}

.input-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mode-switch {
  display: flex;
  padding: 4px;
  gap: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

.mode-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mode-tab:hover {
  color: var(--text);
}

.mode-tab.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.input-block.is-hidden {
  display: none;
}

.field-label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.field-label-row label {
  margin-bottom: 0;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.field-hint.block {
  margin-top: 0.35rem;
}

.dropzone {
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1rem;
  text-align: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone:focus {
  outline: none;
  border-color: rgba(212, 168, 83, 0.45);
  background: var(--accent-dim);
}

.dropzone.is-dragover {
  border-color: rgba(212, 168, 83, 0.75);
  background: rgba(212, 168, 83, 0.12);
}

.dropzone-compact {
  padding: 0.75rem 1rem;
}

.dropzone-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.dropzone-meta {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-status {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--accent);
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field textarea,
.field select {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 44px;
}

.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: rgba(212, 168, 83, 0.45);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.actions-bar-sticky {
  margin-top: 0.5rem;
}

.hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.panel-body-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.script-scroll {
  max-height: min(70vh, 820px);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.actions-bar-footer {
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.split {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 340px);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.split-main {
  min-height: 200px;
}

.split-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scroll-area {
  max-height: min(62vh, 720px);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.side-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.json-preview {
  margin: 0;
  padding: 0.75rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.45;
  color: var(--text-muted);
  max-height: min(40vh, 360px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* —— 视觉步骤：左文案 + 右出图 —— */
.visual-dual-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, min(42vw, 480px));
  gap: 1rem 1.25rem;
  margin-bottom: 1.35rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: start;
}

.visual-dual-row[data-slot-kind="character"] {
  grid-template-columns: minmax(0, 1fr) minmax(300px, min(52vw, 620px));
}

/* 角色出图：9:16 竖版预览区，与接口尺寸一致 */
.visual-dual-row[data-slot-kind="character"] .visual-dual-media {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.visual-dual-row[data-slot-kind="character"] .visual-preview {
  width: 100%;
  max-width: min(100%, 360px);
  aspect-ratio: 9 / 16;
  min-height: 0;
  margin-inline: auto;
}

.visual-dual-row[data-slot-kind="character"] .visual-preview--loading {
  min-height: 0;
  aspect-ratio: 9 / 16;
}

.visual-dual-row[data-slot-kind="character"] .visual-preview--done {
  min-height: 0;
  aspect-ratio: 9 / 16;
  max-width: min(100%, 360px);
  margin-inline: auto;
}

.visual-dual-row[data-slot-kind="character"] .visual-preview-img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

@media (max-width: 960px) {
  .visual-dual-row,
  .visual-dual-row[data-slot-kind="character"] {
    grid-template-columns: 1fr;
  }
}

.visual-dual-text .card-title {
  margin-bottom: 0.35rem;
}

.visual-aspect-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 0.45rem;
  line-height: 1.35;
}

.visual-preview {
  position: relative;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  min-height: 168px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.visual-preview--empty {
  color: var(--text-muted);
}

.visual-preview-placeholder {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.55;
}

.visual-preview-hint {
  display: block;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  opacity: 0.45;
}

.visual-preview--loading {
  min-height: 200px;
}

.visual-preview-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 0%,
    rgba(212, 168, 83, 0.08) 45%,
    rgba(212, 168, 83, 0.18) 50%,
    rgba(212, 168, 83, 0.08) 55%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: visual-shimmer 1.35s ease-in-out infinite;
}

@keyframes visual-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.visual-preview-spinner {
  position: relative;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: visual-spin 0.75s linear infinite;
  margin-bottom: 0.5rem;
}

@keyframes visual-spin {
  to {
    transform: rotate(360deg);
  }
}

.visual-preview-status {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.visual-preview--done {
  padding: 0;
  border-style: solid;
  border-color: var(--border);
  background: #0a0a0c;
  min-height: 120px;
}

.visual-preview-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(52vh, 520px);
  object-fit: contain;
  cursor: zoom-in;
}

.visual-preview-fs {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.visual-preview--error {
  border-color: rgba(232, 93, 93, 0.35);
  background: rgba(232, 93, 93, 0.06);
}

/* 全屏预览 */
.visual-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.visual-fullscreen[hidden] {
  display: none !important;
}

.visual-fullscreen-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: zoom-out;
}

.visual-fullscreen-inner {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(96vw, 1600px);
  max-height: 92vh;
}

.visual-fullscreen-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  color: var(--text) !important;
  background: rgba(0, 0, 0, 0.45) !important;
  border: 1px solid var(--border) !important;
}

.visual-fullscreen-img {
  display: block;
  max-width: min(96vw, 1600px);
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

@media (max-width: 640px) {
  .visual-fullscreen-close {
    font-size: 0.8rem;
  }
}

.visual-brief {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.visual-prompt-block {
  margin-top: 0.65rem;
}

.visual-prompt-zh {
  margin-top: 0.35rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.55;
}

.visual-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.visual-card .prompt-label {
  margin-top: 0.25rem;
}

/* —— 分镜步骤 —— */
.panel-storyboard .shot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem 1rem 1.35rem;
}

.panel-storyboard .shot-head {
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.panel-storyboard .shot-body-block {
  margin-top: 0;
}

.shot-body-block .prompt-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.shot-body-zh {
  margin: 0;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.shot-dialogue-details {
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.shot-dialogue-details[open] {
  background: rgba(0, 0, 0, 0.22);
}

.shot-dialogue-details[open] .shot-dialogue-summary__hint--when-closed {
  display: none;
}

.shot-dialogue-details:not([open]) .shot-dialogue-summary__hint--when-open {
  display: none;
}

.shot-dialogue-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  user-select: none;
}

.shot-dialogue-summary::-webkit-details-marker {
  display: none;
}

.shot-dialogue-summary::marker {
  content: "";
}

.shot-dialogue-summary__label {
  flex: 1 1 auto;
  min-width: 0;
}

.shot-dialogue-summary__meta {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.shot-dialogue-summary__hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent, #c9a227);
  font-size: 0.72rem;
}

.shot-dialogue-json {
  margin: 0;
  padding: 0 0.55rem 0.55rem;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm, 6px) var(--radius-sm, 6px);
  background: transparent;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
}

.shot-card-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  padding: 0.65rem 1.1rem;
  max-width: min(92vw, 38rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 100;
  pointer-events: none;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-inline {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--accent);
  line-height: 1.45;
}

/* —— 工作区 · 云端项目 —— */
.workspace-section {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.workspace-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.workspace-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.workspace-save-status {
  font-size: 0.8125rem;
  color: var(--text-muted);
  min-height: 1.25rem;
  text-align: right;
  flex: 1;
  min-width: 8rem;
}

.workspace-projects {
  margin-top: 0.15rem;
}

.workspace-empty {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.workspace-project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.workspace-project-grid--locked {
  pointer-events: none;
  opacity: 0.55;
  cursor: not-allowed;
}

.workspace-project-card-wrap {
  position: relative;
  min-width: 0;
}

.workspace-project-delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 2;
  margin: 0;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--danger, #c53030);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #ddd);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.workspace-project-delete:hover:not(:disabled) {
  background: rgba(197, 48, 48, 0.08);
  border-color: var(--danger, #c53030);
}

.workspace-project-delete:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 960px) {
  .workspace-project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .workspace-project-grid {
    grid-template-columns: 1fr;
  }
}

.workspace-project-card.workspace-open {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 0.45rem;
  min-height: 5.25rem;
  width: 100%;
  padding: 0.75rem 2.6rem 0.75rem 0.85rem;
  margin: 0;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.workspace-project-card.workspace-open:hover {
  border-color: var(--accent-dim);
  background: var(--surface-hover);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.workspace-card-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.workspace-card-summary {
  flex: 1;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
