/* 知一小站 · 奶油绘本风 */
:root {
  --bg: #FFF9F0;
  --card: #FFFFFF;
  --primary: #F4A261;
  --primary-deep: #E76F51;
  --yellow: #F9C74F;
  --green: #90BE6D;
  --blue: #8ECAE6;
  --text: #5C4A3D;
  --text-light: #A08C7D;
  --shadow: 0 6px 20px rgba(244, 162, 97, 0.15);
  --radius: 22px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  padding-bottom: 90px; /* 给底部导航留空间 */
  max-width: 560px;
  margin: 0 auto;
}

/* ── 顶栏 ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 6px;
}
.topbar .logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-deep);
}
.topbar .deco { font-size: 20px; }

/* ── 卡片 ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 14px 16px;
}
.card h2 {
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--primary-deep);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── 首页 Hero ── */
.hero {
  text-align: center;
  padding: 10px 16px 0;
}
.hero-photo {
  width: 100%;
  max-height: 340px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 6px solid #fff;
}
.hero-placeholder {
  width: 100%;
  height: 220px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #FDE8CD, #FFF3E0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 26px; margin-top: 14px; }
.hero .sub { color: var(--text-light); font-size: 15px; }
.age-badge {
  display: inline-block;
  margin-top: 10px;
  background: var(--yellow);
  color: #7A5C00;
  padding: 8px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(249, 199, 79, 0.4);
}
.age-detail { color: var(--text-light); font-size: 14px; margin-top: 6px; }

/* ── 近况统计格 ── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat {
  border-radius: 16px;
  padding: 14px;
  text-align: center;
}
.stat .icon { font-size: 26px; }
.stat .num { font-size: 22px; font-weight: 800; margin-top: 2px; }
.stat .label { font-size: 13px; color: var(--text-light); }
.stat.feed { background: #FFF1E2; }
.stat.sleep { background: #E9F3FB; }
.stat.pee { background: #FFFBE5; }
.stat.poop { background: #EFF7E8; }

.updated { text-align: center; color: var(--text-light); font-size: 12px; margin-top: 10px; }

/* ── 疫苗倒计时横幅 ── */
.vaccine-banner {
  margin: 14px 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 8px 22px rgba(231, 111, 81, 0.3);
}
.vaccine-banner .title { font-size: 14px; opacity: 0.9; }
.vaccine-banner .name { font-size: 17px; font-weight: 700; margin: 4px 0; }
.vaccine-banner .days { font-size: 30px; font-weight: 800; }
.vaccine-banner .days small { font-size: 14px; font-weight: 400; }

/* ── 疫苗时间轴 ── */
.timeline { list-style: none; padding-left: 6px; }
.timeline li {
  position: relative;
  padding: 0 0 22px 30px;
  border-left: 3px dotted #F1D9C0;
  margin-left: 10px;
}
.timeline li:last-child { border-left-color: transparent; }
.timeline .dot {
  position: absolute;
  left: -13px;
  top: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--green);
  color: #fff;
  border: 3px solid var(--bg);
}
.timeline li.pending .dot { background: var(--yellow); }
.timeline li.paused .dot { background: #CCC; }
.timeline .v-name { font-weight: 700; font-size: 16px; }
.timeline .v-date { color: var(--text-light); font-size: 13px; }
.timeline .v-note { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* ── 相册 ── */
.month-title {
  margin: 22px 20px 8px;
  font-size: 17px;
  font-weight: 800;
  color: var(--primary-deep);
}
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 0 16px;
}
.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
  border: 3px solid #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  cursor: pointer;
}

/* 灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(60, 42, 30, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 99;
  padding: 20px;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 100%; max-height: 75vh; border-radius: 14px; }
.lightbox .cap { color: #fff; margin-top: 14px; text-align: center; font-size: 15px; }
.lightbox .close {
  position: absolute; top: 18px; right: 22px;
  font-size: 30px; color: #fff; cursor: pointer; background: none; border: none;
}

/* ── 表单 ── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 8px; }
input[type="date"], input[type="text"], select {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid #F1D9C0;
  border-radius: 14px;
  font-size: 17px;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, select:focus { border-color: var(--primary); }

.file-drop {
  border: 3px dashed var(--primary);
  border-radius: var(--radius);
  background: #FFF6EB;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--primary-deep);
}
.file-drop .big { font-size: 40px; }
.preview-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.preview-row img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.prev-item { text-align: center; }
.prev-date { display: block; font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* 上传进度条 */
.progress-wrap {
  margin-top: 14px;
  height: 14px;
  background: #F5E8D8;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--yellow), var(--primary));
  border-radius: 999px;
  transition: width 0.25s ease;
}

.who-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.who-btn {
  padding: 12px 0;
  border-radius: 14px;
  border: 2px solid #F1D9C0;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}
.who-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }

.btn-primary {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(231, 111, 81, 0.35);
}
.btn-primary:disabled { opacity: 0.5; }
.upload-msg { text-align: center; margin-top: 14px; font-weight: 700; }
.upload-msg.ok { color: var(--green); }
.upload-msg.err { color: var(--primary-deep); }

/* ── 体格卡片 ── */
.grow-row { display: flex; justify-content: space-around; text-align: center; }
.grow-row .val { font-size: 24px; font-weight: 800; color: var(--primary-deep); }
.grow-row .unit { font-size: 13px; color: var(--text-light); }

/* ── 底部导航 ── */
.navbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 max(10px, env(safe-area-inset-bottom));
  z-index: 50;
}
.navbar a {
  text-decoration: none;
  color: var(--text-light);
  text-align: center;
  font-size: 12px;
  flex: 1;
}
.navbar a .ic { font-size: 24px; display: block; }
.navbar a.active { color: var(--primary-deep); font-weight: 700; }

.loading { text-align: center; color: var(--text-light); padding: 30px; }

/* ── 主题音乐按钮 ── */
.music-btn {
  position: fixed;
  right: 14px;
  bottom: 104px;
  z-index: 60;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 20px;
  cursor: pointer;
}
.music-btn.playing { animation: music-spin 4s linear infinite; }
@keyframes music-spin { to { transform: rotate(360deg); } }
/* 想播但被浏览器拦截：脉冲提示"点一下屏幕" */
.music-btn.nudge { animation: music-pulse 1.6s ease-in-out infinite; }
@keyframes music-pulse {
  0%, 100% { box-shadow: var(--shadow); transform: scale(1); }
  50% { box-shadow: 0 0 0 10px rgba(244, 162, 97, 0.25); transform: scale(1.08); }
}
