/* Cal Teen. Every color comes from a token (Build Spec "Design system"). */
:root {
  --bg: #EEF6FB; --surface: #FFFFFF; --ink: #0E2233; --muted: #536A7A; --line: #D3E4EE;
  --accent: #5BC0F0; --accent-ink: #06293F; --accent-strong: #0B6FA8; --tint: #E1F2FC;
  --leaf: #2E8B57; --leaf-soft: #E2F2E8;
  --low: #2E8B57; --mid: #D98A12; --high: #D23C32;
  --low-text: #22693F; --mid-text: #8A5500; --high-text: #B02A21;
  --mid-soft: #FBEFD9; --high-soft: #FBE3E1;
  --empty: #E3EDF3;
  --display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: max(16px, env(safe-area-inset-left));
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C1620; --surface: #13212D; --ink: #E6F1F8; --muted: #93AABB; --line: #24384A;
    --accent: #6CC8F5; --accent-ink: #04202F; --accent-strong: #86D3F8; --tint: #142C3C;
    --leaf: #5CC98A; --leaf-soft: #173126;
    --low: #5CC98A; --mid: #F0AE3C; --high: #FF6A5C;
    --low-text: #5CC98A; --mid-text: #F0AE3C; --high-text: #FF8579;
    --mid-soft: #33270F; --high-soft: #3A1C1A;
    --empty: #1E3141;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--body);
  padding-bottom: env(safe-area-inset-bottom);
}
body.gated { overflow: hidden; }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0; }
h1 { font-weight: 800; font-size: 1.75rem; letter-spacing: -0.01em; }
h2 { font-weight: 700; font-size: 1.375rem; }
h3 { font-weight: 700; font-size: 1.0625rem; }
p { margin: 0.5rem 0; }
a { color: var(--accent-strong); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }

.wrap { max-width: 720px; margin: 0 auto; padding: 20px var(--gutter) 32px; padding-right: max(16px, env(safe-area-inset-right)); }

