/* ═══════════════════════════════════════════════
   XZY TOOLS — RETRO-FUTURISTIC TERMINAL AESTHETIC
   复古未来主义：CRT 终端 × 70s 太空站
   ═══════════════════════════════════════════════ */

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

/* ── 暗色模式（默认）── */
:root {
  --bg-deep: #0b0d0f;
  --bg-panel: #111416;
  --bg-surface: #181b1f;
  --bg-hover: #1f2329;
  --primary: #39FF14;
  --primary-dim: #2bcc10;
  --primary-ghost: rgba(57, 255, 20, 0.06);
  --accent: #D4A574;
  --accent-dim: #a07c54;
  --cyan: #00D4FF;
  --cyan-dim: rgba(0, 212, 255, 0.15);
  --text: #c8ccd0;
  --text-bright: #e8eaed;
  --text-dim: #6b7280;
  --border: #2a2e33;
  --border-active: #39FF14;
  --success: #39FF14;
  --danger: #ff4444;
  --warning: #D4A574;
  --glow: rgba(57, 255, 20, 0.35);
  --glow-accent: rgba(212, 165, 116, 0.25);
  --scanline-opacity: 0.03;
  --noise-opacity: 0.015;
}

/* ── 亮色模式 ── */
[data-theme="light"] {
  --bg-deep: #e8e0d4;
  --bg-panel: #f2ece3;
  --bg-surface: #faf6f0;
  --bg-hover: #e0d8cc;
  --primary: #1a7a0d;
  --primary-dim: #15620b;
  --primary-ghost: rgba(26, 122, 13, 0.06);
  --accent: #8b6340;
  --accent-dim: #6b4c30;
  --cyan: #0088aa;
  --cyan-dim: rgba(0, 136, 170, 0.1);
  --text: #3a3632;
  --text-bright: #1a1816;
  --text-dim: #8a8078;
  --border: #c8bfb2;
  --border-active: #1a7a0d;
  --success: #1a7a0d;
  --danger: #b92d2d;
  --warning: #8b6340;
  --glow: rgba(26, 122, 13, 0.2);
  --glow-accent: rgba(139, 99, 64, 0.15);
  --scanline-opacity: 0.02;
  --noise-opacity: 0.01;
}

body {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  background: var(--bg-deep);
  color: var(--text);
  overflow: hidden;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* CRT 扫描线全局叠加 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 4px
  );
}

.container {
  display: flex;
  height: 100vh;
}

/* ══════════════════════════════════════
   侧边栏
   ══════════════════════════════════════ */
.sidebar {
  width: 260px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: width 0.3s ease;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.4;
}

.logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.logo h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 20px var(--glow);
  margin-bottom: 4px;
}

.subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.menu {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
}

/* 一级菜单 */
.menu-group {
  margin-bottom: 4px;
}

.menu-group-title {
  padding: 10px 14px;
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 2px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.menu-group-title:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.menu-group-icon {
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
}

.menu-group-name {
  flex: 1;
}

.menu-group-title::after {
  content: '▾';
  font-size: 10px;
  transition: transform 0.2s ease;
  color: var(--text-dim);
  font-family: system-ui;
}

.menu-group.collapsed .menu-group-title::after {
  transform: rotate(-90deg);
}

.menu-group-children {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.menu-group.collapsed .menu-group-children {
  max-height: 0;
  opacity: 0;
}

/* 二级菜单项 */
.menu-item {
  padding: 9px 14px 9px 24px;
  margin-bottom: 2px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  border-left: 2px solid transparent;
}

.menu-item::before {
  content: '›';
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  font-size: 14px;
  transition: color 0.15s ease;
}

.menu-item:hover {
  background: var(--bg-hover);
  border-left-color: var(--primary);
}

.menu-item:hover::before {
  color: var(--primary);
}

.menu-item.active {
  background: var(--primary-ghost);
  border-left-color: var(--primary);
  box-shadow: inset 0 0 20px rgba(57, 255, 20, 0.03);
}

.menu-item.active::before {
  color: var(--primary);
}

.menu-item-name {
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
}

.menu-item.active .menu-item-name {
  color: var(--primary);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.5px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--glow);
  animation: statusPulse 3s infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--glow); }
  50% { opacity: 0.6; box-shadow: 0 0 2px var(--glow); }
}

/* ══════════════════════════════════════
   右侧内容区
   ══════════════════════════════════════ */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-deep);
}

.content-header {
  padding: 20px 32px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.content-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), transparent 60%);
  opacity: 0.2;
}

.content-header h2 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-switch-btn {
  width: 36px;
  height: 36px;
  border-radius: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
}

.theme-switch-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--glow);
}

.theme-icon {
  display: block;
  line-height: 1;
}

.content-body {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  background: var(--bg-deep);
}

/* ══════════════════════════════════════
   欢迎屏幕
   ══════════════════════════════════════ */
.welcome-screen {
  text-align: center;
  padding: 100px 20px;
  animation: terminalFadeIn 0.5s ease;
}

.welcome-icon {
  font-size: 48px;
  margin-bottom: 20px;
  opacity: 0.6;
}

