/* 漫剧工坊 · 两态布局：首页（书库+引导） / 工作台（三栏） */

.drama-header-mid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  justify-self: center;
  text-align: center;
}
.drama-header-mid strong {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text, #1e293b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drama-header-mid .hint {
  margin: 0;
  font-size: 0.75rem;
}

/* ── 首页：书库 + 欢迎 ── */
.drama-layout {
  display: grid;
  gap: 16px;
  padding: 16px 20px 24px;
  min-height: calc(100vh - 72px);
  align-items: stretch;
  box-sizing: border-box;
}
.drama-layout--library {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  grid-template-areas: "aside welcome";
  height: calc(100vh - 72px);
  max-height: calc(100vh - 72px);
  min-height: 0;
  overflow: hidden;
}
body:has(.drama-layout--library) {
  overflow: hidden;
  height: 100vh;
}
.drama-layout--library .drama-aside { grid-area: aside; min-height: 0; }
.drama-layout--library .drama-welcome {
  grid-area: welcome;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
}

/* ── 工作台：顶栏 + 章 | 对话 | 原文 ── */
.drama-layout--reading {
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) minmax(260px, 340px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "head head head"
    "chapters chat reader";
  height: calc(100vh - 72px);
  max-height: calc(100vh - 72px);
  min-height: 0;
  overflow: hidden;
}
body:has(.drama-layout--reading) {
  overflow: hidden;
  height: 100vh;
}
.drama-layout--reading .drama-workbench-head { grid-area: head; }
.drama-layout--reading .drama-chapters { grid-area: chapters; }
.drama-layout--reading .drama-chat-wrap { grid-area: chat; }
.drama-layout--reading .drama-reader { grid-area: reader; }

/* 首页元素在工作台隐藏 */
.drama-layout--reading .drama-aside,
.drama-layout--reading .drama-welcome {
  display: none !important;
}
/* 工作台元素在首页隐藏 */
.drama-layout--library .drama-workbench-head,
.drama-layout--library .drama-chapters,
.drama-layout--library .drama-chat-wrap,
.drama-layout--library .drama-reader {
  display: none !important;
}

.drama-aside {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.drama-aside .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  margin: 0;
  overflow: hidden;
}
.drama-aside .card > h2 {
  flex-shrink: 0;
  margin: 0 0 10px;
}
.drama-aside .drama-upload {
  flex-shrink: 0;
}

