/* ============================================================
   视频转文字 · 现代设计系统
   重构版本 - 2026 UI/UX 最佳实践
   ============================================================ */

@font-face {
  font-family: "AppFont";
  src: url("/static/font.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   重置与基础
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-feature-settings: "tnum" 1, "case" 1;
}

ul, ol { list-style: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; }

/* ============================================================
   设计令牌 (Design Tokens)
   ============================================================ */
:root,
[data-theme="light"] {
  /* 背景层次 */
  --bg-base:       #fafaf9;
  --bg-elevated:   #ffffff;
  --bg-subtle:     #f5f5f4;
  --bg-muted:      #e7e5e4;

  /* 文本颜色 */
  --text-primary:   #1c1917;
  --text-secondary: #57534e;
  --text-tertiary:  #78716c;
  --text-disabled:  #a8a29e;
  --text-inverse:   #ffffff;

  /* 边框 */
  --border-subtle:  #e7e5e4;
  --border-default: #d6d3d1;
  --border-strong:  #a8a29e;

  /* 主色调 */
  --accent-50:      #fef8f5;
  --accent-100:     #fde8dc;
  --accent-500:     #d97548;
  --accent-600:     #c4602e;
  --accent-700:     #a84a1e;
  --accent-900:     #7a2e0a;

  /* 语义色 */
  --success-50:     #f0fdf4;
  --success-500:    #22c55e;
  --success-600:    #16a34a;
  --success-700:    #15803d;

  --warning-50:     #fefce8;
  --warning-500:    #eab308;
  --warning-600:    #ca8a04;

  --error-50:       #fef2f2;
  --error-500:      #ef4444;
  --error-600:      #dc2626;
  --error-700:      #b91c1c;

  --info-50:        #eff6ff;
  --info-500:       #3b82f6;
  --info-600:       #2563eb;

  /* 阴影 */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl:  0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);

  /* 特殊效果 */
  --overlay: rgba(0, 0, 0, 0.5);
  --focus-ring: 0 0 0 3px var(--accent-100);
  --focus-ring-error: 0 0 0 3px var(--error-50);
}

[data-theme="dark"] {
  --bg-base:       #0a0a0a;
  --bg-elevated:   #171717;
  --bg-subtle:     #262626;
  --bg-muted:      #404040;

  --text-primary:   #fafaf9;
  --text-secondary: #d6d3d1;
  --text-tertiary:  #a8a29e;
  --text-disabled:  #78716c;
  --text-inverse:   #0a0a0a;

  --border-subtle:  #262626;
  --border-default: #404040;
  --border-strong:  #525252;

  --accent-500:     #ea8c5d;
  --accent-600:     #f59e6f;
  --accent-700:     #ea8c5d;

  --success-500:    #4ade80;
  --success-600:    #22c55e;

  --error-500:      #f87171;
  --error-600:      #ef4444;

  --shadow-sm:  0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 12px 20px rgba(0, 0, 0, 0.6);
  --shadow-xl:  0 24px 32px rgba(0, 0, 0, 0.7);

  --overlay: rgba(0, 0, 0, 0.75);
  --focus-ring: 0 0 0 3px rgba(234, 140, 93, 0.3);
}

/* 间距 */
:root {
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   20px;
  --space-6:   24px;
  --space-8:   32px;
  --space-10:  40px;
  --space-12:  48px;
  --space-16:  64px;
  --space-20:  80px;

  /* 圆角 */
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  20px;
  --radius-full: 9999px;

  /* 动画 */
  --ease-in:     cubic-bezier(0.4, 0, 1, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast:   150ms;
  --duration-base:   200ms;
  --duration-medium: 300ms;
  --duration-slow:   400ms;

  /* 字体 */
  --font-sans: "AppFont", "PingFang SC", "Microsoft YaHei",
               -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono",
               Consolas, "Courier New", monospace;

  /* 字号 */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;

  /* 行高 */
  --leading-tight:  1.25;
  --leading-snug:   1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
}

/* ============================================================
   全局样式
   ============================================================ */
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  transition: background var(--duration-base), color var(--duration-base);
}

/* 焦点样式 */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* 选择样式 */
::selection {
  background: var(--accent-100);
  color: var(--accent-900);
}