.welcome-screen h2 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 24px;
  font-weight: 500;
  color: var(--text-bright);
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.welcome-screen p {
  font-size: 13px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

/* ══════════════════════════════════════
   通用组件
   ══════════════════════════════════════ */

/* 工具容器 */
.tool-container {
  animation: terminalFadeIn 0.4s ease;
}

.tool-card {
  background: var(--bg-panel);
  border-radius: 2px;
  padding: 24px;
  max-width: 650px;
  margin: 0 auto;
  border: 1px solid var(--border);
  position: relative;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.3;
}

/* 计算器布局 */
.calc-container {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  animation: terminalFadeIn 0.4s ease;
}

.calc-left, .calc-right {
  min-height: 400px;
}

.calc-card {
  background: var(--bg-panel);
  border-radius: 2px;
  padding: 20px;
  border: 1px solid var(--border);
  height: 100%;
  position: relative;
}

.calc-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--primary);
  opacity: 0.3;
}

.calc-title {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* 表单 */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: 'DM Mono', monospace;
}

.form-group input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-bright);
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--glow);
}

.form-group input::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

/* 按钮 */
.btn {
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: 2px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 10px;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: var(--primary-ghost);
  box-shadow: 0 0 12px var(--glow), inset 0 0 12px var(--primary-ghost);
}

.btn:active {
  transform: scale(0.98);
}

/* 结果展示 */
.result-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.result-empty p {
  font-size: 12px;
  margin: 0;
  font-family: 'DM Mono', monospace;
}

.result-content {
  animation: terminalFadeIn 0.3s ease;
}

.result-badge {
  display: inline-block;
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 2px;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 12px;
}

.result-label {
  color: var(--text-dim);
  font-size: 12px;
}

.result-value {
  font-weight: 500;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-bright);
}

/* 上传区域 */
.upload-area {
  border: 1px dashed var(--border);
  border-radius: 2px;
  padding: 50px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-ghost);
}

.upload-icon {
  font-size: 36px;
  color: var(--primary);
  font-weight: 300;
  opacity: 0.7;
}

.upload-text {
  font-size: 14px;
  color: var(--text);
}

.upload-hint {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

/* ══════════════════════════════════════
   图片工具
   ══════════════════════════════════════ */
.image-tools-layout {
  display: flex;
  gap: 20px;
  height: calc(100vh - 180px);
}

.tools-left {
  flex: 0 0 80%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tools-right {
  flex: 0 0 calc(20% - 20px);
  min-width: 240px;
}

.image-viewer {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-panel);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.viewer-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.viewer-hint {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

.viewer-content {
  flex: 1;
  overflow: hidden;
  padding: 16px;
}

.image-compare-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  height: 100%;
}

.image-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.image-panel-header {
  padding: 8px 12px;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  color: var(--accent);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  text-align: center;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.image-panel-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  position: relative;
}

.image-panel-body canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.2s;
}

.image-panel-body canvas:hover {
  transform: scale(1.01);
}

#originalCanvas {
  cursor: crosshair !important;
}

.magnifier {
  position: absolute;
  width: 150px;
  height: 150px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  display: none;
  z-index: 1000;
  box-shadow: 0 0 16px var(--glow);
  background: var(--bg-panel);
}

.magnifier canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.magnifier-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.magnifier-crosshair::before,
.magnifier-crosshair::after {
  content: '';
  position: absolute;
  background: var(--primary);
}

.magnifier-crosshair::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  transform: translateY(-50%);
}

.magnifier-crosshair::after {
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  transform: translateX(-50%);
}

/* ══════════════════════════════════════
   创意胶囊
   ══════════════════════════════════════ */
.creative-capsule-container {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.capsule-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.capsule-selector {
  background: var(--bg-panel);
  border-radius: 2px;
  padding: 20px;
  border: 1px solid var(--border);
}

.tag-section {
  margin-bottom: 18px;
}

.tag-section:last-of-type {
  margin-bottom: 0;
}

.tag-section-title {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tag-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tag-btn.active {
  background: var(--primary-ghost);
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--glow);
}

.capsule-options {
  margin-top: 18px;
  padding: 14px;
  background: var(--bg-surface);
  border-radius: 2px;
  border: 1px solid var(--border);
}

.cutout-mode-toggle {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
}

.cutout-mode-toggle input[type="checkbox"] {
  margin-right: 10px;
  margin-top: 2px;
  cursor: pointer;
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toggle-icon {
  font-size: 13px;
  margin-right: 6px;
}

.toggle-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-bright);
}

.toggle-hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 20px;
  font-family: 'DM Mono', monospace;
}

.capsule-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.capsule-actions .btn {
  flex: 1;
}

/* 胶囊结果区域 */
.capsule-results {
  background: var(--bg-panel);
  border-radius: 2px;
  padding: 20px;
  border: 1px solid var(--border);
  min-height: 400px;
}

.results-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 360px;
  color: var(--text-dim);
  text-align: center;
}

.placeholder-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.results-placeholder p {
  margin: 4px 0;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
}

.placeholder-hint {
  font-size: 11px;
  opacity: 0.6;
}

