:root {
  --bg: #f8fafc;
  --fg: #0f172a;
  --muted: #64748b;
  --card: #ffffff;
  --border: #e2e8f0;
  --primary: #0d9488;
  --primary-soft: #ccfbf1;
  --primary-ink: #0f766e;
  --done-bg: #f1f5f9;
  --done-fg: #64748b;
  --shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.04);
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.loading, .state, .empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 15px;
}
.state h1 {
  font-size: 1.2rem;
  color: var(--fg);
  margin: 0 0 8px;
}

/* 顶栏固定 + 中部独立滚动，避免内容钻入标题下方 */
.page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.page-top {
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.page-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 16px calc(72px + env(safe-area-inset-bottom));
}
.page-no-tab .page-scroll {
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
/* 问卷填写挂载在 .page 上：恢复整页滚动 */
.page.survey-fill-root {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(120px + env(safe-area-inset-bottom));
}

.page-header {
  position: relative;
  background: #fff;
  margin: 0;
  padding: 14px 16px;
}
.page-header h1 {
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}

.chips {
  display: flex;
  gap: 10px;
  padding: 10px 16px 12px;
  overflow-x: auto;
  background: #fff;
}
.chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0 16px;
}
.card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  padding: 14px 14px 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  color: inherit;
}
.card-row.edu { align-items: stretch; }
.card-row-main { flex: 1; min-width: 0; }
.card-title {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.4;
  color: var(--fg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.status-tag {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}
.status-tag.pending {
  background: #e6fffa;
  color: var(--primary);
}
.status-tag.done {
  background: var(--done-bg);
  color: var(--done-fg);
}
.chevron {
  color: #94a3b8;
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.edu-thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--primary-soft);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.edu-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.edu-thumb-fallback {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 2px solid var(--primary-ink);
  box-shadow: inset 0 -8px 0 -6px var(--primary-ink);
}

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  z-index: 30;
}
.tabbar-item {
  flex: 1;
  border: none;
  background: transparent;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  min-height: 48px;
}
.tabbar-item.active {
  color: var(--primary);
}
.tabbar-item span { line-height: 1.2; }

.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-height: 52px;
  margin: 0;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}
.detail-header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.sf-back {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--fg);
  font-family: inherit;
}
.edu-article {
  background: #fff;
  margin: 12px 0 24px;
  padding: 20px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
}
.edu-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}
.edu-meta {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}
.edu-body {
  font-size: 16px;
  line-height: 1.7;
  color: #1e293b;
}
.edu-body.plain { white-space: normal; }
.edu-body img, .edu-body video {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.btn {
  min-height: 48px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
  padding: 0 18px;
}
.btn-secondary {
  background: #fff;
  color: #334155;
  border: 1.5px solid #cbd5e1;
}

/* SurveyFill 挂载时沿用 survey-fill.css；主色微调贴近嵌入壳 */
.survey-fill-root {
  --accent: var(--primary);
  --accent-soft: var(--primary-soft);
}
