/* ══════════════════════════════════════════════════════════
   unified.css — 英剑备课统一平台样式
   从 unified.html 拆分 · 2026-05-20
   ══════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════
   VI 基础变量
   ══════════════════════════════════════════════════════════ */
:root {
  --purple: #7B2CBF;    --purple-light: #9D4EDD;   --purple-pale: #E8D5F9;
  --cyan: #00B4D8;      --cyan-light: #48CAE4;     --cyan-pale: #CAF0F8;
  --orange: #F09020;    --orange-light: #FFB627;   --orange-pale: #FFF0CC;
  --ink-900: #0A0A1A;   --ink-700: #181830;        --ink-500: #2D2D44;
  --ink-300: #6B6B85;   --ink-100: #E0E0EE;        --ink-50: #F5F5FA;
  --success: #10B981;   --warning: #F59E0B;        --error: #EF4444;
  --radius: 12px;       --radius-sm: 8px;           --radius-xs: 4px;
  --shadow-sm: 0 1px 3px rgba(10,10,26,0.08);
  --shadow-md: 0 4px 12px rgba(10,10,26,0.12);
  --shadow-lg: 0 8px 24px rgba(10,10,26,0.16);
}

/* ══════════════════════════════════════════════════════════
   全局重置
   ══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Noto Sans SC', 'Inter', -apple-system, sans-serif;
  background: var(--ink-50);
  color: var(--ink-700);
  display: flex;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════
   侧边栏（25% 视觉比重 ≈ 260px）
   ══════════════════════════════════════════════════════════ */
