:root {
  --bg: #f5f2eb;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --ink: #0c0d0e;
  --muted: #70757c;
  --line: rgba(12, 13, 14, 0.08);
  --line-strong: rgba(12, 13, 14, 0.14);
  --dark: #090a0b;
  --dark-2: #15181b;
  --accent: #d7ff73;
  --accent-2: #7bd88f;
  --warn: #e6a34a;
  --danger: #d46565;
  --blue: #89c5ff;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --shadow: 0 20px 60px rgba(12, 13, 14, 0.10);
  --shadow-soft: 0 14px 36px rgba(12, 13, 14, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { min-height: 100%; background: var(--dark); }
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, Segoe UI, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 0%, rgba(215, 255, 115, .18), transparent 28%),
    radial-gradient(circle at 90% 10%, rgba(137, 197, 255, .15), transparent 26%),
    linear-gradient(180deg, #faf8f3 0%, #f0eee7 58%, #e9e6df 100%);
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }

.phone-shell {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  background: var(--dark);
}

.app {
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 0%, rgba(215, 255, 115, .15), transparent 24%),
    radial-gradient(circle at 100% 18%, rgba(137, 197, 255, .15), transparent 24%),
    linear-gradient(180deg, #faf8f3 0%, #f2f0e9 44%, #e9e6df 100%);
}

.screen {
  min-height: 100dvh;
  padding: calc(18px + var(--safe-top)) 18px calc(92px + var(--safe-bottom));
  animation: rise .38s cubic-bezier(.2, .8, .2, 1);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  margin: calc(-18px - var(--safe-top)) -18px 16px;
  padding: calc(14px + var(--safe-top)) 18px 12px;
  background: linear-gradient(180deg, rgba(250,248,243,.92), rgba(250,248,243,.74) 74%, rgba(250,248,243,0));
  backdrop-filter: blur(22px);
}

.topbar-inner, .row, .split, .card-head, .metric-row, .habit-line, .exercise-meta, .meal-meta, .option-row {
  display: flex;
  align-items: center;
}

.topbar-inner { justify-content: space-between; gap: 12px; }
.logo-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo-mark {
  width: 38px; height: 38px;
  border-radius: 15px;
  background: var(--dark);
  padding: 5px;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  object-fit: contain;
}
.logo-title { min-width: 0; }
.logo-title b { display: block; letter-spacing: -.04em; font-size: 17px; line-height: 1; }
.logo-title span { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }

.icon-btn, .small-btn, .ghost-btn, .primary-btn, .secondary-btn, .nav-btn, .chip, .choice, .habit-toggle, .seg-btn {
  border: 0;
  background: none;
  color: inherit;
}

.icon-btn {
  width: 42px; height: 42px;
  border-radius: 16px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-soft);
}

.icon-btn svg, .nav-btn svg { width: 20px; height: 20px; }

.hero {
  position: relative;
  overflow: hidden;
  color: white;
  border-radius: 36px;
  min-height: 222px;
  padding: 24px;
  background:
    radial-gradient(circle at 75% 10%, rgba(215,255,115,.24), transparent 28%),
    linear-gradient(140deg, #08090a 0%, #181c20 62%, #0d0f12 100%);
  box-shadow: 0 28px 72px rgba(0, 0, 0, .25);
}

.hero .brand-bg {
  position: absolute;
  right: -36px;
  bottom: -34px;
  width: 250px;
  opacity: .08;
  filter: drop-shadow(0 24px 45px rgba(0,0,0,.6));
}

.hero h1, .hero h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  line-height: .95;
  letter-spacing: -.07em;
  font-size: clamp(42px, 12vw, 64px);
}
.hero p {
  position: relative;
  z-index: 1;
  color: rgba(255,255,255,.68);
  line-height: 1.45;
  font-size: 15px;
  max-width: 290px;
  margin: 16px 0 0;
}
.hero .pill { margin-bottom: 18px; }

.pill, .status-pill {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.72);
  background: rgba(255,255,255,.08);
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.pill::before, .status-pill::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(215,255,115,.8);
}
.status-pill {
  color: var(--ink);
  background: rgba(255,255,255,.75);
  border-color: var(--line);
}

