/* ============================================================
   知微 · 高中 AI 学习平台
   style.css
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --ink: #141a2b;
  --ink-2: #4b5468;
  --ink-3: #8a93a8;
  --line: #e9ebf2;
  --line-2: #f1f3f8;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef0ff;
  --accent: #0ea5e9;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 26, 43, .04), 0 2px 8px rgba(20, 26, 43, .04);
  --shadow-md: 0 2px 6px rgba(20, 26, 43, .05), 0 12px 32px rgba(20, 26, 43, .07);
  --shadow-lg: 0 8px 24px rgba(79, 70, 229, .14), 0 24px 60px rgba(20, 26, 43, .10);
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
[hidden] { display: none !important; }
::selection { background: #d9d7ff; }

/* ---------------- 布局 ---------------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .3);
  letter-spacing: -0.5px;
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: var(--ink-3); letter-spacing: .3px; margin-top: -3px; }

.nav-label {
  font-size: 11px; color: var(--ink-3); letter-spacing: 1px;
  padding: 0 10px 8px; font-weight: 600;
}
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: 11px;
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  transition: background .18s, color .18s;
  text-align: left; width: 100%;
}
.nav-item svg { width: 17px; height: 17px; stroke-width: 1.7; opacity: .8; flex: 0 0 auto; }
.nav-item:hover { background: var(--line-2); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--brand); color: #fff;
  border-radius: 20px; padding: 1px 7px; min-width: 20px; text-align: center;
}
.nav-item.active .nav-badge { background: var(--brand); }
.nav-badge.zero { display: none; }

/* 外链型导航项（如学年计划页） */
a.nav-item { text-decoration: none; }
.nav-item .nav-new {
  margin-left: auto; font-size: 10px; font-weight: 600; letter-spacing: .3px;
  color: #7c3aed; background: #f3edff; border-radius: 20px; padding: 1px 7px;
}