.sidebar {
  width: 300px;
  min-width: 300px;
  background: linear-gradient(180deg, var(--ink-900) 0%, var(--ink-500) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-header {
  position: relative;
  padding: 20px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px; height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 520px) {
  .sidebar-close-btn { display: flex; }
}
.sidebar-header .logo-area {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.sidebar-header .logo-img {
  width: 210px;
  height: auto;
  display: block;
  image-rendering: auto;
}
.sidebar-header h2 {
  font-size: 20px; font-weight: 700;
  letter-spacing: 0.5px;
}
.sidebar-header .subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin-top: 4px;
  font-family: 'Inter', monospace;
  letter-spacing: 1.5px;
}

.sidebar-section {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-section.collapsible {
  padding: 10px 0;
}
.sidebar-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
}
.sidebar-section.collapsible .sidebar-section-label {
  margin: 0 16px;
  margin-bottom: 0;
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
  user-select: none;
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.sidebar-section.collapsible .sidebar-section-label:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.12);
  transform: translateX(2px);
}
.sidebar-section.collapsible .collapse-icon {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  transition: transform 0.25s;
  margin-left: 8px;
}
.sidebar-section.collapsible.collapsed .collapse-icon {
  transform: rotate(-90deg);
}
.sidebar-section.collapsible .collapsible-body {
  padding: 12px 16px 8px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease;
  max-height: 800px;
  opacity: 1;
}
.sidebar-section.collapsible.collapsed .collapsible-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Prompt Cards link in sidebar */
.prompt-card-link {
  display: block;
  padding: 11px 16px;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
  border: 1px solid rgba(255,255,255,0.05);
}
.prompt-card-link:hover {
  background: rgba(123,44,191,0.25);
  border-color: rgba(123,44,191,0.4);
  color: #fff;
}

/* Main prompt card link (prominent button) */
.prompt-card-main {
  background: rgba(123,44,191,0.12);
  border-color: rgba(123,44,191,0.25);
  font-weight: 600;
  letter-spacing: 0.3px;
}
.prompt-card-main:hover {
  background: rgba(123,44,191,0.3);
  border-color: rgba(123,44,191,0.5);
  box-shadow: 0 0 16px rgba(123,44,191,0.2);
}

/* Settings bar: 语言切换 + 跨学科开关 同一行 */
.settings-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Language switcher */
.lang-switcher {
  display: flex;
  gap: 0;
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 3px;
  width: fit-content;
  flex-shrink: 0;
}
.lang-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 17px;
  background: transparent;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.lang-btn:hover { color: #fff; }
.lang-btn.active {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 8px rgba(240,144,32,0.35);
}

/* Multi-select toggle — 风格与 lang-switcher 统一 */
.multi-select-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 3px 12px 3px 14px;
  height: 32px;
  transition: all 0.2s;
}
.multi-select-toggle:hover {
  background: rgba(255,255,255,0.12);
}
.toggle-label {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  white-space: nowrap;
}
.toggle-switch {
  width: 34px;
  height: 20px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  position: relative;
  transition: all 0.25s;
  flex-shrink: 0;
}
.toggle-switch.on {
  background: var(--orange);
}
.toggle-knob {
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: all 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-switch.on .toggle-knob {
  left: 16px;
}
.multi-select-hint {
  font-size: 11px;
  color: var(--orange);
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.multi-select-hint.show { opacity: 1; }

/* Campus buttons */
.campus-btns { display: flex; gap: 10px; }
.campus-btn {
  flex: 1;
  padding: 12px 10px;
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-align: center;
}
.campus-btn:hover {
  border-color: var(--cyan);
  color: #fff;
}
.campus-btn.active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--ink-900);
  box-shadow: 0 0 16px rgba(0,180,216,0.3);
}

/* Subject chips */
.subject-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.subject-chip {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.subject-chip:hover { border-color: var(--purple-light); color: #fff; }
.subject-chip.active {
  background: var(--purple-light);
  border-color: var(--purple-light);
  color: #fff;
}

/* Mode tabs */
.mode-category-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  margin: 10px 0 8px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
}
.subject-category-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--cyan);
  margin: 12px 0 8px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  padding: 4px 0;
  border-bottom: 1px solid rgba(0,180,216,0.2);
}
.subject-select-row {
  width: 100%;
  margin-bottom: 12px;
}
.subject-select-row:last-of-type {
  margin-bottom: 8px;
}
.subject-select-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--cyan);
  margin-bottom: 6px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  padding: 4px 0;
  border-bottom: 1px solid rgba(0,180,216,0.2);
}
.subject-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.2);
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.subject-select:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 2px rgba(123,44,191,0.2);
}
.subject-select option {
  background: #1e1b2e;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  padding: 6px;
}
.mode-list { display: flex; flex-wrap: wrap; gap: 6px; }
.mode-chip {
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.mode-chip:hover { border-color: var(--orange); color: #fff; }
.mode-chip.active {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--ink-900);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(240,144,32,0.25);
}

/* Generate type list in sidebar */
.gen-type-btn {
  display: block;
  width: 100%;
  padding: 9px 14px;
  margin-bottom: 5px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.gen-type-btn:hover { background: rgba(255,255,255,0.06); color: #fff; }
.gen-type-btn.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid var(--orange);
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  font-family: 'Inter', monospace;
}

/* ══════════════════════════════════════════════════════════
   主内容区
   ══════════════════════════════════════════════════════════ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Top bar */
.topbar {
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar .mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.badge-ta { background: var(--purple-pale); color: var(--purple); }
.badge-pbl { background: var(--orange-pale); color: #C6720A; }
.badge-gen { background: var(--cyan-pale); color: #0077B6; }

.topbar .context-info { font-size: 12px; color: var(--ink-300); }
.topbar .context-info span { font-weight: 600; color: var(--ink-500); }

.topbar-right { display: flex; gap: 8px; }
.topbar-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-100);
  background: #fff;
  color: var(--ink-500);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
}
.topbar-btn:hover { border-color: var(--purple-light); color: var(--purple); }
.topbar-btn.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  font-weight: 600;
}
.topbar-btn.active:hover { background: var(--orange-light); }

/* Content area */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  margin: 16px 28px 16px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* Chat messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.messages-container::-webkit-scrollbar { width: 6px; }
.messages-container::-webkit-scrollbar-thumb {
  background: var(--ink-100); border-radius: 3px;
}

.message { display: flex; gap: 12px; max-width: 85%; animation: msgIn 0.3s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.ai { align-self: flex-start; }

.msg-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.message.user .msg-avatar { background: var(--purple-pale); }
.message.ai .msg-avatar { background: var(--cyan-pale); }

.msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.7;
}
.message.user .msg-bubble {
  background: var(--purple);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message.ai .msg-bubble {
  background: var(--ink-50);
  color: var(--ink-700);
  border-bottom-left-radius: 4px;
}
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 { margin: 8px 0 4px; font-size: 15px; font-weight: 700; }
.msg-bubble h2 { font-size: 14px; }
.msg-bubble p { margin: 4px 0; }
.msg-bubble ul, .msg-bubble ol { margin: 4px 0; padding-left: 20px; }
.msg-bubble li { margin: 2px 0; }
.msg-bubble code {
  background: rgba(0,0,0,0.08);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Inter', monospace;
  font-size: 13px;
}
.message.user .msg-bubble code { background: rgba(255,255,255,0.2); }
.msg-bubble pre {
  background: var(--ink-900);
  color: #CAF0F8;
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
  font-size: 12px;
}
.msg-bubble pre code { background: transparent; color: inherit; padding: 0; }
.msg-bubble strong { font-weight: 700; color: var(--purple); }
.message.user .msg-bubble strong { color: #FFB627; }

/* Typing indicator */
.typing-indicator {
  align-self: flex-start;
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--ink-50);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
}
.typing-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink-300);
  animation: typingBounce 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-300);
  gap: 8px;
}
.empty-state .icon { font-size: 48px; opacity: 0.4; margin-bottom: 8px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--ink-500); }
.empty-state p { font-size: 13px; max-width: 280px; text-align: center; line-height: 1.6; }

