:root {
  --cream: #fbf9f6;
  --surface: #f5f3f0;
  --surface-2: #efeeeb;
  --line: #e4e2df;
  --outline: #c2c8c2;
  --green: #354c3e;
  --green-2: #4c6455;
  --green-card: #3f5748;
  --sage: #cee9d6;
  --sage-2: #b2cdba;
  --sage-tint: #e3f0e6;
  --peach: #ffdbca;
  --brown: #73594c;
  --ink: #1b1c1a;
  --muted: #424843;
  --soft: #5f665f;
  --white: #ffffff;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: Manrope, system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Screen titles get focus for screen readers when a screen opens; no visible ring needed. */
h1[tabindex="-1"]:focus { outline: none; }
html, body { margin: 0; height: 100%; background: var(--cream); }
body {
  font-family: var(--sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.dark { background: var(--green); }
button, input { font-family: inherit; }
a { color: var(--green); }

.app { position: relative; max-width: 480px; margin: 0 auto; min-height: 100dvh; overflow-x: clip; }

/* Screens */
.screen {
  position: absolute; inset: 0;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: max(24px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
  opacity: 0; transform: translateX(24px);
  pointer-events: none; visibility: hidden;
  transition: opacity .45s var(--ease), transform .45s var(--ease), visibility 0s linear .45s;
}
.screen.is-active {
  position: relative;
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity .45s var(--ease), transform .45s var(--ease), visibility 0s;
}
.screen.is-back { transform: translateX(-24px); }
.screen--dark { background: var(--green); color: var(--cream); }

/* Wordmark */
.wordmark { display: flex; align-items: baseline; justify-content: center; gap: 4px; color: var(--green); }
.wordmark b { font-weight: 700; text-transform: uppercase; letter-spacing: .15em; font-size: 15px; }
.wordmark i { font-family: var(--serif); font-size: 19px; }
.screen--dark .wordmark { color: var(--sage); }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.icon-btn {
  width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--green); cursor: pointer;
}
.icon-btn:active { background: var(--surface); }
.dots { display: flex; gap: 6px; }
.dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--outline); transition: width .3s var(--ease), background-color .3s; }
.dots span.done { background: var(--sage-2); }
.dots span.on { width: 22px; background: var(--green); }

/* Type */
.title { margin: 0; font-family: var(--serif); font-weight: 400; color: var(--green); font-size: 38px; line-height: 1.05; }
.title--xl { font-size: 54px; line-height: 1; }
.lede { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.kicker { margin: 0; font-size: 15px; font-weight: 600; color: var(--green-2); }
.label { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green-2); }
.label small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--soft); font-size: 13px; }
.fine { margin: 0; text-align: center; font-size: 12px; line-height: 1.5; color: var(--soft); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.push { margin-top: auto; }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 58px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--green); color: var(--white); font-size: 17px; font-weight: 600; text-decoration: none;
  transition: transform .2s var(--ease), background-color .2s, opacity .2s;
}
.btn:hover { background: var(--green-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn--ghost { background: transparent; color: var(--green); border: 1px solid var(--outline); min-height: 54px; font-size: 16px; }
.btn--ghost:hover { background: var(--surface); }
.btn--light { background: var(--cream); color: var(--green); font-weight: 700; }
.btn--light:hover { background: var(--white); }
.link-btn { align-self: center; background: none; border: 0; padding: 12px; font-size: 15px; font-weight: 600; color: var(--green); cursor: pointer; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chip {
  min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--outline);
  background: var(--white); color: var(--green); font-size: 15px; font-weight: 600; line-height: 1.25; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .15s;
}
.chips--grid .chip { min-height: 52px; border-radius: 20px; }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--white); }
.chip:disabled { opacity: .45; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.input {
  height: 50px; border-radius: 16px; border: 1px solid var(--outline); background: var(--white);
  padding: 0 16px; font-size: 16px; color: var(--ink); outline-color: var(--green);
}
.pill-link {
  align-self: center; display: flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 999px;
  background: var(--surface); font-size: 13px; color: var(--muted); border: 0; cursor: pointer;
}
.pill-link strong { color: var(--green); }

/* Welcome */
.steps { list-style: none; margin: 36px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; align-items: center; gap: 14px; font-size: 15px; }
.num { width: 32px; height: 32px; border-radius: 50%; background: var(--sage); color: var(--green); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.install { margin-top: 26px; border-radius: 20px; background: var(--surface); }
.install-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 12px 16px;
  border: 0; background: transparent; color: var(--green); font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.install-toggle span { flex: 1; }
.install-toggle .chev { transition: transform .3s var(--ease); }
.install-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.install-how { margin: 0; padding: 0 16px 16px 48px; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* Add menu */
.source {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--white); text-align: left; cursor: pointer;
  transition: border-color .2s, transform .15s;
}
.source:hover { border-color: var(--green); }
.source:active { transform: scale(.98); }
.source .ico { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.source strong { display: block; font-size: 16px; color: var(--green); }
.source span span { font-size: 13px; color: var(--soft); }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { position: relative; width: 64px; height: 84px; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: flex-end; justify-content: center; font-size: 11px; color: var(--muted); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb .pdf { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--green); }
.thumb button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(27,28,26,.6); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.notice { margin: 12px 0 0; padding: 12px 14px; border-radius: 16px; background: var(--peach); color: #2a170d; font-size: 14px; line-height: 1.45; }

/* Reading */
.orb { position: relative; width: 200px; height: 200px; margin: 56px auto 0; }
.orb .core { position: absolute; inset: 40px; border-radius: 50%; background: var(--sage); display: flex; align-items: center; justify-content: center; animation: pulse 5s ease-in-out infinite; }
.orb .ring { position: absolute; inset: 14px; border-radius: 50%; border: 1.5px solid var(--green-2); }
.orb .orbit { position: absolute; inset: 14px; animation: spin 7s linear infinite; }
.orb .orbit span { position: absolute; left: 50%; top: -7px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--peach); }
.orb .orbit--slow { inset: 0; animation: spin 13s linear infinite reverse; }
.orb .orbit--slow span { top: auto; bottom: -4px; width: 8px; height: 8px; margin-left: -4px; background: var(--sage-2); }
.orb .tick { opacity: 0; transform: scale(.6); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.is-ready .orb .tick { opacity: 1; transform: none; }
.status { margin-top: 34px; text-align: center; min-height: 120px; }
.status .title { color: var(--cream); font-size: 34px; }
.status ul { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--sage); }
.status li { opacity: .35; transition: opacity .6s; }
.status li.on { opacity: 1; }
.status .ready-line { margin: 14px 0 0; color: var(--peach); font-weight: 600; font-size: 15px; }
.facts { margin-top: 24px; padding: 20px 22px 18px; border-radius: 26px; background: var(--green-card); }
.facts .label { color: var(--peach); font-size: 12px; letter-spacing: .1em; }
.facts .slot { position: relative; height: 112px; }
.facts .fact { position: absolute; inset: 0; margin: 0; font-family: var(--serif); font-size: 22px; line-height: 1.25; color: var(--cream); opacity: 0; transform: translateY(6px); transition: opacity .9s, transform .9s var(--ease); }
.facts .fact.on { opacity: 1; transform: none; }
.facts .foot { display: flex; align-items: center; justify-content: space-between; }
.facts .fdots { display: flex; gap: 5px; }
.facts .fdots span { height: 5px; width: 5px; border-radius: 3px; background: var(--green-2); transition: width .4s, background-color .4s; }
.facts .fdots span.on { width: 16px; background: var(--peach); }
.facts .src { font-size: 11px; color: var(--sage-2); }
.reveal { opacity: 0; transform: translateY(8px); transition: opacity .6s var(--ease), transform .6s var(--ease); pointer-events: none; }
.is-ready .reveal { opacity: 1; transform: none; pointer-events: auto; }

/* Results */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 6px 12px; border-radius: 999px; background: var(--sage); color: #092014; font-size: 13px; font-weight: 600; }
.tag--peach { background: var(--peach); color: #2a170d; }
.card { padding: 18px; border-radius: 28px; background: var(--white); border: 1px solid var(--line); animation: rise .7s var(--ease) both; }
.card--first { background: var(--sage-tint); border-color: var(--sage); }
.card-head { display: flex; gap: 12px; align-items: flex-start; }
.card-num { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; background: var(--surface); color: var(--green); }
.card--first .card-num { background: var(--green); color: var(--white); }
.card h2 { margin: 2px 0 0; font-family: var(--serif); font-weight: 400; font-size: 25px; line-height: 1.12; color: var(--green); }
.card .why { margin: 12px 0 0; font-size: 15px; line-height: 1.5; }
.kcal { display: inline-block; margin-top: 12px; padding: 5px 11px; border-radius: 999px; background: var(--cream); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.card-extra { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.card-extra p { margin: 0; display: flex; gap: 10px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.card-extra svg { flex-shrink: 0; margin-top: 2px; }
.card-extra strong { color: var(--green); }
.card-extra .ask strong { color: var(--brown); }
.swaps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.swaps li { display: flex; gap: 12px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.swaps li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sage-2); flex-shrink: 0; margin-top: 7px; }
.note { margin: 28px 4px 0; font-family: var(--serif); font-style: italic; font-size: 24px; line-height: 1.25; color: var(--green); }
.boxed { padding: 16px 18px; border-radius: 24px; background: var(--white); border: 1px solid var(--line); }

/* Share sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(27,28,26,0); visibility: hidden; transition: background-color .35s, visibility 0s linear .35s; }
.sheet-wrap.open { background: rgba(27,28,26,.38); visibility: visible; transition: background-color .35s, visibility 0s; }
.sheet { width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto; padding: 12px 22px max(28px, env(safe-area-inset-bottom)); border-radius: 32px 32px 0 0; background: var(--cream); transform: translateY(100%); transition: transform .45s var(--ease); display: flex; flex-direction: column; }
.sheet-wrap.open .sheet { transform: none; }
.handle { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--outline); }
.radio { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--white); text-align: left; font-size: 15px; font-weight: 600; color: var(--green); cursor: pointer; transition: background-color .2s, border-color .2s; }
.radio .r { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--outline); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.radio[aria-checked="true"] { background: var(--sage-tint); border-color: var(--green); }
.radio[aria-checked="true"] .r { border-color: var(--green); }
.radio[aria-checked="true"] .r::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }

/* My clients */
.add-client { display: flex; gap: 10px; align-items: flex-end; margin-top: 24px; }
.btn--small { width: auto; min-height: 50px; padding: 0 22px; font-size: 16px; }
.undo { margin: 12px 0 0; padding: 4px 6px 4px 14px; border-radius: 16px; background: var(--sage-tint); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--green); }
.undo .link-btn { padding: 10px 12px; }
.clients { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.client { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 20px; background: var(--white); border: 1px solid var(--line); animation: rise .5s var(--ease) both; }
.client.is-new { background: var(--sage-tint); border-color: var(--sage); }
.client .who { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; color: var(--green); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--outline); background: transparent; color: var(--green); font-size: 14px; font-weight: 600; cursor: pointer; transition: background-color .2s, transform .15s; }
.client button:active { transform: scale(.96); }
.client .share { background: var(--green); border-color: var(--green); color: var(--white); }
.client .remove { border-color: transparent; color: var(--soft); padding: 0 10px; }

/* Card preview */
.preview { width: 100%; border-radius: 22px; box-shadow: 0 12px 40px rgba(27,28,26,.12); display: block; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(.92); } 50% { transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
