/* ============ 初一知识小课堂 · 样式 ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2430;
  --ink2: #5a6377;
  --line: #e6e9f2;
  --brand: #4c6ef5;
  --brand2: #7950f2;
  --ok: #12b886;
  --bad: #f03e3e;
  --shadow: 0 6px 22px rgba(35, 47, 90, .08);
  --radius: 16px;
}
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  padding-bottom: 76px;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--brand); text-decoration: none; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(120deg, #4c6ef5, #7950f2 60%, #b197fc);
  color: #fff;
  padding: 14px 18px 12px;
  box-shadow: 0 4px 18px rgba(76, 110, 245, .28);
}
.top .row { display: flex; align-items: center; gap: 10px; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand small { font-weight: 400; opacity: .85; font-size: 12px; margin-left: 6px; }
.top .spacer { flex: 1; }
.top-btn {
  background: rgba(255,255,255,.18); border-radius: 10px; padding: 5px 11px;
  font-size: 12.5px; color: #fff; transition: .18s;
}
.top-btn:hover { background: rgba(255,255,255,.3); }
.top-sub { font-size: 12px; opacity: .82; margin-top: 3px; }

/* ---------- 通用 ---------- */
.wrap { max-width: 860px; margin: 0 auto; padding: 16px 14px 10px; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
h2.sec { font-size: 16px; margin: 20px 4px 10px; display: flex; align-items: center; gap: 8px; }
h2.sec .tag { font-size: 11px; font-weight: 500; color: var(--ink2); background: #eef1f8; padding: 2px 8px; border-radius: 20px; }
.muted { color: var(--ink2); font-size: 13px; }
.hidden { display: none !important; }

/* ---------- 首页统计 ---------- */
.hero {
  background: linear-gradient(135deg, #fff, #f7f9ff);
  border: 1px solid var(--line);
}
.hero .big { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat {
  background: #f6f8ff; border-radius: 12px; padding: 10px 8px; text-align: center;
}
.stat b { display: block; font-size: 20px; color: var(--brand); line-height: 1.2; }
.stat span { font-size: 11.5px; color: var(--ink2); }
.progress-bar { height: 8px; border-radius: 8px; background: #e9edf9; overflow: hidden; margin-top: 12px; }
.progress-bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, #4c6ef5, #7950f2); transition: width .5s; }

/* ---------- 学科卡片 ---------- */
.subjects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 620px) { .subjects { grid-template-columns: repeat(3, 1fr); } }
.subj {
  position: relative; overflow: hidden; text-align: left; padding: 15px 14px 13px;
  border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
  border: 1px solid var(--line); transition: transform .16s, box-shadow .16s;
}
.subj:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(35,47,90,.14); }
.subj .ic { font-size: 26px; line-height: 1; }
.subj .nm { font-size: 16px; font-weight: 700; margin: 8px 0 2px; }
.subj .ds { font-size: 11.5px; color: var(--ink2); }
.subj .mini-bar { height: 5px; border-radius: 5px; background: #eef1f8; margin-top: 10px; overflow: hidden; }
.subj .mini-bar i { display: block; height: 100%; border-radius: 5px; transition: width .4s; }
.subj .pct { position: absolute; right: 12px; top: 12px; font-size: 11px; font-weight: 700; }

/* ---------- 单元列表 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  flex: 1; text-align: center; padding: 8px; border-radius: 10px; font-size: 13.5px;
  background: #eef1f8; color: var(--ink2); font-weight: 600; transition: .18s;
}
.tab.on { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(76,110,245,.35); }
.unit {
  display: flex; align-items: center; gap: 10px; padding: 12px 12px; border-radius: 13px;
  background: var(--card); box-shadow: var(--shadow); margin-bottom: 10px; border: 1px solid var(--line);
  transition: .16s; width: 100%; text-align: left;
}
.unit:hover { border-color: #c9d4ff; transform: translateX(2px); }
.unit .no {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 10px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.unit .t { flex: 1; }
.unit .t b { font-size: 14px; display: block; }
.unit .t span { font-size: 11.5px; color: var(--ink2); }
.unit .badge { font-size: 11px; color: var(--ok); background: #e6fcf5; padding: 2px 7px; border-radius: 20px; }

/* ---------- 知识卡片 ---------- */
.kp { border-left: 3px solid var(--brand); padding: 2px 0 2px 12px; margin: 14px 0; }
.kp h4 { margin: 0 0 4px; font-size: 14.5px; }
.kp p { margin: 3px 0; font-size: 13.5px; color: #333a4d; }
.kp .tip {
  display: inline-block; margin-top: 6px; font-size: 12.5px; color: #b45309;
  background: #fff4e6; border-radius: 8px; padding: 5px 10px;
}
.kp .key { color: #d6336c; font-weight: 700; }
.mark-done {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink2);
  background: #f1f3f9; padding: 6px 12px; border-radius: 20px; margin-top: 11px;
}
.mark-done.on { color: var(--ok); background: #e6fcf5; }
.checkbox {
  width: 15px; height: 15px; border-radius: 4px; border: 1.6px solid currentColor; display: inline-grid; place-items: center;
  font-size: 10px; line-height: 1;
}

/* ---------- 练习 ---------- */
.quiz-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.quiz-head .n { font-size: 12px; color: var(--ink2); }
.qtext { font-size: 15.5px; font-weight: 600; line-height: 1.7; margin: 4px 0 14px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
  padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff;
  margin-bottom: 9px; font-size: 14px; transition: .16s;
}
.opt:hover:not(:disabled) { border-color: #a5b4fc; background: #f8f9ff; }
.opt .k {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 7px; background: #eef1f8;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink2);
}
.opt.right { border-color: var(--ok); background: #e6fcf5; }
.opt.right .k { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: #fff0f0; }
.opt.wrong .k { background: var(--bad); color: #fff; }
.opt:disabled { cursor: default; }
.fill-row { display: flex; gap: 8px; }
.fill-row input {
  flex: 1; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line);
  font-size: 15px; outline: none; font-family: inherit;
}
.fill-row input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(76,110,245,.12); }
.btn {
  padding: 11px 18px; border-radius: 12px; background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 600; box-shadow: 0 5px 14px rgba(76,110,245,.3); transition: .16s;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: #eef1f8; color: var(--ink2); box-shadow: none; }
.btn.big { width: 100%; padding: 13px; font-size: 15px; }
.feedback { border-radius: 12px; padding: 11px 13px; font-size: 13.5px; margin-top: 12px; line-height: 1.7; }
.feedback.ok { background: #e6fcf5; color: #0b7285; }
.feedback.bad { background: #fff0f0; color: #c92a2a; }
.feedback b { display: block; margin-bottom: 2px; font-size: 13.5px; }
.pull { display: flex; gap: 8px; margin-top: 14px; }
.pull .btn { flex: 1; }

/* ---------- 结果页 ---------- */
.result { text-align: center; padding: 26px 16px; }
.result .score { font-size: 46px; font-weight: 800; line-height: 1.1;
  background: linear-gradient(120deg, #4c6ef5, #b197fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result .rp { font-size: 13.5px; color: var(--ink2); margin: 4px 0 16px; }
.result .emoji { font-size: 42px; }

/* ---------- 底部导航 ---------- */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); display: flex; padding: 6px 0 8px;
  box-shadow: 0 -4px 20px rgba(35,47,90,.06);
}
.nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; color: #8a93a8; padding: 4px 0;
}
.nav button .i { font-size: 19px; line-height: 1; }
.nav button.on { color: var(--brand); font-weight: 700; }

.empty { text-align: center; color: var(--ink2); padding: 40px 10px; font-size: 13.5px; }
.empty .e { font-size: 40px; display: block; margin-bottom: 8px; }
.wrong-item { border-bottom: 1px dashed var(--line); padding: 11px 0; font-size: 13.5px; }
.wrong-item:last-child { border-bottom: none; }
.wrong-item .s { font-size: 11.5px; color: var(--brand); }
.wrong-item .a { color: var(--ok); font-weight: 600; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(10px);
  background: rgba(30,36,48,.92); color: #fff; padding: 9px 18px; border-radius: 22px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
