/* ============ AI 背诵助手 · 样式 ============ */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --accent: #8b5cf6;
  --success: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ink: #1e293b;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --bg: #f4f6fd;
  --card: rgba(255, 255, 255, 0.88);
  --card-border: rgba(255, 255, 255, 0.9);
  --shadow: 0 8px 32px rgba(99, 102, 241, 0.10);
  --shadow-lg: 0 16px 48px rgba(99, 102, 241, 0.18);
  --radius: 18px;
}

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

html { font-size: 16px; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%; /* 禁止移动端浏览器自作主张放大字号 */
}

/* ---- 背景装饰 ---- */
.bg-decoration { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.blob-1 { width: 520px; height: 520px; background: #c7d2fe; top: -160px; left: -120px; animation: drift 22s ease-in-out infinite alternate; }
.blob-2 { width: 460px; height: 460px; background: #ddd6fe; bottom: -140px; right: -100px; animation: drift 26s ease-in-out infinite alternate-reverse; }
.blob-3 { width: 300px; height: 300px; background: #bae6fd; top: 40%; left: 55%; animation: drift 30s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(60px, -40px) scale(1.12); }
}

/* ---- 头部 ---- */
.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 36px; max-width: 1280px; margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon {
  font-size: 30px; width: 56px; height: 56px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px; box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.logo h1 { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.logo p { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 14px; }

.key-status {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; padding: 7px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid rgba(148, 163, 184, 0.25); color: var(--ink-2);
}
.key-status .dot { width: 8px; height: 8px; border-radius: 50%; }
.key-ok .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.key-missing .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

.btn-icon {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid rgba(148,163,184,0.25);
  background: var(--card); font-size: 18px; cursor: pointer; transition: all 0.2s;
}
.btn-icon:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* ---- 步骤指示器 ---- */
.steps {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  max-width: 640px; margin: 4px auto 22px; padding: 0 20px;
}
.step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; color: var(--ink-3); font-weight: 500; transition: color 0.3s;
  white-space: nowrap;
}
.step-num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #e2e8f0; color: var(--ink-3); font-size: 13px; font-weight: 700; transition: all 0.3s;
}
.step.active { color: var(--primary-dark); }
.step.active .step-num {
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.step.done { color: var(--success); }
.step.done .step-num { background: var(--success); color: #fff; }
.step-line { flex: 1; height: 2px; background: #e2e8f0; border-radius: 2px; min-width: 24px; }

/* ---- 布局容器 ---- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 36px 60px; }
.view { display: none; animation: fadeUp 0.45s ease; }
.view.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- 卡片 ---- */
.card {
  background: var(--card); backdrop-filter: blur(16px);
  border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; gap: 12px;
}
.card-header h3 { font-size: 17px; font-weight: 700; }
.card-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed #e2e8f0; gap: 12px; flex-wrap: wrap;
}
.footer-actions { display: flex; gap: 10px; }

/* ---- 按钮 ---- */
.btn {
  padding: 10px 20px; border-radius: 12px; border: none; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45); }
.btn-ghost {
  background: transparent; color: var(--ink-2); border: 1px solid #e2e8f0;
}
.btn-ghost:hover { background: #f1f5f9; color: var(--primary-dark); border-color: var(--primary-light); }
.btn-small { padding: 6px 12px; font-size: 12.5px; }

.link { color: var(--primary); cursor: pointer; text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }
.hidden { display: none !important; }

/* ---- 上传区 ---- */
.upload-card { max-width: 680px; margin: 30px auto; }
.drop-zone {
  border: 2.5px dashed var(--primary-light); border-radius: 16px;
  padding: 64px 30px; text-align: center; cursor: pointer; transition: all 0.25s;
  background: rgba(238, 242, 255, 0.35);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary); background: rgba(224, 231, 255, 0.55); transform: scale(1.01);
}
.drop-icon { font-size: 52px; margin-bottom: 14px; animation: floaty 3.2s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-8px); } }
.drop-zone h2 { font-size: 19px; margin-bottom: 8px; }
.drop-zone p { color: var(--ink-2); font-size: 14px; margin-bottom: 6px; }

.upload-progress { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 40px; color: var(--ink-2); }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid #e0e7ff; border-top-color: var(--primary); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 首页历史任务 ---- */
.history-card { max-width: 680px; margin: 22px auto 0; }

/* ---- 划选布局 ---- */
.select-layout { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
.select-tip {
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1px solid #e0e7ff; border-radius: 12px;
  padding: 10px 16px; font-size: 13.5px; color: var(--primary-dark); margin-bottom: 16px;
}
.doc-content {
  max-height: 56vh; overflow-y: auto; line-height: 2.05; font-size: 15.5px;
  padding: 6px 14px 6px 6px; color: var(--ink); user-select: text;
  white-space: pre-wrap; word-break: break-word;
}
/* 触屏点选段落 */
.doc-content .para {
  padding: 3px 8px; margin: 0 -8px; border-radius: 8px;
  transition: background 0.15s, color 0.15s; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.doc-content .para:active { background: #eef2ff; }
.doc-content .para.selected {
  background: linear-gradient(135deg, #e0e7ff, #ede9fe);
  color: var(--primary-dark); font-weight: 600;
}
.doc-content .para-empty { cursor: default; pointer-events: none; }

.doc-content::-webkit-scrollbar { width: 8px; }
.doc-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.doc-content::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* 任务列表 */
.task-list { display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow-y: auto; }
.task-item {
  border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px 16px;
  background: #fff; transition: all 0.2s; cursor: pointer; position: relative;
}
.task-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow); transform: translateY(-1px); }
.task-item .task-preview {
  font-size: 13px; color: var(--ink-2); line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 10px;
}
.task-item .task-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: nowrap;
}
.task-item .task-count {
  font-size: 12px; color: var(--ink-3);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task-item .task-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.task-del {
  background: none; border: none; color: var(--ink-3); cursor: pointer; font-size: 15px;
  padding: 3px 6px; border-radius: 6px; transition: all 0.15s; flex-shrink: 0;
}
.task-del:hover { color: var(--danger); background: #fef2f2; }
.task-go {
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  border: none; font-size: 12.5px; padding: 6px 12px; border-radius: 9px; cursor: pointer;
  font-weight: 600; white-space: nowrap; flex-shrink: 0;
}
.empty-state { text-align: center; padding: 44px 16px; color: var(--ink-3); }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.6; }
.empty-state p { font-size: 13px; line-height: 1.8; }

/* ---- 背诵视图 ---- */
.recite-layout { max-width: 860px; margin: 0 auto; }

.mode-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.mode-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 16px 18px; border-radius: 14px; border: 2px solid #e2e8f0;
  background: #fff; cursor: pointer; transition: all 0.22s; font-family: inherit; text-align: left;
}
.mode-btn:hover { border-color: var(--primary-light); }
.mode-btn.active {
  border-color: var(--primary); background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.18);
}
.mode-icon { font-size: 22px; }
.mode-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.mode-desc { font-size: 12px; color: var(--ink-3); }
.mode-btn.active .mode-name { color: var(--primary-dark); }

.original-box {
  border: 1px solid #e0e7ff; border-radius: 14px; overflow: hidden; margin-bottom: 22px;
  background: linear-gradient(180deg, #fbfcff, #f6f7ff);
}
.original-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 18px; font-size: 13.5px; font-weight: 600; color: var(--primary-dark);
  background: rgba(238, 242, 255, 0.7); border-bottom: 1px solid #e0e7ff;
}
.peek-toggle { font-size: 12.5px; font-weight: 400; color: var(--ink-2); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.original-text {
  padding: 18px; line-height: 2.05; font-size: 15.5px; max-height: 26vh; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word; transition: filter 0.3s;
}
.original-text.blurred { filter: blur(7px); user-select: none; }

/* 录音 */
.record-area { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 12px 0 20px; }
.mic-wrap { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.mic-btn {
  width: 84px; height: 84px; border-radius: 50%; border: none; cursor: pointer; z-index: 2;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.45);
  display: grid; place-items: center; transition: all 0.25s;
}
.mic-btn:hover { transform: scale(1.06); }
.mic-svg { width: 36px; height: 36px; fill: #fff; }
.mic-btn.recording {
  background: linear-gradient(135deg, #ef4444, #f97316);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.5);
  animation: micShake 1.6s ease-in-out infinite;
}
@keyframes micShake { 50% { transform: scale(1.05); } }
.mic-pulse {
  position: absolute; inset: 0; border-radius: 50%; z-index: 1;
  border: 3px solid var(--primary); opacity: 0; pointer-events: none;
}
.mic-pulse.active { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse {
  from { transform: scale(0.9); opacity: 0.7; }
  to { transform: scale(1.7); opacity: 0; }
}
.record-info { display: flex; align-items: center; gap: 14px; }
.record-state { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.record-state.live { color: var(--danger); }
.record-time {
  font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 700; color: var(--primary-dark);
  background: #eef2ff; padding: 4px 12px; border-radius: 999px;
}

.live-box { border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; overflow: hidden; }
.live-header {
  padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: #f8fafc; border-bottom: 1px solid #e2e8f0;
  display: flex; justify-content: space-between; align-items: center;
}
.live-text {
  padding: 16px; min-height: 88px; max-height: 200px; overflow-y: auto;
  line-height: 1.95; font-size: 15px; white-space: pre-wrap; word-break: break-word;
}
.live-text.placeholder { color: var(--ink-3); font-size: 13.5px; }
.live-text .interim { color: var(--ink-3); }
.live-text .final { color: var(--ink); }

.manual-input { margin-top: 18px; border: 1px dashed #e2e8f0; border-radius: 12px; padding: 12px 16px; }
.manual-input summary { font-size: 13px; color: var(--ink-3); cursor: pointer; }
.manual-input textarea {
  width: 100%; margin: 12px 0; padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px;
  font-family: inherit; font-size: 14px; line-height: 1.8; resize: vertical; outline: none;
}
.manual-input textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12); }

/* ---- 结果视图 ---- */
.result-layout { display: grid; grid-template-columns: 340px 1fr; gap: 22px; align-items: start; max-width: 1100px; margin: 0 auto; }
.result-summary { text-align: center; }
.score-ring-wrap { position: relative; width: 170px; margin: 8px auto 18px; }
.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #eef2ff; stroke-width: 10; }
.ring-progress {
  fill: none; stroke: url(#none) var(--primary); stroke-width: 10; stroke-linecap: round;
  stroke: var(--primary); stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.4s;
}
.ring-progress.pass { stroke: var(--success); }
.ring-progress.fail { stroke: var(--danger); }
.score-center {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 2px;
}
#scoreValue { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.score-unit { font-size: 14px; color: var(--ink-3); align-self: flex-end; margin-bottom: 10px; }

.verdict-badge {
  display: inline-block; padding: 8px 26px; border-radius: 999px;
  font-size: 15px; font-weight: 700; margin-bottom: 8px;
}
.verdict-pass { background: #d1fae5; color: #047857; }
.verdict-fail { background: #fee2e2; color: #b91c1c; }
.result-comment { font-size: 14px; color: var(--ink-2); line-height: 1.8; margin: 12px 4px 16px; }
.result-stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-chip {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 8px 13px; font-size: 12.5px; color: var(--ink-2);
}
.stat-chip b { font-size: 15px; margin-right: 2px; }
.stat-chip.good b { color: var(--success); }
.stat-chip.bad b { color: var(--danger); }
.stat-chip.warn b { color: var(--warn); }
.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* diff 视图 */
.result-detail { min-width: 0; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--ink-2); align-items: center; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.lg-equal { background: #e2e8f0; }
.lg-del { background: #fecaca; }
.lg-ins { background: #fde68a; }

.diff-view {
  line-height: 2.3; font-size: 16.5px; padding: 8px 4px;
  max-height: 46vh; overflow-y: auto; word-break: break-word;
}
.diff-equal { color: var(--ink); }
.diff-del {
  background: #fee2e2; color: #b91c1c; border-radius: 4px; padding: 1px 2px;
  text-decoration: line-through; text-decoration-color: rgba(185, 28, 28, 0.5);
}
.diff-ins {
  background: #fef3c7; color: #92400e; border-radius: 4px; padding: 1px 2px;
  border-bottom: 2px solid #f59e0b;
}

.ai-issues { margin-top: 20px; border-top: 1px dashed #e2e8f0; padding-top: 16px; }
.ai-issues h4 { font-size: 14.5px; margin-bottom: 12px; color: var(--ink); }
.issue-item {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
  padding: 13px 16px; margin-bottom: 10px; font-size: 13.5px; line-height: 1.75;
}
.issue-item .issue-sentence { color: var(--ink-2); }
.issue-item .issue-problem { color: #92400e; margin-top: 5px; font-weight: 500; }

/* ---- 弹窗 ---- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(30, 41, 59, 0.45); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 100; animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(480px, calc(100vw - 40px)); animation: modalUp 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes modalUp { from { transform: translateY(24px); opacity: 0; } }
.modal-body { padding: 6px 0 2px; }
.field-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; color: var(--ink-2); }
.text-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid #e2e8f0; border-radius: 12px;
  font-size: 14px; font-family: inherit; outline: none; transition: all 0.2s; margin-bottom: 10px;
}
.text-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12); }
.modal-footer { display: flex; justify-content: flex-end; margin-top: 18px; }
.settings-msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.settings-msg.ok { color: var(--success); }
.settings-msg.err { color: var(--danger); }

/* ---- Toast ---- */
.toast {
  position: fixed; top: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 24px; border-radius: 12px;
  font-size: 14px; z-index: 200; box-shadow: var(--shadow-lg); animation: toastIn 0.3s;
  max-width: 80vw;
}
.toast.err { background: var(--danger); }
@keyframes toastIn { from { transform: translate(-50%, -16px); opacity: 0; } }

/* ---- V1.1：自由文字输入 ---- */
.upload-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.upload-tab {
  flex: 1; padding: 11px 14px; border-radius: 12px; border: 1.5px solid #e2e8f0;
  background: #fff; font-size: 14px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.upload-tab:hover { border-color: var(--primary-light); }
.upload-tab.active {
  border-color: var(--primary); color: var(--primary-dark);
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
}
.text-panel { display: flex; flex-direction: column; gap: 12px; }
.text-panel textarea {
  width: 100%; padding: 16px; border: 1.5px solid #e2e8f0; border-radius: 14px;
  font-family: inherit; font-size: 15px; line-height: 1.9; resize: vertical;
  outline: none; min-height: 240px; background: #fff; transition: all 0.2s;
}
.text-panel textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12); }
.text-panel-footer { display: flex; justify-content: space-between; align-items: center; }

.header-btns { display: flex; gap: 8px; }

/* ---- V1.1：编辑弹窗 ---- */
.modal-wide { width: min(720px, calc(100vw - 40px)); }
.edit-textarea {
  width: 100%; padding: 14px; border: 1.5px solid #e2e8f0; border-radius: 12px;
  font-family: inherit; font-size: 15px; line-height: 1.9; resize: vertical;
  outline: none; min-height: 300px; margin-bottom: 10px;
}
.edit-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12); }
.modal-footer { gap: 10px; }

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

/* ---- V1.2：录制选项（栏式布局：左标题 + 居中开关） ---- */
.rec-box {
  border: 1px solid #e0e7ff; border-radius: 14px; overflow: hidden; margin-bottom: 16px;
  background: linear-gradient(180deg, #fbfcff, #f6f7ff);
}
.rec-box-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 18px; font-size: 13.5px; font-weight: 600; color: var(--primary-dark);
  background: rgba(238, 242, 255, 0.7); border-bottom: 1px solid #e0e7ff;
}
.rec-box-body {
  display: flex; justify-content: center; align-items: center; gap: 40px;
  padding: 14px 18px; flex-wrap: wrap;
}
.rec-opt { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch { position: relative; width: 40px; height: 22px; display: inline-block; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: 0.2s;
}
.slider::before {
  content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: 0.55; cursor: not-allowed; }
.rec-lock-hint { font-size: 12px; color: var(--warn); }

/* ---- V1.2：录制实时预览模块 ---- */
.capture-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0 18px; }
.capture-preview.single { grid-template-columns: 1fr; }
.cap-mod {
  border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; background: #0f172a;
}
.cap-mod.hidden { display: none; }
.cap-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; font-size: 12.5px; font-weight: 600; color: #e2e8f0;
  background: rgba(15, 23, 42, 0.92);
}
.cap-head .hint { color: #94a3b8; font-weight: 400; }
.cap-rec-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); margin-right: 6px; animation: blink 1.2s infinite;
}
.cap-mod video {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  background: #0f172a; transform: scaleX(-1); /* 自拍镜像，符合直觉 */
}
/* 单模块居中限宽，避免 16:9 在大屏上过高 */
.capture-preview.single .cap-mod { max-width: 640px; margin: 0 auto; width: 100%; }
.cap-mod canvas { width: 100%; height: 72px; display: block; }

/* ---- V1.2：保存对话框 ---- */
.save-wrap { margin-bottom: 16px; }
.save-wrap video {
  width: 100%; max-height: 46vh; border-radius: 12px; background: #0f172a; display: block;
}
.save-wrap audio { width: 100%; }
.save-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px;
}
.save-row .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 响应式 ---- */
@media (max-width: 980px) {
  .select-layout { grid-template-columns: 1fr; }
  .result-layout { grid-template-columns: 1fr; }
  .container { padding: 0 18px 50px; }
  .app-header { padding: 16px 18px; }
}
@media (max-width: 560px) {
  .mode-selector { grid-template-columns: 1fr; }
  .steps { gap: 4px; }
  .step { font-size: 12px; }

  /* ---- 移动端字体与紧凑布局修正 ---- */
  .app-header { padding: 12px 14px; gap: 8px; }
  .logo { gap: 10px; }
  .logo-icon { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; }
  .logo h1 { font-size: 18px; letter-spacing: 0; }
  .logo p { font-size: 11px; white-space: nowrap; }
  .key-status {
    font-size: 11px; padding: 5px 10px; max-width: 44vw;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .btn-icon { width: 36px; height: 36px; font-size: 16px; }

  .container { padding: 0 12px 40px; }
  .card { padding: 16px; }
  .card-header h3 { font-size: 15.5px; }
  .btn { white-space: nowrap; }
  .btn-small { padding: 5px 10px; font-size: 12px; }

  .upload-tab { font-size: 13px; padding: 10px 6px; white-space: nowrap; }
  .drop-zone { padding: 40px 16px; }
  .drop-zone h2 { font-size: 16px; }
  .drop-zone p { font-size: 13px; }

  .rec-box-header { padding: 9px 12px; font-size: 13px; }
  .rec-box-body { gap: 12px 20px; padding: 12px 10px; }
  .rec-opt { font-size: 13px; gap: 6px; }

  .original-header { flex-wrap: wrap; gap: 8px; padding: 10px 12px; font-size: 13px; }
  .original-header-right { gap: 8px; flex-wrap: wrap; }
  .peek-toggle { font-size: 12px; }
  .original-text { font-size: 15px; line-height: 1.9; padding: 14px; }

  .doc-content { font-size: 15px; line-height: 1.95; }
  .select-tip { font-size: 12.5px; }

  .mode-btn { padding: 12px 14px; }
  .mode-name { font-size: 14px; }
  .mic-btn { width: 72px; height: 72px; }
  .mic-svg { width: 30px; height: 30px; }
  .record-state { font-size: 13px; }
  .live-text { font-size: 14.5px; }

  .diff-view { font-size: 15.5px; line-height: 2.1; }
  #scoreValue { font-size: 36px; }
  .score-ring-wrap { width: 150px; }
  .result-stats { gap: 8px; }
  .stat-chip { font-size: 12px; padding: 6px 10px; }
  .result-comment { font-size: 13.5px; }
  .issue-item { font-size: 12.5px; }

  .modal { padding: 18px; }
  .save-row { flex-wrap: wrap; }
  .toast { font-size: 13px; max-width: 86vw; }
}
