/* Global common styles */

:root {
  --bg-primary: #f4f1ea;
  --bg-secondary: #f8f6f0;
  --bg-tertiary: #f0ece2;
  --bg-card: #ffffff;
  --border-color: #e4decf;
  --text-primary: #1b1d21;
  --text-secondary: #5c6270;
  --text-muted: #646a76;
  --accent-start: #916219;
  --accent-end: #916219;
  --accent-hover: #805311;
  --accent-rgb: 145, 98, 25;
  --shadow-color: rgba(40, 30, 10, 0.14);
  --danger: #ef4444;
  --fs-xl: 16px;
  --fs-lg: 14px;
  --fs-md: 13px;
  --fs-sm: 12px;
  --fs-xs: 12px;
  --fw-bold: 700;
  --fw-semibold: 600;
  --fw-medium: 500;
  --fw-normal: 400;
  --ls-title: 0.02em;
  --ls-button: 0.03em;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
}
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size:13px;
  min-height: 100vh;
  overflow-x: hidden;
}
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.topbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 52px;
}
.topbar-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-title);
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.topbar-keys {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.key-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--r-sm, 4px);
  padding: 4px 8px;
  color: var(--text-primary);
  font-size: var(--fs-xs);
  width: 160px;
  outline: none;
  transition: border-color 0.2s;
}
.key-input:focus { border-color: var(--accent-start); }
.key-input::placeholder { color: var(--text-muted); }

.key-label {
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.btn {
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  color: white;
  border: none;
  border-radius: var(--r-sm, 4px);
  padding: 5px 10px;
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-button);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: grayscale(0.3); }
.btn-secondary { background: var(--bg-tertiary); border: 1px solid var(--border-color); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-small { padding: 3px 6px; font-size:12px; }

.service-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.status-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size:12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}
.status-tag.online { border-color: var(--success); color: var(--success); }
.status-tag.offline { border-color: var(--error); color: var(--error); }
.status-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Main Layout */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.sidebar {
  width: 140px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 12px 0;
  overflow-y: auto;
  flex-shrink: 0;
}
.nav-item {
  --nav-icon-accent: var(--nav-icon-gold);
  display: flex;
  align-items: center;
  gap: var(--nav-item-gap);
  min-height: var(--nav-item-min-height);
  padding: 10px 14px;
  cursor: pointer;
  transition: background-color var(--nav-icon-motion), color var(--nav-icon-motion), transform var(--nav-icon-motion);
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  font-size: var(--fs-lg);
  font-weight: var(--fw-normal);
}
.nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-item.active { background: rgba(var(--accent-rgb), 0.15); border-left-color: var(--accent-start); color: var(--text-primary); }
.nav-item.completed { color: var(--success); }
.nav-item.failed { color: var(--error); }
.nav-item.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.nav-item:active:not(.disabled) { transform: translateY(1px); }
.nav-item:focus-visible { outline: 2px solid var(--nav-icon-gold); outline-offset: -3px; }

.nav-icon {
  position: relative;
  width: var(--nav-icon-box-size);
  height: var(--nav-icon-box-size);
  display: grid;
  place-items: center;
  flex: 0 0 var(--nav-icon-box-size);
  color: var(--nav-icon-ivory);
  background: linear-gradient(145deg, var(--nav-icon-surface), var(--nav-icon-surface-deep));
  border: 1px solid var(--nav-icon-border);
  border-radius: var(--nav-icon-radius);
  box-shadow: inset 0 1px 0 var(--nav-icon-highlight);
  transition: transform var(--nav-icon-motion), border-color var(--nav-icon-motion);
}
.nav-icon::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: var(--nav-icon-dot-size);
  height: var(--nav-icon-dot-size);
  background: var(--nav-icon-gold);
  border-radius: 50%;
}
.nav-icon svg { width: var(--nav-icon-glyph-size); height: var(--nav-icon-glyph-size); overflow: visible; }
.nav-icon-main { fill: var(--nav-icon-ivory); }
.nav-icon-cut { fill: var(--nav-icon-surface); }
.nav-icon-accent { fill: var(--nav-icon-accent); }
.nav-icon-main-stroke { fill: none; stroke: var(--nav-icon-ivory); stroke-width: 2; }
.nav-icon-accent-stroke { fill: none; stroke: var(--nav-icon-accent); stroke-width: 2.2; stroke-linecap: square; stroke-linejoin: round; }
.nav-icon-layer-back { opacity: .42; }
.nav-icon-layer-mid { opacity: .68; }
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { transform: translateY(-1px); border-color: var(--nav-icon-accent); }
.nav-item[data-page="home"] { --nav-icon-accent: var(--nav-icon-home); }
.nav-item[data-page="materials"] { --nav-icon-accent: var(--nav-icon-materials); }
.nav-item[data-page="script"] { --nav-icon-accent: var(--nav-icon-script); }
.nav-item[data-page="voice"] { --nav-icon-accent: var(--nav-icon-voice); }
.nav-item[data-page="avatar"] { --nav-icon-accent: var(--nav-icon-avatar); }
.nav-item[data-page="editor"] { --nav-icon-accent: var(--nav-icon-editor); }
.nav-item[data-page="assets"] { --nav-icon-accent: var(--nav-icon-assets); }
.nav-item[data-page="create"] { --nav-icon-accent: var(--nav-icon-create); }
.nav-num { 
  width: 20px; height: 20px; border-radius: 50%; background: var(--bg-tertiary); 
  display: flex; align-items: center; justify-content: center; font-size:12px; 
}
.nav-item.active .nav-num { background: var(--accent-start); color: white; }
.nav-item.completed .nav-num { background: var(--success); color: white; }
.nav-item.failed .nav-num { background: var(--error); color: white; }

