/* ============================================================
   初中全科家教系统 · 基础样式
   设计取向：安静、清晰、留白足、适合长时间阅读
   视觉基调（2026-09-25）：绿 / 白 / 灰 · 素雅柔和 · 低饱和 · 简约现代
   移动优先，字号偏大（初中生在手机上也能舒服阅读）
   ============================================================ */

:root {
  --bg:        #F4F7F5;
  --surface:   #ffffff;
  --surface-2: #E9EFEB;
  --border:    #C2D4C9;
  --text:      #26312c;
  --text-2:    #55635d;
  --muted:     #8a948f;
  --brand:     #1F5C44;
  --brand-weak:#DFEBE3;
  --ok:        #3f8f5f;
  --warn:      #d9a13d;
  --danger:    #d95f52;
  --radius:    12px;
  --shadow:    0 1px 3px rgba(38,49,44,.05), 0 6px 20px rgba(38,49,44,.04);
  --font: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* 掌握度色阶（灰→黄→绿，绿=已掌握） */
  --m-none:      #c9cdd4;
  --m-weak:      #e8b54e;
  --m-mid:       #9dc26b;
  --m-good:      #4fa96a;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .6em; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 1em; }

/* ---------------------------------------------------- 布局 */

.wrap { max-width: 900px; margin: 0 auto; padding: 0 16px; }

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(31,92,68,.06);
}
body { scroll-padding-top: 56px; }
.topbar .inner {
  max-width: 900px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
}
.topbar .brand { font-weight: 700; font-size: 1rem; color: var(--text); }
.topbar nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.topbar nav a {
  padding: 6px 11px; border-radius: 8px; font-size: .9rem;
  color: var(--text-2); white-space: nowrap;
}
.topbar nav a:hover { background: var(--surface-2); text-decoration: none; }
.topbar nav a.active { background: var(--brand-weak); color: var(--brand); font-weight: 600; }

main.wrap { padding: 22px 16px 80px; }

/* ---------------------------------------------------- 卡片 */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card > :last-child { margin-bottom: 0; }

.card.tight { padding: 14px; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; font-weight: 700; letter-spacing: .04em;
  color: var(--muted); text-transform: none;
  margin: 22px 0 10px;
}
.section-title::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ---------------------------------------------------- 表单 */

input, select, textarea, button { font-family: inherit; font-size: 1rem; }

input[type=text], input[type=password], input[type=number], select, textarea {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .55rem .7rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-weak);
}

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 9px;
  padding: .55rem 1rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s;
  white-space: nowrap;
}
button:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }

button.primary, .btn.primary {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600;
}
button.primary:hover { background: #173F30; }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--surface-2); }
button.danger { color: var(--danger); border-color: #f5c6c6; }
button.danger:hover { background: #fef2f2; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------- 标签 */

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .76rem; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.tag.brand { background: var(--brand-weak); color: var(--brand); }
.tag.ok    { background: #e8f7ee; color: var(--ok); }
.tag.warn  { background: #fdf4e5; color: #b8791a; }
.tag.danger{ background: #fdecec; color: var(--danger); }

/* 星级（中考重要度） */
.stars { color: var(--warn); letter-spacing: 1px; font-size: .82rem; }

/* ---------------------------------------------------- 列表 */

.list { display: flex; flex-direction: column; gap: 8px; }

.row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.row:hover { border-color: #c3d4ca; background: #fbfdfc; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 500; }
.row .meta { font-size: .82rem; color: var(--muted); }
.row .chev { color: var(--muted); flex: none; }

.empty {
  text-align: center; color: var(--muted);
  padding: 32px 16px; font-size: .92rem;
}

/* ---------------------------------------------------- 掌握度条 */

.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--m-mid); }
.bar > i[data-level="none"] { background: var(--m-none); }
.bar > i[data-level="weak"] { background: var(--m-weak); }
.bar > i[data-level="mid"]  { background: var(--m-mid); }
.bar > i[data-level="good"] { background: var(--m-good); }

/* ---------------------------------------------------- 浮动陪读按钮 */

#companion-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff; border: none;
  box-shadow: 0 6px 22px rgba(63,127,99,.32);
  font-size: 1.5rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
#companion-fab:hover { background: #173F30; }

/* 页面内消息横幅（替代推送通道） */
#banner-host {
  position: fixed; left: 0; right: 0; top: 0; z-index: 95;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px; pointer-events: none;
}
.banner {
  pointer-events: auto;
  background: #fffdf5; border: 1px solid #f0dfae; color: #7a5a12;
  border-radius: 10px; padding: 9px 14px; font-size: .9rem;
  box-shadow: var(--shadow); max-width: 560px;
  display: flex; align-items: center; gap: 10px;
}
.banner.info { background: var(--brand-weak); border-color: #C2D4C9; color: #1F5C44; }
.banner.close { margin-left: auto; cursor: pointer; color: inherit; opacity: .6; }

/* 提示阶梯 */
.hint-item {
  border-left: 3px solid var(--brand);
  background: var(--brand-weak);
  padding: 10px 13px; border-radius: 0 8px 8px 0;
  margin-bottom: 8px; font-size: .95rem;
}
.hint-item .lv {
  font-size: .72rem; font-weight: 700; color: var(--brand);
  text-transform: uppercase; letter-spacing: .06em; display: block;
  margin-bottom: 3px;
}

/* ---------------------------------------------------- 工具类 */

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.mt1 { margin-top: 8px; } .mt2 { margin-top: 16px; } .mt3 { margin-top: 24px; }
.hidden { display: none !important; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.kpi .v { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.kpi .k { font-size: .8rem; color: var(--muted); }

/* 公式块 */
.katex-block { overflow-x: auto; padding: 4px 0; }

/* 打印：只保留内容，去掉交互壳 */
@media print {
  :root { --bg: #fff; --shadow: none; }
  body { background: #fff; font-size: 12pt; }
  .topbar, #companion-fab, #banner-host, .no-print { display: none !important; }
  main.wrap { padding: 0; max-width: none; }
  .card { border: none; padding: 0; margin-bottom: 14pt; box-shadow: none; }
  .card + .card { border-top: 1px solid #ddd; padding-top: 12pt; }
  a { color: inherit; text-decoration: none; }
  .page-break { page-break-before: always; }
  .avoid-break { page-break-inside: avoid; }
}

/* 小屏微调 */
@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .topbar .brand { display: none; }
  .topbar nav { margin-left: 0; }
  h1 { font-size: 1.3rem; }
  main.wrap { padding: 16px 13px 90px; }
  .card { padding: 15px; }
}

/* ============================================================
   补充样式：刷题 / 错题 / 看板 / 报告
   ============================================================ */

/* -------- 通用排版 -------- */
.page-head { margin: 6px 0 18px; }
.page-head h1 { margin: 0 0 4px; font-size: 1.45rem; }
.page-sub { color: var(--muted); font-size: .9rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap-gap { flex-wrap: wrap; }
.flex { display: flex; align-items: center; }
.gap8 { gap: 8px; }
.mono { font-family: var(--mono); font-size: .86em; }
.star { color: var(--m-weak); }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--text-2); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px;
          font-size: .82rem; color: var(--muted); }
.legend .dot, .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%;
                     margin-right: 5px; vertical-align: middle; }
.dot.m-good { background: var(--m-good); }
.dot.m-mid  { background: var(--m-mid); }
.dot.m-weak { background: var(--m-weak); }

/* -------- 药丸按钮 / 标签页 -------- */
.pill-row { display: flex; flex-wrap: wrap; gap: 7px; }
.pill {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 6px 13px; font: inherit; font-size: .87rem;
  cursor: pointer; transition: .15s; line-height: 1.35;
}
.pill:hover { border-color: var(--brand); color: var(--brand); }
.pill.sel, .pill[aria-pressed="true"] {
  background: var(--brand-weak); border-color: var(--brand); color: var(--brand);
  font-weight: 600;
}
.pill.sm { padding: 4px 10px; font-size: .82rem; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border);
        overflow-x: auto; }
.tab { border: none; background: none; font: inherit; font-size: .93rem;
       padding: 9px 14px; cursor: pointer; color: var(--muted);
       border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* -------- 表单控件 -------- */
select, input[type=text], textarea {
  font: inherit; font-size: .92rem; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); width: 100%;
}
select { width: auto; min-width: 110px; }
textarea { resize: vertical; min-height: 62px; line-height: 1.6; }
select:focus, input:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(63,127,99,.14);
}
.field { flex: 1; min-width: 160px; }
.field label { display: block; font-size: .82rem; color: var(--muted);
               margin-bottom: 6px; }

/* -------- 徽标 -------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px;
         font-size: .74rem; font-weight: 600; white-space: nowrap;
         background: var(--surface-2); color: var(--text-2); }
.badge.tone-red   { background: #fee7e7; color: #b42318; }
.badge.tone-amber { background: #fdf0dc; color: #a26a12; }
.badge.tone-blue  { background: var(--brand-weak); color: var(--brand); }
.badge.tone-green { background: #e3f5e9; color: #157347; }
.badge.tone-grey  { background: var(--surface-2); color: var(--muted); }

/* -------- 答题 -------- */
.quiz-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.prog { flex: 1; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.prog i, #prog-fill { display: block; height: 100%; background: var(--brand);
                      border-radius: 3px; transition: width .3s; }
.quiz-meta { display: flex; gap: 14px; align-items: center;
             font-size: .85rem; color: var(--muted); white-space: nowrap; }

.q-stem { font-size: 1.03rem; line-height: 1.85; margin-bottom: 16px; }
.q-stem-sm { font-size: .93rem; line-height: 1.75; }
.q-stem img, .q-stem-sm img, .opt-v img, .ans-analysis img {
  max-width: 100%; height: auto; border-radius: 6px; margin: 6px 0;
}
.q-options { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex; gap: 11px; align-items: flex-start; text-align: left;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 12px 14px; font: inherit; font-size: .96rem; cursor: pointer;
  transition: .15s; line-height: 1.7; width: 100%; color: var(--text);
}
.opt:hover { border-color: var(--brand); background: #fbfdfc; }
.opt.sel { border-color: var(--brand); background: var(--brand-weak); }
.opt.right { border-color: var(--ok); background: #e9f8ee; }
.opt.wrong { border-color: var(--danger); background: #fdecec; }
.opt-k { flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--surface-2);
         display: grid; place-items: center; font-weight: 700; font-size: .82rem;
         color: var(--text-2); }
.opt.sel .opt-k { background: var(--brand); color: #fff; }
.opt.right .opt-k { background: var(--ok); color: #fff; }
.opt.wrong .opt-k { background: var(--danger); color: #fff; }
.opt-v { flex: 1; }
.q-blank { margin-top: 6px; }
.q-blank input { font-size: 1rem; padding: 11px 13px; }

.quiz-actions { display: flex; gap: 9px; margin-top: 16px; flex-wrap: wrap; }
.quiz-actions .btn { flex: 1; min-width: 120px; }

/* -------- 即时反馈 -------- */
.fb { border-left: 4px solid var(--border); }
.fb.ok  { border-left-color: var(--ok); background: #f6fdf8; }
.fb.bad { border-left-color: var(--danger); background: #fff8f8; }
.fb-head { font-weight: 700; margin-bottom: 6px; }
.fb.ok .fb-head  { color: var(--ok); }
.fb.bad .fb-head { color: var(--danger); }
.fb-body { line-height: 1.8; font-size: .95rem; }
.fb-ans { margin-top: 9px; font-size: .92rem; }
.fb-more { margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--border);
           font-size: .88rem; }
.fb-more a { color: var(--brand); font-weight: 600; }

/* -------- 提示阶梯 -------- */
.hint-box { background: #fffdf7; border: 1px solid #f2e6cc; }
.hint-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 11px;
             flex-wrap: wrap; }
.hint-item { border-radius: 9px; padding: 11px 13px; margin-bottom: 9px;
             background: var(--surface); border: 1px solid var(--border);
             font-size: .94rem; line-height: 1.8; }
.hint-item.lv1 { border-left: 3px solid #b7cdc0; }
.hint-item.lv2 { border-left: 3px solid #96b3a1; }
.hint-item.lv3 { border-left: 3px solid var(--brand); }
.hint-item.lv4 { border-left: 3px solid var(--m-weak); background: #fffaf0; }
.hint-t { margin-bottom: 5px; }
.hint-c { color: var(--text); }
.hint-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px;
                flex-wrap: wrap; }
.hint-actions .muted { font-size: .84rem; }
#hint-more, #hint-more[hidden] { display: inline-block; }

/* -------- 错题卡片 -------- */
.m-card { border: 1px solid var(--border); border-radius: 11px; padding: 14px;
          margin-bottom: 12px; background: var(--surface); }
.m-card.resolved { opacity: .62; }
.m-head { display: flex; justify-content: space-between; gap: 12px;
          align-items: flex-start; margin-bottom: 7px; flex-wrap: wrap; }
.m-title { font-size: .96rem; line-height: 1.7; flex: 1; min-width: 200px; }
.m-tags { display: flex; gap: 5px; flex-shrink: 0; flex-wrap: wrap; }
.m-meta { font-size: .82rem; margin-bottom: 7px; }
.m-note { background: var(--surface-2); border-left: 3px solid var(--m-weak);
          padding: 7px 11px; border-radius: 0 6px 6px 0; font-size: .88rem;
          color: var(--text-2); margin-bottom: 9px; }
.m-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* -------- 任务行 -------- */
.task-row { display: flex; align-items: center; justify-content: space-between;
            gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border);
            flex-wrap: wrap; }
.task-row:last-child { border-bottom: none; }
.task-row.done { opacity: .6; }
.task-row.done .task-title { text-decoration: line-through; }
.task-main { flex: 1; min-width: 180px; }
.task-title { font-size: .95rem; line-height: 1.6; margin-bottom: 3px; }
.task-meta { font-size: .82rem; }
.task-meta a { color: var(--brand); font-weight: 600; }

/* -------- 警报卡 -------- */
.alert-card { border-left: 4px solid var(--m-weak); background: #fffdf6; }

/* -------- 空状态 -------- */
.empty-hint { text-align: center; padding: 34px 16px; }
.empty-hint b { display: block; font-size: 1.02rem; margin-bottom: 7px; }
.empty-hint p { margin: 0 0 14px; font-size: .9rem; }

/* -------- 弹层 -------- */

/* ⚠️ 这两条的顺序和 !important 都不能动，说明一下为什么。
 *
 * 弹层在 HTML 里是 <div class="modal-host" hidden>，靠 `hidden` 属性
 * 控制显隐，JS 用 `el.hidden = false/true` 开关。
 *
 * 坑在哪：`hidden` 属性在浏览器里的默认样式是
 *      [hidden] { display: none }
 * 而这条默认规则的**优先级极低**——只要作者样式里写了 `.modal-host { display: grid }`，
 * 就会把它盖掉。于是 `hidden` 属性彻底失效，弹层永远铺在屏幕上。
 *
 * 表现（家长实际遇到的）：错题本一打开，两个全屏半透明遮罩
 * （z-index:200，1280x900）就压在页面上，只是背景色 rgba(.46) 而已，
 * 看起来「页面是正常的」，但**所有点击都被遮罩吃掉了**——
 * 点筛选按钮、点关闭，全部没反应。控制台一条报错都没有，
 * 极难排查。
 *
 * 所以必须补一条 `[hidden]` 的兜底规则把它按回去。
 * 用 !important 是因为它要盖过上面那条 `display: grid`；
 * 属性选择器 [hidden] 本身就比单类名多一个特征位，加上 !important 万无一失。
 *
 * 上面还留了一条：`.modal-host[hidden]`，作用一样但更精确，
 * 两者并存是为了明确「弹层隐藏」这件事在样式层是有意为之的。
 */
.modal-host[hidden],
[hidden] { display: none !important; }

.modal-host { position: fixed; inset: 0; background: rgba(16,24,40,.46);
              display: grid; place-items: center; z-index: 200; padding: 16px;
              overflow: auto; }
.modal { background: var(--surface); border-radius: 14px; padding: 22px;
         width: min(96vw, 620px); max-height: 92vh; overflow: auto;
         box-shadow: 0 20px 50px rgba(16,24,40,.24); }
.diag-stem { background: var(--surface-2); border-radius: 9px; padding: 12px 14px;
             margin-bottom: 14px; }
.diag-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
              gap: 9px; }
.diag-type { border: 1px solid var(--border); background: var(--surface);
             border-radius: 10px; padding: 12px; text-align: left; cursor: pointer;
             font: inherit; transition: .15s; display: flex; flex-direction: column;
             gap: 4px; }
.diag-type:hover { border-color: var(--brand); background: #fbfdfc; }
.diag-type.sel { border-color: var(--brand); background: var(--brand-weak);
                 box-shadow: 0 0 0 3px rgba(63,127,99,.12); }
/* 20261002 修复错因弹框文字重叠：全局 button 的 nowrap 会把 20-30 字的
   错因说明压成单行撑破卡片与弹框（手机上 hint 比弹框还宽）。这两类按钮
   是「标题+说明」的多行结构，必须允许换行。 */
button.diag-type, button.rev-btn { white-space: normal; text-align: left; }
.answer-box { grid-column: 1 / -1; }
.ans-line { font-size: 1rem; margin-bottom: 10px; }
.ans-analysis { line-height: 1.85; font-size: .93rem; }
.rev-stage { display: inline-block; background: var(--brand-weak); color: var(--brand);
             padding: 2px 10px; border-radius: 6px; font-size: .8rem;
             font-weight: 600; margin-bottom: 11px; }
.rev-actions { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr));
               gap: 10px; margin-top: 18px; }
.rev-btn { border: 1px solid var(--border); background: var(--surface);
           border-radius: 11px; padding: 14px 12px; cursor: pointer; font: inherit;
           display: flex; flex-direction: column; gap: 4px; transition: .15s;
           text-align: center; }
.rev-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.rev-btn.pass:hover    { border-color: var(--ok); background: #f4fdf7; }
.rev-btn.partial:hover { border-color: var(--m-weak); background: #fffdf6; }
.rev-btn.fail:hover    { border-color: var(--danger); background: #fff8f8; }

/* -------- 看板 -------- */
.grid4 { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr));
         gap: 12px; margin-bottom: 16px; }
.kpi.big { padding: 15px 12px; }
.kpi.big .v { font-size: 1.6rem; font-weight: 700; color: var(--brand);
              line-height: 1.2; }
.kpi .l { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.kpi .sub-l { font-size: .74rem; color: var(--muted); margin-top: 3px; }
.kpi .up { color: var(--ok); font-weight: 600; }
.kpi .down { color: var(--danger); font-weight: 600; }

.advice-item { padding: 10px 13px; border-left: 3px solid var(--brand);
               background: #f4f8f5; border-radius: 0 8px 8px 0; margin-bottom: 9px;
               font-size: .93rem; line-height: 1.75; }

.big-bar { display: flex; height: 26px; border-radius: 7px; overflow: hidden;
           background: var(--surface-2); }
.big-bar i { display: grid; place-items: center; font-size: .76rem; font-weight: 700;
             color: #fff; font-style: normal; transition: width .4s;
             min-width: 0; overflow: hidden; }
.b-good { background: var(--m-good); }
.b-mid  { background: var(--m-mid); }
.b-weak { background: var(--m-weak); }

.subj-row { display: flex; align-items: center; gap: 11px; padding: 8px 0;
            font-size: .9rem; }
.subj-name { width: 52px; flex-shrink: 0; font-weight: 600; }
.mini-bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px;
            overflow: hidden; }
.mini-bar i { display: block; height: 100%; border-radius: 4px; }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 78px;
         padding-top: 6px; }
.sp-col { flex: 1; display: flex; flex-direction: column; align-items: center;
          justify-content: flex-end; height: 100%; gap: 3px; }
.sp-bar { width: 100%; background: #b7cdc0; border-radius: 3px 3px 0 0;
          min-height: 2px; transition: height .3s; }
.sp-bar.acc { background: var(--brand); }
.sp-lab { font-size: .58rem; color: var(--muted); line-height: 1; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

.m-item { border: 1px solid var(--border); border-radius: 11px; padding: 15px;
          margin-bottom: 12px; background: var(--surface); }
.m-item-head { display: flex; justify-content: space-between; gap: 12px;
               align-items: flex-start; margin-bottom: 12px; flex-wrap: wrap; }
.m-score { font-size: 1.3rem; font-weight: 700; line-height: 1; flex-shrink: 0; }
.m-score .unit { font-size: .68rem; font-weight: 500; margin-left: 2px; }
.m-score.good { color: var(--m-good); }
.m-score.mid  { color: var(--m-mid); }
.m-score.weak { color: var(--m-weak); }

.fac-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr));
           gap: 8px 16px; }
.fac { display: flex; align-items: center; gap: 7px; font-size: .8rem; }
.fac-l { width: 62px; flex-shrink: 0; color: var(--muted); }
.fac-bar { flex: 1; height: 7px; background: var(--surface-2); border-radius: 4px;
           overflow: hidden; }
.fac-bar i { display: block; height: 100%; border-radius: 4px; }
.fac-v { width: 26px; text-align: right; color: var(--text-2); }

.diag-list { margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--border); }
.diag-line { font-size: .87rem; color: var(--text-2); line-height: 1.75;
             padding-left: 15px; position: relative; }
.diag-line::before { content: "→"; position: absolute; left: 0; color: var(--brand); }
.m-item-actions { display: flex; gap: 8px; margin-top: 11px; }

/* -------- 报告 -------- */
.pv-frame { width: 100%; height: 640px; border: 1px solid var(--border);
            border-radius: 10px; margin-top: 12px; background: #fff; }

/* -------- 按钮补充 -------- */
.btn.small { padding: 5px 11px; font-size: .84rem; border-radius: 7px; }
.btn.primary {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.btn.primary:hover { background: #173F30; border-color: #356e56; }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* -------- 小屏 -------- */
@media (max-width: 560px) {
  .grid4 { grid-template-columns: repeat(2,1fr); }
  .kpi.big .v { font-size: 1.35rem; }
  .quiz-actions .btn { flex: 1 1 45%; }
  .modal { padding: 17px; }
  .fac-l { width: 56px; font-size: .74rem; }
  .sp-lab { font-size: .5rem; }
  .m-item { padding: 13px; }
}

/* -------- 设置页 kv 列表 -------- */
.kv { display: flex; align-items: baseline; gap: 12px; padding: 9px 0;
      border-bottom: 1px dashed var(--border); font-size: .9rem; }
.kv:last-child { border-bottom: none; }
.kv .k { flex: 0 0 168px; color: var(--muted); font-size: .85rem; }
.kv .v { flex: 1; color: var(--text); word-break: break-all; line-height: 1.7; }
.kv code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px;
           font-family: var(--mono); font-size: .86em; }
@media (max-width: 560px) {
  .kv { flex-direction: column; gap: 3px; }
  .kv .k { flex: none; }
}


/* ============================================================
   Jojo 学生皮肤 · 天空王国（光遇风）
   只作用于 body.skin-sky（学生角色登录后由 ui.js 自动添加）
   ============================================================ */
body.skin-sky {
  background:
    linear-gradient(rgba(18, 24, 40, .42), rgba(18, 24, 40, .58)),
    url('../skins/sky.jpg') center / cover fixed no-repeat;
  background-color: #232a3a;
}
body.skin-sky .topbar { background: rgba(20, 26, 42, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,255,255,.08); }
body.skin-sky .topbar .brand { color: #f5e9d3; }
body.skin-sky .topbar nav a { color: #d7dce8; }
body.skin-sky .topbar nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
body.skin-sky .topbar nav a.active { background: rgba(255,215,160,.28); color: #ffe9c7; }
body.skin-sky .card, body.skin-sky .section, body.skin-sky .row,
body.skin-sky .panel, body.skin-sky .banner, body.skin-sky .hint-item,
body.skin-sky .ov .card, body.skin-sky .rw, body.skin-sky .idx button,
body.skin-sky .g-tabs button, body.skin-sky .opts button, body.skin-sky .spell-in input {
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
body.skin-sky #companion-fab { box-shadow: 0 4px 16px rgba(0,0,0,.35); }
@media print { body.skin-sky { background: #fff; } }


/* ============================================================
   移动端 / 平板增强（2026-09-25）
   修复：手机和平板上「屏幕放大缩小移动、页面跳动」
   ============================================================ */

html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video, canvas, table, pre, code { max-width: 100%; height: auto; }

/* 平板：导航改为横向可滑动，避免菜单换行把顶栏顶高、页面跳动 */
@media (max-width: 900px) {
  .topbar .inner { flex-wrap: nowrap; }
  .topbar nav {
    flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { flex: none; }
  .two-col { grid-template-columns: 1fr; }
}

/* 触屏设备：扩大点击区（移动端误触的主要来源之一） */
@media (pointer: coarse) {
  .topbar nav a { padding: 9px 12px; min-height: 40px; }
  .row, .opt { padding-top: 14px; padding-bottom: 14px; }
  .pill { padding: 9px 15px; }
  button, .btn { min-height: 40px; }
}

@media (max-width: 560px) {
  button, .btn { min-height: 44px; }
  .quick a { padding: 16px 10px; }
  .tabs { -webkit-overflow-scrolling: touch; }
}

/* 竖屏小屏：浮动按钮与弹层贴边 */
@media (max-width: 480px) {
  #companion-fab { right: 12px; bottom: 12px; width: 52px; height: 52px; }
  .modal { padding: 15px; }
}


/* 富冈老师头像（义勇风 · 原创，2026-09-25） */
.ava { overflow: hidden; }
.ava img.t-ava { display: block; width: 100%; height: 100%; object-fit: cover; }
.tc-ic img.t-ava { display: block; width: 38px; height: 38px; object-fit: cover; border-radius: 9px; }
#companion-fab img.t-ava { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
