/* ═══════════════════════════════════════════════════════════
   初心知道 · 高保真原型设计系统 v2
   风格：温暖疗愈 · 克制精致
   主色：鼠尾草绿 / 米白 / 浅杏金
   设计参考：得到 · 壹心理 · 知乎
   ═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────
   1. Design Tokens
   ───────────────────────────────────────── */
:root {
  /* ── Typography ──
     小程序开发友好基线：
     基于原版向上一律 +2px，确保手机端阅读体验足够饱满 */
  --ff-base:
    "PingFang SC", "SF Pro Text", -apple-system, BlinkMacSystemFont,
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --ff-display:
    "SF Pro Display", "PingFang SC", -apple-system, BlinkMacSystemFont,
    "Noto Sans SC", sans-serif;
  --ff-number:
    "DIN Alternate", "SF Pro Display", "Helvetica Neue", "Segoe UI", sans-serif;

  --fs-2xs: 12px;
  --fs-xs: 13px;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-lg: 17px;
  --fs-xl: 19px;
  --fs-2xl: 22px;
  --fs-3xl: 26px;
  --fs-4xl: 30px;
  --fs-caption: 14px;
  --fs-body: 16px;
  --fs-body-lg: 17px;
  --fs-title: 18px;
  --fs-section-title: 20px;
  --fs-page-title: 22px;

  --lh-tight: 1.25;
  --lh-snug: 1.35;
  --lh-normal: 1.5;
  --lh-relaxed: 1.7;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-heavy: 800;

  --ls-tight: -0.02em;
  --ls-normal: 0;
  --ls-wide: 0.02em;

  /* ── Brand Palette (Healing Sage) ── */
  --brand-25: #f8fcf9;
  --brand-50: #f1f8f3;
  --brand-100: #ddefe3;
  --brand-200: #c5dfce;
  --brand-300: #a3c9b0;
  --brand-400: #7db38f;
  --brand-500: #5f9f74;
  --brand-600: #4c8761;
  --brand-700: #3d6d4f;
  --brand-800: #305640;
  --brand-900: #244133;

  --brand-gradient-subtle: linear-gradient(
    135deg,
    rgba(139, 190, 152, 0.1) 0%,
    rgba(95, 159, 116, 0.06) 100%
  );
  --brand-glow: 0 0 0 3px rgba(95, 159, 116, 0.14);

  /* ── Accent Palette (Soft Apricot Gold) ── */
  --accent-25: #fffdf9;
  --accent-50: #fff9f1;
  --accent-100: #f8ead8;
  --accent-200: #efd4b4;
  --accent-300: #e3be91;
  --accent-500: #cda06a;
  --accent-600: #b78654;

  /* ── Semantic: Success ── */
  --success-50: #f1fbf5;
  --success-100: #d9f3e2;
  --success-500: #53a875;
  --success-600: #3f8c5f;
  --success-700: #326e4b;

  /* ── Semantic: Warning ── */
  --warning-50: #fff8ec;
  --warning-100: #ffefd0;
  --warning-500: #f0a830;
  --warning-600: #d48e18;

  /* ── Semantic: Danger ── */
  --danger-50: #fff2f3;
  --danger-100: #ffe0e3;
  --danger-500: #ee3a3a;
  --danger-600: #d02f2f;

  /* ── Neutral / Text ── */
  --text-primary: #26352d;
  --text-secondary: #627068;
  --text-tertiary: #8a978f;
  --text-quaternary: #b2bcb5;
  --text-inverse: #ffffff;

  /* ── Backgrounds ── */
  --bg-page: #f7f8f7;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f6faf7;
  --bg-surface-soft: #f2f5f3;
  --bg-surface-muted: #ebf0ed;
  --bg-mask: rgba(38, 53, 45, 0.45);
  --bg-disabled: #eef1ef;

  /* ── Borders ── */
  --border-lightest: #f0f3f1;
  --border-light: #e8ece9;
  --border-base: #d7ddd9;
  --border-strong: #c2cbc5;
  --border-focus: rgba(95, 159, 116, 0.35);

  /* ── Shadows (green-toned, subtle) ── */
  --shadow-xs: 0 1px 2px rgba(38, 53, 45, 0.04);
  --shadow-sm: 0 1px 4px rgba(38, 53, 45, 0.06);
  --shadow-card:
    0 1px 3px rgba(38, 53, 45, 0.06), 0 1px 2px rgba(38, 53, 45, 0.04);
  --shadow-md:
    0 4px 12px rgba(38, 53, 45, 0.07), 0 1px 3px rgba(38, 53, 45, 0.04);
  --shadow-lg:
    0 8px 24px rgba(38, 53, 45, 0.08), 0 2px 6px rgba(38, 53, 45, 0.04);
  --shadow-floating:
    0 12px 32px rgba(38, 53, 45, 0.1), 0 4px 10px rgba(38, 53, 45, 0.05);
  --shadow-modal:
    0 20px 48px rgba(38, 53, 45, 0.16), 0 6px 16px rgba(38, 53, 45, 0.08);
  --shadow-btn: 0 2px 8px rgba(95, 159, 116, 0.18);
  --shadow-btn-accent: 0 2px 8px rgba(205, 160, 106, 0.2);
  --shadow-up: 0 -1px 6px rgba(38, 53, 45, 0.04);

  /* ── Radii (refined, small) ── */
  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 10px;
  --r-2xl: 12px;
  --r-pill: 999px;

  /* ── Spacing (4px grid)
     小程序页面优先使用 4 / 8 / 12 / 16 / 20 / 24，不随意写 13px / 18px 这类魔法数字。 */
  --sp-0: 0;
  --sp-px: 1px;
  --sp-0h: 2px;
  --sp-1: 4px;
  --sp-1h: 6px;
  --sp-2: 8px;
  --sp-2h: 10px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --space-compact: 8px;
  --space-tight: 12px;
  --space-base: 16px;
  --space-section: 20px;
  --space-loose: 24px;

  /* ── Layout ── */
  --mobile-min: 320px;
  --mobile-max: 430px;
  --page-px: 16px;
  --section-gap: 24px;
  --card-px: 14px;
  --card-py: 12px;
  --nav-h: 56px;
  --header-h: 48px;
  --fab-size: 50px;
  --banner-h: 164px;
  --nav-icon: 44px;
  --search-h: 36px;
  --chip-h: 32px;
  --tab-h: 36px;
  --touch-target-min: 40px;
  --list-row-min-h: 44px;
  --top-gap-tight: 4px;
  --top-gap-base: 8px;
  --section-gap-compact: 16px;

  /* ── Icon Scale
     图标优先使用以下档位，方便 HTML 原型直接映射到小程序： */
  --icon-xs: 16px;
  --icon-sm: 18px;
  --icon-md: 20px;
  --icon-lg: 24px;
  --icon-xl: 28px;
  --icon-2xl: 32px;

  --avatar-xs: 20px;
  --avatar-sm: 28px;
  --avatar-md: 36px;
  --avatar-lg: 48px;
  --avatar-xl: 64px;

  /* ── Z-Index ── */
  --z-base: 1;
  --z-sticky: 10;
  --z-dropdown: 30;
  --z-modal: 100;
  --z-toast: 120;

  /* ── Motion ── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  --dur-instant: 100ms;
  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 320ms;
}

/* ─────────────────────────────────────────
   2. Reset & Base
   ───────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: var(--mobile-min);
  background: #eceeed;
  color: var(--text-primary);
  font-family: var(--ff-base);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  letter-spacing: var(--ls-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

::selection {
  background: rgba(95, 159, 116, 0.16);
  color: var(--brand-700);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
  border: 0;
  background: transparent;
  outline: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ─────────────────────────────────────────
   3. App Shell & Layout
   ───────────────────────────────────────── */
.app-shell {
  width: 100%;
  max-width: var(--mobile-max);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-page);
  position: relative;
}