/* Content Grid */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
  position: relative;
}
.step-content {
  flex: 1;
  padding: 8px;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: row;
  gap: 6px;
  background: var(--bg-card);
}
.step-content .panel {
  display: none;
}
.step-content .panel.active-step {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  padding: 8px;
}
.step-content.three-col .panel.active-step {
  flex: 1;
  min-width: 0;
}
.step-content .mid-stack-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100%;
  gap: 0;
  overflow-y: auto;
  padding-bottom: 200px;
}
.step-content.three-col .mid-stack-panel.active-step {
  display: flex;
}
.step-content .mid-stack-panel .panel.active-step {
  flex: 0 0 auto !important;
  min-height: auto !important;
  height: auto !important;
  border-left: none;
  overflow: visible;
  padding: 8px;
}
.step-content .mid-stack-panel .panel.active-step:first-child {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding-top: 0;
}
.step-content .mid-stack-panel .panel.active-step + .panel.active-step {
  margin-top: -1px;
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.step-content .panel.active-step.home-panel {
  flex: 1;
}
.step-content .panel.active-step + .panel.active-step,
.step-content .panel.active-step + .preview-panel.active-step {
  border-left: 1px solid var(--border-color);
}
.home-card:hover {
  border-color: var(--accent-start) !important;
  transform: translateY(-2px);
}
.preview-panel {
  flex: 0 0 260px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-width: 0;
}
.preview-panel.active-step {
  display: flex;
}
.preview-panel .preview-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.preview-panel .preview-title {
  font-size:12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.preview-panel .preview-box {
  flex: 1;
  background: #000;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 120px;
}
.preview-panel .preview-box video,
.preview-panel .preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.preview-panel .preview-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size:12px;
}
.preview-panel .preview-placeholder div:first-child {
  font-size: 20px;
  margin-bottom: 4px;
}
.preview-panel .preview-controls {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  justify-content: center;
}
.preview-panel .preview-info {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px;
  font-size:12px;
  color: var(--text-secondary);
}
.preview-panel .preview-info .info-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.preview-panel .preview-info .info-value {
  color: var(--text-primary);
}
.preview-panel .text-preview {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px;
  font-size:12px;
  line-height: 1.6;
  color: var(--text-primary);
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.preview-panel .audio-preview {
  margin-top: 6px;
}
.preview-panel .audio-preview audio {
  width: 100%;
  height: 32px;
}
.step-nav {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding-top: 10px;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
}
.step-nav .btn {
  flex: 1;
  text-align: center;
  padding: 6px 12px;
}
.ai-template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: calc(100vh - 420px);
  overflow-y: auto;
}
.ai-template-item {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--border-color);
  transition: all 0.2s;
  aspect-ratio: 16/9;
  background: var(--bg-tertiary);
}
.ai-template-item:hover { border-color: var(--accent-start); }
.ai-template-item.selected { border-color: var(--accent-start); box-shadow: 0 0 8px rgba(var(--accent-rgb),0.3); }
.ai-template-item img { width: 100%; height: 100%; object-fit: cover; }
.ai-template-item .template-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-size:12px;
  color: white;
}
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  overflow-y: auto;
  position: relative;
  transition: all 0.3s;
}
.panel.offline-mode { border: 2px dashed var(--error); }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}
.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel-content { display: flex; flex-direction: column; gap: 10px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
}
.tab {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-start); border-bottom-color: var(--accent-start); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Platform Tags */

