/* ===========================================================
   基于DeepSeek的AI智能教学工作台 —— 设计系统
   =========================================================== */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --ink: #16202e;
  --ink-2: #55637a;
  --ink-3: #8492a9;
  --line: #e3e8f2;
  --line-2: #eef1f8;
  --accent: #3b5bdb;
  --accent-2: #2f49b0;
  --accent-soft: #eef2ff;
  --ok: #15803d;
  --ok-soft: #eafaf0;
  --warn: #b45309;
  --warn-soft: #fef6e7;
  --err: #c62828;
  --err-soft: #fdecec;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(22, 32, 46, .06), 0 1px 3px rgba(22, 32, 46, .04);
  --shadow-2: 0 4px 16px rgba(22, 32, 46, .08), 0 1px 4px rgba(22, 32, 46, .04);
  --shadow-3: 0 18px 48px rgba(22, 32, 46, .18);
  --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC",
          system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }
a { color: var(--accent); }

/* ---------------- 布局 ---------------- */

#app {
  display: flex;
  min-height: 100%;
}

.sidebar {
  width: 246px;
  flex: 0 0 246px;
  background: #101a2e;
  color: #c8d3e8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.brand-title .dot { margin-top: 6px; flex: none; }

/* 两段各自不可再拆，宽度不够时在两段之间换行（整块由 .brand-name 承载） */
.brand-name { min-width: 0; }
.brand-part { display: inline-block; }

.brand-title .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, #6b8cff, #48e0c8);
  box-shadow: 0 0 10px rgba(107, 140, 255, .8);
}

.brand-sub {
  font-size: 12px;
  color: #7b8aa5;
  margin-top: 4px;
}

.nav { padding: 12px 10px; flex: 1; }

.nav-group-title {
  font-size: 11px;
  letter-spacing: 1.4px;
  color: #64748f;
  padding: 14px 10px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: #b9c6dd;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.nav-item.active {
  background: linear-gradient(135deg, #3b5bdb, #4f6ee8);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 91, 219, .4);
}

.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-foot {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-foot .nav-item { font-size: 13px; }

.key-state {
  font-size: 11px;
  padding: 6px 12px;
  color: #7b8aa5;
  display: flex;
  align-items: center;
  gap: 6px;
}

.key-state .led {
  width: 7px; height: 7px; border-radius: 50%; background: #ef4444;
}
.key-state.ok .led { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, .8); }

/* ---------------- 主区域 ---------------- */

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

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-main { min-width: 0; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.topbar-home { flex: none; }

.topbar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
}

.topbar .sub {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 2px;
}

.view { padding: 22px 28px 60px; }

/* ---------------- 面板 ---------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.panel-title { font-size: 15.5px; margin: 0; font-weight: 700; }
.panel-desc { font-size: 12.5px; color: var(--ink-3); margin: 3px 0 0; }
.panel-body { padding: 18px 20px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel-hint { font-size: 12.5px; color: var(--ink-3); margin-top: 10px; }
.output-body { min-height: 120px; }

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) { border-color: #c9d3e6; background: #f8faff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4f6ee8);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(59, 91, 219, .3);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #3450c8, #4463dd); }

.btn-ghost { background: var(--surface); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b71c1c; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { font-size: 14px; line-height: 1; }

/* ---------------- 表单 ---------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.form-grid.form-single { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-optional {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 400;
  background: var(--line-2);
  padding: 1px 6px;
  border-radius: 4px;
}

.field-hint { font-size: 12px; color: var(--ink-3); }

/* ---------------- 语音输入 ---------------- */

.input-wrap { position: relative; display: block; }

/* 给右侧的麦克风让出位置 */
.input-wrap .input { padding-right: 44px; }

.mic-btn {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-3);
  transition: background .15s, color .15s;
}

.mic-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.mic-btn:disabled { opacity: .4; cursor: not-allowed; }

