/* ============================================================
   mirror-mian · 简约高级 · 办公软件风格（浅色专业主题）
   设计体系：语义化 token + 组件全部通过 var() 引用，便于长期维护换肤
   ============================================================ */
:root {
  color-scheme: light;
  /* 页面与表面 */
  --page-bg: #f5f6f8;
  --surface: #ffffff;
  --surface-nested: #f7f8fa;
  --surface-raised: #ffffff;

  /* 边框 */
  --border: #e4e7ec;
  --border-strong: #d3d8e0;
  --border-input: #cfd6e0;

  /* 文本层级 */
  --text: #1f2733;
  --text-secondary: #5a6675;
  --text-tertiary: #8a95a5;
  --text-faint: #aab3bf;
  --text-inverse: #ffffff;

  /* 主色（沉稳克制的办公蓝，较原色更深更耐看，降低刺眼感） */
  --accent: #2a5fc0;
  --accent-hover: #204d9e;
  --accent-muted: #e9eef8;
  --accent-soft: #f3f6fb;
  --on-accent: #ffffff;

  /* 状态色 */
  --green: #1c7c4f;
  --green-muted: #e6f3ec;
  --yellow: #9a6b0b;
  --yellow-muted: #fdf3dc;
  --red: #c23a3a;
  --red-muted: #fdeaea;
  --amber: #b45309;
  --blue: var(--accent);

  /* 语义强调色（用于知识点标签等） */
  --tag-bg: var(--accent-muted);
  --tag-text: var(--accent);

  /* 阴影 */
  --shadow-card: 0 1px 2px rgba(28, 37, 55, 0.05), 0 1px 3px rgba(28, 37, 55, 0.06);
  --shadow-overlay: 0 8px 30px rgba(28, 37, 55, 0.14);
  --shadow-float: 0 4px 14px rgba(28, 37, 55, 0.1);

  /* Toast 提示 */
  --toast-bg: #232b39;
  --toast-text: #ffffff;

  /* 滚动条 */
  --scrollbar-thumb: #c5ccd6;
  --scrollbar-thumb-hover: #aab3bf;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* 字体与布局 */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
  --titlebar-h: 64px;
  --sidebar-w: 216px;
}

/* ===== 深色模式（通过 data-theme 切换） ===== */
[data-theme="dark"] {
  color-scheme: dark;
  /* 页面与表面 */
  --page-bg: #13161c;
  --surface: #1b1f27;
  --surface-nested: #21262e;
  --surface-raised: #232932;

  /* 边框 */
  --border: #2b313b;
  --border-strong: #39414d;
  --border-input: #3a4352;

  /* 文本层级 */
  --text: #e7eaf0;
  --text-secondary: #aab3c0;
  --text-tertiary: #7c8694;
  --text-faint: #626b78;
  --text-inverse: #0f1217;

  /* 主色（更亮的高识别蓝） */
  --accent: #5b8cf5;
  --accent-hover: #739cff;
  --accent-muted: #223451;
  --accent-soft: #1d2939;
  --on-accent: #ffffff;

  /* 状态色（暗环境下提亮） */
  --green: #3dbf7f;
  --green-muted: #14301f;
  --yellow: #d6a84c;
  --yellow-muted: #352c14;
  --red: #e46767;
  --red-muted: #3a1d1d;
  --amber: #e09b3f;

  /* 语义强调色 */
  --tag-bg: var(--accent-muted);
  --tag-text: var(--accent);

  /* 阴影（暗色下用更柔和、更深） */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-overlay: 0 10px 34px rgba(0, 0, 0, 0.5);
  --shadow-float: 0 4px 16px rgba(0, 0, 0, 0.4);

  /* Toast 提示 */
  --toast-bg: #e9ecf1;
  --toast-text: #1f2733;

  /* 滚动条 */
  --scrollbar-thumb: #3a4452;
  --scrollbar-thumb-hover: #4a5668;
}

/* ============================================================
   综合面试红调：进入综合面试模式时，脚本在 <html> 上挂 data-accent="red"
   复用状态红 --red，主色整体切换为红，营造紧迫感
   ============================================================ */
[data-accent="red"] {
  --accent: var(--red);
  --accent-hover: #a53030;
  --accent-muted: var(--red-muted);
  --accent-soft: #fdf1f0;
  --on-accent: #ffffff;
}
[data-theme="dark"][data-accent="red"] {
  --accent: var(--red);
  --accent-hover: #f07f7f;
  --accent-muted: var(--red-muted);
  --accent-soft: #2a1d1c;
  --on-accent: #ffffff;
}