[data-theme="dark"] ::selection {
  background: var(--accent-900);
  color: var(--accent-50);
}

/* ============================================================
   顶部导航栏
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) clamp(var(--space-5), 4vw, var(--space-12));
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-xs);
}

.nav-left,
.nav-center,
.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  transition: opacity var(--duration-fast);
}

.nav-brand:hover {
  opacity: 0.8;
}

.nav-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.nav-title {
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
}

.nav-center-label {
  color: var(--text-tertiary);
  font-weight: 500;
}

.nav-center-name {
  color: var(--accent-600);
  font-weight: 600;
}

@media (max-width: 640px) {
  .nav-center {
    position: static;
    transform: none;
    display: none;
  }
}

/* 主题切换按钮 */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}

.theme-toggle:hover {
  background: var(--bg-muted);
  border-color: var(--border-strong);
  color: var(--accent-600);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle .ico-moon { display: none; }
[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
[data-theme="dark"] .theme-toggle .ico-moon { display: block; }

/* ============================================================
   底部导航栏
   ============================================================ */
.bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) clamp(var(--space-5), 4vw, var(--space-12));
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}

.bottombar-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--duration-fast);
}

.bottombar-toggle:hover {
  background: var(--bg-muted);
  border-color: var(--accent-500);
  color: var(--accent-600);
}

.bottombar-toggle .ico-expand { display: none; }
.layout.collapsed .bottombar-toggle .ico-collapse { display: none; }
.layout.collapsed .bottombar-toggle .ico-expand { display: block; }

.bottombar-info {
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ============================================================
   主布局
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--space-8);
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-8) clamp(var(--space-5), 4vw, var(--space-12)) var(--space-20);
  align-items: start;
  transition: grid-template-columns var(--duration-medium) var(--ease-out);
}

.layout.collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

@media (max-width: 1024px) {
  .layout,
  .layout.collapsed {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
}

.sidebar-label {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: 0 var(--space-3) var(--space-3);
  transition: opacity var(--duration-fast);
}

.layout.collapsed .sidebar-label {
  opacity: 0;
  height: 0;
  padding: 0;
  overflow: hidden;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.side-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  border: 1px solid transparent;
  background: transparent;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.side-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent-500);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: height var(--duration-fast) var(--ease-spring);
}

.side-item:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.side-item.active {
  background: var(--accent-50);
  border-color: var(--accent-500);
  color: var(--accent-700);
}

.side-item.active::before {
  height: 60%;
}

[data-theme="dark"] .side-item.active {
  background: rgba(234, 140, 93, 0.15);
  border-color: var(--accent-600);
  color: var(--accent-500);
}

.layout.collapsed .side-item {
  justify-content: center;
  padding: var(--space-3) var(--space-2);
}

.layout.collapsed .side-text {
  display: none;
}

.side-ico {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: all var(--duration-fast);
}

.side-item:hover .side-ico {
  background: var(--bg-muted);
  color: var(--accent-600);
  transform: scale(1.05);
}

.side-item.active .side-ico {
  background: var(--accent-100);
  color: var(--accent-600);
}

[data-theme="dark"] .side-item.active .side-ico {
  background: rgba(234, 140, 93, 0.2);
}

.side-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.side-title {
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  line-height: var(--leading-tight);
}

.side-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  line-height: var(--leading-tight);
}

/* ============================================================
   主内容区
   ============================================================ */
.main-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

.section {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-base);
}

.section:hover {
  box-shadow: var(--shadow-md);
}

/* ============================================================
   模式切换标签
   ============================================================ */
.mode-tabs {
  display: inline-flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--duration-fast);
  white-space: nowrap;
}

.mode-tab:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .mode-tab:hover {
  background: rgba(255, 255, 255, 0.05);
}

.mode-tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.mode-tab svg {
  color: var(--accent-600);
  flex-shrink: 0;
}

/* ============================================================
   拖拽上传区
   ============================================================ */
.dropzone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-50), transparent);
  opacity: 0;
  transition: opacity var(--duration-base);
}

.dropzone:hover,
.dropzone.drag {
  border-color: var(--accent-500);
  background: var(--accent-50);
  transform: scale(1.01);
}

