/* FOCUSDESIGN AI Studio — 网页版图像修改 / 灯具植入 / AI 布灯 */
:root,
html[data-theme="light"] {
  --bg-dark: #ffffff;
  --bg-card: #ffffff;
  --bg-surface: #f5f5f5;
  --border: #e5e5e5;
  --accent: #d4a853;
  --accent-light: #e8c97a;
  --canvas-teal: #14b8a6;
  --text: #1a1a1a;
  --text2: #666666;
  --text-disabled: #999999;
  --text-on-accent: #1a1a1a;
  --header-bg: rgba(255, 255, 255, 0.95);
  --danger: #c75050;
  --ok: #2d8a5e;
  --warn: #b8913a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }

body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  display: flex;
  flex-direction: column;
}

a { color: var(--text2); text-decoration: none; }
a:hover { color: var(--accent); }

.studio-header {
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 200;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
body.hub-mode {
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
  min-height: 100%;
  max-height: none;
}
body.workspace-mode {
  overflow: hidden;
  height: 100%;
  max-height: 100dvh;
  font-size: 17px;
}
body.hub-mode .header-inner {
  max-width: none;
  padding: 10px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 26px; }
.brand-text { font-size: 1rem; letter-spacing: 0.1em; }
.brand-text span { color: var(--accent); }
.brand-text em { font-style: normal; color: var(--text2); font-size: 0.85em; margin-left: 8px; }
.header-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.portal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 0 12px;
}
.portal-nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.portal-nav-btn:hover,
.portal-nav-btn.open {
  color: var(--text-on-accent);
  background: var(--accent);
}
.portal-nav-btn.open {
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.25);
}

/* AI 工具门户选择器 */
.portal-picker {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.portal-picker[hidden] { display: none !important; }
.portal-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.portal-picker-dialog {
  position: relative;
  width: min(960px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px 32px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
.portal-picker-header {
  position: relative;
  text-align: center;
  margin-bottom: 24px;
  padding-right: 36px;
}
.portal-picker-header h2 {
  font-size: 1.35rem;
  font-weight: 500;
  margin-bottom: 6px;
}
.portal-picker-sub {
  color: var(--text2);
  font-size: 0.88rem;
}
.portal-picker-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.portal-picker-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.portal-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 768px) {
  .portal-picker-grid { grid-template-columns: 1fr; }
}
.portal-picker-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface);
  cursor: pointer;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.portal-picker-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.portal-picker-card.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.portal-picker-card-img {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  display: block;
  background: var(--bg-dark);
}
.portal-picker-card-body {
  padding: 14px 14px 16px;
}
.portal-picker-card-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--accent);
}
.portal-picker-card-desc {
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.45;
}
body.portal-picker-open { overflow: hidden; }
.header-user, .header-balance { color: var(--text2); font-size: 0.9rem; }
.header-balance { color: var(--accent); }
.link-btn {
  background: none; border: none; color: var(--text2); cursor: pointer; font: inherit;
}
.link-btn:hover { color: var(--accent); }

/* 已登录切换门户时：避免短暂闪现登录页 */
html.ai-auth-restoring #authView { display: none !important; }
html.ai-auth-restoring #mainView { display: flex !important; }

/* 认证 */
.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 36px 32px;
}
.auth-title { font-size: 1.6rem; font-weight: 400; margin-bottom: 8px; text-align: center; }
.auth-sub { color: var(--text2); text-align: center; margin-bottom: 28px; font-size: 0.9rem; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1; padding: 10px; background: none; border: none; color: var(--text2);
  cursor: pointer; font: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.auth-form .form-group { margin-bottom: 16px; }
.auth-form label { display: block; margin-bottom: 6px; color: var(--text2); font-size: 0.85rem; }
.auth-form input, .auth-form textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 4px; color: var(--text); font: inherit;
}
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.auth-msg { padding: 10px; border-radius: 4px; margin-bottom: 16px; background: rgba(224,139,139,0.15); color: var(--danger); }
.auth-msg.ok { background: rgba(139,201,168,0.15); color: var(--ok); }
.sms-hint { color: var(--text2); font-size: 0.85rem; margin-bottom: 12px; }
.auth-note { color: var(--text-disabled); font-size: 0.8rem; margin-top: 12px; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: 4px; border: 1px solid transparent;
  cursor: pointer; font: inherit; transition: background 0.2s, border-color 0.2s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-light); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* 主界面 */