.results-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.results-header h3 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 14px;
  margin: 0 0 4px 0;
  color: var(--text-bright);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.results-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin: 0;
  font-family: 'DM Mono', monospace;
}

.prompt-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 16px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}

.prompt-card:hover {
  border-color: var(--accent-dim);
}

.prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.prompt-number {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.prompt-actions {
  display: flex;
  gap: 6px;
}

.btn-copy {
  padding: 4px 10px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-copy:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.prompt-content {
  font-size: 12px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg-deep);
  padding: 12px;
  border-radius: 2px;
  border: 1px solid var(--border);
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
}

.prompt-lang {
  margin-bottom: 12px;
}

.prompt-lang:last-child {
  margin-bottom: 0;
}

.prompt-lang-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.prompt-text {
  font-size: 12px;
  line-height: 1.8;
  color: var(--text);
}

.results-actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.results-actions .btn {
  min-width: 150px;
}

@media (max-width: 1200px) {
  .capsule-content {
    grid-template-columns: 1fr;
  }
  .capsule-results {
    min-height: 300px;
  }
}

/* 图片放大查看 */
.image-zoom-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: terminalFadeIn 0.2s;
}

.image-zoom-modal canvas {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

/* ══════════════════════════════════════
   控制面板
   ══════════════════════════════════════ */
.control-panel {
  background: var(--bg-panel);
  border-radius: 2px;
  padding: 18px;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}

.control-panel h4 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 12px;
  margin-bottom: 16px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.control-group {
  margin-bottom: 18px;
}

.control-group label {
  display: block;
  font-size: 11px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 500;
  font-family: 'DM Mono', monospace;
}

.control-group .hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  display: block;
  font-family: 'DM Mono', monospace;
}

.control-group input[type="range"] {
  width: 100%;
  height: 3px;
  border-radius: 1px;
  background: var(--bg-hover);
  outline: none;
  -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: var(--primary);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 8px var(--glow);
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

/* 颜色选择器 */
.color-picker-group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-surface);
  border-radius: 2px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.color-preview {
  width: 36px;
  height: 36px;
  border-radius: 2px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.color-preview:hover {
  box-shadow: 0 0 8px var(--glow);
}

#colorValue {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

.preset-colors {
  display: flex;
  gap: 6px;
}

.preset-color {
  width: 28px;
  height: 28px;
  border-radius: 2px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

.preset-color:hover {
  box-shadow: 0 0 8px var(--glow);
  border-color: var(--primary);
}

/* 复选框 */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-label span {
  font-size: 12px;
  color: var(--text);
}

/* 垂直按钮组 */
.action-buttons-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
}

.btn-uniform {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0 16px;
  background: transparent;
}

.btn-uniform.btn-primary {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-uniform.btn-primary:hover {
  background: var(--primary-ghost);
  box-shadow: 0 0 10px var(--glow);
}

.btn-uniform.btn-success {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-uniform.btn-success:hover {
  background: var(--cyan-dim);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.btn-uniform.btn-secondary {
  border-color: var(--border);
  color: var(--text-dim);
}

.btn-uniform.btn-secondary:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.btn-uniform:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.preview-item h4 {
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--text-dim);
}

.preview-item img {
  max-width: 100%;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.processed-bg {
  background:
    linear-gradient(45deg, var(--bg-hover) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg-hover) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg-hover) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg-hover) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: var(--bg-panel);
  border-radius: 2px;
  padding: 10px;
  border: 1px solid var(--border);
}

#resultCanvas {
  max-width: 100%;
  display: block;
}

.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.action-buttons .btn {
  flex: 1;
}

.btn-secondary {
  border-color: var(--border) !important;
  color: var(--text-dim) !important;
  background: transparent !important;
}

.btn-secondary:hover {
  border-color: var(--text-dim) !important;
  color: var(--text) !important;
}

/* ══════════════════════════════════════
   文档中心
   ══════════════════════════════════════ */
.docs-container {
  display: flex;
  height: 100%;
  gap: 0;
}

.docs-sidebar {
  width: 260px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

.docs-sidebar-title {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  padding: 18px 20px;
  font-size: 13px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  margin: 0;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
}

.docs-list {
  padding: 10px;
}

.docs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 3px;
  border-left: 2px solid transparent;
}

.docs-item:hover {
  background: var(--bg-hover);
  border-left-color: var(--primary);
}

.docs-item.active {
  background: var(--primary-ghost);
  border-left-color: var(--primary);
}

.docs-item-icon {
  font-size: 16px;
  opacity: 0.6;
}

.docs-item-name {
  font-size: 12px;
  color: var(--text);
  flex: 1;
  word-break: break-all;
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
}

.docs-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-deep);
}

.docs-welcome {
  text-align: center;
  padding: 100px 20px;
}

.docs-welcome h2 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 22px;
  margin-bottom: 10px;
  color: var(--text-bright);
  letter-spacing: 2px;
}

.docs-welcome p {
  font-size: 13px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

.docs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.docs-header h2 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 18px;
  color: var(--text-bright);
  margin: 0;
  letter-spacing: 1px;
}

.btn-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.btn-icon:hover {
  border-color: var(--primary);
  box-shadow: 0 0 6px var(--glow);
}