/* Header */
.brand { display: flex; align-items: center; gap: 14px; margin: 8px 0 16px; }
.logo { flex: none; width: 52px; height: 52px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.logo svg { width: 34px; height: 34px; }
.sub { margin: 2px 0 0; color: var(--muted); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; margin: 0 0 16px; }

/* Notice */
.notice { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; background: var(--tint); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; margin: 0 0 16px; font-size: 0.9375rem; }
.notice p { margin: 0; }

/* Buttons and links */
.btn { appearance: none; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 700 1rem/1 var(--body); min-height: 48px; padding: 0 22px; cursor: pointer; }
.btn:hover { filter: brightness(0.96); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.block { display: block; width: 100%; margin-top: 12px; }
.btn.ghost { background: transparent; color: var(--accent-strong); border: 1.5px solid var(--line); }
.link { appearance: none; background: none; border: 0; padding: 0 4px; min-height: 44px; color: var(--accent-strong); font: 600 0.9375rem var(--body); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; flex: none; }

/* Tabs */
.tabs { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0 12px; margin: 0 0 4px; }
.tabbar { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tabbar [role="tab"] { flex: 1; appearance: none; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 700 0.9375rem var(--body); min-height: 44px; cursor: pointer; }
.tabbar [role="tab"][aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.tabbar [role="tab"]:disabled { opacity: 0.5; cursor: not-allowed; }
[role="tabpanel"]:focus { outline: none; }

/* Photo picker */
.drop { display: block; border: 2px dashed var(--line); border-radius: 18px; padding: 28px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--tint); }
.drop:focus-within { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.drop.has-photo { display: none; }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cam { width: 64px; height: 64px; border-radius: 50%; background: var(--tint); color: var(--accent-strong); display: grid; place-items: center; margin-bottom: 4px; }
.cam svg { width: 30px; height: 30px; }
.drop-title { font: 700 1.125rem var(--display); }
.preview-row { display: flex; align-items: center; gap: 14px; }
.preview-row img { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }

.field { display: block; font-weight: 600; margin: 16px 0 6px; }
textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; resize: vertical; min-height: 64px; }
textarea::placeholder { color: var(--muted); }
textarea:focus-visible { border-color: var(--accent-strong); outline-offset: 0; }
.counter { text-align: right; margin-top: 2px; }
.turnstile:empty { display: none; }
.turnstile { margin-top: 10px; }
.form-error { color: var(--high-text); font-weight: 600; margin: 4px 0 0; }
.form-error:empty { display: none; }

/* Progress */
.progress { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: bounce 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .6; } 40% { transform: translateY(-7px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; } * { scroll-behavior: auto !important; } }

/* Result card */
.tag { display: inline-block; font-size: 0.8125rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--accent-strong); background: var(--tint); border-radius: 999px; padding: 4px 10px; }
.tag.example { color: var(--muted); background: var(--empty); }
.result .title { margin-top: 10px; }
.chips { list-style: none; padding: 0; margin: 12px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 0.875rem; }

.meters { display: grid; gap: 14px; margin: 18px 0; }
.meter-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.meter-level { flex: none; font-weight: 700; }
.meter-level.low { color: var(--low-text); }
.meter-level.mid { color: var(--mid-text); }
.meter-level.high { color: var(--high-text); }
.bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 6px 0 4px; }
.bar i { height: 10px; border-radius: 999px; background: var(--empty); }
.bar i.low { background: var(--low); }
.bar i.mid { background: var(--mid); }
.bar i.high { background: var(--high); }
.why { margin: 0; color: var(--muted); font-size: 0.9375rem; }

.box { border-radius: 16px; padding: 14px 16px; margin: 12px 0; border: 1px solid var(--line); }
.box h3 { font-size: 1rem; }
.box ul { margin: 8px 0 0; padding-left: 1.15rem; }
.box li + li { margin-top: 4px; }
.box p { margin: 6px 0 0; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill { flex: none; font-weight: 700; font-size: 0.875rem; border-radius: 999px; padding: 4px 12px; }
.pill.m-strong { background: var(--leaf-soft); color: var(--low-text); }
.pill.m-some { background: var(--mid-soft); color: var(--mid-text); }
.pill.m-low { background: var(--high-soft); color: var(--high-text); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.two .box { margin: 0; }
.good { background: var(--leaf-soft); }
.swaps { background: var(--tint); }
@media (max-width: 559px) { .two { grid-template-columns: 1fr; } }

.grow-h { margin-top: 18px; }
.grow { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.grow li { border-radius: 999px; padding: 5px 12px; font-size: 0.875rem; border: 1px solid var(--line); }
.grow li.g-yes { background: var(--leaf-soft); border-color: transparent; }
.grow li.g-no { color: var(--muted); }

.doctor { display: flex; gap: 10px; align-items: flex-start; background: var(--tint); }
.doctor svg { flex: none; width: 22px; height: 22px; color: var(--accent-strong); margin-top: 2px; }
.doctor p { margin: 0; font-weight: 600; }
.footnote { color: var(--muted); font-size: 0.875rem; margin-top: 12px; }
.report { font-size: 0.875rem; margin: 4px 0 0; }

/* Grow strong guide */
.intro p { margin-top: 8px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.fact { background: var(--tint); border-radius: 16px; padding: 12px 14px; }
.fact b { display: block; font: 800 1.125rem var(--display); color: var(--accent-strong); }
.fact span { font-size: 0.9375rem; }
@media (max-width: 559px) { .facts { grid-template-columns: 1fr; } }
.target { display: block; font: 600 0.9375rem var(--body); color: var(--accent-strong); margin-top: 4px; }
table.foods { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 0.9375rem; }
table.foods th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
table.foods td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.foods td:last-child, table.foods th:last-child { padding-right: 0; }
table.foods tr:last-child td { border-bottom: 0; }
.tip { background: var(--tint); border-radius: 14px; padding: 12px 14px; margin: 10px 0 0; }
.bullets { padding-left: 1.15rem; margin: 10px 0 0; }
.bullets li + li { margin-top: 8px; }
.menu { margin: 10px 0 0; display: grid; gap: 10px; }
.menu div { display: grid; grid-template-columns: 9rem 1fr; gap: 10px; }
.menu dt { font-weight: 700; }
.menu dd { margin: 0; }
@media (max-width: 479px) { .menu div { grid-template-columns: 1fr; gap: 0; } }

/* Footer */
.foot { color: var(--muted); font-size: 0.875rem; border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; }
.foot .links { margin-top: 10px; }
.foot .links a { display: inline-block; padding: 10px 0; }

/* Age gate */
.overlay { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: grid; place-items: center; padding: 20px var(--gutter); overflow-y: auto; }
.sheet { max-width: 420px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; text-align: center; }
.sheet .logo { margin: 0 auto 14px; }
.sheet .row { display: grid; gap: 10px; margin-top: 18px; }
.sheet .btn.ghost { margin-top: 12px; }

/* Plain content pages (privacy, about, terms, report) */
.page h1 { margin: 8px 0 12px; }
.page h2 { font-size: 1.125rem; margin: 20px 0 6px; }
.page ul { padding-left: 1.15rem; }
.back { display: inline-block; padding: 10px 0; font-weight: 600; }
select { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; min-height: 44px; }
.form-status:empty { display: none; }
.form-status { font-weight: 600; margin: 10px 0 0; }
