:root {
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --surface-2: #EFECE5;
  --ink: #1B1A17;
  --muted: #7A766C;
  --line: #E5E1D8;
  --accent: #FF5B37;
  --accent-ink: #FFFFFF;
  --accent-soft: #FFE7DF;
  --good: #23935F;
  --good-soft: #DDF3E7;
  --warn: #C98400;
  --warn-soft: #FDF0D2;
  --p: #4D7CF3;
  --f: #F0A23A;
  --c: #2DB386;
  --shadow: 0 1px 2px rgba(30, 25, 15, .04), 0 12px 32px rgba(30, 25, 15, .08);
  --shadow-lg: 0 24px 60px rgba(30, 25, 15, .18);
  --r: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131311;
    --surface: #1C1B19;
    --surface-2: #262522;
    --ink: #F1EEE8;
    --muted: #9D988E;
    --line: #2F2E2A;
    --accent: #FF6A49;
    --accent-soft: #3B2219;
    --good: #45C487;
    --good-soft: #17301F;
    --warn: #F0B43C;
    --warn-soft: #33290F;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #131311;
  --surface: #1C1B19;
  --surface-2: #262522;
  --ink: #F1EEE8;
  --muted: #9D988E;
  --line: #2F2E2A;
  --accent: #FF6A49;
  --accent-soft: #3B2219;
  --good: #45C487;
  --good-soft: #17301F;
  --warn: #F0B43C;
  --warn-soft: #33290F;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 24px);
  position: relative;
}

/* ---------- top bar ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.top[hidden] { display: none; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease);
  flex: none;
}
.icon-btn:active { transform: scale(.9); }
.progress { flex: 1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .6s var(--ease); }
.step-label { font-size: 13px; color: var(--muted); font-weight: 600; min-width: 34px; text-align: right; }

/* ---------- screens & transitions ---------- */
.view { position: relative; overflow-x: clip; margin: 0 -16px; padding: 0 16px; }
html, body { overflow-x: clip; }
.screen { animation: enter-fwd .55s var(--ease) both; }
.screen.back { animation-name: enter-back; }
.screen.leaving { animation: leave .22s ease-in both; pointer-events: none; }
@keyframes enter-fwd { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@keyframes leave { to { opacity: 0; transform: scale(.98); } }

.stagger > * { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms + 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.1; }
.title { font-size: clamp(28px, 7.5vw, 36px); font-weight: 800; margin: 8px 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; font-size: 16px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 0 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 56px; padding: 0 26px;
  border-radius: 18px;
  font-weight: 700; font-size: 16px;
  background: var(--ink); color: var(--bg);
  transition: transform .2s var(--ease), opacity .2s, background .2s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.btn.text { background: none; color: var(--muted); height: 44px; padding: 0 12px; }
.btn.block { width: 100%; }
.cta {
  position: sticky; bottom: 0;
  padding: 18px 0 calc(env(safe-area-inset-bottom) + 8px);
  margin-top: 24px;
  background: linear-gradient(transparent, var(--bg) 35%);
  display: flex; gap: 10px; flex-direction: column;
  z-index: 5;
}

/* ---------- welcome ---------- */
.welcome { min-height: calc(100dvh - 40px); display: flex; flex-direction: column; justify-content: space-between; padding-top: 6vh; }
.hero-art { position: relative; height: 340px; margin: 0 -16px; overflow: hidden; }
.plate {
  position: absolute; left: 50%; top: 50%;
  width: 210px; height: 210px; margin: -105px 0 0 -105px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-lg), inset 0 0 0 14px var(--surface-2);
  display: grid; place-items: center;
  font-size: 84px;
  animation: float 6s ease-in-out infinite;
}
.orbit { position: absolute; left: 50%; top: 50%; width: 0; height: 0; animation: spin 26s linear infinite; }
.orbit span {
  position: absolute; font-size: 34px;
  translate: -50% -50%;
  transform: rotate(var(--a)) translateX(var(--d)) rotate(calc(var(--a) * -1));
}
@keyframes float { 50% { transform: translateY(-10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
.welcome .title { font-size: clamp(36px, 10vw, 48px); }
.welcome .title em { font-style: normal; color: var(--accent); }
.features { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.pill { font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 99px; background: var(--surface); box-shadow: var(--shadow); }

/* ---------- option cards (goal) ---------- */
.options { display: grid; gap: 12px; }
.option {
  display: flex; align-items: center; gap: 16px;
  text-align: left;
  padding: 18px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: transform .25s var(--ease), border-color .25s, background .25s;
}
.option:active { transform: scale(.98); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); }
.option .emoji {
  width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center; font-size: 30px;
  background: var(--surface-2); flex: none;
  transition: transform .4s var(--spring);
}
.option.selected .emoji { transform: rotate(-8deg) scale(1.08); }
.option b { display: block; font-size: 18px; }
.option small { color: var(--muted); font-size: 14px; }

/* ---------- budget ---------- */
.big-number { font-size: clamp(54px, 16vw, 72px); font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.big-number small { font-size: 24px; color: var(--muted); font-weight: 700; letter-spacing: 0; }
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: none; margin: 14px 0 0; }
.range::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--pct), var(--surface-2) var(--pct)); }
.range::-moz-range-track { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--pct), var(--surface-2) var(--pct)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -11px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); box-shadow: var(--shadow); transition: transform .2s var(--spring); }
.range::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.range:active::-webkit-slider-thumb { transform: scale(1.2); }
.range-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; }
.hint { font-size: 14px; color: var(--muted); margin-top: 10px; }
.hint b { color: var(--ink); }