/* 综合面试红调：主按钮加简单竖向渐变，增强质感 */
[data-accent="red"] button.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
}
[data-accent="red"] button.primary:hover {
  background: linear-gradient(180deg, var(--accent-hover), var(--accent-hover));
}

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

/* 文本选中高亮 */
::selection {
  background: var(--accent);
  color: var(--on-accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ===== 顶部标题栏 ===== */
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--titlebar-h);
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 20;
}
.titlebar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.titlebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
}
.titlebar-brand .logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(28, 37, 55, 0.22));
}
[data-theme="dark"] .titlebar-brand .logo,
[data-theme="dark"] .home-logo {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}
.titlebar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}
.titlebar-context {
  color: var(--text-secondary);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.titlebar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* 深浅色切换按钮 */
.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-nested);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.theme-toggle svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
}
/* 月牙笔画重心偏右上，轻微向左下平移，使深色模式图标与浅色图标视觉居中一致 */
.theme-toggle .icon-dark {
  transform: translate(calc(-50% - 1px), calc(-50% + 1px));
}
.theme-toggle .icon-dark { display: none; }
.theme-toggle .icon-light { display: block; }
[data-theme="dark"] .theme-toggle .icon-dark { display: block; }
[data-theme="dark"] .theme-toggle .icon-light { display: none; }
.titlebar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-nested);
}
.titlebar-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* ===== 布局 ===== */
.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ===== 左侧导航栏 ===== */
.activitybar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 10px 10px 14px;
  overflow-y: auto;
}
.activity-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.activity-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}
.activity-item:hover {
  background: var(--surface-nested);
  color: var(--text);
}
.activity-item.active {
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 600;
}
.activity-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  line-height: 1;
  flex-shrink: 0;
}
.activity-icon svg {
  width: 18px;
  height: 18px;
}
.activity-label {
  font-size: inherit;
}
.activity-bottom {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ===== 主内容区 ===== */
.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}
.panel {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 32px 48px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel-header {
  margin-bottom: 20px;
}
.panel-header h2 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--text);
  margin-bottom: 4px;
}
.panel-header .hint {
  margin-top: 4px;
}

h2 {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  color: var(--text);
}
h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 18px 0 10px;
  color: var(--text);
}
h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.hint {
  color: var(--text-tertiary);
  font-size: 12.5px;
  line-height: 1.6;
  margin-top: 8px;
}
.warn-text {
  color: var(--amber);
  font-weight: 500;
}

/* ===== 表单控件 ===== */
input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.5;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a95a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
select option {
  background: var(--surface);
}
.field-label {
  display: block;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  margin: 12px 0 6px;
}

/* ===== 按钮 ===== */
button {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 15px;
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}
button:hover {
  background: var(--surface-nested);
  border-color: #b9c2cf;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-muted);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button.ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
button.ghost:hover {
  background: var(--surface-nested);
  border-color: var(--accent);
  color: var(--accent);
}
button.small {
  padding: 5px 11px;
  font-size: 12.5px;
  border-radius: 6px;
}
button.small.danger {
  color: var(--red);
  border-color: var(--red);
  background: transparent;
}
button.small.danger:hover {
  background: var(--red-muted);
  border-color: var(--red);
}
.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
  flex-wrap: wrap;
}

/* 设置页：API Key 输入框 + 清除按钮 同一行 */
.key-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.key-row input {
  flex: 1;
}

/* ===== 模式选择 ===== */
.mode-select {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.mode-select label {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}
.mode-select label:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 500;
}
.mode-select input {
  accent-color: var(--accent);
}

/* ===== 面试聊天 ===== */
#chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--titlebar-h) - 120px);
  min-height: 420px;
}

#direction-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.kp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-nested);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
}
.kp-chip.current {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-muted);
  font-weight: 500;
}
.kp-chip.done {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-muted);
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.72); }
}

