/* MutiTrans - Premium Metallic Theme with Blue Smoke Effect */
/* 基於原版設計重構 - 深色金屬質感風格 */

/* ========== 基礎變數 ========== */
:root {
  /* 漸層色系 - Metallic Style */
  --gradient-primary: linear-gradient(145deg, #3a4556 0%, #252d38 100%);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-dark: linear-gradient(145deg, #0d1117 0%, #161b22 50%, #0d1117 100%);
  --gradient-card: linear-gradient(145deg, #1a1f27 0%, #12161c 100%);

  /* Metallic Dark Palette */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: linear-gradient(145deg, rgba(26, 31, 39, 0.9) 0%, rgba(18, 22, 28, 0.95) 100%);
  --bg-card-hover: rgba(42, 48, 60, 0.9);
  --bg-input: rgba(10, 14, 22, 0.8);

  /* Metallic Highlights */
  --metal-light: #4a5568;
  --metal-shine: #718096;
  --metal-edge: rgba(255, 255, 255, 0.08);

  /* White & Gray Scale */
  --text-primary: #f0f4f8;
  --text-secondary: #a0aec0;
  --text-muted: #718096;

  /* Blue Smoke */
  --smoke-blue: rgba(100, 150, 200, 0.15);
  --smoke-blue-light: rgba(120, 180, 220, 0.08);
  --smoke-cyan: rgba(80, 200, 220, 0.1);

  --accent-blue: #5c6bc0;
  --accent-purple: #7c4dff;
  --accent-pink: #f48fb1;
  --accent-cyan: #00e5ff;
  --accent-green: #69f0ae;

  --border-subtle: rgba(74, 85, 104, 0.3);
  --border-glow: rgba(100, 150, 200, 0.4);

  /* 陰影 */
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(100, 150, 200, 0.15);
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.2), 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-metal: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.3), 0 4px 20px rgba(0, 0, 0, 0.5);

  /* 模糊 */
  --blur-card: blur(20px);
}

/* ========== 全域重置 ========== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.7;
  /* Metal texture with right-center highlight spreading to center */
  background:
    /* Primary metallic shine - from right center, spreading left */
    radial-gradient(ellipse 80% 80% at 100% 50%, rgba(130, 160, 200, 0.25) 0%, rgba(110, 140, 180, 0.15) 20%, rgba(90, 120, 160, 0.08) 40%, transparent 60%),
    /* Secondary glow for depth */
    radial-gradient(ellipse 60% 70% at 95% 45%, rgba(150, 180, 220, 0.18) 0%, rgba(120, 150, 190, 0.08) 30%, transparent 50%),
    /* Subtle inner spread */
    radial-gradient(ellipse 50% 60% at 80% 55%, rgba(140, 170, 210, 0.1) 0%, transparent 45%),
    /* Base gradient */
    var(--gradient-dark);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Brushed Metal Texture Overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* Horizontal brushed metal lines */
  background:
    repeating-linear-gradient(90deg,
      transparent 0px,
      rgba(255, 255, 255, 0.015) 1px,
      transparent 2px,
      transparent 3px),
    repeating-linear-gradient(90deg,
      transparent 0px,
      rgba(200, 220, 240, 0.02) 0.5px,
      transparent 1px,
      transparent 2px);
  z-index: 0;
}

