@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg: #faf9f7;
  --surface: #f2f0eb;
  --surface2: #e8e5de;
  --ink: #1a1a18;
  --ink2: #5a5950;
  --ink3: #9a9890;
  --border: rgba(26,26,24,0.1);
  --border2: rgba(26,26,24,0.2);
  --accent: #2d6a4f;
  --accent-bg: #d8f3dc;
  --accent-text: #1b4332;
  --warn: #e76f51;
  --warn-bg: #fdf0eb;
  --warn-text: #7c3a1e;
  --info: #457b9d;
  --info-bg: #e8f4f8;
  --info-text: #1d3a4a;
  --amber: #e9c46a;
  --amber-bg: #fdf6e3;
  --amber-text: #7a5c00;
  --r: 14px;
  --rm: 10px;
  --fd: 'DM Serif Display', Georgia, serif;
  --fb: 'DM Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; background: var(--ink); }
body {
  font-family: var(--fb);
  background: var(--bg);
  color: var(--ink);
  min-height: 100%;
  max-width: 430px;
  margin: 0 auto;
  overflow-x: hidden;
}

.screen { display: none; min-height: 100svh; flex-direction: column; }
.screen.active { display: flex; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pad { padding: 20px 20px 32px; }

/* NAV */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  padding-top: calc(16px + env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.nav-logo { font-family: var(--fd); font-size: 22px; color: var(--ink); }
.nav-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border2); background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink2); transition: background 0.15s; font-family: var(--fb);
}
.nav-btn:hover { background: var(--surface); }
.nav-back { width: auto; padding: 0 14px; border-radius: 20px; font-size: 13px; gap: 5px; }

/* BOTTOM NAV */
.bottom-nav {
  display: flex; background: var(--bg); border-top: 1px solid var(--border);
  padding: 8px 0; padding-bottom: calc(8px + env(safe-area-inset-bottom)); flex-shrink: 0;
}
.bnav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; cursor: pointer; padding: 6px 0; color: var(--ink3); transition: color 0.15s;
}
.bnav-item.active { color: var(--ink); }
.bnav-label { font-size: 10px; font-weight: 500; }

/* TYPE */
.display { font-family: var(--fd); font-size: 32px; line-height: 1.05; letter-spacing: -0.5px; }
.display-sm { font-family: var(--fd); font-size: 24px; line-height: 1.2; }
.label { font-size: 11px; font-weight: 500; color: var(--ink3); text-transform: uppercase; letter-spacing: 0.6px; }
.body-text { font-size: 14px; line-height: 1.6; color: var(--ink2); }
.caption { font-size: 12px; color: var(--ink3); }

/* CARDS */
.card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 18px; margin-bottom: 12px;
}
.card-flat {
  background: var(--surface); border-radius: var(--r);
  padding: 16px 18px; margin-bottom: 12px;
}

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 12px 22px; border-radius: 30px;
  border: 1px solid var(--border2); font-family: var(--fb);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all 0.15s; background: none; color: var(--ink);
}
.btn:hover { background: var(--surface); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: #333; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 12px; }

/* INPUTS */
input[type=text], input[type=email], textarea, select {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border2); border-radius: var(--rm);
  font-family: var(--fb); font-size: 14px; color: var(--ink);
  background: #fff; outline: none; transition: border 0.15s; appearance: none;
}
input[type=range] { width: 100%; accent-color: var(--ink); }
input:focus, textarea:focus { border-color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: 18px; }
.field-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 7px; }
.field-hint { font-size: 12px; color: var(--ink3); margin-top: 5px; }

/* CHIPS */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  padding: 7px 15px; border-radius: 30px; border: 1px solid var(--border2);
  font-size: 13px; cursor: pointer; color: var(--ink2);
  background: #fff; transition: all 0.15s; user-select: none;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* PILLS */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 30px; font-size: 11px; font-weight: 500;
}
.pill-accent { background: var(--accent-bg); color: var(--accent-text); }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.pill-info { background: var(--info-bg); color: var(--info-text); }
.pill-gray { background: var(--surface2); color: var(--ink2); }

/* ALERT */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--rm);
  margin-bottom: 14px; font-size: 13px; line-height: 1.5;
}
.alert-warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid rgba(231,111,81,0.3); }
.alert-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border-radius: var(--rm); padding: 14px; }
.stat-val { font-size: 22px; font-weight: 500; }
.stat-lbl { font-size: 11px; color: var(--ink3); margin-top: 2px; }
.stat-delta { font-size: 11px; margin-top: 5px; }
.delta-up { color: var(--accent); }
.delta-flat { color: var(--ink3); }