.mic-btn.listening {
  background: #fdecec;
  color: #d32f2f;
  border-color: #f5b5b5;
  animation: mic-pulse 1.3s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(211, 47, 47, .35); }
  50% { box-shadow: 0 0 0 7px rgba(211, 47, 47, 0); }
}

.mic-status {
  font-size: 12px;
  color: #d32f2f;
  min-height: 0;
}

.mic-status:not(:empty) { margin-top: 5px; }

.mic-status:not(:empty)::before {
  content: '🎤 ';
}

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 91, 219, .12);
}

textarea.input { resize: vertical; line-height: 1.6; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }

.chip-body {
  display: flex;
  flex-direction: column;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 13px;
  background: var(--surface);
  transition: all .15s;
}

.chip-desc { font-size: 11px; color: var(--ink-3); }

.chip input:checked + .chip-body {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 600;
}
.chip input:checked + .chip-body .chip-desc { color: var(--accent-2); opacity: .75; }

/* ---------------- 运行状态 ---------------- */

.run-status { font-size: 13px; color: var(--ink-3); }
.run-status > span { display: inline-flex; align-items: center; gap: 6px; }
.run-status:not(:empty) { margin-bottom: 12px; }
.run-status-busy { color: var(--accent); }
.run-status-error { color: var(--err); }
.run-status-done { color: var(--ink-3); display: flex; gap: 14px; flex-wrap: wrap; }
.run-ok { color: var(--ok); }
.run-warn { color: var(--warn); }
.run-error { color: var(--err); }

.spinner {
  width: 13px; height: 13px;
  border: 2px solid rgba(59, 91, 219, .25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

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

.stream-cursor {
  display: inline-block;
  width: 8px; height: 17px;
  background: var(--accent);
  vertical-align: -3px;
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}

/* 代码类模块生成时，把模型正在写的原文实时滚出来。
   成品（图形/游戏）要等代码写完才能画，但也不能让人对着空白等。 */
.stream-raw {
  margin: 0;
  max-height: 46vh;
  overflow-y: auto;
  background: #0f172a;
  color: #cbd8ee;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  overscroll-behavior: contain;
}

@keyframes blink { 50% { opacity: 0; } }

/* ---------------- 文档排版（生成结果） ---------------- */

.doc { font-size: 15px; line-height: 1.85; color: var(--ink); }
.doc > *:first-child { margin-top: 0; }

.doc h2.md-h1 {
  font-size: 20px;
  margin: 26px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-soft);
}
.doc h3.md-h2 {
  font-size: 17px;
  margin: 22px 0 10px;
  color: var(--accent-2);
  padding-left: 10px;
  border-left: 4px solid var(--accent);
}
.doc h4.md-h3 { font-size: 15.5px; margin: 18px 0 8px; color: var(--ink); }
.doc h5.md-h4, .doc h6.md-h5, .doc h6.md-h6 { font-size: 14.5px; margin: 14px 0 6px; }

.doc p.md-p { margin: 10px 0; }
.doc strong { color: #0f172a; font-weight: 700; }
.doc del { color: var(--ink-3); }

.doc ul.md-list, .doc ol.md-list { margin: 8px 0; padding-left: 24px; }
.doc li { margin: 5px 0; }
.doc li > ul, .doc li > ol { margin: 4px 0; }

.md-quote {
  margin: 12px 0;
  padding: 10px 16px;
  border-left: 4px solid #c7d2fe;
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
}

.md-hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

.md-table-wrap { overflow-x: auto; margin: 14px 0; }

.md-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

.md-table th, .md-table td {
  border: 1px solid var(--line);
  padding: 8px 11px;
  text-align: left;
  vertical-align: top;
}

.md-table th { background: var(--surface-2); font-weight: 700; color: var(--ink-2); }
.md-table tbody tr:nth-child(even) { background: #fcfdff; }

.md-code {
  background: #0f172a;
  color: #d6e2f5;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  margin: 12px 0;
}

.md-inline-code {
  background: var(--accent-soft);
  color: var(--accent-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .9em;
}

/* ---------------- 公式 ---------------- */

.tex { font-family: "Cambria Math", "Latin Modern Math", "Times New Roman", var(--font); letter-spacing: .2px; }

.tex-block {
  display: block;
  text-align: center;
  margin: 14px 0;
  font-size: 1.12em;
  overflow-x: auto;
}

.tex-frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  margin: 0 .18em;
  font-size: .94em;
  line-height: 1.15;
}

.tex-num { padding: 0 .3em; border-bottom: 1.4px solid currentColor; }
.tex-den { padding: 0 .3em; }

.tex-sqrt { display: inline-block; }
.tex-rad { border-top: 1.4px solid currentColor; padding: 0 .12em; margin-left: -.06em; }
.tex-root-index { font-size: .62em; margin-right: -0.5em; vertical-align: .55em; }

.tex-overline { border-top: 1.3px solid currentColor; padding-top: 1px; }
.tex-text { font-family: var(--font); font-style: normal; }
.tex sup, .tex sub { font-size: .7em; }

/* 试卷模式：答案区默认折叠 */
.answer-part.answer-hidden { display: none; }

/* ---------------- 课件库 ---------------- */

.lib-list { display: flex; flex-direction: column; gap: 8px; }

.lib-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.lib-item:hover { border-color: #c9d3e6; box-shadow: var(--shadow-1); }

.lib-main { flex: 1; min-width: 0; }
.lib-title { font-weight: 600; font-size: 14px; }
.lib-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.lib-actions { display: flex; gap: 6px; }

.empty {
  text-align: center;
  color: var(--ink-3);
  padding: 44px 20px;
  font-size: 14px;
}
.empty .big { font-size: 34px; display: block; margin-bottom: 10px; opacity: .5; }

/* ---------------- 预览 ---------------- */

/* 小游戏等互动内容的预览框。
   高度由 previewPanel 里的高度上报脚本动态设定（见 ui.js），
   目的是让内容完整显示，不出现框内滚动条。 */
.preview-frame {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  display: block;
}

.preview-panel { margin-top: 4px; }

.preview-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 14px 0 10px;
  flex-wrap: wrap;
}

/* 生成的 SVG 图形：整张完整显示，不让它溢出成滚动条。
   max-width 与 max-height 同时给，SVG 带有 viewBox（内含宽高比），
   浏览器会按比例缩放到能放下的最大尺寸。 */
.svg-stage {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.svg-stage svg {
  max-width: 100%;
  max-height: 68vh;
  width: auto;
  height: auto;
  display: block;
}

/* ---------------- 试卷上传 ---------------- */

.upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 24px 18px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-zone-disabled {
  opacity: .55;
  pointer-events: none;
}

.upload-zone-icon { font-size: 34px; line-height: 1; }

.upload-zone-title {
  font-weight: 700;
  margin-top: 8px;
}

.upload-zone-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 5px;
  line-height: 1.7;
}

.upload-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.upload-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.upload-thumb-index {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(16, 26, 46, .72);
  color: #fff;
  font-size: 11px;
}

.thumb-remove {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(16, 26, 46, .72);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-remove:hover { background: var(--err); }

.score-form { margin-top: 16px; }

/* 生成的配图：完整显示，不出现内部滚动条 */
.image-stage {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.image-stage img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}

/* 生成的视频：完整显示，不出现内部滚动条 */
.video-stage {
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.video-result {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 70vh;
  margin: 0 auto;
  border-radius: 8px;
  background: #000;
}

/* ---------------- 弹窗 ---------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 46, .48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  opacity: 0;
  transition: opacity .18s;
}

.modal-overlay.show { opacity: 1; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 660px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-3);
  transform: translateY(8px) scale(.99);
  transition: transform .18s;
}

.modal-overlay.show .modal { transform: none; }
.modal-wide { max-width: 900px; }
.modal-narrow { max-width: 420px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
}

.modal-title { font-size: 16px; margin: 0; font-weight: 700; }

.modal-close {
  border: none;
  background: none;
  font-size: 16px;
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--line-2); color: var(--ink); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-text { margin: 0; color: var(--ink-2); }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line-2);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------------- 提示条 ---------------- */

#toastRoot {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.toast {
  background: #16202e;
  color: #eef2ff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  box-shadow: var(--shadow-2);
  max-width: 400px;
  opacity: 0;
  transform: translateY(10px);
  transition: all .22s;
  border-left: 3px solid #64748f;
}

.toast-in { opacity: 1; transform: none; }
.toast-error { border-left-color: #ef4444; }
.toast-ok { border-left-color: #22c55e; }
.toast-warn { border-left-color: #f59e0b; }

/* ---------------- 全屏演示 ---------------- */

.fs-overlay {
  position: fixed;
  inset: 0;
  background: #0b1220;
  z-index: 300;
  display: flex;
  flex-direction: column;
}

.fs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  color: #c8d3e8;
  font-size: 14px;
  background: rgba(255, 255, 255, .05);
  opacity: .35;
  transition: opacity .2s;
}

.fs-bar:hover { opacity: 1; }
.fs-frame { flex: 1; border: none; background: #fff; }

/* ---------------- 视频录制 ---------------- */

.rec-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.rec-progress {
  flex: 1;
  min-width: 160px;
  height: 8px;
  background: var(--line-2);
  border-radius: 5px;
  overflow: hidden;
}

.rec-progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #48e0c8);
  transition: width .1s linear;
}

.rec-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulse 1s infinite;
  display: inline-block;
}

@keyframes pulse { 50% { opacity: .25; } }

/* ---------------- AI 语音对话 ---------------- */

.vc-statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.vc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b6c1d6;
  flex: none;
}

.vc-dot-connecting { background: #f59e0b; animation: vc-blink 1s infinite; }
.vc-dot-ready { background: #22c55e; }
.vc-dot-mic-ready { background: #22c55e; }
.vc-dot-user-speaking { background: #3b5bdb; animation: vc-blink .7s infinite; }
.vc-dot-speaking { background: #0e9488; animation: vc-blink 1s infinite; }
.vc-dot-closed { background: #b6c1d6; }

@keyframes vc-blink { 50% { opacity: .3; } }

.vc-status-text { flex: none; }

.vc-level {
  flex: 1;
  height: 6px;
  min-width: 60px;
  background: var(--line-2);
  border-radius: 4px;
  overflow: hidden;
}

.vc-level > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3b5bdb, #48e0c8);
  transition: width .08s linear;
}

.vc-settings {
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--surface);
}

.vc-settings > summary {
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 600;
}

.vc-settings-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  margin-top: 14px;
}

.vc-transcript {
  min-height: 220px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 8px 2px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--surface-2);
}

.vc-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 78%;
}

.vc-msg-user { align-self: flex-end; align-items: flex-end; }
.vc-msg-ai { align-self: flex-start; }

.vc-msg-who {
  font-size: 11.5px;
  color: var(--ink-3);
  padding: 0 4px;
}

.vc-msg-text {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.vc-msg-user .vc-msg-text {
  background: linear-gradient(135deg, var(--accent), #4f6ee8);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.vc-msg-ai .vc-msg-text {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

/* 还在识别/生成中的气泡，加个闪动提示 */
.vc-msg:not(.vc-msg-done) .vc-msg-text::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 3px;
  vertical-align: -2px;
  background: currentColor;
  opacity: .5;
  animation: vc-blink 1s step-end infinite;
}

.vc-log {
  margin-top: 14px;
  font-size: 12.5px;
}

.vc-log > summary {
  cursor: pointer;
  color: var(--ink-3);
}

.vc-log-body {
  margin: 10px 0 0;
  max-height: 180px;
  overflow-y: auto;
  background: #0f172a;
  color: #cbd8ee;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.vc-steps {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.9;
}

/* ---------------- 设置 ---------------- */

.settings-row { margin-bottom: 20px; }
.settings-row label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.settings-note { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.65; }

.self-test-log {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: #0f172a;
  color: #d6e2f5;
  padding: 14px;
  border-radius: var(--radius-sm);
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.7;
}

/* ---------------- 首页 ---------------- */

body.at-home .sidebar,
body.at-home .topbar { display: none; }

body.at-home .view { padding: 0; }

.home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 28px 56px;
  background:
    radial-gradient(1200px 520px at 12% -8%, #e8eeff 0%, rgba(232, 238, 255, 0) 62%),
    radial-gradient(900px 460px at 92% 108%, #e2f7f3 0%, rgba(226, 247, 243, 0) 60%),
    var(--bg);
}

.home-hero { text-align: center; margin-bottom: 38px; }

.home-hero-icon {
  font-size: 46px;
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 6px 14px rgba(59, 91, 219, .22));
}

.home-hero-title {
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: 1px;
  color: #101a2e;
}

.home-hero-sub { margin: 0; color: var(--ink-3); font-size: 14px; letter-spacing: 2px; }

/* ---------------- 首页专属铭牌（金条质感） ---------------- */

.home-exclusive {
  display: flex;
  justify-content: center;
  margin-top: 24px;
  perspective: 900px;
}

.home-exclusive-plate {
  position: relative;
  filter:
    drop-shadow(0 14px 24px rgba(120, 82, 8, .24))
    drop-shadow(0 2px 2px rgba(60, 40, 0, .2));
}

.home-exclusive-bar {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 15px;
  padding: 10px 26px 11px 22px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 242, 170, .62);
  border-radius: 2px;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%,
    calc(100% - 14px) 100%, 14px 100%, 0 50%);
  background:
    repeating-linear-gradient(0deg,
      rgba(255, 255, 255, .09) 0 1px,
      rgba(60, 38, 0, .045) 1px 3px),
    linear-gradient(104deg,
      #6b4909 0%, #9d7018 7%, #efd477 16%, #c6972a 25%,
      #7d560c 34%, #f8e69c 45%, #d3a83d 55%, #87600f 65%,
      #f2d97f 76%, #b2821f 86%, #6a4808 94%, #513505 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 214, .92),
    inset 0 -2px 3px rgba(70, 45, 0, .55),
    inset 2px 0 3px rgba(255, 246, 190, .32),
    inset -2px 0 3px rgba(70, 45, 0, .34);
}

/* 顶部高光棱线 */
.home-exclusive-bar::before {
  content: '';
  position: absolute;
  left: 9%;
  right: 9%;
  top: 2px;
  height: 1.5px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, .95) 18%,
    rgba(255, 255, 255, .3) 50%,
    rgba(255, 255, 255, .95) 82%,
    transparent);
  opacity: .85;
  pointer-events: none;
}

/* 金属流光扫过 */
.home-exclusive-bar::after {
  content: '';
  position: absolute;
  top: -70%;
  bottom: -70%;
  left: -55%;
  width: 40%;
  background: linear-gradient(104deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, .12) 34%,
    rgba(255, 255, 255, .95) 50%,
    rgba(255, 255, 255, .12) 66%,
    rgba(255, 255, 255, 0) 100%);
  transform: translateX(-40%) skewX(-18deg);
  animation: gold-sheen 4.8s cubic-bezier(.45, .05, .55, .95) infinite;
  mix-blend-mode: screen;
  pointer-events: none;
}

@keyframes gold-sheen {
  0%, 10% { transform: translateX(-40%) skewX(-18deg); opacity: 0; }
  16% { opacity: .95; }
  46% { transform: translateX(430%) skewX(-18deg); opacity: .95; }
  58%, 100% { transform: translateX(430%) skewX(-18deg); opacity: 0; }
}

.home-exclusive-plate:hover .home-exclusive-bar::after {
  animation-duration: 2.4s;
}

.home-exclusive-plate:hover {
  filter:
    drop-shadow(0 16px 28px rgba(150, 105, 12, .35))
    drop-shadow(0 2px 2px rgba(60, 40, 0, .22));
}

/* 金条钢印 */
.home-exclusive-stamp {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 34% 26%,
    #fffbe0 0%, #f4db83 28%, #d0a536 55%, #906413 78%, #5e3f06 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 247, 196, .9),
    inset 0 0 0 3px rgba(94, 63, 6, .28),
    inset 0 -3px 5px rgba(70, 45, 0, .5),
    inset 0 2px 2px rgba(255, 255, 230, .75),
    0 1px 2px rgba(60, 40, 0, .35);
  color: #402a03;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 250, 210, .8);
}

.home-exclusive-stamp b {
  font-size: 11px;
  letter-spacing: .06em;
  font-weight: 900;
}

.home-exclusive-stamp i {
  font-size: 6.5px;
  font-style: normal;
  letter-spacing: .02em;
  margin-top: 2px;
  opacity: .82;
}

/* 专属人姓名：宋体 + 阴刻效果 */
.home-exclusive-name {
  font-family: "Songti SC", "STSong", "SimSun", "Microsoft YaHei", serif;
  font-size: clamp(17px, 1.8vw, 21px);
  font-weight: 800;
  letter-spacing: .16em;
  color: #3d2804;
  white-space: nowrap;
  text-shadow:
    0 1px 0 rgba(255, 251, 208, .95),
    0 -1px 0 rgba(70, 40, 0, .55),
    0 2px 4px rgba(60, 35, 0, .22);
}

.home-exclusive-dot {
  padding: 0 .18em;
  opacity: .82;
  font-weight: 400;
}

/* 黑漆金字的「专属系统」小印 */
.home-exclusive-tag {
  flex: none;
  padding: 5px 10px 4px;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .28em;
  color: #f8df8b;
  background: linear-gradient(180deg, #4b3109 0%, #2e1c02 100%);
  box-shadow:
    inset 0 0 0 1px rgba(246, 217, 125, .5),
    inset 0 1px 0 rgba(255, 246, 190, .18),
    0 1px 1px rgba(60, 35, 0, .35);
  text-shadow:
    0 0 7px rgba(255, 218, 110, .35),
    0 1px 0 rgba(0, 0, 0, .4);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .home-exclusive-bar::after { animation: none; opacity: 0; }
}

.home-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 980px;
}

.home-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  padding: 26px 26px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  font-family: inherit;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  overflow: hidden;
}

.home-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--accent);
}