.page {
  padding-bottom: calc(var(--nav-h) + 24px);
}

.page-section {
  padding: 0 var(--page-px);
  margin-top: var(--section-gap);
}

.page-section:first-child {
  margin-top: var(--sp-2);
}

/* ─────────────────────────────────────────
   4. Topbar
   ───────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 var(--page-px);
  background: rgba(247, 248, 247, 0.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.topbar__logo {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--icon-md);
}

.topbar__brand-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.topbar__title {
  font-family: var(--ff-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
  line-height: 1.1;
  color: var(--text-primary);
}

.topbar__slogan {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
  line-height: 1.1;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1h);
}

.topbar__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-lightest);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.topbar__action:active {
  background: var(--bg-surface-soft);
  transform: scale(0.94);
}

/* ─────────────────────────────────────────
   5. Banner
   ───────────────────────────────────────── */
.banner {
  position: relative;
  height: var(--banner-h);
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--brand-100);
}

.banner__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--sp-4) var(--sp-5) var(--sp-4);
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(38, 53, 45, 0.04) 40%,
    rgba(38, 53, 45, 0.52) 100%
  );
  color: var(--text-inverse);
}

.banner__title {
  font-family: var(--ff-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.banner__desc {
  margin-top: var(--sp-1);
  font-size: var(--fs-sm);
  opacity: 0.88;
}

.dots {
  display: flex;
  gap: 5px;
  margin-top: var(--sp-3);
}

.dots__item {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition:
    width var(--dur-base) var(--ease-out),
    background var(--dur-base) var(--ease-out),
    border-radius var(--dur-base) var(--ease-out);
}

.dots__item.is-active {
  width: 16px;
  border-radius: var(--r-pill);
  background: #fff;
}

/* ─────────────────────────────────────────
   6. Cards
   ───────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  transition: transform var(--dur-fast) var(--ease-out);
}

.card:active {
  transform: scale(0.985);
}

.card--bordered {
  border: 1px solid var(--border-lightest);
}

.card--shadow {
  box-shadow: var(--shadow-card);
}

.card--padded {
  padding: var(--card-px);
}

.card--flat {
  border: none;
  box-shadow: none;
  background: var(--bg-surface-soft);
}

/* ─────────────────────────────────────────
   7. Section Head
   ───────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.section-head__title {
  font-family: var(--ff-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
}

.section-head__meta {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
  transition: color var(--dur-fast) var(--ease-out);
}

.section-head__meta:active {
  color: var(--brand-500);
}

/* ─────────────────────────────────────────
   9. Tabs
   ───────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--sp-1h);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* 允许滚动溢出，避免最右侧内容贴边被截断 */
  margin: 0 calc(var(--page-px) * -1);
  padding: 0 var(--page-px);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  padding: 6px 16px;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  user-select: none;
  position: relative;
  z-index: 1;
}

.tab:active {
  transform: scale(0.96);
}

.tab.is-active {
  color: var(--text-primary);
  font-weight: var(--fw-bold);
  font-size: var(--fs-base);
  background: transparent;
}

.tab.is-active::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at center,
    rgba(144, 245, 230, 0.5) 0%,
    rgba(144, 245, 230, 0) 70%
  );
  z-index: -1;
  pointer-events: none;
}

