:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --border: #30363d;
  --text: #f0f6fc;
  --text2: #8b949e;
  --text3: #6e7681;
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.15);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", Consolas, "JetBrains Mono", monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ========================================================
   顶部常驻顶栏与六步流程推进器 (常显屏幕顶端)
   ======================================================== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 汉堡菜单图标按钮 */
.btn-icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.btn-icon-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
}

/* 父子俩跑步意象 Logo */
.brand-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.brand-logo {
  width: 28px;
  height: 28px;
  display: block;
}

/* 极简高考倒计时铭牌 */
.countdown-badge {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 顶栏考点名称与快速切换 */
.current-topic-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px dashed var(--accent);
  padding-bottom: 1px;
  max-width: 140px;
}

.current-topic-name:hover {
  color: var(--accent);
}

/* 常驻顶栏计时器 */
.timer-widget {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  flex-shrink: 0;
}

.timer-digits {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
}

/* 常显吸顶六步流程推进器 (Sub-Header) */
.step-bar {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 6px;
  padding: 4px 10px 6px 10px;
  background: var(--surface);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}

.step-bar::-webkit-scrollbar {
  display: none;
}

.step-btn {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.step-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.step-btn small {
  font-size: 10px;
  color: var(--text3);
}

.step-btn.active small {
  color: var(--accent);
  opacity: 0.85;
}

/* 通用按钮 */
.btn-sm {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-sm:hover, .btn-sm:active {
  background: var(--border);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
}

.btn-accent:hover {
  background: var(--accent-hover);
}

/* ========================================================
   左侧抽屉侧边栏 (参考图 3)
   ======================================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 120;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  backdrop-filter: blur(3px);
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 290px;
  max-width: 82vw;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 130;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.45);
}

.side-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-brand-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding-left: 6px;
}

.drawer-item {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.drawer-item:hover, .drawer-item:active {
  background: var(--surface2);
  border-color: var(--border);
}

.drawer-item-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.drawer-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.drawer-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.drawer-item-desc {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-footer {
  padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.drawer-footer-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-footer-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.drawer-footer-sub {
  font-size: 11px;
  color: var(--text3);
}

/* ========================================================
   主视口与对话流 (填满中间剩余空间)
   ======================================================== */
.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0; /* 允许内部 flex 滚动 */
}

/* 问答对话窗口 */
.chat-window {
  background: var(--bg);
  border: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.chat-messages {
  flex: 1;
  padding: 14px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

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

.msg.ai {
  align-self: flex-start;
}

.msg.user {
  align-self: flex-end;
}

.msg-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
}

.msg.user .msg-role {
  text-align: right;
}

.msg-bubble {
  padding: 12px 14px;
  border-radius: var(--radius);
  line-height: 1.6;
  word-break: break-word;
}

.msg.ai .msg-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: normal;
}

.msg.user .msg-bubble {
  background: var(--accent);
  color: #fff;
  white-space: pre-wrap;
}

/* 对话折叠与展开控制 (超过 3 行默认折叠) */
.msg-bubble.collapsible {
  transition: max-height 0.22s ease;
}

.msg-bubble.collapsed {
  max-height: 92px !important;
  overflow: hidden !important;
  position: relative !important;
  cursor: pointer;
}

/* AI 气泡折叠底部渐变遮罩 */
.msg.ai .msg-bubble.collapsed::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 36px;
  background: linear-gradient(to bottom, rgba(33, 38, 45, 0) 0%, var(--surface2) 90%);
  pointer-events: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* 用户气泡折叠底部渐变遮罩 */
.msg.user .msg-bubble.collapsed::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 36px;
  background: linear-gradient(to bottom, rgba(16, 185, 129, 0) 0%, var(--accent) 90%);
  pointer-events: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* 展开/收起箭头按钮 */
.msg-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.msg.user .msg-expand-btn {
  align-self: flex-end;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.msg-expand-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.msg.user .msg-expand-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Markdown 与数学公式排版优化 */
.msg.ai .msg-bubble h1,
.msg.ai .msg-bubble h2,
.msg.ai .msg-bubble h3,
.msg.ai .msg-bubble h4 {
  margin: 12px 0 6px 0;
  font-weight: 700;
  color: var(--text);
}
.msg.ai .msg-bubble h1 { font-size: 1.22em; }
.msg.ai .msg-bubble h2 { font-size: 1.12em; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.msg.ai .msg-bubble h3 { font-size: 1.05em; }

.msg.ai .msg-bubble p {
  margin: 8px 0;
}

.msg.ai .msg-bubble ul,
.msg.ai .msg-bubble ol {
  margin: 6px 0 6px 20px;
  padding: 0;
}

.msg.ai .msg-bubble li {
  margin: 4px 0;
}

.msg.ai .msg-bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.msg.ai .msg-bubble blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(46, 160, 67, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text2);
}

.msg.ai .msg-bubble code {
  font-family: var(--mono);
  background: var(--surface);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

.msg.ai .msg-bubble pre {
  background: var(--surface);
  padding: 10px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
}

/* KaTeX 公式自适应横向滚动 */
.katex-display {
  margin: 10px 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.katex {
  font-size: 1.05em;
  text-rendering: auto;
}

/* 底部交互输入栏 (方案 B: 现代卡片工作台，常驻屏幕底端) */
.chat-bar {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 8px 12px max(8px, env(safe-area-inset-bottom)) 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 30;
}

/* 顶部快捷辅助工具条 (公式符号与高频提问，根据屏幕宽度自动折行) */
.chat-tools-bar {
  display: flex;
  align-items: flex-start;
  overflow: hidden;
  max-height: 280px;
  opacity: 1;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.2s ease;
}

.chat-tools-bar.collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: -8px;
  pointer-events: none;
}

.tools-scroll {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0 4px 0;
  width: 100%;
}

/* 快捷芯片通用样式 */
.tool-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 13px;
  font-size: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
  user-select: none;
}

.tool-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.tool-chip:active {
  transform: scale(0.96);
}

/* 数学公式芯片 */
.tool-chip.math-chip {
  font-family: KaTeX_Math, var(--mono), serif;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.tool-chip.math-chip .katex {
  font-size: 0.95em;
  color: inherit;
}

/* 快捷提问芯片 */
.tool-chip.prompt-chip {
  font-size: 11px;
  font-weight: 500;
  background: rgba(56, 139, 253, 0.08);
  border-color: rgba(56, 139, 253, 0.22);
  color: #58a6ff;
}

.tool-chip.prompt-chip:hover {
  background: rgba(56, 139, 253, 0.18);
  border-color: #58a6ff;
  color: #79b8ff;
}

/* 输入框包装器 (容纳输入框与清空按钮) */
.chat-input-wrapper {
  position: relative;
  display: flex;
  width: 100%;
}

.chat-input {
  flex: 1;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 34px 9px 12px;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  font-family: inherit;
  resize: none;
  min-height: 42px;
  max-height: 160px;
  box-sizing: border-box;
  overflow-y: hidden;
  word-break: break-word;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* 清空输入按钮 */
.btn-clear-input {
  position: absolute;
  right: 8px;
  top: 9px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text3);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  line-height: 1;
}

.btn-clear-input:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(248, 81, 73, 0.12);
}

/* 底部操作条 */
.chat-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chat-action-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-action-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-subtle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text3);
  font-size: 11px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.btn-subtle:hover, .btn-subtle.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface2);
}

