/* ============ 基础 ============ */
:root {
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --blue: #0F6CB7;
  --blue-deep: #0868B8;
  --blue-dark: #0A4E86;
  --green: #8CC514;
  --green-deep: #78B028;
  --ink: #1F2937;
  --ink-2: #4B5563;
  --ink-3: #9CA3AF;
  --line: #E5EAF0;
  --shadow: 0 2px 12px rgba(15, 108, 183, .08);
  --shadow-lg: 0 8px 28px rgba(15, 108, 183, .16);
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============ 防复制 ============ */
html, body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

#app { max-width: 640px; margin: 0 auto; min-height: 100vh; background: var(--bg); }

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ============ 首页 ============ */
.hero {
  background: linear-gradient(180deg, #0F6CB7 0%, #0868B8 55%, #0A4E86 100%);
  color: #fff;
  padding: 34px 20px 26px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 85% 20%, rgba(140, 197, 20, .28), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(255,255,255,.10), transparent 45%);
}
.hero-inner { position: relative; z-index: 1; }
.hero-title {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 30px; font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.hero-sub { font-size: 14px; opacity: .9; margin-bottom: 16px; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-tags span {
  font-size: 12px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25);
  padding: 4px 11px; border-radius: 999px;
}

.home-main { padding: 20px 16px 8px; }

/* 购买入口 */
.buy-card {
  background: linear-gradient(135deg, #FFF7F0, #FFF0F2);
  border: 1px solid #FFE0D0;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.buy-info { margin-bottom: 12px; }
.buy-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.buy-actions { display: flex; gap: 10px; }
.buy-btn {
  flex: 1; text-align: center;
  font-size: 14px; font-weight: 600;
  padding: 10px 0; border-radius: 999px;
  text-decoration: none; display: inline-block;
  transition: opacity .15s;
}
.buy-copy { background: #FF5000; color: #fff; }
.buy-copy:active { background: #E54500; }
.buy-copy.copied { background: var(--green-deep); }
.buy-open { background: #fff; color: #FF5000; border: 1px solid #FF5000; }

/* 微信内：隐藏打开淘宝链接，只保留复制口令 */
.wechat .buy-open { display: none; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 18px; color: var(--blue-dark); }
.section-note { font-size: 12px; color: var(--ink-3); }

.book-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.book-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  border: 1px solid var(--line);
}
.book-card.online:active { transform: scale(.97); }
.book-card.online:hover { box-shadow: var(--shadow-lg); }
.book-card.soon { opacity: .55; cursor: default; }
.book-cover {
  aspect-ratio: 3 / 4;
  background: #EDF1F5;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.book-cover .soon-ico {
  font-family: "Kaiti SC", "STKaiti", serif;
  font-size: 20px; color: #fff;
}
.book-cover.placeholder {
  background: linear-gradient(160deg, #E6EDF4, #D5DFEA);
  color: var(--ink-3);
}
.book-meta { padding: 10px 12px; }
.book-meta .book-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.book-meta .book-term { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.book-badge {
  display: inline-block; font-size: 10px;
  padding: 2px 8px; border-radius: 999px; margin-top: 6px;
}
.book-badge.on { background: #EAF4DC; color: var(--green-deep); }
.book-badge.off { background: #F0F2F5; color: var(--ink-3); }

/* ============ 顶栏 ============ */
.sub-bar {
  position: sticky; top: 0; z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
  height: 52px;
  box-shadow: 0 1px 6px rgba(15,108,183,.06);
}
.back-btn { font-size: 15px; color: var(--blue); padding: 8px 10px; justify-self: start; }
.sub-bar-title {
  font-size: 16px; font-weight: 600; color: var(--ink);
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-action { font-size: 14px; color: var(--blue); padding: 8px 12px; justify-self: end; }

/* ============ 册内页 ============ */
.book-intro {
  display: flex; gap: 14px;
  background: #fff; margin: 14px 16px;
  padding: 14px; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.book-intro-cover {
  width: 84px; aspect-ratio: 3/4; flex-shrink: 0;
  border-radius: 8px; overflow: hidden; background: #EDF1F5;
}
.book-intro-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.book-intro-text h2 { font-size: 19px; color: var(--blue-dark); margin-bottom: 4px; }
.book-intro-text p { font-size: 13px; color: var(--ink-2); }
.stage-note {
  font-size: 11px; color: var(--ink-3); margin-top: 8px;
  background: #F4F8FC; padding: 6px 9px; border-radius: 8px; line-height: 1.6;
}

.book-main { padding: 0 16px 8px; }
.session-list { display: flex; flex-direction: column; gap: 10px; }
.session-card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 13px 14px; cursor: pointer;
  transition: transform .12s ease;
}
.session-card:active { transform: scale(.98); }
.session-top { display: flex; align-items: center; gap: 10px; }
.session-no {
  flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(160deg, var(--blue), var(--blue-deep));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.session-head { flex: 1; min-width: 0; }
.session-head .progress { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.session-stage { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.session-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.session-items .item {
  font-size: 12px; color: var(--blue-dark);
  background: #EEF5FB; border: 1px solid #D6E8F6;
  padding: 3px 10px; border-radius: 999px;
}

/* ============ 答案页 ============ */
.answer-progress {
  margin: 14px 16px 0; padding: 11px 14px;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.answer-progress b { color: var(--blue-dark); }

.answer-main { padding: 14px 16px 90px; }
.answer-block { margin-bottom: 22px; }
.answer-block-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.answer-block-head .idx {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--green-deep); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.answer-block-head .name { font-size: 15px; font-weight: 600; color: var(--ink); }
.answer-page {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  overflow: hidden;
}
.answer-page img {
  width: 100%; display: block; cursor: zoom-in;
  background: #fafafa;
}
.answer-page .page-note {
  font-size: 11px; color: var(--ink-3);
  text-align: center; padding: 8px;
  border-top: 1px solid var(--line); background: #FBFCFE;
}

/* 底部导航 */
.answer-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px; z-index: 20;
  display: flex; gap: 10px;
  background: #fff; border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(15,108,183,.08);
}
.answer-nav button {
  flex: 1; padding: 11px 0; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  background: #EEF5FB; color: var(--blue-dark);
  transition: background .12s;
}
.answer-nav button:active { background: #DCEBFA; }
.answer-nav button.primary { background: var(--blue); color: #fff; }
.answer-nav button:disabled { opacity: .4; cursor: default; }

/* ============ 大图 ============ */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-mask { position: absolute; inset: 0; background: rgba(10, 20, 30, .92); }
.lightbox img {
  position: relative; z-index: 1;
  max-width: 94vw; max-height: 92vh;
  border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.lightbox-close {
  position: absolute; top: 18px; right: 18px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff;
  font-size: 20px;
}
.lightbox-caption {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 2; color: rgba(255,255,255,.9); font-size: 13px;
  background: rgba(0,0,0,.4); padding: 5px 14px; border-radius: 999px;
}

/* ============ 页脚 ============ */
.foot {
  text-align: center; font-size: 11px; color: var(--ink-3);
  padding: 24px 16px 30px;
}
.foot-logo-link {
  display: inline-block;
  line-height: 0;
  margin-bottom: 10px;
  transition: opacity .15s;
}
.foot-logo-link:hover { opacity: .7; }
.foot-logo { height: 26px; width: auto; display: block; opacity: .85; }
.foot-copy { font-size: 11px; color: var(--ink-3); }

/* ============ 响应式 ============ */
@media (min-width: 640px) {
  #app { box-shadow: 0 0 30px rgba(15,108,183,.10); }
}