.tab.is-active::after {
  content: "";
  position: absolute;
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 6px;
  border-radius: 50%;
  border-bottom: 3px solid var(--brand-500);
}

.tab-panel {
  display: none;
}
.tab-panel.is-active {
  display: block;
}

/* ─────────────────────────────────────────
   10. Tags / Badges
   ───────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  white-space: nowrap;
  line-height: 1;
}

.tag--brand {
  background: var(--brand-50);
  color: var(--brand-600);
}
.tag--warning {
  background: var(--warning-50);
  color: var(--warning-600);
}
.tag--success {
  background: var(--success-50);
  color: var(--success-600);
}
.tag--danger {
  background: var(--danger-50);
  color: var(--danger-600);
}
.tag--accent {
  background: var(--accent-50);
  color: var(--accent-600);
}
.tag--live {
  background: var(--danger-500);
  color: #fff;
  animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.78;
  }
}

/* ─────────────────────────────────────────
   11. List
   ───────────────────────────────────────── */
.list {
  display: flex;
  flex-direction: column;
}

.list--gap {
  gap: var(--sp-3);
}

.list--divided > * + * {
  border-top: 1px solid var(--border-lightest);
}

/* ─────────────────────────────────────────
   12. Avatar
   ───────────────────────────────────────── */
.avatar {
  width: var(--avatar-md);
  height: var(--avatar-md);
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-100);
  flex: 0 0 auto;
}

.avatar--xs {
  width: var(--avatar-xs);
  height: var(--avatar-xs);
}
.avatar--sm {
  width: var(--avatar-sm);
  height: var(--avatar-sm);
}
.avatar--lg {
  width: var(--avatar-lg);
  height: var(--avatar-lg);
}
.avatar--xl {
  width: var(--avatar-xl);
  height: var(--avatar-xl);
}

.avatar--bordered {
  border: 2px solid var(--bg-surface);
  box-shadow: var(--shadow-xs);
}

