:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --ink: #1f2330;
  --muted: #6b7280;
  --line: #e8eaf1;
  --brand: #4f6ef7;
  --brand-soft: #eef1ff;
  --gold: #e6a23c;
  --green: #12855a;
  --red: #e64340;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(21, 28, 60, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶部 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(120deg, #4f6ef7, #6d8bff);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  display: grid; place-items: center; font-size: 22px;
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.brand-slogan { font-size: 12px; opacity: 0.85; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.22); color: #fff; white-space: nowrap;
}
.chip.gold {
  background: linear-gradient(120deg, #ffe9b0, #ffd36a);
  color: #7a4c00; font-weight: 600;
}
.chip.expiring {
  background: linear-gradient(120deg, #ffd7c2, #ffb489);
  color: #7a2f00;
}
.chip { cursor: pointer; }
.topbar .btn-ghost {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

/* ---------- 标签页 ---------- */
.tabs {
  display: flex; gap: 8px;
  padding: 14px 20px 0;
  max-width: 980px; margin: 0 auto;
}
.tab {
  border: none; background: transparent; color: var(--muted);
  font-size: 16px; padding: 10px 4px; cursor: pointer;
  border-bottom: 3px solid transparent; font-weight: 500;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }
.tab { position: relative; }
.badge {
  display: inline-block; min-width: 18px; height: 18px; line-height: 18px;
  padding: 0 5px; margin-left: 4px; border-radius: 9px;
  background: #ef474f; color: #fff; font-size: 11px; font-style: normal;
  font-weight: 700; text-align: center; vertical-align: 2px;
}
.badge[hidden] { display: none; }

/* 跨页复习提醒条（应用内提醒的主入口） */
.due-hint {
  max-width: 980px;
  margin: 12px auto 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff7e8;
  border: 1px solid #f6e3bd;
  border-radius: 12px;
  font-size: 14px;
  box-sizing: border-box;
}
.due-hint[hidden] { display: none; }
.dh-icon { font-size: 15px; line-height: 1; }
.dh-text { flex: 1; color: var(--ink); }
.dh-text b { color: var(--red); font-size: 15px; }
.dh-go {
  border: 0; background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.dh-close {
  border: 0; background: transparent; color: var(--muted);
  font-size: 14px; line-height: 1; padding: 4px 2px; cursor: pointer;
}

.view { max-width: 980px; margin: 0 auto; padding: 16px 20px 90px; }

/* ---------- 复习计划 ---------- */
.hero-review { text-align: center; padding: 28px 20px 22px; }
.hero-review.hot { background: linear-gradient(160deg, #f2f4ff 0%, #fff 62%); }
.hr-num { font-size: 56px; font-weight: 800; color: var(--brand); line-height: 1; }
.hr-label { font-size: 15px; color: var(--ink); font-weight: 600; margin-top: 6px; }
.hero-review.hot .hr-num { color: #e8453c; }
.hr-sub { font-size: 13px; color: var(--muted); margin: 6px 0 16px; }
.hr-foot { font-size: 12px; color: var(--muted); margin-top: 12px; }

.stat-row { display: flex; gap: 12px; }
.stat {
  flex: 1; background: #f7f8fc; border-radius: 12px; padding: 14px 8px;
  text-align: center;
}
.stat b { display: block; font-size: 24px; color: var(--ink); }
.stat span { font-size: 12px; color: var(--muted); }

.up-row {
  display: flex; justify-content: space-between; font-size: 14px;
  padding: 9px 0; border-bottom: 1px dashed var(--line, #e8eaf2);
}
.up-row:last-child { border-bottom: 0; }

.rule p { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 8px 0 12px; }

.tag.due-now { background: #fff1f0; color: #e8453c; }
.tag.ok { background: #eefaf1; color: #1f9d55; }

/* 复习答题 */
.sheet.run { max-width: 720px; width: 100%; max-height: 92vh; display: flex; flex-direction: column; }
.run-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); }
.progress { height: 6px; background: #eef0f6; border-radius: 3px; overflow: hidden; margin: 10px 0 16px; }
.progress i { display: block; height: 100%; background: var(--brand); transition: width 0.25s; }
.run-body { flex: 1; overflow-y: auto; padding-right: 4px; }
.run-plan { font-size: 12px; color: var(--muted); margin-left: 8px; }
.run-stem {
  font-size: 17px; line-height: 1.75; color: var(--ink); margin-top: 12px;
  white-space: pre-wrap; word-break: break-word;
}
.run-img {
  width: 100%; border-radius: 12px; margin-top: 14px; border: 1px solid #eef0f6;
}
.run-answer {
  margin-top: 16px; background: #f7f8fc; border-radius: 12px; padding: 14px;
  border-left: 3px solid var(--brand);
}
.run-answer-label { font-size: 12px; color: var(--brand); font-weight: 700; margin-bottom: 6px; }
.run-answer-body { font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.run-actions { display: flex; gap: 12px; padding-top: 16px; }

.sheet.done { text-align: center; }
.done-rate { margin: 16px 0 8px; }
.done-rate b { font-size: 40px; color: var(--brand); }
.done-rate span { display: block; font-size: 12px; color: var(--muted); }

/* ---------- 通用 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.btn {
  border: none; border-radius: 10px; padding: 11px 18px;
  font-size: 15px; cursor: pointer; font-weight: 600;
  background: var(--brand); color: #fff;
  transition: filter 0.15s ease, opacity 0.15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-line { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn-danger { background: #fff; color: var(--red); border: 1.5px solid #f3c2c1; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }
.tag {
  display: inline-block; font-size: 12px; color: var(--brand);
  background: var(--brand-soft); padding: 2px 10px; border-radius: 7px;
}
.empty { text-align: center; color: var(--muted); padding: 48px 10px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 10px; }

/* ---------- 上传区 ---------- */
.drop {
  border: 2px dashed #cfd6ea; border-radius: var(--radius);
  background: #fbfcff; text-align: center; padding: 40px 20px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.dragover { border-color: var(--brand); background: var(--brand-soft); }
.drop .icon { font-size: 44px; display: block; margin-bottom: 12px; }
.drop h3 { margin: 0 0 6px; font-size: 18px; }
.drop p { margin: 0; color: var(--muted); font-size: 13px; }
.drop-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

.preview {
  width: 100%; max-height: 380px; object-fit: contain;
  border-radius: 12px; background: #f0f2f8;
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, .textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 15px; font-family: inherit;
  background: #fff; color: var(--ink); outline: none;
}
.input:focus, .textarea:focus, select:focus { border-color: var(--brand); }
.textarea { resize: vertical; min-height: 130px; line-height: 1.75; }

/* ---------- 错题列表 ---------- */
.search { display: flex; gap: 10px; margin-bottom: 16px; }
.qitem { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s; }
.qitem:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(21, 28, 60, 0.09); }
.qhead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.qhead .date { color: var(--muted); font-size: 12px; }
.qhead .pick { margin-left: auto; }
.qtitle { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.qbody {
  color: #4b5563; font-size: 14px; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.qitem.checked { outline: 2px solid var(--brand); }
.toolbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line);
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; justify-content: center;
}
.toolbar .inner { display: flex; gap: 10px; width: 100%; max-width: 980px; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 19, 35, 0.5);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade 0.18s ease;
}
.sheet {
  width: 100%; max-width: 460px; background: #fff; border-radius: 20px;
  padding: 26px 22px; position: relative; max-height: 88vh; overflow: auto;
  animation: pop 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateY(14px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .close {
  position: absolute; right: 14px; top: 10px; border: none; background: transparent;
  font-size: 20px; color: #9aa1b1; cursor: pointer;
}
.sheet h2 { margin: 6px 0 4px; font-size: 20px; text-align: center; }
.sheet .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.sheet .emoji { text-align: center; font-size: 40px; }

.plans { display: grid; gap: 10px; margin-bottom: 16px; }
.plan {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 16px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.plan:hover { border-color: var(--brand); }
.plan.active { border-color: var(--brand); background: var(--brand-soft); }
.plan .name { font-weight: 700; }
.plan .desc { font-size: 12px; color: var(--muted); }
.plan .price { margin-left: auto; color: var(--gold); font-size: 20px; font-weight: 700; }
.plan .hot {
  font-size: 11px; color: #7a4c00; background: linear-gradient(120deg, #ffe9b0, #ffd36a);
  border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px;
}
.benefits { list-style: none; padding: 0; margin: 0 0 18px; }
.benefits li { padding: 5px 0; font-size: 14px; color: #374151; }

/* ---------- 免费额度进度（转化入口） ---------- */
.qbar { margin-bottom: 12px; }
.qbar-top {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-bottom: 6px;
}
.qbar-top .n { color: var(--ink); font-weight: 700; }
.qbar-track { height: 8px; background: #eef0f6; border-radius: 999px; overflow: hidden; }
.qbar-track i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #6d86ff, #4f6ef7);
  transition: width 0.3s ease;
}
.qbar.warn .qbar-top, .qbar.warn .qbar-top .n { color: var(--red); }
.qbar.warn .qbar-track i { background: linear-gradient(90deg, #ff8a80, #e64340); }
.quota-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; font-size: 13px;
}
.quota-foot .link-btn { font-weight: 600; }

/* ---------- 会员权益对照表 ---------- */
.cmp {
  width: 100%; border-collapse: collapse; font-size: 13px;
  margin: 0 0 18px; border-radius: 12px; overflow: hidden;
}
.cmp th, .cmp td { padding: 9px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.cmp thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfe; }
.cmp tbody td:first-child { text-align: left; color: var(--ink); }
.cmp .free { color: #9aa1b1; }
.cmp .vip { color: var(--brand); font-weight: 700; background: #f7f9ff; }
.cmp tr:last-child td { border-bottom: 0; }

/* ---------- 套餐卡增强 ---------- */
.plan-main { flex: 1 1 auto; min-width: 0; }
.plan.best { box-shadow: 0 4px 14px rgba(79, 110, 247, 0.12); }
.plan .price b { font-size: 22px; }
.plan .save {
  font-size: 11px; color: #b3341f; background: #ffece6;
  border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px;
}
.trust { text-align: center; margin: 10px 0 0; font-size: 12px; line-height: 1.6; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 10px);
  background: rgba(23, 28, 45, 0.92); color: #fff; padding: 9px 16px;
  border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; z-index: 200; max-width: 86vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.loading { display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: spin 0.8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 96px; border-radius: var(--radius); background: linear-gradient(90deg, #eee 25%, #f6f6f9 37%, #eee 63%); background-size: 400% 100%; animation: sk 1.2s infinite; margin-bottom: 16px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.foot {
  text-align: center; color: #9aa1b1; font-size: 12px;
  padding: 0 20px 26px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

.link-btn {
  border: 0; background: transparent; color: #4f6ef7; font-size: 12px;
  padding: 0; cursor: pointer; text-decoration: underline;
}

.share-mask {
  position: fixed; inset: 0; background: rgba(17, 21, 34, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 400; opacity: 0; transition: opacity 0.2s;
}
.share-mask.show { opacity: 1; }
.share-box { max-width: 420px; width: 100%; text-align: center; }
.share-img {
  width: 100%; max-height: 74vh; object-fit: contain;
  border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  -webkit-touch-callout: default;
}
.share-tip { color: #dfe3ee; font-size: 13px; margin-top: 14px; line-height: 1.6; }
.share-close {
  margin-top: 12px; border: 0; background: rgba(255, 255, 255, 0.14); color: #fff;
  font-size: 14px; padding: 10px 26px; border-radius: 999px; cursor: pointer;
}

.install-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid #e8eaf2; border-radius: 16px;
  box-shadow: 0 12px 34px rgba(23, 28, 45, 0.16);
  padding: 12px 12px 12px 14px; z-index: 300;
  opacity: 0; transform: translateY(120%); transition: opacity 0.28s, transform 0.28s;
  max-width: 620px; margin: 0 auto;
}
.install-bar.show { opacity: 1; transform: translateY(0); }
.ib-icon { width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto; }
.ib-text { flex: 1 1 auto; min-width: 0; }
.ib-title { font-size: 14px; font-weight: 700; color: #1d2433; }
.ib-sub { font-size: 12px; color: #7b8398; margin-top: 3px; line-height: 1.45; }
.ib-btn {
  flex: 0 0 auto; border: 0; background: #4f6ef7; color: #fff;
  font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 10px; cursor: pointer;
}
.ib-close {
  flex: 0 0 auto; border: 0; background: transparent; color: #a5abbd;
  font-size: 15px; padding: 4px 2px; cursor: pointer;
}

@media (max-width: 640px) {
  .brand-slogan { display: none; }
  .view { padding: 14px 14px 100px; }
  .card { padding: 16px; border-radius: 14px; }
  .drop { padding: 30px 14px; }
  .topbar { padding: 12px 14px; }
}
