/* ============================================
   考研工作台 · 手账风 + 抹茶绿
   ============================================ */

:root {
  /* 手账风配色 · oklch 组织和谐色阶 */
  --bg: oklch(0.965 0.012 95);            /* 奶油纸底 */
  --card: oklch(1 0 0);
  --ink: oklch(0.32 0.02 70);             /* 深棕文字 */
  --ink-soft: oklch(0.55 0.02 75);
  --main: oklch(0.62 0.10 130);           /* 抹茶绿 */
  --main-deep: oklch(0.50 0.11 135);
  --main-soft: oklch(0.93 0.04 130);
  --main-faint: oklch(0.965 0.02 130);
  --accent: oklch(0.74 0.10 55);          /* 暖橙点缀 */
  --accent-soft: oklch(0.94 0.03 60);
  --line: oklch(0.93 0.015 90);
  --radius: 20px;
  --shadow: 0 8px 28px oklch(0.4 0.02 80 / 0.08);
  --font-display: 'STKaiti', 'Kaiti SC', 'KaiTi', 'Yuanti SC', serif;
  --font-body: 'Yuanti SC', 'MiSans', 'HarmonyOS Sans', 'PingFang SC', 'Noto Sans SC', sans-serif;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

/* 手写体用于标题/问候/金句 */
.greeting, .page-title, .ring-num, .quote-card .q-text,
.chapter-item .ci-name, .section-item .si-name, .q-card .qc-q,
.feedback, .sheet h3 {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

/* 纸张纹理 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: radial-gradient(#c9c2b2 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  z-index: 0;
}

/* ---------- 页面容器 ---------- */
.page {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  z-index: 1;
}
.page.active { display: flex; }

.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 120px;
}

/* ---------- 底部 Tab ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 64px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1;
  text-align: center;
  padding: 9px 0 7px;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}
.tab-item svg {
  display: block;
  margin: 0 auto 3px;
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab-item.active { color: var(--main-deep); font-weight: 600; }
.tab-item.active svg { stroke-width: 2; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid var(--line);
}

.btn-capsule {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 100px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}
.btn-capsule:active { transform: scale(0.96); }
.btn-main {
  background: var(--main);
  color: #fff;
  box-shadow: 0 8px 20px rgba(123, 160, 91, 0.35);
}
.btn-ghost {
  background: transparent;
  color: var(--main-deep);
  border: 1.5px solid var(--main);
}

/* 问候语 */
.greeting {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 8px 0 4px;
}
.greeting small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-soft);
  margin-top: 6px;
}

/* ---------- 首页 ---------- */
.home-top {
  text-align: center;
  padding-top: 16px;
}

/* 进度环 */
.ring-wrap {
  position: relative;
  width: 190px;
  height: 190px;
  margin: 28px auto 12px;
}
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--main-soft); stroke-width: 10; }
.ring-fg {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-num { font-size: 52px; font-weight: 800; color: var(--ink); line-height: 1; }
.ring-label { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }

.home-date { text-align: center; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }

/* 金句 · 手写便签（120%细节） */
.quote-card {
  background: var(--card);
  border: 1px solid var(--line);
  text-align: center;
  padding: 30px 26px 20px;
  margin: 24px 0 20px;
  position: relative;
  transform: rotate(-0.8deg);
}
.quote-card::before {
  content: '';
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 86px;
  height: 20px;
  background: oklch(0.88 0.05 90 / 0.65);
  box-shadow: 0 1px 3px oklch(0.5 0.03 80 / 0.15);
}
.quote-card .q-mark {
  font-size: 30px;
  color: var(--main);
  font-family: var(--font-display);
  line-height: 0.4;
  display: block;
  margin-bottom: 14px;
}
.quote-card .q-text {
  font-size: 18px;
  color: var(--ink);
  line-height: 1.8;
  text-wrap: pretty;
  text-align: center;
}
.quote-card .q-date {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 12px;
  font-family: var(--font-body);
}

/* 背书统计胶囊 */
.study-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 12px 12px 12px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.study-pill .sp-info { font-size: 14px; }
.study-pill .sp-info b { font-size: 20px; color: var(--main-deep); }
.study-pill .sp-btn {
  background: var(--main);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

/* ---------- 背书首页 ---------- */
.study-home {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 8vh;
  gap: 0;
}
.study-home .greeting { font-size: 26px; margin-bottom: 56px; line-height: 1.4; }
.study-home .start-btn { margin-top: 0; font-size: 18px; padding: 18px 52px; }
.btn-due {
  display: block;
  margin: 0 auto 24px;
  padding: 16px 40px;
  background: var(--main);
  color: #fff;
  box-shadow: 0 8px 20px rgba(123,160,91,0.35);
  font-size: 16px;
  font-weight: 600;
  border-radius: 100px;
  border: none;
  font-family: inherit;
  cursor: pointer;
  position: relative;
}
.due-num {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #fff;
  color: var(--main-deep);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}
.chapter-link {
  display: block;
  margin: 20px auto 0;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.home-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 40px auto;
  width: 50%;
}
/* 错题本按钮 + 红点角标 */
.btn-fuzzy {
  display: block;
  margin: 0 auto 24px;
  padding: 10px 20px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 100px;
  font-size: 13px;
  font-family: inherit;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.fuzzy-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #E25555;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  border-radius: 9px;
  text-align: center;
  display: none;
}
.fuzzy-badge.show { display: block; }

/* ---------- 复习页 ---------- */
.review-header {
  padding: 20px 20px 12px;
  text-align: center;
}
.review-header .ch-name { font-size: 12px; color: var(--main-deep); font-weight: 600; margin-bottom: 4px; }
.review-header .greeting { font-size: 20px; margin: 0; }
.review-header .sec-name { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }

/* 问题卡片 */
.flip-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
}
.q-card {
  width: 100%;
  max-width: 340px;
  min-height: 300px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 28px;
  position: relative;
}
.q-card .qc-label { font-size: 11px; color: var(--ink-soft); letter-spacing: 2px; margin-bottom: 14px; }
.q-card .qc-q { font-size: 19px; font-weight: 600; line-height: 1.7; color: var(--ink); }
.q-card .qc-a {
  display: none;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  font-size: 15px;
  line-height: 1.8;
  color: var(--main-deep);
}
.q-card.show-ans .qc-a { display: block; }
.q-card .qc-src { margin-top: 16px; font-size: 10px; color: #B9B2A4; }

/* 自评反馈语 */
.feedback {
  font-size: 15px;
  font-weight: 600;
  color: var(--main-deep);
  min-height: 24px;
  margin-top: 10px;
  text-align: center;
}

/* 自测弹层内的反馈语 */
.mask .feedback {
  font-size: 21px;
  font-weight: 700;
  color: var(--main-deep);
  text-align: center;
  min-height: 32px;
  margin-top: 16px;
}

/* 自评按钮区 */
.self-check {
  padding: 16px 20px 20px;
  display: flex;
  gap: 12px;
  justify-content: center;
}
.check-btn {
  flex: 1;
  min-width: 90px;
  padding: 14px 0;
  border-radius: 16px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s;
}
.check-btn:active { transform: scale(0.94); }
.btn-known { background: var(--main); color: #fff; }
.btn-fuzzy { background: var(--accent-soft); color: #B06B3C; }
.btn-forgot { background: #F1E6E0; color: #A06958; }

/* 进度条 */
.progress-wrap {
  padding: 14px 20px 22px;
  text-align: center;
  width: 100%;
}
.progress-wrap .pw-label { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }
.progress-track {
  height: 8px;
  background: var(--main-soft);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--main), var(--main-deep));
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 背书首页总进度 */
.round-progress {
  width: 100%;
  margin-top: 24px;
  text-align: center;
}
.round-progress .rp-text {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.round-progress .rp-text span {
  color: var(--main-deep);
  font-weight: 700;
}

/* 收藏星标按钮 */
.star-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.2s;
  line-height: 1;
  padding: 4px;
}
.star-btn:active { transform: scale(1.2); }
.star-btn.favorited { color: #F5A623; }

/* 开始复习弹层 */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(74, 66, 56, 0.4);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.mask.show { display: flex; }
.sheet {
  background: var(--card);
  border-radius: 24px;
  width: 100%;
  max-width: 320px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.sheet h3 { font-size: 17px; margin-bottom: 20px; }
.sheet .sheet-btn {
  display: block;
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 10px;
  color: var(--ink);
}
.sheet .sheet-btn.primary { background: var(--main); color: #fff; border: none; }
.sheet .sheet-cancel { background: none; border: none; color: var(--ink-soft); font-size: 13px; margin-top: 6px; cursor: pointer; }

/* ---------- 章节目录 ---------- */
.chapter-list { display: flex; flex-direction: column; gap: 14px; }
.chapter-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.chapter-item:active { transform: scale(0.98); }
.chapter-item .ci-name { font-size: 16px; font-weight: 600; }
.chapter-item .ci-desc { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.chapter-item .ci-count { font-size: 12px; color: var(--main-deep); font-weight: 600; }
.chapter-item .ci-arrow { font-size: 18px; color: var(--main); }

/* 小节列表 */
.section-list { display: flex; flex-direction: column; gap: 12px; }
.section-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.section-item:active { transform: scale(0.98); }
.section-item .si-name { font-size: 15px; font-weight: 600; }
.section-item .si-count { font-size: 12px; color: var(--ink-soft); }

/* ---------- 院校页 ---------- */
.school-card { margin-bottom: 16px; }
.school-card h3 { font-size: 15px; color: var(--main-deep); margin-bottom: 10px; }
.school-card .row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.school-card .row:last-child { border: none; }
.school-card .row .rk { color: var(--ink-soft); }
.school-card .row .rv { font-weight: 500; text-align: right; max-width: 60%; }
.school-card ul { list-style: none; }
.school-card li { font-size: 13px; line-height: 1.8; padding-left: 14px; position: relative; color: var(--ink); }
.school-card li::before { content: ''; position: absolute; left: 0; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--main); }
.school-card a {
  color: var(--main-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--main);
  padding-bottom: 1px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.back-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--main-deep);
  cursor: pointer;
  padding: 4px 8px 4px 0;
}

.empty-tip { text-align: center; color: var(--ink-soft); font-size: 14px; padding: 40px 0; }

/* 通读模式 */
.read-intro {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
  text-align: center;
  line-height: 1.7;
}
.read-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.read-item .ri-q {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
  line-height: 1.6;
}
.read-item .ri-a {
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink);
  text-wrap: pretty;
}
.read-item .ri-src {
  font-size: 10px;
  color: #B9B2A4;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.read-footer {
  text-align: center;
  padding: 12px 0 8px;
}