/* Input Groups */
.input-group { display: flex; flex-direction: column; gap: 2px; }
.input-label { font-size:12px; color: var(--text-secondary); }

.input-row { display: flex; gap: 6px; align-items: center; }
.input-field {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-size:13px;
  outline: none;
  transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--accent-start); }
.input-field::placeholder { color: var(--text-muted); }

textarea.input-field {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  line-height: 1.5;
}
textarea.input-field.enlarged {
  min-height: 220px;
  font-size:14px;
}
.zoom-controls { display: inline-flex; margin-left: 6px; gap: 2px; }
.zoom-btn {
  width: 22px; height: 22px; border: 1px solid var(--border-color); border-radius: 4px;
  background: var(--bg-tertiary); color: var(--text-secondary); font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1;
}
.zoom-btn:hover { border-color: var(--accent-start); color: var(--accent-start); }

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-tertiary);
}
.upload-zone:hover { border-color: var(--accent-start); background: rgba(var(--accent-rgb), 0.1); }
.upload-zone.dragover { border-color: var(--accent-start); background: rgba(var(--accent-rgb), 0.15); }
.upload-icon { font-size:20px; margin-bottom: 6px; color: var(--text-muted); }
.upload-text { font-size:12px; color: var(--text-secondary); }
.upload-text small { color: var(--text-muted); font-size:12px; }

.file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  margin-top: 8px;
}
.file-preview img, .file-preview video {
  width: 60px; height: 40px; object-fit: cover; border-radius: 4px;
}
.file-name { flex: 1; font-size:12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-remove { color: var(--error); cursor: pointer; font-size: 14px; }

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  padding: 4px 10px;
  border-radius: 12px;
  font-size:12px;
  cursor: pointer;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: all 0.2s;
}
.chip:hover { border-color: var(--accent-start); }
.chip.active { background: var(--accent-start); color: white; border-color: var(--accent-start); }

/* Voice Grid */
.slider-group { display: flex; flex-direction: column; gap: 4px; }
.slider-header { display: flex; justify-content: space-between; align-items: center; }
.slider-label { font-size:12px; color: var(--text-secondary); }
.slider-value { font-size:12px; color: var(--accent-start); }

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius:4px;
  background: var(--bg-tertiary);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  cursor: pointer;
}
.emotion-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.emotion-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: 4px;
  cursor: pointer;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}
.emotion-item:hover { border-color: var(--accent-start); }
.emotion-item.active { outline: 2px solid var(--accent-start); border-radius:4px; }
.emotion-icon { font-size: 16px; }
.emotion-label { font-size:12px; color: var(--text-secondary); margin-top: 2px; }
.emotion-item.active .emotion-label { color: var(--accent-start); }

/* Avatar Grid */
.bg-color-chip:hover { transform: scale(1.15); border-color: var(--accent-start) !important; }
.bg-thumb { width:100%;aspect-ratio:16/9;object-fit:cover;border-radius:4px;cursor:pointer;border:2px solid transparent;transition:all .15s; }
.bg-thumb:hover { border-color: var(--accent-start); }
.bg-thumb.active { border-color: var(--accent-start); box-shadow: 0 0 0 1px var(--accent-start); }
.bg-item { position:relative; }
.bg-item-name { font-size:12px;color:var(--text-muted);text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:1px; }
.bg-item-del { position:absolute;top:1px;right:1px;background:rgba(0,0,0,0.6);color:#fff;border:none;border-radius:50%;width:14px;height:14px;font-size:12px;cursor:pointer;display:none;line-height:14px;text-align:center; }
.bg-item:hover .bg-item-del { display:block; }

/* Filter/Transition Grid */
.effect-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.effect-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border-radius: 4px;
  cursor: pointer;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}
.effect-item:hover { border-color: var(--accent-start); }
.effect-item.active { outline: 2px solid var(--accent-start); border-radius:4px; }
.effect-icon { font-size: 16px; }
.effect-name { font-size:12px; color: var(--text-secondary); margin-top: 2px; text-align: center; }
.effect-item.active .effect-name { color: var(--text-primary); }