.paste-hint {
  font-size: 11px;
  color: var(--text3);
  user-select: none;
}

.char-count {
  font-size: 11px;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.btn-label-long {
  display: inline;
}

.btn-label-short {
  display: none;
}

.chat-bar #btn-camera {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}

.chat-bar #btn-send {
  height: 32px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.15s;
}

.chat-bar #btn-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 600px) {
  .paste-hint {
    display: none;
  }
  .btn-subtle {
    padding: 5px 6px;
  }
}

/* 模态框与弹层 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
}

.form-control {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--accent);
}

textarea.form-control {
  min-height: 70px;
  resize: vertical;
}

/* 拍照预览框 */
.camera-preview-box {
  width: 100%;
  height: 180px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.camera-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 底部状态提示条 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  display: none;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ========================================================
   移动端与 Pad 端专属响应式重构 (针对手机+纸笔工况)
   ======================================================== */

/* 1. 移动端手机与小屏 (<= 680px) */
@media (max-width: 680px) {
  /* 顶部常显顶栏：单行紧凑排布，零折行 */
  .header-main {
    padding: 6px 8px;
    gap: 6px;
  }
  .header-left {
    gap: 5px;
  }
  .header-right {
    gap: 5px;
  }
  .brand-logo {
    width: 24px;
    height: 24px;
  }
  .countdown-badge {
    font-size: 10px;
    padding: 1px 5px;
  }
  .current-topic-name {
    font-size: 12px;
    max-width: 90px;
  }
  .timer-widget {
    padding: 2px 6px;
    font-size: 11px;
    gap: 4px;
  }
  .timer-digits {
    font-size: 12px;
  }
  .header-right #btn-open-checkin {
    padding: 3px 6px;
    font-size: 11px;
  }

  /* 主容器：填满视口无多余外边距 */
  .container {
    padding: 0;
  }

  /* 六步流程卡片：彻底废除双行折行，改为优雅单行平滑横滑胶囊 */
  .step-bar {
    display: flex;
    grid-template-columns: none;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 6px;
    padding: 2px 1px 4px 1px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .step-bar::-webkit-scrollbar {
    display: none;
  }
  .step-btn {
    flex: 0 0 auto;
    padding: 6px 12px;
    border-radius: 999px;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    scroll-snap-align: center;
    white-space: nowrap;
    background: var(--surface2);
  }
  .step-btn.active {
    box-shadow: 0 0 0 1px var(--accent);
  }
  .step-btn small {
    display: inline;
    font-size: 10px;
    opacity: 0.8;
  }

  /* 问答对话窗口与气泡：提升远视距 (40~60cm) 阅读清晰度 */
  .chat-window {
    min-height: 280px;
  }
  .chat-messages {
    padding: 10px 8px;
    gap: 10px;
  }
  .msg {
    max-width: 96%;
  }
  .msg-bubble {
    padding: 10px 12px;
    font-size: 15px;
    line-height: 1.65;
  }

  /* KaTeX 数学公式移动端横向溢出提示与防截断 */
  .katex-display {
    margin: 8px 0 !important;
    padding: 4px 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .katex-display::-webkit-scrollbar {
    height: 3px;
  }
  .katex-display::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
  }

  /* 输入工作台操作栏：文字自适应防折行 */
  .chat-bar {
    padding: 6px 8px 8px 8px;
    gap: 6px;
  }
  .chat-tools-bar {
    max-height: 240px;
  }
  .btn-label-long {
    display: none;
  }
  .btn-label-short {
    display: inline;
  }
  .paste-hint {
    display: none;
  }
  .chat-action-bar {
    gap: 4px;
  }
  .chat-action-left {
    gap: 4px;
    flex-wrap: nowrap;
  }
  .chat-action-left .btn-sm {
    height: 30px;
    padding: 0 7px;
    font-size: 11px;
  }
  .chat-action-right {
    gap: 6px;
  }
  .chat-action-right .btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
  }
  .char-count {
    font-size: 10px;
  }

  /* 模态框改造为移动端 Bottom Sheet (底部滑出抽屉) */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal-content {
    max-width: 100% !important;
    max-height: 85vh !important;
    border-radius: 18px 18px 0 0 !important;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 16px 14px max(16px, env(safe-area-inset-bottom)) !important;
    animation: slideUpSheet 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* 拍照预览框适配移动端高度 */
  .camera-preview-box {
    height: 150px;
  }

  /* 考点网格在小屏上单列整齐 */
  .topic-grid {
    grid-template-columns: 1fr;
  }
}

/* 2. Pad 与平板端 (681px ~ 1024px) */
@media (min-width: 681px) and (max-width: 1024px) {
  .container {
    max-width: 95%;
    padding: 12px 16px 80px;
  }
  .step-bar {
    gap: 8px;
  }
  .step-btn {
    padding: 8px 6px;
  }
}

/* 3. 宽屏台式机/大屏 Pad (>= 1025px) */
@media (min-width: 1025px) {
  .container {
    max-width: 900px;
  }
}

/* 考点网格与卡片 */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px 2px;
}

.topic-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s;
}

.topic-card:hover {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.08);
}

.topic-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.topic-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topic-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.topic-card-meta {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  gap: 8px;
}

.badge-subject {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.badge-math { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-physics { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.badge-chem { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* 历次回看与对话归档面板样式 */
.history-tabs .history-tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.history-tabs .history-tab-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.archive-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.15s;
}

.archive-card:hover {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.05);
}

.archive-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.archive-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.archive-card-meta {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  gap: 8px;
}

.archive-card-preview {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-card-count {
  font-size: 11px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: var(--text2);
}

#history-detail-content h1,
#history-detail-content h2,
#history-detail-content h3,
#history-detail-content h4 {
  margin: 12px 0 6px 0;
  color: var(--text);
}

#history-detail-content h4 {
  border-left: 3px solid var(--accent);
  padding-left: 8px;
  margin-top: 14px;
  background: rgba(16, 185, 129, 0.06);
  padding-top: 4px;
  padding-bottom: 4px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

#history-detail-content p {
  margin: 8px 0;
}

#history-detail-content code {
  font-family: var(--mono);
  background: var(--surface);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

#history-detail-content pre {
  background: var(--surface);
  padding: 10px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
}
