:root {
  --bg: #f4f2ff;
  --panel: #ffffff;
  --ink: #1e2240;
  --ink-2: #454a6b;
  --muted: #8186a3;
  --line: #ece9f8;
  --brand: #6d5efc;
  --brand-2: #9b8cff;
  --brand-soft: #efecff;
  --mint: #10b981;
  --mint-soft: #e7fbf3;
  --amber: #f59e0b;
  --amber-soft: #fff6e5;
  --rose: #f43f5e;
  --rose-soft: #ffedf1;
  --cyan: #06b6d4;
  --violet: #8b5cf6;
  --shadow: 0 10px 30px rgba(74, 63, 145, 0.09);
  --shadow-lg: 0 20px 50px rgba(74, 63, 145, 0.16);
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 68px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
::selection { background: #d9d2ff; }

/* ---------- ambient background ---------- */
.ambient { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.b1 { width: 420px; height: 420px; background: #c7bfff; top: -140px; left: -120px; }
.b2 { width: 380px; height: 380px; background: #b8f0ff; bottom: -120px; right: -120px; opacity: .45; }
.b3 { width: 300px; height: 300px; background: #ffd9ec; top: 40%; left: 60%; opacity: .3; }

/* ---------- app shell ---------- */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 18px);
}
@media (min-width: 720px) {
  body { background: #e9e6fb; }
  .app { margin: 18px auto; min-height: calc(100dvh - 36px); border-radius: 34px; box-shadow: var(--shadow-lg); overflow: hidden; }
  .ambient { opacity: .8; }
}
.view { padding: 18px 18px 30px; min-height: 60dvh; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 6px 2px 16px; }
.topbar .grow { flex: 1; min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 13px;
  background: linear-gradient(135deg, #6d5efc, #22d3ee);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 19px;
  box-shadow: 0 8px 18px rgba(109, 94, 252, .35);
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: -3px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center;
  background: var(--panel); box-shadow: var(--shadow); color: var(--ink-2); font-size: 18px;
  transition: transform .15s, box-shadow .15s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.plain { background: transparent; box-shadow: none; }

.page-title { font-size: 24px; font-weight: 800; letter-spacing: .3px; }
.page-sub { font-size: 13px; color: var(--muted); }

/* ---------- cards ---------- */
.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .8);
}
.card + .card { margin-top: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card-tap { transition: transform .16s, box-shadow .16s; }
.card-tap:active { transform: scale(.985); box-shadow: 0 4px 14px rgba(74,63,145,.08); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: 20px;
  color: #fff;
  background: linear-gradient(135deg, #6d5efc 0%, #8b5cf6 52%, #2dd4bf 130%);
  box-shadow: 0 18px 40px rgba(109, 94, 252, .32);
}
.hero::after {
  content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255, 255, 255, .14); right: -60px; top: -80px;
}
.hero::before {
  content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255, 255, 255, .1); left: -40px; bottom: -70px;
}
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.hero-hi { font-size: 13px; opacity: .85; }
.hero-name { font-size: 22px; font-weight: 800; margin-top: 1px; letter-spacing: .3px; }
.hero-date { font-size: 12px; opacity: .8; margin-top: 2px; }
.hero-ring { flex: none; }
.hero-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-top: 18px; position: relative; z-index: 1; }
.hero-xp { font-size: 12px; opacity: .86; }
.hero-xp b { font-size: 20px; letter-spacing: .5px; }
.hero-goalbar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.22); overflow: hidden; margin-top: 7px; width: 150px; }
.hero-goalbar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #fff, #d9fff2); transition: width .5s; }
.hero-goal-txt { font-size: 11px; opacity: .9; margin-top: 5px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.28);
  padding: 5px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
  backdrop-filter: blur(4px);
}
.streak-flame { font-size: 15px; }

/* level ring */
.ring-wrap { position: relative; width: 82px; height: 82px; }
.ring {
  width: 100%; height: 100%; border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p, 0) * 1%), rgba(255,255,255,.22) 0);
  display: grid; place-items: center;
}
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: rgba(86, 74, 220, .55); backdrop-filter: blur(6px); }
.ring-in { position: relative; z-index: 1; text-align: center; line-height: 1.15; }
.ring-in b { font-size: 19px; }
.ring-in small { display: block; font-size: 9px; opacity: .85; letter-spacing: 1px; }

