:root {
  --bg: #f5f6fb;
  --card: #ffffff;
  --ink: #1f2333;
  --ink-2: #5b6178;
  --ink-3: #8b91a7;
  --line: #e6e8f2;
  --brand: #4f46e5;
  --brand-soft: #eef0ff;
  --teal: #0d9488;
  --teal-soft: #e6f7f5;
  --amber: #d97706;
  --amber-soft: #fff5e6;
  --red: #dc2626;
  --red-soft: #fdecec;
  --green: #16a34a;
  --green-soft: #e9f9ef;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(24, 28, 50, .05), 0 8px 24px rgba(24, 28, 50, .06);
  --shadow-lg: 0 2px 6px rgba(24, 28, 50, .07), 0 18px 48px rgba(24, 28, 50, .12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--brand); }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; }
.brand .logo { font-size: 22px; }
.brand small { display: block; font-weight: 500; color: var(--ink-3); font-size: 11px; letter-spacing: .4px; }
.spacer { flex: 1 1 auto; }

.who { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 6px; background: var(--brand-soft); border-radius: 999px; }
.who .ava { font-size: 20px; line-height: 1; }
.who .nm { font-weight: 600; font-size: 14px; }

.timer { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.timer .bar { width: 92px; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.timer .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--brand)); transition: width .4s ease; }
.timer.warn .bar i { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.timer.over { color: var(--red); font-weight: 600; }

/* ---------- 主体 ---------- */
.main { max-width: 1080px; width: 100%; margin: 0 auto; padding: 20px 16px 96px; flex: 1 1 auto; }
.view { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { margin: 4px 0 18px; }
.page-head h1 { margin: 0 0 4px; font-size: 24px; line-height: 1.3; }
.page-head p { margin: 0; color: var(--ink-2); font-size: 14px; }

.crumb { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); margin-bottom: 10px; }
.crumb button { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-size: 13px; }
.crumb .sep { color: var(--line); }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.card h2 { margin: 0 0 10px; font-size: 17px; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid.c2, .grid.c3 { grid-template-columns: 1fr; } }

.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); font-size: 13px; }
.tiny { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.between { justify-content: space-between; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 600; font-size: 14px;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s;
}
.btn:hover { border-color: #cfd3e6; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #4338ca; border-color: #4338ca; }
.btn.teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: #fff; border-color: #f3c9c9; color: var(--red); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn.lg { padding: 14px 22px; font-size: 16px; }
.btn.block { width: 100%; }

/* ---------- 选人卡 ---------- */
.pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 700px) { .pick { grid-template-columns: 1fr; } }
.pick-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 24px;
  box-shadow: var(--shadow); cursor: pointer; text-align: center;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s;
}
.pick-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #cfd3e6; }
.pick-card .ava { font-size: 56px; line-height: 1; }
.pick-card .nm { font-size: 21px; font-weight: 700; margin-top: 10px; }
.pick-card .stage { color: var(--ink-2); font-size: 14px; }
.pick-card .stat { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* ---------- 标签 ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.tag.gray { background: #f0f1f7; color: var(--ink-2); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.teal { background: var(--teal-soft); color: var(--teal); }

/* ---------- 列表行 ---------- */
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .08s;
}
.list-row:hover { border-color: #cfd3e6; box-shadow: var(--shadow); }
.list-row + .list-row { margin-top: 10px; }
.list-row .idx { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.list-row .body { flex: 1 1 auto; min-width: 0; }
.list-row .t { font-weight: 600; }
.list-row .s { color: var(--ink-3); font-size: 13px; }
.list-row .arrow { color: var(--ink-3); }

/* ---------- 生活场景 ---------- */
.scene {
  border-radius: var(--r-md); padding: 14px 16px; background: linear-gradient(135deg, #fff8ec, #fff3f6);
  border: 1px solid #f6e3c8;
}
.scene .h { display: flex; align-items: center; gap: 6px; font-weight: 700; color: #9a5b12; margin-bottom: 6px; }
.scene p { margin: 0 0 8px; }
.scene .why { margin: 0; padding-top: 8px; border-top: 1px dashed #e9d3ae; color: #7c4a10; font-size: 14px; }

.pitfall { background: var(--red-soft); border: 1px solid #f6d4d4; border-radius: var(--r-md); padding: 12px 14px; }
.pitfall .h { font-weight: 700; color: var(--red); margin-bottom: 6px; }
.pitfall ul { margin: 0; padding-left: 20px; }
.pitfall li { margin: 3px 0; font-size: 14px; }

/* ---------- 新闻（今日大事） ---------- */
.news-hero { border-radius: 22px; padding: 22px; background: linear-gradient(140deg, #1e1b4b, #312e81 55%, #0f766e); color: #fff; box-shadow: var(--shadow-lg); }
.news-hero .label { display: inline-block; padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,.16); font-size: 12px; font-weight: 600; letter-spacing: .5px; }
.news-hero h1 { margin: 12px 0 6px; font-size: 25px; line-height: 1.35; }
.news-hero .meta { font-size: 12px; opacity: .78; }
.news-seg { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); margin-top: 14px; }
.news-seg .k { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.news-seg .k .n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 13px; }
.news-seg p { margin: 0; color: var(--ink); }
.news-src { font-size: 12px; color: var(--ink-3); margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line); word-break: break-all; }

.think { background: var(--teal-soft); border: 1px solid #bfe6e1; border-radius: var(--r-lg); padding: 16px; margin-top: 14px; }
.think .q { font-weight: 700; color: #0b6b62; margin-bottom: 10px; }

textarea, input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
textarea:focus, input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
label.fld { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }

/* ---------- 答题 ---------- */
.quiz-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.quiz-stem { font-size: 18px; font-weight: 600; line-height: 1.6; margin: 0 0 16px; white-space: pre-wrap; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  padding: 13px 15px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: #fff;
  cursor: pointer; transition: border-color .15s, background .15s, transform .08s;
}
.opt + .opt { margin-top: 10px; }
.opt:hover:not(:disabled) { border-color: #c3c8e6; background: #fafbff; }
.opt .k { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 8px; background: #f0f1f7; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.sel .k { background: var(--brand); color: #fff; }
.opt.right { border-color: var(--green); background: var(--green-soft); }
.opt.right .k { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt.wrong .k { background: var(--red); color: #fff; }
.opt:disabled { cursor: default; }

.verdict { border-radius: var(--r-md); padding: 14px 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.verdict.ok { background: var(--green-soft); color: #146c37; border: 1px solid #bfe6cd; }
.verdict.no { background: var(--amber-soft); color: #94560a; border: 1px solid #f2d9ab; }
.verdict.self { background: var(--brand-soft); color: var(--brand); border: 1px solid #d5d8f7; }

.explain { background: #fbfbfe; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--r-md); padding: 14px 16px; margin-top: 12px; }
.explain .h { font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.explain ol { margin: 0; padding-left: 22px; }
.explain li { margin: 5px 0; }
.explain .trap { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--amber); font-size: 14px; }
.explain .ans { margin-top: 10px; padding: 8px 12px; background: var(--green-soft); border-radius: var(--r-sm); font-size: 14px; }

.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; flex: 1 1 auto; min-width: 90px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--brand)); transition: width .35s ease; }

/* ---------- 错题溯源 ---------- */
.remedy { border: 2px solid #f2d9ab; background: #fffdf7; border-radius: var(--r-lg); padding: 18px; }
.remedy .h { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #94560a; font-size: 17px; margin-bottom: 6px; }
.remedy .kp { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }

/* ---------- 老师团 ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 52vh; overflow-y: auto; padding: 4px; }
.bubble { max-width: 82%; padding: 11px 14px; border-radius: 16px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.bubble.ai { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; align-self: flex-start; }
.bubble.me { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; }
.bubble.sys { align-self: center; background: #f0f1f7; color: var(--ink-2); font-size: 12px; padding: 6px 12px; border-radius: 99px; }
.chat-in { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.chat-in textarea { min-height: 46px; height: 46px; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: blink 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; } .typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ---------- 家长后台 ---------- */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; text-align: center; }
.stat .n { font-size: 26px; font-weight: 800; line-height: 1.2; }
.stat .l { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.stat.ok .n { color: var(--green); } .stat.no .n { color: var(--red); } .stat.mid .n { color: var(--brand); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { font-size: 12px; color: var(--ink-3); font-weight: 600; }
table.tbl tr:last-child td { border-bottom: 0; }

.switch-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }

/* ---------- 提示条 ---------- */
.note { border-radius: var(--r-md); padding: 12px 14px; font-size: 14px; border: 1px solid var(--line); background: #fafbff; color: var(--ink-2); }
.note.warn { background: var(--amber-soft); border-color: #f2d9ab; color: #94560a; }
.note.err { background: var(--red-soft); border-color: #f6d4d4; color: #a11d1d; }
.note.good { background: var(--green-soft); border-color: #bfe6cd; color: #146c37; }
.note.brand { background: var(--brand-soft); border-color: #d5d8f7; color: #3730a3; }

#toast-root { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #23263a; color: #fff; padding: 10px 16px; border-radius: 99px; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .2s ease; max-width: 88vw; }
.toast.err { background: #b42318; } .toast.ok { background: #12805c; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar-in { max-width: 1080px; margin: 0 auto; display: flex; }
.tab {
  flex: 1 1 0; background: none; border: 0; padding: 9px 4px 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink-3); font-size: 11px;
}
.tab .ic { font-size: 19px; line-height: 1; }
.tab.on { color: var(--brand); font-weight: 700; }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-3); }
.empty .big { font-size: 42px; margin-bottom: 8px; }

.spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: sp .7s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 46px 0; color: var(--ink-3); }

.kp-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.kp-head h1 { margin: 0; font-size: 22px; }
.summary { font-size: 15px; color: var(--ink-2); margin: 8px 0 0; }

.stars { letter-spacing: 2px; font-size: 14px; }

@media (max-width: 560px) {
  body { font-size: 15px; }
  .main { padding: 14px 12px 92px; }
  .page-head h1 { font-size: 21px; }
  .news-hero { padding: 18px; border-radius: 18px; }
  .news-hero h1 { font-size: 21px; }
  .quiz-stem { font-size: 16px; }
  .card { padding: 15px; border-radius: 15px; }
}

@media print {
  .topbar, .tabbar, .btn { display: none !important; }
  body { background: #fff; }
}

/* ---------- V1 账号制补充样式（工单 XZ-20260913-PEIXUE-V1） ---------- */
.auth-wrap { max-width: 460px; margin: 24px auto; padding: 0 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }
.tabrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.mt4 { margin-top: 4px; }
.mt8 { margin-top: 8px; }
.kv { margin-top: 10px; }
.kv strong { font-size: 13px; }
.kv p { margin: 2px 0 0; }
.perks { margin: 8px 0 0; padding-left: 18px; }
.perks li { margin: 4px 0; }
.footer { border-top: 1px solid #e5e7eb; margin-top: 28px; padding: 14px 0 22px; }
.footer-in { max-width: 1080px; margin: 0 auto; padding: 0 16px; display: flex; gap: 14px; align-items: center; }
/* 学生端有固定底部导航条：页脚垫高，别让导航压住隐私政策那几个链接（红线 7.6） */
.has-tabs .footer { padding-bottom: 78px; }
button.link { background: none; border: 0; padding: 0; color: #6b7280; text-decoration: underline; cursor: pointer; }
.ava.lg { width: 44px; height: 44px; font-size: 24px; }
.tbl-wrap { overflow-x: auto; }
.note.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }

/* ---------- V1.1 教师端（工单 XZ-20260921-PEIXUE-V1.1 三.2 / 三.3 / 四.5） ---------- */
/* 摘要条要一屏四格，手机自动降两格 */
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 红线四.5：教师端所有数据表禁止批量选中复制（不做导出，从根上断） */
.t-no-copy { user-select: none; -webkit-user-select: none; }
.t-click { cursor: pointer; }
.t-click:hover { background: var(--brand-soft); }

/* 发表入口锁定态（工单三.1.6）：置灰 + 锁图标，点击只弹「升级会员后开放」 */
.btn.locked {
  background: #f0f1f7;
  border-color: var(--line);
  color: var(--ink-3);
  cursor: not-allowed;
  filter: grayscale(1);
}
.btn.locked:hover { border-color: var(--line); box-shadow: none; }
.btn.locked:active { transform: none; }

/* 近30天学习时长曲线：纯 div 柱状图，不引第三方图表库 */
.t-chart { display: flex; align-items: flex-end; gap: 3px; height: 132px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
.t-col { flex: 1 0 auto; min-width: 16px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.t-col i { display: block; width: 100%; max-width: 14px; min-height: 2px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, var(--teal), var(--brand)); }
.t-col i.zero { background: var(--line); }
.t-col .d { font-size: 9px; color: var(--ink-3); margin-top: 4px; transform: rotate(-60deg); white-space: nowrap; }

/* 知识点正确率雷达（用横条代替雷达图：手机上更好读，也不引库） */
.t-radar { display: flex; flex-direction: column; gap: 7px; }
.t-rrow { display: flex; align-items: center; gap: 8px; }
.t-rrow .nm { flex: 0 0 38%; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }