/* Lunea — calm, warm, not pink. --phase is set from JS to the current phase colour. */
:root {
  --phase: #B07A8C;
  --accent: #6E4F7A;
  --bg: #FAF6F1;
  --bg2: #F3ECE4;
  --surface: #FFFFFF;
  --ink: #2A2230;
  --muted: #7C7183;
  --line: rgba(42, 34, 48, 0.10);
  --green: #4F8A5B;
  --rose: #A9505E;
  --warn: #A8641F;
  --shadow: 0 1px 2px rgba(42, 34, 48, .05), 0 8px 24px rgba(42, 34, 48, .07);
  --radius: 22px;
  --tab-h: 68px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17131C; --bg2: #201A27; --surface: #241E2C; --ink: #F2EBF4; --muted: #A79DB0;
    --line: rgba(242, 235, 244, 0.10); --green: #8CC79A; --rose: #E3909C; --warn: #E6A867; --accent: #C4A6D6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17131C; --bg2: #201A27; --surface: #241E2C; --ink: #F2EBF4; --muted: #A79DB0;
  --line: rgba(242, 235, 244, 0.10); --green: #8CC79A; --rose: #E3909C; --warn: #E6A867; --accent: #C4A6D6;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  font-family: var(--sans); color: var(--ink); font-size: 16px; line-height: 1.5;
  min-height: 100dvh; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 600px at 50% -200px, color-mix(in srgb, var(--phase) 22%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  transition: background .8s ease;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4, .brand { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; margin: 18px 0 8px; }
h4 { font-size: 15px; margin: 12px 0 6px; }
p + p { margin-top: 8px; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: var(--ink); }
input:not([type]), input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], textarea {
  width: 100%; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); outline: none; font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: color-mix(in srgb, var(--phase) 60%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--phase) 18%, transparent); }
:focus-visible { outline: 2px solid var(--phase); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.green { color: var(--green); }
.rose { color: var(--rose); }
.hint { font-size: 12px; color: var(--muted); margin: -6px 0 12px; }
.lead { font-size: 17px; line-height: 1.55; margin: 6px 0 10px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin: 24px 8px 8px; line-height: 1.45; }
.error { color: var(--rose); font-size: 14px; }
.link { color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; padding: 8px; }

/* Layout */
.app { max-width: 640px; margin: 0 auto; min-height: 100dvh; }
.main { padding: 0 16px calc(var(--tab-h) + 32px + env(safe-area-inset-bottom)); }
.page { padding-top: max(18px, env(safe-area-inset-top)); animation: fadeUp .35s ease both; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 14px; }
.section-title { margin: 24px 4px 10px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Cards & controls */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; border: 1px solid var(--line); }
.card h3:first-child { margin-top: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 700; font-size: 15px; transition: transform .12s, background .2s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary.big { min-height: 56px; font-size: 16px; }
.btn.soft { background: color-mix(in srgb, var(--phase) 16%, var(--surface)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--phase) 30%, transparent); }
.btn.ghost { border: 1px solid var(--line); background: var(--surface); }
.btn.danger { background: #B4424F; color: #fff; }
.btn.big { min-height: 56px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.btn-col { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--muted); transition: background .2s, color .2s; flex-shrink: 0; }
.icon-btn:hover { background: var(--line); }
.icon-btn.on { color: var(--ink); background: color-mix(in srgb, var(--phase) 22%, transparent); }
.badge-btn { position: relative; color: var(--ink); }
.badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--phase); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }

.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; transition: all .18s; white-space: nowrap; }
.chip.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.chip.on { background: color-mix(in srgb, var(--chip, var(--phase)) 22%, var(--surface)); border-color: color-mix(in srgb, var(--chip, var(--phase)) 60%, transparent); }
.chip:active { transform: scale(.96); }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-wrap.center { justify-content: center; margin: 14px 0; }
.chip-wrap.tight { gap: 6px; margin: 8px 0; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chip-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chip-scroll::-webkit-scrollbar { display: none; }
.tag { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--bg2); color: var(--muted); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: color-mix(in srgb, var(--phase) 18%, var(--surface)); }
.seg { display: flex; background: var(--bg2); border-radius: 999px; padding: 4px; gap: 2px; margin: 14px 0; }
.seg button { flex: 1; min-height: 40px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--muted); position: relative; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.small { margin: 6px 0; max-width: 360px; }
.seg.small button { min-height: 34px; font-size: 13px; }
.now-dot { position: absolute; top: 7px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--phase); }