#messages,
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 86%;
  padding: 11px 15px;
  border-radius: var(--radius-md);
  line-height: 1.65;
  font-size: 13.5px;
  box-shadow: var(--shadow-card);
}
.msg.ai {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg.user {
  background: var(--accent-muted);
  color: var(--accent);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg.user strong { color: var(--accent-hover); }
.msg.system {
  align-self: center;
  color: var(--text-tertiary);
  font-size: 12px;
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 2px 10px;
}
/* ===== 对话头像：AI 消息左侧显示模拟面试官头像 ===== */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.msg-row.user {
  justify-content: flex-end;
}
.msg-row.system {
  justify-content: center;
}
.msg-row .msg {
  max-width: calc(100% - 42px);
  align-self: auto; /* 行内对齐交由 .msg-row 控制，避免与头像错位 */
}
.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  object-fit: contain;
  flex-shrink: 0;
  /* 透明底图标放在小芯片上，深浅色主题均清晰 */
  background: var(--surface-nested);
  border: 1px solid var(--border);
  padding: 3px;
  box-shadow: var(--shadow-card);
  margin-bottom: 2px;
  user-select: none;
  pointer-events: none;
}
.q-label {
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.kp {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}

#input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-top: 4px;
}
#input-row textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  margin: 0;
}
#input-row button {
  height: 44px;
  padding: 0 20px;
}

/* ===== 综合面试答题方式选择 ===== */
.answer-type-select {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.answer-type-option {
  flex: 1;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}
.answer-type-option:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.answer-type-option.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 500;
}

/* ===== 视频答题面板 ===== */
.video-answer {
  margin-top: 4px;
}
.video-stage {
  position: relative;
  background: #0f1217;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 300px;
}
.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-controls {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
  flex-wrap: wrap;
}
#btn-video-record.recording {
  background: var(--red);
  border-color: var(--red);
  animation: rec-pulse 1.2s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(194, 58, 58, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(194, 58, 58, 0); }
}
button.danger {
  background: var(--red);
  border-color: var(--red);
  color: var(--on-accent);
}
button.danger:hover {
  background: var(--red);
  border-color: var(--red);
  opacity: 0.9;
}
button.danger:disabled {
  background: var(--surface-nested);
  border-color: var(--border);
  color: var(--text-faint);
}
.video-answer textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
}
#btn-video-send {
  margin-top: 10px;
  width: 100%;
}

#loading-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-tertiary);
  font-size: 12.5px;
  padding: 8px 2px;
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Markdown / 复盘 ===== */
.markdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  line-height: 1.75;
  font-size: 13.5px;
  box-shadow: var(--shadow-card);
}
.markdown h1 {
  font-size: 17px;
  color: var(--text);
  margin: 14px 0 8px;
  font-weight: 650;
}
.markdown h2 {
  font-size: 15px;
  color: var(--text);
  margin: 14px 0 8px;
  font-weight: 650;
}
.markdown h3 {
  font-size: 14px;
  margin: 12px 0 6px;
  color: var(--accent);
}
.markdown li {
  margin-left: 20px;
}
.markdown strong {
  color: var(--text);
  font-weight: 650;
}
.markdown ul {
  margin: 6px 0;
}
.markdown br + * {
  margin-top: 0;
}
.markdown code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-muted);
  border-radius: 5px;
  padding: 1.5px 6px;
}
.markdown pre {
  background: var(--surface-nested);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 10px 0;
}
.markdown pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
}
.markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}
.markdown th,
.markdown td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.markdown th {
  background: var(--surface-nested);
  color: var(--text);
  font-weight: 600;
}
.markdown blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text-secondary);
  margin: 10px 0;
  padding: 8px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
}

/* ===== 成长 Chat ===== */
.grow-guess {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.grow-guess-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 2px;
  white-space: nowrap;
}
.grow-guess-item {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.grow-guess-item:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* 么么Chat 加载转圈提示 */
#grow-messages .msg.grow-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
}
#grow-messages .msg.grow-loading .spinner {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.grow-chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--titlebar-h) - 190px);
  min-height: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.grow-input-row {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-nested);
  align-items: flex-end;
}
.grow-input-row textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  margin: 0;
}
.grow-input-row button {
  height: 44px;
  padding: 0 22px;
}
#grow-chat .ghost {
  margin: 4px 12px 12px;
  align-self: flex-start;
}