/* Blue Smoke Animation Layer */
body::after {
  content: '';
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60%;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% 100%, rgba(70, 130, 180, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(100, 160, 200, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 100% 60% at 50% 110%, rgba(80, 140, 190, 0.08) 0%, transparent 70%);
  animation: smokeFlow 15s ease-in-out infinite;
  z-index: 0;
}

@keyframes smokeFlow {

  0%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  33% {
    transform: translateY(-20px) scale(1.05);
    opacity: 0.8;
  }

  66% {
    transform: translateY(-10px) scale(0.98);
    opacity: 0.9;
  }
}

/* ========== 容器 ========== */
.container {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ========== 標題區 ========== */
header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem 0;
}

header h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  /* Animated Tech Gradient - White/Gray/Misty Blue */
  background: linear-gradient(90deg,
      #ffffff 0%,
      #a8c0d8 20%,
      #7ba3c4 40%,
      #c8d8e8 60%,
      #a8c0d8 80%,
      #ffffff 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleShine 10s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(120, 160, 200, 0.3));
  margin-bottom: 0.5rem;
}

@keyframes titleShine {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* ========== 卡片基礎 ========== */
.control-panel,
.recordings-panel,
.history-panel,
.transcript-panel,
.assistant-panel {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-panel:hover,
.recordings-panel:hover,
.history-panel:hover,
.transcript-panel:hover,
.assistant-panel:hover {
  border-color: rgba(100, 180, 220, 0.6);
  box-shadow:
    var(--shadow-card),
    0 0 20px rgba(100, 180, 220, 0.3),
    0 0 40px rgba(80, 150, 200, 0.2),
    inset 0 0 30px rgba(100, 180, 220, 0.05);
}

/* 卡片標題 */
.recordings-panel h2,
.history-panel h2,
.transcript-panel h2 {
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: linear-gradient(90deg, rgba(124, 77, 255, 0.1) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.recordings-panel h2::before {
  content: '🎙️';
}

.history-panel h2::before {
  content: '📁';
}

.transcript-panel h2::before {
  content: '📝';
}

/* ========== 控制面板 ========== */
.control-panel {
  padding: 1.75rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

/* ========== 按鈕系統 - Premium Metallic Style ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

/* Metallic shine sweep effect */
.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.15),
      transparent);
  transition: left 0.6s ease;
}

.btn:hover::before {
  left: 100%;
}

/* Primary Button - Metallic Gray */
.btn-primary {
  background: linear-gradient(145deg, #3a4556 0%, #252d38 100%);
  color: var(--text-primary);
  border: 1px solid var(--metal-light);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 8px 25px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(100, 150, 200, 0.15);
  border-color: var(--metal-shine);
}

/* Danger Button - Metallic Dark Red */
.btn-danger {
  background: linear-gradient(145deg, #3a3040 0%, #2a2030 100%);
  color: #ff4466;
  border: 1px solid rgba(255, 68, 102, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(145deg, #ff4466 0%, #cc3355 100%);
  color: white;
  transform: translateY(-2px);
  box-shadow:
    0 8px 25px rgba(255, 68, 102, 0.3),
    0 0 20px rgba(255, 68, 102, 0.2);
}

/* Secondary Button - Metallic Subtle */
.btn-secondary {
  background: linear-gradient(145deg, #2a3040 0%, #1e242d 100%);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(145deg, #3a4556 0%, #2a3040 100%);
  border-color: var(--metal-light);
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* 小按鈕 */
.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-download {
  background: var(--gradient-primary);
  color: white;
}

.btn-delete {
  background: rgba(255, 82, 82, 0.15);
  color: #ff8a80;
  border: 1px solid rgba(255, 82, 82, 0.3);
}

.btn-delete:hover {
  background: rgba(255, 82, 82, 0.25);
}

.btn-load {
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.btn-load:hover {
  background: rgba(0, 229, 255, 0.25);
}

/* ========== 選項/勾選框 ========== */
.options {
  margin-bottom: 1.25rem;
}

.options label {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: rgba(92, 107, 192, 0.1);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s;
}

.options label:hover {
  background: rgba(92, 107, 192, 0.15);
  border-color: var(--accent-blue);
}

.options input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--accent-purple);
}

.option-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 1rem;
}

.option-group span {
  font-weight: 500;
  color: var(--text-secondary);
}

.mode-select {
  padding: 0.5rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s;
}

.mode-select:hover {
  border-color: var(--accent-blue);
}

.mode-select:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

.mode-select option {
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 0.5rem;
}

/* ========== 狀態指示器 ========== */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.status.idle {
  background: rgba(92, 107, 192, 0.15);
  color: var(--text-secondary);
}

.status.capturing {
  background: rgba(255, 193, 7, 0.15);
  color: #ffd54f;
  box-shadow: 0 0 20px rgba(255, 193, 7, 0.2);
}

.status.active,
.status.recording {
  background: rgba(255, 82, 82, 0.15);
  color: #ff8a80;
  animation: statusPulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(255, 82, 82, 0.3);
}

@keyframes statusPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* ========== API Key 設定 ========== */
.api-key-section {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
  border: 1px solid var(--border-subtle);
}

.api-key-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  min-width: 200px;
}

.api-key-input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

.api-key-input::placeholder {
  color: var(--text-muted);
}

.btn-icon {
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.2s;
}

.btn-icon:hover {
  color: var(--text-primary);
}

.btn-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.api-key-status {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.api-key-status.saved {
  color: var(--accent-green);
}

.api-key-status.error {
  color: #ff8a80;
}

/* ========== 說話者圖例 ========== */
.speaker-legend {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.legend-local {
  color: #69f0ae;
  background: rgba(105, 240, 174, 0.1);
}

.legend-remote {
  color: #40c4ff;
  background: rgba(64, 196, 255, 0.1);
}

.legend-both {
  color: #b388ff;
  background: rgba(179, 136, 255, 0.1);
}

/* ========== 錄音清單 ========== */
.recordings-list,
.history-list {
  padding: 1rem 1.5rem 1.5rem;
}

.empty-hint {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

.recording-item,
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: rgba(92, 107, 192, 0.08);
  border: 1px solid transparent;
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
  transition: all 0.25s;
}

.recording-item:hover,
.history-item:hover {
  background: rgba(92, 107, 192, 0.15);
  border-color: var(--border-subtle);
}

.recording-info,
.history-name {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.recording-time {
  color: var(--text-primary);
  font-weight: 500;
}

.recording-size {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.recording-actions,
.history-actions {
  display: flex;
  gap: 0.5rem;
}

/* ========== 歷史面板 ========== */
.history-controls {
  display: flex;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-subtle);
}

.folder-status {
  padding: 0.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.2);
}

/* ========== 轉錄面板 ========== */
.transcript-output {
  padding: 1.5rem;
  min-height: 280px;
  max-height: 450px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  line-height: 1.8;
  background: rgba(0, 0, 0, 0.3);
}

.transcript-line {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: rgba(92, 107, 192, 0.05);
  border-left: 3px solid var(--accent-purple);
  border-radius: 0 0.5rem 0.5rem 0;
  transition: all 0.2s;
}

.transcript-line:hover {
  background: rgba(92, 107, 192, 0.1);
}

.transcript-line .speaker {
  color: var(--accent-cyan);
  font-weight: 600;
  margin-right: 0.75rem;
}

.transcript-interim {
  color: var(--text-muted);
  font-style: italic;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--border-subtle);
  animation: interimFade 1s ease-in-out infinite;
}

@keyframes interimFade {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 0.4;
  }
}

/* 即時片段 - 每 2 秒自動顯示的內容 */
.transcript-line.realtime {
  border-left-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.05);
}

/* AI 梳理後的內容 */
.transcript-line.organized {
  border-left-color: var(--accent-green);
  background: rgba(105, 240, 174, 0.08);
}

.transcript-line.organized .speaker {
  color: var(--accent-green);
}

/* ========== 🔧 交替底色（便於分辨段落）========== */
.transcript-line.line-bg-a {
  background: rgba(139, 92, 246, 0.15) !important;
  /* 紫色 */
}

.transcript-line.line-bg-b {
  background: rgba(180, 130, 70, 0.20) !important;
  /* 深黃/琥珀色 */
}

.transcript-line.line-bg-c {
  background: rgba(16, 185, 129, 0.15) !important;
  /* 綠色 */
}

/* ========== 🔧 時間戳樣式 ========== */
.transcript-line .timestamp {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  margin-right: 0.5rem;
  opacity: 0.7;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ========== 說話者辨別樣式 ========== */
/* 本地說話者（自己 - 麥克風）*/
.transcript-line.speaker-local {
  border-left-color: #69f0ae;
  background: rgba(105, 240, 174, 0.08);
}

.transcript-line.speaker-local .speaker {
  color: #69f0ae;
}

/* 遠端說話者（對方 - 電腦聲音）*/
.transcript-line.speaker-remote {
  border-left-color: #40c4ff;
  background: rgba(64, 196, 255, 0.08);
}

.transcript-line.speaker-remote .speaker {
  color: #40c4ff;
}

/* 同時說話 */
.transcript-line.speaker-both {
  border-left-color: #b388ff;
  background: rgba(179, 136, 255, 0.08);
  border-left-width: 4px;
}

.transcript-line.speaker-both .speaker {
  color: #b388ff;
}

/* 筆記樣式 */
.transcript-line.speaker-note {
  border-left-color: #ffd54f;
  background: rgba(255, 213, 79, 0.1);
}

.transcript-line.speaker-note .speaker {
  color: #ffd54f;
}

/* ========== 自動梳理結果區 ========== */
.organized-section {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(105, 240, 174, 0.05);
  border: 1px solid rgba(105, 240, 174, 0.2);
  border-radius: 0.75rem;
}

.organized-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(105, 240, 174, 0.15);
}

.organized-header span:first-child {
  font-weight: 600;
  color: var(--accent-green);
  font-size: 0.9rem;
}

.organized-header .auto-label {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: rgba(105, 240, 174, 0.15);
  color: var(--accent-green);
  border-radius: 0.25rem;
  animation: autoPulse 2s ease-in-out infinite;
}

@keyframes autoPulse {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }
}

.organized-output {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.organized-output p {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.25rem;
}

.organized-output p:last-child {
  margin-bottom: 0;
}

/* ========== 助理面板 ========== */
.assistant-panel {
  overflow: visible;
}

.assistant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(90deg, rgba(124, 77, 255, 0.1) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.assistant-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.assistant-header h2::before {
  content: '✨';
}

.assistant-tabs {
  display: flex;
  gap: 0.5rem;
}

.tab-btn {
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 2rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.25s;
}

.tab-btn:hover {
  background: rgba(92, 107, 192, 0.15);
}

.tab-btn.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.assistant-content {
  padding: 1.5rem;
}

.hidden {
  display: none !important;
}

/* 記事本 */
#notesArea {
  width: 100%;
  min-height: 180px;
  padding: 1rem 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.7;
  resize: vertical;
  transition: all 0.25s;
}

#notesArea:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

#notesArea::placeholder {
  color: var(--text-muted);
}

/* 聊天區域 */
.chat-messages {
  min-height: 220px;
  max-height: 350px;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
}

.chat-bubble {
  padding: 0.875rem 1.25rem;
  border-radius: 1.25rem;
  margin-bottom: 0.75rem;
  max-width: 85%;
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.6;
  animation: bubbleIn 0.3s ease-out;
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-bubble.user {
  background: var(--gradient-primary);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 0.375rem;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.chat-bubble.assistant {
  background: rgba(92, 107, 192, 0.15);
  color: var(--text-primary);
  margin-right: auto;
  border-bottom-left-radius: 0.375rem;
  border: 1px solid var(--border-subtle);
}

.chat-input-area {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

.quick-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.btn-quick {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  background: rgba(92, 107, 192, 0.1);
  color: var(--text-secondary);
  border-radius: 2rem;
  cursor: pointer;
  transition: all 0.25s;
}

.btn-quick:hover {
  background: rgba(92, 107, 192, 0.2);
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.chat-input-row {
  display: flex;
  gap: 0.75rem;
}

.chat-input-row input {
  flex: 1;
  padding: 0.875rem 1.25rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 2rem;
  font-size: 0.95rem;
  transition: all 0.25s;
}

.chat-input-row input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

.chat-input-row input::placeholder {
  color: var(--text-muted);
}

.chat-input-row .btn {
  border-radius: 2rem;
  padding: 0.875rem 1.75rem;
}

/* ========== 滾動條 ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(92, 107, 192, 0.4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(92, 107, 192, 0.6);
}

/* ========== 響應式設計 ========== */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  header h1 {
    font-size: 2.25rem;
  }

  .controls {
    flex-direction: column;
  }

  .controls .btn {
    width: 100%;
    justify-content: center;
  }

  .assistant-header {
    flex-direction: column;
    gap: 1rem;
  }

  .recording-item,
  .history-item {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .recording-actions,
  .history-actions {
    width: 100%;
    justify-content: center;
  }
}

/* ========== 動畫效果 ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.control-panel,
.recordings-panel,
.history-panel,
.transcript-panel,
.assistant-panel {
  animation: fadeIn 0.5s ease-out;
}

/* ========== 浮動助理按鈕 ========== */
#chatPanelToggleBtn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#chatPanelToggleBtn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

/* ========== 右側助理滑入面板 ========== */
.chat-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: 380px;
  min-width: 300px;
  max-width: 600px;
  height: 100vh;
  background: rgba(20, 25, 45, 0.98);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  z-index: 1500;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-sidebar.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.chat-sidebar .resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  transition: background 0.2s;
}

.chat-sidebar .resize-handle:hover,
.chat-sidebar .resize-handle.resizing {
  background: rgba(124, 77, 255, 0.4);
}

.chat-sidebar .chat-header {
  padding: 1rem 1.25rem;
  font-weight: 600;
  background: linear-gradient(90deg, rgba(124, 77, 255, 0.15) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-sidebar .chat-header .title-toggle {
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-sidebar .model-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-sidebar .model-controls select {
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.85rem;
}

/* 模式切換按鈕 */
.mode-toggle {
  display: flex;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.mode-btn {
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.mode-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.mode-btn.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* 模式提示區塊 */
.mode-hint {
  padding: 0.75rem 1rem;
  background: rgba(105, 240, 174, 0.1);
  border-bottom: 1px solid rgba(105, 240, 174, 0.2);
  font-size: 0.8rem;
  color: var(--accent-green);
}

/* AI 模式控制區塊 */
.ai-mode-controls {
  border-bottom: 1px solid var(--border-subtle);
}

.ai-mode-controls .model-controls {
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
}

.chat-sidebar .preset-prompts {
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.chat-sidebar .preset-prompts button {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  background: rgba(92, 107, 192, 0.15);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-sidebar .preset-prompts button:hover {
  background: rgba(92, 107, 192, 0.3);
  color: var(--text-primary);
}

.chat-sidebar .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.chat-sidebar .chat-input-area {
  padding: 1rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.chat-sidebar .chat-input-area textarea {
  width: 100%;
  min-height: 60px;
  max-height: 150px;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
  margin-bottom: 0.75rem;
}

.chat-sidebar .chat-input-area textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
}

.chat-sidebar .input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-sidebar .input-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========== 左側歷史側邊欄 ========== */
#sidebarToggleBtn {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 1100;
  padding: 0.625rem 1rem;
  background: rgba(20, 25, 45, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.25s;
}

#sidebarToggleBtn:hover {
  background: rgba(30, 38, 65, 0.95);
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

#sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 320px;
  min-width: 280px;
  max-width: 500px;
  height: 100vh;
  background: rgba(18, 25, 40, 0.98);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  color: var(--text-primary);
  z-index: 1000;
  padding: 1rem;
  overflow-y: auto;
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#sidebar.show {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#sidebarResizeHandle {
  position: absolute;
  right: 0;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  z-index: 1001;
  transition: background 0.2s;
}

#sidebarResizeHandle:hover,
#sidebarResizeHandle.resizing {
  background: rgba(124, 77, 255, 0.4);
}

#sidebar .sidebar-header {
  padding: 0.5rem 0 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

#sidebar .sidebar-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#historySidebarList {
  list-style: none;
  padding: 0;
  margin: 0;
}

#historySidebarList li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: rgba(92, 107, 192, 0.08);
  border: 1px solid transparent;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

#historySidebarList li:hover {
  background: rgba(92, 107, 192, 0.15);
  border-color: var(--border-subtle);
}

#historySidebarList li.history-active {
  background: rgba(124, 77, 255, 0.2);
  border-color: var(--accent-purple);
}

#historySidebarList li .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

#historySidebarList li .ops {
  display: flex;
  gap: 0.25rem;
}

#historySidebarList li .ops button {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  background: rgba(92, 107, 192, 0.2);
  border: none;
  color: var(--text-secondary);
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.2s;
}

#historySidebarList li .ops button:hover {
  background: rgba(92, 107, 192, 0.4);
  color: var(--text-primary);
}

/* ========== 轉錄面板操作按鈕 ========== */
.transcript-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

/* ========== 翻譯區塊 ========== */
.translation-section {
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: fadeIn 0.5s ease-out;
}

.translation-section:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.translation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.1) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.translation-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.translation-header h2::before {
  content: '🌐';
}

#translationPanels {
  padding: 1rem 1.5rem;
}

.translation-panel {
  background: rgba(92, 107, 192, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.translation-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-subtle);
}

.translation-panel-header select {
  padding: 0.4rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.translation-panel-header .btn-remove {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  background: rgba(255, 82, 82, 0.15);
  border: none;
  color: #ff8a80;
  border-radius: 0.25rem;
  cursor: pointer;
}

.translation-panel-header .btn-remove:hover {
  background: rgba(255, 82, 82, 0.3);
}

.translation-panel-content {
  padding: 1rem;
  min-height: 100px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.translation-panel.loading .translation-panel-content::after {
  content: '翻譯中...';
  color: var(--text-muted);
  font-style: italic;
}

/* ========== 波形與音量指示器 ========== */
.waveform-container {
  margin-top: 1.25rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#waveformCanvas {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 0.5rem;
  flex: 1;
  min-width: 200px;
  max-width: 100%;
}

.volume-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 140px;
}

.volume-meter {
  width: 100px;
  height: 8px;
  background: rgba(92, 107, 192, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.volume-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-cyan) 50%, var(--accent-purple) 100%);
  border-radius: 4px;
  transition: width 0.05s ease-out;
}

#volumeText {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 60px;
  text-align: right;
}

/* ========== 錄音播放相關 ========== */
.recording-item {
  position: relative;
}

.recording-item.playing {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent-cyan);
}

.recording-item.playing::before {
  content: '🔊';
  position: absolute;
  left: -1.5rem;
  top: 50%;
  transform: translateY(-50%);
  animation: playingPulse 1s ease-in-out infinite;
}

@keyframes playingPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.btn-play,
.btn-pause {
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.btn-play:hover,
.btn-pause:hover {
  background: rgba(0, 229, 255, 0.25);
}

.progress-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 100px;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(92, 107, 192, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-cyan);
  border-radius: 2px;
  transition: width 0.1s linear;
}

.progress-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 70px;
  text-align: right;
}

/* ========== 響應式調整 - 側邊面板 ========== */
@media (max-width: 768px) {
  .chat-sidebar {
    width: 100%;
    max-width: 100%;
  }

  #sidebar {
    width: 85%;
    max-width: 320px;
  }

  #chatPanelToggleBtn {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
}

