:root {
  --pink: #FF6B9D;
  --pink-light: #FFF0F5;
  --blue: #4FC3F7;
  --green: #66BB6A;
  --orange: #FFB74D;
  --purple: #BA68C8;
  --bg: #FFF5F7;
  --card: #FFFFFF;
  --text: #333333;
  --text-light: #888888;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(255,107,157,0.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.page {
  display: none;
  padding: 16px;
  animation: fadeIn 0.3s;
}
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 首页 */
.header {
  text-align: center;
  padding: 40px 0 20px;
}
.logo { font-size: 64px; margin-bottom: 8px; }
.header h1 { font-size: 22px; color: var(--pink); }
.subtitle { color: var(--text-light); font-size: 14px; margin-top: 4px; }

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
}

.nav-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
}
.nav-card:active { transform: scale(0.96); }
.card-icon { font-size: 36px; margin-bottom: 8px; }
.card-title { font-weight: 600; font-size: 16px; }
.card-desc { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.disclaimer-box {
  margin-top: 20px;
  padding: 12px;
  background: #FFF8E1;
  border-radius: 12px;
  font-size: 12px;
  color: #F57C00;
  line-height: 1.6;
}

/* 顶栏 */
.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.top-bar h2 { font-size: 18px; }
.back-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* 表单 */
.form-section { margin-bottom: 20px; }
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--pink);
  margin-bottom: 8px;
}

.text-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #FFE0EC;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--card);
}
.text-input:focus { border-color: var(--pink); }

.age-inputs {
  display: flex;
  gap: 8px;
}
.age-inputs .input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}
.age-inputs input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #FFE0EC;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  background: var(--card);
}
.age-inputs input:focus { border-color: var(--pink); }
.age-inputs span { font-size: 14px; color: var(--text-light); }

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btn-option {
  padding: 10px 20px;
  border: 2px solid #FFE0EC;
  border-radius: 24px;
  background: var(--card);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-option.selected {
  background: var(--pink);
  color: white;
  border-color: var(--pink);
}

/* 奶粉选择按钮行 */
.formula-btn-row {
  display: flex;
  gap: 8px;
}
.formula-trigger-btn {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid #FFE0EC;
  border-radius: 12px;
  background: var(--card);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.formula-trigger-btn.active {
  background: var(--pink);
  color: white;
  border-color: var(--pink);
}
.formula-selected-info {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-light);
  text-align: center;
}

/* 弹窗 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: flex-end;
}
.modal-overlay.show {
  display: flex;
}
.modal-box {
  background: white;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 20px 16px 30px;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--pink);
  text-align: center;
  margin-bottom: 12px;
}
.modal-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.modal-item {
  padding: 10px 16px;
  border: 2px solid #FFE0EC;
  border-radius: 12px;
  background: var(--card);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.modal-item:active {
  transform: scale(0.96);
}
.modal-item.selected {
  background: var(--pink);
  color: white;
  border-color: var(--pink);
}

.next-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--pink), #FF8A80);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255,107,157,0.3);
  transition: transform 0.2s;
}
.next-btn:active { transform: scale(0.98); }

/* 报告 */
#report-content h3 {
  font-size: 16px;
  color: var(--pink);
  margin: 16px 0 8px;
  padding-left: 8px;
  border-left: 3px solid var(--pink);
}

.report-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.report-card .status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.status-normal { background: #E8F5E9; color: #2E7D32; }
.status-warn { background: #FFF3E0; color: #E65100; }
.status-danger { background: #FFEBEE; color: #C62828; }

.report-detail {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.8;
}

select.text-input {
  appearance: none;
  -webkit-appearance: none;
}

/* 登录状态栏 */
.auth-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--card);
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.auth-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 20px;
  background: var(--pink);
  color: white;
  font-size: 13px;
  cursor: pointer;
}
.auth-btn-secondary {
  background: #F5F5F5;
  color: var(--text);
  border: 1px solid #E0E0E0;
}
.auth-btns {
  display: flex;
  gap: 6px;
}

/* 登录页 */
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.login-note {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 12px;
}
.error-msg {
  color: #C62828;
  font-size: 13px;
  margin: 8px 0;
  padding: 8px;
  background: #FFEBEE;
  border-radius: 8px;
}

/* 报告操作 */
.report-actions {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}
.action-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.download-btn {
  background: linear-gradient(135deg, #4FC3F7, #2196F3);
  color: white;
}
.guest-notice {
  background: #FFF3E0;
  color: #E65100;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  text-align: center;
  margin: 8px 0;
}

/* 报告历史 */
.empty-notice {
  text-align: center;
  color: var(--text-light);
  padding: 40px 0;
  font-size: 14px;
}
.report-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--card);
  border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: all 0.2s;
}
.report-history-item:active {
  transform: scale(0.98);
  background: #FFF0F5;
}
.report-history-date {
  font-size: 14px;
  font-weight: 600;
}
.report-history-expire {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}
.action-btn-small {
  display: inline-block;
  padding: 6px 14px;
  background: var(--pink);
  color: white;
  border-radius: 16px;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.view-btn {
  background: #4FC3F7;
  margin-left: 6px;
}

/* 顶部公告框 */
.top-notice-box {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
  border-left: 4px solid #FF9800;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(255,152,0,0.1);
}
.notice-title {
  font-size: 15px;
  font-weight: 700;
  color: #E65100;
  margin-bottom: 6px;
}
.notice-content {
  font-size: 13px;
  line-height: 1.8;
  color: #5D4037;
}
.notice-content b {
  color: #BF360C;
}

/* 喂养次数范围输入 */
.freq-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.freq-range-row .input-wrap {
  flex: 1;
}
.freq-range-row .input-wrap .text-input {
  width: 100%;
  text-align: center;
}
.range-separator {
  font-size: 18px;
  color: var(--text-light);
  font-weight: bold;
}
.range-unit {
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
}

/* 评估状态标签 */
.status-normal { background: #E8F5E9; color: #2E7D32; }
.status-warn { background: #FFF3E0; color: #E65100; }
.status-danger { background: #FFEBEE; color: #C62828; }
.status { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }

/* 报告卡片 */
.report-card {
  background: #FAFAFA;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  line-height: 1.8;
  font-size: 14px;
}
.report-card b { color: var(--pink); }
.report-detail {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
  line-height: 1.7;
}
.report-detail br { display: block; content: ""; margin-top: 2px; }

/* 评估建议 */
.advice-box {
  background: #FFF8E1;
  border-left: 3px solid var(--orange);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.7;
  color: #5D4037;
}