.docs-body {
  padding: 32px;
}

.docs-error {
  text-align: center;
  padding: 100px 20px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

.loading {
  text-align: center;
  padding: 100px 20px;
  color: var(--text-dim);
  font-size: 13px;
  font-family: 'DM Mono', monospace;
}

/* Markdown 内容 */
.markdown-body {
  color: var(--text);
  line-height: 1.8;
  font-size: 14px;
  font-family: 'Noto Sans SC', 'DM Mono', sans-serif;
}

.markdown-body h1 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 28px;
  margin: 30px 0 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
  color: var(--primary);
  letter-spacing: 1px;
}

.markdown-body h2 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 22px;
  margin: 28px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-bright);
  letter-spacing: 0.5px;
}

.markdown-body h3 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 18px;
  margin: 24px 0 14px;
  color: var(--accent);
}

.markdown-body h4 {
  font-size: 16px;
  margin: 20px 0 12px;
  color: var(--text-bright);
}

.markdown-body p {
  margin: 12px 0;
  color: var(--text);
}

.markdown-body ul,
.markdown-body ol {
  margin: 12px 0;
  padding-left: 28px;
}

.markdown-body li {
  margin: 6px 0;
  color: var(--text);
}

.markdown-body code {
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 2px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--primary);
  border: 1px solid var(--border);
}

.markdown-body pre {
  background: var(--bg-panel);
  padding: 16px;
  border-radius: 2px;
  overflow-x: auto;
  border: 1px solid var(--border);
  margin: 16px 0;
  position: relative;
}

.markdown-body pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--primary);
  opacity: 0.4;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: var(--text);
  border: none;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.markdown-body th {
  background: var(--bg-surface);
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.markdown-body td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
}

.markdown-body tr:last-child td {
  border-bottom: none;
}

.markdown-body tr:hover {
  background: var(--bg-hover);
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 16px 0;
  background: var(--bg-panel);
  color: var(--text-dim);
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 30px 0;
}

.markdown-body a {
  color: var(--cyan);
  text-decoration: none;
  transition: color 0.15s ease;
  border-bottom: 1px solid transparent;
}

.markdown-body a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.markdown-body strong {
  color: var(--accent);
  font-weight: 600;
}

/* ══════════════════════════════════════
   亮色模式微调
   ══════════════════════════════════════ */
[data-theme="light"] .logo h1 {
  text-shadow: none;
}

[data-theme="light"] .sidebar::before {
  opacity: 0.3;
}

[data-theme="light"] .tool-card,
[data-theme="light"] .result-card {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* ══════════════════════════════════════
   价格计算器增强
   ══════════════════════════════════════ */
.form-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-bright);
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  transition: border-color 0.2s;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--glow);
}

.scheme-info {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
  font-style: normal;
  font-family: 'DM Mono', monospace;
  opacity: 0.7;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.result-section {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.result-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.result-section h4 {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.result-total {
  font-weight: 600;
  font-size: 13px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.result-total .result-label,
.result-total .result-value {
  font-size: 13px;
}

.result-highlight {
  background: var(--primary-ghost);
  padding: 8px;
  border-radius: 2px;
  margin: 4px 0;
  border: 1px solid rgba(57, 255, 20, 0.15);
}

.result-highlight .result-label,
.result-highlight .result-value {
  font-size: 13px;
  font-weight: 600;
}

.result-value.profit {
  color: var(--primary);
  font-weight: 600;
}

.result-note {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.5;
  font-family: 'DM Mono', monospace;
}

.result-footer {
  text-align: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.5px;
}

/* ══════════════════════════════════════
   定价方案管理
   ══════════════════════════════════════ */
.schemes-container {
  max-width: 1200px;
  margin: 0 auto;
}

.schemes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.schemes-header h3 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 15px;
  color: var(--text-bright);
  margin: 0;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.schemes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.scheme-card {
  background: var(--bg-panel);
  border-radius: 2px;
  padding: 16px;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
  position: relative;
}

.scheme-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--border);
  transition: background 0.2s;
}

.scheme-card:hover {
  border-color: var(--primary-dim);
}

.scheme-card:hover::before {
  background: var(--primary);
}

.scheme-card.default {
  border-color: var(--accent-dim);
}

.scheme-card.default::before {
  background: var(--accent);
}

.scheme-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.scheme-card-header h4 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 13px;
  color: var(--text-bright);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  padding: 2px 6px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 2px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.scheme-actions {
  display: flex;
  gap: 4px;
}

.scheme-actions .btn-icon {
  font-size: 13px;
  padding: 4px 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
}

.scheme-actions .btn-icon:hover {
  background: var(--bg-hover);
}

.scheme-description {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.5;
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
}

.scheme-details {
  font-size: 11px;
}

.scheme-detail-row {
  display: flex;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}

.scheme-detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--text-dim);
  min-width: 55px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
}

.detail-value {
  color: var(--text);
  flex: 1;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
}

/* ══════════════════════════════════════
   模态框
   ══════════════════════════════════════ */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-panel);
  border-radius: 2px;
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  position: relative;
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.4;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 14px;
  color: var(--text-bright);
  margin: 0;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  font-size: 18px;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  transition: all 0.15s;
  font-family: system-ui;
}