/* ---------- progress ---------- */
.progress { height: 7px; border-radius: 99px; background: #eeebfa; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .45s cubic-bezier(.2,.8,.2,1); }
.progress.mint > i { background: linear-gradient(90deg, #10b981, #34d399); }
.progress.amber > i { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress.rose > i { background: linear-gradient(90deg, #f43f5e, #fb7185); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 46px; padding: 0 18px; border-radius: 15px; font-weight: 700; font-size: 15px;
  background: var(--brand-soft); color: var(--brand);
  transition: transform .14s, filter .14s, box-shadow .14s;
  white-space: nowrap;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(135deg, #6d5efc, #8b5cf6); color: #fff; box-shadow: 0 10px 22px rgba(109,94,252,.32); }
.btn.dark { background: #232746; color: #fff; }
.btn.mint { background: linear-gradient(135deg, #10b981, #34d399); color: #fff; box-shadow: 0 10px 22px rgba(16,185,129,.28); }
.btn.rose { background: var(--rose-soft); color: var(--rose); }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.block { display: flex; width: 100%; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
.btn.lg { height: 52px; font-size: 16px; border-radius: 17px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* ---------- section ---------- */
.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; padding: 0 2px; }
.section-title { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.section-title span.emoji { font-size: 18px; }
.section-link { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 2px; font-weight: 600; }

/* ---------- goal card ---------- */
.goal-card { display: flex; align-items: center; gap: 16px; }
.goal-ring { flex: none; width: 66px; height: 66px; position: relative; }
.goal-ring .ring { background: conic-gradient(#6d5efc calc(var(--p,0) * 1%), #eeebfa 0); }
.goal-ring .ring::before { background: #fff; inset: 6px; }
.goal-ring .ring-in b { font-size: 16px; color: var(--ink); }
.goal-ring .ring-in small { color: var(--muted); font-size: 9px; }
.goal-info { flex: 1; min-width: 0; }
.goal-info h4 { font-size: 15px; font-weight: 800; }
.goal-info p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.goal-info .progress { margin-top: 8px; }

/* ---------- continue card ---------- */
.continue-card { display: flex; align-items: center; gap: 13px; }
.chapter-badge {
  width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center;
  font-size: 23px; flex: none; color: #fff; box-shadow: 0 8px 16px rgba(0,0,0,.12);
}
.continue-info { flex: 1; min-width: 0; }
.continue-info h4 { font-size: 15.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-info p { font-size: 12px; color: var(--muted); margin-top: 1px; }
.continue-info .progress { margin-top: 7px; }

/* ---------- daily challenge ---------- */
.daily-card {
  position: relative; overflow: hidden; border-radius: 22px; padding: 17px 18px;
  background: linear-gradient(120deg, #fff1e6, #ffe4ef 60%, #f3e8ff);
  border: 1px solid #fff;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.daily-card .d-emoji { font-size: 40px; filter: drop-shadow(0 6px 8px rgba(244,63,94,.2)); animation: float 3.2s ease-in-out infinite; }
.daily-card h4 { font-size: 16px; font-weight: 800; }
.daily-card p { font-size: 12px; color: #8a6a72; margin-top: 1px; }
.daily-card .btn { margin-left: auto; flex: none; }
.daily-card .new-dot { position: absolute; top: 12px; right: 14px; font-size: 10px; font-weight: 800; color: #fff; background: #f43f5e; border-radius: 99px; padding: 2px 7px; }

/* ---------- chapter ---------- */
.chapter-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .chapter-grid { grid-template-columns: 1fr 1fr; } }
.chapter-card { display: flex; align-items: center; gap: 12px; padding: 13px; }
.chapter-card .chapter-badge { width: 44px; height: 44px; border-radius: 14px; font-size: 20px; }
.chapter-card .cc-info { flex: 1; min-width: 0; }
.chapter-card .cc-info h4 { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-card .cc-info p { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; margin-top: 2px; }
.chapter-card .cc-info .progress { margin-top: 6px; height: 5px; }
.chapter-card .chev { color: #c9c5dd; font-size: 17px; flex: none; }
.chapter-card.done { background: linear-gradient(135deg, #f4fffb, #fff); }

/* ---------- chips ---------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 99px; display: inline-flex; align-items: center; gap: 5px;
  background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 600; border: 1.5px solid transparent;
  box-shadow: 0 3px 10px rgba(74,63,145,.05);
}
.chip.on { background: var(--brand); color: #fff; box-shadow: 0 6px 14px rgba(109,94,252,.3); }
.chip.soft { background: var(--brand-soft); color: var(--brand); box-shadow: none; }

/* ---------- search ---------- */
.search {
  display: flex; align-items: center; gap: 9px; background: #fff; border-radius: 16px; padding: 0 14px;
  height: 46px; box-shadow: var(--shadow);
}
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 14px; }
.search input::placeholder { color: #b5b1c9; }
.search .s-ico { color: var(--muted); font-size: 16px; }

/* ---------- point card ---------- */
.point-card { padding: 14px 15px; margin-top: 10px; position: relative; }
.point-head { display: flex; gap: 10px; align-items: flex-start; }
.point-no {
  flex: none; width: 26px; height: 26px; border-radius: 9px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 12px; font-weight: 800; margin-top: 1px;
}
.point-text { font-size: 14.5px; line-height: 1.75; color: var(--ink-2); flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }
.point-text.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.point-card.learned { background: linear-gradient(135deg, #f3fffa, #fff); border-color: #d9f7eb; }
.point-card.learned .point-no { background: var(--mint-soft); color: var(--mint); }
.point-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.point-actions .spacer { flex: 1; }
.mini-btn {
  height: 30px; padding: 0 10px; border-radius: 9px; font-size: 12px; font-weight: 600;
  background: #f7f5ff; color: var(--muted); display: inline-flex; align-items: center; gap: 4px;
}
.mini-btn.on { background: var(--mint-soft); color: var(--mint); }
.mini-btn.fav.on { background: var(--amber-soft); color: var(--amber); }

/* ---------- quiz hub ---------- */
.hub-hero {
  border-radius: 24px; padding: 20px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #232746, #3b2f7a 65%, #6d5efc);
  box-shadow: 0 18px 36px rgba(35,39,70,.3);
}
.hub-hero h3 { font-size: 21px; font-weight: 800; }
.hub-hero p { font-size: 12.5px; opacity: .78; margin-top: 3px; }
.hub-stats { display: flex; gap: 18px; margin-top: 16px; }
.hub-stat b { font-size: 21px; display: block; line-height: 1.2; }
.hub-stat span { font-size: 10.5px; opacity: .7; }
.hub-hero .btn { margin-top: 16px; background: #fff; color: #4338ca; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card { padding: 14px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.mode-card .m-emoji { font-size: 26px; }
.mode-card h4 { font-size: 14.5px; font-weight: 800; }
.mode-card p { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.mode-card .m-go { position: absolute; right: 12px; top: 14px; color: #cfc9e6; }
.mode-card.wide { grid-column: span 2; flex-direction: row; align-items: center; gap: 12px; }
.mode-card.wide .m-emoji { font-size: 30px; }
.mode-card.wide .m-info { flex: 1; }

/* ---------- quiz run ---------- */
.quiz-run { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 720px) { .quiz-run { left: 50%; transform: translateX(-50%); max-width: 620px; inset: 18px auto; height: calc(100dvh - 36px); border-radius: 28px; box-shadow: var(--shadow-lg); } }
.quiz-head { padding: 12px 16px 8px; }
.quiz-head-row { display: flex; align-items: center; gap: 10px; }
.quiz-head .qprog { flex: 1; height: 8px; border-radius: 99px; background: #e7e3f6; overflow: hidden; }
.quiz-head .qprog > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6d5efc, #22d3ee); transition: width .35s; }
.quiz-count { font-size: 12px; font-weight: 800; color: var(--muted); min-width: 46px; text-align: right; }
.combo-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 99px;
  background: linear-gradient(120deg, #fff2d8, #ffe0e8); color: #d97706; font-size: 11.5px; font-weight: 800;
  opacity: 0; transform: scale(.7); transition: all .22s;
}
.combo-pill.show { opacity: 1; transform: scale(1); }
.quiz-body { flex: 1; overflow-y: auto; padding: 8px 16px 140px; -webkit-overflow-scrolling: touch; }
.question-card { background: #fff; border-radius: 24px; padding: 18px; box-shadow: var(--shadow); animation: slideUp .28s ease both; }
.qmeta { display: flex; align-items: center; gap: 7px; margin-bottom: 11px; }
.qtype { font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 7px; letter-spacing: .5px; }
.qtype.tf { background: var(--mint-soft); color: #0b8a64; }
.qtype.choice { background: var(--brand-soft); color: var(--brand); }
.qtype.cloze { background: var(--amber-soft); color: #b45309; }
.qdiff { margin-left: auto; display: flex; gap: 3px; }
.qdiff i { width: 6px; height: 6px; border-radius: 50%; background: #e4e0f2; }
.qdiff i.on { background: #f59e0b; }
.q-stem { font-size: 17.5px; line-height: 1.7; font-weight: 700; letter-spacing: .2px; white-space: pre-wrap; }
.q-stem .blank { display: inline-block; min-width: 76px; border-bottom: 2.5px solid var(--brand); color: var(--brand); text-align: center; font-weight: 800; }

.answer-area { margin-top: 16px; }
.option {
  width: 100%; display: flex; align-items: center; gap: 11px; text-align: left;
  background: #fbfaff; border: 1.5px solid #ece9f8; border-radius: 16px; padding: 12px 13px; margin-top: 9px;
  font-size: 14.5px; line-height: 1.5; transition: all .16s; color: var(--ink-2);
}
.option:active { transform: scale(.985); }
.option .opt-key {
  flex: none; width: 28px; height: 28px; border-radius: 9px; background: #fff; border: 1.5px solid #e2def4;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 800; color: var(--muted);
}
.option.selected { border-color: var(--brand); background: var(--brand-soft); }
.option.selected .opt-key { background: var(--brand); border-color: var(--brand); color: #fff; }
.option.correct { border-color: var(--mint); background: var(--mint-soft); }
.option.correct .opt-key { background: var(--mint); border-color: var(--mint); color: #fff; }
.option.wrong { border-color: var(--rose); background: var(--rose-soft); }
.option.wrong .opt-key { background: var(--rose); border-color: var(--rose); color: #fff; }
.option.faded { opacity: .55; }
.tf-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 14px; }
.tf-btn {
  height: 92px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: #fbfaff; border: 1.5px solid #ece9f8; transition: all .16s; color: var(--ink-2);
}
.tf-btn .tf-ico { font-size: 28px; line-height: 1; }
.tf-btn .tf-txt { font-size: 13px; font-weight: 700; }
.tf-btn:active { transform: scale(.97); }
.tf-btn.selected.t { border-color: var(--mint); background: var(--mint-soft); color: #0b8a64; }
.tf-btn.selected.f { border-color: var(--rose); background: var(--rose-soft); color: #be123c; }
.tf-btn.correct { border-color: var(--mint); background: var(--mint-soft); }
.tf-btn.wrong { border-color: var(--rose); background: var(--rose-soft); }

.cloze-input {
  width: 100%; height: 52px; border-radius: 16px; border: 1.5px solid #e6e1f6; background: #fbfaff;
  padding: 0 15px; font-size: 17px; font-weight: 700; outline: none; text-align: center; letter-spacing: 1px;
}
.cloze-input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(109,94,252,.1); }
.cloze-hint { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 7px; }
.cloze-hint button { color: var(--brand); font-size: 11.5px; font-weight: 700; }

.feedback {
  margin-top: 14px; border-radius: 18px; padding: 13px 14px; animation: slideUp .24s ease both;
  background: var(--mint-soft); border: 1px solid #c9f3e2;
}
.feedback.bad { background: var(--rose-soft); border-color: #ffd0da; }
.feedback-head { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 14.5px; color: #08795a; }
.feedback.bad .feedback-head { color: #c0223d; }
.feedback-ans { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; }
.feedback-ans b { color: var(--ink); }
.feedback-exp { font-size: 12.8px; color: var(--ink-2); margin-top: 7px; line-height: 1.65; }
.feedback-exp .lab { color: var(--muted); font-size: 11px; font-weight: 700; }
.quiz-foot {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(12px + var(--safe-b));
  background: linear-gradient(180deg, rgba(244,242,255,0), var(--bg) 30%);
  z-index: 61;
}
@media (min-width: 720px) { .quiz-foot { left: 50%; transform: translateX(-50%); max-width: 620px; bottom: 18px; border-radius: 0 0 28px 28px; } }
.quiz-foot .btn { width: 100%; height: 52px; border-radius: 17px; font-size: 16px; }

/* ---------- result ---------- */
.result-wrap { padding: 26px 20px 120px; overflow-y: auto; height: 100%; }
.result-card { text-align: center; padding: 26px 20px; border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.result-emoji { font-size: 54px; animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; }
.result-title { font-size: 23px; font-weight: 900; margin-top: 6px; }
.result-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.score-ring { width: 148px; height: 148px; margin: 20px auto 6px; position: relative; }
.score-ring .ring { background: conic-gradient(#6d5efc calc(var(--p,0) * 1%), #eeebfa 0); }
.score-ring .ring::before { background: #fff; inset: 9px; }
.score-ring .ring-in b { font-size: 34px; color: var(--ink); }
.score-ring .ring-in small { color: var(--muted); }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.rs-item { background: #f8f6ff; border-radius: 14px; padding: 10px 4px; }
.rs-item b { display: block; font-size: 18px; }
.rs-item span { font-size: 10.5px; color: var(--muted); }
.result-actions { display: flex; gap: 10px; margin-top: 18px; }
.result-actions .btn { flex: 1; }
.wrong-list { margin-top: 18px; }
.wrong-item { background: #fff; border-radius: 16px; padding: 12px 14px; margin-top: 8px; box-shadow: var(--shadow); }
.wrong-item .wq { font-size: 13.5px; font-weight: 600; }
.wrong-item .wa { font-size: 12px; color: var(--muted); margin-top: 4px; }
.wrong-item .wa b { color: var(--mint); }

/* ---------- reader ---------- */
.reader { position: fixed; inset: 0; z-index: 70; background: #101223; color: #fff; display: flex; flex-direction: column; }
@media (min-width: 720px) { .reader { left: 50%; transform: translateX(-50%); max-width: 720px; inset: 18px auto; height: calc(100dvh - 36px); border-radius: 26px; overflow: hidden; } }
.reader-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.reader-head .r-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-head .r-page { font-size: 12px; color: #9da2c4; margin-left: auto; }
.reader-body { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 0 8px; -webkit-overflow-scrolling: touch; }
.reader-body img { width: 100%; height: auto; border-radius: 8px; margin: 0 auto; background: #fff; }
.reader-foot { padding: 10px 14px calc(12px + var(--safe-b)); display: flex; align-items: center; gap: 10px; }
.reader-foot .rbtn { width: 42px; height: 42px; border-radius: 13px; background: #232848; color: #fff; display: grid; place-items: center; flex: none; }
.reader-foot .rbtn:disabled { opacity: .35; }
.reader-foot .rslider { flex: 1; accent-color: #8b7bff; }
.reader-sections { position: absolute; left: 12px; right: 12px; bottom: 80px; background: #1b1f38; border-radius: 20px; max-height: 55%; overflow: auto; padding: 8px; box-shadow: 0 20px 50px rgba(0,0,0,.5); z-index: 5; }
.reader-sections button { width: 100%; text-align: left; color: #dfe2f5; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; }
.reader-sections button.on { background: #2b3157; color: #fff; font-weight: 700; }
.reader-sections button span { float: right; color: #7f86ad; font-size: 11.5px; }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-box { background: #fff; border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.stat-box .sb-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; margin-bottom: 7px; }
.stat-box b { font-size: 22px; font-weight: 900; }
.stat-box span { display: block; font-size: 11.5px; color: var(--muted); margin-top: -1px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bar-col .bar { width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #a695ff, #6d5efc); min-height: 4px; transition: height .5s; position: relative; }
.bar-col .bar.today { background: linear-gradient(180deg, #34d399, #10b981); }
.bar-col .bar span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); font-weight: 700; }
.bar-col em { font-size: 10.5px; color: var(--muted); font-style: normal; }
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut { width: 110px; height: 110px; border-radius: 50%; background: conic-gradient(#10b981 calc(var(--p,0) * 1%), #eeebfa 0); display: grid; place-items: center; flex: none; }
.donut::before { content: ""; width: 74px; height: 74px; border-radius: 50%; background: #fff; }
.donut-in { position: absolute; text-align: center; }
.donut-in b { font-size: 21px; display: block; }
.donut-in span { font-size: 10px; color: var(--muted); }
.donut-rel { position: relative; display: grid; place-items: center; }
.legend { font-size: 12px; color: var(--muted); }
.legend div { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.mastery-list { display: flex; flex-direction: column; gap: 9px; }
.mastery-row { display: flex; align-items: center; gap: 10px; }
.mastery-row .mr-name { width: 116px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mastery-row .progress { flex: 1; }
.mastery-row .mr-val { width: 38px; text-align: right; font-size: 11.5px; color: var(--muted); }

/* ---------- achievements ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 560px) { .ach-grid { grid-template-columns: repeat(6, 1fr); } }
.ach { text-align: center; background: #fff; border-radius: 16px; padding: 11px 4px; box-shadow: var(--shadow); opacity: .45; filter: grayscale(1); transition: all .2s; }
.ach.on { opacity: 1; filter: none; background: linear-gradient(160deg, #fff9ea, #fff); }
.ach .a-emoji { font-size: 24px; }
.ach .a-name { font-size: 10px; font-weight: 700; color: var(--ink-2); margin-top: 4px; line-height: 1.3; }
.ach.on .a-name { color: #a16207; }

/* ---------- profile / sync ---------- */
.profile-card { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 62px; height: 62px; border-radius: 22px; display: grid; place-items: center; font-size: 32px;
  background: linear-gradient(135deg, #efe9ff, #dff8ff); flex: none; box-shadow: inset 0 0 0 1px #fff;
}
.profile-info { flex: 1; min-width: 0; }
.profile-info h3 { font-size: 19px; font-weight: 800; }
.profile-info p { font-size: 12px; color: var(--muted); }
.sync-code {
  display: flex; align-items: center; gap: 10px; background: #f7f5ff; border: 1.5px dashed #cfc7f6;
  border-radius: 15px; padding: 12px 14px; margin-top: 10px;
}
.sync-code b { font-size: 25px; letter-spacing: 5px; color: var(--brand); font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.sync-code .copy { margin-left: auto; }
.sync-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sync-row:last-child { border-bottom: 0; }
.sync-row .sr-ico { width: 34px; height: 34px; border-radius: 11px; background: var(--brand-soft); display: grid; place-items: center; font-size: 16px; flex: none; }
.sync-row .sr-txt { flex: 1; min-width: 0; }
.sync-row .sr-txt b { display: block; font-size: 13.5px; }
.sync-row .sr-txt span { font-size: 11px; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); display: inline-block; margin-right: 4px; }
.dot.off { background: #c7c3da; }

.setting-row { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .st-label { flex: 1; font-size: 14px; font-weight: 600; }
.setting-row .st-sub { font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.seg { display: inline-flex; background: #f2effc; border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { height: 30px; padding: 0 11px; border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.seg button.on { background: #fff; color: var(--brand); box-shadow: 0 2px 8px rgba(74,63,145,.12); }
.switch { width: 46px; height: 27px; border-radius: 99px; background: #ddd8ef; position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; width: 21px; height: 21px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform .2s; box-shadow: 0 2px 5px rgba(0,0,0,.15); }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(19px); }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(255,255,255,.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(232,228,248,.8);
}
@media (min-width: 720px) {
  .tabbar { max-width: 620px; left: 50%; transform: translateX(-50%); bottom: 18px; border-radius: 0 0 34px 34px; }
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; color: #a8a3bf; font-size: 10px; font-weight: 700; width: 64px; height: 100%; justify-content: center; position: relative; }
.tab svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--brand); }
.tab.on::after { content: ""; position: absolute; bottom: 8px; width: 16px; height: 3px; border-radius: 99px; background: var(--brand); }
.tab.center { width: 66px; }
.tab.center .fab {
  width: 54px; height: 54px; border-radius: 19px; margin-top: -26px;
  background: linear-gradient(135deg, #6d5efc, #8b5cf6 60%, #22d3ee);
  display: grid; place-items: center; color: #fff; font-size: 25px;
  box-shadow: 0 10px 22px rgba(109,94,252,.45); border: 3px solid var(--bg);
}
.tab.center.on::after { display: none; }

/* ---------- toast / modal ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 20px); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: rgba(30, 34, 64, .94); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 13px; font-weight: 600;
  box-shadow: 0 12px 30px rgba(0,0,0,.2); animation: toastIn .25s ease both; max-width: 86vw; text-align: center;
}
.toast.good { background: linear-gradient(120deg, #0e9f6e, #10b981); }
.toast.bad { background: linear-gradient(120deg, #e11d48, #f43f5e); }
.toast.gold { background: linear-gradient(120deg, #d97706, #f59e0b); }
.toast.out { animation: toastOut .25s ease both; }

.modal-root .mask { position: fixed; inset: 0; background: rgba(18, 20, 40, .5); z-index: 150; display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s; backdrop-filter: blur(2px); }
@media (min-width: 720px) { .modal-root .mask { align-items: center; } }
.sheet {
  width: 100%; max-width: 520px; background: #fff; border-radius: 26px 26px 0 0; padding: 20px 20px calc(20px + var(--safe-b));
  animation: sheetUp .28s cubic-bezier(.2,.9,.2,1) both; max-height: 86dvh; overflow-y: auto;
}
@media (min-width: 720px) { .sheet { border-radius: 26px; } }
.sheet h3 { font-size: 19px; font-weight: 800; }
.sheet p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.sheet .field { margin-top: 14px; }
.sheet .field label { font-size: 12px; font-weight: 700; color: var(--ink-2); display: block; margin-bottom: 6px; }
.input {
  width: 100%; height: 48px; border-radius: 14px; border: 1.5px solid #e7e2f6; background: #fbfaff;
  padding: 0 14px; font-size: 15px; outline: none; transition: all .15s;
}
.input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(109,94,252,.1); }
.input.code { text-transform: uppercase; letter-spacing: 4px; font-weight: 800; font-family: ui-monospace, Consolas, monospace; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }
.close-x { position: absolute; right: 16px; top: 16px; color: var(--muted); font-size: 20px; }

/* confetti */
.fx-canvas { position: fixed; inset: 0; z-index: 300; pointer-events: none; display: none; }
.fx-canvas.on { display: block; }

/* empty */
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .e-emoji { font-size: 42px; }
.empty p { font-size: 13px; margin-top: 6px; }

/* utils */
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

@keyframes float { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(8px); opacity: 0; } }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
.shake { animation: shake .3s; }
@keyframes xpfly { 0% { opacity: 0; transform: translateY(0) scale(.8); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-46px) scale(1.15); } }
.xp-fly { position: fixed; z-index: 250; font-weight: 900; color: #f59e0b; pointer-events: none; animation: xpfly .9s ease-out forwards; font-size: 18px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- v1 additions ---------- */
:root { --read-font: 16px; }
.point-text { font-size: var(--read-font, 16px); }

.gallery-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.gallery-strip::-webkit-scrollbar { display: none; }
.gallery-chip {
  flex: 0 0 168px; display: flex; align-items: center; gap: 10px; background: #fff;
  border-radius: 17px; padding: 11px 12px; box-shadow: var(--shadow);
}
.gallery-chip .gc-emoji { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; }
.gallery-chip .gc-t { min-width: 0; }
.gallery-chip .gc-t b { display: block; font-size: 13.5px; font-weight: 800; white-space: nowrap; }
.gallery-chip .gc-t span { display: block; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gallery-card { overflow: hidden; }
.gallery-cover { height: 150px; overflow: hidden; position: relative; }
.gallery-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top center; opacity: .92; }
.gallery-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(255,255,255,.9)); }

.point-card.highlight { animation: glow 1.8s ease; }
@keyframes glow {
  0%, 100% { box-shadow: var(--shadow); }
  30% { box-shadow: 0 0 0 4px rgba(109,94,252,.35), var(--shadow-lg); }
}

.reading .tabbar { display: none; }
.reading .app { padding-bottom: 0; }
.reading .view { padding: 0; }
.reader-body img { transition: width .2s ease; cursor: zoom-in; }

.bar-col .bar span:empty { display: none; }
.section-title { letter-spacing: .2px; }
.hero-name { font-size: 21px; }

@media (max-width: 360px) {
  .view { padding: 14px 13px 24px; }
  .hero { padding: 17px; }
  .hero-name { font-size: 19px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card.wide { grid-column: span 1; }
  .stat-grid { gap: 8px; }
}

.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.q-stem .blank.filled { color: var(--mint); border-bottom-color: var(--mint); }
body:has(.mask) .toast-wrap { bottom: auto; top: calc(14px + env(safe-area-inset-top, 0px)); }
.sync-code b { flex: none; }
.quiz-body { display: flex; flex-direction: column; }
.quiz-body > .question-card { margin-top: auto; margin-bottom: auto; }
.quiz-body > .question-card { flex: none; }
.exam-tip { margin-top: 10px; background: linear-gradient(135deg,#fff9ec,#fffdf8); border: 1px solid #ffe9bf; padding: 12px 14px; }
.exam-tip .et-head { font-size: 12.5px; font-weight: 800; color: #b45309; margin-bottom: 3px; }
.exam-tip .et-body { font-size: 12.8px; line-height: 1.65; color: #7c5a1d; white-space: pre-wrap; }
.qr-box { margin-top: 14px; padding: 14px; background: #fff; border-radius: 18px; display: flex; justify-content: center; box-shadow: inset 0 0 0 1px var(--line); }
.qr-box svg { width: 240px; height: 240px; max-width: 68vw; max-height: 68vw; }
