/* 课堂笔记助手 · Liquid Glass 风格 */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #e9edf5;
  --orb-1: #ffb38a;
  --orb-2: #b69cff;
  --orb-3: #7cc8ff;
  --orb-4: #9ff0d0;

  --text: rgba(20, 22, 30, 0.92);
  --text-2: rgba(40, 44, 60, 0.62);
  --text-3: rgba(40, 44, 60, 0.42);

  --glass: rgba(255, 255, 255, 0.42);
  --glass-strong: rgba(255, 255, 255, 0.66);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-edge-dim: rgba(255, 255, 255, 0.22);
  --glass-shadow: 0 1px 1px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(40, 50, 90, 0.14);
  --fill: rgba(120, 125, 150, 0.12);
  --fill-hover: rgba(120, 125, 150, 0.2);
  --hairline: rgba(60, 60, 90, 0.1);

  --accent: #0a84ff;
  --accent-ink: #ffffff;
  --rec: #ff3b30;
  --star: #ff9f0a;
  --star-bg: rgba(255, 159, 10, 0.14);
  --ok: #30b158;
  --warn: #e8590c;

  --blur: blur(28px) saturate(185%);
  --r-xl: 30px;
  --r-lg: 22px;
  --r-md: 14px;
  --r-pill: 999px;
  --ease: cubic-bezier(0.2, 0.9, 0.25, 1.15);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* 深色：由 data-theme 决定（自动 / 浅色 / 深色，脚本根据选择和系统外观设置） */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0c0e16;
    --orb-1: #ff6b3d;
    --orb-2: #7b5cff;
    --orb-3: #1f8fff;
    --orb-4: #19c48e;
    --text: rgba(255, 255, 255, 0.94);
    --text-2: rgba(235, 238, 255, 0.62);
    --text-3: rgba(235, 238, 255, 0.4);
    --glass: rgba(36, 38, 52, 0.42);
    --glass-strong: rgba(48, 50, 66, 0.72);
    --glass-edge: rgba(255, 255, 255, 0.22);
    --glass-edge-dim: rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 16px 48px rgba(0, 0, 0, 0.45);
    --fill: rgba(255, 255, 255, 0.08);
    --fill-hover: rgba(255, 255, 255, 0.14);
    --hairline: rgba(255, 255, 255, 0.08);
    --star-bg: rgba(255, 159, 10, 0.16);
}
:root[data-theme="dark"] .orb { opacity: 0.42; }
:root[data-theme="dark"] .o4 { opacity: 0.3; }
:root { color-scheme: light; }
body { transition: background-color 0.4s ease, color 0.4s ease; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 16px 16px 112px;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- 背景：透过玻璃可见的彩色光斑 ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.75; will-change: transform; }
.o1 { width: 46vw; height: 46vw; left: -8vw; top: -10vw; background: var(--orb-1); animation: drift1 26s ease-in-out infinite alternate; }
.o2 { width: 40vw; height: 40vw; right: -6vw; top: 4vh; background: var(--orb-2); animation: drift2 30s ease-in-out infinite alternate; }
.o3 { width: 52vw; height: 52vw; left: 22vw; bottom: -26vw; background: var(--orb-3); animation: drift3 34s ease-in-out infinite alternate; }
.o4 { width: 26vw; height: 26vw; left: 6vw; bottom: 4vh; background: var(--orb-4); opacity: 0.55; animation: drift2 22s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(8vw, 6vh) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-6vw, 10vh) scale(0.94); } }
@keyframes drift3 { to { transform: translate(-10vw, -6vh) scale(1.1); } }

/* ---------- 液态玻璃基础材质 ---------- */
.glass {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-radius: var(--r-xl);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    inset 0 -1px 0 var(--glass-edge-dim),
    inset 1px 0 0 var(--glass-edge-dim),
    inset -1px 0 0 var(--glass-edge-dim),
    var(--glass-shadow);
  isolation: isolate;
}
/* 镜面高光：左上的一道光泽 */
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 60% at 10% 0%, rgba(255, 255, 255, 0.38), transparent 46%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.16), transparent 30%, transparent 75%, rgba(255, 255, 255, 0.08));
  mix-blend-mode: soft-light;
  z-index: -1;
}

