:root {
  --bg: #faf6ef;
  --card: #ffffff;
  --ink: #3d3229;
  --ink-soft: #7a6f63;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --line: #e8e0d3;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(61, 50, 41, 0.08), 0 4px 14px rgba(61, 50, 41, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
}

/* ---- 头部 ---- */
.app-header {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 0;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.baby-line {
  font-size: 1.3rem;
  font-weight: 700;
}
.stage-line {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-top: 2px;
}
.btn-settings {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn-settings:hover { border-color: var(--accent); color: var(--accent); }

/* ---- 设置面板 ---- */
.settings-panel {
  max-width: 720px;
  margin: 12px auto 0;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.settings-panel[hidden] { display: none; }
.settings-panel label { font-weight: 600; font-size: 0.92rem; }
.settings-panel input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.92rem;
  background: var(--bg);
  color: var(--ink);
}
.settings-hint {
  margin: 0;
  width: 100%;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.btn-ghost {
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
}
.btn-primary {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: #0d685f; }

/* ---- 新阶段横幅 ---- */
.stage-banner {
  max-width: 720px;
  margin: 12px auto 0;
  padding: 12px 16px;
  background: var(--amber-soft);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}
.stage-banner[hidden] { display: none; }

/* ---- 主导航 ---- */
.main-tabs {
  max-width: 720px;
  margin: 16px auto 0;
  padding: 0 16px;
  display: flex;
  gap: 8px;
}
.main-tabs button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 10px 4px;
  border-radius: 12px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.main-tabs button:hover { border-color: var(--accent); }
.main-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ---- 内容区 ---- */
.content {
  max-width: 720px;
  margin: 16px auto 40px;
  padding: 0 16px;
}
.page-intro {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 4px 0 14px;
}

/* ---- 引导卡 ---- */
.setup-card {
  text-align: center;
  padding: 48px 16px;
  color: var(--ink-soft);
}
.setup-card .big { font-size: 2.6rem; }

/* ---- 三件事 ---- */
.three-card {
  background: linear-gradient(135deg, #134e4a, #0f766e);
  color: #f0fdfa;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
}
.three-card h2 { margin: 0 0 10px; font-size: 1.05rem; }
.three-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.three-list li {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.three-list li:last-child { margin-bottom: 0; }
.three-list .num { font-weight: 700; }
.three-card .item-detail { color: #ccfbf1; }

/* ---- 节奏时间轴 ---- */
.rhythm-title {
  font-size: 1.05rem;
  margin: 24px 0 6px;
}
.legend {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rhythm {
  position: relative;
  padding-left: 4px;
}
.moment {
  display: flex;
  gap: 14px;
  position: relative;
}
.moment-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.moment:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 20px;
  bottom: -8px;
  width: 2px;
  background: var(--line);
}
.moment-body {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin-bottom: 14px;
}
.moment-body h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--accent);
}
.moment-body ul { margin: 0; padding-left: 4px; list-style: none; }
.moment-body li { margin-bottom: 10px; }
.moment-body li:last-child { margin-bottom: 0; }

.item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.item-title { font-weight: 600; }
.item-detail {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-top: 2px;
}
.mark {
  font-size: 0.72rem;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.mark-loop { background: var(--accent-soft); color: var(--accent); }
.mark-daily { background: #e0e7ff; color: #4338ca; }
.mark-need { background: var(--amber-soft); color: var(--amber); }

/* ---- 本阶段入口按钮 ---- */
.stage-link {
  display: block;
  width: 100%;
  margin: 8px 0 20px;
  padding: 14px;
  background: var(--card);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
}
.stage-link:hover { background: var(--accent-soft); }

/* ---- 给照护者的一句话 ---- */
.caregiver-note {
  background: var(--amber-soft);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.caregiver-note h3 { margin: 0 0 6px; font-size: 0.95rem; color: var(--amber); }
.caregiver-note p { margin: 0; font-size: 0.92rem; }

/* ---- 主题折叠（本阶段 / 遇到问题 / 全部） ---- */
.theme, .lib-stage {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.theme summary, .lib-stage summary {
  padding: 13px 18px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme summary::-webkit-details-marker,
.lib-stage summary::-webkit-details-marker { display: none; }
.theme summary::after, .lib-stage summary::after {
  content: "▸";
  margin-left: auto;
  color: var(--ink-soft);
  transition: transform 0.2s ease;
}
.theme[open] summary::after, .lib-stage[open] summary::after {
  transform: rotate(90deg);
}
.theme-body { padding: 0 18px 14px; }
.theme-body > ul { margin: 0; padding-left: 4px; list-style: none; }
.theme-body > ul li { margin-bottom: 12px; }
.count {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  padding: 0 8px;
  border-radius: 999px;
}
.count.dim { background: var(--bg); color: var(--ink-soft); }
.pending { color: var(--ink-soft); font-size: 0.9rem; margin: 4px 0 8px; }

/* ---- 三档分层 ---- */
.tier { margin-bottom: 12px; border-radius: 10px; padding: 10px 14px; }
.tier h4 { margin: 0 0 6px; font-size: 0.88rem; }
.tier ul { margin: 0; padding-left: 4px; list-style: none; }
.tier li { margin-bottom: 8px; }
.tier li:last-child { margin-bottom: 0; }
.tier-must { background: var(--red-soft); }
.tier-must h4 { color: var(--red); }
.tier-try { background: #f0faf8; }
.tier-try h4 { color: var(--accent); }
.tier-watch { background: var(--amber-soft); }
.tier-watch h4 { color: var(--amber); }

/* ---- 全部内容 ---- */
.lib-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.lib-tab {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
}
.lib-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.lib-tab .badge {
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin-left: 4px;
}
.lib-tab.active .badge { color: rgba(255, 255, 255, 0.75); }

.lib-stage.current { border: 2px solid var(--accent); }
.stage-label { color: var(--accent); font-weight: 700; }
.current-tag {
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  padding: 1px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.section { margin-top: 12px; border-radius: 10px; padding: 10px 14px; }
.section h3 { margin: 0 0 6px; font-size: 0.95rem; }
.section ul { margin: 0; padding-left: 4px; list-style: none; }
.section li { margin-bottom: 8px; }
.section.do { background: #f0faf8; border-left: 4px solid var(--accent); }
.section.tip { background: #f7f4ee; border-left: 4px solid #a8a29e; }
.section.warn { background: var(--amber-soft); border-left: 4px solid var(--amber); }
.section.warn h3 { color: var(--amber); }
.section.rule { background: var(--red-soft); border-left: 4px solid var(--red); }
.section.rule h3 { color: var(--red); }

.meta-card {
  background: linear-gradient(135deg, #134e4a, #0f766e);
  color: #f0fdfa;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin-bottom: 12px;
}
.meta-card h2 { margin: 0 0 10px; font-size: 1.05rem; }
.meta-card ul { margin: 0; padding-left: 4px; list-style: none; }
.meta-card li { margin-bottom: 10px; }
.meta-card .item-detail { color: #ccfbf1; }

/* ---- 页脚 ---- */
.app-footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 0 16px 32px;
}
.app-footer a { color: var(--accent); }

@media (max-width: 480px) {
  .baby-line { font-size: 1.15rem; }
  .main-tabs button { font-size: 0.88rem; padding: 9px 2px; }
  .moment-body { padding: 10px 12px; }
}