/* ─────────────────────────────────────────
   13. QA Card
   ───────────────────────────────────────── */
.qa-card {
  padding: var(--card-px) var(--card-px) var(--card-py);
}

.qa-card__header {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: var(--sp-2);
}

.qa-card__badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: var(--fw-bold);
  margin-top: 1px;
}

.qa-card__badge--ask {
  background: var(--brand-50);
  color: var(--brand-600);
}

.qa-card__badge--reward {
  background: transparent;
  color: #ff6b22;
  font-size: 24px;
}

.qa-card__title {
  flex: 1;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--text-primary);
}

.qa-card__user {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.qa-card__user-name {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.qa-card__user-tag {
  font-size: 11px;
  color: var(--text-tertiary);
}

.qa-card__content {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qa-card__tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: var(--fw-medium);
  margin-right: 4px;
  vertical-align: top;
}

.qa-card__tag--essence {
  background: var(--brand-50);
  color: var(--brand-600);
}

.qa-card__tag--desc {
  background: transparent;
  color: var(--brand-600);
  border: 1px solid var(--brand-200);
}

.qa-card__more {
  color: var(--brand-600);
}

.qa-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-lightest);
}

.qa-card__stats {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.qa-card__link {
  font-size: var(--fs-xs);
  color: var(--brand-600);
  display: flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
}

.meta-group {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-4);
  color: var(--text-tertiary);
  font-size: var(--fs-xs);
}

.meta-group__item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meta-group__item iconify-icon {
  font-size: 16px !important;
  color: var(--text-quaternary);
}

/* ─────────────────────────────────────────
   14. Course Mini Card (2-col Grid)
   ───────────────────────────────────────── */
.course-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2h);
}

.course-mini {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-surface);
}

.course-mini:active {
  transform: scale(0.97);
}

.course-mini__cover-wrap {
  position: relative;
  overflow: hidden;
}

.course-mini__cover {
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: var(--brand-100);
  display: block;
}

.course-mini__tag {
  position: absolute;
  top: 6px;
  left: 6px;
}

.course-mini__body {
  padding: var(--sp-2h) var(--sp-3) var(--sp-3);
}

.course-mini__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-mini__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--sp-1h);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.course-mini__price {
  margin-top: var(--sp-1h);
  font-family: var(--ff-number);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--danger-500);
}

.course-mini__price--free {
  color: var(--brand-500);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.course-mini__price--bought {
  color: var(--success-600);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

/* ─────────────────────────────────────────
   15. Course List Card
   ───────────────────────────────────────── */
.course-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--card-py) var(--card-px);
}

.course-card__cover {
  width: 112px;
  height: 84px;
  border-radius: var(--r-md);
  object-fit: cover;
  background: var(--brand-100);
  flex: 0 0 auto;
}

.course-card__body {
  flex: 1;
  min-width: 0;
}

.course-card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-card__desc {
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-card__info {
  display: flex;
  align-items: center;
  gap: var(--sp-1h);
  margin-top: var(--sp-1h);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  flex-wrap: wrap;
}

.course-card__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-2);
}

.stars {
  letter-spacing: 1px;
  color: var(--warning-500);
  font-size: var(--fs-sm);
}

.price {
  font-family: var(--ff-number);
  color: var(--danger-500);
  font-weight: var(--fw-bold);
  font-size: var(--fs-xl);
}