/* ---------- 顶栏 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 8px 8px 16px;
  border-radius: var(--r-pill);
}
.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #ff6a55, #ff2d55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 4px 12px rgba(255, 45, 85, 0.35);
}
.brand-mark svg { width: 16px; height: 16px; stroke-width: 2.2; }
.brand-name { font-family: var(--font-display); font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.course-field { flex: 1; min-width: 0; }
.course-field input {
  width: 100%; height: 36px; padding: 0 16px; border: 0; outline: 0;
  border-radius: var(--r-pill); background: var(--fill); font-size: 14px;
  transition: background 0.2s, box-shadow 0.2s;
}
.course-field input:focus { background: var(--glass-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.course-field input::placeholder { color: var(--text-3); }
.toolbar-actions { display: flex; gap: 4px; flex: none; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px;
  border: 0; border-radius: var(--r-pill); background: transparent; cursor: pointer; font-size: 13.5px;
  color: var(--text-2); transition: background 0.2s, color 0.2s, transform 0.25s var(--ease);
}
.icon-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }

/* ---------- 双栏 ---------- */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px; min-height: 0; }
.pane { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.pane-head {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px 22px;
  border-bottom: 1px solid var(--hairline);
}
.pane-head h2 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.pane-actions { margin-left: auto; display: flex; gap: 6px; }
.pane-body { flex: 1; overflow-y: auto; padding: 14px 22px 22px; scroll-behavior: smooth; }
.pane-body::-webkit-scrollbar { width: 10px; }
.pane-body::-webkit-scrollbar-thumb { background: var(--fill-hover); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: var(--r-pill); background: var(--fill); font-size: 12px; color: var(--text-2);
}
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status-pill b { font-weight: 550; }
.status-pill[data-state="listening"] i { background: var(--rec); animation: blink 1.4s ease-in-out infinite; }
.status-pill[data-state="listening"] { color: var(--rec); background: color-mix(in srgb, var(--rec) 12%, transparent); }
.status-pill[data-state="reconnecting"] i { background: var(--star); }
.status-pill[data-state="error"] { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.status-pill[data-state="error"] i { background: var(--warn); }
@keyframes blink { 50% { opacity: 0.25; } }

.chip-btn {
  height: 28px; padding: 0 12px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: var(--fill); font-size: 12.5px; color: var(--text-2);
  transition: background 0.2s, color 0.2s, transform 0.25s var(--ease);
}
#pasteBtn { margin-left: auto; }
.chip-btn:hover:not(:disabled) { background: var(--fill-hover); color: var(--text); }
.chip-btn:active:not(:disabled) { transform: scale(0.94); }
.chip-btn:disabled { opacity: 0.4; cursor: default; }
.model-badge {
  font-size: 12px; color: var(--text-2); padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--fill); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%;
}

/* ---------- 转写 ---------- */
.lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.line {
  display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 7px 10px; margin: 0 -10px;
  border-radius: 12px; font-size: 15.5px; line-height: 1.6; animation: rise 0.45s var(--ease-out);
}
.line time { font: 500 11.5px/1.6 var(--mono); color: var(--text-3); padding-top: 3px; }
.line.emph { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.line.emph p::after { content: " 老师强调"; font-size: 11px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.line.star { background: var(--star-bg); box-shadow: inset 3px 0 0 var(--star); }
.line p { margin: 0; overflow-wrap: anywhere; }
.line.mark {
  grid-template-columns: 46px 1fr; font-size: 12.5px; color: var(--star); font-weight: 600;
  padding: 4px 10px; background: transparent;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.interim { margin: 6px 0 0 56px; font-size: 15.5px; line-height: 1.6; color: var(--text-3); min-height: 1.6em; }

.empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.empty-icon {
  width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; margin-bottom: 14px;
  background: var(--glass-strong); color: var(--rec);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 8px 24px rgba(40, 50, 90, 0.12);
}
.empty-icon svg { width: 28px; height: 28px; }
.empty-icon.spark { color: var(--accent); }
.empty-title { margin: 0 0 6px; font-family: var(--font-display); font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.empty-sub { margin: 0; font-size: 14px; line-height: 1.65; color: var(--text-2); }
.empty-sub.left { text-align: left; margin-bottom: 12px; }
.empty .primary-btn { margin-top: 18px; }

/* ---------- 笔记 Markdown ---------- */
.md { font-size: 15px; line-height: 1.75; }
.md:empty { display: none; }
.md h1, .md h2, .md h3 { font-family: var(--font-display); letter-spacing: -0.015em; line-height: 1.35; }
.md h1 { font-size: 22px; margin: 6px 0 12px; }
.md h2 {
  font-size: 17px; margin: 22px 0 8px; padding: 6px 12px; border-radius: 12px;
  background: var(--fill); display: inline-block;
}
.md h3 { font-size: 15.5px; margin: 16px 0 6px; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li.lv1 { margin-left: 18px; } .md li.lv2 { margin-left: 36px; } .md li.lv3 { margin-left: 54px; }
.md strong { font-weight: 650; }
.md code { font: 13px var(--mono); background: var(--fill); padding: 1px 6px; border-radius: 6px; }
.md pre { background: var(--fill); padding: 12px 14px; border-radius: var(--r-md); overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 8px 0; padding: 8px 14px; border-radius: 12px; background: var(--star-bg); box-shadow: inset 3px 0 0 var(--star); }
.md hr { border: 0; height: 1px; background: var(--hairline); margin: 18px 0; }
.md .math-block { margin: 10px 0; overflow-x: auto; white-space: pre-wrap; }
.md .table-wrap { overflow-x: auto; margin: 10px 0; border-radius: var(--r-md); background: var(--fill); }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.md th { font-weight: 650; }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.md.streaming > :last-child::after {
  content: ""; display: inline-block; width: 8px; height: 1.05em; margin-left: 3px; vertical-align: -2px;
  border-radius: 3px; background: var(--accent); animation: blink 1s steps(2) infinite;
}
.thinking { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; padding: 6px 0; }
.thinking i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: 0.15s; } .thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 50% { transform: scale(0.5); opacity: 0.4; } }
.error-card {
  padding: 14px 16px; border-radius: var(--r-lg); font-size: 14px; line-height: 1.6;
  background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text);
  box-shadow: inset 3px 0 0 var(--warn);
}
.error-card b { color: var(--warn); }

/* ---------- 底部悬浮控制条 ---------- */
.dock {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 8px;
  border-radius: var(--r-pill); z-index: 5;
}
.lang-select select {
  appearance: none; -webkit-appearance: none; height: 44px; padding: 0 30px 0 16px; border: 0; cursor: pointer;
  border-radius: var(--r-pill); background: var(--fill); font-size: 14px; outline: 0;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 19px, calc(100% - 11px) 19px; background-size: 5px 5px; background-repeat: no-repeat;
}
.dock-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 16px; border: 0; cursor: pointer;
  border-radius: var(--r-pill); background: var(--fill); font-size: 14px; font-weight: 550;
  transition: background 0.2s, transform 0.3s var(--ease), opacity 0.2s;
}
.dock-btn:hover:not(:disabled) { background: var(--fill-hover); }
.dock-btn:active:not(:disabled) { transform: scale(0.93); }
.dock-btn:disabled { opacity: 0.38; cursor: default; }
#markBtn:not(:disabled) { color: var(--star); }
#markBtn:not(:disabled) svg { fill: color-mix(in srgb, var(--star) 30%, transparent); }
#markBtn.pop { animation: pop 0.5s var(--ease); }
@keyframes pop { 40% { transform: scale(1.12); } }
.dock-btn.accent {
  color: var(--accent-ink);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, white), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}
.dock-btn.accent:hover:not(:disabled) { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 70%, white), var(--accent)); }
.timer { min-width: 58px; text-align: center; font: 600 15px var(--mono); font-variant-numeric: tabular-nums; color: var(--text-2); }
.recording .timer { color: var(--rec); }