.dropzone:hover::before,
.dropzone.drag::before {
  opacity: 1;
}

.drop-ico {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 2px solid var(--border-default);
  color: var(--accent-600);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-base) var(--ease-spring);
}

.dropzone:hover .drop-ico {
  transform: translateY(-4px) scale(1.05);
  border-color: var(--accent-500);
  box-shadow: var(--shadow-md);
}

.drop-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.drop-hint {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
}

.drop-hint .link {
  color: var(--accent-600);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.drop-formats {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* 文件信息行 */
.file-row {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  animation: slideIn var(--duration-medium) var(--ease-spring);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--text-primary);
}

.file-size {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

/* ============================================================
   URL 输入
   ============================================================ */
.url-input-wrap {
  display: flex;
  gap: var(--space-3);
  align-items: stretch;
}

#urlInput {
  flex: 1;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  outline: none;
  transition: all var(--duration-fast);
}

#urlInput:hover {
  border-color: var(--border-strong);
}

#urlInput:focus {
  border-color: var(--accent-500);
  box-shadow: var(--focus-ring);
}

#urlInput::placeholder {
  color: var(--text-tertiary);
  font-family: var(--font-sans);
}

.url-hint {
  margin-top: var(--space-3);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  letter-spacing: 0.01em;
}

/* ============================================================
   操作区与进度
   ============================================================ */
.action-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-500), var(--accent-600));
  width: 0%;
  transition: width var(--duration-medium) var(--ease-out);
  border-radius: var(--radius-full);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-pct {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  min-width: 48px;
  text-align: right;
  tabular-nums;
}

/* 阶段标签 */
.stages {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-sm);
  flex-wrap: wrap;
}

.stage {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-tertiary);
  font-weight: 500;
  transition: all var(--duration-base);
}

.stage.active {
  color: var(--accent-700);
  border-color: var(--accent-500);
  background: var(--accent-50);
  animation: pulse 2s infinite;
}

[data-theme="dark"] .stage.active {
  background: rgba(234, 140, 93, 0.15);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.stage.done {
  color: var(--success-600);
  border-color: var(--success-500);
  background: var(--success-50);
}

.stage.error {
  color: var(--error-600);
  border-color: var(--error-500);
  background: var(--error-50);
}

/* ============================================================
   按钮系统
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
  color: var(--text-inverse);
  border: none;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: all var(--duration-fast);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.2));
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary:disabled:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--duration-fast);
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  border-color: var(--accent-500);
  color: var(--accent-600);
  transform: translateY(-1px);
}

.btn-ghost:active {
  transform: translateY(0);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

/* ============================================================
   结果显示区
   ============================================================ */
.card-result {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.result-title {
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-primary);
}

.result-stats {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.result-stats b {
  color: var(--text-primary);
  font-weight: 600;
}

.result-stats .ok {
  color: var(--success-600);
}

#resultText {
  width: 100%;
  min-height: 300px;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  resize: vertical;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  outline: none;
  text-align: right;
  unicode-bidi: plaintext;
  transition: all var(--duration-fast);
}

#resultText:hover {
  border-color: var(--border-strong);
}

#resultText:focus {
  border-color: var(--accent-500);
  box-shadow: var(--focus-ring);
}

.result-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.raw-block {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-4);
}

.raw-block summary {
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  padding: var(--space-2) 0;
  user-select: none;
  font-weight: 500;
  transition: color var(--duration-fast);
}

.raw-block summary:hover {
  color: var(--text-primary);
}

.raw-block pre {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  max-height: 240px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: var(--leading-relaxed);
}

/* 日志 */
.logs {
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  max-height: 160px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
}

.logs li {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-1) 0;
}

.logs li .ts {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.logs li.ok { color: var(--success-600); }
.logs li.err { color: var(--error-600); }
.logs li.info { color: var(--text-primary); }

/* ============================================================
   翻译页面
   ============================================================ */
.translate-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.translate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

@media (max-width: 768px) {
  .translate-grid {
    grid-template-columns: 1fr;
  }
}

.translate-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.translate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.translate-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.translate-stats {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-weight: 500;
}

.translate-stats .ok {
  color: var(--success-600);
}

.translate-col textarea {
  width: 100%;
  min-height: 380px;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  resize: vertical;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  outline: none;
  transition: all var(--duration-fast);
  unicode-bidi: plaintext;
}

.translate-col textarea:hover {
  border-color: var(--border-strong);
}

.translate-col textarea:focus {
  border-color: var(--accent-500);
  box-shadow: var(--focus-ring);
}

.translate-col textarea[readonly] {
  background: var(--bg-subtle);
  cursor: default;
}

.translate-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}