/* 欢迎页 */
.drama-welcome {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.drama-welcome-inner {
  max-width: 520px;
  width: 100%;
  padding: 28px 32px;
  margin: auto;
}
.drama-welcome h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  line-height: 1.35;
  color: var(--text, #1e293b);
}
.drama-welcome-lead {
  margin: 0 0 24px;
  color: var(--muted, #64748b);
  font-size: 0.95rem;
  line-height: 1.55;
}
.drama-steps-guide {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}
.drama-steps-guide li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
}
.drama-steps-guide strong {
  color: var(--primary, #ff6b4a);
  font-size: 0.92rem;
}
.drama-steps-guide span {
  color: var(--muted, #64748b);
}
.drama-welcome-tip {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted, #64748b);
  padding: 10px 12px;
  background: rgba(255, 107, 74, 0.08);
  border-radius: 10px;
  border: 1px solid rgba(255, 107, 74, 0.15);
}

/* 工作台顶栏 */
.drama-workbench-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px !important;
  margin: 0;
  flex-wrap: wrap;
}
.drama-workbench-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drama-workbench-title strong {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drama-workbench-title .hint {
  font-size: 0.75rem;
  margin: 0;
}
.drama-steps-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  padding: 5px 12px;
}
.drama-step { white-space: nowrap; }
.drama-step-arrow { opacity: 0.45; }

.drama-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  border: 1.5px dashed var(--border-strong, #cbd5e1);
  border-radius: var(--radius, 14px);
  background: var(--primary-soft, rgba(255, 107, 74, 0.12));
  color: var(--primary, #ff6b4a);
  font-weight: 600;
  cursor: pointer;
}
.drama-upload:hover { border-color: var(--primary, #ff6b4a); }
.drama-upload input { display: none; }

.drama-aside .hint {
  flex-shrink: 0;
  margin: 8px 0 0;
}

.drama-book-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
  margin-top: 4px;
}
.drama-book {
  border: 1px solid var(--border, #e2e8f0);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.drama-book:hover {
  border-color: rgba(255, 107, 74, 0.35);
}
.drama-book.active {
  border-color: rgba(255, 107, 74, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 107, 74, 0.12);
}
.drama-book h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
}
.drama-book .meta {
  color: var(--muted, #64748b);
  font-size: 0.78rem;
  line-height: 1.4;
}
.drama-book .row {
  display: flex;
  gap: 8px;
}
.drama-book .open { flex: 1; }
.drama-book .reindex,
.drama-book .del { flex: 0 0 auto; font-size: 0.78rem; }

.drama-empty {
  text-align: center;
  color: var(--muted, #64748b);
  padding: 24px 12px;
  font-size: 0.875rem;
}

.drama-chapters,
.drama-reader {
  min-height: 0;
  max-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.drama-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}
.drama-panel-head h2 {
  margin: 0;
  font-size: 0.92rem;
}
.btn-sm {
  padding: 4px 10px !important;
  font-size: 0.78rem !important;
  min-height: 30px;
}
.drama-chapter-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}
.drama-chapter-search input {
  width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.85rem;
}
.drama-chapter-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drama-chapter-item {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 4px;
}
.drama-chapter-item:hover { border-color: rgba(255, 107, 74, 0.35); }
.drama-chapter-item.active {
  border-color: rgba(255, 107, 74, 0.55);
  background: var(--primary-soft, rgba(255, 107, 74, 0.08));
}
.drama-chapter-item strong {
  font-size: 0.84rem;
  line-height: 1.35;
}
.drama-chapter-item .meta {
  font-size: 0.72rem;
  color: var(--muted, #64748b);
}
.drama-chapter-item .summary {
  font-size: 0.75rem;
  color: var(--muted, #64748b);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.drama-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.drama-session-select {
  max-width: 140px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.8rem;
  background: #fff;
}

.drama-reader-tabs { display: flex; gap: 6px; }
.drama-tab {
  border: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}
.drama-tab.active {
  background: var(--primary, #ff6b4a);
  color: #fff;
  border-color: transparent;
}
.drama-reader-pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 12px 14px 16px;
}
.drama-reader-empty {
  color: var(--muted, #64748b);
  font-size: 0.85rem;
  line-height: 1.55;
  padding: 12px 4px;
}
.drama-reader-title {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.4;
}
.drama-reader-summary {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  font-size: 0.82rem;
  color: var(--muted, #64748b);
  line-height: 1.5;
}
.drama-reader-body {
  font-size: 0.88rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.drama-reader-body mark {
  background: rgba(255, 214, 102, 0.65);
  padding: 0 2px;
  border-radius: 2px;
}

.drama-char-toolbar {
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.drama-char-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.drama-char-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: #fff;
}
.drama-char-card input,
.drama-char-card textarea {
  width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 7px 9px;
  font: inherit;
  font-size: 0.82rem;
}
.drama-char-card textarea {
  min-height: 56px;
  resize: vertical;
}
.drama-char-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.drama-char-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin-left: auto;
}
.drama-char-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.drama-tier {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.drama-tier--lead { background: #fef3c7; color: #b45309; }
.drama-tier--supporting { background: #dbeafe; color: #1d4ed8; }
.drama-tier--extra { background: #f1f5f9; color: #475569; }
.drama-tier--unknown { background: #f8fafc; color: #94a3b8; }
.drama-chapters-tag { font-size: 0.72rem; color: var(--muted, #64748b); }
.drama-char-card select.char-tier {
  width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 7px 9px;
  font: inherit;
  font-size: 0.82rem;
  background: #fff;
}
.drama-prod-hint {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin: 0 0 10px;
  line-height: 1.45;
}
.drama-prod-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  max-height: calc(100vh - 220px);
}
.drama-prod-section {
  font-size: 0.82rem;
  margin: 0 0 8px;
  color: var(--muted, #64748b);
}
.drama-prod-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
}
.drama-prod-card h4 {
  margin: 0 0 4px;
  font-size: 0.88rem;
}
.drama-prod-card .meta {
  margin: 0 0 6px;
  font-size: 0.72rem;
  color: var(--muted, #64748b);
}
.drama-prod-card .prompt {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: #334155;
  font-style: italic;
}

.drama-prod-card--wardrobe {
  border-color: #e9d5ff;
  background: #faf5ff;
}

.drama-cite details summary { cursor: pointer; }
.drama-cite .cite-jump {
  margin-left: 6px;
  color: var(--primary, #ff6b4a);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
}

.drama-dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  max-width: min(720px, 92vw);
  width: 100%;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}
.drama-dialog::backdrop { background: rgba(15, 23, 42, 0.35); }
.drama-dialog-inner { display: grid; gap: 0; }
.drama-dialog-inner header,
.drama-dialog-inner footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.drama-dialog-inner footer {
  border-bottom: 0;
  border-top: 1px solid var(--border, #e2e8f0);
  justify-content: flex-end;
}
.drama-dialog-inner header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.drama-dialog-actions {
  display: flex;
  gap: 8px;
}
.drama-dialog-inner header h3 { margin: 0; font-size: 1rem; }
.drama-dialog-inner pre {
  margin: 0;
  padding: 14px 16px;
  max-height: 55vh;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.45;
  background: #0f172a;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

.drama-chat-wrap {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
}
.drama-chat-card {
  flex: 1;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
}
.drama-chat-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.drama-mode { display: flex; gap: 8px; flex-wrap: wrap; }
.drama-chip {
  border-radius: 999px !important;
  padding: 6px 14px !important;
  font-size: 0.85rem !important;
}
.drama-chip.active {
  background: var(--primary, #ff6b4a) !important;
  color: #fff !important;
  border-color: transparent !important;
}
.drama-mode-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.78rem;
  color: #b45309;
}

.drama-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(248, 250, 252, 0.8);
}
.drama-bubble {
  max-width: min(720px, 88%);
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.55;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid transparent;
}
.drama-bubble.user {
  align-self: flex-end;
  background: var(--primary-soft, rgba(255, 107, 74, 0.12));
  border-color: rgba(255, 107, 74, 0.22);
  border-bottom-right-radius: 4px;
}
.drama-bubble.bot {
  align-self: flex-start;
  background: #fff;
  border-color: var(--border, #e2e8f0);
  border-bottom-left-radius: 4px;
}
.drama-bubble.sys {
  align-self: center;
  background: transparent;
  border: 0;
  color: var(--muted, #64748b);
  font-size: 0.8rem;
  max-width: 100%;
  text-align: center;
}
.drama-bubble--creative {
  border-color: #fcd34d;
  background: #fffbeb;
}
.drama-creative-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
}
.drama-bubble-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.drama-tier--world { background: #ede9fe; color: #6d28d9; }
.drama-world-cat--faction { background: #fee2e2; color: #b91c1c; }
.drama-world-cat--location { background: #dbeafe; color: #1d4ed8; }
.drama-world-cat--rule { background: #ffedd5; color: #c2410c; }
.drama-world-cat--timeline { background: #ecfccb; color: #4d7c0f; }
.drama-world-cat--term { background: #f1f5f9; color: #475569; }
.drama-world-card select.world-category {
  width: 100%;
  margin-bottom: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0);
  font-size: 0.85rem;
}

.drama-cite {
  border-top: 1px solid var(--border, #e2e8f0);
  padding: 10px 16px;
  max-height: 140px;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 0.8rem;
  color: var(--muted, #64748b);
  background: #fff;
  flex-shrink: 0;
}
.drama-cite details {
  margin-bottom: 6px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 8px 10px;
}
.drama-cite .drama-graph {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.2);
  border-radius: 8px;
}
.drama-cite .drama-graph ul {
  margin: 6px 0 0;
  padding-left: 1.2rem;
}

.drama-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border, #e2e8f0);
  background: #fff;
  flex-shrink: 0;
}
.drama-composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 52px;
  max-height: 120px;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
  padding: 10px 12px;
  font: inherit;
  line-height: 1.45;
}
.drama-composer textarea:disabled {
  background: #f1f5f9;
  color: var(--muted, #64748b);
}
.drama-composer .btn {
  min-width: 88px;
  height: 44px;
}

.drama-studio-toolbar { flex-wrap: wrap; }
.drama-studio-tts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted, #64748b);
  cursor: pointer;
  user-select: none;
}
.drama-bgm-select {
  flex: 0 1 140px;
  min-width: 120px;
  max-width: 180px;
}
.drama-studio-export-link {
  font-size: 0.85rem;
  color: #2563eb;
  text-decoration: none;
}
.drama-studio-export-link:hover { text-decoration: underline; }

.drama-publish-project {
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
}
.drama-publish-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 6px 0 8px;
}
.drama-publish-platform {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
}
.drama-publish-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: #475569;
}
.drama-publish-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: #fff;
}
.drama-publish-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 8px;
}
.drama-publish-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
}
.drama-publish--exported .drama-publish-badge { background: #dbeafe; color: #1d4ed8; }
.drama-publish--published .drama-publish-badge { background: #dcfce7; color: #15803d; }
.drama-publish--failed .drama-publish-badge { background: #fee2e2; color: #b91c1c; }
.drama-publish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.drama-publish-actions .drama-episode-select { flex: 0 1 120px; min-width: 100px; }
.drama-platform-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.drama-platform-pill {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
}
.drama-platform-pill--ok { background: #dcfce7; color: #15803d; }
.drama-platform-hint { margin: 0 0 10px; font-size: 0.78rem; }
.drama-publish-platform-meta { margin-bottom: 10px; }
.drama-episode-select {
  flex: 1 1 160px;
  min-width: 140px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0);
  font-size: 0.85rem;
}
.drama-studio-review {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 12px 8px;
}
.drama-studio-meta { padding: 0 12px 8px; }
.drama-studio-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.88rem;
}
.drama-studio-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #f1f5f9;
  color: #475569;
}
.drama-studio-tag--rendering { background: #dbeafe; color: #1d4ed8; }
.drama-studio-tag--assembled,
.drama-studio-tag--ready_to_assemble { background: #fef3c7; color: #b45309; }
.drama-studio-tag--approved { background: #dcfce7; color: #15803d; }
.drama-studio-tag--rejected { background: #fee2e2; color: #b91c1c; }
.drama-studio-player {
  padding: 0 12px 12px;
}
.drama-studio-player video {
  width: 100%;
  max-height: 280px;
  border-radius: 10px;
  background: #000;
}
.drama-studio-shots {
  padding: 0 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 42vh;
  overflow-y: auto;
}
.drama-shot-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  font-size: 0.85rem;
}
.drama-shot-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.drama-shot-id { font-weight: 600; }
.drama-shot-status {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
}
.drama-shot--succeeded .drama-shot-status { background: #dcfce7; color: #15803d; }
.drama-shot--failed .drama-shot-status { background: #fee2e2; color: #b91c1c; }
.drama-shot--running .drama-shot-status,
.drama-shot--queued .drama-shot-status { background: #dbeafe; color: #1d4ed8; }
.drama-shot-scene { margin: 0 0 4px; color: #334155; }
.drama-shot-line, .drama-shot-cap { margin: 0; color: #64748b; font-size: 0.8rem; }
.drama-shot-err { margin: 4px 0 0; color: #b91c1c; font-size: 0.78rem; }
.drama-shot-form {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drama-shot-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  color: #64748b;
}
.drama-shot-field input,
.drama-shot-field textarea,
.drama-shot-field select {
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border, #e2e8f0);
}
.drama-shot-form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.drama-shot-form-row .drama-shot-field { flex: 1 1 120px; }
.drama-studio-ready {
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 0.8rem;
}
.char-ref-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.char-ref-preview {
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
}
.char-ref-hint { font-size: 0.78rem; }
.char-ref-upload { cursor: pointer; margin: 0; }
.drama-studio-comfy {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 0 12px 10px;
}
.drama-comfy-status {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
}
.drama-comfy-status--ok { background: #dcfce7; color: #15803d; }
.drama-comfy-status--bad { background: #fee2e2; color: #b91c1c; }

/* 窄屏：工作台纵向三块，顺序固定 */
@media (max-width: 1100px) {
  .drama-layout--reading {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 34vh) minmax(0, 1fr) minmax(0, 30vh);
    grid-template-areas:
      "head"
      "chapters"
      "chat"
      "reader";
  }
  .drama-steps-bar { display: none; }
}

@media (max-width: 900px) {
  .drama-layout--library {
    grid-template-columns: 1fr;
    grid-template-areas: "aside" "welcome";
    grid-template-rows: minmax(0, 45vh) minmax(0, 1fr);
  }
  .drama-welcome { min-height: 0; }
  .drama-welcome-inner { padding: 20px 16px; }
  .drama-aside .card { max-height: none; }
}
