/* 公考刷题 - light theme, mobile-first */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-weak: #e8effd;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --success-weak: #e7f6ec;
  --danger: #dc2626;
  --danger-weak: #fdecec;
  --warning: #b45309;
  --warning-weak: #fdf3e3;
  --text: #1f2937;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.65;
  min-height: 100vh; display: flex; flex-direction: column;
}
.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; flex: 1; }
a { color: var(--primary); text-decoration: none; }

/* topbar */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: 760px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.brand-name { font-size: 17px; }
.topnav { display: flex; gap: 4px; }
.topnav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.topnav a.active { color: var(--primary); background: var(--primary-weak); font-weight: 500; }

/* generic */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 10px; padding: 10px 18px; font-size: 15px; cursor: pointer; font-family: inherit; transition: opacity .15s; }
.btn:active { opacity: .8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: var(--card); color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost { background: var(--bg); color: var(--muted); }
.btn-danger-ghost { background: transparent; color: var(--danger); border: 1px solid var(--danger-weak); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: var(--primary-weak); color: var(--primary); }
.tag-gray { background: var(--bg); color: var(--muted); }
.page-loading { text-align: center; padding: 80px 0; color: var(--muted); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer { text-align: center; color: var(--faint); font-size: 12px; padding: 20px 0 28px; }

/* home */
.hero { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-radius: 16px; padding: 22px 20px; margin-bottom: 16px; }
.hero h1 { font-size: 20px; margin-bottom: 4px; }
.hero p { font-size: 13px; opacity: .85; }
.hero-stats { display: flex; gap: 24px; margin-top: 14px; }
.hero-stats div span { display: block; font-size: 20px; font-weight: 600; }
.hero-stats div em { font-style: normal; font-size: 12px; opacity: .8; }
.section-title { font-size: 16px; font-weight: 600; margin: 20px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.section-title a { font-size: 13px; font-weight: 400; }
.module-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.module-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: block; color: var(--text); transition: transform .12s; }
.module-card:active { transform: scale(.98); }
.module-card .mc-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: 8px; }
.module-card h3 { font-size: 15px; font-weight: 600; }
.module-card p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.quick-row { display: flex; gap: 10px; margin-top: 16px; }
.quick-card { flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); color: var(--text); font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; }