.price--sm {
  font-size: var(--fs-lg);
}
.price--free {
  color: var(--brand-500);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.price--bought {
  color: var(--success-600);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

/* ─────────────────────────────────────────
   16. Article Card
   ───────────────────────────────────────── */
.article-card {
  padding: var(--card-py) var(--card-px);
}

.article-card--horizontal {
  display: flex;
  gap: var(--sp-3);
}

.article-card__cover {
  width: 100%;
  height: 148px;
  margin-bottom: var(--sp-3);
  border-radius: var(--r-md);
  object-fit: cover;
  background: var(--brand-100);
}

.article-card__cover--sm {
  width: 96px;
  height: 72px;
  margin-bottom: 0;
  flex: 0 0 auto;
  border-radius: var(--r-md);
}

.article-card__body {
  flex: 1;
  min-width: 0;
}

.article-card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card__desc {
  margin-top: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card__meta {
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ─────────────────────────────────────────
   17. Buttons
   ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  min-width: 72px;
  height: 38px;
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-lg);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  user-select: none;
  transition:
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.btn:active {
  transform: scale(0.96);
  opacity: 0.88;
}

.btn--primary {
  background: var(--brand-500);
  color: var(--text-inverse);
}

.btn--primary:hover {
  opacity: 0.92;
}

.btn--secondary {
  background: var(--brand-50);
  color: var(--brand-600);
}

.btn--secondary:hover {
  background: var(--brand-100);
}

.btn--accent {
  background: var(--accent-500);
  color: var(--text-inverse);
}

.btn--outline {
  background: transparent;
  color: var(--brand-600);
  border: 1px solid var(--brand-200);
}

.btn--outline:hover {
  background: var(--brand-25);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn--ghost:hover {
  background: var(--bg-surface-soft);
}

.btn--sm {
  height: 30px;
  min-width: 52px;
  font-size: var(--fs-sm);
  padding: 0 var(--sp-3);
  border-radius: var(--r-md);
}

.btn--block {
  width: 100%;
}

.btn--lg {
  height: 44px;
  font-size: var(--fs-lg);
  padding: 0 var(--sp-6);
}

/* ─────────────────────────────────────────
   18. Bottom Navigation
   ───────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--mobile-max);
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border-lightest);
  z-index: var(--z-sticky);
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-tertiary);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  text-decoration: none;
  position: relative;
  transition: color var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav__item.is-active {
  color: var(--brand-600);
  font-weight: var(--fw-semibold);
}

.bottom-nav__badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  background: var(--danger-500);
  color: #fff;
  font-size: 9px;
  font-weight: var(--fw-bold);
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
}

/* ─────────────────────────────────────────
   19. Search Bar
   ───────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 36px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-tertiary);
  font-size: var(--fs-sm);
  transition: border-color var(--dur-base) var(--ease-out);
}

.search-bar:focus-within {
  border-color: var(--brand-300);
}

.search-bar__input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--fs-sm);
}

.search-bar__input::placeholder {
  color: var(--text-quaternary);
}

/* ─────────────────────────────────────────
   20. Filter Chips
   ───────────────────────────────────────── */
.filter-row {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  /* 允许滚动溢出，避免最右侧内容贴边被截断 */
  margin: 0 calc(var(--page-px) * -1);
  padding: 0 var(--page-px) 2px;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  user-select: none;
  transition: all var(--dur-fast) var(--ease-out);
}

.filter-chip:active {
  transform: scale(0.96);
}

.filter-chip.is-active {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-600);
  font-weight: var(--fw-semibold);
}

/* ─────────────────────────────────────────
   21. Sort Row
   ───────────────────────────────────────── */
.sort-row {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-1) 0;
  font-size: var(--fs-lg); /* 调大到15px */
  color: var(--text-tertiary);
  overflow-x: auto; /* 增加横向滚动 */
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.sort-row::-webkit-scrollbar {
  display: none;
}

.sort-row__item {
  flex: 0 0 auto; /* 防止被压缩 */
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
  position: relative;
  padding-bottom: 4px;
}

.sort-row__item.is-active {
  color: var(--brand-600);
  font-weight: var(--fw-semibold);
}

.sort-row__item.is-active::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 0;
  height: 2px;
  border-radius: var(--r-pill);
  background: var(--brand-500);
}

/* ─────────────────────────────────────────
   22. Modal
   ───────────────────────────────────────── */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--bg-mask);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--dur-base) var(--ease-out),
    visibility var(--dur-base) var(--ease-out);
}

.modal-mask.is-visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  z-index: calc(var(--z-modal) + 1);
  width: calc(100% - 56px);
  max-width: 340px;
  background: var(--bg-surface);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-modal);
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--dur-base) var(--ease-out),
    visibility var(--dur-base) var(--ease-out),
    transform var(--dur-slow) var(--ease-spring);
}

.modal.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-surface-muted);
  color: var(--text-tertiary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease-out);
  z-index: 2;
  border: none;
  outline: none;
}

.modal__close:hover {
  background: var(--border-light);
}

.modal__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--brand-500);
}

