:root {
  --ink: #1c1c1a;
  --ink-2: #5f5e5a;
  --ink-3: #8a8984;
  --line: #e7e5df;
  --line-2: #d3d1c7;
  --bg: #faf9f6;
  --card: #ffffff;
  --blue: #185fa5;
  --blue-50: #e6f1fb;
  --teal: #0f6e56;
  --teal-50: #e1f5ee;
  --amber: #854f0b;
  --amber-50: #faeeda;
  --purple: #534ab7;
  --purple-50: #eeedfe;
  --red: #a32d2d;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 28, 26, 0.04), 0 8px 24px rgba(28, 28, 26, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.65;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { max-width: 1080px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 15.5px; letter-spacing: -0.2px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 500; }
.nav-links { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.nav-link { padding: 7px 12px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2); }
.nav-link:hover { background: #f1efe8; color: var(--ink); }
.nav-link.primary { background: var(--ink); color: #fff; }
.nav-link.primary:hover { background: #333; color: #fff; }

.hero { padding: 52px 0 36px; }
.hero h1 { font-size: 34px; line-height: 1.28; margin: 0 0 14px; font-weight: 500; letter-spacing: -0.6px; }
.hero p { margin: 0; color: var(--ink-2); max-width: 620px; font-size: 15px; }
.hero-meta { display: flex; gap: 22px; margin-top: 26px; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 21px; font-weight: 500; letter-spacing: -0.3px; }
.hero-stat span { font-size: 12.5px; color: var(--ink-3); }

.section-head { display: flex; align-items: baseline; gap: 12px; margin: 44px 0 18px; }
.section-head h2 { font-size: 17px; font-weight: 500; margin: 0; letter-spacing: -0.2px; }
.section-head span { font-size: 12.5px; color: var(--ink-3); }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr !important; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }

.cover { height: 132px; position: relative; display: grid; place-items: center; }
.cover-inner {
  width: 74px; height: 96px; border-radius: 4px; background: #fff;
  border: 1px solid rgba(28,28,26,.12); box-shadow: 0 4px 14px rgba(28,28,26,.10);
  padding: 11px 9px; display: flex; flex-direction: column; gap: 4px;
}
.cover-inner .ct { font-size: 8.5px; font-weight: 500; line-height: 1.25; letter-spacing: -0.1px; }
.cover-inner .cl { height: 2px; background: #e7e5df; border-radius: 2px; }
.cover-inner .cl.s { width: 62%; }

.card-body { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-size: 14px; font-weight: 500; letter-spacing: -0.2px; line-height: 1.4; }
.card-sub { font-size: 12px; color: var(--ink-3); }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 10px; }
.price { font-size: 15px; font-weight: 500; }
.price small { font-size: 11px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }
.tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 5px; background: #f1efe8; color: var(--ink-2); margin-right: 4px; }
.badge-free { font-size: 11px; color: var(--teal); background: var(--teal-50); padding: 2px 7px; border-radius: 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink); font-size: 14px; font-weight: 500;
}
.btn:hover { background: #f7f6f2; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #333; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.note { font-size: 13px; color: var(--ink-2); background: #f7f6f2; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }

.crumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 18px; display: flex; gap: 7px; }
.crumb a:hover { color: var(--ink); }
.detail-grid { display: grid; grid-template-columns: 300px 1fr; gap: 34px; align-items: start; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr !important; gap: 22px !important; } }

.thumb { width: 84px; height: 112px; border-radius: 6px; border: 1px solid var(--line-2); background: #fff; display: grid; place-items: center; font-size: 11px; color: var(--ink-3); }
.pbar { height: 4px; border-radius: 4px; background: #e7e5df; overflow: hidden; }
.pfill { height: 100%; background: var(--ink); }

.who { font-size: 13px; color: var(--ink-2); margin-bottom: 16px; }
.lbl { font-size: 13px; font-weight: 500; display: block; margin-bottom: 8px; }
.inp { width: 100%; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); font-size: 14px; outline: none; background: #fff; }
.inp:focus { border-color: var(--ink-3); }
.inp.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; }
.row { display: flex; gap: 10px; }
.row .inp { flex: 1; }
.tiny { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.err { color: var(--red); font-size: 13px; margin-top: 8px; }
.ok { color: var(--teal); font-size: 13px; margin-top: 8px; }
.okbig { font-size: 16px; font-weight: 500; color: var(--teal); }

.footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 26px 0 44px; }
.footer-in { display: flex; gap: 20px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }

.reader-root { min-height: 100vh; background: #f2f1ec; display: flex; flex-direction: column; }
.reader-bar {
  position: sticky; top: 0; z-index: 20; height: 54px; flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: rgba(250,249,246,.94); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.rb-back { font-size: 13.5px; color: var(--ink-2); }
.rb-title { font-size: 14px; font-weight: 500; letter-spacing: -.2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-right { margin-left: auto; display: flex; gap: 6px; }
.rb-btn { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; font-size: 12.5px; color: var(--ink-2); }
.rb-btn:hover { background: #f7f6f2; color: var(--ink); }

.reader-stage { flex: 1; display: flex; align-items: flex-start; justify-content: center; gap: 18px; padding: 26px 16px 96px; }
.paper {
  width: 100%; max-width: 700px; background: #fff; border-radius: 6px;
  box-shadow: 0 2px 6px rgba(28,28,26,.06), 0 18px 40px rgba(28,28,26,.07);
  position: relative; overflow: hidden;
}
.paper.zoom { max-width: 1000px; }
.paper img { display: block; width: 100%; height: auto; }

.page-nav {
  position: sticky; top: 45vh; width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 20px; border: 1px solid var(--line-2); background: #fff;
  font-size: 20px; line-height: 1; color: var(--ink-2);
}
.page-nav:disabled { opacity: .35; }

.reader-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px; padding: 10px 18px;
  background: rgba(250,249,246,.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.rf-progress { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-3); flex: 1; }
.rf-bar { flex: 1; max-width: 300px; height: 4px; border-radius: 4px; background: #e7e5df; overflow: hidden; }
.rf-fill { height: 100%; background: var(--ink); transition: width .2s ease; }
.rf-actions { display: flex; gap: 8px; }

.note-drawer {
  position: fixed; right: 16px; bottom: 68px; z-index: 25; width: 340px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 14px 40px rgba(28,28,26,.14); padding: 14px;
}
.nd-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.note-drawer textarea {
  width: 100%; min-height: 110px; resize: vertical; border: 1px solid var(--line-2);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.6;
  font-family: inherit; outline: none;
}
.nd-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 88px; z-index: 40;
  background: rgba(28,28,26,.92); color: #fff; font-size: 13px;
  padding: 9px 16px; border-radius: 10px;
}

@media (max-width: 640px) {
  .rb-title { display: none; }
  .page-nav { width: 34px; height: 34px; top: 40vh; }
  .reader-stage { gap: 8px; padding: 14px 10px 96px; }
  .note-drawer { right: 8px; left: 8px; width: auto; }
  .rf-bar { display: none; }
}

@media print {
  .no-print { display: none !important; }
  .reader-root { background: #fff; }
  .reader-stage { padding: 0; display: block; }
  .paper { box-shadow: none; max-width: 100%; }
  @page { size: A4; margin: 12mm; }
}

/* ---------------- 互动练习页 ---------------- */
.wx-secs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.wx-sec {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 2px;
}
.wx-sec b { font-size: 13.5px; font-weight: 600; }
.wx-sec span { font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 560px) { .wx-secs { grid-template-columns: repeat(2, 1fr); } }

.wx-lock { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 14px; }
.wx-lock-t { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.wx-lock p { color: var(--ink-2); font-size: 13px; margin: 0 0 14px; }

.wx-game {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 16px; margin-bottom: 10px;
}
.wx-game-icon { font-size: 22px; flex: none; }
.wx-game-name { font-size: 14px; font-weight: 600; }
.wx-game-desc { font-size: 12.5px; color: var(--ink-2); }
.wx-soon {
  margin-left: auto; flex: none; font-size: 11px; color: var(--ink-3);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 10px;
}

/* 窄屏（手机）导航：隐藏与「输入兑换码」重复的入口，避免登录后四项挤在一起换行 */
@media (max-width: 430px) {
  .nav-inner { gap: 10px; padding: 10px 14px; }
  .nav-links { gap: 2px; }
  .nav-link { padding: 6px 8px; font-size: 12.5px; }
  .nav-link.dim { display: none; }
}

/* 窄屏（手机）导航：隐藏与「输入兑换码」重复的入口，避免登录后四项挤在一起换行 */
@media (max-width: 430px) {
  .nav-inner { gap: 10px; padding: 10px 14px; }
  .nav-links { gap: 2px; }
  .nav-link { padding: 6px 8px; font-size: 12.5px; }
  .nav-link.dim { display: none; }
}
