/* =============================================================================
   中考英语真题库 · 样式系统
   设计原则：移动优先、正文可读性优先（做题场景长时间阅读）
   —— 短文与小题目的是"一个视觉整体"：同一张卡片、同一底色，中间不用分隔线切断
   ============================================================================= */

:root {
  --c-primary: #2563eb;
  --c-primary-dark: #1d4ed8;
  --c-primary-light: #eff6ff;
  --c-text: #0f172a;
  --c-text-2: #475569;
  --c-text-3: #94a3b8;
  --c-line: #e2e8f0;
  --c-bg: #f6f8fb;
  --c-card: #ffffff;
  --c-passage-bg: #f8fafc;
  --c-ok: #059669;
  --c-ok-bg: #ecfdf5;
  --c-err: #dc2626;
  --c-err-bg: #fef2f2;
  --c-warn: #d97706;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .12);
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 0 16px; height: 58px;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--c-text); text-decoration: none; flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; font-weight: 800; font-size: 17px;
  display: grid; place-items: center;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .3);
}
.brand-text { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }

.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 13px; border-radius: 999px;
  color: var(--c-text-2); font-size: 14px; font-weight: 500;
  white-space: nowrap; text-decoration: none; transition: .15s;
}
.nav a:hover { background: #f1f5f9; color: var(--c-text); text-decoration: none; }
.nav a.active { background: var(--c-primary-light); color: var(--c-primary); font-weight: 600; }

.userbox { flex: none; display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: #f1f5f9; font-size: 13px; color: var(--c-text-2); cursor: pointer;
}
.user-chip .vip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-ok); }

/* ---------------------------------------------------------------- 布局 */
.main { max-width: var(--maxw); margin: 0 auto; padding: 24px 16px 64px; min-height: 60vh; }
.loading { text-align: center; color: var(--c-text-3); padding: 80px 0; }

.page-head { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 750; margin: 0 0 6px; letter-spacing: -.02em; }
.page-sub { color: var(--c-text-2); font-size: 14px; margin: 0; }

.card {
  background: var(--c-card); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); border: 1px solid var(--c-line);
  padding: 20px; margin-bottom: 16px;
}

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: .15s; white-space: nowrap; line-height: 1.4;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .25); }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-dark); text-decoration: none; }
.btn-ghost { background: #fff; border-color: var(--c-line); color: var(--c-text-2); }
.btn-ghost:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; color: var(--c-text); text-decoration: none; }
.btn-light { background: var(--c-primary-light); color: var(--c-primary); }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }

/* ---------------------------------------------------------------- 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--c-text-2); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--c-text);
  transition: .15s; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.row { display: flex; gap: 10px; align-items: stretch; }
.row > input { flex: 1; }
.captcha-img {
  width: 108px; height: 42px; border-radius: 10px; border: 1px solid var(--c-line);
  cursor: pointer; object-fit: cover; background: #f8fafc;
}

.err { color: var(--c-err); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }

/* ---------------------------------------------------------------- 弹窗 */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; z-index: 1; width: 100%; max-width: 380px;
  background: #fff; border-radius: var(--r-lg); padding: 24px;
  box-shadow: var(--shadow-lg); animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-x {
  position: absolute; top: 10px; right: 12px; width: 30px; height: 30px;
  border: none; background: none; font-size: 22px; line-height: 1;
  color: var(--c-text-3); cursor: pointer; border-radius: 8px;
}
.modal-x:hover { background: #f1f5f9; color: var(--c-text); }
.modal-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.modal-sub { font-size: 13px; color: var(--c-text-2); margin: 0 0 18px; }
.modal-tip { font-size: 12px; color: var(--c-text-3); margin: 12px 0 0; text-align: center; line-height: 1.6; }

.qr-wrap { display: grid; place-items: center; padding: 12px; background: #f8fafc; border-radius: 12px; margin-bottom: 12px; }
.qr-wrap img { width: 200px; height: 200px; object-fit: contain; }
.pay-status { text-align: center; font-size: 13px; color: var(--c-text-2); margin: 0 0 14px; }
.pay-status.paid { color: var(--c-ok); font-weight: 600; }

/* ---------------------------------------------------------------- Toast */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 200; box-shadow: var(--shadow-md); max-width: 90vw;
}
.toast[hidden] { display: none; }

/* ---------------------------------------------------------------- 首页 */
.hero {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #7c3aed 100%);
  border-radius: var(--r-lg); color: #fff; padding: 32px 28px; margin-bottom: 20px;
  box-shadow: 0 10px 32px rgba(37, 99, 235, .25);
}
.hero h1 { font-size: 26px; margin: 0 0 8px; font-weight: 800; letter-spacing: -.02em; }
.hero p { margin: 0 0 20px; opacity: .9; font-size: 14px; max-width: 560px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn-ghost { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); color: #fff; }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .26); color: #fff; }
.hero .btn-primary { background: #fff; color: var(--c-primary); }
.hero .btn-primary:hover { background: #f1f5f9; }

.stat-card { text-align: center; padding: 18px 12px; }
.stat-num { font-size: 26px; font-weight: 800; color: var(--c-primary); letter-spacing: -.02em; }
.stat-label { font-size: 13px; color: var(--c-text-2); margin-top: 2px; }

.feature { display: flex; gap: 12px; padding: 4px 0; }
.feature-ico {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: var(--c-primary-light); color: var(--c-primary);
  display: grid; place-items: center; font-size: 18px; font-weight: 700;
}
.feature h3 { font-size: 15px; margin: 0 0 3px; font-weight: 650; }
.feature p { font-size: 13px; color: var(--c-text-2); margin: 0; line-height: 1.6; }

/* ---------------------------------------------------------------- 组卷 */
.sec-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--c-line); border-radius: var(--r-md);
  margin-bottom: 10px; background: #fff;
}
.sec-row .sec-name { flex: 1; font-weight: 600; font-size: 14px; }
.sec-row .sec-hint { font-size: 12px; color: var(--c-text-3); font-weight: 400; margin-left: 6px; }
.stepper { display: flex; align-items: center; gap: 0; border: 1px solid var(--c-line); border-radius: 9px; overflow: hidden; }
.stepper button {
  width: 32px; height: 32px; border: none; background: #fff; cursor: pointer;
  font-size: 17px; color: var(--c-text-2); line-height: 1;
}
.stepper button:hover:not(:disabled) { background: #f1f5f9; }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper input {
  width: 46px; height: 32px; border: none; border-left: 1px solid var(--c-line);
  border-right: 1px solid var(--c-line); text-align: center; font-size: 14px;
  font-weight: 600; font-family: inherit; outline: none;
}

.assemble-bar {
  position: sticky; bottom: 0; background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px); border-top: 1px solid var(--c-line);
  padding: 12px 16px; display: flex; align-items: center; gap: 14px;
  margin: 0 -16px -64px; z-index: 40;
}
.assemble-bar .sum { flex: 1; font-size: 13px; color: var(--c-text-2); }
.assemble-bar .sum b { color: var(--c-text); font-size: 17px; margin: 0 2px; }

/* ---------------------------------------------------------------- 试卷 / 题目单元 */
.paper-head {
  background: #fff; border-radius: var(--r-lg); border: 1px solid var(--c-line);
  padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.paper-head h2 { margin: 0 0 6px; font-size: 19px; font-weight: 750; }
.paper-meta { font-size: 13px; color: var(--c-text-2); display: flex; gap: 14px; flex-wrap: wrap; }
.paper-meta b { color: var(--c-primary); }

.sec-title {
  display: flex; align-items: baseline; gap: 10px;
  margin: 26px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--c-line);
}
.sec-title h3 { margin: 0; font-size: 16px; font-weight: 700; }
.sec-title .badge { font-size: 12px; color: var(--c-text-3); }

/* ★ 题目单元：短文 + 小题同卡片、同底色，视觉上不可分割 */
.unit {
  background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-lg);
  margin-bottom: 16px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.unit-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; background: #f8fafc; border-bottom: 1px solid var(--c-line);
  font-size: 12px; color: var(--c-text-3);
}
.unit-head .unit-tag {
  background: var(--c-primary-light); color: var(--c-primary);
  padding: 2px 9px; border-radius: 999px; font-weight: 600; font-size: 12px;
}
.passage {
  padding: 18px 20px;
  background: var(--c-passage-bg);
  border-bottom: 1px dashed var(--c-line);
  font-size: 15px; line-height: 1.95; color: #1e293b;
  white-space: pre-wrap; word-break: break-word;
  max-height: 420px; overflow-y: auto;
}
.passage.collapsed { max-height: 180px; }
.passage-toggle {
  display: block; width: 100%; border: none; background: none; cursor: pointer;
  font-size: 13px; color: var(--c-primary); padding: 8px; font-family: inherit;
}
.passage-toggle:hover { background: #f1f5f9; }

.qs { padding: 6px 18px 14px; }
.q { padding: 14px 0; border-bottom: 1px solid #f1f5f9; }
.q:last-child { border-bottom: none; }
.q-stem { font-size: 15px; line-height: 1.8; margin-bottom: 10px; word-break: break-word; }
.q-no {
  display: inline-block; min-width: 24px; height: 24px; line-height: 24px;
  text-align: center; border-radius: 6px; background: var(--c-primary-light);
  color: var(--c-primary); font-weight: 700; font-size: 13px; margin-right: 8px;
  padding: 0 6px;
}
.opts { display: flex; flex-direction: column; gap: 7px; }
.opt {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 9px 12px; border: 1px solid var(--c-line); border-radius: 10px;
  cursor: pointer; transition: .12s; background: #fff; font-size: 14.5px; line-height: 1.65;
}
.opt:hover { border-color: #bfdbfe; background: #fafcff; }
.opt .k {
  flex: none; width: 22px; height: 22px; border-radius: 6px; background: #f1f5f9;
  display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--c-text-2);
}
.opt.picked { border-color: var(--c-primary); background: var(--c-primary-light); }
.opt.picked .k { background: var(--c-primary); color: #fff; }
.opt.right { border-color: var(--c-ok); background: var(--c-ok-bg); }
.opt.right .k { background: var(--c-ok); color: #fff; }
.opt.wrong { border-color: var(--c-err); background: var(--c-err-bg); }
.opt.wrong .k { background: var(--c-err); color: #fff; }

.ans-box {
  margin-top: 10px; padding: 11px 14px; border-radius: 10px;
  background: var(--c-ok-bg); border: 1px solid #a7f3d0; font-size: 14px;
}
.ans-box .lbl { font-weight: 700; color: var(--c-ok); margin-right: 6px; }
.expl-box {
  margin-top: 8px; padding: 12px 14px; border-radius: 10px;
  background: #f8fafc; border: 1px solid var(--c-line);
  font-size: 14px; color: var(--c-text-2); line-height: 1.85; white-space: pre-wrap;
}
.locked-box {
  margin-top: 10px; padding: 12px 14px; border-radius: 10px;
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 1px solid #fcd34d; font-size: 13.5px; color: #92400e;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.locked-box .btn { margin-left: auto; }

.q-img { margin: 10px 0; border: 1px solid var(--c-line); border-radius: 10px; overflow: hidden; max-width: 520px; }
.q-img img { display: block; width: 100%; }

/* 试卷底部操作栏（对答案 / 打印等） */
.paper-bar {
  position: sticky; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  margin: 18px -16px -64px; padding: 12px 16px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--c-line);
}
.paper-bar-info { flex: 1; font-size: 13px; color: var(--c-text-2); }

/* 判分结果（非会员仅提示对错，不泄露答案） */
.res-line { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.res-ok { color: var(--c-ok); font-weight: 700; font-size: 14px; }
.res-bad { color: var(--c-err); font-weight: 700; font-size: 14px; }

/* ---------------------------------------------------------------- 列表 */
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border: 1px solid var(--c-line); border-radius: var(--r-md); background: #fff;
  margin-bottom: 9px; transition: .12s; cursor: pointer;
}
.list-item:hover { border-color: #bfdbfe; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 14.5px; margin-bottom: 2px; }
.list-item .li-sub { font-size: 12.5px; color: var(--c-text-3); }
.list-item .li-right { font-size: 13px; color: var(--c-text-2); flex: none; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px;
  background: #f1f5f9; color: var(--c-text-2); margin-right: 5px;
}
.tag-blue { background: var(--c-primary-light); color: var(--c-primary); }
.tag-green { background: var(--c-ok-bg); color: var(--c-ok); }
.tag-amber { background: #fffbeb; color: var(--c-warn); }

/* ---------------------------------------------------------------- 会员 */
.plan {
  border: 1.5px solid var(--c-line); border-radius: var(--r-lg); padding: 20px;
  background: #fff; position: relative; transition: .15s; cursor: pointer;
}
.plan:hover { border-color: #bfdbfe; box-shadow: var(--shadow-md); }
.plan.hot { border-color: var(--c-primary); box-shadow: 0 6px 20px rgba(37, 99, 235, .15); }
.plan-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--c-primary); color: #fff; font-size: 11.5px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.plan-name { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.plan-price { font-size: 30px; font-weight: 800; color: var(--c-primary); letter-spacing: -.03em; }
.plan-price small { font-size: 15px; font-weight: 600; margin-right: 1px; }
.plan-price span { font-size: 13px; color: var(--c-text-3); font-weight: 500; margin-left: 4px; }
.plan-desc { font-size: 13px; color: var(--c-text-2); margin: 8px 0 0; line-height: 1.6; min-height: 40px; }

.vip-active {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fcd34d; border-radius: var(--r-md); padding: 14px 16px;
  color: #92400e; font-size: 14px; margin-bottom: 16px;
}

.empty { text-align: center; color: var(--c-text-3); padding: 48px 16px; font-size: 14px; }

/* ---------------------------------------------------------------- 筛选条 */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input {
  padding: 9px 12px; border: 1px solid var(--c-line); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: #fff; outline: none; color: var(--c-text);
}
.filters input:focus, .filters select:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.filters .grow { flex: 1; min-width: 180px; }

/* ---------------------------------------------------------------- 页脚 */
.footer {
  border-top: 1px solid var(--c-line); background: #fff;
  padding: 22px 16px; text-align: center;
  font-size: 12.5px; color: var(--c-text-3); line-height: 1.9;
}
.footer span { display: block; }
.footer-sub { font-size: 12px; color: #cbd5e1; }

/* ---------------------------------------------------------------- 移动端 */
@media (max-width: 640px) {
  .topbar-inner { height: 52px; gap: 10px; padding: 0 12px; }
  .brand-text { display: none; }
  .nav a { padding: 6px 10px; font-size: 13px; }
  .main { padding: 16px 12px 48px; }
  .hero { padding: 24px 18px; }
  .hero h1 { font-size: 21px; }
  .passage { padding: 14px 15px; font-size: 14.5px; }
  .qs { padding: 4px 14px 12px; }
  .modal-card { padding: 20px; }
  .stat-num { font-size: 22px; }
  .section-pad { padding: 14px; }
}

/* ---------------------------------------------------------------- 打印（打印 / 导出 PDF） */
@media print {
  .topbar, .footer, .toast, .modal, .paper-bar, .passage-toggle { display: none !important; }
  html, body { background: #fff; color: #000; }
  .main { max-width: 100%; padding: 0; margin: 0; }
  .card, .unit, .paper-head { box-shadow: none !important; border: 1px solid #cbd5e1 !important; break-inside: avoid; }
  a { color: #000 !important; text-decoration: none !important; }
  .passage { max-height: none !important; overflow: visible !important; }
  .opt.picked { border-color: #94a3b8 !important; background: #fff !important; }
  .opt.right, .opt.wrong { background: #fff !important; border-color: #cbd5e1 !important; }
  .opt.right .k, .opt.wrong .k { background: #000 !important; color: #fff !important; }
  .locked-box { background: #f1f5f9 !important; border-color: #cbd5e1 !important; color: #334155 !important; }
  .locked-box .btn { display: none !important; }
  .res-line .btn { display: none !important; }
}