/* ===== 么么Chat 历史记录（左侧栏） ===== */
.grow-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.grow-header-row h2 {
  margin-bottom: 0;
}
#btn-grow-history {
  font-size: 13px;
  padding: 5px 12px;
}
.grow-body {
  display: flex;
  gap: 14px;
  align-items: stretch;
}
.grow-history {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--titlebar-h) - 190px);
  min-height: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  animation: fadeIn 0.18s ease;
}
.grow-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  margin-bottom: 10px;
}
.grow-history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.grow-history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.grow-history-item {
  background: var(--surface-nested);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.grow-history-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.grow-history-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.grow-history-item-top .meta {
  color: var(--text-tertiary);
  font-size: 11.5px;
  white-space: nowrap;
}
.grow-history-item-preview {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grow-history-empty {
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 12px 4px;
}

/* ===== 历史面试记录 ===== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.14s ease, background 0.14s ease;
}
.history-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.history-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.history-item-title {
  font-weight: 600;
  font-size: 14.5px;
}
.history-badge {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.history-badge.ongoing {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
}
.history-badge.finished {
  color: var(--text-secondary);
  background: var(--surface-nested);
  border: 1px solid var(--border);
}
.history-badge.video {
  color: var(--green);
  background: var(--green-muted);
  border: 1px solid var(--green);
}
.history-item-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--text-tertiary);
  font-size: 12.5px;
}
.history-resume-btn {
  margin-top: 10px;
}
.history-empty {
  color: var(--text-tertiary);
  font-size: 13.5px;
  padding: 24px 4px;
}
.history-qa-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--surface);
}
.history-qa-q {
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 6px;
}
.history-qa-a {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.history-qa-score {
  display: inline-block;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
}
.history-qa-type {
  display: inline-block;
  margin-top: 8px;
  margin-left: 8px;
  font-size: 11.5px;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
  vertical-align: middle;
}
.history-subhead {
  font-size: 14px;
  font-weight: 600;
  margin: 18px 0 10px;
}

/* ===== 卡片 ===== */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.settings-card h3 {
  margin-top: 0;
}

.wp {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 10px;
  font-size: 13.5px;
  line-height: 1.6;
  box-shadow: var(--shadow-card);
}
.wp .meta {
  color: var(--text-tertiary);
  font-size: 12px;
  margin-left: 6px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.bar-row > span:first-child {
  width: 150px;
  flex-shrink: 0;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-row .bar {
  flex: 1;
  height: 8px;
  background: var(--surface-nested);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f8bff, var(--accent));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.bar-row > span:last-child {
  width: 90px;
  flex-shrink: 0;
  text-align: right;
  color: var(--text-tertiary);
  font-size: 12px;
}

.domain-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.domain-info {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  min-width: 0;
}
.domain-actions {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}
.file-chip {
  display: inline-block;
  margin: 4px 6px 4px 0;
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-secondary);
  transition: border-color 0.14s ease, color 0.14s ease;
}
.file-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.file-chip.hf {
  color: var(--yellow);
  border-color: var(--yellow);
}
#domain-file-select {
  margin-bottom: 12px;
  max-width: 320px;
}

.test-result {
  font-size: 12.5px;
  margin-left: 10px;
  font-weight: 500;
}
.test-result.ok {
  color: var(--green);
}
.test-result.err {
  color: var(--red);
}

#domain-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
#domain-toolbar input {
  flex: 1;
  max-width: 360px;
  margin: 0;
}

/* 文件上传：隐藏原生 input，用统一样式 */
input[type="file"] {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 8px 0;
}
input[type="file"]::file-selector-button {
  background: var(--surface-nested);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 12px;
  margin-right: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  transition: border-color 0.14s ease, color 0.14s ease;
}
input[type="file"]::file-selector-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== 个人账户（标题栏） ===== */
.account-area {
  position: relative;
  display: flex;
  align-items: center;
}
.btn-login {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-nested);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.btn-login:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.btn-login svg {
  width: 16px;
  height: 16px;
}
.user-menu {
  position: relative;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-nested);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.user-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.user-avatar {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
}
.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}
.user-caret {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-overlay);
  padding: 8px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 30;
}
.user-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.dropdown-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.dropdown-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.dropdown-email {
  font-size: 12px;
  color: var(--text-tertiary);
  word-break: break-all;
  margin-top: 2px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}
.dropdown-item:hover {
  background: var(--red-muted);
  color: var(--red);
}
.dropdown-item svg {
  width: 16px;
  height: 16px;
}

/* ===== 登录 / 注册遮罩 ===== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 24, 34, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
[data-theme="dark"] .auth-overlay {
  background: rgba(8, 10, 14, 0.6);
}
.auth-card {
  width: 380px;
  max-width: calc(100vw - 40px);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-overlay);
  padding: 32px 30px 28px;
  animation: authIn 0.24s ease;
}
@keyframes authIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-brand {
  text-align: center;
  margin-bottom: 20px;
}
.auth-brand img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(42, 95, 192, 0.25));
}
.auth-brand h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 12px 0 4px;
}
.auth-brand p {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin: 0;
}
.auth-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface-nested);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
}
.auth-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-card);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-submit {
  width: 100%;
  padding: 10px 0;
  margin-top: 4px;
}
.auth-msg {
  min-height: 18px;
  margin-top: 12px;
  font-size: 12.5px;
  text-align: center;
  color: var(--text-tertiary);
}
.auth-msg.err {
  color: var(--red);
}
.auth-msg.ok {
  color: var(--green);
}

/* ===== Toast ===== */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 99;
  font-size: 13px;
  box-shadow: var(--shadow-overlay);
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: content-box;
}