.modal__title {
  font-family: var(--ff-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
}

.modal__desc {
  margin-top: var(--sp-2);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}

.modal__actions {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

.modal__actions .btn {
  flex: 1;
}

/* ─────────────────────────────────────────
   23. FAB
   ───────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 18px);
  right: calc(50% - var(--mobile-max) / 2 + 18px);
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: var(--r-2xl);
  background: var(--brand-500);
  color: var(--text-inverse);
  border: none;
  box-shadow: var(--shadow-lg);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-sticky);
  transition:
    transform var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out);
}

.fab:active {
  transform: scale(0.9);
  opacity: 0.88;
}

@media (max-width: 430px) {
  .fab {
    right: 18px;
  }
}

/* ─────────────────────────────────────────
   24. Profile Header
   ───────────────────────────────────────── */
.profile-header {
  padding: 36px var(--page-px) var(--sp-5);
  background: linear-gradient(180deg, var(--brand-50) 0%, var(--bg-page) 100%);
}

.profile-top {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  object-fit: cover;
  background: var(--brand-100);
  flex: 0 0 auto;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-family: var(--ff-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
}

.profile-phone {
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-wide);
}

/* ─────────────────────────────────────────
   25. Stats Row
   ───────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: var(--sp-4) 0;
}

.stat-item {
  text-align: center;
  position: relative;
}

.stat-item + .stat-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 1px;
  background: var(--border-lightest);
}

.stat-item__value {
  font-family: var(--ff-number);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  letter-spacing: var(--ls-tight);
}

.stat-item__label {
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  font-weight: var(--fw-medium);
}

/* ─────────────────────────────────────────
   26. Menu Group
   ───────────────────────────────────────── */
.menu-group {
  margin-top: var(--section-gap);
}

.menu-group__title {
  padding: 0 var(--page-px);
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  font-weight: var(--fw-medium);
}

.menu-list {
  margin: 0 var(--page-px);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-surface);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}

.menu-item + .menu-item {
  border-top: 1px solid var(--border-lightest);
}
.menu-item:active {
  background: var(--bg-surface-soft);
}

.menu-item__icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex: 0 0 auto;
}

.menu-item__icon--brand {
  color: var(--brand-500);
}
.menu-item__icon--accent {
  color: var(--accent-500);
}
.menu-item__icon--success {
  color: var(--success-500);
}
.menu-item__icon--warning {
  color: var(--warning-500);
}

.menu-item__label {
  flex: 1;
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
}

.menu-item__extra {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
}

.menu-item__arrow {
  color: var(--text-quaternary);
  font-size: var(--fs-sm);
}

.menu-item__badge {
  background: var(--danger-500);
  color: #fff;
  font-size: 9px;
  font-weight: var(--fw-bold);
  padding: 1px 5px;
  border-radius: var(--r-pill);
  min-width: 16px;
  text-align: center;
  line-height: 1.3;
}

/* ─────────────────────────────────────────
   27. Learning Card
   ───────────────────────────────────────── */
.learning-card {
  display: flex;
  gap: var(--sp-3);
  padding: var(--card-py) var(--card-px);
}

.learning-card__cover {
  width: 84px;
  height: 64px;
  border-radius: var(--r-md);
  object-fit: cover;
  background: var(--brand-100);
  flex: 0 0 auto;
}

.learning-card__body {
  flex: 1;
  min-width: 0;
}

.learning-card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.learning-card__meta {
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.progress-bar {
  height: 3px;
  border-radius: var(--r-pill);
  background: var(--bg-disabled);
  margin-top: var(--sp-2);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand-400);
  transition: width var(--dur-slow) var(--ease-out);
}

/* ─────────────────────────────────────────
   28. Reward Badge
   ───────────────────────────────────────── */
.reward-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--accent-50);
  color: var(--accent-600);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

/* ─────────────────────────────────────────
   29. Empty State
   ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--text-tertiary);
}

.empty-state__icon {
  font-size: 40px;
  margin-bottom: var(--sp-3);
  opacity: 0.5;
}

.empty-state__text {
  font-size: var(--fs-sm);
}

/* ─────────────────────────────────────────
   30. Divider
   ───────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-lightest);
  margin: var(--sp-3) 0;
}

.divider--section {
  height: 8px;
  background: var(--bg-page);
  margin: 0;
}

/* ─────────────────────────────────────────
   31. Responsive
   ───────────────────────────────────────── */
@media (max-width: 374px) {
  :root {
    --page-px: 14px;
    --banner-h: 148px;
    --nav-icon: 40px;
    --fs-lg: 16px;
    --fs-xl: 18px;
    --fs-2xl: 20px;
  }

  .course-mini__cover {
    height: 84px;
  }
  .course-card__cover {
    width: 96px;
    height: 72px;
  }
  .article-card__cover {
    height: 128px;
  }
}