/* Pexels Grid */
.preview-box {
  width: 100%;
  aspect-ratio: 9/16;
  max-height: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.preview-box video, .preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.preview-placeholder {
  color: var(--text-muted);
  font-size:12px;
  text-align: center;
  padding: 20px;
}
.preview-controls {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.progress-container {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius:4px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  border-radius:4px;
  transition: width 0.3s;
  position: relative;
  overflow: hidden;
}
.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  100% { left: 100%; }
}
.progress-text {
  font-size:13px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.result-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 10px;
  font-size:12px;
  line-height: 1.6;
}
.result-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size:12px;
}
.meta-label { color: var(--text-muted); }
.meta-value { color: var(--text-primary); }

.status-badge {
  padding: 2px 6px;
  border-radius: 8px;
  font-size:12px;
}
.status-badge.success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.status-badge.warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.status-badge.error { background: rgba(239, 68, 68, 0.2); color: var(--error); }

/* Compliance */
.compliance-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success);
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size:12px;
  color: var(--success);
}
.resolution-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-size:12px;
  outline: none;
  cursor: pointer;
}
.platform-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.platform-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
}
.platform-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.platform-card-icon { font-size: 20px; }
.platform-card-name { font-size:13px; font-weight: 600; }

.platform-steps {
  font-size:12px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.platform-steps li { margin-left: 14px; }

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size:12px;
  color: var(--text-muted);
}
.footer-stats { display: flex; gap: 16px; }
.stat-item { display: flex; align-items: center; gap: 4px; }
.stat-value { color: var(--text-primary); }

/* Guide Overlay */
.toast {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1001;
  animation: toastFadeIn 0.3s ease;
  max-width: 400px;
  box-shadow: 0 4px 12px var(--shadow-color);
}
.toast.hidden { display: none; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }
.toast.info { border-color: var(--info); }