/* ========== 關鍵字系統 ========== */
.keyword-section {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
}

.keyword-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.keyword-header label {
  font-weight: 600;
  color: var(--text-primary);
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 2rem;
  padding: 0.5rem 0;
}

.keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  background: var(--gradient-primary);
  color: white;
  border-radius: 999px;
  font-size: 0.875rem;
  animation: fadeIn 0.3s ease;
}

.keyword-remove {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 0.25rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.keyword-remove:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.keyword-input {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.keyword-input input {
  flex: 1;
  padding: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 0.375rem;
  color: var(--text-primary);
}

.keyword-input input:focus {
  outline: none;
  border-color: var(--accent-purple);
}

/* ========== 轉錄行交替底色 ========== */
.line-bg-a {
  background: rgba(102, 126, 234, 0.15) !important;
  border-left: 3px solid rgba(102, 126, 234, 0.6);
}

.line-bg-b {
  background: rgba(124, 77, 255, 0.15) !important;
  border-left: 3px solid rgba(124, 77, 255, 0.6);
}

.line-bg-c {
  background: rgba(244, 143, 177, 0.15) !important;
  border-left: 3px solid rgba(244, 143, 177, 0.6);
}

/* ========== 翻譯行樣式 ========== */
.translation-line {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.translation-line .timestamp {
  color: var(--text-muted);
  margin-right: 0.5rem;
  font-size: 0.875rem;
}

/* 翻譯面板行列佈局 */
.translation-panel-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.translation-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.translation-col .col-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.translation-col select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 0.375rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  min-width: 150px;
}

.translation-col.translation-actions .action-buttons {
  display: flex;
  gap: 0.5rem;
}

.translation-panel-content.hidden {
  display: none;
}

/* ========== 分享資訊區 ========== */
.share-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, rgba(0, 200, 220, 0.1) 0%, rgba(0, 150, 180, 0.05) 100%);
  border-top: 1px solid rgba(0, 200, 220, 0.2);
}