.studio-main { flex: 1; display: flex; flex-direction: column; max-width: 1400px; width: 100%; margin: 0 auto; padding: 0 16px 16px; min-height: 0; }
body.hub-mode .studio-main {
  max-width: none;
  width: 100%;
  padding: 0;
  flex: 1 0 auto;
  min-height: 0;
  overflow: visible;
}
body.workspace-mode .studio-main {
  max-width: none;
  width: 100%;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
body.workspace-mode .header-inner {
  max-width: none;
  padding: 10px 20px;
}
.balance-banner {
  margin: 12px 0 0; padding: 12px 16px; border-radius: 6px;
  background: rgba(224,139,139,0.12); border: 1px solid rgba(224,139,139,0.35); color: var(--danger);
}

/* 方案模板（独立标签页） */
.ppt-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 180px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.ppt-workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ppt-panel-status { font-size: 0.82rem; margin: 0; }
.ppt-category-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 18px;
}
.ppt-category-block + .ppt-category-block { margin-top: 16px; }
.ppt-category-title {
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 10px;
  letter-spacing: 0.06em;
}
.ppt-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px;
}
.ppt-thumb-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.ppt-thumb-cover {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  aspect-ratio: 16 / 10;
  cursor: pointer;
}
.ppt-thumb-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ppt-thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.ppt-thumb-cover:hover .ppt-thumb-overlay { opacity: 1; }
.ppt-thumb-overlay .btn { padding: 4px 8px; font-size: 0.72rem; min-width: 0; }
.ppt-thumb-name {
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ppt-thumb-meta {
  font-size: 0.7rem;
  color: var(--text-disabled);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ppt-thumb-meta .paid { color: var(--accent); }

.ppt-preview-panel {
  width: min(880px, 96vw);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ppt-preview-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 18px 18px;
  overflow: hidden;
}
.ppt-preview-info { font-size: 0.82rem; line-height: 1.6; white-space: pre-line; flex-shrink: 0; }
.ppt-preview-banner {
  margin-top: 10px; padding: 10px 12px; border-radius: 6px; font-size: 0.82rem;
  background: rgba(212,168,83,0.12); border: 1px solid rgba(212,168,83,0.35); color: var(--warn);
  flex-shrink: 0;
}
.ppt-preview-scroll-hint { font-size: 0.78rem; margin-top: 10px; flex-shrink: 0; }
.ppt-preview-scroll {
  flex: 1;
  min-height: 200px;
  max-height: min(62vh, 560px);
  margin-top: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  background: var(--bg-surface);
}
.ppt-preview-pages { display: flex; flex-direction: column; gap: 16px; }
.ppt-preview-page-item { text-align: center; }
.ppt-preview-page-label {
  font-size: 0.8rem;
  color: var(--text2);
  margin-bottom: 8px;
}
.ppt-preview-page-item img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-dark);
}
.ppt-preview-actions { margin-top: 14px; display: flex; gap: 10px; flex-shrink: 0; }

/* ========== AI 工具箱（卡片入口，铺满视口） ========== */
.module-hub {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: auto;
  width: 100%;
  padding: 12px 20px 16px;
  overflow: visible;
}
.hub-header {
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 0 4px;
}
.hub-title {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0;
  white-space: nowrap;
}
.hub-sub {
  color: var(--text2);
  font-size: 0.85rem;
  text-align: right;
  flex: 1;
}
.hub-empty {
  grid-column: 1 / -1;
  color: var(--text2);
  text-align: center;
  padding: 48px 16px;
}
.hub-loading {
  color: var(--text-disabled);
}
.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 14px;
  width: 100%;
  overflow: visible;
  align-items: start;
  align-content: start;
  padding: 0 4px 8px;
}
@media (max-width: 720px) {
  .hub-grid {
    grid-template-columns: 1fr;
  }
}
.hub-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  font: inherit;
  color: inherit;
  height: auto;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.hub-card:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.hub-card:disabled,
.hub-card-soon {
  opacity: 0.55;
  cursor: not-allowed;
}
.hub-card-text {
  padding: 12px 14px 10px;
  flex-shrink: 0;
}
.hub-card-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 5px;
  min-height: calc(1.4em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hub-card-sub {
  font-size: 15px;
  color: var(--text2);
  line-height: 1.45;
  min-height: calc(1.45em * 3);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 改前 / 改后 对比图组 */
.hub-compare {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: start;
  padding: 0 10px 12px;
}
.hub-compare--video {
  align-items: stretch;
}
.hub-compare-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.hub-compare-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--bg-surface);
  overflow: hidden;
  flex-shrink: 0;
}
.hub-compare-img,
.hub-compare-video {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--bg-surface);
  object-fit: contain;
  object-position: center;
}
.hub-compare--video .hub-compare-frame .hub-compare-img,
.hub-compare--video .hub-compare-frame .hub-compare-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
  background-color: #000;
  object-fit: cover;
  object-position: center;
}
.hub-compare-divider {
  align-self: stretch;
  width: 4px;
  min-height: 48px;
  margin: 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22), 0 0 8px rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}