.rec-btn {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; padding: 0; margin: -6px 2px;
  display: grid; place-items: center; position: relative;
  background: var(--glass-strong);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 0 0 1px var(--hairline), 0 6px 20px rgba(40, 50, 90, 0.18);
  transition: transform 0.35s var(--ease);
}
.rec-btn:hover { transform: scale(1.05); }
.rec-btn:active { transform: scale(0.92); }
.rec-core {
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a80, var(--rec) 60%, #d70015);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.55), 0 2px 8px rgba(255, 59, 48, 0.45);
  transition: border-radius 0.4s var(--ease), width 0.4s var(--ease), height 0.4s var(--ease);
}
.rec-btn[aria-pressed="true"] .rec-core { width: 24px; height: 24px; border-radius: 7px; }
.rec-btn[aria-pressed="true"]::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--rec); opacity: 0.6; animation: ring 1.8s ease-out infinite;
}
@keyframes ring { from { transform: scale(0.92); opacity: 0.7; } to { transform: scale(1.25); opacity: 0; } }

/* ---------- 弹出面板 ---------- */
dialog.sheet {
  width: min(620px, calc(100vw - 32px)); max-height: min(86vh, 860px); padding: 0; border: 0; color: var(--text);
  background: var(--glass-strong); overflow: hidden;
}
dialog.sheet[open] { animation: sheetIn 0.45s var(--ease-out); }
dialog::backdrop { background: rgba(10, 14, 30, 0.22); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(18px) scale(0.97); } }
.sheet-inner { max-height: inherit; overflow-y: auto; padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 18px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.close-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; background: var(--fill);
  font-size: 20px; line-height: 1; color: var(--text-2);
}
.close-btn:hover { background: var(--fill-hover); color: var(--text); }
.step { display: flex; flex-direction: column; gap: 10px; }
.step-label { margin: 0; display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; }
.step-label span {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px;
  color: #fff; background: var(--accent);
}
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.provider {
  text-align: left; padding: 11px 13px; border: 0; border-radius: var(--r-md); cursor: pointer; background: var(--fill);
  display: flex; flex-direction: column; gap: 3px; transition: background 0.2s, box-shadow 0.2s, transform 0.25s var(--ease);
}
.provider:hover { background: var(--fill-hover); }
.provider:active { transform: scale(0.97); }
.provider[aria-checked="true"] { background: var(--glass-strong); box-shadow: 0 0 0 2px var(--accent), 0 6px 16px rgba(10, 132, 255, 0.16); }
.provider .p-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.provider b { font-size: 14.5px; }
.provider small { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.tag { font-size: 10.5px; font-weight: 650; padding: 2px 7px; border-radius: var(--r-pill); white-space: nowrap; }
.tag.cn { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.tag.intl { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.tag.any { color: var(--text-2); background: var(--fill); }
.key-row, .model-tools { display: flex; gap: 8px; align-items: center; }
.key-row input, .model-tools input, .field input, .field textarea, #pasteInput {
  flex: 1; width: 100%; height: 40px; padding: 0 14px; border: 0; outline: 0; border-radius: 12px;
  background: var(--fill); font-size: 14px; font-family: var(--mono);
  transition: box-shadow 0.2s, background 0.2s;
}
.field textarea, #pasteInput { height: auto; padding: 10px 14px; font-family: var(--font); line-height: 1.6; resize: vertical; }
input:focus, textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.key-row .chip-btn, .model-tools .chip-btn { height: 40px; padding: 0 14px; border-radius: 12px; white-space: nowrap; }
.key-link { font-size: 13px; color: var(--accent); text-decoration: none; width: fit-content; }
.key-link:hover { text-decoration: underline; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.model-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto; }
.model {
  border: 0; cursor: pointer; padding: 8px 12px; border-radius: 12px; background: var(--fill); text-align: left;
  display: flex; flex-direction: column; gap: 1px; transition: background 0.2s, box-shadow 0.2s;
}
.model:hover { background: var(--fill-hover); }
.model[aria-checked="true"] { background: var(--glass-strong); box-shadow: 0 0 0 2px var(--accent); }
.model b { font: 600 13px var(--mono); }
.model small { font-size: 11.5px; color: var(--text-2); }
.test-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.test-result { font-size: 13.5px; }
.test-result.ok { color: var(--ok); } .test-result.bad { color: var(--warn); }
.primary-btn {
  height: 42px; padding: 0 20px; border: 0; border-radius: var(--r-pill); cursor: pointer; font-weight: 600; font-size: 14.5px;
  color: var(--accent-ink); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, white), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.3s var(--ease), filter 0.2s;
}
.primary-btn:hover { filter: brightness(1.06); }
.primary-btn:active { transform: scale(0.95); }
.primary-btn:disabled { opacity: 0.5; cursor: default; }
.primary-btn.wide { width: 100%; }
.advanced summary { cursor: pointer; font-size: 14px; color: var(--text-2); padding: 4px 0; }
.advanced[open] { display: flex; flex-direction: column; gap: 14px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.switch-row small { color: var(--text-2); font-size: 12px; }
.switch {
  appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: var(--r-pill); flex: none; cursor: pointer;
  background: var(--fill-hover); position: relative; transition: background 0.25s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); transition: transform 0.35s var(--ease);
}
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }
.sheet-foot { padding-top: 2px; }