.side-foot { margin-top: auto; }
.streak-card {
  background: linear-gradient(145deg, #f7f6ff, #fdfbff);
  border: 1px solid #ece9ff;
  border-radius: var(--radius);
  padding: 13px 14px;
}
.streak-top { display: flex; align-items: baseline; gap: 6px; }
.streak-num { font-size: 24px; font-weight: 700; color: var(--brand); letter-spacing: -.5px; }
.streak-txt { font-size: 12px; color: var(--ink-2); }
.streak-days { display: flex; gap: 4px; margin-top: 10px; }
.streak-days i {
  flex: 1; height: 5px; border-radius: 3px; background: #e4e1fa; display: block;
}
.streak-days i.on { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }

.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 6px 4px; margin-top: 10px;
  border-top: 1px solid var(--line-2);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; flex: 0 0 auto;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-meta { font-size: 11px; color: var(--ink-3); margin-top: -4px; }

/* ---------------- 主区域 ---------------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 64px; flex: 0 0 64px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 30px;
  background: rgba(246, 247, 251, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.page-title { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.page-desc { font-size: 12px; color: var(--ink-3); margin-top: -3px; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.date-chip {
  font-size: 12px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 5px 13px;
}
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 10px; padding: 8px 14px;
  font-size: 13px; font-weight: 600;
  transition: transform .12s, box-shadow .18s, background .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; stroke-width: 1.9; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, .26);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(79, 70, 229, .34); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: #d6d9e6; color: var(--ink); background: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }

.scroll { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }
.scroll::-webkit-scrollbar { width: 9px; }
.scroll::-webkit-scrollbar-thumb { background: #dcdff0; border-radius: 5px; }
.scroll::-webkit-scrollbar-thumb:hover { background: #c9cde3; }

.view { display: none; max-width: 1120px; margin: 0 auto; }
.view.active { display: block; animation: fadeUp .32s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 通用卡片 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px;
}
.card-title { font-size: 14px; font-weight: 700; letter-spacing: .2px; }
.card-sub { font-size: 12px; color: var(--ink-3); }
.card-body { padding: 0 18px 18px; }

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

/* ---------------- 首页 ---------------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 20px;
  padding: 26px 28px;
  color: #fff;
  background: linear-gradient(120deg, #4f46e5 0%, #6d4dea 46%, #8b5cf6 100%);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.hero::after {
  content: ''; position: absolute; right: -70px; top: -90px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 68%);
}
.hero::before {
  content: ''; position: absolute; left: 38%; bottom: -120px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(14,165,233,.25), transparent 70%);
}
.hero-txt { position: relative; z-index: 1; }
.hero-greet { font-size: 12.5px; opacity: .82; letter-spacing: .4px; }
.hero-title { font-size: 24px; font-weight: 700; margin: 6px 0 8px; letter-spacing: -.3px; }
.hero-desc { font-size: 13px; opacity: .84; max-width: 460px; line-height: 1.7; }
.hero-cta { display: flex; gap: 10px; margin-top: 18px; }
.hero-btn {
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff; padding: 9px 16px; border-radius: 11px;
  font-size: 13px; font-weight: 600;
  backdrop-filter: blur(4px);
  transition: background .18s;
}
.hero-btn:hover { background: rgba(255, 255, 255, .27); }
.hero-btn.solid { background: #fff; color: var(--brand); border-color: #fff; }
.hero-btn.solid:hover { background: #f4f3ff; }

.hero-ring { position: relative; z-index: 1; flex: 0 0 auto; }
.ring-wrap { position: relative; width: 118px; height: 118px; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-c {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center; line-height: 1.2;
}
.ring-c b { font-size: 26px; font-weight: 700; letter-spacing: -1px; }
.ring-c span { font-size: 10.5px; opacity: .82; display: block; margin-top: 2px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-top: 16px;
}
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px 14px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 12px; color: var(--ink-3); }
.stat-ico {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
}
.stat-ico svg { width: 14px; height: 14px; stroke-width: 2; }
.stat-val { font-size: 25px; font-weight: 700; letter-spacing: -.6px; margin-top: 4px; }
.stat-val small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }
.stat-foot { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.stat-foot em { font-style: normal; font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; margin-top: 16px; }

.subject-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.subject-row + .subject-row { border-top: 1px dashed var(--line-2); }
.sb-chip {
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; flex: 0 0 auto;
}
.sb-mid { flex: 1; min-width: 0; }
.sb-name { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
.sb-name span { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.sb-bar { height: 5px; background: var(--line-2); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.sb-bar i { display: block; height: 100%; border-radius: 3px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

.weak-item {
  display: flex; gap: 12px; padding: 11px 12px;
  border-radius: 12px; transition: background .16s; cursor: pointer;
}
.weak-item:hover { background: var(--surface-2); }
.weak-rank {
  width: 20px; height: 20px; border-radius: 6px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  background: #f4f5fa; color: var(--ink-3); margin-top: 2px;
}
.weak-item:nth-child(1) .weak-rank { background: #fff0f0; color: #e05a5a; }
.weak-item:nth-child(2) .weak-rank { background: #fff6e8; color: #d98b22; }
.weak-item:nth-child(3) .weak-rank { background: #eef4ff; color: #4a7bd0; }
.weak-main { flex: 1; min-width: 0; }
.weak-topic { font-size: 13px; font-weight: 600; }
.weak-sub { font-size: 11.5px; color: var(--ink-3); }
.weak-count { font-size: 11.5px; color: var(--danger); font-weight: 600; white-space: nowrap; }

/* 热力图 */
.heat { display: flex; gap: 7px; margin-top: 4px; }
.heat-day { flex: 1; text-align: center; }
.heat-cell {
  height: 42px; border-radius: 9px; background: var(--line-2);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  transition: transform .16s;
}
.heat-cell:hover { transform: translateY(-2px); }
.heat-cell.l1 { background: #e6e4fd; color: #6d63e8; }
.heat-cell.l2 { background: #cdc9fb; color: #4f46e5; }
.heat-cell.l3 { background: #a9a2f7; color: #fff; }
.heat-cell.l4 { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.heat-cell.today { outline: 2px solid #c7c2fb; outline-offset: 2px; }
.heat-lbl { font-size: 10.5px; color: var(--ink-3); margin-top: 6px; }

/* ---------------- AI 答疑 ---------------- */
.ask-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }

.composer { padding: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 20px; padding: 4.5px 12px;
  font-size: 12.5px; color: var(--ink-2); font-weight: 500;
  transition: all .16s;
}
.chip:hover { border-color: #cfd3e6; background: #fff; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.input-box {
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface-2);
  padding: 12px 14px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.input-box:focus-within {
  border-color: #c3befa; background: #fff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .07);
}
.input-box textarea {
  width: 100%; border: none; background: none; outline: none;
  resize: none; font-size: 14px; line-height: 1.7;
  max-height: 180px; min-height: 62px;
}
.input-box textarea::placeholder { color: #a7aec1; }
.composer-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 2px;
}
.attach-row { display: flex; gap: 6px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--ink-3); border: 1px solid transparent;
  transition: all .16s;
}
.icon-btn:hover { background: #f2f3f9; color: var(--ink-2); border-color: var(--line); }
.icon-btn svg { width: 16px; height: 16px; stroke-width: 1.8; }
.send-hint { font-size: 11.5px; color: var(--ink-3); margin-right: 10px; }
.send-hint kbd {
  background: #f2f3f9; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 4px; font-size: 10.5px; font-family: inherit; color: var(--ink-2);
}

.quick-list { display: flex; flex-direction: column; gap: 8px; padding: 0 18px 16px; }
.quick-item {
  text-align: left; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 11px;
  font-size: 12.5px; color: var(--ink-2);
  background: var(--surface-2);
  transition: all .16s;
  display: flex; gap: 9px; align-items: center;
}
.quick-item:hover { background: #fff; border-color: #d8d5f7; color: var(--ink); transform: translateX(2px); }
.quick-item .q-sub { font-size: 10.5px; color: var(--ink-3); flex: 0 0 auto; }
.quick-item .q-txt { flex: 1; }

/* 对话 */
.thread { display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; }
.msg-user { justify-content: flex-end; }
.bubble-user {
  background: linear-gradient(135deg, var(--brand), #6d4dea);
  color: #fff; border-radius: 14px 14px 4px 14px;
  padding: 11px 15px; max-width: 74%;
  font-size: 13.5px; line-height: 1.65;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .22);
  white-space: pre-wrap;
}
.ai-avatar {
  width: 30px; height: 30px; border-radius: 10px; flex: 0 0 auto;
  background: linear-gradient(135deg, #eef0ff, #e6f4ff);
  border: 1px solid #e3e6fb;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--brand);
  margin-top: 2px;
}
.ai-card {
  flex: 1; min-width: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.ai-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ai-tag {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px;
}
.ai-title { font-size: 15px; font-weight: 700; letter-spacing: .1px; margin-bottom: 4px; }
.ai-core {
  font-size: 13.5px; color: var(--ink-2);
  background: #f8f9fd; border-left: 3px solid #c9c4fb;
  border-radius: 0 8px 8px 0;
  padding: 9px 12px; margin: 10px 0 14px;
  line-height: 1.7;
}
.step { display: flex; gap: 11px; padding: 9px 0; }
.step + .step { border-top: 1px dashed var(--line-2); }
.step-no {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 auto;
  background: var(--brand-soft); color: var(--brand);
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center; margin-top: 1px;
}
.step-h { font-size: 13px; font-weight: 700; margin-bottom: 1px; }
.step-p { font-size: 13px; color: var(--ink-2); line-height: 1.72; }

.ai-block-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--ink-3);
  letter-spacing: .5px; margin: 16px 0 8px;
}
.ai-block-title::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.pitfall-item {
  font-size: 12.8px; color: var(--ink-2); line-height: 1.7;
  padding-left: 16px; position: relative; margin-bottom: 5px;
}
.pitfall-item::before {
  content: ''; position: absolute; left: 4px; top: 8px;
  width: 5px; height: 5px; border-radius: 50%; background: #f0b429;
}

.variant {
  background: linear-gradient(135deg, #fbfaff, #f7fbff);
  border: 1px solid #ecebfb; border-radius: 12px;
  padding: 12px 14px; margin-top: 6px;
}
.variant-q { font-size: 13px; font-weight: 600; line-height: 1.7; }
.variant-toggle {
  font-size: 12px; color: var(--brand); font-weight: 600;
  margin-top: 7px; display: inline-flex; align-items: center; gap: 4px;
}
.variant-a {
  display: none; margin-top: 9px; padding-top: 9px;
  border-top: 1px dashed #e2e0f7;
  font-size: 12.8px; color: var(--ink-2); line-height: 1.75;
}
.variant.open .variant-a { display: block; animation: fadeUp .2s ease both; }

.ai-actions {
  display: flex; gap: 8px; margin-top: 16px;
  padding-top: 13px; border-top: 1px solid var(--line-2);
  flex-wrap: wrap;
}
.ai-actions .btn-ghost:hover { border-color: #c9c4fb; color: var(--brand); }

.typing { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: #b9b3f7;
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.think-line {
  font-size: 12.5px; color: var(--ink-3);
  display: flex; align-items: center; gap: 8px;
  padding: 12px 0 2px;
}

.empty-hint {
  text-align: center; padding: 54px 20px; color: var(--ink-3);
}
.empty-hint h3 { font-size: 15px; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
.empty-hint p { font-size: 12.5px; max-width: 340px; margin: 0 auto; line-height: 1.75; }
.empty-ico {
  width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 14px;
  background: linear-gradient(135deg, #eef0ff, #f5f0ff);
  display: grid; place-items: center;
  color: var(--brand);
}
.empty-ico svg { width: 24px; height: 24px; stroke-width: 1.6; }

/* ---------------- 错题本 ---------------- */
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-count { margin-left: auto; font-size: 12px; color: var(--ink-3); }

.mistake-list { display: flex; flex-direction: column; gap: 12px; }
.mk {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 17px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, border-color .2s;
}
.mk:hover { box-shadow: var(--shadow-md); border-color: #e2e4ee; }
.mk.done { opacity: .62; }
.mk-top { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; flex-wrap: wrap; }
.mk-subject {
  font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 6px;
}
.mk-topic { font-size: 12px; color: var(--ink-3); }
.mk-time { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }
.mk-q { font-size: 13.5px; font-weight: 600; line-height: 1.7; margin-bottom: 5px; }
.mk-a {
  font-size: 12.8px; color: var(--ink-2); line-height: 1.72;
  background: var(--surface-2); border-radius: 9px; padding: 8px 11px;
  display: none;
}
.mk.open .mk-a { display: block; animation: fadeUp .2s ease both; }
.mk-bottom {
  display: flex; align-items: center; gap: 14px; margin-top: 11px;
  padding-top: 10px; border-top: 1px solid var(--line-2);
  flex-wrap: wrap;
}
.mk-progress { display: flex; align-items: center; gap: 5px; }
.mk-progress i {
  width: 16px; height: 4px; border-radius: 2px; background: var(--line);
}
.mk-progress i.on { background: var(--brand); }
.mk-stage { font-size: 11.5px; color: var(--ink-3); margin-left: 4px; }
.mk-actions { margin-left: auto; display: flex; gap: 6px; }
.link-btn { font-size: 12.5px; color: var(--ink-3); font-weight: 500; padding: 4px 6px; border-radius: 7px; }
.link-btn:hover { background: var(--line-2); color: var(--ink-2); }
.link-btn.ok:hover { color: var(--ok); background: #eafaf3; }

/* ---------------- 学习计划 ---------------- */
.plan-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.task {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  margin-bottom: 8px;
  transition: all .18s;
}
.task:hover { border-color: #dfe2f0; }
.task.done { background: var(--surface-2); }
.task.done .task-txt { text-decoration: line-through; color: var(--ink-3); }
.check {
  width: 20px; height: 20px; border-radius: 6px; flex: 0 0 auto;
  border: 1.6px solid #d3d7e6; background: #fff;
  display: grid; place-items: center;
  transition: all .16s;
}
.check svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3; opacity: 0; }
.task.done .check { background: var(--ok); border-color: var(--ok); }
.task.done .check svg { opacity: 1; }
.task-main { flex: 1; min-width: 0; }
.task-txt { font-size: 13.5px; font-weight: 500; }
.task-meta { font-size: 11.5px; color: var(--ink-3); margin-top: -2px; }
.task-mins { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

.review-day {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; font-size: 12.5px;
}
.review-day + .review-day { border-top: 1px dashed var(--line-2); }
.rd-date {
  width: 44px; flex: 0 0 auto; font-weight: 600; color: var(--ink-2);
}
.rd-date small { display: block; font-size: 10px; color: var(--ink-3); font-weight: 400; }
.rd-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.rd-dots i { width: 9px; height: 9px; border-radius: 3px; }

/* ---------------- 知识点图谱 ---------------- */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.kb-card {
  text-align: left; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 15px; box-shadow: var(--shadow-sm);
  transition: all .18s;
}
.kb-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #dfe2f0; }
.kb-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.kb-topic { font-size: 13.5px; font-weight: 700; }
.kb-core { font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.kb-foot { font-size: 11px; color: var(--ink-3); margin-top: 8px; display: flex; gap: 8px; align-items: center; }

/* ---------------- Toast ---------------- */
.toast-wrap {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 100;
  align-items: center; pointer-events: none;
}
.toast {
  background: #1b2136; color: #fff;
  border-radius: 11px; padding: 9px 18px;
  font-size: 13px; box-shadow: 0 10px 30px rgba(20, 26, 43, .25);
  animation: toastIn .28s cubic-bezier(.2, .9, .3, 1.2) both;
  display: flex; align-items: center; gap: 8px;
}
.toast svg { width: 15px; height: 15px; stroke-width: 2.2; color: #6ee7b7; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 高拍仪拍照 ---------------- */
.cam-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 20, 35, .58);
  backdrop-filter: blur(6px);
  display: none; place-items: center;
  padding: 22px;
}
.cam-mask.open { display: grid; animation: fadeUp .22s ease both; }

.cam-panel {
  width: min(880px, 100%);
  max-height: calc(100vh - 44px);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(10, 15, 30, .35);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.cam-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 15px 18px;
  border-bottom: 1px solid var(--line-2);
}
.cam-title { font-size: 15px; font-weight: 700; }
.cam-sub { font-size: 12px; color: var(--ink-3); margin-top: -2px; }

.cam-stage {
  position: relative; background: #0d1120;
  width: 100%; aspect-ratio: 4 / 3; max-height: 56vh;
  display: grid; place-items: center; overflow: hidden;
  touch-action: none;
}
.cam-stage video, .cam-stage img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
#camShot { display: none; }
.cam-stage.shot #camShot { display: block; }
.cam-stage.shot video { display: none; }

.cam-frame {
  position: absolute; inset: 6%;
  border-radius: 12px; pointer-events: none;
  border: 1px dashed rgba(255, 255, 255, .28);
}
.cam-frame span {
  position: absolute; width: 24px; height: 24px;
  border: 2.5px solid rgba(255, 255, 255, .9);
}
.cam-frame span:nth-child(1) { left: -1px; top: -1px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.cam-frame span:nth-child(2) { right: -1px; top: -1px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.cam-frame span:nth-child(3) { left: -1px; bottom: -1px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.cam-frame span:nth-child(4) { right: -1px; bottom: -1px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.cam-stage.shot .cam-frame { display: none; }

.crop-box {
  position: absolute; border: 2px solid #fff; border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(6, 10, 20, .5);
  cursor: crosshair;
}
.crop-box::after {
  content: ''; position: absolute; inset: 0;
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, .55);
}

.cam-status {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: #fff; font-size: 13px; text-align: center;
  background: rgba(10, 14, 25, .7); border-radius: 10px;
  padding: 9px 16px; max-width: 80%;
  display: none;
}
.cam-status.show { display: block; }
.cam-status.busy::after {
  content: ''; display: inline-block; width: 12px; height: 12px;
  margin-left: 8px; vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.cam-status.err { background: rgba(180, 40, 40, .85); }

.cam-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 18px; border-top: 1px solid var(--line-2);
}
.cam-select {
  flex: 1; min-width: 180px;
  padding: 7px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 12.5px; color: var(--ink-2); outline: none;
  max-width: 100%;
}
.cam-select:focus { border-color: #c3befa; }
.cam-btns { display: flex; gap: 8px; margin-left: auto; }
.cam-tip {
  padding: 0 18px 15px; font-size: 11.5px; color: var(--ink-3);
  line-height: 1.7;
}
.cam-tip b { color: var(--ink-2); }

/* 识别的题干 */
.q-block {
  margin: 10px 0 12px; padding: 10px 12px;
  background: #fbfbfe; border: 1px dashed #e3e0f7; border-radius: 10px;
}
.q-label {
  font-size: 11px; font-weight: 700; color: var(--ink-3);
  letter-spacing: .5px; margin-bottom: 3px;
}
.q-text { font-size: 13px; color: var(--ink-2); line-height: 1.75; white-space: pre-wrap; }

.ai-err .ai-core {
  background: #fdf6f6; border-left-color: #f0b4b4; color: #7a4a4a;
}
.ai-err .ai-title { color: #b0423f; }

/* 对话里的题目照片 */
.bubble-img {
  display: block; max-width: 250px; max-height: 190px;
  border-radius: 12px; object-fit: cover;
  border: 1px solid var(--line);
}
.msg-user .bubble-photo {
  background: #fff; padding: 5px; border-radius: 14px 14px 4px 14px;
  box-shadow: 0 6px 18px rgba(20, 26, 43, .12);
}

/* ---------------- 拍照提问入口 ---------------- */
.hero-btn svg.hero-ic {
  width: 15px; height: 15px; margin-right: 6px;
  vertical-align: -3px; stroke-width: 2.3;
}

.shot-cta {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 12px;
  background: linear-gradient(135deg, #f3f2ff 0%, #eef7ff 100%);
  border: 1px solid #dcd8ff; border-radius: 13px;
  text-align: left; transition: all .18s;
}
.shot-cta:hover {
  border-color: #b8b0ff; transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(79, 70, 229, .12);
}
.shot-cta:active { transform: translateY(0); }
.shot-cta-ic {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .26);
}
.shot-cta-ic svg { width: 19px; height: 19px; stroke-width: 2; }
.shot-cta-txt { flex: 1; min-width: 0; display: block; }
.shot-cta-txt b { display: block; font-size: 14.5px; color: var(--brand); letter-spacing: .2px; }
.shot-cta-txt i {
  display: block; font-style: normal; font-size: 12px;
  color: var(--ink-3); margin-top: 2px; line-height: 1.45;
}
.shot-cta-arrow {
  flex: 0 0 auto; width: 15px; height: 15px;
  color: #a9a2e8; stroke-width: 2.5;
}

/* 取景台轻点即拍 */
.cam-stage { cursor: pointer; }
.cam-stage.shot { cursor: default; }
.cam-tap {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  padding: 6px 14px; border-radius: 20px; white-space: nowrap;
  background: rgba(12, 16, 28, .58); color: #fff;
  font-size: 12px; letter-spacing: .3px;
  backdrop-filter: blur(6px); pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
.cam-stage.ready .cam-tap { opacity: 1; }
.cam-stage.shot .cam-tap { opacity: 0; }

/* ---------------- 响应式 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
@media (max-width: 980px) {
  .cam-panel { max-height: calc(100vh - 24px); }
  .cam-stage { max-height: 48vh; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .ask-wrap, .plan-grid { grid-template-columns: 1fr; }
  .hero-ring { display: none; }
}
@media (max-width: 720px) {
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    width: 100%; flex: none; height: 62px;
    flex-direction: row; padding: 0 6px;
    border-right: none; border-top: 1px solid var(--line);
    z-index: 50; align-items: center;
  }
  .brand, .nav-label, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; gap: 0; }
  .nav-item {
    flex-direction: column; gap: 2px; padding: 6px 0;
    font-size: 10px; flex: 1; align-items: center; justify-content: center;
    border-radius: 9px;
  }
  .nav-item svg { width: 19px; height: 19px; }
  .nav-badge { position: absolute; transform: translate(12px, -10px); font-size: 9px; padding: 0 4px; }
  .scroll { padding: 18px 16px 90px; }
  .topbar { padding: 0 16px; height: 58px; flex: 0 0 58px; }
  .hero { padding: 20px; }
  .hero-title { font-size: 20px; }
  .stat-grid { gap: 10px; }
  .stat-val { font-size: 21px; }
  .date-chip { display: none; }
}