/* ============================================================
   TTS 页面
   ============================================================ */
.tts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: stretch;
}

@media (max-width: 768px) {
  .tts-grid {
    grid-template-columns: 1fr;
  }
}

.tts-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  min-height: 360px;
}

.tts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tts-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tts-stats {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-weight: 500;
}

.tts-stats .ok {
  color: var(--success-600);
}

.tts-col textarea {
  width: 100%;
  flex: 1 1 auto;
  min-height: 240px;
  resize: vertical;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  outline: none;
  transition: all var(--duration-fast);
  unicode-bidi: plaintext;
}

.tts-col textarea:hover {
  border-color: var(--border-strong);
}

.tts-col textarea:focus {
  border-color: var(--accent-500);
  box-shadow: var(--focus-ring);
}

.tts-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

@media (max-width: 640px) {
  .tts-controls {
    grid-template-columns: 1fr;
  }
}

.tts-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.tts-field input,
.tts-field select {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  outline: none;
  transition: all var(--duration-fast);
}

.tts-field input:hover,
.tts-field select:hover {
  border-color: var(--border-strong);
}

.tts-field input:focus,
.tts-field select:focus {
  border-color: var(--accent-500);
  box-shadow: var(--focus-ring);
}

.tts-player {
  flex: 1 1 auto;
  min-height: 240px;
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: var(--space-3);
}

.tts-player audio {
  display: block;
  width: 100%;
}

.tts-empty {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--space-12) 0;
}

.tts-player-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

/* ============================================================
   音色卡片
   ============================================================ */
.voices-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.voices-title {
  font-weight: 700;
  font-size: var(--text-lg);
}

.voices-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
}

.voices-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  padding: var(--space-12) 0;
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
}

.voice-card {
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  transition: all var(--duration-fast);
  cursor: pointer;
}

.voice-card:hover {
  border-color: var(--accent-500);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.voice-card.active {
  border-color: var(--accent-500);
  background: var(--accent-50);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .voice-card.active {
  background: rgba(234, 140, 93, 0.1);
}

.voice-card-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.voice-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-tertiary);
  border: 2px solid var(--border-default);
}

.voice-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.voice-info {
  min-width: 0;
  flex: 1;
}

.voice-name {
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--space-1);
}

.voice-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.voice-note {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.voice-card-actions button {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--duration-fast);
}

.voice-card-actions button:hover {
  color: var(--accent-600);
  border-color: var(--accent-500);
  background: var(--accent-50);
}

.voice-card-actions .voice-del:hover {
  color: var(--error-600);
  border-color: var(--error-500);
  background: var(--error-50);
}

/* ============================================================
   模态框
   ============================================================ */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  backdrop-filter: blur(4px);
  animation: fadeIn var(--duration-base);
}

.modal-mask[hidden] {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-box {
  width: 100%;
  max-width: 560px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp var(--duration-medium) var(--ease-spring);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-weight: 700;
  font-size: var(--text-lg);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}

.modal-close:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}

/* 音色表单 */
.voice-form-inline {
  margin-top: var(--space-4);
  padding: var(--space-5);
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-base);
  animation: slideIn var(--duration-medium) var(--ease-spring);
}

.voice-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.voice-form-grid .voice-form-avatar {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .voice-form-grid {
    grid-template-columns: 1fr;
  }
}

.voice-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* ============================================================
   滚动条美化
   ============================================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-base);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ============================================================
   响应式优化
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar {
    position: static;
  }

  .navbar {
    padding: var(--space-3) var(--space-5);
  }

  .bottombar {
    padding: var(--space-3) var(--space-5);
  }
}