.home-card-prepare::before { background: #0e9488; }

.home-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
  border-color: #c9d3e6;
}

.home-card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 600;
}

.home-card-prepare .home-card-badge { background: #e6f7f5; color: #0b6f66; }

.home-card-head { display: flex; align-items: center; gap: 13px; }
.home-card-icon { font-size: 34px; line-height: 1; }
.home-card-name { display: block; font-size: 19px; font-weight: 800; color: var(--ink); }
.home-card-tagline { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }

.home-card-desc { font-size: 13.5px; color: var(--ink-2); line-height: 1.75; }

.home-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.home-chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  white-space: nowrap;
}

.home-card-cta {
  margin-top: auto;
  padding-top: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.home-card-prepare .home-card-cta { color: #0b6f66; }

.home-foot { display: flex; gap: 10px; margin-top: 34px; flex-wrap: wrap; justify-content: center; }

.home-foot-link {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.home-foot-link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.home-tip { margin-top: 20px; font-size: 12.5px; color: var(--ink-3); text-align: center; }

/* ---------------- 工作区页 ---------------- */

.space-page { max-width: 1100px; }
.space-group { margin-bottom: 26px; }

.space-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 2px;
  margin: 0 0 12px;
}

.space-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.mod-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  text-align: left;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-1);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.mod-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: #c9d3e6; }

.mod-card-icon { font-size: 24px; line-height: 1.2; }
.mod-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mod-card-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.mod-card-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.65; }