.field { display: block; padding: 8px 0 14px; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; padding-bottom: 0; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; background: var(--bg2); border-radius: 999px; padding: 4px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); font-size: 22px; font-weight: 600; box-shadow: var(--shadow); }
.stepper span { min-width: 92px; text-align: center; font-size: 16px; }
.stepper b { font-family: var(--serif); font-size: 24px; }
.date-row { display: flex; gap: 8px; margin-top: 10px; }
.date-row input { flex: 1; }
textarea.full { width: 100%; margin-bottom: 4px; resize: vertical; }

.sync-pill { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 60; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--surface); color: var(--muted); border: 1px solid var(--line); box-shadow: var(--shadow); white-space: nowrap; }

/* Tab bar */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(620px, calc(100% - 20px)); height: var(--tab-h); display: flex; justify-content: space-around; align-items: center;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-radius: 26px; box-shadow: var(--shadow); border: 1px solid var(--line); z-index: 40;
}
.tabbar button { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--muted); transition: color .2s; }
.tabbar button svg { transition: transform .25s cubic-bezier(.3,1.6,.5,1); }
.tabbar button.on { color: var(--ink); }
.tabbar button.on svg { transform: translateY(-2px) scale(1.08); color: var(--phase); }

.fab {
  position: fixed; right: max(18px, calc(50% - 300px)); bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom));
  width: 62px; height: 62px; border-radius: 50%; color: #fff; z-index: 41;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--phase) 70%, #fff), var(--phase) 60%, color-mix(in srgb, var(--phase) 70%, #000));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--phase) 50%, transparent); display: grid; place-items: center;
  animation: breathe 4s ease-in-out infinite;
}

/* Home */
.home-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 6px 4px 0; }
.home-head h1 { font-size: 28px; }
.ring-wrap { position: relative; width: min(330px, 86vw); aspect-ratio: 1; margin: 6px auto 4px; }
.ring-svg { width: 100%; height: 100%; touch-action: none; position: relative; z-index: 1; overflow: visible; }
.ring-blob {
  position: absolute; inset: 18%; border-radius: 50%; filter: blur(28px); opacity: .55;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--phase) 80%, #fff), var(--phase));
  animation: breathe 6s ease-in-out infinite; transition: background .8s;
}
.ring-arc path { transition: stroke-opacity .4s; }
.ring-wrap .ring-arc { opacity: 0; transform-origin: 150px 150px; transform: rotate(-30deg) scale(.92); }
.ring-wrap.in .ring-arc { opacity: 1; transform: none; transition: opacity .7s ease calc(var(--i) * 90ms), transform 1s cubic-bezier(.2,.9,.3,1) calc(var(--i) * 90ms); }
.ring-arc { cursor: pointer; }
.ring-marker { transition: opacity .3s; }
.ring-wrap:not(.in) .ring-marker { opacity: 0; }
.ring-wrap.in .ring-marker { transition: opacity .5s ease .6s; }
.ring-marker-halo { animation: pulse 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.ring-marker.dragging .ring-marker-halo { animation: none; transform: scale(1.25); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; z-index: 2; padding: 0 22%; }
.ring-icon { margin-bottom: 2px; }
.ring-day { font-family: var(--serif); font-size: 54px; font-weight: 600; line-height: 1; letter-spacing: -0.03em; }
.ring-day span { font-size: 18px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.ring-phase { font-family: var(--serif); font-size: 19px; margin-top: 4px; }
.ring-sub { font-size: 13px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.ring-badge { margin-top: 6px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--line); border-radius: 999px; padding: 2px 8px; }
.ring-q { font-family: var(--serif); font-size: 64px; color: var(--muted); }
.period-actions { display: flex; flex-direction: column; align-items: stretch; gap: 4px; margin: 4px 0 16px; }
.period-actions .btn.ghost { background: transparent; border: 0; color: var(--muted); min-height: 40px; }
.cta-card .chip-row { justify-content: flex-start; }
.note-card { display: flex; gap: 12px; align-items: flex-start; background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.note-card svg { flex-shrink: 0; color: var(--warn); margin-top: 2px; }
.today-card { position: relative; overflow: hidden; cursor: pointer; background: linear-gradient(135deg, color-mix(in srgb, var(--phase) 22%, var(--surface)), var(--surface) 70%); }
.today-card h2 { margin: 8px 0 6px; }
.today-top { display: flex; align-items: center; gap: 8px; }
.today-top .eyebrow { flex: 1; }
.phase-dot { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: color-mix(in srgb, var(--phase) 25%, var(--surface)); color: var(--ink); flex-shrink: 0; font-size: 14px; }
.food-cols { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 520px) { .food-cols { grid-template-columns: 1fr 1fr; gap: 14px; } }
.why { margin-top: 10px; font-size: 14px; color: var(--muted); background: var(--bg2); padding: 10px 12px; border-radius: 12px; animation: fadeUp .25s ease; }
.carousel-wrap { margin: 4px 0 14px; }
.carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 16px 12px; margin: 0 -16px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.mini-recipe {
  flex: 0 0 158px; scroll-snap-align: start; text-align: left; border-radius: 20px; padding: 14px; min-height: 168px;
  display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); border: 1px solid var(--line);
  background: linear-gradient(160deg, color-mix(in srgb, var(--phase) 30%, var(--surface)), var(--surface) 75%);
  transition: transform .15s;
}
.mini-recipe:active { transform: scale(.97); }
.mini-emoji { font-size: 34px; }
.mini-title { font-family: var(--serif); font-size: 16px; font-weight: 600; line-height: 1.25; flex: 1; }
.mini-meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.ask-card { background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface)); }
.ask-head { display: flex; align-items: center; gap: 8px; }
.ask-q { font-family: var(--serif); font-size: 19px; margin: 10px 0 12px; line-height: 1.35; }
.ask-form { display: flex; gap: 8px; margin-bottom: 4px; }
.ask-form input { flex: 1; }
.ask-card .link { display: block; margin: 6px 0 -6px auto; }
.mira-dot { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--phase) 45%, var(--accent)); animation: breathe 4s ease-in-out infinite; }
.tip-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 520px) { .tip-grid { grid-template-columns: 1fr 1fr; gap: 14px; } }

