:root {
  --bg: #fff7ef;
  --surface: #ffffff;
  --surface-2: #fbefe3;
  --text: #2b211c;
  --muted: #8a796d;
  --line: #f0e1d2;
  --brand: #e2560e;
  --brand-ink: #ffffff;
  --brand-soft: #ffe7d4;
  --teal: #2f8a8a;
  --good: #2f9e44;
  --bad: #c92a2a;
  --warn: #d9480f;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(120 60 20 / .06), 0 6px 20px rgb(120 60 20 / .07);
  --nav-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --round: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1715;
    --surface: #262120;
    --surface-2: #302927;
    --text: #f3ebe4;
    --muted: #a89a8f;
    --line: #3b3330;
    --brand: #ff8c42;
    --brand-ink: #2a1205;
    --brand-soft: #3d2618;
    --teal: #5cc0c0;
    --good: #69db7c;
    --bad: #ff8787;
    --warn: #ffa94d;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
}
body.sheet-open { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, .brand, .bottomnav, .btn, .chip { font-family: var(--round); }
h1 { font-size: 1.45rem; line-height: 1.2; margin: 0 0 2px; }
h2 { font-size: 1.08rem; margin: 0; }
h3 { font-size: .9rem; margin: 18px 0 6px; color: var(--muted); font-weight: 700; }
h3 small { font-weight: 600; opacity: .7; margin-left: 4px; }
img { display: block; max-width: 100%; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
/* iOS zooms into any focused field below 16px and leaves the page zoomed and shifted afterwards. */
@media (max-width: 899px) { input, select, textarea { font-size: 16px; } }
textarea { resize: vertical; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; justify-content: center; }
.danger-text { color: var(--bad) !important; }
.late-text { color: var(--warn); font-weight: 600; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.row.end { justify-content: flex-end; }
.stack { display: grid; gap: 14px; }
.stack label, .field { display: grid; gap: 6px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.field .lbl b { color: var(--text); }
.stack label > input, .stack label > select, .stack label > textarea, .field input, .field select { color: var(--text); font-weight: 400; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pad { padding-left: 16px; padding-right: 16px; }
.hint { margin: -8px 0 0; }
.check-label { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.check-label input { width: 22px; height: 22px; accent-color: var(--brand); }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; min-height: 44px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
  font-weight: 700; white-space: nowrap; transition: transform .1s;
}
.btn:active { transform: scale(.96); }
.btn.small { padding: 6px 13px; min-height: 36px; font-size: .88rem; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 4px 14px rgb(226 86 14 / .25); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.round { width: 48px; height: 48px; padding: 0; font-size: 1.5rem; flex: none; }
.btn:disabled { opacity: .6; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.3rem; line-height: 1; flex: none; }
.link-btn { background: none; border: 0; color: var(--muted); font-weight: 700; cursor: pointer; padding: 8px 0; font-family: var(--round); }
.add-line { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 2px 2px; color: var(--brand); font-weight: 700; cursor: pointer; font-family: var(--round); }

/* ---------- chrome */
.topbar {
  position: sticky; top: 0; z-index: 900;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 8px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 800; font-size: 1.15rem; }
.brand img { width: 36px; height: 36px; }
.tabs { display: none; gap: 2px; margin-left: 12px; }
.tabs a { padding: 7px 12px; border-radius: 999px; color: var(--muted); font-weight: 700; font-family: var(--round); font-size: .92rem; }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.me-btn { margin-left: auto; display: flex; }
.me-btn .av { width: 34px; height: 34px; font-size: .95rem; }
.me-btn.active .av { box-shadow: 0 0 0 3px var(--brand-soft), 0 0 0 5px var(--brand); }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: .72rem; font-weight: 700; color: var(--muted); }
.bottomnav a .ico { font-size: 1.35rem; filter: grayscale(1); opacity: .6; transition: transform .2s; }
.bottomnav a.active { color: var(--brand); }
.bottomnav a.active .ico { filter: none; opacity: 1; transform: translateY(-2px) scale(1.1); }
.view { max-width: 760px; margin: 0 auto; }

@media (min-width: 700px) {
  .cal-cell { aspect-ratio: auto; height: 56px; }
}

@media (min-width: 900px) {
  body { padding-bottom: 32px; }
  .tabs { display: flex; }
  .bottomnav { display: none; }
}

/* ---------- avatars */
.av { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 800; font-size: .78rem; font-family: var(--round); flex: none; }
.av.sm { width: 22px; height: 22px; font-size: .68rem; }
.av-pair { display: inline-flex; flex: none; }
.av-pair .av + .av { margin-left: -8px; box-shadow: -2px 0 0 var(--surface); }

/* ---------- cards & lists */
.card { background: var(--surface); margin: 14px 16px 0; padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); }
.card h2 { margin-bottom: 6px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.card-head a { font-weight: 700; font-size: .85rem; font-family: var(--round); }
.sub-head { margin: 12px 0 2px; font-size: .8rem; color: var(--muted); font-weight: 700; }
.empty-line { margin: 6px 0; }
.empty { text-align: center; padding: 40px 24px; color: var(--muted); }
.empty img { margin: 0 auto 12px; opacity: .9; }
.small-empty { padding: 16px; }
.group { margin: 0 16px; }
.group.late h3 { color: var(--warn); }
.group.today h3 { color: var(--brand); }
.done-group { margin-top: 12px; }
.plain-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.plain-list li { display: flex; align-items: center; gap: 8px; }

.hello { display: flex; align-items: center; gap: 14px; padding: 12px 16px 2px; }
.hello-fox { width: 78px; height: 78px; flex: none; animation: fox-hop 1s ease .3s 1; }
.hello p { margin: 0; }
.fox-tip { margin-top: 4px !important; font-size: .9rem; background: var(--brand-soft); padding: 4px 10px; border-radius: 10px 10px 10px 2px; display: inline-block; }
@keyframes fox-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px) rotate(-6deg); } }

.row-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: 0; }
.group .row-item, .agenda-day .row-item { background: var(--surface); border: 0; border-radius: 14px; padding: 10px 12px; margin-bottom: 6px; box-shadow: var(--shadow); }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; background: none; border: 0; padding: 2px 0; cursor: pointer; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-meta { font-size: .8rem; color: var(--muted); }
.check {
  width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--brand) 60%, var(--line));
  background: var(--surface); cursor: pointer; position: relative; padding: 0;
}
.check:active { transform: scale(.85); }
.is-done .check { background: var(--good); border-color: var(--good); }
.is-done .check::after { content: ''; position: absolute; left: 7px; top: 3px; width: 7px; height: 12px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.is-done .row-title { text-decoration: line-through; color: var(--muted); }

/* ---------- quick add */
.quick { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 6px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 52px); z-index: 50; background: var(--bg); }
.quick input { flex: 1; min-width: 0; border-radius: 999px; padding-left: 18px; min-height: 48px; box-shadow: var(--shadow); border-color: transparent; }
.quick input:focus { border-color: var(--brand); }
.quick-preview { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.quick-preview:empty { display: none; }
.pchip { font-size: .8rem; background: var(--brand-soft); color: var(--text); border-radius: 999px; padding: 3px 10px; font-weight: 600; }

/* ---------- chips & segments */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.small .chip { padding: 5px 11px; font-size: .8rem; }
.chip {
  padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface);
  cursor: pointer; font-weight: 700; font-size: .86rem; white-space: nowrap; color: var(--text);
}
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip small { opacity: .6; margin-left: 2px; }
.seg-tabs { display: flex; gap: 4px; margin: 10px 16px 0; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.seg-tabs a { flex: 1; text-align: center; padding: 8px 6px; border-radius: 999px; color: var(--muted); font-weight: 700; font-family: var(--round); font-size: .9rem; }
.seg-tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-radio { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-radio label { display: block; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; font-family: var(--round); }
.seg-radio input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.seg-radio input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.repeat-row { display: flex; gap: 10px; align-items: center; }
.repeat-row select { flex: 1; }
.repeat-row .inline { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.repeat-row .inline input { width: 72px; }

/* ---------- meals */
.meal-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 9px 0; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; text-align: right; }
.meal-line:last-child { border-bottom: 0; }
.meal-line > span:first-child { text-align: left; flex: none; }
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 16px 0; text-align: center; font-family: var(--round); }
.week { padding: 6px 12px; }
.week-day { display: flex; gap: 12px; align-items: stretch; padding: 6px 0; border-bottom: 1px solid var(--line); }
.week-day:last-child { border-bottom: 0; }
.week-day.past { opacity: .55; }
.wd { width: 44px; flex: none; display: grid; place-content: center; text-align: center; font-family: var(--round); line-height: 1.15; }
.wd span { font-size: .78rem; color: var(--muted); }
.week-day.is-today .wd { background: var(--brand); color: var(--brand-ink); border-radius: 12px; }
.week-day.is-today .wd span { color: inherit; opacity: .85; }
.slots { flex: 1; display: grid; gap: 6px; min-width: 0; }
.slots.two { grid-template-columns: 1fr 1fr; }
.slot { display: grid; text-align: left; gap: 0; padding: 10px 12px; border-radius: 12px; border: 1.5px dashed var(--line); background: transparent; cursor: pointer; min-height: 46px; font-weight: 600; }
.slot.set { border-style: solid; border-color: transparent; background: var(--surface-2); }
.slot small { font-size: .7rem; font-weight: 700; }
.pick-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 12px 4px; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; font-weight: 600; }
.search { margin-top: 12px; }
#meal-list { max-height: 45vh; overflow-y: auto; margin-top: 6px; }

.dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 14px 16px 0; }
.dish { display: grid; gap: 4px; align-content: start; text-align: left; padding: 10px; border-radius: var(--radius); border: 0; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; }
.dish img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; }
.dish-emoji { display: grid; place-items: center; aspect-ratio: 4 / 3; font-size: 2.6rem; background: var(--surface-2); border-radius: 12px; }
.dish-img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 14px; margin-bottom: 12px; }
.ingredients { padding-left: 20px; margin: 0 0 10px; }
.ingredients li { padding: 2px 0; }
.steps { line-height: 1.6; }
.emoji-name { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
.emoji-name input:first-child { text-align: center; font-size: 1.4rem; }

/* ---------- shopping */
.shop-tools { margin-top: 6px; }
.sugg .chip { font-weight: 600; background: var(--surface-2); border-color: transparent; }
.shop-list { margin: 12px 16px 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2px 6px 6px 14px; }
.shop-cat + .shop-cat { border-top: 6px solid var(--bg); margin: 0 -6px 0 -14px; padding: 0 6px 0 14px; }
.shop-cat h3 { margin: 12px 0 0; display: flex; align-items: center; gap: 6px; font-size: .8rem; }
.shop-cat h3 .btn { margin-left: auto; }
.shop-item { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.shop-item:last-child { border-bottom: 0; }
.shop-tap { flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 52px; background: none; border: 0; text-align: left; cursor: pointer; min-width: 0; }
.shop-tap .check { pointer-events: none; }
.shop-name { font-size: 1.05rem; font-weight: 600; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.qty { font-size: .8rem; background: var(--brand-soft); padding: 1px 8px; border-radius: 999px; font-weight: 700; }
.for { flex-basis: 100%; }
.more { width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; flex: none; }
.in-cart { opacity: .75; }
.in-cart .shop-name { text-decoration: line-through; color: var(--muted); }
.shop-peek { margin: 4px 0; line-height: 1.7; }

/* ---------- cleaning */
.fair-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; gap: 3px; margin: 10px 0 8px; }
.fair-bar i { background: var(--c); min-width: 6px; transition: flex .4s; }
.fair-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.fair-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dirt { display: block; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 4px 0 2px; max-width: 260px; }
.dirt i { display: block; height: 100%; background: hsl(var(--h) 70% 48%); border-radius: inherit; transition: width .4s; }
.effort { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); margin-left: 3px; vertical-align: middle; opacity: .6; }
.done-btn { width: 44px; height: 44px; padding: 0; font-size: 1.1rem; color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.chore.due .done-btn { background: var(--good); color: #fff; border-color: var(--good); }

/* ---------- calendar */
.cal { padding: 12px; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-head h2 { flex: 1; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 700; padding-bottom: 4px; }
.cal-cell { aspect-ratio: 1 / .9; border: 0; background: none; border-radius: 12px; display: grid; align-content: center; justify-items: center; gap: 2px; cursor: pointer; font-weight: 600; padding: 0; }
.cal-cell.other { color: var(--muted); opacity: .5; }
.cal-cell.today span:first-child { color: var(--brand); font-weight: 800; }
.cal-cell.sel { background: var(--brand); color: var(--brand-ink); }
.cal-cell.sel.today span:first-child { color: var(--brand-ink); }
.dots { display: flex; gap: 2px; height: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.dots .task-dot { background: transparent; border: 1.5px solid currentColor; opacity: .6; }
.cal-cell.sel .dots i { box-shadow: 0 0 0 1.5px var(--brand-ink); }
.agenda { padding: 0 16px; }
.agenda-day h3 { margin-top: 16px; }
.agenda-day.is-today h3 { color: var(--brand); }
.ev-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 6px; border: 0; border-left: 4px solid var(--c); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; }
.card .ev-row { box-shadow: none; background: var(--surface-2); }
.ev-row.muted-row { opacity: .7; }
.ev-time { width: 66px; flex: none; font-size: .82rem; font-weight: 700; color: var(--muted); font-family: var(--round); }
.ev-main { flex: 1; min-width: 0; display: grid; }
.ev-main b { font-weight: 650; overflow-wrap: anywhere; }
.ev-icons { display: flex; align-items: center; gap: 4px; font-size: .8rem; flex: none; }

/* ---------- ideas */
.ideas { display: grid; gap: 10px; padding: 12px 16px 0; }
.idea { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.card .idea { box-shadow: none; padding: 0; }
.idea.match { box-shadow: 0 0 0 2px #f783ac, var(--shadow); }
.card .idea.match { box-shadow: none; }
.idea-main { display: flex; gap: 12px; align-items: center; width: 100%; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.idea-emoji { font-size: 1.8rem; width: 48px; height: 48px; flex: none; display: grid; place-items: center; background: var(--surface-2); border-radius: 14px; }
.idea-text { display: grid; gap: 2px; min-width: 0; }
.idea-actions { display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.likes { display: inline-flex; gap: 2px; background: var(--surface-2); border: 0; border-radius: 999px; padding: 6px 10px; cursor: pointer; margin-right: auto; }
.likes i { font-style: normal; font-size: 1.15rem; color: var(--line); transition: transform .2s; }
.likes i.on { color: var(--c); transform: scale(1.15); }
.memories { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.memories li { display: grid; gap: 1px; border-left: 3px solid var(--brand-soft); padding-left: 10px; }
.stars { color: #f59f00; }
.random-idea { text-align: center; padding: 8px 0; }
.random-idea img { margin: 0 auto; }
.random-idea h2 { font-size: 1.4rem; margin: 6px 0; }
.hop { animation: fox-hop .6s ease 2; }
.chips.center { justify-content: center; margin-top: 14px; }

/* ---------- sheets, toasts, fox */
.sheet-wrap { position: fixed; inset: 0; z-index: 2000; background: rgb(40 20 10 / .4); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
.sheet-wrap.show { opacity: 1; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 24px 24px 0 0; padding: 20px 18px calc(24px + var(--safe-b));
  transform: translateY(40px); transition: transform .25s cubic-bezier(.2, 1, .3, 1);
}
.sheet::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); }
.sheet-wrap.show .sheet { transform: none; }
.sheet h2 { margin: 4px 40px 14px 0; font-size: 1.25rem; }
.sheet-close { position: absolute; right: 12px; top: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 24px; }
}
.toast {
  position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; max-width: 480px; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 3000;
  transform: translateY(20px); opacity: 0; transition: .25s;
  display: flex; align-items: center; gap: 12px;
  background: #2b211c; color: #fff; padding: 11px 16px; border-radius: 14px; font-weight: 600; box-shadow: 0 8px 24px rgb(0 0 0 / .2);
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #a61e1e; }
.toast.good { background: #2b6b3a; }
.toast button { background: rgb(255 255 255 / .18); color: #fff; border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.spin { width: 16px; height: 16px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.fox-say { position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; max-width: 460px; bottom: calc(var(--nav-h) + var(--safe-b) + 80px); transform: translateY(30px); opacity: 0; z-index: 2500; display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: 0 8px 30px rgb(0 0 0 / .18); border: 1px solid var(--line); transition: transform .35s cubic-bezier(.2, 1.4, .4, 1), opacity .3s; font-weight: 600; font-family: var(--round); }
.fox-say.show { transform: none; opacity: 1; }
.fox-say img { flex: none; animation: fox-hop .6s ease 2; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2400; }
.update-bar { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 60px); left: 16px; right: 16px; margin: 0 auto; width: fit-content; z-index: 1000; background: var(--surface); box-shadow: var(--shadow); border-radius: 999px; padding: 6px 6px 6px 16px; display: flex; gap: 10px; align-items: center; font-weight: 600; white-space: nowrap; }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 360px; background: var(--surface); padding: 28px 24px; border-radius: 24px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.login-box .login-logo { width: 220px; height: auto; margin: 0 auto 6px; }
.login-box label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.login-error { color: var(--bad); margin: 0; text-align: center; }

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

/* ---------- discover: swiping new recipes */
.seg-tabs a { position: relative; white-space: nowrap; }
.seg-tabs .count { position: absolute; top: -6px; right: 2px; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: .7rem; }
.swipe-view { max-width: 480px; margin: 0 auto; padding: 8px 16px 8px; display: grid; gap: 12px; }
.swipe-stage { position: relative; display: grid; touch-action: none; }
/* Transformed cards paint above plain ones, so the order has to be set explicitly. */
.swipe-stage > .rc { grid-area: 1 / 1; position: relative; z-index: 2; }
.swipe-stage > .rc-next { z-index: 1; position: absolute; inset: 0; }
.rc { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; user-select: none; -webkit-user-select: none; cursor: grab; transition: transform .25s ease; display: flex; flex-direction: column; }
.rc:active { cursor: grabbing; }
.rc-next { transform: scale(.95) translateY(12px); opacity: .7; pointer-events: none; }
.rc-next .rc-body { visibility: hidden; }
.rc-img { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); }
.rc-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.rc-src { position: absolute; left: 12px; bottom: 12px; background: rgb(0 0 0 / .55); color: #fff; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; backdrop-filter: blur(6px); }
.rc-body { padding: 14px 16px 16px; display: grid; gap: 8px; }
.rc-body h2 { font-size: 1.2rem; line-height: 1.25; margin: 0; }
.rc-body p { margin: 0; }
.rc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-chips span { font-size: .78rem; font-weight: 700; background: var(--surface-2); border-radius: 999px; padding: 3px 10px; }
.rc-why { font-size: .88rem; color: var(--teal); font-weight: 600; }
.rc-partner { font-size: .88rem; font-weight: 700; color: #d6336c; }
.rc-more summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .88rem; }
.rc-more ul { margin: 8px 0; padding-left: 18px; font-size: .9rem; columns: 2; column-gap: 18px; }
.rc-more a { font-size: .88rem; font-weight: 600; }
.swipe-stamp { position: absolute; top: 16px; right: 16px; padding: 6px 14px; border-radius: 12px; border: 3px solid currentColor; font-weight: 800; font-size: 1.2rem; opacity: 0; transform: rotate(10deg); background: rgb(255 255 255 / .9); font-family: var(--round); }
.swipe-stamp.on { opacity: 1; }
.swipe-stamp.like { color: #2b8a3e; }
.swipe-stamp.super { color: #e67700; right: auto; left: 50%; transform: translateX(-50%); }
.swipe-stamp.nope { color: #c92a2a; left: 16px; right: auto; transform: rotate(-10deg); }
.swipe-btns { display: flex; justify-content: center; align-items: center; gap: 20px; }
.swipe-btn { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 1.6rem; cursor: pointer; transition: transform .1s; }
.swipe-btn:active { transform: scale(.88); }
.swipe-btn.nope { color: #c92a2a; font-weight: 800; }
.swipe-btn.super { width: 52px; height: 52px; font-size: 1.3rem; }
.swipe-btn.like { width: 72px; height: 72px; font-size: 1.9rem; }
.swipe-done { text-align: center; padding: 28px 24px 8px; display: grid; gap: 10px; justify-items: center; }
.swipe-done h2 { font-size: 1.3rem; }
.swipe-done p { margin: 0; max-width: 420px; }
.mini-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mini-list.decided li > span { min-width: 0; }
.taste { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.taste li { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 10px; font-weight: 600; font-size: .9rem; }
.tbar { position: relative; height: 10px; background: var(--surface-2); border-radius: 999px; }
.tbar::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: var(--line); }
.tbar i { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.tbar i.pos { left: 50%; background: var(--good); }
.tbar i.neg { right: 50%; background: var(--bad); opacity: .75; }
.settings-card summary { cursor: pointer; list-style: none; }
.settings-card summary::-webkit-details-marker { display: none; }
.settings-card summary h2::after { content: ' ▾'; color: var(--muted); }
.settings-card[open] summary { margin-bottom: 12px; }
.source-list { display: grid; gap: 2px; }
.source-list .check-label { margin-top: 4px; color: var(--text); font-weight: 600; }
.warn-text { color: var(--warn); }
.discover-teaser { display: flex; align-items: center; gap: 14px; color: var(--text); background: linear-gradient(120deg, var(--surface), var(--brand-soft)); }
.dt-imgs { display: flex; flex: none; }
.dt-imgs img { width: 46px; height: 46px; object-fit: cover; border-radius: 12px; border: 2px solid var(--surface); box-shadow: var(--shadow); }
.dt-imgs img + img { margin-left: -18px; }
.rate-card h2 { margin-bottom: 2px; }
.rate-card p { margin: 0 0 10px; }
.rate-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rate-btn { display: grid; justify-items: center; gap: 2px; padding: 10px 4px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; font-size: .82rem; font-family: var(--round); }
.rate-btn span { font-size: 1.6rem; }
.rate-btn:active { transform: scale(.94); }
.variety { display: flex; align-items: center; gap: 10px; margin: 12px 16px 0; padding: 10px 14px; border-radius: 16px; background: var(--brand-soft); font-size: .9rem; }
.variety img { flex: none; }
.sugg-box { margin-top: 12px; padding: 4px 12px; border-radius: 14px; background: var(--brand-soft); }
.sugg-box .sub-head { margin-top: 8px; }
.pick-row.sugg { border-bottom-color: color-mix(in srgb, var(--brand) 15%, transparent); }
.pick-row.sugg:last-child { border-bottom: 0; }
.dish-pic { position: relative; display: block; }
.dish-badges { position: absolute; left: 6px; top: 6px; display: flex; gap: 4px; }
.dish-badges span { background: rgb(255 255 255 / .9); border-radius: 999px; padding: 1px 7px; font-size: .78rem; font-weight: 700; color: #2b211c; }
.dish-badges .new { background: var(--brand); color: #fff; }
.pick-row > span:first-child { min-width: 0; }
.pick-row > span:last-child { flex: none; white-space: nowrap; text-align: right; }
