/* =========================================================
   OmniLearn · 自主学习星图
   浅色商务主题（对齐「爱成长门店运营系统」配色）
   侧边栏 + 顶栏 + 卡片/表格/星图
   ========================================================= */

:root {
  --bg: #F3F6FC;
  --bg-2: #EDEFF5;
  --card: #FFFFFF;
  --card-solid: #FFFFFF;
  --border: rgba(20, 50, 110, 0.13);
  --border-2: rgba(20, 50, 110, 0.08);
  --text: #1D2129;
  --text-2: #4E5969;
  --text-3: #86909C;
  --primary: #2563EB;
  --primary-2: #1D4ED8;
  --primary-bg: rgba(37, 99, 235, 0.10);
  --primary-soft: rgba(37, 99, 235, 0.30);
  --purple: #7C3AED;
  --purple-bg: rgba(124, 58, 237, 0.12);
  --purple-bd: rgba(124, 58, 237, 0.32);
  --green: #16A34A;
  --green-bg: rgba(22, 163, 74, 0.12);
  --green-bd: rgba(22, 163, 74, 0.30);
  --blue: #0EA5E9;
  --blue-bg: rgba(14, 165, 233, 0.14);
  --blue-bd: rgba(14, 165, 233, 0.32);
  --orange: #D97706;
  --orange-bg: rgba(217, 119, 6, 0.12);
  --orange-bd: rgba(217, 119, 6, 0.30);
  --red: #DC2626;
  --red-bg: rgba(220, 38, 38, 0.10);
  --red-bd: rgba(220, 38, 38, 0.28);
  --gray-bg: #F2F3F5;
  --gray: #86909C;
  --grad: linear-gradient(90deg, #2563EB, #7C3AED);
  --grad-soft: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(124, 58, 237, 0.10));
  --radius: 12px;
  --shadow: 0 4px 16px rgba(20, 50, 110, 0.08);
  --glow: 0 0 0 1px rgba(37, 99, 235, 0.14), 0 10px 40px rgba(20, 50, 110, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, select { font: inherit; color: inherit; }
img { max-width: 100%; }

/* ---------- 应用壳 ---------- */
#app { display: flex; min-height: 100vh; }

#sidebar {
  width: 222px; flex: none;
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  position: fixed; top: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column; z-index: 40;
  transition: transform 0.25s ease;
}
.brand { padding: 16px 16px 14px; border-bottom: 1px solid var(--border-2); display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: var(--grad); color: #FFFFFF; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}
.brand-logo svg { width: 19px; height: 19px; }
.brand-name {
  font-size: 14.5px; font-weight: 800; line-height: 1.25; letter-spacing: 0.06em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub { font-size: 10.5px; color: var(--text-3); line-height: 1.3; letter-spacing: 0.12em; }

.side-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-group { font-size: 10.5px; color: var(--text-3); padding: 10px 10px 4px; letter-spacing: 0.16em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-size: 13.5px; margin-bottom: 2px;
  border-left: 2px solid transparent; transition: all 0.15s;
}
.nav-item:hover { background: rgba(37, 99, 235, 0.06); color: var(--text); }
.nav-item.active { background: rgba(37, 99, 235, 0.10); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-badge { margin-left: auto; font-size: 11px; color: var(--text-3); background: var(--gray-bg); border-radius: 6px; padding: 0 6px; line-height: 17px; }
.nav-item.active .nav-badge { background: rgba(37, 99, 235, 0.16); color: var(--primary); }

.sidebar-user {
  border-top: 1px solid var(--border-2); padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user .avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--grad); color: #FFFFFF; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.26);
}
.sidebar-user .u-name { font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .u-level { font-size: 10.5px; color: var(--primary); letter-spacing: 0.06em; }
.sidebar-user .u-out { margin-left: auto; font-size: 11px; color: var(--text-3); }
.sidebar-user .u-out:hover { color: var(--primary); }

#menuBtn { display: none; width: 34px; height: 34px; border-radius: 8px; color: var(--text-2); place-items: center; }
#menuBtn svg { width: 18px; height: 18px; }

#main { margin-left: 222px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  height: 58px; background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.tb-left { min-width: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
#pageTitle { font-size: 15.5px; font-weight: 700; letter-spacing: 0.02em; }
.tb-sub { font-size: 12px; color: var(--text-3); }
.tb-right { display: flex; align-items: center; gap: 10px; }
.role-tag {
  background: var(--primary-bg); color: var(--primary); border: 1px solid var(--primary-soft);
  border-radius: 6px; padding: 3px 9px; font-weight: 600; font-size: 11.5px; white-space: nowrap;
}
.avatar-chip {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--grad-soft); border: 1px solid var(--border);
  color: var(--primary); display: grid; place-items: center; font-size: 12px; font-weight: 700;
}

#content { padding: 20px 22px 72px; max-width: 1360px; width: 100%; }
.panel[hidden] { display: none; }

/* ---------- 卡片 / 网格 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-t { font-size: 14.5px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g21 { grid-template-columns: 2fr 1fr; }
.g12 { grid-template-columns: 1fr 2fr; }

.stat { padding: 16px; }
.stat .label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 750; margin: 5px 0 3px; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; letter-spacing: 0; }
.stat .sub { font-size: 12px; color: var(--text-3); }
.stat .sub.warn { color: var(--red); }

.pbar { height: 7px; background: #E5E6EB; border-radius: 999px; overflow: hidden; }
.pbar > i { display: block; height: 100%; border-radius: 999px; background: var(--grad); transition: width 0.5s ease; }

/* ---------- 表格 ---------- */
.tbl-wrap {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--radius); background: #FFFFFF; box-shadow: var(--shadow);
}
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.tbl th {
  background: #F2F3F5; color: var(--text-2); font-weight: 600; text-align: left;
  padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--border); font-size: 12px;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: rgba(37, 99, 235, 0.045); }
.tbl .num { font-variant-numeric: tabular-nums; }
.cell-title { font-weight: 600; font-size: 13.5px; }
.cell-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.cell-actions { display: flex; gap: 6px; }
.prog-cell { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.prog-cell .pbar { flex: 1; }
.prog-cell span { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; width: 38px; text-align: right; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1.5px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 500;
  white-space: nowrap; border: 1px solid transparent;
}
.tag-red, .tag-primary { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-soft); }
.tag-blue { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-bd); }
.tag-green { background: var(--green-bg); color: var(--green); border-color: var(--green-bd); }
.tag-orange { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-bd); }
.tag-purple { background: var(--purple-bg); color: var(--purple); border-color: var(--purple-bd); }
.tag-gray { background: var(--gray-bg); color: var(--gray); border-color: var(--border); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid transparent;
  background: var(--grad); color: #FFFFFF; font-size: 13px; font-weight: 600;
  transition: filter 0.15s, transform 0.15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: #FFFFFF; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--gray-bg); filter: none; }
.btn-soft { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-soft); }
.btn-soft:hover { background: rgba(37, 99, 235, 0.18); filter: none; }
.btn-primary, .btn-red { background: var(--grad); color: #FFFFFF; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn svg { width: 14px; height: 14px; flex: none; }

/* ---------- 筛选 ---------- */
.filter-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 14px;
}
.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg button {
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; color: var(--text-2);
  border: 1px solid var(--border); background: #FFFFFF; transition: all 0.15s;
}
.seg button:hover { border-color: var(--primary); color: var(--primary); }
.seg button.on { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.starmap-tabs { margin-top: 16px; margin-bottom: 4px; }
.starmap-tabs button { padding: 7px 16px; font-size: 14px; }
.filter-bar .spacer { flex: 1; }
.filter-bar.sub { margin-top: 10px; }
@media (max-width: 860px) {
  .filter-bar.sub { flex-wrap: nowrap; }
  .filter-bar.sub .seg { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .filter-bar.sub .seg button { flex: 0 0 auto; white-space: nowrap; }
}

/* 教材星库：学段 → 年级 → 科目 下钻导航 */
.lib-nav { margin-bottom: 14px; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.breadcrumb button { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 3px 7px; border-radius: 7px; font-family: inherit; }
.breadcrumb button:hover { background: var(--primary-bg); }
.breadcrumb .sep { color: var(--text-3); margin: 0 1px; }
.breadcrumb .cur { color: var(--text); font-weight: 600; padding: 3px 7px; }
.lib-level-title { font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; letter-spacing: .3px; }
.lib-levels { display: flex; flex-wrap: wrap; gap: 10px; }
.lib-opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 108px; min-height: 58px; padding: 10px 16px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all .15s; font-family: inherit;
}
.lib-opt:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); transform: translateY(-1px); box-shadow: var(--shadow); }
.lib-opt.on { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); box-shadow: 0 0 0 2px var(--primary-bg); }
.lib-opt .sub { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.lib-opt:hover .sub { color: var(--primary); }
#lib-table-wrap[hidden] { display: none; }
#book-rows .cell-actions { flex-direction: column; align-items: stretch; gap: 6px; }
#book-rows .cell-actions .btn { width: 100%; justify-content: center; }

.result-count { font-size: 12px; color: var(--text-3); }

/* ---------- 错题星集 ---------- */
.wb-callout { margin-bottom: 16px; }
.wb-list { display: flex; flex-direction: column; gap: 14px; }
.wb-card {
  border: 1px solid var(--border); border-radius: 14px; background: var(--card);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.wb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.wb-grade { font-size: 13px; font-weight: 600; color: var(--text-2); }
.wb-unit { font-size: 12px; color: var(--text-3); }
.wb-q { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.5; margin-bottom: 10px; }
.wb-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.wb-opt {
  padding: 6px 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-2); font-size: 14px; color: var(--text-2);
}
.wb-opt.right { background: #e7f7ee; border-color: #7fd6a5; color: #1f9254; font-weight: 600; }
.wb-opt.wrong { background: #fdeaea; border-color: #f0a3a3; color: #d23b3b; font-weight: 600; text-decoration: line-through; }
.wb-ans { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 8px; font-size: 14px; }
.wb-wrong { color: #d23b3b; }
.wb-right { color: #1f9254; }
.wb-explain { font-size: 14px; color: var(--text-2); line-height: 1.6; margin-bottom: 6px; }
.wb-practice { font-size: 14px; color: var(--primary); line-height: 1.6; margin-bottom: 12px; }
.wb-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.wb-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; margin-bottom: 14px;
  background: var(--primary-bg); border: 1px solid var(--border); border-radius: 14px;
}
.wb-toolbar-info { font-size: 13px; color: var(--text-2); }
.wb-toolbar .btn { white-space: nowrap; }
.wb-empty {
  padding: 40px 20px; text-align: center; color: var(--text-3);
  border: 1px dashed var(--border); border-radius: 14px; line-height: 1.8; font-size: 14px;
}
/* ---------- 智能练习弹窗 ---------- */
.wp-modal { max-width: 540px; }
.wp-progress { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.wp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.wp-q { font-size: 17px; font-weight: 600; color: var(--text-1); line-height: 1.6; margin-bottom: 10px; }
.wp-hint {
  font-size: 13px; color: var(--text-2); background: var(--yellow-bg, #fff8e6);
  border-left: 3px solid #f5b400; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px;
}
.wp-explain {
  margin-top: 14px; font-size: 14px; line-height: 1.7; color: var(--text-2);
  background: var(--primary-bg); border-radius: 10px; padding: 10px 12px;
}
.wp-explain b { color: var(--text-1); }
.wp-modal .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wp-modal .opt { min-height: 48px; }
@media (max-width: 600px) {
  .wb-card { padding: 14px; }
  .wb-q { font-size: 15px; }
  .wb-ans { gap: 10px; }
  .wb-actions .btn { flex: 1 1 auto; justify-content: center; }
  .wb-toolbar { flex-direction: column; align-items: stretch; }
  .wb-toolbar .btn { justify-content: center; }
  .wp-modal .opts { grid-template-columns: 1fr; }
}
.search {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px;
  background: #F7F8FA; min-width: 230px;
}
.search svg { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.search input { border: none; outline: none; background: transparent; width: 100%; font-size: 13px; color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.empty { padding: 40px 12px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }

.callout {
  border-radius: 10px; padding: 12px 14px; font-size: 12.8px; line-height: 1.75;
  border: 1px solid var(--blue-bd); background: var(--blue-bg); color: #1D4ED8;
  margin-bottom: 16px;
}
.callout a { color: var(--primary); text-decoration: underline; }
.crumbs { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; margin: 0 0 14px; }
.crumbs a:hover { color: var(--primary); }

/* ---------- 知识星图 ---------- */
.starmap-head { margin-bottom: 18px; }
.starmap-head h2 { font-size: 24px; font-weight: 800; letter-spacing: 0.01em; }
.starmap-head h2 em {
  font-style: normal;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.starmap-head p { font-size: 13px; color: var(--text-2); margin-top: 6px; }

.planet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.planet {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow); transition: transform 0.2s, border-color 0.2s;
}
.planet::after {
  content: ''; position: absolute; right: -30px; top: -40px; width: 130px; height: 130px;
  border-radius: 50%; background: radial-gradient(circle, var(--pc, rgba(37, 99, 235, 0.30)), transparent 68%);
  opacity: 0.35; pointer-events: none;
}
.planet:hover { transform: translateY(-3px); border-color: var(--primary-soft); }
.planet-top { display: flex; align-items: center; gap: 10px; }
.planet-icon {
  width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-size: 18px; background: var(--grad-soft); border: 1px solid var(--border);
}
.planet h3 { font-size: 15.5px; font-weight: 700; }
.planet .p-stage { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.planet .p-desc { font-size: 12.5px; color: var(--text-2); margin: 12px 0 14px; min-height: 38px; line-height: 1.6; }
.planet .p-progress { display: flex; align-items: center; gap: 8px; }
.planet .p-progress .pbar { flex: 1; height: 6px; }
.planet .p-progress span { font-size: 11.5px; color: var(--text-2); }
.planet .p-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.planet .p-badges { display: flex; gap: 4px; }
.score-pill {
  width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center;
  font-size: 10px; background: var(--gray-bg); border: 1px solid var(--border); color: var(--text-3);
}
.score-pill.on { color: var(--orange); border-color: var(--orange-bd); background: var(--orange-bg); }
.planet .p-enter {
  font-size: 12px; color: var(--primary); display: inline-flex; align-items: center; gap: 4px; font-weight: 600;
}
.planet .p-enter:hover { text-decoration: underline; }

/* ---------- 航行日志 ---------- */
.journal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.journal-head h2 { font-size: 22px; font-weight: 800; }
.journal-head p { font-size: 13px; color: var(--text-2); margin-top: 5px; }

.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.choice {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; box-shadow: var(--shadow); transition: border-color 0.15s, transform 0.15s;
}
.choice:hover { border-color: var(--primary-soft); transform: translateY(-2px); }
.choice .c-tag { font-size: 11px; letter-spacing: 0.1em; color: var(--text-3); }
.choice h4 { font-size: 15px; font-weight: 700; }
.choice p { font-size: 12.5px; color: var(--text-2); line-height: 1.65; min-height: 40px; }
.choice .c-link { margin-top: auto; font-size: 12px; color: var(--primary); font-weight: 600; }

/* ---------- 成就殿堂 ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.badge-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; text-align: center; box-shadow: var(--shadow); position: relative;
}
.badge-icon {
  width: 46px; height: 46px; border-radius: 50%; margin: 0 auto 10px;
  display: grid; place-items: center; font-size: 21px;
  background: var(--grad-soft); border: 1px solid var(--primary-soft);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.18);
}
.badge-card h4 { font-size: 13.5px; font-weight: 700; }
.badge-card p { font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }
.badge-card.locked { opacity: 0.55; }
.badge-card.locked .badge-icon {
  background: var(--gray-bg); border-color: var(--border); box-shadow: none;
  filter: grayscale(1);
}
.badge-card .b-state { margin-top: 9px; font-size: 11px; color: var(--green); }
.badge-card.locked .b-state { color: var(--text-3); }

/* ---------- 课程详情 ---------- */
.course-layout { display: grid; grid-template-columns: 292px 1fr; gap: 16px; align-items: start; }
.course-side { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 14px; }
.side-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.side-card h4 { font-size: 13.5px; font-weight: 700; }
.ring-wrap { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.ring {
  --p: 0; width: 68px; height: 68px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), #E5E6EB 0);
  display: grid; place-items: center; position: relative;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.20);
}
.ring::before { content: ''; position: absolute; inset: 7px; background: #FFFFFF; border-radius: 50%; }
.ring span { position: relative; font-size: 17px; font-weight: 700; }

.unit-list { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; max-height: 380px; overflow-y: auto; }
.unit-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px;
  font-size: 13px; color: var(--text-2); cursor: pointer; transition: background 0.15s;
}
.unit-item:hover { background: #F2F3F5; }
.unit-item.on { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.unit-item .dot { width: 6px; height: 6px; border-radius: 50%; background: #C9CDD4; flex: none; }
.unit-item.done .dot { background: var(--green); }
.unit-item .u-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.course-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.course-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #FFFFFF, #F3F6FF);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px 20px;
}
.course-hero::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--grad);
}
.course-hero .pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.course-hero .pills span {
  font-size: 11.5px; color: var(--text-2); background: var(--gray-bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px;
}
.course-hero h2 { font-size: 21px; font-weight: 800; }
.course-hero .desc { color: var(--text-2); margin-top: 8px; max-width: 640px; font-size: 13px; }
.course-hero .goals { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12.5px; color: var(--text-2); }
.course-hero .goals span { display: inline-flex; align-items: center; gap: 5px; }
.course-hero .goals i { color: var(--primary); font-style: normal; }
.course-hero .hero-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

.unit-block {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.unit-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border-2); background: #F7F8FA;
}
.unit-head .no {
  font-family: 'SFMono-Regular', Consolas, monospace; font-size: 11px; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 5px; padding: 0 5px;
}
.unit-head h4 { font-size: 14px; flex: 1; font-weight: 600; }
.unit-head .mini-progress { font-size: 11.5px; color: var(--text-3); }

.activities { display: grid; grid-template-columns: repeat(3, 1fr); }
.activity {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-right: 1px solid var(--border-2); cursor: pointer; transition: background 0.15s;
}
.activity:last-child { border-right: none; }
.activity:hover { background: rgba(37, 99, 235, 0.05); }
.activity .a-icon {
  width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-bd);
}
.activity .a-icon svg { width: 15px; height: 15px; }
.activity.a-quiz .a-icon { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-soft); }
.activity.a-assign .a-icon { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-bd); }
.activity .a-body { min-width: 0; flex: 1; }
.activity .a-title { font-size: 13px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity .a-type { font-size: 11px; color: var(--text-3); margin-top: 1px; display: block; }
.activity .check {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border);
  display: grid; place-items: center; flex: none; color: #FFFFFF; background: transparent;
}
.activity .check svg { display: none; width: 10px; height: 10px; }
.activity.done .check { background: var(--green); border-color: var(--green); }
.activity.done .check svg { display: block; }
.activity.done .a-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: rgba(29, 33, 41, 0.25); }
.activity.flash { animation: flash 1.4s ease; }
@keyframes flash {
  0%, 100% { background: transparent; }
  30% { background: rgba(37, 99, 235, 0.14); }
  60% { background: rgba(37, 99, 235, 0.05); }
}

/* ---------- AI 学长 ---------- */
.tutor-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.chat-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
  height: calc(100vh - 170px); min-height: 520px; margin: 0;
}
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border-2); background: #F7F8FA;
}
.chat-avatar {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--grad); color: #FFFFFF; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.26);
}
.chat-avatar svg { width: 16px; height: 16px; }
.chat-head .who { font-size: 13.5px; font-weight: 600; }
.chat-head .who span { display: block; font-size: 11px; color: var(--text-3); font-weight: 400; }
.badge-demo {
  margin-left: auto; font-size: 11px; color: var(--orange);
  background: var(--orange-bg); border: 1px solid var(--orange-bd);
  padding: 2px 8px; border-radius: 6px; white-space: nowrap;
}
.badge-live {
  color: #1a7f37; background: #e8f6ee; border-color: #b7e3c6;
}
/* 教学模式切换（对接 Omni-Edu 教学任务） */
.tutor-modes { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border-2); background: var(--surface); }
.tutor-mode {
  font-size: 12px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); transition: all .15s;
}
.tutor-mode:hover { border-color: var(--primary); color: var(--primary); }
.tutor-mode.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 3px 10px rgba(37,99,235,.22); }
.chat-log { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { display: flex; gap: 9px; max-width: 88%; animation: rise 0.3s ease both; }
.msg .avatar {
  width: 28px; height: 28px; border-radius: 7px; flex: none; display: grid; place-items: center;
  background: var(--gray-bg); color: var(--text-2); border: 1px solid var(--border);
}
.msg .avatar svg { width: 14px; height: 14px; }
.msg .bubble { font-size: 13px; padding: 10px 14px; border-radius: 4px 12px 12px 12px; background: #F2F3F5; line-height: 1.75; }
.msg.user { margin-left: auto; flex-direction: row-reverse; }
.msg.user .bubble { background: var(--grad); color: #FFFFFF; border-radius: 12px 4px 12px 12px; font-weight: 500; }
.msg.user .avatar { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-soft); }

.answer {
  padding: 14px 16px; border-radius: 4px 12px 12px 12px; background: #FFFFFF;
  border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 13px; max-width: 100%;
}
.answer .a-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.answer .a-top .pill {
  font-size: 10.5px; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 6px;
  background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-bd);
}
.answer h5 { font-size: 15px; margin: 0 0 3px; font-weight: 700; }
.answer .cite { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--green); margin-bottom: 10px; }
.answer .cite:hover { text-decoration: underline; }
.answer .cite svg { width: 13px; height: 13px; }
.answer .blk { margin-top: 12px; }
.answer .blk .bh { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; color: var(--primary); margin-bottom: 4px; }
.answer .blk p, .answer .blk li { font-size: 12.8px; color: var(--text-2); line-height: 1.75; }
.answer .blk ol, .answer .blk ul { margin: 0; padding-left: 17px; }
.answer .footnote { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 11px; color: var(--text-3); }
.typing { display: flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.chat-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 12px; }
.chip {
  font-size: 12px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2); background: #FFFFFF;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chat-form { display: flex; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--border-2); background: #FAFBFC; }