/* Recipes */
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; color: var(--muted); }
.search input { border: 0; background: transparent; padding: 13px 0; box-shadow: none !important; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 6px; }
.recipe-card {
  text-align: left; border-radius: 20px; padding: 14px; min-height: 180px; display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--phase) 26%, var(--surface)), var(--surface) 70%);
  border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s; animation: fadeUp .3s ease both;
}
.recipe-card:active { transform: scale(.97); }
.rc-top { display: flex; justify-content: space-between; }
.rc-emoji { font-size: 32px; }
.rc-fav { color: var(--rose); font-size: 18px; }
.rc-title { font-family: var(--serif); font-size: 16px; font-weight: 600; line-height: 1.25; flex: 1; }
.rc-meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.rc-fit { font-size: 11px; font-weight: 700; }
.rc-fit.ok { color: var(--green); }
.rc-fit.warn { color: var(--warn); }
.recipe-hero { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px; margin-bottom: 8px; background: linear-gradient(135deg, color-mix(in srgb, var(--phase) 30%, var(--surface)), var(--surface)); }
.rh-emoji { font-size: 48px; }
.rh-meta { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.fav.on { color: var(--rose); }
.warn-line { color: var(--warn); font-size: 14px; font-weight: 600; margin: 6px 0; }
.ingredients { list-style: none; }
.ingredients li, .shop-check { display: flex; align-items: flex-start; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ingredients li.done, .shop-list li.done .shop-text { color: var(--muted); text-decoration: line-through; }
.check { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; }
.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.steps { list-style: none; counter-reset: s; }
.steps li { display: flex; gap: 12px; margin-bottom: 14px; }
.step-n { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: color-mix(in srgb, var(--phase) 25%, var(--surface)); }
.shop-list { list-style: none; margin-top: 10px; }
.shop-list li { display: flex; align-items: center; }
.shop-check { flex: 1; text-align: left; border-bottom: 0; }
.shop-list li { border-bottom: 1px solid var(--line); }
.shop-text small { display: block; font-size: 12px; color: var(--muted); text-decoration: none; }

/* Coach */
.coach { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tab-h) - 40px); }
.coach-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.coach-title { flex: 1; }
.coach-title h1 { font-size: 24px; }
.mira-avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; background: radial-gradient(circle at 35% 30%, #fff 0, color-mix(in srgb, var(--phase) 80%, #fff) 25%, var(--phase) 60%, var(--accent)); box-shadow: 0 6px 18px color-mix(in srgb, var(--phase) 45%, transparent); }
.mira-avatar.active { animation: breathe 1.6s ease-in-out infinite; }
.live-cta { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 20px; margin-bottom: 14px; background: linear-gradient(120deg, color-mix(in srgb, var(--phase) 28%, var(--surface)), color-mix(in srgb, var(--accent) 16%, var(--surface))); border: 1px solid var(--line); box-shadow: var(--shadow); }
.live-cta b { display: block; font-family: var(--serif); font-size: 17px; }
.live-cta small { color: var(--muted); font-size: 12px; }
.live-cta > span:nth-child(2) { flex: 1; }
.live-cta-orb { width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--phase) 50%, var(--accent)); animation: breathe 3s ease-in-out infinite; flex-shrink: 0; }
.chat { flex: 1; display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.bubble { max-width: 88%; padding: 12px 16px; border-radius: 20px; animation: fadeUp .25s ease both; position: relative; font-size: 15.5px; }
.bubble.me { align-self: flex-end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 6px; }
.bubble.mira { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow); padding-bottom: 14px; }
.bubble ul, .bubble ol { padding-left: 20px; margin: 6px 0; }
.bubble li { margin: 3px 0; }
.bubble p + ul, .bubble ul + p, .bubble ol + p { margin-top: 8px; }
.say-btn { position: absolute; right: 6px; bottom: -14px; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.chat-recipe { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 10px 12px; border-radius: 14px; text-align: left; background: color-mix(in srgb, var(--phase) 18%, var(--surface)); border: 1px solid var(--line); }
.cr-title { flex: 1; font-weight: 700; font-size: 14px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
.composer-wrap { position: sticky; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom)); padding-top: 8px; background: linear-gradient(transparent, var(--bg) 30%); z-index: 5; }
.quick { margin-bottom: 4px; }
.composer { display: flex; align-items: flex-end; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 5px; box-shadow: var(--shadow); }
.composer textarea { border: 0; background: transparent; resize: none; max-height: 140px; padding: 11px 6px; box-shadow: none !important; field-sizing: content; }
.composer .send { background: var(--ink); color: var(--bg); }
.composer .send:disabled { opacity: .3; }
.mic.rec { background: #B4424F; color: #fff; animation: breathe 1.2s ease-in-out infinite; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--ink); animation: spin .8s linear infinite; }

/* Live voice */
.live {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(800px 700px at 50% 35%, color-mix(in srgb, var(--phase) 45%, #1a1420), #120E16 75%);
  color: #F6EEF6; animation: fadeIn .35s ease;
}
.live-x { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; color: #F6EEF6; }
.live-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.orb { --lvl: 0; position: relative; width: 210px; height: 210px; display: grid; place-items: center; }
.orb-core {
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, color-mix(in srgb, var(--phase) 70%, #fff) 22%, var(--phase) 58%, #3B2A48 100%);
  box-shadow: 0 0 calc(40px + var(--lvl) * 80px) color-mix(in srgb, var(--phase) 70%, transparent);
  transform: scale(calc(1 + var(--lvl) * 0.22)); transition: transform .08s linear;
}
.orb.connecting .orb-core { animation: breathe 1.4s ease-in-out infinite; opacity: .8; }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--phase) 60%, transparent); animation: ripple 3.2s ease-out infinite; opacity: 0; }
.orb-ring.r2 { animation-delay: 1.6s; }
.orb.live .orb-ring { opacity: 1; }
.orb.error .orb-core { filter: grayscale(.7); opacity: .6; }
.live-name { font-family: var(--serif); font-size: 32px; margin-top: 12px; }
.live-status { font-size: 15px; opacity: .8; min-height: 22px; text-align: center; }
.live-status.err { color: #FFB4BE; opacity: 1; }
.live-note { font-size: 13px; opacity: .6; text-align: center; max-width: 280px; }
.live-lines { width: 100%; max-width: 480px; min-height: 110px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; margin-bottom: 14px; }
.live-lines p { font-size: 15px; line-height: 1.4; }
.live-lines p.me { text-align: right; color: #E6D6EE; font-style: italic; }
.live-recipe { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 480px; padding: 12px 14px; border-radius: 18px; background: rgba(255,255,255,.1); color: inherit; margin-bottom: 14px; text-align: left; animation: fadeUp .3s ease; }
.live-recipe > span:nth-child(2) { flex: 1; }
.live-recipe b { display: block; }
.live-recipe small { opacity: .7; }
.live-recipe-emoji { font-size: 28px; }
.live-actions { width: 100%; max-width: 480px; }
.live-actions .btn { width: 100%; }

/* Learn */
.phase-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 18px; }
.phase-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border-radius: 20px; text-align: left; background: linear-gradient(150deg, color-mix(in srgb, var(--phase) 30%, var(--surface)), var(--surface)); border: 1px solid var(--line); box-shadow: var(--shadow); }
.phase-tile svg { color: var(--phase); }
.phase-tile b { font-family: var(--serif); font-size: 16px; }
.phase-tile small { color: var(--muted); font-size: 12px; }
.phase-tile.now { outline: 2px solid var(--phase); outline-offset: 2px; }
.phase-tile.wide { width: 100%; margin: -6px 0 18px; }
.ring-sub { max-width: 170px; text-align: center; margin-top: 4px; }
.fold { padding: 0; overflow: hidden; }
.fold-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-align: left; min-height: 56px; }
.fold-title { flex: 1; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.fold-chev { color: var(--muted); transition: transform .25s; }
.fold.open .fold-chev { transform: rotate(180deg); }
.fold-body { padding: 0 18px 18px; animation: fadeUp .25s ease; }
.kb-list { padding-left: 18px; }
.kb-list li { margin: 6px 0; }
.herb { padding: 10px 0; border-bottom: 1px solid var(--line); }
.herb:last-child { border-bottom: 0; }
.phase-detail .pd-hero { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 20px; background: linear-gradient(135deg, color-mix(in srgb, var(--phase) 30%, var(--surface)), var(--surface)); }
.pd-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--phase); box-shadow: var(--shadow); }
.pd-mood { font-family: var(--serif); font-size: 19px; }
.nutrients { display: grid; gap: 8px; }
.nutrient { padding: 12px 14px; border-radius: 14px; background: var(--bg2); }
.nutrient p { font-size: 14px; margin-top: 2px; }