/* ---------------- 侧边栏里的工作区元素 ---------------- */

.nav-space {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 12px 8px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.nav-space-icon { font-size: 17px; }

.nav-space-name { letter-spacing: .5px; }

.nav-home { color: #8fa2c4; }

.nav-switch { color: #7fd6c8; }
.nav-switch:hover { color: #fff; }

.nav-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 8px 12px; }

/* ---------------- 打印 ---------------- */

#printRoot { display: none; }

@media print {
  body.printing { background: #fff; }
  body.printing > #app,
  body.printing > #modalRoot,
  body.printing > #toastRoot { display: none !important; }
  body.printing > #printRoot { display: block !important; }

  @page { margin: 16mm 14mm; }

  .no-print { display: none !important; }

  #printRoot { font-size: 12pt; line-height: 1.7; color: #000; }

  .print-title {
    font-size: 19pt;
    text-align: center;
    margin: 0 0 6mm;
    padding-bottom: 3mm;
    border-bottom: 1.5pt solid #000;
  }

  #printRoot .doc h2.md-h1 { font-size: 15pt; border-bottom: 1pt solid #999; page-break-after: avoid; }
  #printRoot .doc h3.md-h2 { font-size: 13.5pt; color: #000; border-left: 3pt solid #333; page-break-after: avoid; }
  #printRoot .doc h4.md-h3 { font-size: 12.5pt; page-break-after: avoid; }

  #printRoot .doc p,
  #printRoot .doc li { orphans: 3; widows: 3; }

  #printRoot .md-table { font-size: 10.5pt; }
  #printRoot .md-table th,
  #printRoot .md-table td { border: .75pt solid #666; padding: 2mm 2.5mm; }
  #printRoot .md-table th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  #printRoot .md-table-wrap { overflow: visible; }
  #printRoot .md-code {
    background: #f5f5f5 !important;
    color: #000 !important;
    border: .75pt solid #bbb;
    font-size: 10pt;
  }
  #printRoot .md-inline-code { background: #f0f0f0 !important; color: #000 !important; }

  #printRoot .md-quote { background: #f7f7f7 !important; border-left: 3pt solid #999; }

  #printRoot .tex-frac .tex-num { border-bottom: 1pt solid #000; }
  #printRoot .tex-rad { border-top: 1pt solid #000; }

  #printRoot .svg-stage { border: none; padding: 0; page-break-inside: avoid; }
  #printRoot .image-stage { border: none; padding: 0; page-break-inside: avoid; }
  #printRoot .image-stage img { max-height: 150mm; }
  #printRoot .preview-frame { border: 1pt solid #999; page-break-inside: avoid; }

  .page-break { page-break-before: always; }
  .avoid-break { page-break-inside: avoid; }
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 980px) {
  #app { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 0 8px;
  }
  .brand { border: none; padding: 12px 12px; white-space: nowrap; }
  .brand-sub { display: none; }
  .nav { display: flex; padding: 6px; gap: 4px; }
  .nav-group-title { display: none; }
  .nav-item { white-space: nowrap; }
  .sidebar-foot { flex-direction: row; border: none; padding: 6px; }
  .key-state { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .view { padding: 16px 14px 50px; }
  .topbar { padding: 12px 16px; }
  .home { padding: 30px 16px 40px; }
  .home-cards { grid-template-columns: 1fr; gap: 16px; }
  .home-hero-title { font-size: 23px; }
  .home-hero-icon { font-size: 38px; }
  .home-exclusive { margin-top: 18px; }
  .home-exclusive-bar {
    gap: 10px;
    padding: 8px 16px 9px 14px;
    clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%,
      calc(100% - 10px) 100%, 10px 100%, 0 50%);
  }
  .home-exclusive-stamp { width: 32px; height: 32px; }
  .home-exclusive-name { font-size: 15px; letter-spacing: .1em; }
  .home-exclusive-tag { font-size: 9.5px; letter-spacing: .18em; padding: 4px 8px; }
  .space-cards { grid-template-columns: 1fr; }
}