.chat-form input {
  flex: 1; border: 1px solid var(--border); background: #FFFFFF; border-radius: 8px;
  padding: 9px 12px; font-size: 13px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; color: var(--text);
}
.chat-form input::placeholder { color: var(--text-3); }
.chat-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.chat-form button { flex: none; padding: 0 18px; border-radius: 8px; background: var(--grad); color: #FFFFFF; font-size: 13px; font-weight: 600; }

.tutor-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 74px; }
.cap-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.cap { display: flex; gap: 9px; align-items: flex-start; }
.cap .ci {
  width: 26px; height: 26px; border-radius: 7px; flex: none; display: grid; place-items: center;
  background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-bd);
  font-family: 'SFMono-Regular', Consolas, monospace; font-size: 10.5px;
}
.cap .ct { font-size: 12.5px; font-weight: 600; }
.cap .cd { font-size: 11.5px; color: var(--text-3); line-height: 1.5; margin-top: 1px; }
.refs { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.ref {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px;
  font-size: 12.5px; color: var(--text-2); transition: background 0.15s;
}
.ref:hover { background: #F2F3F5; color: var(--text); }
.ref .rd { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); flex: none; }

/* ---------- 学习报告 ---------- */
.dash-top { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.stat-card .sk { font-size: 12px; color: var(--text-2); }
.stat-card .sv { font-size: 26px; font-weight: 750; margin-top: 5px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-card .sv small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.stat-card .sd { font-size: 12px; color: var(--green); margin-top: 5px; }
.stat-card .sd.warn { color: var(--red); }

.dash-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.dash-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin: 0;
}
.dash-card h3 { font-size: 14.5px; font-weight: 700; }
.dash-card .dc-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.dash-card .dc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row .br-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; color: var(--text-2); }
.bar-row .br-top b { color: var(--text); font-weight: 600; }
.bar-row .bar { height: 7px; border-radius: 999px; background: #E5E6EB; overflow: hidden; }
.bar-row .bar > span { display: block; height: 100%; border-radius: 999px; transition: width 0.5s; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; margin-top: 12px; }
.day { text-align: center; font-size: 11px; color: var(--text-3); }
.day .cell {
  height: 32px; border-radius: 7px; background: #F2F3F5; margin-bottom: 4px;
  display: grid; place-items: center; color: var(--text-3); font-size: 11.5px;
}
.day .cell.done { background: linear-gradient(150deg, #22c55e, #15803d); color: #FFFFFF; font-weight: 600; }
.day .cell.today { box-shadow: inset 0 0 0 2px var(--primary); color: var(--primary); font-weight: 700; }
.day .cell.done.today { color: #FFFFFF; }

.plan-list { display: flex; flex-direction: column; gap: 2px; }
.plan-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 9px; border-radius: 8px;
  cursor: pointer; font-size: 13px; transition: background 0.15s;
}
.plan-item:hover { background: #F2F3F5; }
.plan-item .pbox {
  width: 17px; height: 17px; border-radius: 4px; border: 1.5px solid var(--border);
  flex: none; display: grid; place-items: center; color: #FFFFFF;
}
.plan-item .pbox svg { width: 10px; height: 10px; display: none; }
.plan-item.done .pbox { background: var(--green); border-color: var(--green); }
.plan-item.done .pbox svg { display: block; }
.plan-item.done .pt { color: var(--text-3); text-decoration: line-through; }
.plan-item .pd { font-size: 11px; color: var(--text-3); margin-left: auto; white-space: nowrap; }

.diag-list { display: flex; flex-direction: column; gap: 10px; }
.diag { padding: 11px 13px; border-radius: 9px; background: #FAFBFC; border: 1px solid var(--border-2); font-size: 12.8px; }
.diag .dh { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12.8px; }
.diag .dh i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); font-style: normal; flex: none; }
.diag p { color: var(--text-3); font-size: 12px; margin-top: 3px; line-height: 1.65; }

/* ---------- 模态 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(29, 33, 41, 0.45); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(4px);
}
.modal-mask.open { display: flex; animation: fade 0.2s ease both; }
.modal {
  width: min(560px, 100%); background: #FFFFFF; border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 30px 80px rgba(20, 50, 110, 0.25); overflow: hidden;
  animation: pop 0.22s ease both;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-2); }
.modal-head h3 { font-size: 15px; font-weight: 700; }
.modal-head .close { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: var(--text-3); }
.modal-head .close:hover { background: #F2F3F5; color: var(--text); }
.modal-body { padding: 18px 20px; max-height: 62vh; overflow-y: auto; }
.q-progress { font-size: 11.5px; color: var(--text-3); letter-spacing: 0.05em; margin-bottom: 8px; }
.q-text { font-size: 16px; font-weight: 600; line-height: 1.6; margin-bottom: 14px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-radius: 8px;
  border: 1px solid var(--border); background: #FFFFFF; font-size: 13px;
  text-align: left; transition: all 0.15s;
}
.opt:hover { border-color: var(--primary); }
.opt .ok {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border); flex: none;
  display: grid; place-items: center; font-size: 12px; color: var(--text-3);
}
.opt.sel { border-color: var(--primary); background: var(--primary-bg); }
.opt.sel .ok { border-color: var(--primary); background: var(--primary); color: #FFFFFF; }
.opt.right { border-color: var(--green); background: var(--green-bg); }
.opt.right .ok { border-color: var(--green); background: var(--green); color: #FFFFFF; }
.opt.wrong { border-color: var(--red); background: var(--red-bg); }
.q-explain { margin-top: 14px; padding: 12px 14px; border-radius: 8px; background: var(--green-bg); border: 1px solid var(--green-bd); font-size: 12.8px; color: var(--text-2); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 18px; border-top: 1px solid var(--border-2); }

.p-item { border: 1px solid var(--border); border-radius: 9px; background: #FFFFFF; padding: 12px 14px; margin-bottom: 10px; }
.p-top { display: flex; gap: 9px; align-items: flex-start; }
.p-no {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-bd);
  font-size: 11.5px; font-weight: 700; display: grid; place-items: center;
}
.p-q { font-size: 13px; line-height: 1.7; }
.p-toggle { margin: 5px 0 0 29px; font-size: 12px; font-weight: 600; color: var(--primary); }
.p-toggle:hover { text-decoration: underline; }
.p-answer {
  display: none; margin: 7px 0 0 29px; padding: 9px 11px; border-radius: 8px;
  background: var(--green-bg); border: 1px solid var(--green-bd);
  font-size: 12.5px; color: var(--text-2); line-height: 1.7;
}
.p-item.show .p-answer { display: block; animation: fade 0.2s ease both; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 8px;
  background: #1D2129; border: 1px solid rgba(255, 255, 255, 0.12); color: #FFFFFF;
  font-size: 12.5px; box-shadow: 0 16px 40px rgba(20, 50, 110, 0.30); animation: toastIn 0.26s ease both;
}
.toast svg { width: 14px; height: 14px; color: #4ADE80; }

/* ---------- 动效 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 0.45s ease, transform 0.45s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- 年级筛选 + 册次入口 ---------- */
.grade-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.grade-chips .chip { font-size: 13px; padding: 7px 14px; cursor: pointer; }
.chip.on {
  background: var(--grad); border-color: transparent; color: #FFFFFF; font-weight: 600;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22);
}
.sem-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.sem-link {
  flex: 1 1 90px; text-decoration: none; display: block; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: #FFFFFF; transition: all 0.15s;
}
.sem-link:hover { border-color: var(--primary); background: var(--primary-bg); }
.sem-link b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.sem-link span { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ---------- 单元：视频讲解 + 文字版介绍 ---------- */
.ub-cols { display: grid; grid-template-columns: 1fr 1.15fr; gap: 0; border-top: 1px solid var(--border-2); }
.ub-col { padding: 14px 16px; min-width: 0; }
.ub-col + .ub-col { border-left: 1px solid var(--border-2); }
.ub-col-h {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700;
  color: var(--text-2); margin-bottom: 10px;
}
.ub-col-h svg { width: 15px; height: 15px; color: var(--primary); flex: none; }
.ub-col-h .ub-n { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--text-3); }

.video-list { display: flex; flex-direction: column; gap: 6px; }
.video-item {
  display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text);
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border-2); background: #FFFFFF;
  transition: all 0.15s;
}
.video-item:hover { border-color: var(--primary); background: var(--primary-bg); }
.video-item .v-no {
  width: 19px; height: 19px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: var(--primary); background: var(--primary-bg);
}
.video-item .v-t {
  flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.video-item svg { width: 13px; height: 13px; color: var(--text-3); flex: none; }

.ub-text { font-size: 12.5px; color: var(--text-2); line-height: 1.75; }
.ub-intro { margin-bottom: 10px; }
.ub-sub {
  font-size: 11.5px; font-weight: 700; color: var(--text-3); letter-spacing: 0.02em;
  margin: 10px 0 5px;
}
.ub-points { padding-left: 18px; margin: 0; }
.ub-points li { margin-bottom: 3px; }
.ub-kp { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.kp-chip {
  font-size: 11.5px; line-height: 1.4; padding: 4px 9px; border-radius: 999px;
  background: var(--green-bg); border: 1px solid var(--green-bd); color: #0E7A52;
}
.q-kp {
  display: inline-block; font-size: 11.5px; font-weight: 600; color: #0E7A52;
  background: var(--green-bg); border: 1px solid var(--green-bd); border-radius: 999px;
  padding: 3px 10px; margin-bottom: 8px;
}
.ub-ex {
  border: 1px solid var(--border-2); border-radius: 8px; padding: 8px 11px; margin-bottom: 6px;
  background: #FFFFFF;
}
.ub-ex summary { cursor: pointer; font-size: 12.5px; color: var(--text); outline: none; }
.ub-ex .ex-a {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
  font-size: 12.5px; color: var(--text-2);
}
.ub-ex .ex-a b { color: var(--primary); }

/* 四活动时自动换行 */
.activities { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.activity.a-video .a-icon { background: var(--purple-bg); color: var(--purple); border-color: var(--purple-bd); }

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3, .g21, .g12 { grid-template-columns: 1fr; }
  .planet-grid { grid-template-columns: repeat(2, 1fr); }
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
  .course-layout { grid-template-columns: 1fr; }
  .course-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .course-side .side-card { flex: 1 1 260px; }
  .unit-list { max-height: none; }
  .tutor-grid { grid-template-columns: 1fr; }
  .tutor-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .tutor-side .side-card { flex: 1 1 240px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-top { grid-template-columns: repeat(2, 1fr); }
  .chat-panel { height: 70vh; min-height: 480px; }
}
@media (max-width: 900px) {
  #sidebar { transform: translateX(-100%); box-shadow: 0 0 60px rgba(20, 50, 110, 0.25); }
  #sidebar.open { transform: none; }
  #main { margin-left: 0; }
  #menuBtn { display: grid; }
  #content { padding: 14px 14px 60px; }
  #topbar { padding: 0 14px; }
  .tb-sub { display: none; }
  .g2 { grid-template-columns: 1fr; }
  .planet-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .g4, .dash-top { grid-template-columns: 1fr; }
  .activities { grid-template-columns: 1fr; }
  .activity { border-right: none; border-bottom: 1px solid var(--border-2); }
  .activity:last-child { border-bottom: none; }
  .filter-bar { padding: 10px 12px; }
  .search { min-width: 100%; }
  .course-hero { padding: 18px 16px; }
  .chat-panel { height: 66vh; min-height: 420px; }
  .msg { max-width: 94%; }
}

/* ---------- 新增组件：小屏适配 ---------- */
@media (max-width: 900px) {
  .ub-cols { grid-template-columns: 1fr; }
  .ub-col + .ub-col { border-left: none; border-top: 1px solid var(--border-2); }
}

/* ---------- 侧栏遮罩（移动端点空白处收起） ---------- */
.sidebar-backdrop { display: none; }
@media (max-width: 900px) {
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 39;
    background: rgba(20, 30, 55, 0.42); opacity: 0; visibility: hidden;
    transition: opacity 0.25s ease;
  }
  #sidebar.open + .sidebar-backdrop { opacity: 1; visibility: visible; }
}

/* ---------- 手机端（≤600px）深度适配 ---------- */
@media (max-width: 600px) {
  #content { padding: 12px 12px 64px; }
  #topbar { height: 54px; padding: 0 12px; }
  #pageTitle { font-size: 14.5px; }
  .tb-right .role-tag { display: none; }
  .card { padding: 14px; }
  .card-h { margin-bottom: 10px; }

  /* 所有并列网格在手机上单列 */
  .g4, .g3, .g2, .g21, .g12,
  .planet-grid, .badge-grid, .dash-top, .choice-grid, .tutor-grid { grid-template-columns: 1fr; }

  /* 更大的触摸目标 */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }
  .chip { padding: 8px 13px; }
  .nav-item { padding: 11px 10px; font-size: 14px; }

  /* 教材星库：去掉横向滚动，压缩列、按钮自动换行 */
  .tbl-wrap { overflow-x: visible; }
  table.tbl { min-width: 0; font-size: 12.5px; }
  .tbl th, .tbl td { padding: 8px 9px; }
  .tbl th:nth-child(2), .tbl td:nth-child(2),
  .tbl th:nth-child(4), .tbl td:nth-child(4) { display: none; } /* 隐藏「学段 / 版本」列 */
  .cell-actions { display: flex; flex-wrap: wrap; gap: 6px; }
  .cell-actions .btn { flex: 1 1 auto; min-width: 84px; justify-content: center; }

  /* 模态：底部抽屉式，选项更好点 */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal { width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .modal-body { max-height: 72vh; }
  .opt { min-height: 46px; padding: 12px 14px; }

  /* 知识星图：年级 chips 横向滚动，省竖向空间 */
  .grade-chips {
    flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .grade-chips::-webkit-scrollbar { display: none; }
  .grade-chips .chip { flex: 0 0 auto; }
  .starmap-head h2 { font-size: 20px; }
  .planet { padding: 16px; }
  .planet .p-desc { min-height: 0; }

  /* 课程详情：英雄区与按钮紧凑化 */
  .course-hero { padding: 16px 14px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .course-side .side-card { flex: 1 1 100%; }
}

/* ---------- 超小屏（≤380px）微调 ---------- */
@media (max-width: 380px) {
  #content { padding: 10px 10px 56px; }
  .cell-actions .btn { min-width: 72px; font-size: 12px; padding: 8px 6px; }
  .stat .value { font-size: 22px; }
}

/* ---------- 知识图谱 ---------- */
.kg-wrap { max-width: 1100px; margin: 0 auto; }
.breadcrumb .crumb-link { color: var(--primary); cursor: pointer; padding: 3px 7px; border-radius: 7px; }
.breadcrumb .crumb-link:hover { background: var(--primary-bg); }
.breadcrumb .crumb-sep { color: var(--text-3); margin: 0 1px; }
.breadcrumb .cur { color: var(--text); font-weight: 600; padding: 3px 7px; }
.kg-search { margin: 14px 0 4px; }
.kg-search input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text);
}
.kg-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.kg-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.kg-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(20, 40, 90, 0.04); animation: rise 0.25s ease both;
}
.kg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kg-name { font-size: 16px; font-weight: 700; color: var(--text); margin-right: 4px; }
.kg-chapter { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.kg-desc { font-size: 13.5px; line-height: 1.75; color: var(--text-2); margin: 10px 0 0; }
.kg-sec { margin-top: 12px; font-size: 13px; color: var(--text-2); }
.kg-sec > b { display: inline-block; font-size: 12px; color: var(--primary); background: var(--primary-bg); padding: 2px 8px; border-radius: 6px; margin-bottom: 6px; }
.kg-ul { margin: 4px 0 0; padding-left: 20px; }
.kg-ul li { margin: 3px 0; line-height: 1.7; }
.kg-dq { line-height: 1.8; }
.kg-ans { color: #1a7f37; font-weight: 600; margin-left: 6px; }
.kg-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.kg-chip {
  font-size: 12.5px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: #F6F8FC; color: var(--text-2); font-family: inherit;
  transition: all 0.15s ease;
}
.kg-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); transform: translateY(-1px); }
/* 知识点详情弹窗 */
.modal-card.kg-detail {
  width: min(620px, 100%); background: #fff; border-radius: 16px; padding: 22px 22px 18px;
  position: relative; box-shadow: 0 30px 80px rgba(20, 50, 110, 0.28); max-height: 80vh; overflow-y: auto;
  animation: pop 0.22s ease both;
}
.modal-close {
  position: absolute; top: 12px; right: 14px; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; font-size: 20px; color: var(--text-3); cursor: pointer; line-height: 1;
}
.modal-close:hover { background: #F2F3F5; color: var(--text); }
@media (max-width: 600px) {
  .kg-card { padding: 14px; }
  .kg-name { font-size: 15px; }
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal-card.kg-detail { width: 100%; border-radius: 16px 16px 0 0; max-height: 86vh; }
}

/* ---- 自适应诊断 / 学习路径 ---- */
.kg-diag-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: linear-gradient(135deg, var(--primary-bg), #fff);
  border: 1px solid var(--primary); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; color: var(--text-2);
}
.kg-diag-banner .kg-banner-ic { font-size: 18px; }
.kg-diag-banner b { color: var(--text); }
.kg-diag-banner .btn { margin-left: auto; }
.kg-diag-banner[hidden] { display: none; }
.kg-card-foot { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.diag-modal { width: min(640px, 100%); }
.diag-input { display: flex; gap: 8px; margin-top: 14px; }
.diag-input input {
  flex: 1; min-width: 0; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: var(--card); color: var(--text);
}
.diag-input input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.diag-reveal {
  margin-top: 14px; padding: 11px 14px; border-radius: 10px; background: var(--primary-bg);
  color: var(--text); font-size: 14px; line-height: 1.7;
}
.diag-judge { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.diag-judge-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn-ai { background: var(--grad); color: #fff; border-color: transparent; }
.btn-ai:hover { filter: brightness(1.05); }
.btn-ai:disabled { opacity: .6; cursor: default; }
.diag-ai {
  margin-top: 14px; border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 12px; background: var(--card); overflow: hidden;
}
.diag-ai-head { font-size: 13px; font-weight: 700; color: var(--primary); padding: 9px 14px; background: var(--primary-bg); }
.diag-ai-body { padding: 12px 14px; font-size: 14px; line-height: 1.75; color: var(--text); }
.diag-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.dstat {
  flex: 1 1 84px; min-width: 84px; text-align: center; padding: 12px 8px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border);
}
.dstat .dn { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.1; }
.dstat .dl { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.dstat.warn { border-color: var(--orange-bd, #ffd8a8); background: var(--orange-bg, #fff5e9); }
.dstat.warn .dn { color: var(--orange, #e8590c); }
.dstat.ok { border-color: #b2e6c3; background: #ecfaf1; }
.dstat.ok .dn { color: #1a7f37; }
.diag-result-title { font-size: 18px; font-weight: 800; color: var(--text); }
.diag-result-sub { font-size: 13.5px; color: var(--text-2); margin: 6px 0 0; line-height: 1.7; }
.diag-result-sub b { color: var(--orange, #e8590c); }
.diag-sec { margin-top: 16px; }
.diag-sec > b { display: inline-block; font-size: 12.5px; color: var(--primary); background: var(--primary-bg); padding: 3px 10px; border-radius: 7px; margin-bottom: 8px; }
.diag-root { border-left: 4px solid var(--orange, #e8590c); }
.kg-std { display: inline-block; font-size: 11px; color: var(--text-3); background: #F2F3F5; border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; margin: 2px 4px 2px 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.kg-stds { display: flex; flex-wrap: wrap; }
.diag-path { display: flex; flex-direction: column; gap: 8px; }
.diag-path-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--border);
}
.diag-path-item.stage-小学 { border-left-color: #2f9e44; }
.diag-path-item.stage-初中 { border-left-color: #1971c2; }
.diag-path-item.stage-高中 { border-left-color: #c92a2a; }
.dpi-idx { width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.dpi-stage { font-size: 11px; color: #fff; background: var(--text-3); border-radius: 5px; padding: 2px 7px; flex: none; }
.diag-path-item.stage-小学 .dpi-stage { background: #2f9e44; }
.diag-path-item.stage-初中 .dpi-stage { background: #1971c2; }
.diag-path-item.stage-高中 .dpi-stage { background: #c92a2a; }
.dpi-name { font-size: 14.5px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; }
.dpi-meta { font-size: 11.5px; color: var(--text-3); flex: none; }
.diag-path-item .btn { flex: none; }
.diag-hint-tip { font-size: 12.5px; color: var(--text-3); margin: 10px 0 0; }
@media (max-width: 600px) {
  .diag-path-item { flex-wrap: wrap; }
  .dpi-name { flex-basis: 100%; order: 3; }
  .kg-diag-banner .btn { margin-left: 0; width: 100%; }
}


/* ---------- 拍照批改 ---------- */
.hw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.hw-head h2 { font-size: 21px; font-weight: 800; letter-spacing: -0.2px; }
.hw-head h2 em { font-style: normal; color: var(--primary); }
.hw-head p { font-size: 13px; color: var(--text-3); margin-top: 6px; line-height: 1.7; max-width: 640px; }
.hw-modes { display: inline-flex; background: var(--bg-2); border-radius: 10px; padding: 3px; gap: 2px; }
.hw-mode {
  border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-2); padding: 7px 16px; border-radius: 8px; cursor: pointer; transition: .18s;
}
.hw-mode.on { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(20,50,110,.10); }

.hw-card { background: #fff; border: 1px solid var(--border-2); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.hw-card + .hw-card { margin-top: 14px; }
.hw-setup { display: flex; flex-direction: column; gap: 14px; }

.hw-row { display: flex; gap: 10px; flex-wrap: wrap; }
.hw-field { display: flex; flex-direction: column; gap: 5px; min-width: 118px; }
.hw-field.grow { flex: 1 1 220px; min-width: 180px; }
.hw-field > span { font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.hw-field > span em { font-style: normal; font-weight: 400; }
.hw-field select, .hw-field input {
  font: inherit; font-size: 13.5px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--border); background: #fff; color: var(--text); width: 100%;
}
.hw-field select:focus, .hw-field input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }

.hw-drop {
  border: 1.5px dashed var(--primary-soft); border-radius: 14px; background: var(--primary-bg);
  padding: 24px 16px; text-align: center; transition: .2s;
}
.hw-drop.dragging { border-color: var(--primary); background: rgba(37,99,235,.16); transform: scale(1.01); }
.hw-drop-ic { font-size: 34px; line-height: 1; }
.hw-drop-t { font-size: 15px; font-weight: 700; margin-top: 8px; }
.hw-drop-s { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.7; }
.hw-drop-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.hw-cam { cursor: pointer; }

.hw-thumbs { display: flex; gap: 9px; flex-wrap: wrap; }
.hw-thumb { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.hw-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hw-thumb-n {
  position: absolute; left: 4px; bottom: 4px; background: rgba(20,50,110,.72); color: #fff;
  font-size: 10px; line-height: 15px; padding: 0 5px; border-radius: 5px; font-weight: 700;
}
.hw-x {
  position: absolute; right: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%;
  border: 0; background: rgba(20,50,110,.62); color: #fff; font-size: 14px; line-height: 1; cursor: pointer;
}

.hw-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hw-tip { font-size: 11.5px; color: var(--text-3); margin-left: auto; }

.hw-busy { display: flex; align-items: center; gap: 14px; }
.hw-busy b { display: block; font-size: 14px; }
.hw-busy span { font-size: 12px; color: var(--text-3); }
.hw-spinner {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: hwspin .8s linear infinite;
}
@keyframes hwspin { to { transform: rotate(360deg); } }

.hw-res-top { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.hw-score {
  width: 104px; height: 104px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--bg-2) 0);
  display: flex; align-items: center; justify-content: center;
}
.hw-score-in { width: 82px; height: 82px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hw-score-in b { font-size: 27px; font-weight: 800; line-height: 1; }
.hw-score-in span { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.hw-stats { display: grid; grid-template-columns: repeat(4, minmax(72px, 1fr)); gap: 10px; flex: 1 1 320px; }
.hw-stat { background: var(--bg-2); border-radius: 10px; padding: 10px 12px; }
.hw-stat b { display: block; font-size: 21px; font-weight: 800; line-height: 1.1; }
.hw-stat span { font-size: 11px; color: var(--text-3); }
.hw-stat.ok b { color: var(--green); }
.hw-stat.bad b { color: var(--red); }

.hw-comment { margin-top: 16px; background: var(--purple-bg); border: 1px solid var(--purple-bd); border-radius: 10px; padding: 12px 14px; }
.hw-comment b { font-size: 12.5px; color: var(--purple); }
.hw-comment p { font-size: 13.5px; line-height: 1.8; margin-top: 5px; color: var(--text); }

.hw-tabs { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-2); }
.hw-tab {
  border: 1px solid var(--border); background: #fff; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); padding: 6px 13px; border-radius: 8px; cursor: pointer; transition: .18s;
}
.hw-tab.on { background: var(--primary-bg); border-color: var(--primary-soft); color: var(--primary); }
.hw-tabs-r { margin-left: auto; display: flex; gap: 7px; flex-wrap: wrap; }

.hw-kns { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.hw-kn { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-bd); border-radius: 20px; padding: 4px 11px; font-size: 12px; cursor: pointer; }
.hw-kn b { font-weight: 800; }

.hw-items { display: flex; flex-direction: column; gap: 11px; margin-top: 14px; }
.hw-item { border: 1px solid var(--border-2); border-left: 3px solid var(--border); border-radius: 11px; padding: 12px 14px; background: #fff; }
.hw-item.ok { border-left-color: var(--green); background: rgba(22,163,74,.035); }
.hw-item.bad { border-left-color: var(--red); background: rgba(220,38,38,.035); }
.hw-item-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hw-no { font-size: 12px; font-weight: 800; color: var(--text-3); }
.hw-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.hw-badge.ok { background: var(--green-bg); color: var(--green); }
.hw-badge.bad { background: var(--red-bg); color: var(--red); }
.hw-page { font-size: 11px; color: var(--text-3); }
.hw-err { font-size: 11px; font-weight: 600; color: var(--orange); background: var(--orange-bg); padding: 2px 8px; border-radius: 20px; }
.hw-kns-inline { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; }
.hw-kns-inline i { font-style: normal; font-size: 11px; color: var(--blue); background: var(--blue-bg); padding: 2px 8px; border-radius: 20px; }
.hw-q { font-size: 14px; font-weight: 600; margin-top: 9px; line-height: 1.65; white-space: pre-wrap; }
.hw-answers { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 9px; }
.hw-a { background: var(--bg-2); border-radius: 8px; padding: 7px 12px; font-size: 13px; }
.hw-a span { color: var(--text-3); font-size: 11.5px; margin-right: 7px; }
.hw-a b.right { color: var(--green); }
.hw-explain { margin-top: 9px; font-size: 13px; line-height: 1.8; color: var(--text-2); background: var(--bg-2); border-radius: 8px; padding: 9px 12px; }
.hw-explain b { color: var(--text); margin-right: 7px; font-size: 12px; }
.hw-item-f { margin-top: 10px; }

.hw-advice { margin-top: 16px; background: var(--orange-bg); border: 1px solid var(--orange-bd); border-radius: 10px; padding: 12px 14px; }
.hw-advice b { font-size: 12.5px; color: var(--orange); }
.hw-advice ul { margin: 7px 0 0; padding-left: 18px; }
.hw-advice li { font-size: 13px; line-height: 1.85; }
.hw-empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 26px 0; }

.hw-hist { margin-top: 14px; }
.hw-hist > b { font-size: 13px; }
.hw-hist-i { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); padding: 8px 0; border-bottom: 1px dashed var(--border-2); }
.hw-hist-i:last-child { border-bottom: 0; }
.hw-hist-i .btn { margin-left: auto; }

.hw-toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 16px);
  background: rgba(20,50,110,.93); color: #fff; font-size: 13px; padding: 10px 18px;
  border-radius: 9px; opacity: 0; pointer-events: none; transition: .24s; z-index: 9999; max-width: 84vw; text-align: center;
}
.hw-toast.show { opacity: 1; transform: translate(-50%, 0); }

.hw-cam-modal { position: fixed; inset: 0; background: rgba(15,23,42,.82); display: flex; align-items: center; justify-content: center; z-index: 10000; padding: 20px; }
.hw-cam-box { background: #111827; border-radius: 14px; padding: 12px; max-width: 100%; }
.hw-cam-box video { max-width: 100%; max-height: 70vh; border-radius: 9px; display: block; background: #000; }
.hw-cam-btns { display: flex; gap: 9px; justify-content: center; margin-top: 11px; }

@media (max-width: 600px) {
  .hw-head h2 { font-size: 19px; }
  .hw-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hw-score { width: 88px; height: 88px; }
  .hw-score-in { width: 68px; height: 68px; }
  .hw-score-in b { font-size: 23px; }
  .hw-tabs-r { margin-left: 0; width: 100%; }
  .hw-tabs-r .btn { flex: 1; }
  .hw-tip { margin-left: 0; width: 100%; }
  .hw-kns-inline { margin-left: 0; width: 100%; }
}

.hw-modebar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 12.5px; line-height: 1.7; padding: 10px 14px; border-radius: 10px;
  margin-bottom: 14px; border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text-2);
}
.hw-modebar b { font-weight: 700; color: var(--text); }
.hw-modebar code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px;
  background: rgba(20,50,110,.08); border-radius: 5px; padding: 1px 6px; color: var(--text);
}
.hw-mode-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.hw-mode-dot.live { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.hw-mode-dot.demo { background: var(--orange); box-shadow: 0 0 0 3px var(--orange-bg); }
.hw-mode-dot.off { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.hw-mode-dot.checking { background: var(--text-3); animation: hwpulse 1.1s ease-in-out infinite; }
@keyframes hwpulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
.hw-modebar.live { background: var(--green-bg); border-color: var(--green-bd); }
.hw-modebar.demo { background: var(--orange-bg); border-color: var(--orange-bd); }
.hw-modebar.off { background: var(--red-bg); border-color: var(--red-bd); }

/* ---------- 拍照批改入口 ---------- */
.tb-quick {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--primary-soft); background: var(--primary-bg); color: var(--primary);
  font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 20px;
  cursor: pointer; transition: .18s; white-space: nowrap;
}
.tb-quick:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.tb-quick svg { width: 15px; height: 15px; }

.hw-promo {
  display: flex; align-items: center; gap: 14px; text-decoration: none;
  background: linear-gradient(120deg, rgba(37,99,235,.10), rgba(124,58,237,.10));
  border: 1px solid var(--primary-soft); border-radius: var(--radius);
  padding: 15px 18px; margin-bottom: 16px; transition: .2s;
}
.hw-promo:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }
.hw-promo-ic { font-size: 30px; line-height: 1; flex: 0 0 auto; }
.hw-promo-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hw-promo-t b { font-size: 15px; font-weight: 800; color: var(--text); }
.hw-promo-t i { font-style: normal; font-size: 12.5px; color: var(--text-3); }
.hw-promo-go { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--primary); white-space: nowrap; }

@media (max-width: 760px) {
  .tb-quick span { display: none; }
  .tb-quick { padding: 6px 9px; }
  .hw-promo { padding: 13px 14px; gap: 11px; }
  .hw-promo-ic { font-size: 24px; }
  .hw-promo-t b { font-size: 14px; }
  .hw-promo-t i { font-size: 11.5px; }
  .hw-promo-go { font-size: 12px; }
}

/* ---------- 移动端底部导航 ---------- */
.mnav { display: none; }
@media (max-width: 900px) {
  .mnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 38;
    background: rgba(255,255,255,.96); backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--border-2);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 14px rgba(20,50,110,.07);
  }
  .mnav-i {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    text-decoration: none; color: var(--text-3); font-size: 10.5px; font-weight: 600;
    padding: 5px 2px; border-radius: 10px; -webkit-tap-highlight-color: transparent;
    min-height: 46px; justify-content: center;
  }
  .mnav-i svg { width: 21px; height: 21px; }
  .mnav-i.on { color: var(--primary); background: var(--primary-bg); }
  .mnav-i.on span { font-weight: 700; }
  .mnav-i:active { transform: scale(.94); }
  /* 内容区给底部导航留出空间 */
  #content { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
}

/* ---------- PWA 安装引导条 ---------- */
.pwa-bar {
  position: fixed; left: 10px; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 60; display: flex; align-items: center; gap: 11px;
  background: #fff; border: 1px solid var(--primary-soft); border-radius: 14px;
  padding: 12px 13px; box-shadow: 0 8px 30px rgba(20,50,110,.18);
  transform: translateY(130%); transition: transform .34s cubic-bezier(.2,.9,.3,1.1); opacity: 0;
}
.pwa-bar.show { transform: translateY(0); opacity: 1; }
.pwa-bar-ic {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563EB, #7C3AED); color: #fff; font-size: 17px;
}
.pwa-bar-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pwa-bar-t b { font-size: 13.5px; font-weight: 700; }
.pwa-bar-t i { font-style: normal; font-size: 11.5px; color: var(--text-3); }
.pwa-bar-btn {
  flex: 0 0 auto; border: 0; font: inherit; font-size: 13px; font-weight: 700; color: #fff;
  background: var(--primary); padding: 8px 16px; border-radius: 9px; cursor: pointer;
  min-height: 38px;
}
.pwa-bar-x { flex: 0 0 auto; border: 0; background: transparent; color: var(--text-3); font-size: 20px; cursor: pointer; width: 28px; height: 28px; }
@media (max-width: 900px) { .pwa-bar { bottom: calc(66px + env(safe-area-inset-bottom)); } }

/* ---------- 移动端：统计卡 2 列 + 更紧凑 ---------- */
@media (max-width: 720px) {
  .g4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px 13px !important; }
  .stat-card .sv { font-size: 23px !important; line-height: 1.15; }
  .stat-card .sv small { font-size: 12px !important; }
  .stat-card .sk { font-size: 11.5px !important; }
  .stat-card .sd { font-size: 11px !important; margin-top: 4px !important; }
  .hw-stats { grid-template-columns: repeat(2, 1fr); }
  /* 触控目标不小于 44px */
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .btn-sm { min-height: 38px; }
  .chip { min-height: 38px; }
  /* 批改页控件纵向堆叠，避免被截断 */
  .hw-row { flex-direction: column; }
  .hw-field { width: 100%; min-width: 0; }
  .hw-drop { padding: 20px 14px; }
  .hw-drop-btns .btn { flex: 1 1 auto; }
  /* 顶栏更紧凑 */
  #topbar { padding: 0 12px; }
  .tb-quick { min-height: 38px; }
  /* 课程卡两列更紧凑 */
  .planet-grid { gap: 10px; }
}
@media (max-width: 420px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .planet-grid { grid-template-columns: 1fr; }
}

/* ---------- 拍照批改：答案修正与重判 ---------- */
.hw-edit-btn {
  margin-left: 8px; border: 1px solid var(--primary-soft); background: var(--primary-bg);
  color: var(--primary); font: inherit; font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 6px; cursor: pointer; min-height: 24px;
}
.hw-edit-btn:hover { background: var(--primary); color: #fff; }
.hw-a-edit { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hw-edit-input {
  font: inherit; font-size: 13.5px; font-weight: 700; padding: 6px 9px; border-radius: 7px;
  border: 1px solid var(--primary); background: #fff; color: var(--text); min-width: 90px; flex: 1 1 120px;
}
.hw-edit-input:focus { outline: 0; box-shadow: 0 0 0 3px var(--primary-bg); }
.hw-edit-save { min-height: 32px !important; }
.hw-fixed {
  font-size: 11px; font-weight: 700; color: var(--green);
  background: var(--green-bg); padding: 2px 8px; border-radius: 20px;
}
@media (max-width: 600px) {
  .hw-edit-btn { min-height: 30px; padding: 4px 12px; }
  .hw-edit-input { min-height: 38px; }
}

/* ---------- AI 互动课堂（OpenMAIC 嵌入） ---------- */
.maic { display: flex; flex-direction: column; gap: 12px; }
.maic-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border-2); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow);
}
.maic-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.maic-ic {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563EB, #7C3AED); font-size: 19px;
}
.maic-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.maic-t b { font-size: 14.5px; font-weight: 800; }
.maic-t i { font-style: normal; font-size: 12px; color: var(--text-3); }
.maic-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.maic-frame {
  width: 100%; height: calc(100vh - 230px); min-height: 560px;
  border: 1px solid var(--border-2); border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow); display: block;
}
.maic-tip {
  font-size: 12px; color: var(--text-3); line-height: 1.8; margin: 0;
  background: var(--bg-2); border-radius: 9px; padding: 9px 13px;
}
.maic-tip code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px;
  background: rgba(20,50,110,.08); border-radius: 5px; padding: 1px 6px; color: var(--text); font-weight: 600;
}
@media (max-width: 900px) {
  .maic-bar { padding: 11px 13px; }
  .maic-ic { width: 34px; height: 34px; font-size: 17px; }
  .maic-t b { font-size: 13.5px; }
  .maic-t i { font-size: 11px; }
  .maic-frame { height: calc(100vh - 200px); min-height: 480px; border-radius: 10px; }
}

/* ---------- 批改服务降级提示 ---------- */
.hw-degraded {
  background: var(--red-bg); border: 1px solid var(--red-bd); border-radius: 11px;
  padding: 13px 15px; margin-bottom: 14px;
}
.hw-degraded b { display: block; font-size: 13.5px; color: var(--red); }
.hw-degraded p { font-size: 13px; line-height: 1.75; color: var(--text); margin-top: 6px; }
.hw-degraded .hw-degraded-tip { font-size: 12px; color: var(--text-3); }