.section-title { margin: 24px 2px 12px; }
.section-title h2, .section-title h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1;
  letter-spacing: -.055em;
}
.section-title p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.42;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 12px; }
.stack-lg { display: grid; gap: 16px; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}
.card.dark {
  color: white;
  background: linear-gradient(145deg, #101215, #1b1e21);
  border-color: rgba(255,255,255,.08);
}
.card.accent {
  background: linear-gradient(145deg, rgba(215,255,115,.62), rgba(255,255,255,.70));
  border-color: rgba(100,120,28,.16);
}
.card-head { justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-kicker { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.card.dark .card-kicker { color: rgba(255,255,255,.52); }
.card-title { margin: 0; font-size: 18px; letter-spacing: -.045em; line-height: 1.05; }
.card-body { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.card.dark .card-body { color: rgba(255,255,255,.68); }
.card-note { color: var(--muted); font-size: 12px; line-height: 1.35; }

.metric {
  border-radius: 22px;
  padding: 15px;
  min-height: 116px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
}
.metric b { display: block; margin-top: 12px; font-size: 28px; letter-spacing: -.06em; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 650; }
.metric .mini { font-size: 12px; color: var(--muted); margin-top: 8px; }
.metric-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--dark);
  color: white;
}
.metric-icon svg { width: 18px; height: 18px; }

.primary-btn, .secondary-btn, .ghost-btn, .small-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border-radius: 18px;
  padding: 0 16px;
  font-weight: 760;
  letter-spacing: -.02em;
}
.primary-btn {
  color: #090a0b;
  background: var(--accent);
  box-shadow: 0 18px 32px rgba(100,120,28,.22);
}
.secondary-btn {
  color: white;
  background: var(--dark);
  box-shadow: 0 18px 32px rgba(0,0,0,.14);
}
.ghost-btn {
  color: var(--ink);
  background: rgba(255,255,255,.70);
  border: 1px solid var(--line);
}
.small-btn {
  min-height: 36px;
  font-size: 13px;
  border-radius: 14px;
  background: rgba(255,255,255,.8);
  border: 1px solid var(--line);
}
.primary-btn:active, .secondary-btn:active, .ghost-btn:active, .small-btn:active, .choice:active, .nav-btn:active { transform: scale(.98); }

.cta-row { display: grid; gap: 10px; grid-template-columns: 1fr; margin-top: 18px; }
.cta-row.two { grid-template-columns: 1fr 1fr; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  z-index: 30;
  background: linear-gradient(180deg, rgba(233,230,223,0), rgba(233,230,223,.82) 16%, rgba(233,230,223,.96));
  backdrop-filter: blur(24px);
}
.nav-inner {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 7px;
  border-radius: 26px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(0,0,0,.14);
}
.nav-btn {
  min-height: 52px;
  border-radius: 19px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.nav-btn span { font-size: 10px; font-weight: 720; margin-top: 4px; }
.nav-btn.active {
  color: var(--ink);
  background: var(--dark);
}
.nav-btn.active svg, .nav-btn.active span { color: white; }
.nav-btn.coach.active { background: var(--accent); }
.nav-btn.coach.active svg, .nav-btn.coach.active span { color: var(--dark); }

.progress-shell {
  height: 8px;
  background: rgba(255,255,255,.10);
  border-radius: 999px;
  overflow: hidden;
  margin: 18px 0 0;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width .35s ease;
}
.onboarding-card {
  min-height: calc(100dvh - 72px);
  display: grid;
  align-content: space-between;
  gap: 20px;
}
.onboarding-logo {
  width: 116px;
  margin: 0 auto 18px;
  filter: drop-shadow(0 18px 40px rgba(0,0,0,.18));
}
.onboarding h1 { margin: 0; font-size: 46px; letter-spacing: -.075em; line-height: .94; }
.onboarding h2 { margin: 0; font-size: 34px; letter-spacing: -.065em; line-height: .98; }
.onboarding p { color: var(--muted); line-height: 1.45; }
.choice-grid { display: grid; gap: 10px; }
.choice-grid.two { grid-template-columns: 1fr 1fr; }
.choice {
  text-align: left;
  padding: 15px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  min-height: 70px;
}
.choice b { display: block; letter-spacing: -.035em; }
.choice span { display: block; color: var(--muted); margin-top: 6px; font-size: 13px; line-height: 1.28; }
.choice.active {
  background: var(--dark);
  color: white;
  border-color: var(--dark);
  box-shadow: 0 20px 48px rgba(0,0,0,.16);
}
.choice.active span { color: rgba(255,255,255,.64); }

.range-row { margin: 16px 0; }
.range-row label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 650; margin-bottom: 10px; }
input[type=range] { width: 100%; accent-color: var(--dark); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  padding: 14px 15px;
  outline: none;
  color: var(--ink);
}
textarea { min-height: 112px; resize: vertical; line-height: 1.45; }

.score-ring {
  position: relative;
  width: 86px; height: 86px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) calc(var(--score, 70) * 1%), rgba(255,255,255,.18) 0);
}
.score-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: var(--dark-2);
}
.score-ring b { position: relative; z-index: 1; color: white; font-size: 22px; letter-spacing: -.04em; }
.score-ring small { position: relative; z-index: 1; color: rgba(255,255,255,.54); font-size: 9px; }

