/* style.css —— 网页版样式（响应式：移动端手机布局 / 桌面端宽屏布局） */
/* 配色沿用原小程序：主绿 #5B8A72 / 错题红 #A05B5B / 收藏金 #E8A000 */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 确保 hidden 属性始终生效（覆盖下方 .modal-mask/.loading-mask 的 display） */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: #FAFAF8;
  color: #2C2C2C;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }
a { text-decoration: none; color: inherit; }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #FAFAF8;
  border-bottom: 1px solid #EBEBEB;
}
.topbar-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
}
.brand { font-size: 17px; font-weight: 700; color: #5B8A72; }
.topnav { display: flex; gap: 6px; }
.topnav-item {
  padding: 6px 16px; border-radius: 20px; font-size: 14px;
  color: #7A7A7A; font-weight: 600; transition: all .15s;
}
.topnav-item:hover { background: #EEE; }
.topnav-item.active { background: #E8F5EF; color: #5B8A72; }

/* ---------- 主内容容器 ---------- */
.app {
  max-width: 960px; margin: 0 auto;
  padding: 8px 0 24px;
  min-height: calc(100vh - 120px);
}
/* 阅读类子页面内容居中、限制可读宽度 */
.sub-page { max-width: 720px; margin: 0 auto; }

/* ---------- 底部导航（移动端） ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: none;
  background: #FFF; border-top: 1px solid #EBEBEB;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 7px 0; color: #B0B0B0; font-size: 11px; gap: 2px;
}
.tab-item.active { color: #5B8A72; }
.tab-icon { font-size: 20px; }

/* ============ 激活页 ============ */
.activate-wrap { display: flex; flex-direction: column; align-items: center; padding: 80px 30px; }
.activate-logo {
  width: 64px; height: 64px; border-radius: 50%;
  background: #E8F5EF; border: 2px solid #5B8A72;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; margin-bottom: 18px;
}
.activate-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.activate-sub { font-size: 13px; color: #7A7A7A; margin-bottom: 36px; }
.activate-input {
  width: 240px; max-width: 80vw; padding: 14px 20px; border-radius: 26px;
  border: 1px solid #EBEBEB; background: #FFF; font-size: 17px;
  text-align: center; letter-spacing: 4px; margin-bottom: 18px; outline: none;
}
.activate-input:focus { border-color: #5B8A72; }
.activate-btn {
  width: 240px; max-width: 80vw; padding: 14px; border-radius: 26px;
  background: #5B8A72; color: #FFF; font-size: 16px; font-weight: 600; border: none;
}
.activate-error { font-size: 13px; color: #A05B5B; margin-top: 12px; min-height: 18px; }

/* ============ 首页 ============ */
.page-home { padding: 12px 0; }
.pt { font-size: 24px; font-weight: 700; padding: 0 20px 2px; }
.ps { font-size: 12px; color: #7A7A7A; padding: 0 20px 14px; }

.paper-grid { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 0 20px; }
.paper-card {
  background: #FFF; border-radius: 14px; overflow: hidden;
  border: 1px solid #EBEBEB; position: relative;
}
.paper-bar { position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.paper-title { font-size: 16px; font-weight: 600; padding: 18px 18px 2px; }
.paper-sub { font-size: 12px; color: #7A7A7A; padding: 0 18px 10px; }
.paper-btns { display: flex; padding: 0 18px 10px; gap: 10px; }
.btn-study, .btn-exam { flex: 1; padding: 10px 0; border-radius: 9px; font-size: 14px; font-weight: 600; border: none; }
.btn-study { background: #E8F5EF; color: #5B8A72; }
.btn-exam { background: #5B8A72; color: #FFF; }
.progress-row { display: flex; align-items: center; padding: 0 18px 14px; gap: 10px; }
.progress-bar { flex: 1; height: 6px; background: #EBEBEB; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; }
.progress-text { font-size: 11px; color: #7A7A7A; white-space: nowrap; }

.stats-card, .link-card, .wrong-card {
  background: #FFF; border-radius: 14px; margin: 14px 20px 0; border: 1px solid #EBEBEB;
}
.stats-card { padding: 16px 18px; }
.stats-label { font-size: 14px; font-weight: 600; color: #5B8A72; }
.stats-detail { font-size: 12px; color: #7A7A7A; margin-top: 3px; }
.link-card { padding: 16px 18px; cursor: pointer; }
.link-title { font-size: 16px; font-weight: 600; }
.link-sub { font-size: 12px; margin-top: 3px; }

.wrong-card { overflow: hidden; position: relative; }
.wrong-bar { position: absolute; top: 0; left: 0; right: 0; height: 4px; background: #A05B5B; }
.wrong-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 2px; }
.wrong-title { font-size: 16px; font-weight: 600; }
.wrong-badge { background: #FFF2F0; color: #A05B5B; font-size: 12px; padding: 3px 10px; border-radius: 12px; font-weight: 600; }
.wrong-sub { font-size: 12px; color: #7A7A7A; padding: 0 18px 10px; }
.wrong-btns { display: flex; padding: 0 18px 14px; gap: 10px; }
.btn-wrong-view, .btn-wrong-test { flex: 1; padding: 10px 0; border-radius: 9px; font-size: 14px; font-weight: 600; border: none; }
.btn-wrong-view { background: #FFF2F0; color: #A05B5B; }
.btn-wrong-test { background: #A05B5B; color: #FFF; }

/* ============ 通用页头 ============ */
.page-header { text-align: center; padding: 28px 0 20px; }
.page-title { font-size: 24px; font-weight: 700; }
.page-sub { font-size: 12px; color: #7A7A7A; margin-top: 4px; }
.hint-text { text-align: center; font-size: 12px; color: #7A7A7A; margin-top: 12px; padding: 0 20px; }

/* ============ 研习选择 ============ */
.studysel-grid { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 0 20px; }
.paper-section { background: #FFF; border-radius: 14px; border: 1px solid #EBEBEB; padding: 16px 18px; }
.section-label { font-size: 15px; font-weight: 600; }
.section-stats { font-size: 12px; color: #7A7A7A; margin: 4px 0 12px; }
.mode-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-btn { flex: 1; min-width: 90px; padding: 10px 6px; border-radius: 9px; font-size: 13px; font-weight: 600; border: 1px solid #EBEBEB; background: #FAFAFA; color: #2C2C2C; }
.mode-btn.primary { background: #5B8A72; color: #FFF; border-color: #5B8A72; }

/* ============ 答题（研习/考试通用） ============ */
.study-header, .exam-header, .detail-header, .list-header {
  display: flex; align-items: center; padding: 0 18px; height: 48px;
  border-bottom: 1px solid #EBEBEB; background: #FAFAF8;
  position: sticky; top: 0; z-index: 10;
}
.back-btn { font-size: 14px; color: #2C2C2C; cursor: pointer; }
.header-title, .exam-title { font-size: 13px; color: #7A7A7A; flex: 1; text-align: center; }
.fav-btn { font-size: 22px; color: #C0C0C0; cursor: pointer; }
.fav-btn.active { color: #E8A000; }
.header-count { font-size: 13px; color: #7A7A7A; }

.study-body, .exam-body, .detail-body { padding: 16px 20px 32px; }
.q-meta { display: flex; justify-content: space-between; margin-bottom: 14px; }
.q-num { font-size: 14px; font-weight: 700; }
.q-chapter { font-size: 11px; color: #7A7A7A; }
.q-text { font-size: 16px; line-height: 1.7; margin-bottom: 18px; }

.opts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.op-item { border-radius: 10px; border: 2px solid #EBEBEB; background: #FAFAFA; padding: 13px 16px; display: flex; align-items: center; gap: 14px; cursor: pointer; transition: all .12s; }
.op-item.selected { border-color: #5B8A72; background: #E8F5EF; }
.op-item.correct { border-color: #4A7C59; background: #F6FFED; }
.op-item.wrong { border-color: #A05B5B; background: #FFF2F0; }
.op-key { width: 30px; height: 30px; border-radius: 50%; background: #E0E0E0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #666; flex-shrink: 0; }
.op-item.selected .op-key, .op-item.correct .op-key { background: #5B8A72; color: #FFF; }
.op-item.correct .op-key { background: #4A7C59; }
.op-item.wrong .op-key { background: #A05B5B; color: #FFF; }
.op-text { flex: 1; font-size: 15px; line-height: 1.5; }
.op-icon { margin-left: auto; font-size: 18px; }

.expl { background: #F0F7F4; border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; border-left: 4px solid #5B8A72; }
.expl-title { font-size: 14px; font-weight: 700; color: #5B8A72; margin-bottom: 8px; }
.expl-content { font-size: 14px; line-height: 1.8; margin-bottom: 8px; }
.expl-meta { font-size: 11px; color: #7A7A7A; border-top: 1px solid #D0E0D8; padding-top: 8px; }

.prog-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.prog-bar { flex: 1; height: 6px; background: #EBEBEB; border-radius: 3px; overflow: hidden; }
.prog-fill { height: 100%; background: #5B8A72; border-radius: 3px; }
.prog-text { font-size: 11px; color: #7A7A7A; white-space: nowrap; }

.nav-btns, .exam-btns { display: flex; gap: 10px; }
.btn-prev { flex: 1; padding: 13px; border-radius: 9px; background: #E0E0E0; color: #666; font-size: 15px; font-weight: 600; border: none; }
.btn-placeholder { flex: 1; }
.action-btn, .btn-next { flex: 2; padding: 13px; border-radius: 9px; background: #5B8A72; color: #FFF; font-size: 15px; font-weight: 600; border: none; }
.btn-next { flex: 2; }

/* ============ 考试 ============ */
.exam-grid { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 0 20px; }
.card { background: #FFF; border-radius: 14px; overflow: hidden; border: 2px solid #EBEBEB; position: relative; cursor: pointer; transition: all .15s; }
.card.selected { border-color: #5B8A72; box-shadow: 0 0 0 3px rgba(91,138,114,.15); }
.card.selected .card-title { color: #5B8A72; }
.card-bar { position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.card-title { font-size: 16px; font-weight: 600; padding: 18px 18px 2px; }
.card-sub { font-size: 12px; color: #7A7A7A; padding: 0 18px 16px; }
.start-btn { display: block; width: calc(100% - 40px); max-width: 320px; margin: 18px auto; padding: 14px; border-radius: 26px; background: #5B8A72; color: #FFF; font-size: 16px; font-weight: 600; border: none; }
.start-btn.disabled { opacity: .4; cursor: not-allowed; }

.exam-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.timer { font-size: 22px; font-weight: 700; color: #5B8A72; font-variant-numeric: tabular-nums; }
.timer.warn { color: #A05B5B; }
.exam-progress { font-size: 14px; color: #7A7A7A; }

/* ============ 考试结果 ============ */
.result-wrap { display: flex; flex-direction: column; align-items: center; padding: 30px 24px; }
.result-icon { font-size: 64px; line-height: 1; }
.result-title { font-size: 22px; font-weight: 700; margin-top: 12px; }
.result-card { background: #FFF; border-radius: 16px; padding: 28px 36px; text-align: center; margin: 24px 0; width: 100%; border: 2px solid #EBEBEB; }
.result-card.pass { border-color: #4A7C59; box-shadow: 0 4px 24px rgba(74,124,89,.1); }
.result-card.fail { border-color: #A05B5B; box-shadow: 0 4px 24px rgba(160,91,91,.1); }
.result-badge { display: inline-block; padding: 8px 20px; border-radius: 9px; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.result-badge.pass { background: #F6FFED; border: 1px solid #4A7C59; color: #4A7C59; }
.result-badge.fail { background: #FFF2F0; border: 1px solid #A05B5B; color: #A05B5B; }
.result-pct { font-size: 40px; font-weight: 700; }
.result-pct.pass { color: #4A7C59; }
.result-pct.fail { color: #A05B5B; }
.result-detail { font-size: 14px; color: #7A7A7A; margin-top: 4px; }
.result-note { font-size: 13px; text-align: center; margin-bottom: 18px; }
.result-note.pass { color: #4A7C59; }
.result-note.fail { color: #A05B5B; }
.stats-row { display: flex; gap: 12px; width: 100%; margin-bottom: 18px; }
.stat-item { flex: 1; padding: 12px; border-radius: 9px; font-size: 13px; font-weight: 600; text-align: center; }
.stat-item.ok { background: #F6FFED; color: #4A7C59; }
.stat-item.ng { background: #FFF2F0; color: #A05B5B; }

.review-section { width: 100%; margin-bottom: 18px; }
.review-header { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; background: #FFF; border-radius: 12px; border: 1px solid #EBEBEB; cursor: pointer; }
.review-title { font-size: 14px; font-weight: 600; }
.review-toggle { font-size: 13px; color: #7A7A7A; }
.review-list { margin-top: 10px; }
.review-item { background: #FFF; border-radius: 12px; padding: 16px 18px; margin-bottom: 10px; border: 1px solid #EBEBEB; }
.review-q-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.review-num { font-size: 13px; font-weight: 700; white-space: nowrap; }
.review-answer-info { font-size: 12px; color: #7A7A7A; }
.wrong-text { color: #A05B5B; font-weight: 600; }
.correct-text { color: #4A7C59; font-weight: 600; }
.review-q-text { font-size: 14px; line-height: 1.7; margin-bottom: 8px; }
.review-opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.review-opt { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; border: 1px solid #EBEBEB; background: #FAFAFA; }
.review-opt.correct { border-color: #4A7C59; background: #F6FFED; }
.review-opt.wrong { border-color: #A05B5B; background: #FFF2F0; }
.review-opt-key { width: 26px; height: 26px; border-radius: 50%; background: #E0E0E0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #666; flex-shrink: 0; }
.review-opt.correct .review-opt-key { background: #4A7C59; color: #FFF; }
.review-opt.wrong .review-opt-key { background: #A05B5B; color: #FFF; }
.review-opt-text { flex: 1; font-size: 13px; }
.review-expl { background: #F0F7F4; border-radius: 8px; padding: 12px 14px; border-left: 3px solid #5B8A72; }
.review-expl-title { font-size: 12px; font-weight: 700; color: #5B8A72; display: block; margin-bottom: 4px; }
.review-expl-content { font-size: 12px; line-height: 1.8; }
.btn-primary, .btn-secondary { display: block; width: 100%; max-width: 320px; margin: 0 auto 12px; padding: 13px; border-radius: 26px; font-size: 15px; font-weight: 600; }
.btn-primary { background: #5B8A72; color: #FFF; border: none; }
.btn-secondary { background: #FFF; color: #5B8A72; border: 2px solid #5B8A72; }

/* ============ 错题/收藏 列表 ============ */
.list-body { padding: 14px 20px 32px; }
.practice-bar { display: flex; align-items: center; gap: 10px; background: #E8F5EF; color: #5B8A72; border-radius: 12px; padding: 14px 18px; margin-bottom: 14px; cursor: pointer; font-weight: 600; }
.practice-icon { font-size: 18px; }
.practice-text { flex: 1; font-size: 14px; }
.practice-arrow { font-size: 18px; }
.q-item { display: flex; align-items: center; gap: 12px; background: #FFF; border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid #EBEBEB; cursor: pointer; }
.q-item-main { flex: 1; min-width: 0; }
.q-item .q-num { font-size: 12px; color: #7A7A7A; font-weight: 600; margin-bottom: 4px; }
.q-item .q-text { font-size: 14px; line-height: 1.5; margin-bottom: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-delete { width: 28px; height: 28px; border-radius: 50%; background: #F5F5F5; color: #B0B0B0; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.empty { text-align: center; color: #B0B0B0; padding: 80px 20px; font-size: 14px; white-space: pre-line; }

/* ============ 详情页 ============ */
.q-answer { font-size: 15px; font-weight: 600; color: #4A7C59; margin: 16px 0; }
.q-explanation { background: #F0F7F4; border-radius: 12px; padding: 16px 18px; border-left: 4px solid #5B8A72; margin-bottom: 18px; }
.remove-btn { display: block; width: 100%; padding: 13px; border-radius: 26px; background: #FFF; color: #A05B5B; border: 2px solid #A05B5B; font-size: 15px; font-weight: 600; }

/* ============ 错题测试结果 ============ */
.result-body { padding: 20px; }
.wr-stats-row { display: flex; gap: 14px; margin-bottom: 18px; }
.wr-stat-box { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px; border-radius: 14px; }
.wr-stat-box.correct { background: #F6FFED; }
.wr-stat-box.wrong { background: #FFF2F0; }
.wr-stat-label { font-size: 13px; color: #7A7A7A; }
.wr-stat-num { font-size: 34px; font-weight: 700; }
.wr-stat-box.correct .wr-stat-num { color: #4A7C59; }
.wr-stat-box.wrong .wr-stat-num { color: #A05B5B; }
.wr-stat-unit { font-size: 12px; color: #7A7A7A; }
.remove-notice { background: #FFF8E8; color: #B0860B; border-radius: 12px; padding: 14px 18px; font-size: 13px; margin-bottom: 18px; }
.wr-review-section { margin-bottom: 18px; }
.wr-review-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.wr-review-item { display: flex; align-items: center; gap: 12px; background: #FFF; border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid #EBEBEB; cursor: pointer; }
.wr-review-num { font-size: 13px; font-weight: 700; color: #A05B5B; white-space: nowrap; }
.wr-review-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wr-review-text { font-size: 14px; }
.wr-review-chapter { font-size: 12px; color: #7A7A7A; }
.empty-review { text-align: center; padding: 50px 20px; font-size: 16px; color: #4A7C59; }
.action-btns { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.btn-retest { padding: 13px; border-radius: 26px; background: #5B8A72; color: #FFF; font-size: 15px; font-weight: 600; border: none; }
.btn-home { padding: 13px; border-radius: 26px; background: #FFF; color: #5B8A72; border: 2px solid #5B8A72; font-size: 15px; font-weight: 600; }

/* ============ 全局组件：toast / loading / modal ============ */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.8); color: #FFF; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; z-index: 200; opacity: 0; pointer-events: none; transition: all .2s;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loading-mask, .modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.loading-box { background: rgba(0,0,0,.8); color: #FFF; padding: 20px 28px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 14px; }
.spinner { width: 28px; height: 28px; border: 3px solid rgba(255,255,255,.3); border-top-color: #FFF; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-box { background: #FFF; border-radius: 14px; width: 300px; max-width: 84vw; overflow: hidden; }
.modal-title { font-size: 17px; font-weight: 600; text-align: center; padding: 22px 20px 8px; }
.modal-content { font-size: 14px; color: #555; text-align: center; padding: 0 24px 22px; line-height: 1.6; }
.modal-btns { display: flex; border-top: 1px solid #EBEBEB; }
.modal-cancel, .modal-confirm { flex: 1; padding: 14px; border: none; background: #FFF; font-size: 16px; }
.modal-cancel { color: #888; border-right: 1px solid #EBEBEB; }
.modal-confirm { color: #5B8A72; font-weight: 600; }

/* ============ 响应式断点 ============ */
/* 移动端：隐藏顶部导航链接，显示底部 tabbar，给内容留出底栏空间 */
@media (max-width: 767px) {
  .topnav { display: none; }
  .tabbar { display: flex; }
  .app { padding-bottom: 70px; }
  .toast { bottom: 90px; }
}
/* 桌面端：宽屏多列布局 */
@media (min-width: 768px) {
  .app { padding: 16px 0 40px; }
  .paper-grid, .studysel-grid, .exam-grid { grid-template-columns: 1fr 1fr; padding: 0 24px; }
  .pt, .ps { padding-left: 24px; padding-right: 24px; }
  .stats-card, .link-card, .wrong-card { margin-left: 24px; margin-right: 24px; }
  .op-item:hover { border-color: #C8D8CF; }
  .q-item:hover, .card:hover, .paper-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.05); }
}
@media (min-width: 1040px) {
  .paper-grid, .studysel-grid { grid-template-columns: 1fr 1fr 1fr; }
}