.modal-close:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.modal form {
  padding: 20px;
}

.modal textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-bright);
  font-size: 12px;
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  resize: vertical;
  transition: border-color 0.2s;
}

.modal textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--glow);
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-primary {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 8px 16px;
  font-size: 11px;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  width: auto;
  margin: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--primary-ghost);
  box-shadow: 0 0 10px var(--glow);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  font-size: 11px;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.5px;
  width: auto;
  margin: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

/* ══════════════════════════════════════
   通知系统
   ══════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 260px;
  max-width: 380px;
  padding: 12px 16px;
  background: var(--bg-panel);
  border-radius: 2px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: auto;
  border-left: 3px solid;
  font-family: 'DM Mono', monospace;
}

.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
}

.toast-success {
  border-left-color: var(--success);
}

.toast-success .toast-icon {
  background: var(--primary-ghost);
  color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error .toast-icon {
  background: rgba(255, 68, 68, 0.1);
  color: var(--danger);
}

.toast-warning {
  border-left-color: var(--accent);
}

.toast-warning .toast-icon {
  background: var(--glow-accent);
  color: var(--accent);
}

.toast-info {
  border-left-color: var(--cyan);
}

.toast-info .toast-icon {
  background: var(--cyan-dim);
  color: var(--cyan);
}

[data-theme="light"] .toast {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ══════════════════════════════════════
   打印
   ══════════════════════════════════════ */
@media print {
  .docs-sidebar,
  .docs-header button,
  .sidebar,
  .content-header {
    display: none !important;
  }
  .docs-content {
    background: white;
  }
  .markdown-body {
    color: black;
  }
  body::after {
    display: none;
  }
}

/* ══════════════════════════════════════
   动画
   ══════════════════════════════════════ */
@keyframes terminalFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ══════════════════════════════════════
   滚动条
   ══════════════════════════════════════ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* ══════════════════════════════════════
   图片工作台
   ══════════════════════════════════════ */
.image-workbench {
  display: flex;
  gap: 14px;
  height: calc(100vh - 180px);
  min-height: 500px;
}

.workbench-left {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.workbench-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-radius: 2px;
  border: 1px solid var(--border);
  overflow: visible;
  min-width: 0;
}