/* 动效偏好：减少动画 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 深浅色切换时，主要表面的平滑过渡 */
.titlebar,
.activitybar,
.settings-card,
.wp,
.domain-card .info,
.home-card,
.grow-chat,
#direction-bar,
#chat,
.mode-select label,
.mode-select label:has(input:checked),
.msg {
  transition-property: background-color, border-color, color, box-shadow, transform;
  transition-duration: 0.25s;
  transition-timing-function: ease;
}

/* ===== 首页落地介绍页 ===== */
.home-panel {
  max-width: 860px;
  padding: 40px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.home-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 24px;
}
.home-logo-box {
  position: relative;
  width: 88px;
  height: 88px;
  display: inline-block;
  cursor: pointer;
  animation: homeFloat 4s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}
.home-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  display: block;
  user-select: none;
  /* 透明底图标：阴影跟随机器人轮廓，而非方形包围盒 */
  filter: drop-shadow(0 8px 22px rgba(42, 95, 192, 0.25));
  transition: filter 0.18s ease;
}
/* 点击压下 + 快速回弹（带过冲的弹性曲线） */
.home-logo-box.pressed .home-logo {
  animation: logoPress 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.home-logo-box.pressed {
  animation: none; /* 压下时暂停悬浮，避免两个 transform 打架 */
}
@keyframes logoPress {
  0% { transform: scale(1); }
  30% { transform: scale(0.86) rotate(-2deg); }
  100% { transform: scale(1); }
}
/* 点击彩蛋字幕：向上飘出并淡出 */
.poke-text {
  position: absolute;
  left: 50%;
  top: -4px;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid var(--accent-muted);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
  animation: pokeFloat 0.9s ease-out forwards;
}
.poke-text.poke {
  color: var(--red);
  background: var(--red-muted);
  border-color: var(--red-muted);
}
@keyframes pokeFloat {
  0% { opacity: 0; transform: translate(-50%, 2px) scale(0.8); }
  18% { opacity: 1; transform: translate(-50%, -8px) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -36px) scale(1); }
}
@keyframes homeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.home-hero h1 {
  font-size: 34px;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 20px 0 8px;
  color: var(--text);
}
.home-tagline {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin: 0 0 10px;
}
.home-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 26px;
}
.home-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.home-cta {
  min-width: 170px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.home-cta svg {
  width: 17px;
  height: 17px;
}
.home-cta.primary {
  font-size: 14px;
  padding: 11px 20px;
  box-shadow: 0 6px 18px rgba(42, 95, 192, 0.22);
}
.home-cta.ghost {
  font-size: 14px;
  padding: 11px 20px;
}
.home-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.home-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.home-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 14px 32px rgba(20, 30, 50, 0.1);
}
/* 悬浮气泡提示（tooltip） */
.home-card::after {
  content: attr(data-tooltip);
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translate(-50%, -4px);
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  padding: 5px 11px;
  border-radius: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 5;
  box-shadow: var(--shadow-float);
}
.home-card:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.home-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.home-card-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-muted);
  transition: transform 0.22s ease;
}
.home-card:hover .home-card-icon {
  transform: scale(1.06);
}
.home-card-icon svg {
  width: 22px;
  height: 22px;
}
.home-card h3 {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
  margin: 0;
  flex: 1;
}
.home-card-go {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
.home-card:hover .home-card-go {
  color: var(--accent);
  transform: translateX(2px);
}
.home-card-brief {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 12px;
}
.home-card-more {
  list-style: none;
  border-top: 1px solid var(--border);
  padding: 12px 0 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.home-card-more li {
  position: relative;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  padding-left: 14px;
}
.home-card-more li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}
.home-foot {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

/* 小屏适配 */
@media (max-width: 820px) {
  :root {
    --sidebar-w: 68px;
  }
  .activity-item {
    justify-content: center;
    padding: 10px 6px;
  }
  .activity-label {
    display: none;
  }
  .panel {
    padding: 20px 18px 40px;
  }
  .bar-row > span:first-child {
    width: 110px;
  }
  .home-features {
    grid-template-columns: 1fr;
  }
  .home-panel {
    padding: 24px 18px 40px;
  }
  .home-hero h1 {
    font-size: 28px;
  }
  .grow-history {
    width: 220px;
  }
}