/* Onboarding steps */
.onboarding-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--ink-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-100);
}
.onboarding-steps .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.onboarding-steps .step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ink-100);
  color: var(--ink-300);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.onboarding-steps .step.active .step-num {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 0 4px var(--purple-pale);
}
.onboarding-steps .step.done .step-num {
  background: var(--success);
  color: #fff;
}
.onboarding-steps .step-text {
  font-size: 11px;
  color: var(--ink-300);
  font-weight: 500;
  white-space: nowrap;
}
.onboarding-steps .step.active .step-text {
  color: var(--purple);
  font-weight: 600;
}
.onboarding-steps .step-arrow {
  font-size: 14px;
  color: var(--ink-100);
}

/* Input area */
.input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--ink-100);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
.input-area textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--ink-100);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.input-area textarea:focus { border-color: var(--purple-light); box-shadow: 0 0 0 3px var(--purple-pale); }
.input-area textarea::placeholder { color: var(--ink-300); }

.send-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--purple);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.send-btn:hover { background: var(--purple-light); transform: scale(1.05); }
.send-btn:disabled { background: var(--ink-100); color: var(--ink-300); cursor: not-allowed; transform: none; }
.send-btn.loading { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.cancel-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--error);
  background: #fff;
  color: var(--error);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cancel-btn:hover { background: var(--error); color: #fff; transform: scale(1.05); }

/* ══════════════════════════════════════════════════════════
   生成面板
   ══════════════════════════════════════════════════════════ */
.generate-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: none;
}
.generate-panel.show { display: block; }

.gen-form { max-width: 600px; }
.gen-form .gen-title {
  font-size: 20px; font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 4px;
}
.gen-form .gen-desc {
  font-size: 13px; color: var(--ink-300);
  margin-bottom: 20px;
}
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--ink-100);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-pale);
}
.form-group textarea { min-height: 80px; resize: vertical; }

.gen-submit-btn {
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--orange);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.gen-submit-btn:hover { background: var(--orange-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.gen-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.gen-result {
  margin-top: 24px;
  padding: 20px;
  background: var(--cyan-pale);
  border-radius: var(--radius);
  display: none;
}
.gen-result.show { display: block; }
.gen-result h4 { font-size: 14px; color: #0077B6; margin-bottom: 8px; }
.gen-result .download-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--cyan);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.15s;
}
.gen-result .download-link:hover { background: #0077B6; transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════════
   拍照批改面板
   ══════════════════════════════════════════════════════════ */
.ocr-panel { display: none; flex-direction: column; height: 100%; overflow-y: auto; padding: 20px; }
.ocr-panel.show { display: flex; }

.ocr-form { max-width: 640px; width: 100%; margin: 0 auto; }
.ocr-title { font-size: 20px; font-weight: 700; color: var(--purple); margin-bottom: 4px; }
.ocr-desc { font-size: 13px; color: var(--ink-300); margin-bottom: 20px; }

.ocr-upload-area { margin-bottom: 20px; }
.ocr-upload-box {
  border: 2px dashed var(--ink-200);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--ink-50);
}
.ocr-upload-box:hover { border-color: var(--purple); background: #faf5ff; }
.ocr-upload-icon { font-size: 40px; margin-bottom: 8px; }
.ocr-upload-text { font-size: 14px; font-weight: 600; color: var(--ink-700); margin-bottom: 4px; }
.ocr-upload-hint { font-size: 11px; color: var(--ink-300); }

.ocr-preview { position: relative; margin-bottom: 20px; border-radius: var(--radius-sm); overflow: hidden; }
.ocr-preview img { width: 100%; max-height: 400px; object-fit: contain; border-radius: var(--radius-sm); }
.ocr-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px; height: 28px;
  border: none; border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

/* 多图预览网格 */
.ocr-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.ocr-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--ink-100);
  background: var(--ink-50);
}
.ocr-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ocr-preview-item .ocr-remove-btn {
  top: 4px;
  right: 4px;
  width: 24px; height: 24px;
  font-size: 14px;
  background: rgba(0,0,0,0.5);
}
.ocr-add-more {
  aspect-ratio: 1;
  border: 2px dashed var(--ink-200);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-300);
  font-size: 13px;
  gap: 4px;
  transition: all 0.2s;
  background: var(--ink-50);
}
.ocr-add-more:hover {
  border-color: var(--purple);
  color: var(--purple);
  background: #faf5ff;
}
.ocr-add-more .icon { font-size: 24px; }

