/* ========== 基础变量 ========== */
:root {
  --pink-1: #fce4ec;
  --pink-2: #f8bbd0;
  --pink-3: #f48fb1;
  --pink-4: #e91e63;
  --blue-1: #e3f2fd;
  --blue-2: #64b5f6;
  --green-1: #e8f5e9;
  --green-2: #66bb6a;
  --orange-1: #fff3e0;
  --orange-2: #ffb74d;
  --purple-1: #f3e5f5;
  --purple-2: #ba68c8;
  --bg: #f5f0eb;
  --card: #ffffff;
  --text: #3a3a3a;
  --text-light: #999;
  --radius: 16px;
  --shadow: 0 2px 16px rgba(0,0,0,0.05);
}

/* 两个主题色 */
.theme-prenatal {
  --accent: #9c27b0;
  --accent-light: #f3e5f5;
  --accent-gradient: linear-gradient(135deg, #f3e5f5, #e1bee7, #ce93d8);
  --accent-shadow: rgba(156, 39, 176, 0.2);
}
.theme-postnatal {
  --accent: #e91e63;
  --accent-light: #fce4ec;
  --accent-gradient: linear-gradient(135deg, #fce4ec, #f8bbd0, #f48fb1);
  --accent-shadow: rgba(233, 30, 99, 0.2);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

/* ========== 顶部 Header ========== */
.header {
  background: var(--accent-gradient);
  padding: 50px 24px 30px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px var(--accent-shadow);
}
.header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.1);
  letter-spacing: 2px;
}
.header .subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  margin-top: 6px;
  font-weight: 300;
}

/* ========== 切换标签 ========== */
.tab-bar {
  display: flex;
  margin: -15px 16px 20px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  position: relative;
  z-index: 101;
}
.tab-item {
  flex: 1;
  padding: 14px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #999;
  cursor: pointer;
  transition: all 0.3s;
  border-bottom: 2px solid transparent;
}
.tab-item.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-light);
}

/* ========== 统计条 ========== */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 18px 20px;
  background: #fff;
  margin: 0 16px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-item { text-align: center; }
.stat-item .num {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.stat-item .label {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* ========== 月份标题 ========== */
.month-title {
  text-align: center;
  padding: 10px 16px;
  margin: 10px 0;
  position: relative;
}
.month-title::before,
.month-title::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 60px;
  height: 1px;
  background: #ddd;
}
.month-title::before { left: 16px; }
.month-title::after { right: 16px; }
.month-title span {
  background: var(--bg);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  color: #999;
  letter-spacing: 3px;
}

/* ========== 里程碑卡片 ========== */
.milestone-card {
  margin: 0 16px 24px;
  background: linear-gradient(135deg, #fff9c4, #fff59d);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 16px rgba(255, 235, 59, 0.2);
}
.milestone-card .emoji { font-size: 36px; margin-bottom: 8px; }
.milestone-card .title { font-size: 16px; font-weight: 700; color: #f57f17; }
.milestone-card .desc { font-size: 13px; color: #f9a825; margin-top: 4px; }

/* ========== 时间轴容器 ========== */
.timeline {
  position: relative;
  padding: 0 16px 20px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 38px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-light), var(--accent), var(--accent-light));
  opacity: 0.4;
}

/* ========== 时间轴节点 ========== */
.timeline-node {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  position: relative;
}

/* 左侧日期 */
.timeline-date {
  width: 52px;
  flex-shrink: 0;
  text-align: center;
  position: relative;
  z-index: 2;
}
.timeline-date .node-dot {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  margin: 4px auto 0;
  box-shadow: 0 0 0 4px var(--accent-light), 0 0 0 6px rgba(156,39,176,0.15);
}
.timeline-date .node-day {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}
.timeline-date .node-month {
  font-size: 11px;
  color: var(--text-light);
}

/* 右侧卡片 */
.timeline-card {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}
.timeline-card.today {
  border: 2px solid var(--accent);
}

/* 卡片顶部标签行 */
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 0;
}
.card-header .day-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}
.card-header .day-sub {
  font-size: 12px;
  color: #bbb;
}