.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.history-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--fill);
}
.history-item button.open { flex: 1; text-align: left; border: 0; background: none; cursor: pointer; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.history-item b { font-size: 14.5px; }
.history-item small { font-size: 12px; color: var(--text-2); }
.history-item:hover { background: var(--fill-hover); }
.history-item .del { border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 13px; padding: 6px 8px; border-radius: 8px; }
.history-item .del:hover { color: var(--warn); background: var(--fill); }

.toast {
  position: fixed; left: 50%; top: 84px; transform: translate(-50%, calc(-100% - 100px)); padding: 11px 20px;
  border-radius: var(--r-pill); font-size: 14px; font-weight: 550; z-index: 20; max-width: calc(100vw - 32px);
  background: var(--glass-strong); transition: transform 0.5s var(--ease); pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- 顶部通知条（新版本 / 备份提醒） ---------- */
.notice {
  position: fixed; left: 50%; bottom: 104px; z-index: 15; display: flex; align-items: center; gap: 10px;
  max-width: min(720px, calc(100vw - 32px)); padding: 8px 8px 8px 18px; border-radius: var(--r-pill);
  background: var(--glass-strong); transform: translate(-50%, 40px) scale(0.96); opacity: 0;
  transition: transform 0.55s var(--ease), opacity 0.3s ease; pointer-events: none;
}
.notice.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; box-shadow: var(--glass-shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.notice p { margin: 0; font-size: 14px; font-weight: 550; flex: 1; min-width: 0; }
.notice .chip-btn, .notice .primary-btn { flex: none; }
.primary-btn.small { height: 32px; padding: 0 16px; font-size: 13.5px; }

/* 工具栏按钮上的小圆点（同步状态） */
.icon-btn { position: relative; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; box-shadow: 0 0 0 2px var(--glass-strong); }
#dataDot[data-state="off"] { display: none; }
#dataDot[data-state="ok"], #dataDot[data-state="idle"] { background: var(--ok); }
#dataDot[data-state="syncing"] { background: var(--accent); animation: blink 1s ease-in-out infinite; }
#dataDot[data-state="error"], #dataDot[data-state="warn"] { background: var(--star); }

/* ---------- 分段切换（笔记 / 实时提问） ---------- */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-pill); background: var(--fill);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}
.segmented button {
  position: relative; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer;
  height: 30px; padding: 0 14px; border-radius: var(--r-pill); font: 600 14px var(--font-display); color: var(--text-2);
  transition: background 0.25s ease, color 0.2s ease, transform 0.2s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button:active { transform: scale(0.95); }
.segmented button[aria-selected="true"] {
  background: var(--glass-strong); color: var(--text);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06), 0 3px 10px rgba(40, 50, 90, 0.12), inset 0 1px 0 var(--glass-edge);
}
.segmented .dot { background: var(--rec); }

/* ---------- 实时提问 ---------- */
.qa-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.qa-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.qa-item { display: flex; flex-direction: column; gap: 8px; animation: rise 0.45s var(--ease-out); }
.qa-q { align-self: flex-end; max-width: 86%; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.qa-q p {
  margin: 0; padding: 9px 15px; border-radius: 20px 20px 6px 20px; font-size: 15px; line-height: 1.55;
  color: var(--accent-ink); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, white), var(--accent));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent); overflow-wrap: anywhere; white-space: pre-wrap;
}
.qa-q time { font: 500 11px var(--mono); color: var(--text-3); padding-right: 6px; }
.qa-a {
  align-self: flex-start; max-width: 100%; padding: 10px 16px; border-radius: 6px 20px 20px 20px;
  background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--glass-edge), 0 2px 10px rgba(40, 50, 90, 0.08);
}
.qa-a > :first-child { margin-top: 0; }
.qa-a > :last-child { margin-bottom: 0; }
.qa-a.qa-error { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--warn); }
.qa-a.qa-error p { margin: 0; }