/* paper list */
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.chip { flex-shrink: 0; padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-size: 13px; color: var(--muted); cursor: pointer; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.paper-list { display: flex; flex-direction: column; gap: 10px; }
.paper-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: block; color: var(--text); }
.paper-item h3 { font-size: 15px; font-weight: 500; line-height: 1.5; }
.paper-item .pi-meta { display: flex; gap: 8px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.paper-item .pi-meta .pi-count { font-size: 13px; color: var(--muted); margin-left: auto; }
.muted-tip { text-align: center; color: var(--muted); font-size: 14px; padding: 40px 0; }

/* practice */
.practice-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.practice-top .pt-info { font-size: 14px; color: var(--muted); }
.progress-bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progress-bar i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .25s; }
.timer-pill { font-variant-numeric: tabular-nums; background: var(--warning-weak); color: var(--warning); padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.timer-pill.over { background: var(--danger-weak); color: var(--danger); }
.material-box { background: var(--primary-weak); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; font-size: 14px; }
.material-box .mb-label { font-size: 12px; color: var(--primary); font-weight: 600; margin-bottom: 6px; }
.q-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 16px; }
.q-type-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.q-stem { font-size: 16px; line-height: 1.7; margin-bottom: 16px; word-break: break-word; }
.q-stem img, .material-box img, .analysis img { max-width: 100%; height: auto; border-radius: 6px; display: block; margin: 8px 0; }
.option { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; margin-bottom: 10px; cursor: pointer; font-size: 15px; line-height: 1.6; background: var(--card); transition: border-color .15s, background .15s; word-break: break-word; }
.option:hover { border-color: var(--primary); }
.option .opt-key { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; margin-top: 1px; }
.option.chosen { border-color: var(--primary); background: var(--primary-weak); }
.option.chosen .opt-key { background: var(--primary); color: #fff; }
.option.correct { border-color: var(--success); background: var(--success-weak); }
.option.correct .opt-key { background: var(--success); color: #fff; }
.option.wrong { border-color: var(--danger); background: var(--danger-weak); }
.option.wrong .opt-key { background: var(--danger); color: #fff; }
.option.locked { cursor: default; }
.verdict { padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; margin: 4px 0 10px; }
.verdict.ok { background: var(--success-weak); color: var(--success); }
.verdict.no { background: var(--danger-weak); color: var(--danger); }
.analysis { border-top: 1px dashed var(--border); margin-top: 12px; padding-top: 12px; font-size: 14px; color: var(--text); }
.analysis .an-title { font-size: 13px; color: var(--primary); font-weight: 600; margin-bottom: 6px; }
.analysis .an-answer { color: var(--success); font-weight: 500; margin-bottom: 6px; }
.practice-nav { display: flex; gap: 10px; margin-top: 16px; }
.practice-nav .btn { flex: 1; }
.practice-foot { text-align: center; margin-top: 14px; color: var(--faint); font-size: 13px; }

/* answer sheet */
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; margin-top: 12px; }
.sheet-cell { aspect-ratio: 1; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; border: 1px solid var(--border); background: var(--card); cursor: pointer; }
.sheet-cell.answered { background: var(--primary); border-color: var(--primary); color: #fff; }
.sheet-cell.current { outline: 2px solid var(--primary); outline-offset: 2px; }
.sheet-cell.bad { background: var(--danger); border-color: var(--danger); color: #fff; }
.sheet-cell.good { background: var(--success); border-color: var(--success); color: #fff; }

/* result */
.result-hero { text-align: center; padding: 26px 16px; }
.result-hero .rh-score { font-size: 44px; font-weight: 700; color: var(--primary); }
.result-hero .rh-score small { font-size: 18px; color: var(--muted); font-weight: 400; }
.result-hero .rh-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.result-bars { margin: 14px 0; }
.rbar { margin-bottom: 10px; }
.rbar .rb-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.rbar .rb-track { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.rbar .rb-track i { display: block; height: 100%; background: var(--success); border-radius: 999px; }

/* wrongbook */
.wrong-group { margin-bottom: 14px; }
.wrong-group h3 { font-size: 15px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.wrong-actions { display: flex; gap: 10px; margin-top: 16px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .es-icon { font-size: 40px; margin-bottom: 10px; }

/* stats */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-cell { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 10px; text-align: center; box-shadow: var(--shadow); }
.stat-cell span { display: block; font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-cell em { font-style: normal; font-size: 12px; color: var(--muted); }

/* books */
.book-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.book-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: block; color: var(--text); transition: transform .12s; }
.book-card:active { transform: scale(.98); }
.book-cover { position: relative; height: 72px; display: flex; align-items: center; padding: 0 14px; }
.book-cover .book-glyph { font-size: 44px; font-weight: 800; color: rgba(255,255,255,.85); line-height: 1; }
.book-cover .book-years { position: absolute; right: 12px; top: 10px; font-size: 10px; color: rgba(255,255,255,.7); letter-spacing: 1px; }
.book-body { padding: 10px 12px 12px; }
.book-body h3 { font-size: 14.5px; font-weight: 600; }
.book-body p { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-body .book-meta { font-size: 11.5px; color: var(--primary); margin-top: 5px; font-weight: 500; }
.book-hero { color: #fff; border-radius: 14px; padding: 20px 18px; }
.book-hero .bh-title { font-size: 19px; font-weight: 700; letter-spacing: 1px; }
.book-hero .bh-sub { font-size: 12.5px; opacity: .85; margin-top: 5px; }
.book-hero .bh-meta { font-size: 12.5px; opacity: .8; margin-top: 10px; }
.book-part { font-size: 13px; font-weight: 600; color: var(--muted); margin: 16px 2px 8px; padding-left: 2px; }
.book-intro { font-size: 13.5px; color: var(--text); line-height: 1.75; }
.book-intro p { margin-bottom: 8px; }
.code-jump { display: flex; gap: 8px; margin-top: 10px; }
.code-jump input { flex: 1; border: 1.5px solid var(--border); border-radius: 10px; padding: 9px 12px; font-size: 14px; font-family: inherit; outline: none; text-transform: uppercase; }
.code-jump input:focus { border-color: var(--primary); }
.support-card { text-align: center; padding: 30px 20px; }
.support-card h2 { font-size: 18px; margin-top: 8px; }

/* vip lock */
.lock-card { text-align: center; padding: 30px 20px; margin-top: 8px; }
.lock-card h2 { font-size: 18px; margin-top: 8px; }
.lock-desc { font-size: 13.5px; color: var(--muted); margin-top: 10px; line-height: 1.8; }
.lock-cur { font-size: 13px; color: var(--primary); font-weight: 600; margin-top: 12px; word-break: break-all; }
.lock-note { font-size: 12.5px; color: var(--faint); margin-top: 14px; line-height: 1.7; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px); background: rgba(31,41,55,.92); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; max-width: 80vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 560px) {
  .module-grid { grid-template-columns: repeat(3, 1fr); }
}