/* Me */
.history { list-style: none; }
.history li { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.history li > span:nth-child(2) { flex: 1; }
.history li svg { color: #9B4150; }
.mem-list { list-style: none; margin-bottom: 8px; }
.mem-list li { display: flex; align-items: center; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mem-list li span { flex: 1; font-size: 15px; }
.answer-list { list-style: none; }
.answer-list li { padding: 8px 0; }
.answer-list input { margin-top: 4px; }

/* Sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(20, 14, 26, .38); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s ease; }
.sheet { width: min(640px, 100%); max-height: 88dvh; background: var(--bg); border-radius: 28px 28px 0 0; display: flex; flex-direction: column; animation: sheetUp .32s cubic-bezier(.2,.9,.3,1); outline: none; box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
.sheet.tall { height: 92dvh; max-height: 92dvh; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 0; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px 6px 22px; }
.sheet-head h2 { flex: 1; font-size: 21px; }
.sheet-body { overflow-y: auto; padding: 4px 20px calc(28px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 26px + env(safe-area-inset-bottom)); z-index: 120; display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 16px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: toastIn .3s cubic-bezier(.2,.9,.3,1); }
.toast button { color: color-mix(in srgb, var(--phase) 60%, var(--bg)); font-weight: 800; white-space: nowrap; padding: 4px; }

/* Login / onboarding / splash */
.login, .splash, .onboarding { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 10px; }
.brand { font-size: 46px; }
.login-orb, .ob-orb { width: 120px; height: 120px; border-radius: 50%; margin-bottom: 14px; background: conic-gradient(from 200deg, #9B4150, #7FAE8A, #E9A866, #9886B8, #9B4150); filter: blur(.5px); animation: spin 18s linear infinite, breathe 5s ease-in-out infinite; box-shadow: 0 20px 50px rgba(110, 79, 122, .35); position: relative; }
.login-orb::after, .ob-orb::after { content: ''; position: absolute; inset: 16px; border-radius: 50%; background: var(--bg); opacity: .9; }
.login .seg, .ob-body .seg { width: 240px; }
.login-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; margin: 18px 0 6px; }
.onboarding { justify-content: space-between; padding-top: max(24px, env(safe-area-inset-top)); max-width: 520px; margin: 0 auto; }
.ob-progress { width: 100%; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.ob-progress span { display: block; height: 100%; background: var(--phase); transition: width .4s ease; }
.ob-back { position: absolute; top: max(36px, calc(env(safe-area-inset-top) + 16px)); left: 12px; }
.ob-body { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; animation: fadeUp .35s ease; }
.ob-body h2 { font-size: 26px; }
.ob-body .chip-wrap { justify-content: center; }
.ob-orb.done { animation: spin 6s linear infinite, breathe 2.5s ease-in-out infinite; }
.big-input { max-width: 340px; text-align: center; font-size: 20px !important; }
.ob-foot { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: env(safe-area-inset-bottom); }

/* Animations */
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.18); opacity: .75; } }
@keyframes ripple { from { transform: scale(.7); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.age-input { display: flex; align-items: center; justify-content: center; gap: 10px; }
.age-input input { width: 96px; font-size: 22px; text-align: center; }
.field .age-input { justify-content: flex-start; }
.ob-body .field > span { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--ink); margin-top: 18px; }