.plan-card { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; }
.plan-time {
  width: 92px; height: 92px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: var(--dark);
  color: white;
}
.plan-time b { font-size: 28px; letter-spacing: -.05em; }
.plan-time span { font-size: 11px; color: rgba(255,255,255,.58); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 720;
  color: var(--ink);
  background: rgba(255,255,255,.76);
  border: 1px solid var(--line);
}
.chip.dark { color: white; background: var(--dark); border-color: var(--dark); }
.chip.green { background: rgba(215,255,115,.62); }
.chip.blue { background: rgba(137,197,255,.25); }
.chip.warn { background: rgba(230,163,74,.22); }

.context-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
}
.context-icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--dark);
  color: white;
}
.context-icon svg { width: 20px; height: 20px; }
.context-card b { display: block; letter-spacing: -.035em; }
.context-card p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.42; }

.visual {
  height: 148px;
  border-radius: 24px;
  overflow: hidden;
  background: var(--dark);
  margin-bottom: 12px;
}
.visual svg { width: 100%; height: 100%; }
.exercise-card, .meal-card { padding: 10px; }
.exercise-card h3, .meal-card h3 { font-size: 18px; margin: 4px 6px 0; letter-spacing: -.045em; }
.exercise-card p, .meal-card p { margin: 7px 6px 11px; color: var(--muted); font-size: 13px; line-height: 1.38; }
.exercise-meta, .meal-meta { gap: 6px; margin: 0 6px 6px; flex-wrap: wrap; }

.timeline { position: relative; display: grid; gap: 10px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 20px; top: 18px; bottom: 18px;
  width: 2px;
  background: var(--line-strong);
}
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
}
.timeline-dot {
  width: 42px; height: 42px;
  border-radius: 16px;
  background: var(--dark);
  color: white;
  display: grid;
  place-items: center;
  z-index: 1;
  font-size: 13px;
  font-weight: 800;
}
.timeline-content { padding: 14px; border-radius: 22px; background: rgba(255,255,255,.70); border: 1px solid var(--line); }
.timeline-content b { display: block; letter-spacing: -.035em; }
.timeline-content span { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; line-height: 1.35; }

.habit-list { display: grid; gap: 10px; }
.habit-line {
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border-radius: 20px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
}
.habit-line b { display: block; letter-spacing: -.03em; }
.habit-line small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.habit-toggle {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.75);
  display: grid;
  place-items: center;
}
.habit-toggle.done { color: #0b0d10; background: var(--accent); border-color: transparent; }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 22px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.seg-btn {
  min-height: 42px;
  border-radius: 17px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}
.seg-btn.active { color: white; background: var(--dark); }

.chat {
  display: grid;
  gap: 12px;
  padding-bottom: 12px;
}
.message {
  max-width: 88%;
  padding: 13px 14px;
  border-radius: 21px;
  font-size: 14px;
  line-height: 1.42;
  white-space: pre-wrap;
}
.message.ai {
  background: rgba(255,255,255,.76);
  border: 1px solid var(--line);
  border-top-left-radius: 8px;
}
.message.user {
  justify-self: end;
  color: white;
  background: var(--dark);
  border-top-right-radius: 8px;
}
.chatbar {
  position: sticky;
  bottom: calc(74px + var(--safe-bottom));
  z-index: 16;
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 10px;
  margin-top: 12px;
}
.chatbar input { height: 48px; border-radius: 18px; }
.chatbar button { height: 48px; border-radius: 18px; background: var(--accent); border: 0; font-weight: 800; }

.install-card {
  display: none;
  border-radius: 24px;
  padding: 15px;
  background: rgba(9,10,11,.92);
  color: white;
  margin: 12px 0;
}
.install-card.visible { display: block; }
.install-card p { color: rgba(255,255,255,.62); margin: 6px 0 0; font-size: 13px; line-height: 1.38; }

.footer-spacer { height: 10px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 800; }
.split { justify-content: space-between; gap: 12px; }
.center { text-align: center; }
.full { width: 100%; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  z-index: 100;
  width: min(420px, calc(100vw - 32px));
  padding: 13px 15px;
  border-radius: 18px;
  color: white;
  background: rgba(9,10,11,.88);
  box-shadow: 0 20px 54px rgba(0,0,0,.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease, transform .24s ease;
  font-size: 13px;
  line-height: 1.35;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 461px) {
  .app { box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 30px 120px rgba(0,0,0,.55); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