@media (max-width: 640px) {
  :root {
    --text-base: 0.9375rem; /* 15px */
  }

  .layout {
    padding: var(--space-6) var(--space-4) var(--space-20);
  }

  .section {
    padding: var(--space-6);
  }

  .mode-tabs {
    width: 100%;
    justify-content: stretch;
  }

  .mode-tab {
    flex: 1;
    justify-content: center;
  }

  .nav-title {
    display: none;
  }
}

/* ============================================================
   打印样式
   ============================================================ */
@media print {
  .navbar,
  .bottombar,
  .sidebar,
  .mode-tabs,
  button {
    display: none !important;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .section {
    border: none;
    box-shadow: none;
    page-break-inside: avoid;
  }
}

/* ============================================================
   减弱动画（尊重用户偏好）
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   高对比度模式支持
   ============================================================ */
@media (prefers-contrast: high) {
  :root {
    --border-default: #000000;
    --text-secondary: #000000;
  }

  [data-theme="dark"] {
    --border-default: #ffffff;
    --text-secondary: #ffffff;
  }
}

/* ============================================================
   翻译页 - 图片上传按钮和预览弹窗
   ============================================================ */

/* 标题栏操作按钮 */
.translate-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.btn-icon:hover {
  background: var(--bg-subtle);
  border-color: var(--border-emphasis);
  color: var(--text-primary);
}

.btn-icon:active {
  transform: scale(0.95);
}

/* 图片预览 - 内联显示 */
.image-preview-inline {
  margin-top: 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.image-preview-inline:not([hidden]) {
  display: flex;
}

.image-preview-inline img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--bg-elevated);
}

.btn-close-preview {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.btn-close-preview:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.btn-close-preview:active {
  transform: scale(0.95);
}

[data-theme="dark"] .btn-close-preview {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .btn-close-preview:hover {
  background: rgba(255, 255, 255, 0.3);
}

.image-preview-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* 响应式 */
@media (max-width: 768px) {
  .image-preview-inline img {
    max-height: 150px;
  }
}

/* ============================================================
   图片预览 (OCR 页面) - 紧凑版
   ============================================================ */

/* OCR 上传和预览水平布局 */
.ocr-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.ocr-upload-col,
.ocr-preview-col {
  min-height: 140px;
}

/* 紧凑型拖拽区 */
.dropzone.compact {
  min-height: 140px;
  padding: 20px 16px;
}

.dropzone.compact .drop-ico svg {
  width: 24px;
  height: 24px;
}

.dropzone.compact .drop-title {
  font-size: 14px;
  margin-top: 8px;
}

.dropzone.compact .drop-hint {
  font-size: 13px;
  margin-top: 4px;
}

.dropzone.compact .drop-formats {
  display: none;
}

/* 图片预览容器 */
.image-preview {
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: none;
  justify-content: center;
  align-items: center;
  min-height: 140px;
  max-height: 340px;
  padding: 12px;
}

.image-preview.compact {
  min-height: 140px;
}

.image-preview img {
  max-width: 100%;
  max-height: 320px;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 8px;
}

/* OCR 控制行 - 语言选择和按钮在同一行 */
.ocr-control-section {
  padding: 0 !important;
  margin-bottom: 16px;
}

.ocr-control-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* 行内模式标签 */
.mode-tabs.inline {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.mode-tabs.compact {
  padding: 4px;
  gap: 4px;
}

.mode-tabs.compact .mode-tab {
  padding: 8px 12px;
  font-size: 13px;
  gap: 6px;
}

.mode-tabs.compact .mode-tab svg {
  width: 14px;
  height: 14px;
}

/* 翻译栏内按钮 */
.translate-col-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* 统一结果区域高度 */
.translate-section .translate-grid {
  margin-bottom: 0;
}

.translate-section textarea {
  min-height: 200px;
  height: 200px;
  max-height: 400px;
  resize: vertical;
}

/* 响应式布局 */
@media (max-width: 768px) {
  .ocr-upload-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ocr-upload-col,
  .ocr-preview-col {
    min-height: 120px;
  }

  .dropzone.compact {
    min-height: 120px;
  }

  .image-preview.compact {
    min-height: 120px;
  }

  .ocr-control-row {
    flex-direction: column;
    align-items: stretch;
  }

  .mode-tabs.inline {
    width: 100%;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 1s linear infinite;
}




