/* AeroSpeech — Linear Design System + Feishu Layout Rewrite */

/* ========== DESIGN TOKENS ========== */
:root {
  --bg-base:       #08090a;
  --bg-surface-0:  #0f1011;
  --bg-surface-1:  #141516;
  --bg-surface-2:  #191a1b;
  --bg-surface-3:  #28282c;
  --bg-hover:      rgba(255, 255, 255, 0.04);
  --bg-active:     rgba(255, 255, 255, 0.06);

  --text-primary:    #f7f8f8;
  --text-secondary:  #d0d6e0;
  --text-tertiary:   #8a8f98;
  --text-quaternary: #62666d;

  --border-subtle:   rgba(255, 255, 255, 0.05);
  --border-standard: rgba(255, 255, 255, 0.08);
  --border-strong:   rgba(255, 255, 255, 0.12);

  --brand:       #5e6ad2;
  --brand-hover: #828fff;
  --danger:      #ef4444;
  --success:     #27a644;

  --correction-l0: #27a644;
  --correction-l1: #5e6ad2;
  --correction-l2: #f59e0b;

  --speaker-0: #5dade2; --speaker-1: #bb8fce; --speaker-2: #58d68d;
  --speaker-3: #f0b27a; --speaker-4: #f1948a; --speaker-5: #85c1e9;

  --font-sans: 'Inter', -apple-system, 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Menlo', ui-monospace, monospace;

  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-xl: 12px;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========== RESET ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ========== APP LAYOUT (full viewport) ========== */
.app {
  width: 100%; height: 100vh;
  display: flex; flex-direction: column;
}

/* ========== HEADER ========== */
.header {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
}
.header h1 {
  font-size: 20px; color: var(--brand);
  font-weight: 600; letter-spacing: -0.02em;
}
.status-bar {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-quaternary);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); display: inline-block;
}
.status-dot.connected { background: var(--success); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.divider { color: var(--border-standard); }

/* ========== TABS ========== */
.tabs { display: flex; gap: 4px; margin-top: 10px; }
.tab {
  padding: 7px 16px; border: 1px solid var(--border-standard); background: transparent;
  color: var(--text-tertiary); cursor: pointer; border-radius: var(--radius-md);
  font-size: 13px; transition: all 0.15s ease;
}
.tab.active { background: rgba(94, 106, 210, 0.12); color: var(--brand); border-color: rgba(94, 106, 210, 0.3); }
.tab:hover { border-color: var(--border-strong); color: var(--text-secondary); }

/* ========== PANELS ========== */
.panel { display: none; }
.panel.active { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

/* ========== TOOLBAR ========== */
.toolbar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 12px;
  background: var(--bg-surface-1); border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle); font-size: 13px;
  flex-shrink: 0;
}
.toolbar label { color: var(--text-tertiary); cursor: pointer; display: flex; align-items: center; gap: 4px; }
.toolbar input[type="checkbox"] { accent-color: var(--brand); }

/* ========== HOTWORDS / SPEAKER PANELS ========== */
.hotwords-panel {
  padding: 8px 12px; background: var(--bg-surface-1);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); margin-top: -4px;
}
.hotwords-input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.hotwords-tags { display: flex; flex-wrap: wrap; gap: 5px; min-height: 24px; }
.hotwords-tags .hw-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; background: rgba(94, 106, 210, 0.12); border: 1px solid rgba(94, 106, 210, 0.25);
  border-radius: 12px; font-size: 12px; color: var(--brand);
}
.hotwords-tags .hw-tag .hw-remove { cursor: pointer; font-size: 14px; color: var(--text-quaternary); line-height: 1; }
.hotwords-tags .hw-tag .hw-remove:hover { color: var(--danger); }
.hotwords-hint { font-size: 11px; color: var(--text-quaternary); margin-top: 6px; }