/* WELLBEING */
.wb-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.wb-lbl { font-size: 13px; color: var(--ink2); width: 68px; flex-shrink: 0; }
.wb-track { flex: 1; height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.wb-fill { height: 100%; border-radius: 3px; }
.wb-score { font-size: 12px; font-weight: 500; width: 28px; text-align: right; }

/* ACTIVITY CHART */
.act-chart { display: flex; align-items: flex-end; gap: 5px; height: 70px; margin: 10px 0 6px; }
.act-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.act-bar { width: 100%; border-radius: 3px 3px 0 0; background: var(--surface2); min-height: 3px; }
.act-bar.today { background: var(--ink); }
.act-day { font-size: 10px; color: var(--ink3); }

/* INSIGHTS */
.insight-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.insight-row:last-child { border-bottom: none; }
.insight-pip { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.insight-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.insight-desc { font-size: 12px; color: var(--ink2); line-height: 1.5; }

/* LOG */
.log-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.log-item:last-child { border-bottom: none; }
.log-time { font-size: 11px; color: var(--ink3); width: 36px; flex-shrink: 0; padding-top: 2px; }
.log-icon { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.log-main { font-size: 13px; font-weight: 500; }
.log-sub { font-size: 12px; color: var(--ink2); margin-top: 1px; }

/* QUICK ACTIONS */
.qa-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 20px; }
.qa {
  background: var(--surface); border-radius: var(--rm); padding: 12px 6px;
  text-align: center; cursor: pointer; transition: background 0.15s; border: 1px solid var(--border);
}
.qa:hover { background: var(--surface2); }
.qa-icon { width: 32px; height: 32px; border-radius: 8px; margin: 0 auto 7px; display: flex; align-items: center; justify-content: center; }
.qa-lbl { font-size: 11px; color: var(--ink2); line-height: 1.3; }

/* BREED */
.breed-hero { position: relative; height: 200px; background: var(--surface); overflow: hidden; }
.breed-hero img { width: 100%; height: 100%; object-fit: cover; }
.breed-hero-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px 20px 14px;
  background: linear-gradient(transparent, rgba(26,26,24,0.85));
}
.breed-hero-name { font-family: var(--fd); font-size: 28px; color: #faf9f7; }
.breed-hero-sub { font-size: 13px; color: rgba(250,249,247,0.75); margin-top: 2px; }
.breed-tabs { display: flex; border-bottom: 1px solid var(--border); overflow-x: auto; }
.breed-tab {
  flex-shrink: 0; padding: 11px 16px; font-size: 13px; font-weight: 500;
  cursor: pointer; color: var(--ink3); border-bottom: 2px solid transparent;
  transition: all 0.15s; white-space: nowrap;
}
.breed-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.health-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.health-item:last-child { border-bottom: none; }
.risk-wrap { width: 72px; flex-shrink: 0; }
.risk-lbl { font-size: 10px; color: var(--ink3); margin-bottom: 4px; }
.risk-track { height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
.risk-fill { height: 100%; border-radius: 2px; }
.risk-high { background: var(--warn); }
.risk-med { background: var(--amber); }
.risk-low { background: var(--accent); }
.health-name { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.health-desc { font-size: 12px; color: var(--ink2); line-height: 1.5; }
.health-when { font-size: 11px; color: var(--ink3); margin-top: 4px; }
.myth-card { border-left: 3px solid var(--border2); padding: 10px 14px; margin-bottom: 12px; border-radius: 0 var(--rm) var(--rm) 0; }
.myth-busted { border-left-color: var(--warn); background: var(--warn-bg); }
.myth-nuanced { border-left-color: var(--amber); background: var(--amber-bg); }
.myth-lbl { font-size: 10px; font-weight: 500; margin-bottom: 4px; }
.myth-busted .myth-lbl { color: var(--warn-text); }
.myth-nuanced .myth-lbl { color: var(--amber-text); }
.myth-claim { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.myth-truth { font-size: 12px; color: var(--ink2); line-height: 1.5; }

/* REGISTER */
.reg-progress { display: flex; align-items: center; padding: 0 20px 16px; }
.reg-step { display: flex; align-items: center; gap: 7px; flex: 1; }
.reg-circle {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: var(--ink3);
  background: var(--bg); flex-shrink: 0; transition: all 0.2s;
}
.reg-circle.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.reg-circle.done { background: var(--accent-bg); color: var(--accent-text); border-color: var(--accent); }
.reg-slabel { font-size: 11px; color: var(--ink3); }
.reg-slabel.active { color: var(--ink); font-weight: 500; }
.reg-line { flex: 1; height: 1px; background: var(--border); margin: 0 6px; }
.photo-zone {
  border: 1.5px dashed var(--border2); border-radius: var(--r);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: background 0.15s;
}
.photo-zone:hover { background: var(--surface); }

/* VET */
.vet-days { font-size: 36px; font-weight: 300; line-height: 1; }
.vet-bar-wrap { height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.vet-bar-fill { height: 100%; border-radius: 2px; background: var(--accent); }

/* TOAST */
.toast {
  position: fixed; bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 20px;
  border-radius: 30px; font-size: 13px; font-weight: 500;
  opacity: 0; transition: all 0.25s; pointer-events: none; white-space: nowrap; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* WELCOME ANIMATION */
.welcome-word { display: block; overflow: hidden; padding-bottom: 6px; }
.welcome-word span { display: block; transform: translateY(100%); animation: slideUp 0.6s cubic-bezier(0.16,1,0.3,1) forwards; }
.welcome-word:nth-child(2) span { animation-delay: 0.1s; }
.welcome-word:nth-child(3) span { animation-delay: 0.2s; }
@keyframes slideUp { to { transform: translateY(0); } }
.fade-in { opacity: 0; animation: fadeIn 0.5s 0.5s forwards; }
.fade-in-late { opacity: 0; animation: fadeIn 0.5s 0.7s forwards; }
@keyframes fadeIn { to { opacity: 1; } }