.workbench-right {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

/* 面板通用 */
.image-workbench .panel {
  background: var(--bg-panel);
  border-radius: 2px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.image-workbench .panel-header {
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.image-workbench .panel-title {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.image-workbench .panel-content {
  padding: 12px;
}

.image-workbench .upload-area {
  border: 1px dashed var(--border);
  border-radius: 2px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.image-workbench .upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-ghost);
}

.image-workbench .upload-placeholder {
  cursor: pointer;
}

.image-workbench .upload-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.image-workbench .upload-text {
  font-size: 12px;
  color: var(--text);
}

.image-workbench .upload-hint {
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

.image-workbench .upload-preview {
  position: relative;
  width: 100%;
}

.image-workbench .upload-preview img {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 2px;
}

.image-workbench .btn-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 2px;
  background: rgba(255, 68, 68, 0.9);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.image-workbench .btn-remove:hover {
  background: #dc2626;
}

.image-workbench .panel-materials {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.image-workbench .panel-materials .panel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.image-workbench .search-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.image-workbench .search-bar input {
  flex: 1;
  padding: 6px 10px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
}

.image-workbench .search-bar input:focus {
  outline: none;
  border-color: var(--primary);
}

.image-workbench .btn-search,
.image-workbench .btn-refresh {
  padding: 6px 10px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.image-workbench .btn-refresh {
  border-color: var(--border);
  color: var(--text-dim);
  padding: 4px 8px;
}

.image-workbench .btn-search:hover,
.image-workbench .btn-refresh:hover {
  background: var(--primary-ghost);
}

.image-workbench .material-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.image-workbench .material-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.image-workbench .material-item:hover {
  border-color: var(--primary);
}

.image-workbench .material-item img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.image-workbench .material-info {
  flex: 1;
  min-width: 0;
}

.image-workbench .material-name {
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.image-workbench .material-code {
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

.image-workbench .loading-placeholder,
.image-workbench .empty-placeholder {
  text-align: center;
  padding: 28px 10px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: 'DM Mono', monospace;
}

.image-workbench .pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  margin-top: auto;
}

.image-workbench .pagination button {
  padding: 4px 10px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.image-workbench .pagination button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.image-workbench .pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.image-workbench .pagination span {
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
}

/* 画布区域 */
.image-workbench .canvas-header {
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.image-workbench .canvas-title {
  font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.image-workbench .canvas-actions {
  display: flex;
  gap: 6px;
}

.image-workbench .canvas-actions .btn-icon {
  width: 30px;
  height: 30px;
  border-radius: 2px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}

.image-workbench .canvas-actions .btn-icon:hover {
  border-color: var(--primary);
  box-shadow: 0 0 6px var(--glow);
}

.image-workbench .canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  min-height: 0;
  background:
    linear-gradient(45deg, #1a1d21 25%, transparent 25%),
    linear-gradient(-45deg, #1a1d21 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1d21 75%),
    linear-gradient(-45deg, transparent 75%, #1a1d21 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: #15181c;
  padding: 20px;
  min-height: 600px;
}

[data-theme="light"] .image-workbench .canvas-wrapper {
  background:
    linear-gradient(45deg, #d8d0c4 25%, transparent 25%),
    linear-gradient(-45deg, #d8d0c4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8d0c4 75%),
    linear-gradient(-45deg, transparent 75%, #d8d0c4 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: #e4dcd0;
}

.image-workbench .canvas-container {
  display: inline-block;
  background: transparent;
}

.image-workbench .canvas-container canvas {
  display: block;
  background: transparent !important;
}

.image-workbench .canvas-container .canvas-container {
  background: transparent !important;
}

.image-workbench .canvas-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: center;
  background: var(--bg-panel);
  flex-shrink: 0;
  min-height: 46px;
}

.image-workbench .canvas-footer .btn {
  padding: 8px 20px;
  font-size: 11px;
  width: auto;
  margin: 0;
}

/* 属性设置 */
.image-workbench .property-group {
  margin-bottom: 12px;
}

.image-workbench .property-group:last-child {
  margin-bottom: 0;
}

.image-workbench .property-group label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.image-workbench .input-row {
  display: flex;
  gap: 6px;
}

.image-workbench .input-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0 8px;
}

.image-workbench .input-item.full {
  flex: 1;
}

.image-workbench .input-item span {
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
  font-family: 'DM Mono', monospace;
}

.image-workbench .input-item input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-bright);
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  padding: 6px 0;
  width: 100%;
}

.image-workbench .input-item input:focus {
  outline: none;
}

.image-workbench .align-buttons {
  display: flex;
  gap: 4px;
}

.image-workbench .align-buttons button {
  flex: 1;
  padding: 7px;
  font-size: 13px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
}

.image-workbench .align-buttons button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.image-workbench .btn-danger {
  background: transparent !important;
  border: 1px solid var(--danger) !important;
  color: var(--danger) !important;
}

.image-workbench .btn-danger:hover {
  background: rgba(255, 68, 68, 0.1) !important;
}

.image-workbench .full-width {
  width: 100%;
}

.image-workbench .added-materials {
  max-height: 200px;
  overflow-y: auto;
}

.image-workbench .added-material-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.image-workbench .added-material-item:hover {
  border-color: var(--primary);
}

.image-workbench .added-material-item.active {
  border-color: var(--primary);
  background: var(--primary-ghost);
}

.image-workbench .added-material-item img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border-radius: 2px;
}

.image-workbench .added-material-item .material-name {
  flex: 1;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-workbench .btn-remove-small {
  width: 18px;
  height: 18px;
  border-radius: 2px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.image-workbench .btn-remove-small:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.image-workbench .empty-hint {
  text-align: center;
  padding: 18px 10px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: 'DM Mono', monospace;
}

/* 侧边栏折叠 */
.sidebar.collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
  border: none;
}

.container.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.container.sidebar-collapsed .content {
  margin-left: 0;
}

/* 全屏模式 */
.image-workbench:fullscreen {
  background: var(--bg-deep);
  padding: 20px;
  height: 100vh;
}

.image-workbench:-webkit-full-screen {
  background: var(--bg-deep);
  padding: 20px;
  height: 100vh;
}

/* ══════════════════════════════════════
   选择框统一样式
   ══════════════════════════════════════ */
select {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-bright);
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ══════════════════════════════════════
   视频工作台 — 对话式布局
   ══════════════════════════════════════ */
.vgen-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 130px);
  max-width: 860px;
  margin: 0 auto;
  position: relative;
}

/* 对话消息区 */
.vgen-chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 消息通用 */
.vgen-msg {
  animation: terminalFadeIn 0.3s ease;
}

/* 用户消息 */
.vgen-msg-user {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 16px 20px;
  position: relative;
}

.vgen-msg-user::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
  opacity: 0.6;
}

.vgen-msg-prompt {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 12px;
  font-family: 'Noto Sans SC', 'DM Mono', sans-serif;
}

.vgen-msg-params {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.vgen-param-tag {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.vgen-param-tag-accent {
  border-color: var(--cyan);
  color: var(--cyan);
}

.vgen-param-tag-model {
  border-color: var(--accent-dim);
  color: var(--accent);
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* AI 回复消息 */
.vgen-msg-assistant {
  padding: 0 0 0 16px;
  border-left: 1px solid var(--primary);
  position: relative;
}

.vgen-msg-assistant::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 0;
  width: 1px;
  height: 100%;
  box-shadow: 0 0 8px var(--glow);
}

/* 视频结果 */
.vgen-result-video {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vgen-video-player {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-width: 520px;
  position: relative;
}

.vgen-video-player video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vgen-video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-surface);
}

.vgen-video-ph-icon {
  width: 48px;
  height: 48px;
  border: 1px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--primary);
  box-shadow: 0 0 16px var(--glow);
  padding-left: 3px;
}

.vgen-video-ph-text {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
}

.vgen-video-ph-meta {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.5;
}

/* 结果操作按钮 */
.vgen-result-actions {
  display: flex;
  gap: 8px;
}

.vgen-action-btn {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 11px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}

.vgen-action-btn:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.vgen-action-btn-primary {
  border-color: var(--primary);
  color: var(--primary);
}

.vgen-action-btn-primary:hover {
  background: var(--primary-ghost);
  box-shadow: 0 0 8px var(--glow);
}

/* 加载状态 */
.vgen-result-loading {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 520px;
}

.vgen-loading-bar {
  height: 3px;
  background: var(--bg-hover);
  border-radius: 1px;
  overflow: hidden;
}

.vgen-loading-bar-inner {
  height: 100%;
  width: 40%;
  background: var(--primary);
  border-radius: 1px;
  animation: vgenLoadingSlide 1.8s ease-in-out infinite;
  box-shadow: 0 0 8px var(--glow);
}

@keyframes vgenLoadingSlide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(200%); }
  100% { transform: translateX(-100%); }
}

.vgen-loading-text {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}

/* ── 底部输入区 ── */
.vgen-input-area {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
}

.vgen-input-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), transparent 60%);
  opacity: 0.25;
}

/* 上排：附件 + 输入框 + 模板 */
.vgen-input-row-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.vgen-input-attachments {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.vgen-attach-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.vgen-attach-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.vgen-attach-icon {
  font-size: 14px;
  opacity: 0.5;
}

.vgen-attach-sep {
  color: var(--text-dim);
  opacity: 0.3;
  font-size: 12px;
}

.vgen-input-field-wrap {
  flex: 1;
  min-width: 0;
}

.vgen-input-field {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 8px 12px;
  color: var(--text-bright);
  font-family: 'Noto Sans SC', 'DM Mono', sans-serif;
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  overflow: hidden;
  min-height: 36px;
  max-height: 120px;
  transition: border-color 0.2s;
}

.vgen-input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--glow);
}

.vgen-input-field::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

.vgen-template-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.vgen-template-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* 下排：参数 + 发送 */
.vgen-input-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vgen-params {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.vgen-param-select select {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 4px 8px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
}

.vgen-param-select select:focus {
  outline: none;
  border-color: var(--primary);
}

.vgen-param-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}

.vgen-param-toggle input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: var(--primary);
  cursor: pointer;
}

.vgen-toggle-label {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 11px;
  color: var(--text-dim);
}

.vgen-submit-area {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.vgen-cost-hint {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.5;
  white-space: nowrap;
}

.vgen-submit-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding-left: 2px;
}

.vgen-submit-btn:hover {
  background: var(--primary-ghost);
  box-shadow: 0 0 14px var(--glow);
}

.vgen-submit-icon {
  display: block;
  line-height: 1;
}

.vgen-submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 空状态 */
.vgen-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  opacity: 0.4;
  user-select: none;
}