/* 照片区域 */
.card-photos { padding: 12px 16px; }
.photo-grid {
  display: grid;
  gap: 4px;
  border-radius: 12px;
  overflow: hidden;
}
.photo-grid.single { grid-template-columns: 1fr; }
.photo-grid.double { grid-template-columns: 1fr 1fr; }
.photo-grid.triple { grid-template-columns: 1fr 1fr; }
.photo-grid.quad { grid-template-columns: 1fr 1fr; }

.photo-item {
  background: linear-gradient(135deg, var(--accent-light), #f3e5f5, #e8eaf6);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-item.tall { aspect-ratio: 3/4; }
.photo-item.wide { aspect-ratio: 16/9; }
.photo-item span.hint {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.15);
  padding: 2px 8px;
  border-radius: 10px;
}

/* 文字内容 */
.card-text { padding: 0 16px 14px; }
.card-text .story {
  font-size: 14px;
  line-height: 1.8;
  color: #555;
}

/* 标签 */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 14px;
}
.tag {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}
.tag.blue { background: var(--blue-1); color: #1976d2; }
.tag.green { background: var(--green-1); color: #388e3c; }
.tag.orange { background: var(--orange-1); color: #f57c00; }
.tag.purple { background: var(--purple-1); color: #7b1fa2; }

/* 数据小卡片 */
.data-pills {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
  flex-wrap: wrap;
}
.data-pill {
  background: #f5f5f5;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
}
.data-pill .val {
  font-weight: 700;
  color: var(--accent);
  font-size: 14px;
}

/* ========== AI 笔记 ========== */
.ai-note {
  margin: 0 16px 14px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  border-left: 3px solid #66bb6a;
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  color: #2e7d32;
  line-height: 1.6;
}

/* ========== 底部 ========== */
.footer {
  text-align: center;
  padding: 30px 16px 100px;
  color: #ccc;
  font-size: 12px;
}
.footer .heart { color: var(--accent); }

/* ========== 底部导航（隐藏） ========== */
.bottom-nav { display: none; }

/* ========== 页面切换 ========== */
.page { display: none; }
.page.active { display: block; }

/* ========== 孕期主题特殊样式 ========== */
.theme-prenatal .photo-item {
  background: linear-gradient(135deg, #f3e5f5, #e1bee7, #d1c4e9);
}

/* ========== 年份分隔 ========== */
.year-divider {
  text-align: center;
  margin: 20px 0 16px;
  position: relative;
}
.year-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}
.year-divider span {
  position: relative;
  background: var(--bg);
  padding: 0 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}

/* ========== 孕期阶段标题 ========== */
.trimester-title {
  text-align: center;
  margin: 28px 0 16px;
  position: relative;
}
.trimester-title::before,
.trimester-title::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 25%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e0c3f0, transparent);
}
.trimester-title::before { left: 0; }
.trimester-title::after { right: 0; }
.trimester-title span {
  display: inline-block;
  background: linear-gradient(135deg, #f3e5f5, #e8d5f5);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #7b1fa2;
  letter-spacing: 1px;
}

/* ========== Lightbox ========== */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}
.lightbox-overlay.active {
  display: flex;
}
.lightbox-img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  z-index: 10000;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }

/* ========== 孕期进度条/已出生横幅 ========== */
.prenatal-progress {
  margin: 16px 0 8px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fce4ec, #f3e5f5);
  border-radius: 14px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: #7b1fa2;
}
.progress-hint {
  text-align: right;
  font-size: 11px;
  color: #9c27b0;
  margin-top: 4px;
  opacity: 0.7;
}

/* ========== 点击可放大的照片 ========== */
.photo-item.has-photo {
  cursor: zoom-in;
}

/* ========== 视频 ========== */
.video-item {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16/9;
}
.video-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.video-play-btn::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent #fff;
  margin-left: 3px;
}
.video-item:hover .video-play-btn {
  background: rgba(0,0,0,0.7);
}
.video-item.playing .video-play-btn {
  display: none;
}
.video-duration {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 11px;
  color: #fff;
  background: rgba(0,0,0,0.6);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ========== 响应式 ========== */
@media (min-width: 768px) {
  body { max-width: 430px; margin: 0 auto; }
}
