/* 卷先生 · 网页版共用样式（移动优先） */
:root {
  --paper: #f7f5ef;
  --card: #ffffff;
  --ink: #17211c;
  --ink-2: #4c5a53;
  --ink-3: #87948c;
  --brand: #166b52;
  --brand-dark: #0f4d3b;
  --brand-soft: #e6f2ec;
  --gold: #d9a441;
  --gold-soft: #fbf1dc;
  --line: #e4dfd3;
  --danger: #c4453a;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(23, 33, 28, .07);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }

.container { max-width: 960px; margin: 0 auto; padding: 20px 16px 56px; }
.container.narrow { max-width: 760px; }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); flex-shrink: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; letter-spacing: -1px;
}
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: var(--ink-3); letter-spacing: 1px; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 12px; border-radius: 999px; white-space: nowrap;
  color: var(--ink-2); font-size: 14px;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.nav a.active { background: var(--brand); color: #fff; }
.user-area { display: flex; align-items: center; gap: 8px; flex-shrink: 0; font-size: 13px; }
.user-name { color: var(--ink-2); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-size: 14px; font-family: inherit;
  cursor: pointer; transition: .18s; line-height: 1.4;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.plain { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn.plain:hover { border-color: var(--ink-3); background: #faf9f5; }
.btn.gold { background: var(--gold); }
.btn.gold:hover { background: #c8932f; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.lg { padding: 12px 24px; font-size: 16px; }

/* ---------- 卡片 / 排版 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.section-title { font-size: 19px; font-weight: 700; margin: 28px 0 12px; letter-spacing: .3px; }
.section-title:first-child { margin-top: 0; }
.muted { color: var(--ink-3); font-size: 13px; }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; background: var(--brand-soft); color: var(--brand-dark);
}
.tag.gold { background: var(--gold-soft); color: #8a6516; }
.tag.gray { background: #f0eee7; color: var(--ink-3); }

/* ---------- 首页 ---------- */
.hero {
  padding: 34px 28px;
  border-radius: 22px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(217, 164, 65, .16), transparent 55%),
    linear-gradient(150deg, #ffffff 0%, #f3f8f5 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 30px; line-height: 1.25; margin: 10px 0 10px; letter-spacing: .5px; }
.hero p { margin: 0 0 18px; color: var(--ink-2); max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.grade-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
.grade-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px;
}
.grade-card h3 { margin: 0 0 8px; font-size: 15px; }
.book-row { display: flex; gap: 8px; }
.book-chip {
  flex: 1; text-align: center; padding: 8px 4px; border-radius: 9px;
  border: 1px solid var(--line); color: var(--ink-2); font-size: 13px;
  background: #fff;
}
.book-chip.open { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.book-chip.open:hover { border-color: var(--brand-dark); }
.book-chip.closed { color: #b3b0a6; background: #f6f5f0; cursor: not-allowed; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.step .num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-dark); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 8px;
}
.step h4 { margin: 0 0 4px; font-size: 14px; }
.step p { margin: 0; font-size: 13px; color: var(--ink-3); }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 16px; }
.form-row > label.label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; font-weight: 600; }
.input, select.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--brand); }
.input.sm { width: 72px; height: 34px; padding: 0 8px; text-align: center; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.disabled { opacity: .5; cursor: not-allowed; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.check-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check-item input { accent-color: var(--brand); width: 15px; height: 15px; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.total-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.total-score { font-size: 22px; font-weight: 700; color: var(--brand-dark); }

/* ---------- 题型表 ---------- */
.type-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.type-table th, .type-table td { padding: 8px 6px; text-align: center; border-bottom: 1px solid #f0ede5; font-size: 13px; }
.type-table th { color: var(--ink-3); font-weight: 600; font-size: 12px; }
.type-table td:first-child, .type-table th:first-child { text-align: left; }
.type-table tr:last-child td { border-bottom: none; }

/* ---------- 预览 ---------- */
.paper-sheet { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 26px 22px; box-shadow: var(--shadow); }
.paper-head { text-align: center; margin-bottom: 14px; }
.paper-head h1 { font-size: 22px; margin: 0 0 4px; }
.paper-head .sub { color: var(--ink-2); font-size: 14px; }
.paper-info { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; font-size: 13px; color: var(--ink-3); margin-top: 10px; }
.paper-section { margin-top: 22px; }
.paper-section h3 { font-size: 15px; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.q-item { margin-bottom: 10px; font-size: 14px; }
.q-item .q-no { color: var(--ink-3); margin-right: 4px; }
.q-opts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 0 18px; color: var(--ink-2); font-size: 13px; }
.answer {
  margin-top: 6px; font-size: 13px; color: #6b5220;
  background: var(--gold-soft); border: 1px solid #efe0bf; border-radius: 8px; padding: 5px 10px; display: inline-block;
}
.score-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.score-table th, .score-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

/* ---------- 套餐 ---------- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan-card {
  background: #fff; border: 1.5px solid var(--line); border-radius: 16px;
  padding: 20px 18px; display: flex; flex-direction: column;
}
.plan-card.featured { border-color: var(--gold); background: linear-gradient(180deg, #fffdf7, #fff); }
.plan-card h3 { margin: 0 0 2px; font-size: 17px; }
.plan-card .price { font-size: 28px; font-weight: 700; color: var(--ink); margin: 8px 0 2px; }
.plan-card .price small { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.plan-card ul { margin: 10px 0 16px; padding-left: 18px; color: var(--ink-2); font-size: 13px; flex: 1; }
.member-banner {
  background: linear-gradient(120deg, #123f31, #1b6a51);
  color: #fff; border-radius: 16px; padding: 20px 22px; margin-bottom: 16px;
}
.member-banner h2 { margin: 0 0 4px; font-size: 19px; }
.member-banner p { margin: 0; font-size: 13px; opacity: .82; }

/* ---------- 历史 ---------- */
.history-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 4px; border-bottom: 1px solid #f0ede5;
}
.history-item:last-child { border-bottom: none; }
.history-item .t { font-size: 14px; font-weight: 600; }
.history-item .m { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.history-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--ink-3); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ---------- 弹层 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 19, .5);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  padding: 16px;
}
.modal {
  background: #fff; border-radius: 18px; padding: 24px;
  width: 400px; max-width: 100%; max-height: 90vh; overflow: auto;
  position: relative; box-shadow: 0 24px 60px rgba(0,0,0,.24);
}
.modal h3 { margin: 0 0 4px; font-size: 19px; }
.modal .modal-sub { color: var(--ink-3); font-size: 13px; margin: 0 0 18px; }
.close-x {
  position: absolute; top: 10px; right: 12px; border: none; background: none;
  font-size: 22px; color: #bbb; cursor: pointer; line-height: 1;
}
.code-row { display: flex; gap: 8px; }
.code-row .input { flex: 1; }
.send-btn { height: 40px; padding: 0 12px; white-space: nowrap; flex-shrink: 0; font-size: 13px; }
.form-msg { min-height: 20px; font-size: 12px; color: var(--danger); margin-top: 8px; }
.form-msg.ok { color: var(--brand); }
#qr-holder { display: flex; justify-content: center; margin: 12px 0; }
#qr-holder svg, #qr-holder img { width: 200px; height: 200px; }
.pay-amount { text-align: center; font-size: 22px; font-weight: 700; color: var(--ink); margin: 6px 0 2px; }
.pay-status { text-align: center; font-size: 13px; color: var(--ink-3); min-height: 22px; }
.pay-status.ok { color: var(--brand); font-weight: 700; }
.pay-status.err { color: var(--danger); }

/* ---------- 提示 ---------- */
#toastWrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(23, 33, 28, .92); color: #fff; padding: 9px 18px; border-radius: 999px;
  font-size: 13px; animation: toastIn .18s ease-out;
}
.toast.err { background: rgba(196, 69, 58, .95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 底部 ---------- */
.site-footer { text-align: center; color: var(--ink-3); font-size: 12px; padding: 24px 16px 40px; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .container { padding: 16px 14px 44px; }
  .header-inner { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; flex: none; }
  .brand-sub { display: none; }
  .hero { padding: 24px 18px; border-radius: 18px; }
  .hero h1 { font-size: 24px; }
  .steps, .plans { grid-template-columns: 1fr; }
  .grade-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .paper-sheet { padding: 18px 14px; }
  .history-item { flex-direction: column; align-items: flex-start; }
}

@media print {
  .site-header, .toolbar, .site-footer, #toastWrap { display: none !important; }
  body { background: #fff; }
  .container { max-width: none; padding: 0; }
  .paper-sheet { border: none; box-shadow: none; padding: 0; }
  .answer { display: none !important; }
}

/* ---------- A4 打印规范 ---------- */
@page {
  size: A4;
  margin: 18mm 16mm 20mm 16mm;
}

@media print {
  html, body { background: #fff !important; font-size: 12pt; }
  .site-header, .toolbar, .site-footer, #toastWrap, .paper-info .actions { display: none !important; }
  .container { max-width: none !important; padding: 0 !important; margin: 0 !important; }
  .paper-sheet { border: none !important; box-shadow: none !important; padding: 0 !important; border-radius: 0 !important; }
  .paper-sheet + .paper-sheet { margin-top: 0 !important; }
  .answer { display: none !important; }
  /* 题不跨页；选项整块不拆 */
  .q-item, .q-fig, .score-table, .paper-head { break-inside: avoid; page-break-inside: avoid; }
  .q-opts { break-inside: avoid; page-break-inside: avoid; }
  .paper-section h3 { break-after: avoid; page-break-after: avoid; margin-top: 14pt; }
  .q-item { margin-bottom: 8pt; }
  .q-fig svg { max-width: 55% !important; }
  .paper-head h1 { font-size: 16pt; }
  a { color: inherit; text-decoration: none; }
}
