*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4A90A4;
  --primary-light: #6BB5C9;
  --bg: #F5F9FA;
  --card: #FFFFFF;
  --text: #2C3E50;
  --text-secondary: #6B7C8F;
  --text-muted: #8A9BA8;
  --green: #66BB6A;
  --red: #C62828;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overscroll-behavior: none;
  min-height: 100dvh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 12px;
  background: var(--primary);
  color: #fff;
  padding-top: env(safe-area-inset-top, 0px);
}

.back-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.top-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  margin-right: 40px;
}

.top-bar:has(.back-btn:not([hidden])) .top-title { margin-right: 0; }

.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(72px + var(--safe-area-bottom));
}

.page { display: none; }
.page.active { display: block; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--card);
  border-top: 1px solid #E8EDF0;
  padding-bottom: var(--safe-area-bottom);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 6px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-item.active { color: var(--primary); font-weight: 600; }

.nav-icon-wrap {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.nav-char {
  width: 38px;
  height: 38px;
  object-fit: contain;
  pointer-events: none;
}

@keyframes navFlash {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
    box-shadow: 0 0 0 rgba(74, 144, 164, 0);
  }
  50% {
    transform: scale(1.14);
    filter: brightness(1.12);
    box-shadow: 0 0 14px rgba(74, 144, 164, 0.5);
  }
}

@keyframes navGlow {
  0%, 100% { background: transparent; }
  50% { background: rgba(120, 200, 255, 0.22); }
}

.nav-item .nav-icon-wrap {
  animation: navFlash 2s ease-in-out infinite;
}

.nav-item.active .nav-icon-wrap {
  animation: navFlash 1.1s ease-in-out infinite, navGlow 1.1s ease-in-out infinite;
}

.nav-flash-0 .nav-icon-wrap { animation-delay: 0s, 0s; }
.nav-flash-1 .nav-icon-wrap { animation-delay: 0.4s, 0.4s; }
.nav-flash-2 .nav-icon-wrap { animation-delay: 0.8s, 0.8s; }
.nav-flash-3 .nav-icon-wrap { animation-delay: 1.2s, 1.2s; }

.music-btn {
  position: fixed;
  right: 16px;
  bottom: calc(78px + var(--safe-area-bottom));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #4A90A4, #6BB5C9);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(74, 144, 164, 0.35);
  cursor: pointer;
  z-index: 101;
  -webkit-tap-highlight-color: transparent;
  animation: navFlash 2.5s ease-in-out infinite;
}

.music-btn.playing { background: linear-gradient(135deg, #66BB6A, #4CAF50); }

.music-hint {
  position: fixed;
  left: 50%;
  bottom: calc(130px + var(--safe-area-bottom));
  transform: translateX(-50%) translateY(12px);
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  background: rgba(74, 144, 164, 0.95);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(74, 144, 164, 0.35);
  z-index: 102;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.music-hint.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.music-btn.paused::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 18px;
  background: rgba(255,255,255,0.9);
  transform: rotate(-35deg);
  border-radius: 1px;
}

.hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 16px;
  padding: 24px 20px;
  color: #fff;
  margin-bottom: 16px;
}

.hero-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 14px;
}

.hero-photo {
  width: 120px;
  height: 120px;
  border-radius: 18px;
  object-fit: cover;
  object-position: center center;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

.hero-text { flex: 1; min-width: 0; }
.hero-greeting { font-size: 22px; font-weight: 600; }
.hero-sub { font-size: 13px; opacity: 0.95; margin-top: 6px; line-height: 1.55; font-style: italic; }

.mascot-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(74, 144, 164, 0.08);
  border: 2px solid #FFE4EC;
}

.mascot-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
  animation: navFlash 2.2s ease-in-out infinite;
}

.mascot-title {
  font-size: 16px;
  font-weight: 700;
  color: #5D4037;
}

.mascot-sub {
  font-size: 13px;
  color: #8D6E63;
  margin-top: 4px;
}

.tip-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  border-left: 4px solid var(--green);
  box-shadow: 0 2px 12px rgba(74,144,164,0.08);
}

.tip-label { font-size: 12px; color: var(--green); font-weight: 600; margin-bottom: 6px; }
.tip-text { font-size: 15px; line-height: 1.7; }