@keyframes toastFadeIn {
  from { transform: translateX(-50%) translateY(-10px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.toast-icon { font-size: 16px; }
.toast-message { font-size:12px; flex: 1; }
.toast-close { cursor: pointer; color: var(--text-muted); font-size: 14px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius:4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-color); }

/* Two Column Layout */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.col-full { grid-column: 1 / -1; }

/* Section Divider */
.section-divider {
  height: 1px;
  background: var(--border-color);
  margin: 10px 0;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius:12px;
  font-size:12px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.tag-pill .remove { cursor: pointer; color: var(--text-muted); }
.tag-pill .remove:hover { color: var(--error); }

/* Loading Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--accent-start);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@media (max-width: 1200px) {
  .step-content {
    padding: 6px;
  }
  .preview-panel {
    display: none !important;
  }
  .publish-panel {
    display: none !important;
  }
  .panel { min-height: auto; }
}
@media (max-width: 900px) {
  .sidebar { width: 50px; }
  .nav-item { padding-right: 8px; padding-left: 8px; }
  .nav-item span:not(.nav-icon):not(.nav-num) { display: none; }
  .platform-cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-item,
  .nav-icon { transition: none; }
}
@media (max-width: 600px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-keys { flex-direction: column; }
  .key-input { width: 100%; }
  .sidebar { display: none; }
  .preview-panel { display: none !important; }
  .publish-panel { display: none !important; }
  .step-content { padding: 6px; }
}
.main-tabs{display:none;gap:4px;border-bottom:1px solid var(--border-color);margin:0 6px 2px 6px;padding:0 4px;flex-shrink:0}
.main-tab{flex:1;text-align:center;padding:7px 8px;cursor:pointer;font-size:var(--fs-lg);font-weight:var(--fw-semibold);white-space:nowrap;color:var(--text-secondary);border-bottom:2px solid transparent;transition:all .2s;user-select:none}
.main-tab:hover{color:var(--text-primary)}
.main-tab.active{color:var(--accent-start);border-bottom-color:var(--accent-start)}

/* Voice Accordion */
.user-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
}
.user-status .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  font-weight: 600;
}
.user-status .user-name {
  font-size: 13px;
  color: var(--text-primary);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-status .vip-badge {
  font-size:12px;
  padding: 1px 6px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  font-weight: 600;
}
.user-status .btn-login,
.user-status .btn-logout {
  font-size:13px;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.user-status .btn-login {
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  color: white;
}
.user-status .btn-login:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.user-status .btn-logout {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.user-status .btn-logout:hover {
  background: var(--border-color);
}
.auth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.auth-overlay.active {
  opacity: 1;
  visibility: visible;
}
.auth-modal {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius:12px;
  padding: 32px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px var(--shadow-color);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}
.auth-overlay.active .auth-modal {
  transform: translateY(0);
}
.auth-modal h2 {
  font-size:20px;
  margin: 0 0 6px 0;
  color: var(--text-primary);
  text-align: center;
}
.auth-modal .auth-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
}
.auth-form-group {
  margin-bottom: 16px;
}
.auth-form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.auth-form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.auth-form-group input:focus {
  outline: none;
  border-color: var(--accent-start);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}
.auth-form-group input::placeholder {
  color: var(--text-muted);
}
.auth-btn-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  color: white;
  font-size:14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}
.auth-btn-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.auth-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}
.auth-switch a {
  color: var(--accent-start);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
.auth-switch a:hover {
  text-decoration: underline;
}
.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
}
.auth-error.visible {
  display: block;
}
.auth-optional {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}
.auth-optional-toggle {
  font-size:13px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.auth-optional-toggle:hover {
  color: var(--text-secondary);
}
.auth-optional .auth-form-group {
  display: none;
  margin-top: 12px;
}
.auth-optional.expanded .auth-form-group {
  display: block;
}
.auth-benefits {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size:13px;
  color: #10b981;
  line-height: 1.6;
}
.auth-benefits strong {
  color: #34d399;
}
@media (max-width: 600px) {
  .auth-modal {
    padding: 24px 20px;
    width: 95vw;
  }
  .user-status .user-name {
    display: none;
  }
}
/* Expand overlay for textarea */
.expand-btn {
  position: absolute; bottom: 4px; right: 4px; z-index: 5;
  width: 24px; height: 24px; border: 1px solid var(--border-color); border-radius: 4px;
  background: var(--bg-tertiary); color: var(--text-secondary); font-size: 13px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1;
  opacity: 0.6; transition: opacity 0.2s;
}
.expand-btn:hover { opacity: 1; border-color: var(--accent-start); color: var(--accent-start); }
.input-group { position: relative; }

.textarea-expand-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 9999;
  background: rgba(0,0,0,0.7); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.textarea-expand-box {
  width: 380px; height: 550px; background: var(--bg-primary); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 8px;
}
.textarea-expand-header {
  display: flex; align-items: center; justify-content: space-between;
}
.textarea-expand-title { font-size: 14px; color: var(--text-primary); font-weight: 600; }
.textarea-expand-close {
  width: 32px; height: 32px; border: none; border-radius: 6px; cursor: pointer;
  background: var(--bg-tertiary); color: var(--text-primary); font-size:16px;
  display: flex; align-items: center; justify-content: center;
}
.textarea-expand-close:hover { background: #e74c3c; color: #fff; }
.textarea-expand-area {
  flex: 1; width: 100%; background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: 6px; padding: 12px; color: var(--text-primary); font-size: 16px;
  font-family: inherit; line-height: 1.6; resize: none; outline: none;
}
.textarea-expand-area:focus { border-color: var(--accent-start); }

/* ===== 主题定制系统 ===== */
body, .topbar, .sidebar, .nav-item, .btn, .chip, .tab, .effect-item, 
.pfilter-tag, .theme-card, .theme-panel, .theme-btn, .preview-panel, .preview-section,
.panel, .step-content, .auth-modal, .auth-overlay, .home-card, .result-box, .voice-item,
.avatar-item, .preset-avatar-item, .pexels-item, .ai-template-item, .key-input,
.voice-tab, .voice-acc-header, .voice-coll-header, .status-tag { 
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; 
}
.theme-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s;
  white-space: nowrap;
}
.theme-btn:hover { border-color: var(--accent-start); background: var(--bg-card); }
.theme-panel {
  display: none;
  position: fixed;
  top: 56px;
  right: 16px;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius:12px;
  padding: 14px;
  z-index: 9999;
  box-shadow: 0 8px 32px var(--shadow-color);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.theme-panel-open { opacity: 1 !important; transform: translateY(0) !important; }
.theme-panel-title {
  font-size:13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.theme-card {
  padding: 8px 4px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  cursor: pointer;
  text-align: center;
  font-size:12px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  transition: all 0.2s;
}
.theme-card:hover { border-color: var(--accent-start); transform: translateY(-2px); }
.theme-card.theme-active { border-color: var(--accent-start); background: var(--bg-secondary); box-shadow: 0 0 0 2px var(--accent-start); }
.theme-card-color {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin: 0 auto 4px;
}
.theme-divider {
  height: 1px;
  background: var(--border-color);
  margin: 10px 0;
}
.theme-custom-label {
  font-size:12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.theme-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-custom-row input[type="color"] {
  width: 40px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}
.theme-custom-row input[type="text"] {
  flex: 1;
  padding: 6px 8px;
  font-size:12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.theme-apply-btn {
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  font-size:12px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  color: #fff;
  cursor: pointer;
}

/* ===== Refined UI - Clean & Elegant ===== */
.nav-item { font-size: 13px; }
.nav-item.active { background: var(--bg-tertiary); font-weight: var(--fw-medium); }
.nav-item:hover:not(.active):not(.disabled) { background: var(--bg-tertiary); }
.btn:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.chip {
  border-radius: var(--r-sm, 4px); border: 1px solid var(--border-color);
  background: var(--bg-tertiary); color: var(--text-secondary);
  font-size: var(--fs-xs); padding: 3px 10px;
  transition: all 0.15s ease; cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--accent-start); color: var(--text-primary); }
.chip.active { background: var(--accent-start) !important; color: #fff !important; border-color: var(--accent-start) !important; }
.tab { position: relative; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary) !important; font-weight: var(--fw-medium); }
.tab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 12%; right: 12%;
  height: 2px; background: var(--accent-start); border-radius:4px;
}
.effect-item { border: 2px solid var(--border-color); border-radius: 6px; }
.effect-item:hover { border-color: var(--accent-start); }
.effect-item.active { border-color: var(--accent-start) !important; }
.pfilter-tag { border-radius: 4px; }
.pfilter-tag:hover { border-color: var(--accent-start); color: var(--text-primary); }
.pfilter-tag.active { background: var(--accent-start) !important; color: #fff !important; border-color: var(--accent-start) !important; }
.status-tag.online { background: rgba(16, 185, 129, 0.1); }
.status-tag.offline { background: rgba(239, 68, 68, 0.1); }
.key-input:focus { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.15); }
.upload-zone { transition: all 0.15s ease; }
.upload-zone:hover { border-color: var(--accent-start); }
.panel-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text-primary); letter-spacing: var(--ls-title); }
.preview-title { font-size:12px; font-weight: 600; color: var(--text-secondary); }
.home-card:hover { border-color: var(--accent-start) !important; transform: translateY(-2px); box-shadow: 0 4px 12px var(--shadow-color); }

/* ===== 统一交互四态 v2(2026-07-10)——元素级低优先兜底,不覆盖各按钮已有的定制样式 ===== */
button, .btn, .action-btn, .btn-rewrite {
  transition: transform .12s cubic-bezier(.23,1,.32,1), filter .12s ease, opacity .12s ease;
}
/* 悬停:没定义 hover 的按钮也有统一反馈 */
button:not(:disabled):hover, .btn:not(.disabled):hover, .action-btn:hover { filter: brightness(1.08); }
/* 按下:全站统一轻微下陷 */
button:not(:disabled):active, .btn:not(.disabled):active, .action-btn:active, .btn-rewrite:not(:disabled):active { transform: scale(.96); }
/* 置灰:点击后 JS disabled=true 的等待场景自动获得统一外观 */
button:disabled, .btn:disabled, .btn.disabled, .action-btn:disabled {
  opacity: .45; cursor: not-allowed; filter: saturate(.5); transform: none;
}
/* 键盘焦点 */
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent-start); outline-offset: 2px; }
/* 等待中:统一转圈(新代码用 .is-loading,旧代码靠 disabled 兜底) */
.is-loading { pointer-events: none; opacity: .8; }
.is-loading::before {
  content: ""; display: inline-block; width: 1em; height: 1em;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%;
  margin-right: 6px; vertical-align: -2px; animation: spin .8s linear infinite;
}

/* ===== 顶栏清理(2026-07-12 用户要求):隐藏 Key 输入区/自检按钮/服务状态灯 ===== */
.topbar-keys, .service-status, .topbar button[onclick="checkServices()"] { display: none !important; }