@media (min-width: 431px) {
  .app-shell {
    border-left: 1px solid var(--border-lightest);
    border-right: 1px solid var(--border-lightest);
    box-shadow: 0 0 40px rgba(38, 53, 45, 0.05);
  }
}

/* ─────────────────────────────────────────
   32. Utilities (开发友好收敛类)
   ───────────────────────────────────────── */
.mt-0 {
  margin-top: 0 !important;
}
.mt-tight {
  margin-top: var(--space-tight) !important;
} /* 12px */
.mt-base {
  margin-top: var(--space-base) !important;
} /* 16px */
.mb-tight {
  margin-bottom: var(--space-tight) !important;
}
.pt-base {
  padding-top: var(--space-base) !important;
}
.pb-base {
  padding-bottom: var(--space-base) !important;
}
.px-page {
  padding-left: var(--page-px) !important;
  padding-right: var(--page-px) !important;
}

.fs-section-title {
  font-size: var(--fs-section-title) !important;
}

.relative {
  position: relative !important;
}
.z-1 {
  z-index: 1 !important;
}

.badge-dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  background: var(--danger-500);
  border-radius: 50%;
  border: 1.5px solid #fff;
}

.avatar--anon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  background: var(--bg-surface-muted);
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─────────────────────────────────────────
   33. Article Tabs（分类筛选统一组件）
   ───────────────────────────────────────── */
.article-tabs {
  display: flex;
  align-items: center;
  margin-bottom: var(--sp-3);
  position: relative;
}
.article-tabs__list {
  display: flex;
  align-items: baseline;
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-right: 48px;
  padding-left: 2px;
  padding-bottom: 6px;
}
.article-tabs__list::-webkit-scrollbar {
  display: none;
}
.article-tabs__item {
  flex: 0 0 auto;
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.article-tabs__item.is-active {
  font-size: 18px;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  position: relative;
}
.article-tabs__item.is-active::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 3px;
  background: var(--brand-500);
  border-radius: 2px;
}
.article-tabs__count {
  font-family: var(--ff-number);
  font-size: var(--fs-2xs);
  margin-left: 2px;
  font-weight: var(--fw-regular);
}
.article-tabs__more {
  position: absolute;
  right: -8px;
  bottom: -2px;
  width: 48px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: linear-gradient(
    90deg,
    rgba(247, 248, 247, 0) 0%,
    var(--bg-page) 35%
  );
  font-size: 22px;
  color: var(--text-secondary);
  z-index: 2;
  pointer-events: none;
}
.article-tabs__more iconify-icon {
  pointer-events: auto;
  cursor: pointer;
  background: var(--bg-page);
  padding-left: 12px;
  padding-bottom: 2px;
}

.article-tabs-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 14px;
  background: #fff;
  border-radius: var(--r-2xl);
  padding: var(--sp-4);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  transition: all 0.2s ease-out;
}
.article-tabs-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.article-tabs-dropdown::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 18px;
  width: 14px;
  height: 14px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.03);
  border-top-left-radius: 2px;
  z-index: -1;
}
.article-tabs-dropdown__item {
  padding: 7px 16px;
  background: var(--bg-surface-soft);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
}
.article-tabs-dropdown__item.is-active {
  background: #eff8ff;
  color: #219bf6;
  border-color: #9cd3ff;
}

/* ─────────────────────────────────────────
   34. Utilities (cont.)
   ───────────────────────────────────────── */

/* 链接重置：用于 <a> 包裹卡片等场景 */
.link-reset {
  text-decoration: none;
  color: inherit;
}

/* 图标尺寸档位 */
.icon--2xs { font-size: 12px !important; }
.icon--xs  { font-size: 13px !important; }
.icon--sm  { font-size: 14px !important; }

/* 图标语义色 */
.icon-color--danger  { color: var(--danger-500) !important; }
.icon-color--success { color: var(--success-500) !important; }
.icon-color--warning { color: var(--warning-500) !important; }
.icon-color--brand   { color: var(--brand-500) !important; }

/* 统一图标内联样式 */
iconify-icon {
  vertical-align: -0.125em;
}
.section-head__meta iconify-icon,
.menu-item__arrow iconify-icon {
  vertical-align: -0.2em;
}