.stats-row {
  display: flex;
  background: var(--card);
  border-radius: 14px;
  padding: 16px 0;
  margin-bottom: 8px;
  box-shadow: 0 2px 12px rgba(74,144,164,0.08);
}

.stat-item { flex: 1; text-align: center; }
.stat-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-divider { width: 1px; background: #E8EDF0; margin: 4px 0; }

.section-header {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 12px;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.grid-card {
  background: var(--card);
  border: none;
  border-radius: 14px;
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(74,144,164,0.08);
  -webkit-tap-highlight-color: transparent;
}

a.grid-card { text-decoration: none; color: inherit; display: block; }
.grid-card.emergency { border-top: 3px solid #EF5350; }
.grid-card.relax { border-top: 3px solid #AB47BC; }
.grid-card.knowledge { border-top: 3px solid #42A5F5; }
.grid-card.quiz { border-top: 3px solid #FFA726; }
.grid-card.files { border-top: 3px solid #4A90A4; }
.grid-icon { font-size: 26px; display: block; margin-bottom: 6px; }
.grid-title { font-size: 15px; font-weight: 600; display: block; color: var(--text); }
.grid-desc { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px; }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(74,144,164,0.08);
}

.card-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.card-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  margin-right: 6px;
}
.tag-know { background: #E3F2FD; color: #1565C0; }
.tag-prevent { background: #E8F5E9; color: #2E7D32; }
.tag-recover { background: #FFF3E0; color: #E65100; }
.tag-diet { background: #F3E5F5; color: #7B1FA2; }
.tag-mind { background: #FCE4EC; color: #C2185B; }

.article-card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.article-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.read-time { font-size: 11px; color: var(--text-muted); }
.list-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.list-summary { font-size: 13px; color: var(--text-secondary); }
.list-arrow { font-size: 12px; color: var(--primary); text-align: right; margin-top: 8px; }

.search-input {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  background: var(--card);
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(74,144,164,0.08);
  outline: none;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-tag {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  border: none;
  background: var(--card);
  color: var(--text-secondary);
  cursor: pointer;
}
.filter-tag.active { background: var(--primary); color: #fff; }

.safe-tip {
  background: #FFF8E1;
  border-radius: 10px;
  padding: 12px;
  font-size: 12px;
  color: #8D6E00;
  line-height: 1.6;
  margin-top: 16px;
}

/* 闯关 */
.quiz-start, .quiz-result { text-align: center; padding: 32px 12px; }
.quiz-hero { font-size: 56px; }
.quiz-title { font-size: 22px; font-weight: 700; margin-top: 12px; }
.quiz-desc { font-size: 14px; color: var(--text-secondary); margin: 8px 0 24px; }
.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 14px 40px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-secondary {
  display: inline-block;
  background: var(--card);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 24px;
  padding: 12px 32px;
  font-size: 15px;
  margin-top: 12px;
  cursor: pointer;
}

.progress-bar {
  height: 6px;
  background: #E8EDF0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--green));
  border-radius: 3px;
  transition: width 0.3s;
}
.progress-text { font-size: 12px; color: var(--text-muted); text-align: right; margin-bottom: 12px; }

.question-text { font-size: 17px; font-weight: 600; margin-bottom: 16px; line-height: 1.5; }
.option {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--bg);
  margin-bottom: 8px;
  font-size: 15px;
  cursor: pointer;
  border: 2px solid transparent;
  -webkit-tap-highlight-color: transparent;
}
.option.correct { background: #E8F5E9; border-color: var(--green); }
.option.wrong { background: #FFEBEE; border-color: #EF5350; }
.option-letter {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--card); display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; margin-right: 12px; flex-shrink: 0;
}
.explain-box { margin-top: 12px; padding-top: 12px; border-top: 1px solid #E8EDF0; }
.explain-title { font-weight: 600; margin-bottom: 6px; }
.explain-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 14px; }

.result-emoji { font-size: 56px; }
.result-score { font-size: 40px; font-weight: 700; color: var(--primary); }

/* 呵护 */
.checkin-hero {
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, var(--green), #4CAF50);
  border-radius: 16px;
  padding: 20px;
  color: #fff;
  margin-bottom: 16px;
}
.streak-circle {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin-right: 16px; flex-shrink: 0;
}
.streak-num { font-size: 28px; font-weight: 700; }
.streak-label { font-size: 11px; }
.checkin-title { font-size: 18px; font-weight: 600; }
.checkin-sub { font-size: 13px; opacity: 0.9; }

.task-item {
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(74,144,164,0.06);
}
.task-item.done { background: #F1F8E9; }
.task-check {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #C5D5DC; margin-right: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff;
}
.task-item.done .task-check { background: var(--green); border-color: var(--green); }
.task-item.done .task-name { text-decoration: line-through; color: var(--text-muted); }
.task-name { font-size: 15px; font-weight: 600; }
.task-desc { font-size: 12px; color: var(--text-muted); }

.encourage {
  background: #FFF8E1; border-radius: 12px; padding: 14px;
  text-align: center; font-size: 15px; color: #F57F17; margin: 12px 0;
}

.week-row {
  display: flex; justify-content: space-between;
  background: var(--card); border-radius: 14px; padding: 14px 10px;
}
.week-day { text-align: center; flex: 1; }
.day-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: #E8EDF0; margin: 0 auto 4px;
  font-size: 11px; line-height: 28px; color: var(--text-muted);
}
.day-dot.active { background: var(--green); color: #fff; }
.day-label { font-size: 11px; color: var(--text-muted); }

/* 急救 */
.alert-banner {
  background: linear-gradient(135deg, var(--red), #E53935);
  border-radius: 14px; padding: 20px; color: #fff; text-align: center; margin-bottom: 16px;
}
.alert-title { font-size: 17px; font-weight: 700; }
.alert-sub { font-size: 13px; opacity: 0.9; margin-top: 4px; }

.fast-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.fast-card {
  background: var(--card); border-radius: 12px; padding: 14px; text-align: center;
  box-shadow: 0 2px 10px rgba(198,40,40,0.1);
}
.fast-letter { font-size: 32px; font-weight: 800; color: var(--red); }
.fast-word { font-size: 14px; font-weight: 600; }
.fast-mean { font-size: 12px; color: var(--text-muted); }
.fast-check { font-size: 12px; margin-top: 6px; line-height: 1.4; }

.step { display: flex; margin-bottom: 14px; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
  color: #fff; font-size: 14px; font-weight: 700; text-align: center; line-height: 28px;
  margin-right: 12px; flex-shrink: 0;
}
.step-title { font-size: 15px; font-weight: 600; }
.step-desc { font-size: 13px; color: var(--text-secondary); }

.dont-card { border: 1px solid #FFCDD2; }
.dont-card li { font-size: 14px; color: var(--red); line-height: 2; margin-left: 16px; }

.call-btn {
  display: block; text-align: center; text-decoration: none;
  background: linear-gradient(135deg, var(--red), #E53935);
  color: #fff; border-radius: 24px; padding: 16px;
  font-size: 18px; font-weight: 600; margin: 20px 0 12px;
  letter-spacing: 2px;
}

/* 轻松阅读 */
.relax-header { text-align: center; margin-bottom: 20px; }
.relax-title { font-size: 22px; font-weight: 700; }
.relax-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.relax-card {
  background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 10px;
  cursor: pointer; box-shadow: 0 2px 10px rgba(74,144,164,0.08);
}
.relax-card.type-story { border-left: 4px solid #AB47BC; }
.relax-card.type-quote { border-left: 4px solid #FF7043; }
.relax-card.type-fact { border-left: 4px solid #42A5F5; }
.relax-type { font-size: 11px; color: var(--text-muted); }
.relax-card-title { font-size: 16px; font-weight: 600; margin: 4px 0 8px; }
.relax-content { font-size: 14px; color: var(--text-secondary); line-height: 1.8; white-space: pre-wrap; }
.relax-content.collapsed {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.expand-hint { font-size: 12px; color: var(--primary); text-align: right; margin-top: 6px; }
.text-btn {
  display: block; width: 100%; border: none; background: none;
  color: var(--primary); font-size: 15px; padding: 16px; cursor: pointer;
}

/* 文章详情 */
.article-header { margin-bottom: 16px; }
.article-title { font-size: 22px; font-weight: 700; line-height: 1.4; margin: 10px 0 6px; }
.article-content {
  font-size: 15px; line-height: 2; white-space: pre-wrap; color: #37474F;
}
.article-nav { display: flex; gap: 10px; margin-top: 20px; }
.article-nav button { flex: 1; }