html[data-theme="light"] .hub-compare-divider {
  background: rgba(0, 0, 0, 0.18);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* 改前：偏暗、低饱和 */
.hub-thumb-before-1 { background-image: linear-gradient(145deg, #141210 0%, #252018 50%, #1a1612 100%); }
.hub-thumb-after-1  { background-image: linear-gradient(135deg, #1a1510 0%, #3d2e1a 40%, #6b4a28 70%, #2a2218 100%); }
.hub-thumb-before-2 { background-image: linear-gradient(160deg, #0a0c0e 0%, #151a20 50%, #0e1114 100%); }
.hub-thumb-after-2  { background-image: linear-gradient(160deg, #0f1418 0%, #1e2830 35%, #4a5568 60%, #1a1f24 100%); }
.hub-thumb-before-3 { background-image: linear-gradient(145deg, #0e1014 0%, #1a1e24 50%, #121418 100%); }
.hub-thumb-after-3  { background-image: linear-gradient(145deg, #121418 0%, #252830 45%, #3a3f48 75%, #181a1e 100%); }
.hub-thumb-before-4 { background-image: linear-gradient(120deg, #12100e 0%, #282018 50%, #1a1612 100%); }
.hub-thumb-after-4  { background-image: linear-gradient(120deg, #1c1814 0%, #4a3c2a 30%, #8b7355 55%, #2a241c 100%); }
.hub-thumb-before-5 { background-image: linear-gradient(155deg, #0e0c0a 0%, #1e1a16 50%, #141210 100%); }
.hub-thumb-after-5  { background-image: linear-gradient(155deg, #141210 0%, #2a2420 40%, #5c4a38 65%, #1e1a16 100%); }
.hub-thumb-before-6 { background-image: linear-gradient(140deg, #080a0c 0%, #141820 50%, #0e1014 100%); }
.hub-thumb-after-6  { background-image: linear-gradient(140deg, #101214 0%, #222830 50%, #3d4654 80%, #16181c 100%); }
.hub-thumb-before-7 { background-image: linear-gradient(130deg, #060810 0%, #121820 50%, #0a0e14 100%); }
.hub-thumb-after-7  { background-image: linear-gradient(130deg, #0e1014 0%, #1a2030 35%, #4a5878 60%, #141820 100%); }
.hub-thumb-before-8 { background-image: linear-gradient(125deg, #0e0c0a 0%, #221e18 50%, #141210 100%); }
.hub-thumb-after-8  { background-image: linear-gradient(125deg, #12100e 0%, #3a3228 40%, #7a6548 70%, #201c18 100%); }
.hub-thumb-before-9 { background-image: linear-gradient(130deg, #101014 0%, #1a1820 45%, #121018 100%); }
.hub-thumb-after-9  { background-image: linear-gradient(130deg, #181420 0%, #3a2848 40%, #6a5080 65%, #201828 100%); }
.hub-thumb-before-ppt { background-image: linear-gradient(145deg, #0e1014 0%, #1a2030 50%, #121820 100%); }
.hub-thumb-after-ppt  { background-image: linear-gradient(145deg, #141820 0%, #243048 45%, #4a6080 75%, #181c24 100%); }

@media (max-width: 720px) {
  .hub-header { flex-direction: column; align-items: flex-start; gap: 4px; }
  .hub-sub { text-align: left; }
  .module-hub { padding: 10px 12px 6px; }
}

.module-workspace {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  padding: 0 12px 12px;
  max-width: none;
  width: 100%;
  margin: 0;
  overflow: hidden;
}
.module-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 4px 0;
  flex-shrink: 0;
}
.module-title {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}

.module-tabs {
  display: flex; gap: 4px; margin: 16px 0; border-bottom: 1px solid var(--border);
}
.module-tab {
  padding: 12px 24px; background: none; border: none; color: var(--text2);
  cursor: pointer; font: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.module-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.studio-workspace {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  width: auto;
  flex: none;
  align-self: stretch;
  overflow: hidden;
}
.preview-block {
  flex: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow: hidden;
  box-sizing: border-box;
}
.preview-block-title {
  font-size: 0.95rem;
  color: var(--text2);
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.preview-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.preview-mask-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.preview-side-hint {
  font-size: 0.9rem;
  color: var(--text-disabled);
  margin-top: 8px;
  line-height: 1.45;
  flex-shrink: 0;
}
.preview-box-tall {
  flex: none;
  min-height: 120px;
  position: relative;
  background: var(--bg-surface);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.preview-box-tall .preview-zoom-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.22s ease;
}
.preview-box-tall.preview-zoomed .preview-zoom-inner {
  position: absolute;
  inset: 0;
  transform: scale(2);
}
.preview-box-tall .preview-zoom-inner img {
  position: relative;
  flex: none;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}
.preview-box-tall.preview-zoomed {
  overflow: auto;
  cursor: zoom-out;
}
.preview-box-tall.preview-zoomed .preview-zoom-inner img {
  cursor: zoom-out;
}
.chat-panel {
  max-width: 100%;
  min-width: 0;
}
.preview-box-tall .preview-zoom-inner canvas {
  display: none;
}
.preview-box-tall .preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-disabled);
  font-size: 0.85rem;
  padding: 20px;
  text-align: center;
  pointer-events: none;
}
.preview-block-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.msg {
  max-width: 88%; padding: 10px 14px; border-radius: 8px; line-height: 1.55; font-size: 1rem;
}
.msg.user { align-self: flex-end; background: rgba(212,168,83,0.12); border: 1px solid rgba(212,168,83,0.35); }
.msg.ai { align-self: flex-start; background: var(--bg-surface); border: 1px solid var(--border); }
.msg.system { align-self: center; color: var(--text2); font-size: 0.95rem; background: transparent; border: none; }
.msg .time { font-size: 0.82rem; color: var(--text-disabled); margin-top: 6px; }
.msg img.result-img {
  max-width: 100%; max-height: 360px; border-radius: 6px; margin-top: 8px;
  cursor: zoom-in;
  border: 1px solid var(--border);
}
.result-img-wrap { margin-top: 8px; }
.result-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.image-viewer-modal { align-items: stretch; justify-content: stretch; }
.modal-panel.image-viewer-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(96vw, 1100px);
  height: min(88vh, 820px);
  min-width: 480px;
  min-height: 320px;
  max-width: 96vw;
  max-height: 94vh;
  overflow: hidden;
}
.modal-panel.image-viewer-panel.is-maximized {
  left: 2vw !important;
  top: 3vh !important;
  width: 96vw !important;
  height: 94vh !important;
  transform: none !important;
}
.modal-panel.image-viewer-panel.is-resizing { user-select: none; }
.image-viewer-body {
  overflow: auto; padding: 12px 18px 8px; flex: 1; min-height: 0; text-align: center;
  background: var(--bg-surface);
}
.image-viewer-stage {
  display: inline-block;
  min-width: min(100%, 960px);
}
.image-viewer-body img {
  max-width: 100%;
  max-height: calc(88vh - 160px);
  object-fit: contain;
  transform-origin: center center;
  cursor: zoom-in;
}
.image-viewer-resize {
  position: absolute;
  z-index: 5;
}
.image-viewer-resize.edge-n,
.image-viewer-resize.edge-s {
  left: 12px;
  right: 12px;
  height: 8px;
  cursor: ns-resize;
}
.image-viewer-resize.edge-e,
.image-viewer-resize.edge-w {
  top: 12px;
  bottom: 12px;
  width: 8px;
  cursor: ew-resize;
}
.image-viewer-resize.edge-n { top: 0; }
.image-viewer-resize.edge-s { bottom: 0; }
.image-viewer-resize.edge-e { right: 0; }
.image-viewer-resize.edge-w { left: 0; }
.image-viewer-resize.corner-nw,
.image-viewer-resize.corner-ne,
.image-viewer-resize.corner-sw,
.image-viewer-resize.corner-se {
  width: 14px;
  height: 14px;
}
.image-viewer-resize.corner-nw { top: 0; left: 0; cursor: nwse-resize; }
.image-viewer-resize.corner-ne { top: 0; right: 0; cursor: nesw-resize; }
.image-viewer-resize.corner-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.image-viewer-resize.corner-se { bottom: 0; right: 0; cursor: nwse-resize; }
.modal-panel.image-viewer-panel.is-maximized .image-viewer-resize { display: none; }
.viewer-zoom-label {
  min-width: 48px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text2);
}
.viewer-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.viewer-hint { padding: 0 18px 14px; font-size: 0.8rem; text-align: center; }
#resultPreviewBox { cursor: zoom-in; }
#resultPreviewBox .preview-zoom-inner img { cursor: zoom-in; }
.msg pre.state-text { white-space: pre-wrap; font-family: inherit; font-size: 1rem; margin-top: 6px; }

.task-progress {
  flex-shrink: 0;
  flex-grow: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.progress-track { height: 8px; background: var(--bg-surface); border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.3s; }
.progress-line-main {
  font-size: 1.12rem;
  line-height: 1.5;
  color: var(--text);
  font-weight: 500;
}
.progress-line-sub {
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--text2);
  margin-top: 4px;
}

.chat-input-bar {
  display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.icon-btn {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; color: var(--text); font-size: 1.2rem;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
#promptInput {
  flex: 1; resize: none; overflow-y: hidden; padding: 12px 14px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 6px; color: var(--text);
  font: inherit; font-size: 1rem; line-height: 1.5; min-height: 3.2em; max-height: 280px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  min-height: 0;
  min-width: 220px;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}
.side-panel.sized {
  flex: none;
  min-width: 0;
}
.side-panel .side-block {
  width: 100%;
  box-sizing: border-box;
}
.side-block-grow {
  flex-shrink: 0;
}
#sceneSideBlock,
#referenceBlock {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#sceneSideBlock.sized {
  flex: none;
  align-self: stretch;
  box-sizing: border-box;
}
.side-block .side-scene-preview {
  flex: 1;
  min-height: 100px;
}
.side-scene-media {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  gap: 10px;
}
.side-subtitle {
  font-size: 0.95rem;
  color: var(--text2);
  margin: 4px 0 6px;
}
.side-outdoor-brightness {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.side-brightness-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.side-brightness-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}
.side-brightness-val {
  font-size: 0.85rem;
  color: var(--accent);
  min-width: 42px;
  text-align: right;
}
body.outdoor-landscape-mode .side-cad-annotated {
  margin-top: 8px;
}

/* 户外景观模块：仅放大中间对话区，顶栏/按钮/侧栏保持站点常规字号 */
body.outdoor-landscape-mode.workspace-mode {
  font-size: 17px;
}
body.outdoor-landscape-mode.workspace-mode .studio-header,
body.outdoor-landscape-mode.workspace-mode .module-toolbar,
body.outdoor-landscape-mode.workspace-mode .preview-panel,
body.outdoor-landscape-mode.workspace-mode .side-panel {
  font-size: 17px;
}
body.outdoor-landscape-mode.workspace-mode .studio-header .link-btn,
body.outdoor-landscape-mode.workspace-mode .studio-header .header-user,
body.outdoor-landscape-mode.workspace-mode .studio-header .header-balance,
body.outdoor-landscape-mode.workspace-mode .studio-header .portal-nav-btn,
body.outdoor-landscape-mode.workspace-mode .studio-header .brand-text,
body.outdoor-landscape-mode.workspace-mode .module-toolbar .btn-sm,
body.outdoor-landscape-mode.workspace-mode .module-title {
  font-size: inherit;
}
body.outdoor-landscape-mode.workspace-mode .chat-panel {
  font-size: 42px;
}
body.outdoor-landscape-mode.workspace-mode .chat-messages {
  padding: 14px;
  gap: 12px;
}
body.outdoor-landscape-mode.workspace-mode .msg,
body.outdoor-landscape-mode.workspace-mode .msg.system,
body.outdoor-landscape-mode.workspace-mode .msg pre.state-text {
  font-size: 1rem;
  padding: 10px 14px;
  line-height: 1.55;
}
body.outdoor-landscape-mode.workspace-mode .msg .time,
body.outdoor-landscape-mode.workspace-mode .msg .dim {
  font-size: 0.82rem;
}
body.outdoor-landscape-mode.workspace-mode #promptInput {
  font-size: 1rem;
  line-height: 1.55;
  min-height: 3.2em;
  max-height: 280px;
  padding: 12px 14px;
  resize: none;
  overflow-y: hidden;
}
body.outdoor-landscape-mode.workspace-mode .chat-input-bar {
  padding: 10px 12px;
  gap: 8px;
}
body.outdoor-landscape-mode.workspace-mode .chat-input-bar .btn {
  font-size: 15px;
  padding: 8px 16px;
  line-height: 1.3;
}
body.outdoor-landscape-mode.workspace-mode .chat-input-bar .icon-btn {
  width: 40px;
  height: 40px;
  font-size: 18px;
}
body.outdoor-landscape-mode.workspace-mode .task-progress {
  padding: 10px 14px;
  flex-shrink: 0;
  min-height: auto;
}
body.outdoor-landscape-mode.workspace-mode .progress-track {
  height: 8px;
  margin-bottom: 10px;
}
body.outdoor-landscape-mode.workspace-mode .progress-line-main {
  font-size: 1.1rem;
  line-height: 1.5;
}
body.outdoor-landscape-mode.workspace-mode .progress-line-sub {
  font-size: 1.02rem;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}
body.outdoor-landscape-mode.workspace-mode .side-panel {
  min-width: 220px;
}
body.outdoor-landscape-mode.workspace-mode .side-block {
  padding: 14px;
}
body.outdoor-landscape-mode.workspace-mode .preview-block {
  padding: 10px 12px;
}
.side-cad-annotated .preview-box {
  min-height: 100px;
}
#sceneSideBlock .side-scene-preview.sized {
  flex: none;
}
#sceneSidePreviewBox.sized img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.scene-side-mask-canvas {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}
.side-block-prompts {
  flex: 1 1 180px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.side-block-prompts .quick-prompt-list {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
}
.side-block {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 14px;
}
.side-title { font-size: 1rem; margin-bottom: 10px; color: var(--text2); }
.side-title .dim { font-size: 0.88rem; color: var(--text-disabled); }
.side-block .preview-box {
  position: relative;
  background: var(--bg-surface);
  border-radius: 6px;
  flex: 1;
  min-height: 120px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.side-block .side-ref-preview {
  flex: none;
  min-height: 100px;
  max-height: 200px;
}
.side-block .preview-box img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.side-block .preview-box.small { min-height: 80px; }
.side-block .preview-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.side-block .preview-placeholder { color: var(--text-disabled); font-size: 0.95rem; padding: 20px; text-align: center; }
.side-actions { display: flex; gap: 8px; margin-top: 10px; }
#sceneSideBlock .preview-mask-tools {
  justify-content: center;
  flex-wrap: wrap;
  box-sizing: border-box;
}
.side-hint { font-size: 0.8rem; color: var(--text-disabled); margin-top: 8px; }
#negativeInput {
  width: 100%; padding: 8px; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text); font: inherit; resize: vertical; min-height: 150px;
}
.quick-prompt-list { list-style: none; overflow-y: auto; }

@media (max-width: 1100px) {
  .studio-workspace {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .preview-panel { order: 1; flex-direction: row; max-height: 320px; }
  .chat-panel { order: 2; min-height: 420px; }
  .side-panel { order: 3; overflow-y: auto; }
  #referenceBlock { flex: none; }
  .side-block .side-ref-preview { min-height: 160px; max-height: 240px; }
}
@media (max-width: 720px) {
  .preview-panel { flex-direction: column; max-height: none; }
}
.quick-prompt-list li {
  padding: 8px 10px; border-radius: 4px; cursor: pointer; font-size: 0.95rem;
  border: 1px solid transparent; margin-bottom: 4px;
}
.quick-prompt-list li.dim { color: var(--text-disabled); cursor: default; }
.msg .dim { color: var(--text-disabled); font-size: 0.85rem; margin-top: 8px; }
.quick-prompt-list li:hover { background: var(--bg-surface); border-color: var(--border); }
.quick-prompt-list .qp-label { color: var(--accent); font-size: 0.92rem; margin-bottom: 2px; }
.quick-prompt-list .qp-preview { color: var(--text2); font-size: 0.95rem; line-height: 1.45; margin-top: 2px; }

/* 画布编辑器 */
.canvas-modal .canvas-panel {
  width: min(98vw, 1480px);
  height: min(94vh, 920px);
  max-height: 94vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.canvas-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.canvas-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.canvas-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.canvas-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}
.canvas-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.canvas-replace-btn { cursor: pointer; margin: 0; }
.canvas-zoom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 4px;
}
.canvas-zoom-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
}
.canvas-zoom-btn:hover { background: var(--bg-card); color: var(--canvas-teal, #14b8a6); }
.canvas-zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text2);
}
.canvas-viewport {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #0a0a0a;
  padding: 16px;
  touch-action: none;
}
.canvas-stack-wrap {
  display: inline-block;
  line-height: 0;
  transform-origin: 0 0;
}
.canvas-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.canvas-tools {
  width: 228px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-surface);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.canvas-tabs {
  display: flex;
  gap: 6px;
}
.canvas-tab {
  flex: 1;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text2);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.canvas-tab:disabled { opacity: 0.45; cursor: not-allowed; }
.canvas-tab.active {
  background: rgba(20, 184, 166, 0.18);
  border-color: var(--canvas-teal, #14b8a6);
  color: var(--canvas-teal, #14b8a6);
}
.canvas-tool-section { display: flex; flex-direction: column; gap: 8px; }
.canvas-section-title {
  font-size: 0.82rem;
  color: var(--text2);
  letter-spacing: 0.02em;
}
.canvas-tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.btn-block { width: 100%; display: block; text-align: center; }
.canvas-tool-btn {
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  line-height: 1.2;
}
.canvas-tool-btn:hover { border-color: var(--canvas-teal, #14b8a6); }
.canvas-tool-btn.active {
  background: rgba(20, 184, 166, 0.2);
  border-color: var(--canvas-teal, #14b8a6);
  color: var(--canvas-teal, #14b8a6);
}
.canvas-slider-row,
.canvas-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.canvas-slider-row input[type=range] { flex: 1; }
.canvas-slider-val,
.canvas-color-hex {
  min-width: 44px;
  font-size: 0.82rem;
  color: var(--canvas-teal, #14b8a6);
}
.canvas-color-row input[type=color] {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}
.canvas-tool-hint {
  font-size: 0.75rem;
  line-height: 1.45;
  margin: 0;
}
.canvas-slot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.canvas-slot-actions .btn { flex: 1; min-width: 0; }
.canvas-tools.slot-light-mode .canvas-tab-legacy { display: none !important; }
.canvas-tools.slot-light-mode .canvas-tab-slot { display: inline-block !important; }
.btn-canvas-teal {
  background: var(--canvas-teal, #14b8a6);
  border: 1px solid var(--canvas-teal, #14b8a6);
  color: #062925;
}
.btn-canvas-teal:hover { filter: brightness(1.08); }
.btn-canvas-muted {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-canvas-muted:hover { border-color: var(--text2); }

.modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.75); }
.modal-panel {
  position: relative; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; width: min(96vw, 960px); max-height: 92vh; display: flex; flex-direction: column;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-weight: 400; font-size: 1rem; }
.mask-stack { position: relative; display: inline-block; line-height: 0; }
.mask-stack canvas { display: block; }
#maskBgCanvas { border: 1px solid var(--border); z-index: 1; }
#maskDrawCanvas {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  cursor: crosshair; touch-action: none;
  pointer-events: auto;
  z-index: 2;
}

.studio-footer {
  text-align: center; padding: 8px 16px; color: var(--text-disabled); font-size: 0.75rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
body.hub-mode .studio-footer {
  padding: 4px 16px;
  font-size: 0.7rem;
}

.video-slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.video-params {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}
.video-param-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.video-param-label {
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.4;
}
.video-param-val {
  color: var(--accent);
  font-size: 0.82rem;
}
.video-param-input {
  width: 100%;
  box-sizing: border-box;
}
.video-param-select {
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}
.video-param-range {
  accent-color: var(--accent);
}
.video-param-seed-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.video-param-number {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
}
.video-slots-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.video-slots-grid--2col {
  display: grid;
  grid-template-columns: var(--video-col0-w, 165px) var(--video-col1-w, 165px);
  gap: 10px;
  width: 100%;
  max-width: 100%;
}
.video-slots-media {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
}
.video-media-panel {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--bg-surface);
  width: 100%;
  box-sizing: border-box;
}
.video-media-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  min-width: 0;
}
.video-media-av-col {
  flex: 0 0 39%;
  min-width: 180px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.video-media-params-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: stretch;
  font-size: 1rem;
}
.video-slot--compact {
  border: none;
  padding: 0;
  background: transparent;
  min-height: 0;
  height: 100%;
}
.video-slot-head--tight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
.video-slot-head--tight .video-slot-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.video-slot-head--tight .video-slot-upload-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 0.88rem;
}
.video-media-path {
  font-size: 0.92rem;
  color: var(--text);
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 28px;
  display: flex;
  align-items: center;
}
.video-params-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  width: 100%;
  align-content: start;
}
.video-params-inline--lg .video-param-label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.video-params-inline--lg .video-param-select {
  padding: 10px 12px;
  font-size: 1rem;
}
.video-params-inline--lg .video-param-val {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}
.video-pixel-duration-combo {
  gap: 8px;
}
.video-pixel-duration-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}
.video-pixel-duration-row .video-pixel-width-input {
  width: 108px;
  flex: 0 0 auto;
  padding: 8px 10px;
  font-size: 1.05rem;
  font-weight: 500;
}
.video-params-inline--lg .video-pixel-size-display {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.45;
  flex: 1 1 180px;
  min-width: 160px;
}
.video-duration-inline {
  flex: 1 1 200px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.video-duration-label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.video-params-inline--lg .video-duration-range {
  width: 100%;
  height: 22px;
  accent-color: var(--accent);
}
.video-param-row--full {
  grid-column: 1 / -1;
}
.video-param-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.video-param-label {
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.3;
}
.video-param-select {
  padding: 5px 8px;
  font-size: 0.78rem;
}
.video-pixel-size-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.video-pixel-size-row .video-pixel-width-input {
  width: 96px;
  flex: 0 0 auto;
  padding: 5px 8px;
  font-size: 0.82rem;
}
.video-pixel-size-display {
  font-size: 0.78rem;
  color: var(--accent);
  line-height: 1.35;
  flex: 1 1 auto;
  min-width: 140px;
}
.video-slot {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--bg-surface);
  min-width: 0;
  box-sizing: border-box;
}
.video-slot--image {
  display: flex;
  flex-direction: column;
}
.video-slot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.82rem;
}
.video-slot-preview {
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-card);
  min-height: 72px;
}
.video-slot--image .video-slot-preview {
  display: block;
  width: 100%;
  line-height: 0;
  overflow: hidden;
}
.video-slot--image .video-slot-preview:has(img) {
  min-height: calc(var(--video-col0-w, 165px) * 0.65);
}
.video-slot--image .video-slot-preview:not(:has(img)) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--video-col0-w, 165px) * 0.65);
  line-height: 1.4;
}
.video-slot-preview-hit {
  cursor: pointer;
}
.video-slot-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: rgba(0, 0, 0, 0.12);
}
.video-slot-preview video {
  width: 100%;
  max-height: calc(var(--video-col0-w, 165px) * 1.15);
  display: block;
}
.video-slot--media .video-slot-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
}
.video-slot-placeholder {
  color: var(--text-disabled);
  font-size: 0.78rem;
  padding: 16px 8px;
  text-align: center;
  line-height: 1.4;
}
#videoInputsBlock.is-open {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: var(--video-panel-w, auto);
  max-width: 100%;
  box-sizing: border-box;
  flex: 0 0 auto;
}
/* 多图视频模式：左栏（提示词+对话）窄，右栏（素材+生成视频）宽，右缘贴齐窗体 */
body.video-multi-slots-mode .module-workspace {
  padding: 0 0 8px 10px;
  width: 100%;
}
body.video-multi-slots-mode .module-toolbar {
  padding-right: 10px;
}
body.video-multi-slots-mode.workspace-mode .studio-workspace {
  grid-template-columns: var(--video-left-col-w, 35%) minmax(0, 1fr);
  gap: 10px 0;
  width: 100%;
}
.video-left-stack {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: none;
  gap: 10px;
  overflow: hidden;
}
.video-left-stack .side-block-prompts {
  flex: 0 0 auto;
  max-height: 38%;
  min-height: 100px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.video-left-stack .side-block-prompts .quick-prompt-list {
  flex: 1;
  min-height: 60px;
  max-height: 200px;
  overflow-y: auto;
}
.video-left-stack .chat-panel {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
}
body.video-multi-slots-mode.workspace-mode .side-panel {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 100%;
  min-height: 100%;
  height: 100%;
  min-width: 0;
  width: 100%;
  max-width: none;
  flex-shrink: 0;
  align-self: stretch;
  justify-self: stretch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 0;
}
body.video-multi-slots-mode .side-panel > .side-block {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  align-self: stretch;
  flex-shrink: 0;
  border-radius: 8px 0 0 8px;
  padding-right: 12px;
}
body.video-multi-slots-mode #videoInputsBlock.is-open {
  width: 100%;
  max-width: 100%;
}
body.video-multi-slots-mode .preview-panel {
  display: none !important;
}
#resultPreviewBlock.video-result-in-side {
  margin-top: auto;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding-right: 0;
  border-radius: 8px 0 0 8px;
}
#resultPreviewBlock.video-result-in-side .preview-box-tall {
  margin: 0;
  max-width: 100%;
}
.result-preview-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.msg video.ai-result-video {
  max-width: min(100%, 520px);
  border-radius: 8px;
  background: #000;
}

html[data-theme="dark"] {
  --bg-dark: #0d0d0d;
  --bg-card: #141414;
  --bg-surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e6e3;
  --text2: #9a9793;
  --text-disabled: #5c5955;
  --header-bg: rgba(13, 13, 13, 0.95);
  --danger: #e08b8b;
  --ok: #8bc9a8;
  --warn: #e8c97a;
}
html[data-theme="dark"] .msg.user {
  background: rgba(212,168,83,0.15);
  border-color: rgba(212,168,83,0.3);
}