.qa-composer { flex: none; padding: 10px 14px 14px; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 8px; }
.qa-quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.qa-quick::-webkit-scrollbar { display: none; }
.qa-quick .chip-btn { flex: none; white-space: nowrap; }
.qa-row {
  display: flex; align-items: flex-end; gap: 8px; padding: 5px 5px 5px 16px; border-radius: 22px;
  background: var(--fill); transition: background 0.2s, box-shadow 0.2s;
}
.qa-row:focus-within { background: var(--glass-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.qa-row textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; resize: none; color: var(--text);
  font: 15px/1.5 var(--font); padding: 7px 0; max-height: 140px;
}
.qa-row textarea::placeholder { color: var(--text-3); }
.qa-row textarea:focus-visible { outline: none; }
.send-btn {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  color: #fff; background: var(--accent); transition: transform 0.25s var(--ease), opacity 0.2s, background 0.2s;
}
.send-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.send-btn .i-stop { display: none; fill: currentColor; stroke: none; }
.send-btn.stop { background: var(--text-2); }
.send-btn.stop .i-send { display: none; }
.send-btn.stop .i-stop { display: block; }
.send-btn:hover:not(:disabled) { transform: scale(1.07); }
.send-btn:active:not(:disabled) { transform: scale(0.9); }
.send-btn:disabled { opacity: 0.35; cursor: default; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 备份与同步 ---------- */
.data-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--fill); }
.data-card h3 { margin: 0; font: 650 16px var(--font-display); letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.data-card h3 small { font: 500 12px var(--font); color: var(--text-2); }
.data-card .history-item { background: var(--glass-strong); }
.data-card .history-item .open { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.btn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.code-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-md); background: var(--glass-strong); }
.code-box span { font-size: 13px; color: var(--text-2); }
.code-box b { font: 650 17px var(--mono); letter-spacing: 0.06em; flex: 1; min-width: 200px; }
.hint { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--text-2); }
.sync-status { flex: 1; min-width: 160px; font-size: 13.5px; color: var(--text-2); }
.sync-status.ok { color: var(--ok); }
.sync-status.error { color: var(--warn); }

/* ---------- 窄屏 ---------- */
@media (max-width: 860px) {
  body { overflow: auto; height: auto; min-height: 100%; }
  .stage { grid-template-columns: 1fr; }
  .pane { min-height: 46vh; }
  .icon-btn span, .brand-name { display: none; }
  .dock { gap: 6px; width: calc(100vw - 24px); justify-content: space-between; }
  .dock-btn span { display: none; }
  .lang-select select { padding: 0 26px 0 12px; }
  .notice { bottom: 96px; border-radius: var(--r-lg); flex-wrap: wrap; }
  .segmented button { padding: 0 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