@media (max-width: 520px) {
  .ocr-preview-grid { grid-template-columns: repeat(2, 1fr); }
}

.ocr-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.ocr-fields .form-group { display: flex; flex-direction: column; gap: 4px; }
.ocr-fields .form-group label { font-size: 12px; font-weight: 600; color: var(--ink-500); }
.ocr-fields .form-group input {
  padding: 8px 12px;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--ink-50);
}

.ocr-submit-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--cyan);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ocr-submit-btn:hover { background: #0077B6; }
.ocr-submit-btn:disabled { background: var(--ink-100); color: var(--ink-300); cursor: not-allowed; }

.ocr-result {
  max-width: 640px;
  width: 100%;
  margin: 20px auto 0;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.7;
  display: none;
}
.ocr-result.show { display: block; }
.ocr-result h4 { color: var(--purple); margin-bottom: 12px; font-size: 16px; }
.ocr-result p { margin-bottom: 8px; }
.ocr-result ul { margin-left: 20px; margin-bottom: 8px; }
.ocr-result li { margin-bottom: 4px; }
.ocr-result strong { color: var(--purple); }

@media (max-width: 520px) {
  .ocr-fields { grid-template-columns: 1fr; }
  .ocr-upload-box { padding: 24px; }
}

/* ══════════════════════════════════════════════════════════
   移动端汉堡菜单（含微信兼容修复）
   ══════════════════════════════════════════════════════════ */
.mobile-menu-btn {
  display: none;           /* 桌面端隐藏 */
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: none;
  background: var(--purple);
  color: #fff;
  font-size: 22px;
  line-height: 48px;
  text-align: center;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  -webkit-align-items: center;
  -webkit-justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.mobile-menu-btn:hover { background: var(--purple-light); transform: scale(1.05) translateZ(0); }
.mobile-menu-btn:active { background: var(--purple-light); }

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10,10,26,0.5);
  z-index: 9990;
  backdrop-filter: blur(2px);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ══════════════════════════════════════════════════════════
   响应式
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { width: 260px; min-width: 260px; }
  .content-area { margin: 8px 12px 8px 8px; }
  .message { max-width: 92%; }
}

@media (max-width: 520px) {
  .mobile-menu-btn {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    min-width: 280px;
    height: 100%;
    transition: left 0.3s ease;
    z-index: 9995;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open {
    left: 0;
  }
  .sidebar-overlay.show {
    display: block;
  }

  .main { width: 100%; }
  .topbar {
    padding: 14px 16px 14px 64px;
  }
  .topbar-left { gap: 6px; flex-wrap: wrap; }
  .topbar-right { gap: 6px; }
  .topbar-btn { padding: 5px 10px; font-size: 11px; }
  .topbar .mode-badge { font-size: 11px; padding: 4px 8px; }
  .topbar .context-info { font-size: 11px; }

  .content-area {
    margin: 8px;
    border-radius: var(--radius-sm);
  }
  .messages-container { padding: 16px; }
  .message { max-width: 95%; gap: 8px; }
  .msg-avatar { width: 30px; height: 30px; font-size: 14px; }
  .msg-bubble { padding: 10px 12px; font-size: 13px; }

  .input-area { padding: 12px; gap: 8px; }
  .input-area textarea { font-size: 16px; } /* 防止iOS缩放 */
  .send-btn, .cancel-btn { width: 40px; height: 40px; }

  .onboarding-steps {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  .onboarding-steps .step-arrow { transform: rotate(90deg); }

  .generate-panel { padding: 16px; }
  .gen-form .gen-title { font-size: 16px; }
}

/* ── PBL 流程指示器 ─────────────────────────────── */
.flow-indicator {
  background: linear-gradient(135deg, #f8f5ff 0%, #f0f8ff 100%);
  border: 1px solid #e0d4f7;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin: 12px 16px 0;
  box-shadow: 0 2px 8px rgba(123, 44, 191, 0.08);
}

.flow-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 14px;
}

.flow-icon {
  font-size: 18px;
}

.flow-name {
  font-weight: 600;
  color: var(--primary);
  flex: 1;
}

.flow-step {
  color: var(--text-secondary);
  font-size: 12px;
  background: rgba(123, 44, 191, 0.08);
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.flow-exit-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}
.flow-exit-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.flow-progress-bar {
  height: 5px;
  background: rgba(123, 44, 191, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}
.flow-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* 步骤圆点行 */
.flow-steps-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0;
  overflow-x: auto;
  padding: 0 2px;
}

.flow-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 0;
  transition: all 0.3s ease;
}

.flow-dot-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: rgba(123, 44, 191, 0.08);
  color: var(--text-tertiary);
  border: 2px solid rgba(123, 44, 191, 0.15);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.flow-dot.active .flow-dot-circle {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.2);
  animation: flowDotPulse 2s infinite;
}