.share-info.hidden {
  display: none;
}

.share-info .share-link {
  flex: 1;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-info .btn-copy-link {
  background: rgba(0, 200, 220, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 200, 220, 0.3);
}

.share-info .btn-copy-link:hover {
  background: rgba(0, 200, 220, 0.25);
}

.share-info .btn-stop-share {
  background: rgba(255, 82, 82, 0.15);
  color: #ff8a80;
  border: 1px solid rgba(255, 82, 82, 0.3);
}

.share-info .btn-stop-share:hover {
  background: rgba(255, 82, 82, 0.25);
}

.btn-danger {
  background: rgba(255, 82, 82, 0.15) !important;
  color: #ff8a80 !important;
  border: 1px solid rgba(255, 82, 82, 0.3) !important;
}

.btn-danger:hover {
  background: rgba(255, 82, 82, 0.25) !important;
}


/* ========== 區段標題行（標題+按鈕） ========== */
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.section-header-row h2 {
  margin: 0;
}

.section-header-actions {
  display: flex;
  gap: 0.5rem;
}

/* ========== 用戶認證與點數區 ========== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-main {
  text-align: left;
}

.auth-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.points-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.15) 0%, rgba(0, 229, 255, 0.1) 100%);
  border: 1px solid rgba(124, 77, 255, 0.3);
  border-radius: 2rem;
}

.points-icon {
  font-size: 1.1rem;
}

#pointsBalance {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-cyan);
  min-width: 2rem;
  text-align: center;
}

#pointsBalance.low-balance {
  color: #ff8a80;
  animation: lowBalancePulse 1s ease-in-out infinite;
}

@keyframes lowBalancePulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.points-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.btn-accent {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  font-weight: 600;
}

.btn-accent:hover {
  box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.points-warning {
  padding: 0.5rem 1rem;
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 0.5rem;
  color: #ffd54f;
  font-size: 0.85rem;
}

.points-warning.error {
  background: rgba(255, 82, 82, 0.15);
  border-color: rgba(255, 82, 82, 0.3);
  color: #ff8a80;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-email {
  color: var(--text-secondary);
  font-size: 0.85rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== 登入 Modal ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: var(--blur-card);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-card), 0 0 40px rgba(124, 77, 255, 0.2);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(90deg, rgba(124, 77, 255, 0.1) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}

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

.modal-body {
  padding: 1.5rem;
}

.login-hint {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: rgba(105, 240, 174, 0.1);
  border-radius: 0.5rem;
  border: 1px solid rgba(105, 240, 174, 0.2);
}

.login-hint strong {
  color: var(--accent-green);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-form label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.login-form input {
  padding: 0.875rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15);
}

.login-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.login-divider span {
  padding: 0 1rem;
  font-size: 0.85rem;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem;
  background: white;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-google:hover {
  background: #f5f5f5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-google svg {
  flex-shrink: 0;
}

/* ========== 隱藏類 ========== */
.hidden {
  display: none !important;
}

/* ========== Debug Timeline (Temporary) ========== */
.debug-timeline-section {
  background: rgba(20, 25, 45, 0.9);
  border: 1px solid rgba(255, 100, 100, 0.3);
  border-radius: 1.25rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.debug-timeline-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(90deg, rgba(255, 100, 100, 0.1) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 100, 100, 0.2);
}

.debug-timeline-section h2 {
  color: #ff6b6b;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.debug-timeline-section .section-header-actions {
  display: flex;
  gap: 0.5rem;
}

#debugTimelineContent {
  padding: 1rem 1.5rem;
}

.debug-timeline-canvas-wrap {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 0.5rem;
  padding: 0.5rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}

#debugTimelineCanvas {
  display: block;
  min-width: 100%;
  height: 80px;
}

.debug-transcript-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.debug-transcript-item {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.5rem;
  padding: 0.75rem;
  border-left: 3px solid var(--accent-blue);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.debug-transcript-item .debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  color: var(--accent-cyan);
}

.debug-transcript-item .debug-header .segment-id {
  font-weight: 600;
  color: #ff6b6b;
}

.debug-transcript-item .debug-header .time-info {
  color: var(--text-secondary);
}

.debug-transcript-item .debug-result {
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.debug-transcript-item .debug-result.error {
  color: #ff6b6b;
}

.debug-transcript-item .debug-result.pending {
  color: var(--text-muted);
  font-style: italic;
}