.stepper-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.stepper-row + .stepper-row { border-top: 1px solid var(--line); }
.stepper-row b { display: block; }
.stepper-row small { color: var(--muted); font-size: 13px; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 16px; padding: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 12px; font-size: 22px; font-weight: 600; transition: background .2s, transform .15s; }
.stepper button:active { transform: scale(.88); background: var(--surface); }
.stepper button:disabled { opacity: .3; }
.stepper output { min-width: 30px; text-align: center; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.bump { animation: bump .35s var(--spring); }
@keyframes bump { 40% { transform: scale(1.35); } }

/* ---------- calc ---------- */
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); padding: 4px; border-radius: 16px; position: relative; }
.segmented button { height: 44px; border-radius: 12px; font-weight: 700; position: relative; z-index: 1; color: var(--muted); transition: color .3s; }
.segmented button.on { color: var(--ink); }
.segmented .thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); transition: transform .35s var(--ease); }
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.field { background: var(--surface-2); border-radius: 16px; padding: 10px 12px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; display: block; }
.field input { width: 100%; border: 0; background: none; font-size: 22px; font-weight: 800; outline: none; padding: 0; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 14px; border-radius: 99px;
  background: var(--surface); box-shadow: var(--shadow);
  font-weight: 600; font-size: 14px;
  border: 1.5px solid transparent;
  transition: transform .2s var(--spring), background .2s, border-color .2s, color .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:active { transform: scale(.94); }
.chip.on { background: var(--ink); color: var(--bg); }
.chip.exclude.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip .count { font-size: 12px; opacity: .55; }
.kcal-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.kcal-result .hint { line-height: 1.35; }
.kcal-result .big { font-size: 34px; font-weight: 800; letter-spacing: -.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.activity-list { display: grid; gap: 8px; }
.activity-list .chip { justify-content: flex-start; text-align: left; border-radius: 14px; box-shadow: none; background: var(--surface-2); }
.activity-list .chip.on { background: var(--ink); }

/* ---------- cuisines ---------- */
.group { margin-bottom: 14px; }
.group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.group-head h3 { font-size: 20px; display: flex; gap: 8px; align-items: center; }
.toggle-all { font-size: 13px; font-weight: 700; color: var(--accent); padding: 6px 4px; }
.text-input {
  width: 100%; height: 54px; border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--surface); padding: 0 16px; font-size: 16px; outline: none;
  transition: border-color .2s;
}
.text-input:focus { border-color: var(--accent); }

/* ---------- swipe ---------- */
.swipe-screen { display: flex; flex-direction: column; min-height: calc(100dvh - 90px); }
.deck { position: relative; flex: none; height: clamp(300px, calc(100dvh - 300px), 560px); margin: 8px 0 18px; }
.swipe-card {
  position: absolute; inset: 0;
  border-radius: 28px; overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-lg);
  touch-action: none; user-select: none;
  transition: transform .45s var(--ease), opacity .3s;
  will-change: transform;
}
.swipe-card.dragging { transition: none; }
.swipe-card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.swipe-card .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.78) 100%); }
.swipe-card .info { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px; color: #fff; }
.swipe-card h2 { font-size: 28px; font-weight: 800; margin-bottom: 8px; text-wrap: balance; }
.swipe-card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.swipe-card .meta span { font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 99px; background: rgba(255,255,255,.18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.stamp {
  position: absolute; top: 28px; padding: 6px 14px;
  border: 4px solid; border-radius: 14px;
  font-size: 30px; font-weight: 800; letter-spacing: .04em;
  opacity: 0; transform: scale(.8);
}
.stamp.like { left: 22px; color: #3BE08F; transform: rotate(-14deg); }
.stamp.nope { right: 22px; color: #FF5B5B; transform: rotate(14deg); }
.swipe-actions { display: flex; justify-content: center; align-items: center; gap: 18px; }
.round {
  width: 68px; height: 68px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center;
  transition: transform .25s var(--spring);
}
.round:active { transform: scale(.86); }
.round.small { width: 48px; height: 48px; }
.round.nope { color: #FF5B5B; }
.round.like { color: #2BC47A; }
.round svg { width: 30px; height: 30px; }
.round.small svg { width: 22px; height: 22px; color: var(--muted); }
.swipe-counter { text-align: center; font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 12px; }
.deck-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); }

/* ---------- image placeholder / skeleton ---------- */
.img-wrap { position: relative; background: var(--surface-2); overflow: hidden; }
.img-wrap::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.img-wrap.loaded::before { display: none; }
.img-wrap img { opacity: 0; transition: opacity .5s; }
.img-wrap.loaded img { opacity: 1; }
.img-wrap.failed { background: radial-gradient(circle at 30% 20%, var(--accent-soft), var(--surface-2) 70%); }
.img-wrap.failed::after { content: attr(data-emoji); position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; }
.img-wrap .credit {
  position: absolute; right: 8px; bottom: 8px; z-index: 1;
  font-size: 10px; font-weight: 600; color: #fff;
  padding: 3px 7px; border-radius: 99px; background: rgba(0, 0, 0, .45);
  display: none;
}
.img-wrap.is-alt .credit { display: block; }
.swipe-card .img-wrap { position: absolute; inset: 0; }
.swipe-card .img-wrap .credit { top: 76px; bottom: auto; right: 16px; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* ---------- loading ---------- */
.loading { min-height: 80dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 28px; }
.pan { position: relative; width: 120px; height: 120px; }
.pan span { position: absolute; font-size: 40px; left: 40px; top: 40px; animation: toss 1.6s var(--ease) infinite; }
.pan span:nth-child(2) { animation-delay: .25s; }
.pan span:nth-child(3) { animation-delay: .5s; }
@keyframes toss {
  0% { transform: translate(0, 30px) rotate(0) scale(.6); opacity: 0; }
  30% { opacity: 1; }
  50% { transform: translate(var(--x, 0), -40px) rotate(180deg) scale(1); }
  100% { transform: translate(0, 30px) rotate(360deg) scale(.6); opacity: 0; }
}
.loading-text { font-size: 18px; font-weight: 700; min-height: 1.5em; }
.loading-text span { display: inline-block; animation: rise .4s var(--ease) both; }

/* ---------- result ---------- */
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.stat { background: var(--surface); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.stat b { font-size: 24px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat b i { font-style: normal; font-size: 14px; color: var(--muted); font-weight: 700; }
.stat.wide { grid-column: span 2; }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.meter div { height: 100%; width: 0; border-radius: 99px; background: var(--good); transition: width 1.1s var(--ease) .2s; }
.meter.over div { background: var(--warn); }
.note { margin-top: 12px; padding: 12px 14px; border-radius: 16px; background: var(--warn-soft); color: var(--ink); font-size: 14px; }

.days {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 20px -16px 0; padding: 12px 16px;
  background: linear-gradient(var(--bg) 80%, transparent);
  scroll-snap-type: x proximity;
}
.days::-webkit-scrollbar { display: none; }
.day-tab {
  flex: none; scroll-snap-align: center;
  min-width: 64px; padding: 10px 12px; border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow);
  text-align: center; transition: background .3s, color .3s, transform .2s var(--spring);
}
.day-tab:active { transform: scale(.94); }
.day-tab b { display: block; font-size: 15px; }
.day-tab small { font-size: 11px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.day-tab.on { background: var(--ink); color: var(--bg); }
.day-tab.on small { color: inherit; opacity: .7; }

.day-summary { display: flex; align-items: center; gap: 18px; padding: 18px; margin-top: 4px; }
.ring { position: relative; width: 104px; height: 104px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .track { stroke: var(--surface-2); }
.ring .val { stroke: var(--accent); transition: stroke-dashoffset 1.2s var(--ease); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.05; }
.ring .center b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ring .center small { font-size: 11px; color: var(--muted); font-weight: 600; }
.macros { flex: 1; display: grid; gap: 9px; min-width: 0; }
.macro { display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.macro .bar { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.macro .bar div { height: 100%; width: 0; border-radius: 99px; transition: width 1s var(--ease) .15s; }
.macro span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); }

.meals { display: grid; gap: 14px; margin-top: 14px; }
.meal {
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow);
  overflow: hidden; text-align: left; width: 100%;
  transition: transform .25s var(--ease);
}
.meal:active { transform: scale(.985); }
.meal .img-wrap { aspect-ratio: 16 / 10; }
.meal .img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.meal .over { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; justify-content: space-between; z-index: 1; }
.tag { font-size: 12px; font-weight: 800; padding: 6px 10px; border-radius: 99px; background: rgba(255,255,255,.92); color: #1B1A17; backdrop-filter: blur(6px); }
.tag.kcal { background: var(--accent); color: #fff; }
.meal-body { padding: 14px 16px 16px; }
.meal-body h3 { font-size: 19px; font-weight: 800; margin-bottom: 6px; text-wrap: balance; }
.meal-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); font-weight: 600; }
.kbju { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.kbju span { font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 10px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.kbju .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.meal-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--accent); text-decoration: none; padding: 8px 0; }
.liked { color: var(--accent); }

.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 26px; }
.footer-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 18px; }

/* ---------- sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 8, 5, .45); opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 40; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 560px; margin: 0 auto;
  max-height: 92dvh;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  transform: translateY(105%);
  transition: transform .45s var(--ease);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.sheet.open { transform: none; }
.sheet.dragging { transition: none; }
.sheet-grip { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 10px auto; flex: none; }
.sheet-body { overflow-y: auto; padding: 0 16px calc(env(safe-area-inset-bottom) + 24px); overscroll-behavior: contain; }
.sheet .img-wrap { border-radius: 22px; aspect-ratio: 4 / 3; }
.sheet .img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.sheet h2 { font-size: 26px; font-weight: 800; margin: 16px 0 6px; }
.sheet .desc { color: var(--muted); margin: 8px 0 0; font-size: 15px; }
.nutri { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.nutri div { background: var(--surface); border-radius: 16px; padding: 10px 6px; text-align: center; box-shadow: var(--shadow); }
.nutri b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nutri small { font-size: 11px; color: var(--muted); font-weight: 700; }
.nutri .k b { color: var(--accent); }
.per100 { font-size: 13px; color: var(--muted); margin-top: 8px; text-align: center; }
.ingredients { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); }
.ingredients li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; font-size: 15px; }
.ingredients li + li { border-top: 1px solid var(--line); }
.ingredients li span:last-child { color: var(--muted); font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); z-index: 60;
  transform: translate(-50%, 140%);
  background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px;
  transition: transform .4s var(--ease), opacity .3s, visibility .4s;
  max-width: calc(100vw - 32px);
  opacity: 0; visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

@media (min-width: 600px) {
  .app { padding-top: 24px; }
  .meals { grid-template-columns: 1fr 1fr; }
  .meal-body h3 { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- cook time ---------- */
.option .option-text { flex: 1; min-width: 0; }
.option-count { flex: none; text-align: right; line-height: 1.1; }
.option-count b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.option-count small { font-size: 12px; }
.meal .over .tags { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.tag.quick { background: var(--good); color: #fff; }
.result-head .badge + .badge { margin-left: 6px; }
.badge.soft { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- sub screens (cart, search) ---------- */
.top.plain .progress { visibility: hidden; }
.top.plain .step-label { font-size: 15px; color: var(--ink); font-weight: 800; }
.still, .still .stagger > *, .still .screen { animation: none !important; }
body.busy { cursor: progress; }
body.busy #view { opacity: .6; pointer-events: none; transition: opacity .2s; }
.empty { color: var(--muted); text-align: center; padding: 28px 20px; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.quick-actions .btn { height: 50px; padding: 0 12px; }
.day-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-foot .link-btn { padding: 0; font-size: 13px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-actions .btn { height: 50px; padding: 0 10px; font-size: 15px; }

/* cart */
.cart-range { margin-top: 0; position: static; }
.cart-range .day-tab { min-width: 70px; }
.cart-summary { display: grid; gap: 12px; margin-top: 4px; }
.cart-total { font-size: 32px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 2px 0; }
.cart-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.cart-list li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; user-select: none; transition: background .2s, opacity .2s; }
.cart-list li + li { border-top: 1px solid var(--line); }
.cart-list li:active { background: var(--surface-2); }
.cart-list .check { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; transition: background .2s, border-color .2s; }
.cart-list li.done .check { background: var(--good); border-color: var(--good); }
.cart-list li.done .check::after { content: ""; width: 10px; height: 5px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.cart-list li.done { opacity: .5; }
.cart-list li.done .cart-name b { text-decoration: line-through; }
.cart-name { min-width: 0; }
.cart-name b { display: block; font-size: 15px; }
.cart-name small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-qty { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cart-qty b { display: block; font-size: 14px; }
.cart-qty small { color: var(--muted); font-size: 12px; }

/* search */
.search-box { position: sticky; top: 64px; z-index: 6; padding: 4px 0 8px; background: var(--bg); }
.search-box .text-input { -webkit-appearance: none; appearance: none; }
.search-slots { margin: 4px 0 14px; }
.search-results { display: grid; gap: 10px; }
.search-item { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 8px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); transition: transform .2s var(--ease); }
.search-item:active { transform: scale(.98); }
.search-item .img-wrap { width: 76px; height: 76px; border-radius: 12px; }
.search-item .img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.search-item .img-wrap.failed::after { font-size: 30px; }
.search-item .img-wrap .credit { display: none !important; }
.search-text { min-width: 0; display: grid; gap: 2px; }
.search-text b { font-size: 15px; line-height: 1.25; }
.search-text small { color: var(--muted); font-size: 12px; font-weight: 600; }
.add-to-plan { display: grid; gap: 12px; }
.add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.add-row label { font-size: 12px; font-weight: 700; color: var(--muted); display: grid; gap: 4px; }
.add-row select { height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 700; padding: 0 10px; }

/* cart: view switch + share */
.cart-tools { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-top: 14px; }
.cart-tools .btn { height: 52px; padding: 0 16px; }
.cart-view button { height: 44px; font-size: 14px; }
.cart-group-title b { display: block; text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--ink); margin-top: 2px; }
.share-link { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 16px; }
.share-link .btn { height: 54px; }
.share-targets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.share-targets .btn { height: 50px; text-decoration: none; }
@media (max-width: 360px) { .cart-tools { grid-template-columns: 1fr; } }