/* ========== FEISHU LAYOUT (left sidebar + right main) ========== */
.feishu-layout { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* --- Left sidebar --- */
.feishu-sidebar {
  width: 300px; min-width: 260px; background: var(--bg-surface-0);
  border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0;
}
.sidebar-header {
  padding: 14px 18px 10px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.sidebar-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }

.sidebar-section { border-bottom: 1px solid var(--border-subtle); }
.section-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
}
.section-badge {
  font-size: 11px; color: var(--text-quaternary); background: var(--bg-surface-3);
  padding: 1px 8px; border-radius: 10px; margin-left: auto;
}
.section-content { padding: 0 18px 10px; font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
.summary-placeholder { color: var(--text-quaternary); font-size: 12px; padding: 6px 0; }

.info-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 12px; }
.info-label { color: var(--text-quaternary); }
.info-value { color: var(--text-secondary); font-family: var(--font-mono); }

.keywords-cloud { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 0; }
.keyword-tag {
  padding: 2px 10px; background: rgba(94,106,210,0.10); color: var(--brand);
  border-radius: 12px; font-size: 12px;
}

.sidebar-footer {
  margin-top: auto; padding: 10px 18px; border-top: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 5px;
}
.sidebar-action-btn {
  width: 100%; padding: 7px 12px; border: 1px solid var(--border-standard);
  background: transparent; color: var(--text-secondary); border-radius: var(--radius-md);
  font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.sidebar-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* --- Right main area --- */
.feishu-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.feishu-main-tabs {
  display: flex; padding: 0 24px; border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0; background: var(--bg-surface-0);
}
.feishu-tab {
  padding: 10px 18px; border: none; background: transparent;
  color: var(--text-quaternary); font-size: 14px; font-weight: 500;
  cursor: pointer; position: relative; transition: color 0.15s;
}
.feishu-tab.active { color: var(--text-primary); }
.feishu-tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 18px; right: 18px;
  height: 2px; background: var(--brand); border-radius: 1px;
}

/* ========== TRANSCRIPT AREA ========== */
.transcript-area {
  background: var(--bg-surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  min-height: 420px; max-height: 640px;
  overflow-y: auto; padding: 16px 20px;
  margin-bottom: 12px;
  scroll-behavior: smooth;
}
.transcript-area::-webkit-scrollbar { width: 6px; }
.transcript-area::-webkit-scrollbar-track { background: transparent; }
.transcript-area::-webkit-scrollbar-thumb { background: var(--border-standard); border-radius: 3px; }

.feishu-transcript {
  flex: 1; border: none; border-radius: 0; margin-bottom: 0;
  max-height: none; min-height: 0; background: var(--bg-base); padding: 16px 28px;
}

.placeholder { color: var(--text-quaternary); text-align: center; margin-top: 180px; font-size: 14px; }

/* ================================================================
   PARAGRAPH — 核心布局（修复竖排bug）

   结构：
     div.paragraph          ← flex column
       div.paragraph-header ← flex row（头像+名字+时间戳）
       div.paragraph-body   ← 文本区域（左缩进对齐）
         span.text-content  ← 单句文本
         div.translation-line ← 翻译行
   ================================================================ */
.paragraph {
  display: flex;
  flex-direction: column;   /* KEY FIX: column layout prevents text squeezing */
  margin-bottom: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-lg);
  transition: background 0.15s ease;
}
.paragraph:hover { background: rgba(255,255,255,0.02); }
.paragraph.active { background: rgba(94, 106, 210, 0.04); }

.paragraph-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.paragraph-body {
  padding-left: 40px;
  font-size: 15px;
  line-height: 1.85;
  word-break: break-word;
  color: var(--text-primary);
}

/* ========== SPEAKER ========== */
.speaker-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #4a6cf7; color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.speaker-name {
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
}
.timestamp {
  font-size: 11px; color: var(--text-quaternary); font-family: var(--font-mono);
}
.timestamp.clickable { cursor: pointer; }
.timestamp.clickable:hover { color: var(--brand); }