.vgen-empty-icon {
  font-size: 48px;
  color: var(--primary);
  text-shadow: 0 0 20px var(--glow);
}

.vgen-empty-title {
  font-family: 'Orbitron', 'DM Mono', monospace;
  font-size: 16px;
  color: var(--primary);
  letter-spacing: 2px;
}

.vgen-empty-desc {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 12px;
  color: var(--text-dim);
}

/* 含图片标签 */
.vgen-msg-image-tag {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--accent-amber);
  margin-bottom: 4px;
  opacity: 0.8;
}

/* 任务 ID */
.vgen-task-id {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.4;
  margin-top: 6px;
  word-break: break-all;
}

/* 错误状态 */
.vgen-result-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
}

.vgen-error-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #ff4444;
  color: #ff4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
}

.vgen-error-text {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 12px;
  color: #ff6666;
  text-align: center;
  max-width: 400px;
  word-break: break-word;
}

/* 真实视频播放器 */
.vgen-video-el {
  width: 100%;
  max-height: 400px;
  border-radius: 4px;
  background: #000;
}

/* 首尾帧预览插槽 */
.vgen-frame-slot {
  width: 56px;
  height: 56px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.vgen-frame-slot:hover {
  border-color: var(--primary);
}

.vgen-frame-slot-active {
  border-style: solid;
  border-color: var(--primary);
}

.vgen-frame-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.vgen-frame-ph-icon {
  font-size: 16px;
  color: var(--text-dim);
  opacity: 0.5;
}

.vgen-frame-ph-label {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 9px;
  color: var(--text-dim);
  opacity: 0.6;
}

.vgen-frame-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vgen-frame-remove {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: #fff;
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.vgen-frame-slot:hover .vgen-frame-remove {
  opacity: 1;
}

/* 提示词五要素引导 */
.vgen-empty-tips {
  margin-top: 20px;
  text-align: center;
}

.vgen-tip-title {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.vgen-tip-items {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.vgen-tip-tag {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--primary);
  background: var(--primary-ghost);
}

.vgen-tip-sep {
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.4;
}

/* 模板面板 */
.vgen-template-panel {
  position: absolute;
  bottom: 130px;
  left: 16px;
  right: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 300px;
  overflow: hidden;
  z-index: 10;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.vgen-template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.vgen-template-panel-title {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 12px;
  color: var(--primary);
  letter-spacing: 1px;
}

.vgen-template-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
}

.vgen-template-close:hover {
  color: var(--text-base);
}

.vgen-template-list {
  padding: 6px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.vgen-template-item {
  padding: 10px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.vgen-template-item:hover {
  background: var(--primary-ghost);
  border-color: var(--border);
}

.vgen-template-name {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 12px;
  color: var(--primary);
  margin-bottom: 4px;
}

.vgen-template-preview {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  opacity: 0.7;
}

/* ========== 视频生成日志 ========== */

.vlog-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

.vlog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.vlog-title {
  font-family: 'Orbitron', 'DM Mono', monospace;
  font-size: 18px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
  text-shadow: 0 0 6px var(--glow);
}

.vlog-refresh-btn {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  padding: 6px 14px;
  cursor: pointer;
  transition: all .2s;
}
.vlog-refresh-btn:hover {
  background: var(--primary);
  color: var(--bg-deep);
  box-shadow: 0 0 8px var(--glow);
}

.vlog-loading,
.vlog-empty,
.vlog-error {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 60px 0;
}
.vlog-error { color: var(--accent2, #ff6b6b); }

.vlog-table-wrap {
  overflow-x: auto;
}

.vlog-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 12px;
}

.vlog-table thead th {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
  user-select: none;
}

.vlog-row {
  cursor: pointer;
  transition: background .15s;
  border-bottom: 1px solid rgba(0,255,65,0.04);
}
.vlog-row:hover {
  background: rgba(0,255,65,0.04);
}

.vlog-cell {
  padding: 12px 8px;
  vertical-align: middle;
  color: var(--text-dim);
}
.vlog-cell-id {
  width: 50px;
  color: var(--primary);
  opacity: 0.5;
}
.vlog-cell-prompt {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vlog-cell-model {
  white-space: nowrap;
  color: var(--accent1, var(--primary));
}
.vlog-cell-params {
  white-space: nowrap;
  opacity: 0.6;
}
.vlog-cell-time {
  white-space: nowrap;
  opacity: 0.5;
  font-size: 11px;
}
.vlog-cell-actions {
  white-space: nowrap;
}

.vlog-status {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 2px;
}
.vlog-status-queued {
  color: var(--accent1, #e6c866);
  background: rgba(230,200,102,0.1);
  border: 1px solid rgba(230,200,102,0.2);
}
.vlog-status-running {
  color: var(--primary);
  background: rgba(0,255,65,0.08);
  border: 1px solid rgba(0,255,65,0.15);
  animation: vlog-pulse 1.5s infinite;
}
.vlog-status-succeeded {
  color: #00ff41;
  background: rgba(0,255,65,0.1);
  border: 1px solid rgba(0,255,65,0.2);
}
.vlog-status-failed {
  color: #ff6b6b;
  background: rgba(255,107,107,0.1);
  border: 1px solid rgba(255,107,107,0.2);
}

@keyframes vlog-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.vlog-act-btn {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  margin-left: 4px;
  transition: all .2s;
}
.vlog-act-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 6px var(--glow);
}
.vlog-act-del:hover {
  color: #ff6b6b;
  border-color: #ff6b6b;
  box-shadow: 0 0 6px rgba(255,107,107,0.3);
}

/* 详情弹窗 */
.vlog-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.vlog-modal {
  background: var(--bg-deep, #0a0a0c);
  border: 1px solid var(--border);
  max-width: 680px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(0,255,65,0.06);
}

.vlog-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.vlog-modal-title {
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.vlog-modal-close {
  font-size: 14px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  transition: color .2s;
}
.vlog-modal-close:hover {
  color: var(--primary);
}

.vlog-modal-body {
  padding: 20px;
}

.vlog-detail-section {
  margin-bottom: 18px;
}
.vlog-detail-label {
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  opacity: 0.5;
  margin-bottom: 6px;
}
.vlog-detail-value {
  font-family: 'DM Mono', 'Noto Sans SC', monospace;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}
.vlog-detail-prompt {
  background: rgba(0,255,65,0.03);
  border: 1px solid rgba(0,255,65,0.06);
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 150px;
  overflow-y: auto;
}
.vlog-detail-mono {
  font-size: 11px;
  opacity: 0.4;
  word-break: break-all;
}
.vlog-detail-error {
  color: #ff6b6b;
  background: rgba(255,107,107,0.05);
  border: 1px solid rgba(255,107,107,0.1);
  padding: 10px;
  font-size: 12px;
}
.vlog-detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.vlog-detail-img {
  max-width: 200px;
  max-height: 140px;
  border: 1px solid var(--border);
  object-fit: contain;
}
.vlog-detail-video {
  width: 100%;
  max-height: 360px;
  background: #000;
  border: 1px solid var(--border);
}
.vlog-detail-actions {
  margin-top: 12px;
  text-align: center;
}
.vlog-detail-dl-btn {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--bg-deep, #0a0a0c);
  background: var(--primary);
  border: none;
  padding: 10px 32px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all .2s;
}
.vlog-detail-dl-btn:hover {
  box-shadow: 0 0 14px var(--glow);
  transform: translateY(-1px);
}