.flow-dot.done .flow-dot-circle {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

.flow-dot-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-align: center;
  max-width: 56px;
  line-height: 1.2;
  white-space: nowrap;
}
.flow-dot.active .flow-dot-label {
  color: var(--primary);
  font-weight: 600;
}
.flow-dot.done .flow-dot-label {
  color: #10b981;
}

.flow-dot-line {
  flex: 1;
  height: 2px;
  background: rgba(123, 44, 191, 0.12);
  margin: 13px 2px 0;
  min-width: 8px;
  border-radius: 1px;
  transition: background 0.3s ease;
}

/* 当前步骤提示 */
.flow-prompt {
  margin-top: 12px;
  padding: 9px 14px;
  background: rgba(123, 44, 191, 0.06);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.5;
}
.flow-prompt span {
  color: var(--ink-700);
}

@keyframes flowDotPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(123, 44, 191, 0.08); }
}

/* 移动端步骤指示器适配 */
@media (max-width: 520px) {
  .flow-indicator { padding: 10px 12px; margin: 8px 10px 0; }
  .flow-steps-row { gap: 0; }
  .flow-dot-circle { width: 24px; height: 24px; font-size: 10px; }
  .flow-dot-label { font-size: 9px; max-width: 44px; }
  .flow-dot-line { margin: 11px 1px 0; min-width: 4px; }
}

/* 流程中的下载链接 */
.download-link {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 500;
}

.download-link:hover {
  color: var(--primary-dark);
}

/* ══════════════════════════════════════════════════════════
   首次访问欢迎引导（Welcome Modal）
   ══════════════════════════════════════════════════════════ */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.3s ease;
}

.welcome-modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 24px 20px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-header {
  text-align: center;
  margin-bottom: 20px;
}

.welcome-logo {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 10px;
}

.welcome-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 4px;
}

.welcome-header p {
  font-size: 13px;
  color: var(--ink-300);
}

.welcome-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.welcome-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--ink-100);
  background: var(--ink-50);
  cursor: pointer;
  transition: all 0.2s;
}

.welcome-card:hover,
.welcome-card:active {
  border-color: var(--purple-pale);
  background: #faf5ff;
  transform: translateY(-1px);
}

.welcome-card-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.welcome-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 2px;
}

.welcome-card-desc {
  font-size: 12px;
  color: var(--ink-300);
  line-height: 1.5;
}

.welcome-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #faf5ff, #f0f9ff);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid #E9D5FF;
}

.welcome-hint-icon {
  font-size: 18px;
  color: var(--purple);
  flex-shrink: 0;
}

.welcome-hint-text {
  font-size: 12px;
  color: var(--ink-500);
  line-height: 1.5;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.welcome-btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.welcome-btn-primary:hover,
.welcome-btn-primary:active {
  opacity: 0.9;
  transform: translateY(-1px);
}

.welcome-dont-show {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-300);
  cursor: pointer;
}

.welcome-dont-show input {
  width: 14px;
  height: 14px;
  accent-color: var(--purple);
}

/* 移动端汉堡菜单脉冲动画（首次访问时） */
.mobile-menu-btn.pulse {
  animation: menuPulse 2s ease-in-out infinite;
}

@keyframes menuPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(123, 44, 191, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(123, 44, 191, 0); }
}

/* 空状态优化 */
.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  color: var(--ink-300);
  margin-bottom: 16px;
}

.onboarding-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.onboarding-steps .step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--ink-50);
  border-radius: 20px;
  border: 1px solid var(--ink-100);
}

.onboarding-steps .step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.onboarding-steps .step-text {
  font-size: 12px;
  color: var(--ink-500);
  white-space: nowrap;
}

.onboarding-steps .step-arrow {
  font-size: 14px;
  color: var(--ink-300);
}

@media (max-width: 520px) {
  .welcome-modal {
    padding: 20px 16px 16px;
    max-height: 92vh;
  }
  .welcome-header h2 {
    font-size: 16px;
  }
  .welcome-card {
    padding: 12px;
  }
  .onboarding-steps .step-text {
    font-size: 11px;
  }
}