.speaker-label {
  display: inline-block; padding: 1px 8px; margin-right: 6px;
  border-radius: 10px; font-size: 11px; font-weight: 600;
}
.speaker-0 { background: rgba(93,173,226,0.12); color: var(--speaker-0); }
.speaker-1 { background: rgba(187,143,206,0.12); color: var(--speaker-1); }
.speaker-2 { background: rgba(88,214,141,0.12); color: var(--speaker-2); }
.speaker-3 { background: rgba(240,178,122,0.12); color: var(--speaker-3); }
.speaker-4 { background: rgba(241,148,138,0.12); color: var(--speaker-4); }
.speaker-5 { background: rgba(133,193,233,0.12); color: var(--speaker-5); }

/* ========== CHAR-LEVEL STREAMING ========== */
.char-stream {
  display: inline;
  opacity: 0;
  animation: charReveal 80ms var(--ease-out-expo) forwards;
}
@keyframes charReveal {
  from { opacity: 0; transform: translateY(1.5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========== THREE-LAYER RENDERING ========== */

/* Layer C: partial — gray, recognizing */
.paragraph.partial .paragraph-body {
  color: var(--text-secondary);
  opacity: 0.6;
  transition: opacity 0.3s ease, color 0.3s ease;
}

/* Layer B: final awaiting correction — subtle pulse, higher opacity than partial */
.paragraph.final.awaiting-correction .paragraph-body {
  color: var(--text-secondary);
  opacity: 0.75;
  animation: awaitPulse 2s ease-in-out infinite;
  transition: opacity 0.4s var(--ease-out-expo), color 0.4s var(--ease-out-expo);
}
@keyframes awaitPulse {
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 0.6; }
}

/* Layer A: correction confirmed — white, smooth "light up" + left accent */
.paragraph.final.correction-confirmed {
  border-left: 2px solid transparent;
  animation: confirmAccent 1.2s var(--ease-out-expo) forwards;
}
.paragraph.final.correction-confirmed .paragraph-body {
  color: var(--text-primary);
  opacity: 1;
  animation: none;
  transition: opacity 0.5s var(--ease-out-expo), color 0.5s var(--ease-out-expo);
}
@keyframes confirmAccent {
  0%   { border-left-color: var(--brand); }
  40%  { border-left-color: rgba(94, 106, 210, 0.4); }
  100% { border-left-color: transparent; }
}

/* Default final (no correction scenario, or timeout fallback) */
.paragraph.final:not(.awaiting-correction) .paragraph-body {
  color: var(--text-primary);
  opacity: 1;
}

/* Typing cursor — visible during partial, fades on final */
.typing-cursor {
  display: inline-block; width: 2px; height: 1em;
  background: var(--brand); margin-left: 1px; vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
  transition: opacity 0.2s ease;
}
.typing-cursor.fade-out { opacity: 0; animation: none; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ========== CORRECTION ANIMATIONS ========== */
.correction-highlight {
  border-radius: 2px; padding: 0 1px; margin: 0 -1px;
}

/* L0: green, fast & subtle — rule-based hotword/mapping replacements */
.corrected-l0, .correction-highlight.l0 {
  animation: flashL0 250ms var(--ease-out-expo) forwards;
}
@keyframes flashL0 {
  0%   { background: rgba(39, 166, 68, 0.20); }
  40%  { background: rgba(39, 166, 68, 0.06); }
  100% { background: transparent; }
}

/* L1: indigo, noticeable — sherpa/pipeline level corrections */
.corrected-l1, .correction-highlight.l1 {
  animation: flashL1 400ms var(--ease-out-expo) forwards;
}
@keyframes flashL1 {
  0%   { background: rgba(94, 106, 210, 0.25); color: #a5b0ff; }
  35%  { background: rgba(94, 106, 210, 0.10); color: var(--text-primary); }
  100% { background: transparent; }
}

/* L2: amber, confident + underline — slower, more visible */
.corrected-l2, .correction-highlight.l2 {
  animation: flashL2 1200ms var(--ease-out-expo) forwards;
  text-decoration: underline; text-decoration-color: var(--correction-l2);
  text-underline-offset: 3px; text-decoration-thickness: 1.5px;
}
@keyframes flashL2 {
  0%   { background: rgba(245, 158, 11, 0.35); color: #ffd980; }
  20%  { background: rgba(245, 158, 11, 0.22); color: #ffe4a0; }
  50%  { background: rgba(245, 158, 11, 0.08); color: var(--text-primary); }
  80%  { background: transparent; text-decoration-color: rgba(245, 158, 11, 0.3); }
  100% { background: transparent; text-decoration-color: transparent; }
}

/* Qwen3: cyan-blue, ASR quality upgrade — longer & more visible */
.corrected-qwen3, .correction-highlight.qwen3 {
  animation: flashQwen3 900ms var(--ease-out-expo) forwards;
}
@keyframes flashQwen3 {
  0%   { background: rgba(56, 189, 248, 0.40); color: #7dd3fc; }
  25%  { background: rgba(56, 189, 248, 0.22); color: #bae6fd; }
  60%  { background: rgba(56, 189, 248, 0.08); color: var(--text-primary); }
  100% { background: transparent; }
}

.paragraph.corrected { animation: flashL1 300ms ease; }

/* ========== TRANSLATION ========== */
.translation-line {
  font-size: 13px; line-height: 1.5; margin-top: 3px; margin-bottom: 4px;
  border-left: 2px solid rgba(94, 106, 210, 0.2);
  padding-left: 8px;
}
.translation-draft { color: var(--text-quaternary); font-style: italic; }
.translation-final { color: var(--text-tertiary); font-style: normal; }

/* ========== BUTTONS ========== */
.btn {
  padding: 8px 20px; border: none; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s ease;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-secondary { background: var(--bg-surface-3); color: var(--text-secondary); }
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.1); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; margin-bottom: 6px; }

/* ========== INPUTS ========== */
.input-sm {
  padding: 7px 10px; background: var(--bg-surface-0); border: 1px solid var(--border-standard);
  color: var(--text-primary); border-radius: var(--radius-md); font-size: 13px; width: 180px;
}
.input-sm:focus { outline: none; border-color: var(--brand); }
.input-block {
  width: 100%; margin-bottom: 10px; padding: 7px 10px;
  background: var(--bg-surface-0); border: 1px solid var(--border-standard);
  color: var(--text-primary); border-radius: var(--radius-md); font-size: 13px;
}
.select-sm {
  padding: 5px 8px; background: var(--bg-surface-0); border: 1px solid var(--border-standard);
  color: var(--text-primary); border-radius: var(--radius-sm); font-size: 12px;
}
.file-input { color: var(--text-tertiary); font-size: 13px; }

/* ========== PROGRESS ========== */
.progress-bar { flex: 1; height: 4px; background: var(--bg-surface-3); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--brand); transition: width 0.3s; }

/* ========== CONTROLS BAR (file/meeting panels) ========== */
.controls {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg-surface-1); border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

/* ========== BOTTOM CONTROLS (feishu player style) ========== */
.feishu-controls {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 18px; background: var(--bg-surface-1);
  border-top: 1px solid var(--border-subtle); flex-shrink: 0; height: 52px;
}
.feishu-rec-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--brand); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.feishu-rec-btn:hover:not(:disabled) { background: var(--brand-hover); transform: scale(1.05); }
.feishu-rec-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.feishu-rec-btn.recording { background: var(--danger); animation: recPulse 1.5s infinite; }
@keyframes recPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

.feishu-stop-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--bg-surface-3); color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.feishu-stop-btn:hover:not(:disabled) { background: var(--danger); color: #fff; }
.feishu-stop-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.feishu-progress { flex: 1; display: flex; align-items: center; gap: 8px; }
.feishu-time { font-size: 12px; color: var(--text-quaternary); font-family: var(--font-mono); min-width: 36px; }
.feishu-progress-bar { flex: 1; height: 3px; background: var(--bg-surface-3); border-radius: 2px; }
.feishu-progress-fill { height: 100%; width: 0%; background: var(--brand); border-radius: 2px; transition: width 1s linear; }

/* ========== MEETING PANEL ========== */
.meeting-layout { display: flex; gap: 16px; }
.meeting-sidebar { width: 220px; flex-shrink: 0; }
.meeting-sidebar h3 { font-size: 13px; color: var(--text-tertiary); margin: 12px 0 8px; font-weight: 500; }
.meeting-content { flex: 1; }

.tag-container { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag { padding: 3px 10px; background: rgba(94,106,210,0.12); color: var(--brand); border-radius: 12px; font-size: 12px; }

/* ========== PLAYER ========== */
.player-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--bg-surface-1); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); margin-bottom: 10px;
}
.player-btn {
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.player-btn:hover { background: var(--brand-hover); }
.speed-btn {
  background: var(--bg-surface-3); color: var(--text-secondary);
  border-radius: var(--radius-sm); width: auto; padding: 4px 10px; font-size: 12px;
}
.player-time { font-size: 11px; color: var(--text-quaternary); min-width: 45px; font-family: var(--font-mono); }
.seek-bar { flex: 1; height: 3px; accent-color: var(--brand); background: var(--bg-surface-3); border-radius: 2px; cursor: pointer; }

.player-segments { max-height: 280px; overflow-y: auto; background: var(--bg-surface-1); border-radius: var(--radius-lg); padding: 6px; }
.player-segment {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.15s; font-size: 13px;
}
.player-segment:hover { background: var(--bg-hover); }
.player-segment.active { background: rgba(94,106,210,0.08); border-left: 2px solid var(--brand); }
.seg-time { font-size: 11px; color: var(--text-quaternary); min-width: 40px; }
.seg-speaker { font-size: 11px; color: var(--speaker-1); min-width: 60px; }
.seg-text { color: var(--text-secondary); }

.playback-active {
  background: rgba(94,106,210,0.06);
  border-left: 2px solid var(--brand);
  padding-left: 6px;
}

/* ========== SPEAKER STATS ========== */
.speaker-stat { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 12px; }
.speaker-stat-bar { flex: 1; height: 4px; background: var(--bg-surface-3); border-radius: 2px; overflow: hidden; }
.speaker-stat-fill { height: 100%; border-radius: 2px; }

/* ========== EDITABLE ========== */
.text-content[contenteditable="true"]:focus { outline: 1px solid rgba(94,106,210,0.3); background: rgba(94,106,210,0.04); }
.text-content .edit-indicator { font-size: 10px; color: var(--text-quaternary); margin-left: 4px; display: none; }
.text-content:hover .edit-indicator { display: inline; }

/* ========== MARKDOWN (meeting summary) ========== */
.markdown-content { padding: 8px 0; line-height: 1.8; color: var(--text-primary); font-size: 14px; }
.markdown-content h2 { font-size: 18px; font-weight: 600; color: var(--brand); margin: 16px 0 8px; }
.markdown-content h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 14px 0 6px; }
.markdown-content h4 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin: 10px 0 4px; }
.markdown-content p { margin: 4px 0; color: var(--text-secondary); }
.markdown-content .list-item { padding: 2px 0 2px 16px; position: relative; color: var(--text-secondary); }
.markdown-content .list-item::before { content: '\2022'; position: absolute; left: 4px; color: var(--brand); }
.markdown-content .todo-item { padding: 3px 0; display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.markdown-content .todo-item input[type="checkbox"] { accent-color: var(--brand); }
.markdown-content strong { color: var(--text-primary); font-weight: 600; }
.markdown-content code { background: var(--bg-surface-3); padding: 1px 5px; border-radius: 3px; font-family: var(--font-mono); font-size: 13px; }

/* ========== LEXICON PANEL ========== */
.lexicon-layout { display: flex; flex: 1; overflow: hidden; min-height: 0; }

.lexicon-sidebar {
  width: 220px; flex-shrink: 0; padding: 14px;
  background: var(--bg-surface-0); border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
}
.lexicon-sidebar h3 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 12px; }
.lexicon-field { margin-bottom: 10px; }
.lexicon-field label { display: block; font-size: 12px; color: var(--text-tertiary); margin-bottom: 4px; }
.lexicon-hint { font-size: 11px; color: var(--text-quaternary); margin-top: 6px; line-height: 1.5; }
.lexicon-stats { margin-top: 16px; font-size: 12px; color: var(--text-tertiary); line-height: 1.8; }

.lexicon-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.lexicon-tabs {
  display: flex; padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; background: var(--bg-surface-0);
}
.lex-tab {
  padding: 10px 18px; border: none; background: transparent;
  color: var(--text-quaternary); font-size: 13px; font-weight: 500;
  cursor: pointer; position: relative; transition: color 0.15s;
}
.lex-tab.active { color: var(--text-primary); }
.lex-tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 18px; right: 18px;
  height: 2px; background: var(--brand); border-radius: 1px;
}

.lex-panel { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.lex-panel.active { display: flex; }

.lex-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--bg-surface-1); border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.lex-list {
  flex: 1; overflow-y: auto; padding: 8px 16px;
}
.lex-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-bottom: 1px solid var(--border-subtle);
  font-size: 13px; transition: background 0.1s;
}
.lex-item:hover { background: var(--bg-hover); }
.lex-item-main { flex: 1; min-width: 0; }
.lex-item-term { font-weight: 500; color: var(--text-primary); }
.lex-item-def { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lex-item-meta { font-size: 11px; color: var(--text-quaternary); }
.lex-item-synonyms { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.lex-item-syn-tag {
  padding: 1px 6px; background: rgba(94,106,210,0.08); color: var(--brand);
  border-radius: 8px; font-size: 11px;
}
.lex-item-badge {
  padding: 1px 8px; border-radius: 8px; font-size: 11px; flex-shrink: 0;
}
.lex-badge-hotword { background: rgba(39,166,68,0.12); color: var(--success); }
.lex-badge-rule { background: rgba(245,158,11,0.12); color: #f59e0b; }
.lex-badge-term { background: rgba(94,106,210,0.12); color: var(--brand); }
.lex-item-arrow { color: var(--text-quaternary); font-size: 12px; flex-shrink: 0; }
.lex-item-del {
  width: 24px; height: 24px; border: none; background: transparent;
  color: var(--text-quaternary); cursor: pointer; border-radius: 4px;
  font-size: 14px; flex-shrink: 0;
}
.lex-item-del:hover { background: rgba(239,68,68,0.12); color: var(--danger); }

.lex-footer {
  display: flex; gap: 8px; padding: 8px 16px;
  border-top: 1px solid var(--border-subtle); flex-shrink: 0; background: var(--bg-surface-1);
}
.lex-empty { color: var(--text-quaternary); text-align: center; padding: 40px; font-size: 13px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .header h1 { font-size: 18px; }
  .tabs { gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { padding: 6px 14px; font-size: 13px; white-space: nowrap; flex-shrink: 0; }
  .controls { flex-wrap: wrap; gap: 8px; padding: 8px; }
  .btn { padding: 10px 16px; font-size: 13px; min-height: 44px; }
  .input-sm { width: 100%; min-height: 44px; }
  .transcript-area { min-height: 50vh; max-height: 70vh; padding: 10px; }
  .paragraph-body { font-size: 14px; padding-left: 8px; }
  .meeting-layout { flex-direction: column; }
  .meeting-sidebar { width: 100%; }
  .feishu-layout { flex-direction: column; }
  .feishu-sidebar { width: 100%; max-height: 180px; border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .feishu-transcript { padding: 10px 14px; }
  .lexicon-layout { flex-direction: column; }
  .lexicon-sidebar { width: 100%; max-height: 160px; border-right: none; border-bottom: 1px solid var(--border-subtle); }
}

@media (prefers-reduced-motion: reduce) {
  .char-stream { animation: none; opacity: 1; }
  .corrected-l0, .corrected-l1, .corrected-l2, .corrected-qwen3 { animation: none; }
  .correction-highlight { animation: none !important; }
  .paragraph.final.awaiting-correction .paragraph-body { animation: none; }
}

@supports (padding-top: env(safe-area-inset-top)) {
  .app {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}
