/* Gohan: liquid-glass design system (apple-design skill)
   - Glass needs something to refract: an ambient colour field + photography sit under every surface.
   - Heavier glass = bigger surface (bars, sheet); light glass for small controls over photos.
   - Colour lives on solid layers (primary buttons, numbers), never on the translucent foreground. */

:root {
  --serif: ui-serif, "New York", "Fraunces", "Iowan Old Style", Georgia, serif;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --bg: #f7efe6;
  --ink: #1d1611; --ink-2: rgb(29 22 17 / .62); --ink-3: rgb(29 22 17 / .38);
  --hair: rgb(29 22 17 / .08);
  --accent: #e2531d; --accent-2: #f2883a; --accent-ink: #fff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --ok: #2f9e5b; --warn: #b8640b; --danger: #d92d20;

  /* glass */
  --glass-fill: linear-gradient(160deg, rgb(255 255 255 / .62), rgb(255 255 255 / .34));
  --glass-fill-thick: linear-gradient(160deg, rgb(255 255 255 / .82), rgb(255 255 255 / .62));
  --glass-blur: blur(22px) saturate(190%);
  --glass-edge: linear-gradient(160deg, rgb(255 255 255 / .95), rgb(255 255 255 / .25) 38%, rgb(255 255 255 / .08) 62%, rgb(255 255 255 / .6));
  --glass-shadow: 0 1px 0 rgb(255 255 255 / .55) inset, 0 -1px 0 rgb(255 255 255 / .12) inset,
                  0 10px 30px -6px rgb(73 38 12 / .18), 0 2px 6px rgb(73 38 12 / .06);
  --glass-dark: rgb(28 20 15 / .55);
  --bar-fill: linear-gradient(160deg, color-mix(in srgb, #fff 80%, var(--bg)) , color-mix(in srgb, var(--bg) 78%, transparent));

  --r-sm: 12px; --r-md: 18px; --r-lg: 24px; --r-xl: 30px;
  --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #120d0a;
    --ink: #f6efe8; --ink-2: rgb(246 239 232 / .66); --ink-3: rgb(246 239 232 / .4);
    --hair: rgb(255 255 255 / .09);
    --accent: #ff7a3d; --accent-2: #ffa25c; --accent-soft: rgb(255 122 61 / .16);
    --glass-fill: linear-gradient(160deg, rgb(255 255 255 / .14), rgb(255 255 255 / .05));
    --glass-fill-thick: linear-gradient(160deg, rgb(52 40 32 / .86), rgb(34 26 21 / .82));
    --glass-edge: linear-gradient(160deg, rgb(255 255 255 / .38), rgb(255 255 255 / .06) 40%, rgb(255 255 255 / .02) 60%, rgb(255 255 255 / .18));
    --glass-shadow: 0 1px 0 rgb(255 255 255 / .12) inset, 0 12px 34px -8px rgb(0 0 0 / .6), 0 2px 6px rgb(0 0 0 / .3);
    --glass-dark: rgb(0 0 0 / .45);
    --bar-fill: linear-gradient(160deg, rgb(48 37 30 / .86), rgb(30 23 18 / .82));
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font: 100%/1.5 var(--font); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100dvh; overscroll-behavior-y: none;
  padding-bottom: calc(var(--tab-h) + 2.5rem + env(safe-area-inset-bottom)); }
body.sheet-open { overflow: hidden; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--accent); text-decoration: none; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .8125rem; overflow-wrap: anywhere; }
img { -webkit-user-drag: none; }

/* Ambient colour field: soft warm light that glass refracts. Static (no looping motion). */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.ambient i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .75; }
.ambient i:nth-child(1) { width: 70vmax; height: 70vmax; left: -25vmax; top: -30vmax; background: var(--amb1); }
.ambient i:nth-child(2) { width: 55vmax; height: 55vmax; right: -25vmax; top: 10vh; background: var(--amb2); }
.ambient i:nth-child(3) { width: 60vmax; height: 60vmax; left: -20vmax; bottom: -30vmax; background: var(--amb3); }
.ambient i:nth-child(4) { width: 45vmax; height: 45vmax; right: -15vmax; bottom: -10vmax; background: var(--amb4); }
@media (prefers-color-scheme: dark) {
  .ambient i { opacity: .5; }

}

/* ---------- typography: tracking + leading per size ---------- */
.large-title { font-size: 2.125rem; line-height: 1.08; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
.subtitle { font-size: .9375rem; color: var(--ink-2); letter-spacing: -0.005em; margin: .15rem 0 0; }
h2 { font-size: 1.375rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h3 { font-size: 1rem; line-height: 1.25; font-weight: 650; letter-spacing: -0.012em; margin: 0; }
.eyebrow { font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0; }
.meta { font-size: .8125rem; line-height: 1.35; letter-spacing: .002em; color: var(--ink-2); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- glass material ---------- */
.glass { position: relative; background: var(--glass-fill); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow); isolation: isolate; }
.glass-thick { background: var(--glass-fill-thick); }
/* Specular rim: a light-catching 1px edge, brighter where light hits (top-left) */
.glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: var(--glass-edge);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
/* Glass over photography: lighter fill, vibrant white text */
.glass-photo { position: relative; background: linear-gradient(180deg, rgb(255 255 255 / .2), rgb(0 0 0 / .1));
  -webkit-backdrop-filter: blur(18px) saturate(170%) brightness(.82); backdrop-filter: blur(18px) saturate(170%) brightness(.82);
  color: #fff; box-shadow: 0 1px 0 rgb(255 255 255 / .35) inset; }
.glass-photo::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(160deg, rgb(255 255 255 / .7), rgb(255 255 255 / .1) 45%, rgb(255 255 255 / .3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.glass-dark { background: var(--glass-dark); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); color: #fff; }

/* ---------- controls ---------- */
button { font: inherit; font-weight: 600; letter-spacing: -0.01em; border: 0; cursor: pointer; color: inherit; background: none;
  touch-action: manipulation; transition: transform .18s cubic-bezier(.2,.8,.2,1), opacity .18s, background-color .2s, box-shadow .2s; }
button:active:not(:disabled) { transform: scale(.96); transition-duration: .06s; }
button:disabled { opacity: .38; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible, .card:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 3.25rem; padding: 0 1.4rem;
  border-radius: 999px; color: var(--accent-ink); font-size: 1.0625rem;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 1px 0 rgb(255 255 255 / .35) inset, 0 8px 22px -6px color-mix(in srgb, var(--accent) 65%, transparent); }
.btn-glass { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.75rem; padding: 0 1rem; border-radius: 999px; color: var(--ink); font-size: .9375rem; }
.icon-glass { width: 3.25rem; height: 3.25rem; border-radius: 50%; display: grid; place-items: center; color: var(--ink); }
.icon-glass svg { width: 1.35rem; height: 1.35rem; }
.icon-glass[aria-pressed="true"] { color: var(--accent); }
.icon-glass[aria-pressed="true"] svg { fill: currentColor; }
.text-btn { color: var(--accent); font-weight: 500; font-size: 1.0625rem; padding: .5rem .25rem; min-height: 2.75rem; }
.text-btn.strong { font-weight: 650; }
.pill-btn { padding: 0 .85rem; height: 2.1rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .875rem; }
.danger-link { color: var(--danger); font-weight: 500; display: flex; align-items: center; gap: .4rem; margin: 1.25rem auto 0; padding: .75rem 1rem; }

input, textarea { font: inherit; font-size: 1rem; width: 100%; color: var(--ink); touch-action: auto;
  background: rgb(255 255 255 / .55); border: 1px solid rgb(255 255 255 / .7); border-radius: var(--r-sm);
  padding: .75rem .9rem; box-shadow: 0 1px 2px rgb(73 38 12 / .06) inset; transition: background-color .2s, border-color .2s; }
input:focus, textarea:focus { outline: none; background: rgb(255 255 255 / .85); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
@media (prefers-color-scheme: dark) {
  input, textarea { background: rgb(255 255 255 / .07); border-color: rgb(255 255 255 / .1); }
  input:focus, textarea:focus { background: rgb(255 255 255 / .12); }
}

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: flex-end; gap: .75rem;
  padding: calc(.85rem + env(safe-area-inset-top)) 1.25rem .85rem; transition: background-color .25s; }
/* Glass appears only once content scrolls underneath (scroll edge effect) */
.topbar::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .25s;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 92%, transparent), color-mix(in srgb, var(--bg) 82%, transparent));
  -webkit-backdrop-filter: blur(24px) saturate(190%); backdrop-filter: blur(24px) saturate(190%);
  box-shadow: 0 1px 0 var(--hair); }
@media (prefers-color-scheme: dark) { .topbar::after { background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 92%, transparent), color-mix(in srgb, var(--bg) 82%, transparent)); } }
body.scrolled .topbar::after { opacity: 1; }
#title { flex: 1; min-width: 0; }
#title .large-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fab { width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 1px 0 rgb(255 255 255 / .4) inset, 0 10px 24px -6px color-mix(in srgb, var(--accent) 70%, transparent); margin-bottom: .2rem; }
.fab svg { width: 1.4rem; height: 1.4rem; stroke-width: 2.4; }

/* Detail route: bar floats over the hero photo with glass buttons */
body.route-detail .topbar { position: fixed; left: 0; right: 0; align-items: center; padding-bottom: .5rem; }
body.route-detail .fab { display: none; }
body.route-detail:not(.scrolled) .topbar::after { opacity: 0; }
.nav-title { font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.015em; flex: 1; text-align: center; opacity: 0;
  transition: opacity .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 .5rem; }
body.scrolled .nav-title { opacity: 1; }
.bar-btn { width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.bar-btn svg { width: 1.3rem; height: 1.3rem; stroke-width: 2.2; }
body.scrolled .bar-btn { color: var(--ink); background: var(--accent-soft); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
body.scrolled .bar-btn::before { display: none; }
.bar-btn[aria-pressed="true"] svg { fill: var(--accent); stroke: var(--accent); }

main { padding: 0 1.25rem 1rem; max-width: 60rem; margin: 0 auto; }

/* ---------- library ---------- */
.search-wrap, .input-wrap { position: relative; display: flex; align-items: center; }
.search-wrap { margin: .1rem 0 .9rem; border-radius: var(--r-md); }
.search-wrap svg, .input-icon { position: absolute; left: .85rem; color: var(--ink-3); pointer-events: none; width: 1.15rem; height: 1.15rem; }
.search { padding-left: 2.6rem; border-radius: var(--r-md); background: transparent; border-color: transparent; box-shadow: none; height: 2.9rem; }
.search:focus { background: transparent; border-color: transparent; }
.search::-webkit-search-cancel-button { -webkit-appearance: none; }
.input-wrap input { padding-left: 2.5rem; padding-right: 5rem; }
.input-wrap .pill-btn { position: absolute; right: .4rem; }

.chips { display: flex; gap: .5rem; overflow-x: auto; margin: 0 -1.25rem; padding: .1rem 1.25rem 1.1rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 2.25rem; padding: 0 1rem; border-radius: 999px; font-size: .875rem; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: .35rem; }
.chip svg { width: 1rem; height: 1rem; }
.chip.on { background: var(--ink); color: var(--bg); box-shadow: 0 6px 16px -6px rgb(29 22 17 / .5); }
.chip.on::before { display: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1rem; }
.card { position: relative; border-radius: var(--r-lg); overflow: hidden; cursor: pointer; aspect-ratio: 3/4; isolation: isolate;
  box-shadow: 0 14px 30px -12px rgb(73 38 12 / .45), 0 2px 6px rgb(73 38 12 / .08);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s; touch-action: manipulation; }
.card:active { transform: scale(.97); transition-duration: .08s; }
.card .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
.card .caption { position: absolute; left: .5rem; right: .5rem; bottom: .5rem; border-radius: calc(var(--r-lg) - .5rem); padding: .6rem .7rem .65rem; }
.card h3 { font-size: .9375rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 8px rgb(0 0 0 / .25); }
.card .meta { color: rgb(255 255 255 / .9); margin-top: .3rem; font-size: .75rem; font-weight: 500; gap: .6rem; }
.card .meta span { display: inline-flex; align-items: center; gap: .25rem; }
.card .meta svg { width: .9rem; height: .9rem; }
.card .tag { position: absolute; top: .55rem; left: .55rem; border-radius: 999px; padding: .2rem .6rem; font-size: .6875rem; font-weight: 700; letter-spacing: .02em; }
.card .fav { position: absolute; top: .5rem; right: .5rem; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; }
.card .fav svg { width: 1rem; height: 1rem; fill: #fff; stroke: #fff; }
/* Placeholder when a post has no thumbnail: warm generated gradient, not a grey box */
.ph { position: absolute; inset: 0; z-index: -1; display: grid; place-items: center; color: rgb(255 255 255 / .85); }
.ph svg { width: 2.6rem; height: 2.6rem; stroke-width: 1.4; margin-bottom: 3rem; }

.pending { display: flex; align-items: center; gap: .8rem; padding: .8rem .9rem; margin-bottom: .9rem; border-radius: var(--r-md); font-size: .875rem; }
.pending .status { color: var(--ink-2); font-size: .8125rem; }
.pending.failed .status { color: var(--warn); }
.pending .thumb-spin { width: 2.5rem; height: 2.5rem; border-radius: .75rem; background: var(--accent-soft); display: grid; place-items: center; flex: none; color: var(--accent); }
.spinner { width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 20%, transparent); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 3.5rem 1.5rem; border-radius: var(--r-xl); margin-top: .5rem; }
.empty .art { width: 4.5rem; height: 4.5rem; border-radius: 1.4rem; margin: 0 auto 1rem; display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--accent) 60%, transparent); }
.empty .art svg { width: 2rem; height: 2rem; }
.empty h3 { font-size: 1.125rem; margin-bottom: .35rem; }
.empty p { color: var(--ink-2); margin: 0 auto; max-width: 22rem; font-size: .9375rem; }
.empty .btn-primary { margin-top: 1.25rem; }

/* ---------- detail ---------- */
.hero { position: relative; margin: 0 -1.25rem; height: min(62vh, 34rem); overflow: hidden; color: #fff; isolation: isolate; }
.hero img, .hero .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgb(0 0 0 / .38) 0%, transparent 22%, transparent 45%, rgb(0 0 0 / .62) 100%); }
.hero-text { position: absolute; left: 1.25rem; right: 1.25rem; bottom: 4.6rem; }
.hero h2 { font-size: 2rem; line-height: 1.08; font-weight: 800; letter-spacing: -0.03em; text-shadow: 0 2px 20px rgb(0 0 0 / .3); }
.source { display: inline-flex; align-items: center; gap: .4rem; margin-top: .6rem; padding: .3rem .75rem .3rem .35rem; border-radius: 999px; font-size: .8125rem; font-weight: 600; color: #fff; }
.source .av { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: linear-gradient(135deg, #ffb27a, #e2531d); display: grid; place-items: center; font-size: .7rem; font-weight: 800; }
.stats { --glass-fill: var(--bar-fill); position: relative; z-index: 2; margin: -3.4rem 0 0; display: grid; grid-template-columns: repeat(4, 1fr); border-radius: var(--r-lg); padding: .8rem .25rem; }
.stat { text-align: center; position: relative; }
.stat + .stat::after { content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 1px; background: var(--hair); }
.stat b { display: block; font-size: 1.125rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: .6875rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.detail-actions { display: flex; gap: .65rem; margin: 1rem 0 .25rem; align-items: center; }
.detail-actions .btn-primary { flex: 1; }
.notice { display: flex; gap: .6rem; align-items: flex-start; margin: .9rem 0 0; padding: .75rem .9rem; border-radius: var(--r-md); font-size: .8125rem; color: var(--warn); }
.notice svg { margin-top: .05rem; }
.desc { color: var(--ink-2); margin: 1rem .25rem 0; font-size: .9375rem; }

.section { border-radius: var(--r-lg); padding: 1.1rem 1.1rem 1rem; margin: 1rem 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; gap: .75rem; }
.section-head h3 { font-size: 1.125rem; letter-spacing: -0.02em; }
.ing { display: flex; gap: .8rem; align-items: center; padding: .7rem 0; cursor: pointer; border-top: 1px solid var(--hair); }
.group + .ing, .section-head + .ing { border-top: 0; }
.ing input { appearance: none; -webkit-appearance: none; width: 1.45rem; height: 1.45rem; padding: 0; margin: 0; flex: none; border-radius: 50%;
  border: 1.6px solid var(--ink-3); background: transparent; box-shadow: none; display: grid; place-items: center; transition: background-color .15s, border-color .15s; }
.ing input:checked { background: var(--ok); border-color: var(--ok); }
.ing input:checked::after { content: ""; width: .35rem; height: .65rem; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.ing .txt { flex: 1; font-size: .9875rem; transition: color .15s; }
.ing .qty { font-weight: 650; font-variant-numeric: tabular-nums; }
.ing .note { color: var(--ink-3); }
.ing.done .txt { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-3); }
.group { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin: 1rem 0 .1rem; }
.stepper { display: inline-flex; align-items: center; gap: .15rem; border-radius: 999px; padding: .2rem; background: var(--accent-soft); }
.stepper button { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; color: var(--accent); }
.stepper button svg { width: 1rem; height: 1rem; stroke-width: 2.4; }
.stepper output { min-width: 4.6rem; text-align: center; font-size: .8125rem; font-weight: 650; color: var(--accent); font-variant-numeric: tabular-nums; }
.step { display: flex; gap: .9rem; padding: .75rem 0; border-top: 1px solid var(--hair); }
.section-head + .step { border-top: 0; }
.step .n { flex: none; width: 1.85rem; height: 1.85rem; border-radius: 50%; display: grid; place-items: center; font-size: .8125rem; font-weight: 750; color: #fff;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: 0 4px 10px -3px color-mix(in srgb, var(--accent) 55%, transparent); }
.step p { margin: .15rem 0 0; font-size: .9875rem; line-height: 1.5; }
.tags { display: flex; gap: .45rem; flex-wrap: wrap; margin: .25rem 0; }
.tags span { padding: .3rem .75rem; border-radius: 999px; font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.nutrition { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .25rem; }
.nutrition div { padding: .6rem; border-radius: var(--r-sm); background: var(--accent-soft); text-align: center; }
.nutrition b { display: block; font-size: 1rem; font-variant-numeric: tabular-nums; }
.nutrition span { font-size: .6875rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

/* ---------- bottom sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgb(20 10 4 / .38); opacity: 0; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; margin: 0 auto; max-width: 36rem;
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: .4rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  transform: translateY(110%); touch-action: none; -webkit-user-select: none; user-select: none;
  box-shadow: 0 -1px 0 rgb(255 255 255 / .7) inset, 0 -20px 60px -10px rgb(40 20 8 / .35); }
.sheet input, .sheet textarea { touch-action: auto; -webkit-user-select: text; user-select: text; }
.grabber { width: 2.4rem; height: .32rem; border-radius: 999px; background: var(--ink-3); opacity: .6; margin: .3rem auto .4rem; }
.sheet form { display: flex; flex-direction: column; gap: 1rem; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.sheet-head h2 { font-size: 1.0625rem; letter-spacing: -0.015em; text-align: center; }
.sheet-head [type=submit] { justify-self: end; }
.sheet-head [data-close] { justify-self: start; }
.sources { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; margin-top: -.25rem; }
.sources span { font-size: .75rem; font-weight: 600; color: var(--ink-2); padding: .25rem .6rem; border-radius: 999px; background: rgb(255 255 255 / .5); border: 1px solid rgb(255 255 255 / .7); }
@media (prefers-color-scheme: dark) { .sources span { background: rgb(255 255 255 / .06); border-color: rgb(255 255 255 / .08); } }
.field { display: flex; flex-direction: column; gap: .45rem; }
.field-label { font-size: .8125rem; font-weight: 600; color: var(--ink-2); padding-left: .2rem; }
.hint { min-height: 1.1em; color: var(--warn); font-size: .8125rem; padding-left: .2rem; }
textarea { resize: none; }

/* ---------- cook mode: the dish, blurred, behind glass ---------- */
.cook { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; color: #fff; overflow: hidden; isolation: isolate;
  padding: calc(1rem + env(safe-area-inset-top)) 0 calc(1.25rem + env(safe-area-inset-bottom)); transform: translateY(100%);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; background: #1a120c; }
.cook-bg { position: absolute; inset: -40px; z-index: -1; background-size: cover; background-position: center; filter: blur(40px) saturate(150%) brightness(.55); transform: scale(1.1); }
.cook-bg.ph { filter: brightness(.6); }
.cook-head { display: flex; justify-content: space-between; align-items: center; padding: 0 1.25rem; gap: 1rem; }
.cook-head .title { font-size: .9375rem; font-weight: 650; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cook .close { width: 2.5rem; height: 2.5rem; border-radius: 50%; display: grid; place-items: center; flex: none; }
.progress { height: 4px; margin: 1rem 1.25rem 0; border-radius: 999px; background: rgb(255 255 255 / .18); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: #fff; border-radius: inherit; transition: width .35s cubic-bezier(.2,.8,.2,1); }
.pager { flex: 1; overflow: hidden; position: relative; }
.track { display: flex; height: 100%; }
.page { flex: 0 0 100%; display: grid; place-items: center; padding: 1.25rem; }
.step-card { width: 100%; max-width: 32rem; border-radius: var(--r-xl); padding: 1.75rem 1.5rem 2rem; }
.step-card .eyebrow { color: rgb(255 255 255 / .7); margin-bottom: .75rem; }
.step-card p:not(.eyebrow) { margin: 0; font-size: clamp(1.4rem, 6vw, 2rem); line-height: 1.3; letter-spacing: -0.018em; font-weight: 600; }
.cook .nav { display: flex; gap: .65rem; padding: 0 1.25rem; }
.cook .nav button { flex: 1; min-height: 3.5rem; border-radius: 999px; font-size: 1.0625rem; }
.cook .nav .back-btn { color: #fff; }
.cook .nav .next-btn { background: #fff; color: #1a120c; box-shadow: 0 10px 30px -8px rgb(0 0 0 / .5); }

/* ---------- floating tab bar (liquid glass) ---------- */
.tabbar { --glass-fill: var(--bar-fill); -webkit-backdrop-filter: blur(30px) saturate(200%); backdrop-filter: blur(30px) saturate(200%);
  position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); bottom: calc(.75rem + env(safe-area-inset-bottom));
  width: min(calc(100% - 2rem), 26rem); height: var(--tab-h); border-radius: 999px; display: flex; padding: .35rem; }
.tabbar .lens { position: absolute; top: .35rem; bottom: .35rem; left: .35rem; border-radius: 999px; z-index: 0;
  width: calc((100% - .7rem) / 4); background: rgb(255 255 255 / .7); box-shadow: 0 2px 10px -2px rgb(73 38 12 / .18), 0 1px 0 #fff inset;
  transition: transform .45s cubic-bezier(.3,1.3,.5,1); }
@media (prefers-color-scheme: dark) { .tabbar .lens { background: rgb(255 255 255 / .14); box-shadow: 0 1px 0 rgb(255 255 255 / .15) inset; } }
.tabbar button { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  font-size: .6875rem; font-weight: 600; letter-spacing: .01em; color: var(--ink-2); border-radius: 999px; }
.tabbar button svg { width: 1.45rem; height: 1.45rem; }
.tabbar button.active { color: var(--accent); }
body.route-detail .tabbar, body.sheet-open .tabbar { }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 1.6rem + env(safe-area-inset-bottom)); z-index: 50; pointer-events: none;
  display: flex; align-items: center; gap: .5rem; padding: .7rem 1.1rem; border-radius: 999px; font-size: .9rem; font-weight: 600; letter-spacing: -0.005em;
  box-shadow: 0 1px 0 rgb(255 255 255 / .18) inset, 0 14px 34px -8px rgb(0 0 0 / .45); max-width: calc(100% - 2.5rem);
  opacity: 0; transform: translate(-50%, 8px) scale(.94); filter: blur(6px); white-space: nowrap; }
#toast svg { color: #7ee2a0; }
#toast button { color: var(--accent-2); font-weight: 700; padding: 0 0 0 .4rem; }

/* ---------- settings / groceries ---------- */
.settings-row { display: flex; gap: .5rem; }
ol.howto { padding-left: 1.2rem; margin: .5rem 0 0; color: var(--ink-2); font-size: .9375rem; }
ol.howto li { margin-bottom: .45rem; } ol.howto b { color: var(--ink); }
.section p.meta { display: block; }
.row-actions { display: flex; gap: .6rem; }
.row-actions button { flex: 1; }
.btn-solid { min-height: 2.75rem; padding: 0 1.1rem; border-radius: var(--r-sm); background: var(--ink); color: var(--bg); }

/* Draggable/tappable surfaces: no selection fighting the gesture */
.cook, .sheet-head, .grabber, .card, .tabbar, .chips, .topbar { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* ---------- accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .sheet, .cook { transition: opacity .2s ease; }
  button:active:not(:disabled), .card:active { transform: none; }
  .tabbar .lens, .progress i { transition: none; }
  .spinner { animation-duration: 2s; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .glass-photo, .glass-dark, .topbar::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .glass { background: var(--bg); } .glass-thick { background: var(--bg); }
  .glass-photo { background: rgb(0 0 0 / .55); } .glass-dark, #toast { background: #1d1611; }
  .topbar::after { background: var(--bg); }
  .ambient { display: none; }
}
@media (prefers-contrast: more) {
  :root { --ink-2: var(--ink); --ink-3: rgb(29 22 17 / .7); --hair: rgb(29 22 17 / .3); }
  .glass { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; border: 1.5px solid var(--ink); }
  .glass::before, .glass-photo::before { display: none; }
  .glass-photo { background: rgb(0 0 0 / .7); }
}

/* Broken thumbnail fallback + hero backdrop while the photo loads */
.ph-fallback { position: absolute; inset: 0; z-index: -1; background: linear-gradient(150deg, #ffb27a, #e2531d); }
.hero { background: linear-gradient(150deg, #ffb27a, #c2410c); }


/* =====================================================================
   Social layer
   ===================================================================== */
/* avatars */
.av { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; color: #fff; flex: none;
  font-size: .8125rem; font-weight: 750; letter-spacing: 0; box-shadow: 0 0 0 2px var(--bg); text-transform: uppercase; }
.av.xs { width: 1.35rem; height: 1.35rem; font-size: .625rem; box-shadow: 0 0 0 1.5px rgb(255 255 255 / .85); }
.av.sm { width: 1.75rem; height: 1.75rem; font-size: .75rem; }
.av.md { width: 2.4rem; height: 2.4rem; font-size: .9375rem; }
.av.lg { width: 3.4rem; height: 3.4rem; font-size: 1.3rem; }
.av.more { background: var(--ink-3); }
.faces { display: inline-flex; align-items: center; }
.faces .av + .av { margin-left: -.35rem; }
.faces.lg .av { width: 2.5rem; height: 2.5rem; font-size: 1rem; }
.faces.lg .av + .av { margin-left: -.55rem; }
.card .by { margin-left: auto; }

/* segmented control */
.seg { display: flex; gap: .2rem; padding: .25rem; border-radius: 999px; margin: 0 0 .8rem; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; height: 2.2rem; padding: 0 .9rem; border-radius: 999px; font-size: .875rem; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; white-space: nowrap; }
.seg button svg { width: 1rem; height: 1rem; }
.seg button.on { background: var(--ink); color: var(--bg); box-shadow: 0 4px 12px -4px rgb(29 22 17 / .45); }

/* tab badge */
.tabbar .badge { position: absolute; top: .35rem; left: calc(50% + .45rem); min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .625rem; font-weight: 800; font-style: normal; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.tabbar .badge[hidden] { display: none; }
.tabbar button span:not(.badge) { white-space: nowrap; }
.chip .dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--danger); display: inline-block; }

/* generic layout bits */
.wide { width: 100%; margin-top: .75rem; }
.center { text-align: center; justify-content: center; }
.block { margin: 1.4rem 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin: 0 .2rem .6rem; }
.block-head h3 { font-size: 1.25rem; letter-spacing: -0.02em; }
.pill-btn { display: inline-flex; align-items: center; gap: .3rem; font-weight: 650; }
.pill-btn svg { width: 1rem; height: 1rem; stroke-width: 2.2; }
.btn-glass.wide { justify-content: center; }
.hint-card { display: flex; gap: .8rem; align-items: center; padding: 1rem; border-radius: var(--r-lg); color: var(--ink-2); font-size: .9375rem; }
.hint-card svg { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.hint-card p { margin: 0; }
.mini, .mini-del { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); flex: none; }
.mini svg, .mini-del svg { width: 1rem; height: 1rem; }
.thumb-sm { width: 2.75rem; height: 2.75rem; border-radius: .8rem; object-fit: cover; flex: none; position: relative; overflow: hidden; display: block; }
.thumb-sm .ph { position: absolute; inset: 0; z-index: 0; }
.thumb-sm .ph svg { width: 1.2rem; height: 1.2rem; margin: 0; }
select { font: inherit; font-size: 1rem; width: 100%; color: var(--ink); padding: .75rem .9rem; border-radius: var(--r-sm);
  background: rgb(255 255 255 / .55); border: 1px solid rgb(255 255 255 / .7); -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 1.1rem; }
@media (prefers-color-scheme: dark) { select { background-color: rgb(255 255 255 / .07); border-color: rgb(255 255 255 / .1); } }

/* auth */
body.auth-mode .tabbar, body.auth-mode .topbar { display: none; }
body.auth-mode { padding-bottom: 2rem; }
.auth { max-width: 26rem; margin: 0 auto; padding: calc(2.5rem + env(safe-area-inset-top)) 0 1rem; }
.auth-brand { text-align: center; margin-bottom: 1.4rem; }
.auth-brand .art, .empty .art { width: 4.5rem; height: 4.5rem; border-radius: 1.4rem; margin: 0 auto 1rem; display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--accent) 60%, transparent); }
.auth-brand .art svg { width: 2rem; height: 2rem; }
.auth-brand .subtitle { max-width: 20rem; margin: .4rem auto 0; }
.auth-card { display: flex; flex-direction: column; gap: .9rem; padding: 1.1rem; border-radius: var(--r-xl); }
.auth-card .seg { margin: 0; }
.auth-card .btn-primary { margin-top: .25rem; }
.invite { display: flex; gap: .8rem; align-items: center; padding: .9rem 1rem; border-radius: var(--r-lg); margin-bottom: .9rem; }
.invite svg { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.invite b { display: block; }

/* detail: sharing + social */
.share-line { display: flex; align-items: center; gap: .6rem; width: 100%; margin: .9rem 0 0; padding: .7rem .9rem; border-radius: var(--r-md);
  font-size: .875rem; font-weight: 500; color: var(--ink-2); text-align: left; }
.share-line svg { width: 1.15rem; height: 1.15rem; color: var(--accent); }
.share-line b { color: var(--ink); }
.share-line .link { margin-left: auto; color: var(--accent); font-weight: 650; }
.detail-actions .icon-glass { width: 3.25rem; flex: none; }
.rate { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.rate-btn { display: flex; align-items: center; justify-content: center; gap: .45rem; min-height: 3rem; border-radius: var(--r-md);
  background: rgb(255 255 255 / .45); border: 1px solid rgb(255 255 255 / .6); color: var(--ink-2); font-size: .9375rem; }
@media (prefers-color-scheme: dark) { .rate-btn { background: rgb(255 255 255 / .06); border-color: rgb(255 255 255 / .08); } }
.rate-btn b { font-variant-numeric: tabular-nums; }
.rate-btn.on.yes { background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 8px 20px -8px rgb(47 158 91 / .7); }
.rate-btn.on.no { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.cooks { display: flex; gap: .7rem; overflow-x: auto; margin: 0 -1.1rem .2rem; padding: .2rem 1.1rem .6rem; scroll-snap-type: x mandatory; scrollbar-width: none; }
.cooks::-webkit-scrollbar { display: none; }
.cook-card { flex: 0 0 10.5rem; margin: 0; scroll-snap-align: start; border-radius: var(--r-md); overflow: hidden;
  background: rgb(255 255 255 / .55); border: 1px solid rgb(255 255 255 / .65); }
@media (prefers-color-scheme: dark) { .cook-card { background: rgb(255 255 255 / .06); border-color: rgb(255 255 255 / .08); } }
.cook-card img, .cook-nophoto { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.cook-nophoto { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.cook-nophoto svg { width: 2rem; height: 2rem; }
.cook-card figcaption { display: flex; align-items: center; gap: .35rem; padding: .5rem .6rem 0; font-size: .8125rem; }
.cook-card figcaption span { color: var(--ink-3); font-size: .75rem; }
.cook-card figcaption .mini-del { margin-left: auto; width: 1.5rem; height: 1.5rem; }
.cook-card p { margin: .3rem .6rem .6rem; font-size: .8125rem; color: var(--ink-2); line-height: 1.35; }
.variation { padding: .8rem 0; border-top: 1px solid var(--hair); }
.section-head + .variation { border-top: 0; padding-top: .2rem; }
.variation header { display: flex; gap: .6rem; align-items: center; }
.variation header div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.variation p { margin: .5rem 0 0; font-size: .9375rem; white-space: pre-wrap; }
.btn-glass.glass.wide { color: var(--accent); }

/* sheets */
.dyn-sheet { max-height: 92dvh; display: flex; flex-direction: column; }
.dyn-sheet form { min-height: 0; }
.sheet-body { display: flex; flex-direction: column; gap: .9rem; overflow-y: auto; touch-action: pan-y; -webkit-user-select: text; user-select: text;
  max-height: calc(92dvh - 6rem); margin: 0 -1.25rem; padding: .25rem 1.25rem .5rem; }
.sheet-body select { touch-action: auto; }
.sheet-lead { margin: 0; font-size: .9375rem; }
.row2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: .6rem; }
.photo-pick { display: grid; place-items: center; aspect-ratio: 4/3; border-radius: var(--r-lg); overflow: hidden; cursor: pointer;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--accent); }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-empty { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.photo-empty svg { width: 2.2rem; height: 2.2rem; }
.photo-empty small { color: var(--ink-3); }
.choice-list { display: flex; flex-direction: column; gap: .5rem; }
.choice { display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; border-radius: var(--r-md); cursor: pointer;
  background: rgb(255 255 255 / .5); border: 1.5px solid transparent; transition: border-color .15s, background-color .15s; }
@media (prefers-color-scheme: dark) { .choice { background: rgb(255 255 255 / .06); } }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { accent-color: var(--accent); width: 1.2rem; height: 1.2rem; margin: 0; flex: none; }
.choice > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.choice small { color: var(--ink-3); font-size: .75rem; }
.list-ico { width: 2.4rem; height: 2.4rem; border-radius: .8rem; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.list-ico.shared { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #fff; }
.recipe-pick { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.pick { display: flex; align-items: center; gap: .55rem; padding: .45rem; border-radius: var(--r-md); cursor: pointer; font-size: .8125rem; font-weight: 600; line-height: 1.2;
  background: rgb(255 255 255 / .5); border: 1.5px solid transparent; }
@media (prefers-color-scheme: dark) { .pick { background: rgb(255 255 255 / .06); } }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pick:has(input:disabled) { opacity: .45; }
.pick .thumb-sm { width: 2.4rem; height: 2.4rem; }

/* group tab */
.members { display: flex; align-items: center; justify-content: space-between; padding: .7rem .8rem .7rem 1rem; border-radius: var(--r-lg); margin-bottom: 1rem; }
.summary .sum-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .3rem 0 .6rem; }
.sum-grid div { text-align: center; padding: .7rem .3rem; border-radius: var(--r-md); background: var(--accent-soft); }
.sum-grid b { display: block; font-size: 1.6rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.sum-grid span { font-size: .6875rem; font-weight: 600; color: var(--ink-2); }
.sum-row { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--hair); color: var(--ink); }
.sum-row div { display: flex; flex-direction: column; min-width: 0; }
.sum-row b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; margin-top: .5rem; }
.sum-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .7rem; }
.event-card { display: flex; gap: .85rem; align-items: center; padding: .75rem; border-radius: var(--r-lg); margin-bottom: .6rem; cursor: pointer; }
.event-card:active { transform: scale(.98); }
.ev-thumbs { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; width: 3.8rem; height: 3.8rem; border-radius: .9rem; overflow: hidden; flex: none; }
.ev-thumbs .thumb-sm { width: 100%; height: 100%; border-radius: 0; }
.ev-thumbs .thumb-sm:first-child { grid-row: span 2; }
.ev-info { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.ev-info .meta svg { width: .9rem; height: .9rem; }
.ev-status { font-size: .75rem; font-weight: 650; display: inline-flex; align-items: center; gap: .3rem; }
.ev-status.open { color: var(--accent); }
.ev-status.done { color: var(--ok); }
.ev-status svg { width: .95rem; height: .95rem; }
.rank-label { margin: .6rem 0 .1rem; }
.rank-row { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; color: var(--ink); border-top: 1px solid var(--hair); }
.rank-label + .rank-row { border-top: 0; }
.rank-row .pos { width: 1.2rem; text-align: center; font-weight: 800; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rank-row:first-of-type .pos { color: var(--accent); }
.rank-row b { flex: 1; min-width: 0; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .score { display: inline-flex; align-items: center; gap: .25rem; font-weight: 700; color: var(--ok); font-variant-numeric: tabular-nums; }
.rank-row .score svg { width: 1rem; height: 1rem; }
.rank-row .score small { color: var(--ink-3); font-weight: 500; }
.section-head > svg { color: var(--accent); }
.feed { border-radius: var(--r-lg); padding: .2rem .95rem; }
.feed-item { display: flex; gap: .75rem; align-items: flex-start; padding: .8rem 0; border-top: 1px solid var(--hair); cursor: default; }
.feed-item:first-child { border-top: 0; }
.feed-item[role=link] { cursor: pointer; }
.feed-body { flex: 1; min-width: 0; }
.feed-body p { margin: 0; font-size: .9375rem; line-height: 1.4; }
.feed-body .quote { color: var(--ink-2); margin-top: .25rem; font-style: italic; }
.feed-photo { width: 100%; max-width: 15rem; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--r-md); margin-top: .5rem; display: block; }
.feed-item > .thumb-sm { margin-top: .1rem; }

/* dinner poll */
.plain-bar { color: var(--ink); background: rgb(255 255 255 / .5); }
@media (prefers-color-scheme: dark) { .plain-bar { background: rgb(255 255 255 / .08); } }
.event-head { display: flex; align-items: center; gap: 1rem; justify-content: space-between; padding: 1rem 1.1rem; border-radius: var(--r-lg); margin-bottom: 1rem; }
.event-head h2 { margin: .15rem 0; }
.event-head .meta svg { width: .95rem; height: .95rem; }
.progress-ring { --p: 0; width: 4.4rem; height: 4.4rem; flex: none; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--bg) 78%, transparent 80% 100%), conic-gradient(var(--accent) calc(var(--p) * 100%), var(--accent-soft) 0); }
.progress-ring b { font-size: 1rem; font-variant-numeric: tabular-nums; line-height: 1; }
.progress-ring span { font-size: .625rem; color: var(--ink-2); font-weight: 600; }
.options { display: flex; flex-direction: column; gap: .75rem; }
.option { display: flex; gap: .85rem; padding: .7rem; border-radius: var(--r-lg); border: 2px solid transparent; transition: border-color .2s; }
.option.mine { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.option.won { border-color: var(--ok); }
.opt-photo { width: 5.5rem; height: 5.5rem; border-radius: var(--r-md); overflow: hidden; flex: none; position: relative; display: block; }
.opt-photo img { width: 100%; height: 100%; object-fit: cover; }
.opt-photo .ph svg { margin: 0; width: 1.8rem; height: 1.8rem; }
.opt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .45rem; justify-content: center; }
.opt-body > b { font-size: 1rem; line-height: 1.25; }
.bar { height: .45rem; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.option.won .bar i { background: var(--ok); }
.opt-foot { display: flex; align-items: center; gap: .5rem; }
.opt-foot .meta { flex: 1; }
.vote-btn { height: 2.2rem; padding: 0 1rem; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: .875rem; display: inline-flex; align-items: center; gap: .3rem; }
.vote-btn svg { width: 1rem; height: 1rem; stroke-width: 2.4; }
.vote-btn.on { background: var(--accent); color: #fff; }
.winner { position: relative; display: block; height: 13rem; border-radius: var(--r-xl); overflow: hidden; margin-bottom: .5rem; color: #fff; isolation: isolate;
  box-shadow: 0 18px 40px -16px rgb(73 38 12 / .55); }
.winner > img, .winner > .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
.winner > div { position: absolute; left: .6rem; right: .6rem; bottom: .6rem; padding: .75rem .9rem; border-radius: var(--r-lg); display: flex; flex-direction: column; }
.winner .eyebrow { color: rgb(255 255 255 / .85); display: inline-flex; align-items: center; gap: .3rem; }
.winner .eyebrow svg { width: .95rem; height: .95rem; }
.winner b { font-size: 1.3rem; letter-spacing: -0.02em; }
#closeBtn { margin-top: 1rem; }

/* lists */
.lists { display: flex; flex-direction: column; gap: .6rem; }
.list-card { display: flex; align-items: center; gap: .85rem; padding: .85rem .9rem; border-radius: var(--r-lg); color: var(--ink); }
.list-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.list-card .bar { margin-top: .35rem; }
.chev { transform: rotate(180deg); color: var(--ink-3); }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; border-radius: var(--r-lg); margin-bottom: .8rem; }
.list-head > div { display: flex; flex-direction: column; }
.list-head b { font-size: 1.35rem; letter-spacing: -0.02em; }
.list-head .eyebrow { display: inline-flex; align-items: center; gap: .3rem; }
.list-head .eyebrow svg { width: .9rem; height: .9rem; }
.add-item { display: flex; align-items: center; gap: .4rem; padding: .35rem .35rem .35rem .4rem; border-radius: var(--r-md); }
.add-item input { background: transparent; border: 0; box-shadow: none; }
.add-item input:focus { background: transparent; }
.icon-add { width: 2.5rem; height: 2.5rem; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.icon-add svg { stroke-width: 2.4; }
.litems { padding: .3rem .9rem; }
.litem { display: flex; align-items: center; gap: .7rem; padding: .65rem 0; border-top: 1px solid var(--hair); }
.litem:first-child, .section-head + .litem { border-top: 0; }
.ing-check input { appearance: none; -webkit-appearance: none; width: 1.45rem; height: 1.45rem; padding: 0; margin: 0; border-radius: 50%;
  border: 1.6px solid var(--ink-3); background: transparent; box-shadow: none; display: grid; place-items: center; cursor: pointer; }
.ing-check input:checked { background: var(--ok); border-color: var(--ok); }
.ing-check input:checked::after { content: ""; width: .35rem; height: .65rem; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.litem-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.litem-body .txt { font-size: .9875rem; }
.litem-body small { font-size: .75rem; color: var(--ink-3); }
.litem.done .txt { color: var(--ink-3); text-decoration: line-through; }
.bring { display: inline-flex; align-items: center; gap: .3rem; height: 2rem; padding: 0 .7rem; border-radius: 999px; font-size: .78rem; font-weight: 650; flex: none;
  color: var(--accent); background: var(--accent-soft); }
.bring:disabled { opacity: 1; color: var(--ink-2); background: rgb(29 22 17 / .06); padding-left: .3rem; }
.bring.mine { background: var(--accent); color: #fff; padding-left: .3rem; }
.litem .mini-del { width: 1.75rem; height: 1.75rem; }
.done-sec { opacity: .85; }

/* settings */
.account { display: flex; align-items: center; gap: .9rem; }
.account > div { flex: 1; display: flex; flex-direction: column; }
.account b { font-size: 1.1rem; }
.group-row { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-top: 1px solid var(--hair); }
.section-head + .group-row { border-top: 0; }
.group-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* polish */
#title .large-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#title .large-title:not(:only-child) { font-size: clamp(1.6rem, 7.5vw, 2.125rem); }
body.route-sub .fab { display: none; }
body.route-sub .topbar { align-items: center; }
.event-head .meta, .ev-info .meta { display: block; }
.event-head .meta svg, .ev-info .meta svg { vertical-align: -.15em; margin-right: .2rem; }
.opt-foot .meta { white-space: nowrap; }

/* notifications */
.switches { display: flex; flex-direction: column; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--hair); font-size: .9375rem; }
.switch-row:first-child { border-top: 0; }
.switch-row input { appearance: none; -webkit-appearance: none; width: 3.1rem; height: 1.9rem; padding: 0; margin: 0; flex: none; border-radius: 999px; border: 0;
  background: rgb(120 120 128 / .32); position: relative; cursor: pointer; transition: background-color .2s; box-shadow: none; }
.switch-row input::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgb(0 0 0 / .2); transition: transform .3s cubic-bezier(.3,1.3,.5,1); }
.switch-row input:checked { background: var(--ok); }
.switch-row input:checked::after { transform: translateX(1.2rem); }
.nudge { display: flex; align-items: center; gap: .75rem; padding: .8rem .7rem .8rem .9rem; border-radius: var(--r-lg); margin-bottom: 1rem; }
.nudge > svg { width: 1.6rem; height: 1.6rem; color: var(--accent); flex: none; }
.nudge > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.btn-primary.wide svg, .btn-glass svg { width: 1.15rem; height: 1.15rem; }
@media (prefers-reduced-motion: reduce) { .switch-row input::after { transition: none; } }

/* cost & nutrition */
.facts-top { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
.fact-big { display: flex; flex-direction: column; padding: .8rem .9rem; border-radius: var(--r-md); background: var(--accent-soft); }
.fact-big b { font-size: 1.6rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.fact-big span { font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.fact-big em { font-style: normal; font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-top: .3rem; }
.macro-bar { display: flex; height: .55rem; border-radius: 999px; overflow: hidden; gap: 2px; margin: .2rem 0 .5rem; }
.macro-bar i, .macro-legend i { background: var(--c); }
.macro-bar .p, .macro-legend .p { --c: #2f8fdd; } .macro-bar .c, .macro-legend .c { --c: #e9a23b; } .macro-bar .f, .macro-legend .f { --c: #d9466f; }
.macro-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .8125rem; color: var(--ink-2); margin-bottom: .6rem; }
.macro-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.macro-legend i { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.macro-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.warn-line { display: flex; gap: .5rem; align-items: flex-start; font-size: .8125rem; color: var(--warn); margin: .4rem 0; }
.warn-line svg { width: 1rem; height: 1rem; margin-top: .1rem; }
.facts .text-btn { padding-left: 0; font-size: .9375rem; }
.fline { display: grid; grid-template-columns: 1fr auto auto auto; gap: .6rem; align-items: center; padding: .5rem 0; border-top: 1px solid var(--hair); font-size: .875rem; }
.fline div { display: flex; flex-direction: column; min-width: 0; }
.fline small { color: var(--ink-3); font-size: .75rem; }
.fline.bad b { color: var(--warn); }
.fnum { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .8125rem; text-align: right; min-width: 3.2rem; }
.facts .src { margin-top: .6rem; font-size: .75rem; }
.price-chip { height: 1.8rem; padding: 0 .55rem; border-radius: 999px; font-size: .75rem; font-weight: 650; color: var(--ink-2);
  background: rgb(29 22 17 / .06); font-variant-numeric: tabular-nums; flex: none; }
@media (prefers-color-scheme: dark) { .price-chip { background: rgb(255 255 255 / .08); } }
.choice { text-align: left; width: 100%; }

/* paragraphs styled as meta text must flow as text, not flex items */
p.meta { display: block; }

/* =====================================================================
   Plan, pantry, timers, scaling, units
   ===================================================================== */
.tabbar { width: min(calc(100% - 1.5rem), 28rem); }
.tabbar .lens { width: calc((100% - .7rem) / 5); }
.tabbar button { font-size: .625rem; letter-spacing: 0; }
.tabbar button svg { width: 1.35rem; height: 1.35rem; }

.sub-bar { display: flex; align-items: center; gap: .5rem; }
.bar-spacer { width: 2.75rem; flex: none; }
.page-lead { margin: 0 .2rem; }

/* ingredient tools: scale + units */
.ing-tools { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; margin: .1rem 0 .4rem; }
.mini-seg { display: inline-flex; padding: .2rem; border-radius: 999px; background: rgb(29 22 17 / .06); gap: .1rem; }
@media (prefers-color-scheme: dark) { .mini-seg { background: rgb(255 255 255 / .08); } }
.mini-seg button { height: 1.9rem; min-width: 2.4rem; padding: 0 .65rem; border-radius: 999px; font-size: .8125rem; font-weight: 650; color: var(--ink-2); }
.mini-seg button.on { background: var(--surface, #fff); color: var(--ink); box-shadow: 0 1px 4px rgb(0 0 0 / .12); }
@media (prefers-color-scheme: dark) { .mini-seg button.on { background: rgb(255 255 255 / .16); } }

/* timer chips inside step text */
.timer-chip { display: inline-flex; align-items: center; gap: .25rem; vertical-align: baseline; margin: 0 .1rem; padding: .05rem .55rem .05rem .4rem;
  border-radius: 999px; font: inherit; font-weight: 650; color: var(--accent); background: var(--accent-soft); line-height: 1.5; }
.timer-chip svg { width: 1em; height: 1em; stroke-width: 2.2; }
.step-card .timer-chip { color: #fff; background: rgb(255 255 255 / .22); }

/* running timers */
.timer-tray { position: fixed; z-index: 45; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 1.4rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: .4rem; width: min(calc(100% - 2rem), 24rem); pointer-events: none; }
body.cooking .timer-tray { bottom: auto; top: calc(4.2rem + env(safe-area-inset-top)); }
body.sheet-open:not(.cooking) .timer-tray { display: none; }
.timer-pill { pointer-events: auto; display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem .45rem 1rem; border-radius: 999px; color: #fff;
  background: rgb(28 20 15 / .72); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 10px 30px -8px rgb(0 0 0 / .45), 0 1px 0 rgb(255 255 255 / .15) inset; }
.timer-pill .t-time { font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; min-width: 3.6rem; }
.timer-pill .t-ctx { flex: 1; min-width: 0; font-size: .8125rem; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-pill button { width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgb(255 255 255 / .14); font-size: .8rem; flex: none; }
.timer-pill.paused .t-time { opacity: .6; }
.timer-pill.done { background: linear-gradient(180deg, var(--accent-2), var(--accent)); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent), 0 10px 30px -8px rgb(0 0 0 / .45); } }
@media (prefers-reduced-motion: reduce) { .timer-pill.done { animation: none; } }

/* lists by aisle + pantry */
.aisle-head { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; font-weight: 750; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent); padding: .35rem 0 .15rem; }
.aisle-head span { color: var(--ink-3); font-weight: 600; }
.aisle-head + .litem { border-top: 0; }
.litem { align-items: flex-start; }
.litem .ing-check { padding-top: .1rem; }
.litem-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.litem .mini, .litem .mini-del { margin-top: -.15rem; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip-wrap .chip { height: 2.1rem; font-size: .8125rem; }
.pantry-chip { display: inline-flex; align-items: center; gap: .2rem; height: 2.1rem; padding: 0 .25rem 0 .85rem; border-radius: 999px; font-size: .875rem; font-weight: 600;
  background: var(--accent-soft); color: var(--ink); }
.pantry-chip button { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); }
.pantry-chip button svg { width: .9rem; height: .9rem; }

/* plan */
.week-nav { display: flex; align-items: stretch; gap: .5rem; }
.icon-glass.sm { width: 2.75rem; height: auto; min-height: 2.75rem; border-radius: var(--r-md); flex: none; }
.icon-glass.fwd svg { transform: rotate(180deg); }
.week-sum { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); border-radius: var(--r-md); padding: .55rem .25rem; }
.week-sum div { text-align: center; display: flex; flex-direction: column; }
.week-sum b { font-size: 1.05rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.week-sum span { font-size: .6875rem; color: var(--ink-3); font-weight: 600; }
.days { display: flex; flex-direction: column; gap: .75rem; }
.day { border-radius: var(--r-lg); padding: .8rem .9rem .5rem; }
.day.past { opacity: .72; }
.day.today { box-shadow: var(--glass-shadow), 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.day-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.day-head b { font-size: 1rem; text-transform: capitalize; letter-spacing: -0.01em; }
.today-pill { font-size: .6875rem; font-weight: 750; color: #fff; background: var(--accent); padding: .1rem .5rem; border-radius: 999px; }
.slot { display: grid; grid-template-columns: 4.2rem 1fr; gap: .5rem; padding: .45rem 0; border-top: 1px solid var(--hair); align-items: start; }
.day-head + .slot { border-top: 0; }
.slot-label { font-size: .75rem; font-weight: 650; color: var(--ink-3); padding-top: .55rem; }
.slot-body { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.meal { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.meal-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; color: var(--ink); }
.meal-main span { display: flex; flex-direction: column; min-width: 0; }
.meal-main b { font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-main small { font-size: .75rem; color: var(--ink-3); }
.serv-pill { display: inline-flex; align-items: center; gap: .2rem; height: 1.9rem; padding: 0 .55rem; border-radius: 999px; font-size: .8125rem; font-weight: 650;
  color: var(--accent); background: var(--accent-soft); flex: none; }
.serv-pill svg { width: .95rem; height: .95rem; }
.add-meal { align-self: flex-start; display: inline-flex; align-items: center; gap: .3rem; height: 2.1rem; padding: 0 .75rem; border-radius: 999px;
  font-size: .8125rem; font-weight: 600; color: var(--ink-3); border: 1.5px dashed color-mix(in srgb, var(--ink) 20%, transparent); }
.add-meal svg { width: .95rem; height: .95rem; }
.meal + .add-meal { border-style: solid; border-color: transparent; padding-left: .2rem; height: 1.7rem; }
.picked { display: flex; align-items: center; gap: .75rem; padding: .6rem; border-radius: var(--r-md); background: var(--accent-soft); }
.big-stepper { display: flex; align-items: center; justify-content: center; gap: 1.5rem; margin-top: .5rem; }
.big-stepper button { width: 3.25rem; height: 3.25rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.big-stepper output { font-size: 2.5rem; font-weight: 800; min-width: 3rem; text-align: center; font-variant-numeric: tabular-nums; }

/* =====================================================================
   Visual audit: consistent vertical rhythm and card captions
   ===================================================================== */
/* One spacing rule for every top-level block on a screen (margins no longer stack or collapse unevenly). */
#view > *, .detail > *, #socialArea > *, #factsArea > * { margin-top: 0; margin-bottom: 0; }
#view > * + *, .detail > * + *, #socialArea > * + *, #factsArea > * + * { margin-top: 1rem; }
#socialArea:empty, #factsArea:empty { display: none; }
.detail > .stats { margin-top: -3.4rem; }
.detail > .stats + * { margin-top: 1rem; }
.btn-primary.wide, .btn-glass.wide { margin-top: 0; }
.section > .btn-glass.wide { margin-top: .75rem; }
.block-head { margin-top: 0; }
.block > .block-head + * { margin-top: 0; }
.row-actions { margin-top: 1rem; }
.danger-link { margin: 1.5rem auto .5rem; }

/* recipe cards: caption is title + ONE meta line; badges sit top-right, aligned */
.card .caption { display: flex; flex-direction: column; gap: .3rem; }
.card .caption .meta { margin-top: 0; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.card .badges { position: absolute; top: .5rem; right: .5rem; display: flex; align-items: center; gap: .3rem; }
.card .fav { position: static; }
.card .by .av { box-shadow: 0 0 0 2px rgb(255 255 255 / .9); }
.badge-cook { display: inline-flex; align-items: center; gap: .15rem; height: 1.9rem; padding: 0 .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-cook svg { width: .85rem; height: .85rem; stroke-width: 2.6; }
.card .tag { max-width: calc(100% - 6rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* =====================================================================
   Themes (Definições → Aparência). Light themes follow the system's dark mode;
   "Meia-noite" is always dark.
   ===================================================================== */
:root { --amb1: #ffc8a2; --amb2: #ffe0a8; --amb3: #f8b9b0; --amb4: #d7e6c4; }
@media (prefers-color-scheme: dark) { :root { --amb1: #6b2a10; --amb2: #5a3a12; --amb3: #4d1a22; --amb4: #1f3322; } }
:root[data-theme="salvia"] { --accent: #4e7d5b; --accent-2: #74a580; --bg: #eef2ea; --amb1: #cfe3c9; --amb2: #e9efcf; --amb3: #cfe1db; --amb4: #f0e4cc; }
:root[data-theme="rosa"]   { --accent: #c2496b; --accent-2: #e07a93; --bg: #f9eff0; --amb1: #f6c6d1; --amb2: #fbdfd8; --amb3: #ebc4dc; --amb4: #f4e2c5; }
:root[data-theme="mel"]    { --accent: #b97c0c; --accent-2: #dfa83a; --bg: #f8f1e1; --amb1: #f5d993; --amb2: #fbe8b4; --amb3: #f0c79c; --amb4: #e3e2ae; }
:root[data-theme="azul"]   { --accent: #2f6fb3; --accent-2: #5b97d3; --bg: #edf2f8; --amb1: #c2d8f2; --amb2: #dce7f6; --amb3: #cdd6ef; --amb4: #e0ecd9; }
:root[data-theme] { --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="salvia"] { --accent: #8cc49a; --accent-2: #a9d7b4; --bg: #0f1410; --amb1: #1d3a24; --amb2: #2d3a1a; --amb3: #173330; --amb4: #3a3018; }
  :root[data-theme="rosa"]   { --accent: #f08aa4; --accent-2: #f6a9bb; --bg: #160e11; --amb1: #4d1a2a; --amb2: #4a2a20; --amb3: #3a1a3a; --amb4: #3a3018; }
  :root[data-theme="mel"]    { --accent: #f0b84d; --accent-2: #f6cc78; --bg: #15110a; --amb1: #5a4210; --amb2: #4a3a14; --amb3: #4a2a14; --amb4: #2e3416; }
  :root[data-theme="azul"]   { --accent: #6fa8e6; --accent-2: #93bfee; --bg: #0c1118; --amb1: #163055; --amb2: #1d2a48; --amb3: #241f48; --amb4: #18361f; }
}
/* Meia-noite: always dark */
:root[data-theme="meianoite"] {
  color-scheme: dark; --bg: #0d0f14; --ink: #eef0f5; --ink-2: rgb(238 240 245 / .66); --ink-3: rgb(238 240 245 / .4); --hair: rgb(255 255 255 / .09);
  --accent: #ff8a4c; --accent-2: #ffa86f; --amb1: #2a1d4a; --amb2: #3a2410; --amb3: #12304a; --amb4: #1a2f2a;
  --glass-fill: linear-gradient(160deg, rgb(255 255 255 / .12), rgb(255 255 255 / .04));
  --glass-fill-thick: linear-gradient(160deg, rgb(36 40 52 / .9), rgb(22 25 33 / .86));
  --glass-edge: linear-gradient(160deg, rgb(255 255 255 / .35), rgb(255 255 255 / .06) 40%, rgb(255 255 255 / .02) 60%, rgb(255 255 255 / .16));
  --glass-shadow: 0 1px 0 rgb(255 255 255 / .1) inset, 0 12px 34px -8px rgb(0 0 0 / .7), 0 2px 6px rgb(0 0 0 / .35);
  --bar-fill: linear-gradient(160deg, rgb(34 38 50 / .9), rgb(20 23 30 / .86)); --glass-dark: rgb(0 0 0 / .5);
}
:root[data-theme="meianoite"] input, :root[data-theme="meianoite"] textarea, :root[data-theme="meianoite"] select { background-color: rgb(255 255 255 / .07); border-color: rgb(255 255 255 / .1); }
:root[data-theme="meianoite"] .ambient i { opacity: .55; }
:root[data-theme="meianoite"] .chip.on, :root[data-theme="meianoite"] .seg button.on { box-shadow: none; }
body { transition: background-color .4s ease, color .4s ease; }

.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: .7rem .3rem; border-radius: var(--r-md);
  border: 2px solid transparent; font-size: .8125rem; font-weight: 600; color: var(--ink-2); background: rgb(29 22 17 / .04); }
.theme-opt.on { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.theme-opt i { width: 2.2rem; height: 2.2rem; border-radius: 50%; box-shadow: 0 2px 6px rgb(0 0 0 / .18), 0 0 0 2px rgb(255 255 255 / .8) inset; }

/* =====================================================================
   Visual audit fixes, round 2
   ===================================================================== */
/* card top row: platform tag and badges share one flexible row (no clipping) */
.card .top { position: absolute; top: .5rem; left: .5rem; right: .5rem; display: flex; align-items: center; justify-content: space-between; gap: .35rem; }
.card .top .tag, .card .top .badges { position: static; }
.card .top .tag { max-width: none; min-width: 0; flex: 0 1 auto; }
.card .top .badges { flex: none; }
/* select arrows never overlap the text */
select { padding-right: 2.4rem; text-overflow: ellipsis; }
/* meals keep two lines of title instead of a hard cut */
.meal-main b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.slot { grid-template-columns: 4.6rem 1fr; }
.add-meal.more { border-style: solid; border-color: transparent; padding-left: .2rem; height: 1.7rem; }
.center-btn { display: block; margin: 0 auto; }
/* list head eyebrow on one line */
.list-head .eyebrow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; }
.list-head > div { min-width: 0; }
.live-dot { display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; background: var(--ok); margin: 0 .25rem .08rem 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
/* settings group rows */
.group-row > div b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-row > div .meta { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* import button only where importing makes sense */
body:not([data-tab="library"]):not([data-tab="group"]) .fab { display: none; }
/* scaled note */
.scale-note { font-size: .8125rem; color: var(--ink-2); margin: .1rem 0 .5rem; display: flex; gap: .4rem; }
.scale-note svg { width: 1rem; height: 1rem; color: var(--accent); flex: none; margin-top: .1rem; }
/* trips */
.trips { display: flex; flex-direction: column; gap: .6rem; }
.trip-card { display: flex; align-items: center; gap: .85rem; padding: .85rem .9rem; border-radius: var(--r-lg); color: var(--ink); }
.trip-card.past { opacity: .7; }
.trip-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.trip-ico { width: 2.6rem; height: 2.6rem; border-radius: .9rem; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.trip-head { padding: 1rem 1.1rem; border-radius: var(--r-lg); display: flex; flex-direction: column; gap: .15rem; }
.trip-head .eyebrow { display: inline-flex; gap: .3rem; align-items: center; }
.trip-head .eyebrow svg { width: .9rem; height: .9rem; }
.trip-head h2 { margin: .1rem 0; }
#view > .week-sum { display: grid; }
/* hands-free cook mode */
.cook-head { gap: .5rem; }
.cook-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: .5rem; }
.cook-serv { display: inline-flex; align-items: center; gap: .2rem; font-size: .8125rem; font-weight: 650; padding: .15rem .5rem; border-radius: 999px; background: rgb(255 255 255 / .16); flex: none; }
.cook-serv svg { width: .9rem; height: .9rem; }
.hf-btn { display: inline-flex; align-items: center; gap: .35rem; height: 2.5rem; padding: 0 .85rem; border-radius: 999px; color: #fff; font-size: .8125rem; flex: none; }
.hf-btn svg { width: 1.1rem; height: 1.1rem; }
.hf-btn.on { background: #fff; color: #1a120c; }
.hf-btn.on svg { color: var(--danger); animation: pulse-mic 1.2s ease-in-out infinite alternate; }
@keyframes pulse-mic { to { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .hf-btn.on svg { animation: none; } }
.hf-hint { margin: .75rem 1.25rem 0; display: flex; align-items: center; gap: .45rem; font-size: .8125rem; color: rgb(255 255 255 / .85); }
.hf-hint svg { width: 1rem; height: 1rem; flex: none; }
.hf-hint.listening svg { color: #ff8a8a; }
.need { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid rgb(255 255 255 / .18); }
.need .eyebrow { margin-bottom: .5rem; }
.need-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.need-chips span { font-size: .875rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px; background: rgb(255 255 255 / .16); }
.step-card p:not(.eyebrow) { margin: 0; }
.step-card { max-height: calc(100% - 1rem); overflow-y: auto; }

/* =====================================================================
   Stillness: no zoom, no rubber-band drag of the whole app, no sideways scroll
   ===================================================================== */
html { overscroll-behavior: none; touch-action: pan-x pan-y; overflow-x: clip; }
body { overscroll-behavior: none; overflow-x: clip; }
.chips, .seg, .sheet-body, .step-card, .cook, .timer-tray { overscroll-behavior: contain; }
/* iOS zooms into fields under 16px: keep every field at 16px there */
@supports (-webkit-touch-callout: none) { input, select, textarea { font-size: 16px !important; } }

/* =====================================================================
   Categories (Bimby) and Bimby settings in steps
   ===================================================================== */
.chips.cats { padding-bottom: .9rem; }
.chip-bimby svg { color: var(--accent); }
.chip-bimby.on svg { color: inherit; }
.card .top .tag svg { width: .85rem; height: .85rem; margin: 0 .2rem -.15rem 0; }
.bimby-set { display: inline-block; font-weight: 700; color: var(--accent); background: var(--accent-soft);
  padding: 0 .4rem; border-radius: .4rem; white-space: nowrap; }
.cook .bimby-set { color: #fff; background: rgb(255 255 255 / .18); }

/* =====================================================================
   Home: hero + "esta semana" (iPad and desktop). Phones keep the compact library.
   ===================================================================== */
.home-hero, .home-side, .home-head { display: none; }
.home-main > * + * { margin-top: 1rem; }
#view > .home-hero + .home-grid { margin-top: 0; }
.home-main > .chips { margin-top: .25rem; }

@media (min-width: 768px) {
  main { max-width: 78rem; padding: 0 2rem 2rem; }
  body[data-tab="library"]:not(.route-detail) #title { visibility: hidden; }
  body[data-tab="library"]:not(.route-detail) .topbar { padding-bottom: .25rem; }

  .home-hero { --hero-ink: #fff8ef; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(15rem, .75fr); align-items: center; gap: 2rem;
    position: relative; overflow: hidden; isolation: isolate; border-radius: 1.75rem; padding: 2.6rem 2.75rem; min-height: 21rem;
    color: var(--hero-ink); background: color-mix(in srgb, var(--accent) 16%, #15110e);
    box-shadow: 0 30px 60px -30px rgb(30 15 5 / .55), 0 1px 0 rgb(255 255 255 / .08) inset; }
  .hh-bg { position: absolute; inset: 0 0 0 38%; z-index: -1; background-size: cover; background-position: center; opacity: .55;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 45%); mask-image: linear-gradient(90deg, transparent, #000 45%); filter: saturate(1.1); }
  .home-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(60% 90% at 0% 0%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%); }
  .hh-greet { margin: 0 0 .6rem; font-family: var(--serif); font-style: italic; font-size: 1.125rem; color: var(--accent-2); }
  .home-hero h2 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(2.6rem, 4.6vw, 3.8rem); line-height: 1.02; letter-spacing: -0.025em; max-width: 12ch; text-wrap: balance; }
  .home-hero h2 em { color: var(--accent-2); font-style: italic; }
  .hh-sub { margin: 1rem 0 0; max-width: 34rem; font-size: 1rem; line-height: 1.55; color: color-mix(in srgb, var(--hero-ink) 78%, transparent); text-wrap: pretty; }
  .hh-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
  .hh-actions .btn-primary { min-height: 2.9rem; }
  .hh-ghost { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.9rem; padding: 0 1.2rem; border-radius: 999px; font-weight: 650;
    color: var(--hero-ink); background: rgb(255 255 255 / .1); box-shadow: 0 0 0 1px rgb(255 255 255 / .18) inset;
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transition: background-color .2s; }
  .hh-ghost:hover { background: rgb(255 255 255 / .18); }
  .hh-ghost svg { width: 1.1rem; height: 1.1rem; }
  .hh-stats { margin: 1.25rem 0 0; font-size: .875rem; color: color-mix(in srgb, var(--hero-ink) 70%, transparent); }
  .hh-stats b { color: var(--hero-ink); }

  /* recipe of the week: a pinned print */
  .hh-week { justify-self: end; width: min(100%, 17rem); display: flex; flex-direction: column; gap: .25rem; padding: .7rem .7rem 1rem;
    background: #fffaf3; color: #1d1611; border-radius: .6rem; transform: rotate(2.5deg);
    box-shadow: 0 24px 40px -18px rgb(0 0 0 / .6), 0 2px 6px rgb(0 0 0 / .2); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
  .hh-week:hover { transform: rotate(0) translateY(-3px); }
  .hh-week img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: .35rem; margin-bottom: .45rem; }
  .hh-week .eyebrow { color: #9a6a4a; font-size: .625rem; }
  .hh-week b { font-family: var(--serif); font-size: 1.25rem; line-height: 1.15; letter-spacing: -0.01em; }
  .hh-week i { font-family: var(--serif); font-size: .875rem; color: var(--accent); }

  .home-grid { display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); gap: 1.75rem; align-items: start; }
  #view > .home-hero + .home-grid { margin-top: 1.75rem; }
  .home-grid:only-child, .home-grid:first-child { margin-top: 0; }
  .home-side { display: flex; flex-direction: column; gap: .5rem; position: sticky; top: calc(5.5rem + env(safe-area-inset-top));
    padding: 1.1rem; border-radius: var(--r-lg); }
  .home-side .spinner { margin: 1rem auto; }
  .hs-meals { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
  .hs-meals a { display: flex; align-items: center; gap: .65rem; padding: .35rem; margin: 0 -.35rem; border-radius: .8rem; color: var(--ink); transition: background-color .2s; }
  .hs-meals a:hover { background: var(--accent-soft); }
  .hs-meals img, .hs-dot { width: 2.75rem; height: 2.75rem; border-radius: .7rem; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
  .hs-meals span { display: flex; flex-direction: column; min-width: 0; }
  .hs-meals small, .hs-list small { font-size: .75rem; color: var(--ink-3); font-weight: 600; }
  .hs-meals b { font-size: .875rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .hs-link { display: inline-flex; align-items: center; gap: .4rem; font-weight: 650; font-size: .875rem; margin-top: .25rem; }
  .hs-link svg { width: 1rem; height: 1rem; }
  .hs-list { display: flex; flex-direction: column; gap: .35rem; color: var(--ink); padding: .5rem 0; }
  .hs-list > span:first-child { display: flex; justify-content: space-between; gap: .5rem; font-size: .875rem; }
  .hs-list b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hs-bar { height: .35rem; border-radius: 999px; background: var(--hair); overflow: hidden; }
  .hs-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

  .home-head { display: block; }
  .home-head .eyebrow { color: var(--accent); }
  .home-head h2 { margin: .15rem 0 0; font-family: var(--serif); font-size: 1.75rem; letter-spacing: -0.015em; }
  .home-main .chips { margin: 0; padding: .1rem 0 .2rem; flex-wrap: wrap; overflow: visible; }
  .home-main .grid { grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 1.25rem; }

  /* iPad / desktop: tabs move to the top, as a centred glass pill */
  .tabbar { top: calc(.75rem + env(safe-area-inset-top)); bottom: auto; width: 36rem; height: 3.25rem; }
  .tabbar button { flex-direction: row; gap: .4rem; font-size: .8125rem; }
  .tabbar button svg { width: 1.2rem; height: 1.2rem; }
  .tabbar .badge { top: .25rem; left: auto; right: .5rem; }
  .topbar { padding-top: calc(4.9rem + env(safe-area-inset-top)); }
  body { padding-bottom: calc(2.5rem + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
  .timer-tray { bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
  body.route-detail .topbar { padding-top: calc(4.6rem + env(safe-area-inset-top)); }
}
@media (min-width: 768px) and (max-width: 1060px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-side { position: static; display: grid; grid-template-columns: 1fr; }
  .hs-meals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* =====================================================================
   Gohan (ご飯): brand wordmark + house theme (sumi ink, washi paper, hanko red)
   ===================================================================== */
:root[data-theme="gohan"] { --accent: #d7261e; --accent-2: #ef4b38; --bg: #f6f1e8; --amb1: #f4d2c4; --amb2: #efe6d3; --amb3: #f1c9c2; --amb4: #dfe3d2; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="gohan"] { --accent: #ff5a45; --accent-2: #ff7a66; --bg: #110e0c; --amb1: #4a1612; --amb2: #33281c; --amb3: #3a1418; --amb4: #1c2a20; }
}
:root[data-theme="gohan"] .home-hero { background: #15120f; }
:root[data-theme="gohan"] .hh-greet, :root[data-theme="gohan"] .home-hero h2 em { color: #ff5a45; }

.brand { display: inline-flex; align-items: stretch; gap: .3em; line-height: 1; color: var(--ink); }
.brand b { font-family: "Arial Narrow", "Helvetica Neue", var(--font); font-stretch: condensed; font-weight: 900; font-size: 1em;
  letter-spacing: .06em; transform: scaleY(1.35); transform-origin: center; display: inline-block; padding: .12em 0; }
.brand i { font-style: normal; writing-mode: vertical-rl; font-size: .4em; font-weight: 800; letter-spacing: .05em; line-height: 1.15;
  color: #d7261e; border: .12em solid #d7261e; padding: .35em .14em .45em; border-radius: .12em; display: inline-flex; align-items: center; }
.top-brand { display: none; }
.auth-brand .auth-icon { width: 4.5rem; height: 4.5rem; border-radius: 1.1rem; box-shadow: 0 14px 30px -12px rgb(0 0 0 / .45); }
.auth-title { margin: .9rem 0 .2rem; font-size: 2.6rem; }
@media (min-width: 768px) {
  .top-brand { display: block; position: fixed; z-index: 26; top: calc(1.35rem + env(safe-area-inset-top)); left: 2rem; font-size: 1.5rem; }
  body.route-detail .top-brand, body.auth-mode .top-brand { display: none; }
  /* library home: the hero carries the title and the import button */
  body[data-tab="library"]:not(.route-detail) .topbar .fab { display: none; }
  body[data-tab="library"]:not(.route-detail) .topbar { padding-bottom: 0; }
  body[data-tab="library"]:not(.route-detail) #title { display: none; }
}
@media (min-width: 768px) and (max-width: 1100px) { .tabbar { width: min(32rem, calc(100% - 15rem)); left: calc(50% + 4rem); } .tabbar button span:not(.badge) { font-size: .75rem; } }

/* blocky wordmark (svg) */
.logo { display: block; height: 100%; width: auto; color: var(--ink); overflow: visible; }
.top-brand { height: 2.1rem; }
.auth-title { height: 4.4rem; margin: 1.1rem 0 .4rem; display: flex; justify-content: center; }

/* =====================================================================
   iPad / desktop menu: a red bowl hanging from the top edge
   ===================================================================== */
@media all {
  .tabbar { display: none; }
  .topbar { padding-top: calc(4.6rem + env(safe-area-inset-top)); }
  .top-brand { top: calc(1.25rem + env(safe-area-inset-top)); }
  .menu-btn { display: grid; place-items: center; position: fixed; z-index: 62; top: calc(1rem + env(safe-area-inset-top)); right: 2rem;
    width: 2.75rem; height: 2.75rem; color: #e1001a; border: 2px solid #e1001a; border-radius: .2rem; background: color-mix(in srgb, var(--bg) 70%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: color .3s, border-color .3s, background-color .3s; }
  .menu-btn svg { width: 1.4rem; height: 1.4rem; stroke-width: 2.2; stroke-linecap: square; overflow: visible; }
  .menu-btn path { transition: transform .35s cubic-bezier(.3,1.3,.5,1); transform-origin: 12px 12px; }
  body.menu-open .menu-btn { background: #fff; }
  body.menu-open .menu-btn .m1 { transform: translateY(4px) rotate(45deg); }
  body.menu-open .menu-btn .m2 { transform: translateY(-4px) rotate(-45deg); }
  .menu-btn .badge { position: absolute; top: -.45rem; right: -.45rem; min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem; border-radius: 999px;
    background: #e1001a; color: #fff; font-size: .6875rem; font-weight: 700; display: grid; place-items: center; font-style: normal; }
  .menu-btn .badge[hidden], .cup-menu .badge[hidden] { display: none; }
  body.route-detail .menu-btn { top: calc(1rem + env(safe-area-inset-top)); }

  .cup-menu { --cup: #d9413d; display: flex; flex-direction: column; align-items: center; position: fixed; z-index: 61; top: 0; right: clamp(5rem, 9vw, 9rem);
    width: 25rem; max-height: 100dvh; padding: 4.2rem 3.2rem 4.8rem; color: #fff; background: var(--cup);
    border-radius: 0 0 12.5rem 12.5rem; box-shadow: 0 40px 80px -30px rgb(120 10 10 / .55);
    transform: translateY(-105%); transition: transform .55s cubic-bezier(.22,1.15,.36,1); }
  .cup-menu[hidden] { display: none; }
  .cup-menu.in { transform: none; }
  /* the flared lip at the top corners */
  .cup-menu::before, .cup-menu::after { content: ""; position: absolute; top: 0; width: 1.4rem; height: 3.6rem; }
  .cup-menu::before { left: -1.4rem; background: radial-gradient(ellipse 100% 100% at 0 100%, transparent 98%, var(--cup) 100%); }
  .cup-menu::after { right: -1.4rem; background: radial-gradient(ellipse 100% 100% at 100% 100%, transparent 98%, var(--cup) 100%); }
  .cup-menu ul { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: .35rem; }
  .cup-menu a { display: grid; grid-template-columns: 1fr 6.5rem auto; align-items: baseline; gap: .75rem; color: #fff; padding: .35rem 0; border-radius: .4rem; position: relative; }
  .mi-pt { font-family: "Fraunces", ui-serif, Georgia, serif; font-size: 2rem; font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; transition: transform .25s, opacity .25s; }
  .mi-jp { font-size: .95rem; font-weight: 700; letter-spacing: .06em; opacity: .9; }
  .cup-menu a:hover .mi-pt, .cup-menu a:focus-visible .mi-pt { transform: translateX(.35rem); }
  .cup-menu a.on .mi-pt { font-style: italic; }
  .cup-menu a.on::before { content: ""; position: absolute; left: -1.1rem; top: 50%; width: .45rem; height: .45rem; border-radius: 50%; background: #fff; transform: translateY(-50%); }
  .cup-menu a .badge { align-self: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: #fff; color: var(--cup);
    font-size: .75rem; font-weight: 800; font-style: normal; display: grid; place-items: center; }
  .cup-menu a:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
  .cm-import { margin-top: 1.6rem; display: inline-flex; align-items: center; gap: .5rem; align-self: flex-start; color: #fff; font-weight: 650;
    padding: .55rem 1rem; border-radius: 999px; box-shadow: 0 0 0 1.5px rgb(255 255 255 / .7) inset; }
  .cm-import:hover { background: rgb(255 255 255 / .12); }
  .cm-import svg { width: 1.1rem; height: 1.1rem; }
  .cm-logo { margin-top: 2.6rem; display: flex; flex-direction: column; align-items: center; gap: .7rem; }
  .cm-logo .logo { height: 3.4rem; color: #fff; }
  .cm-logo .logo-cup { fill: #fff; }
  .cm-logo small { font-size: .75rem; letter-spacing: .3em; opacity: .85; }
  @media (prefers-reduced-motion: reduce) { .cup-menu { transition: opacity .2s; transform: none; opacity: 0; } .cup-menu.in { opacity: 1; } }
  @media (max-height: 760px) { .cup-menu { padding-top: 3.4rem; padding-bottom: 4rem; } .mi-pt { font-size: 1.7rem; } .cm-logo { margin-top: 1.6rem; } .cm-logo .logo { height: 2.8rem; } }
}

/* =====================================================================
   Lettering (after u-gohan.jp): lowercase high-contrast serif, tight tracking,
   a heavy rule under the word and a small Japanese caption.
   ===================================================================== */
:root { --jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Zen Kaku Gothic New", "Yu Gothic", "Noto Sans JP", sans-serif;
  --letter: "Fraunces", ui-serif, "New York", Georgia, serif; }
.jt { display: inline-flex; flex-direction: column; align-items: flex-start; margin: 0; color: var(--ink); max-width: 100%; }
.jt b { position: relative; font-family: var(--letter); font-weight: 400; font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  letter-spacing: -0.045em; line-height: 1; padding: 0 .04em .14em 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.jt b::after { content: ""; position: absolute; left: 34%; right: 0; bottom: 0; height: max(3px, .07em); background: currentColor; }
.jt small { font-family: var(--jp); font-weight: 700; font-size: .75rem; letter-spacing: .4em; line-height: 1; margin: .7rem 0 0 34%; white-space: nowrap; color: var(--ink); }
.jt-large b { font-size: 2.6rem; }
.jt-large + .subtitle { margin-top: .35rem; }
.jt-center { align-items: center; text-align: center; }
.jt-center b { font-size: 2.4rem; }
.jt-center b::after { left: 30%; }
.jt-center small { margin-left: 30%; }
.home-head { display: flex; justify-content: center; margin: .5rem 0 1.25rem !important; }
@media (max-width: 767px) { .home-head { display: none; } }
@media (min-width: 768px) { .home-head .jt b { font-size: 3rem; } }

/* section headings inside cards */
.section-head h3 { font-family: var(--letter); font-weight: 400; font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  font-size: 1.45rem; letter-spacing: -0.035em; text-transform: lowercase; display: inline-flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; }
.section-head h3[data-jp]::after { content: attr(data-jp); font-family: var(--jp); font-weight: 700; font-size: .6875rem; letter-spacing: .35em; color: var(--accent); text-transform: none; }
.empty h3 { font-family: var(--letter); font-weight: 400; font-variation-settings: "opsz" 144; letter-spacing: -0.03em; font-size: 1.5rem; }

/* thin, small lettering (no Japanese captions) */
.jt b { font-weight: 300; letter-spacing: -0.035em; }
.jt b::after { height: max(2px, .05em); }
.jt-large b { font-size: 2.2rem; }
@media (min-width: 768px) { .home-head .jt b { font-size: 2.25rem; } }
.home-head { margin: .25rem 0 1rem !important; }
.section-head h3 { font-weight: 300; font-size: 1.25rem; letter-spacing: -0.025em; }
.mi-pt { font-weight: 300; }
.cup-menu a { grid-template-columns: 1fr auto; }

/* =====================================================================
   Organic motion, from the bowl: things fill, settle and breathe.
   Springy curves, soft squash-and-stretch, nothing mechanical.
   ===================================================================== */
:root { --ease-soft: cubic-bezier(.2,.8,.2,1); --ease-jelly: cubic-bezier(.3,1.35,.45,1); }

/* the bowl pours in (anchored at its base), with a little settle */
.logo-cup { transform-box: fill-box; transform-origin: 50% 100%; animation: bowl-pour .9s var(--ease-soft) both; }
@keyframes bowl-pour {
  0% { transform: scale(.7, .15); opacity: 0; }
  45% { transform: scale(.96, 1.08); opacity: 1; }
  70% { transform: scale(1.03, .96); }
  100% { transform: none; }
}
.logo .logo-word { animation: word-rise .8s .18s var(--ease-soft) both; }
@keyframes word-rise { from { opacity: 0; transform: translateY(18px); filter: blur(4px); } }
.top-brand:hover .logo-cup { animation: bowl-wobble .7s var(--ease-soft); }
@keyframes bowl-wobble { 25% { transform: rotate(-6deg) scale(1.02, .98); } 55% { transform: rotate(4deg); } 80% { transform: rotate(-1.5deg); } }

/* loading: a small bowl slowly filling, the surface rolling like broth */
.spinner { width: 1.15rem; height: 1.6rem; border: 0; border-radius: 0; position: relative; overflow: hidden; animation: none;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 155"><path d="M0 0C30 6 70 6 100 0C97 4 96 12 96 32V108A46 46 0 0 1 4 108V32C4 12 3 4 0 0Z"/></svg>') center / contain no-repeat;
          mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 155"><path d="M0 0C30 6 70 6 100 0C97 4 96 12 96 32V108A46 46 0 0 1 4 108V32C4 12 3 4 0 0Z"/></svg>') center / contain no-repeat; }
.spinner::before { content: ""; position: absolute; left: -60%; width: 220%; aspect-ratio: 1; border-radius: 43%; background: var(--accent);
  top: 100%; animation: broth-fill 2.4s var(--ease-soft) infinite, spin 2.8s linear infinite; }
@keyframes broth-fill { 0% { top: 105%; opacity: 1; } 72% { top: 8%; opacity: 1; } 90%, 100% { top: 8%; opacity: 0; } }
.btn-primary .spinner, .cook .spinner { background: rgb(255 255 255 / .25); }
.btn-primary .spinner::before, .cook .spinner::before { background: #fff; }
.home-side .spinner, .empty .spinner { width: 1.6rem; height: 2.2rem; }

/* lettering: the rule under each title is drawn after the word lands */
.jt b::after { transform-origin: 0 50%; animation: rule-draw .8s .25s var(--ease-soft) both; }
@keyframes rule-draw { from { transform: scaleX(0); } }
.jt b { animation: word-rise .7s var(--ease-soft) both; }

/* cards rise in a soft wave */
.grid .card { animation: card-in .7s calc(var(--n, 0) * 45ms) var(--ease-soft) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(22px) scale(.97); } }
.card:active { transform: scale(.97); transition: transform .12s; }
.card:hover .photo, .card:hover img { transform: scale(1.04); }
.card .photo, .card img { transition: transform .8s var(--ease-soft); }

/* the menu bowl drops like poured jelly: stretches, then settles */
@media all {
  .cup-menu { transform-origin: 50% 0; }
  .cup-menu.in { animation: bowl-drop .8s var(--ease-soft) both; }
  @keyframes bowl-drop {
    0% { transform: translateY(-105%) scale(1, 1); }
    55% { transform: translateY(0) scale(.985, 1.045); }
    75% { transform: translateY(0) scale(1.01, .985); }
    100% { transform: none; }
  }
  .cup-menu.in li, .cup-menu.in .cm-import, .cup-menu.in .cm-logo { animation: item-drip .6s var(--ease-jelly) both; }
  .cup-menu.in li:nth-child(1) { animation-delay: .16s; } .cup-menu.in li:nth-child(2) { animation-delay: .2s; }
  .cup-menu.in li:nth-child(3) { animation-delay: .24s; } .cup-menu.in li:nth-child(4) { animation-delay: .28s; }
  .cup-menu.in li:nth-child(5) { animation-delay: .32s; } .cup-menu.in .cm-import { animation-delay: .38s; }
  .cup-menu.in .cm-logo { animation-delay: .44s; }
  @keyframes item-drip { from { opacity: 0; transform: translateY(-14px); } }
  .home-hero { animation: hero-in .9s var(--ease-soft) both; }
  @keyframes hero-in { from { opacity: 0; transform: translateY(16px) scale(.99); border-radius: 3rem; } }
  .hh-week { animation: print-drop 1s .3s var(--ease-jelly) both; }
  @keyframes print-drop { from { opacity: 0; transform: translateY(-24px) rotate(-4deg); } }
}

/* the ambient light drifts like steam, very slowly */
.ambient i { will-change: transform; animation: steam 26s ease-in-out infinite alternate; }
.ambient i:nth-child(2) { animation-duration: 31s; animation-delay: -8s; }
.ambient i:nth-child(3) { animation-duration: 35s; animation-delay: -15s; }
.ambient i:nth-child(4) { animation-duration: 29s; animation-delay: -4s; }
@keyframes steam { 50% { transform: translate(4vmax, -3vmax) scale(1.08, .95); } 100% { transform: translate(-3vmax, 2vmax) scale(.96, 1.06); } }

/* ticking an ingredient: the circle fills like a drop landing */
.ing input:checked, .ing-check input:checked, .litem input:checked { animation: drop-in .45s var(--ease-jelly); }
@keyframes drop-in { 0% { transform: scale(.6); } 60% { transform: scale(1.15, .9); } 100% { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .logo-cup, .logo .logo-word, .jt b, .jt b::after, .grid .card, .cup-menu.in, .cup-menu.in li, .cup-menu.in .cm-import, .cup-menu.in .cm-logo,
  .home-hero, .hh-week, .ambient i, .top-brand:hover .logo-cup { animation: none !important; }
  .spinner::before { animation: broth-fill 3s linear infinite; }
}


/* =====================================================================
   Phone: the bowl menu replaces the tab bar here too
   ===================================================================== */
@media (max-width: 767px) {
  .topbar { padding: calc(.85rem + env(safe-area-inset-top)) 4.6rem .85rem 1.25rem; }
  .menu-btn { top: calc(1rem + env(safe-area-inset-top)); right: 1.1rem; width: 2.6rem; height: 2.6rem; }
  body.route-detail .menu-btn { display: none; }
  body.cooking .menu-btn, body.auth-mode .menu-btn { display: none; }
  body { padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
  .timer-tray { bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
  .cup-menu { --w: min(calc(100vw - 2rem), 22rem); right: 1rem; width: var(--w); padding: calc(3.6rem + env(safe-area-inset-top)) 2.2rem 4.2rem;
    border-radius: 0 0 calc(var(--w) / 2) calc(var(--w) / 2); max-height: 100dvh; overflow-y: auto; }
  .cup-menu::before, .cup-menu::after { width: 1rem; height: 2.6rem; }
  .cup-menu::before { left: -1rem; } .cup-menu::after { right: -1rem; }
  .mi-pt { font-size: 1.75rem; }
  .cm-import { margin-top: 1.2rem; }
  .cm-logo { margin-top: 1.8rem; }
  .cm-logo .logo { height: 2.8rem; }
  /* a scrim so the page recedes behind the bowl */
  body.menu-open::after { content: ""; position: fixed; inset: 0; z-index: 60; background: rgb(20 10 8 / .25);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade-in .3s ease both; }
}
@keyframes fade-in { from { opacity: 0; } }

body.cooking .menu-btn, body.auth-mode .menu-btn, body.auth-mode .top-brand { display: none !important; }

/* =====================================================================
   Proposal: "Washi" — Japanese craft meets glass.
   Washi paper grain, shoji-like frosted panels with a hairline frame, sumi ink,
   shu (vermilion) seal red, ai (indigo) and kintsugi gold seams; seigaiha waves; ma (generous space).
   ===================================================================== */
:root[data-theme="washi"] {
  --bg: #f2ede3; --ink: #1b1915; --ink-2: rgb(27 25 21 / .62); --ink-3: rgb(27 25 21 / .4); --hair: rgb(27 25 21 / .1);
  --accent: #c8372d; --accent-2: #dc5444; --accent-soft: rgb(200 55 45 / .1); --ai: #2b4a6b; --kin: #b8913a;
  --amb1: #f1d9cf; --amb2: #e7e2d4; --amb3: #d9e0e6; --amb4: #ebe4d3;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px;
  --glass-fill: linear-gradient(170deg, rgb(255 253 248 / .62), rgb(255 252 245 / .42));
  --glass-fill-thick: linear-gradient(170deg, rgb(255 253 248 / .88), rgb(250 246 238 / .78));
  --glass-edge: linear-gradient(170deg, rgb(255 255 255 / .9), rgb(255 255 255 / .2) 45%, rgb(184 145 58 / .25));
  --glass-shadow: 0 1px 0 rgb(255 255 255 / .7) inset, 0 0 0 1px rgb(27 25 21 / .06), 0 18px 36px -22px rgb(40 30 20 / .35);
  --bar-fill: linear-gradient(170deg, rgb(255 253 248 / .8), rgb(250 246 238 / .7));
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="washi"] { --bg: #141210; --ink: #efe9dd; --ink-2: rgb(239 233 221 / .64); --ink-3: rgb(239 233 221 / .4); --hair: rgb(239 233 221 / .1);
    --accent: #e2553f; --accent-2: #ee7360; --kin: #d1aa52; --amb1: #3a1814; --amb2: #262016; --amb3: #14222f; --amb4: #20201a;
    --glass-fill: linear-gradient(170deg, rgb(255 250 240 / .09), rgb(255 250 240 / .04));
    --glass-fill-thick: linear-gradient(170deg, rgb(38 34 30 / .9), rgb(26 23 20 / .86));
    --glass-edge: linear-gradient(170deg, rgb(255 255 255 / .3), rgb(255 255 255 / .04) 45%, rgb(209 170 82 / .3));
    --glass-shadow: 0 1px 0 rgb(255 255 255 / .08) inset, 0 0 0 1px rgb(255 255 255 / .05), 0 18px 36px -20px rgb(0 0 0 / .7); }
}
/* washi grain over everything (static SVG noise, no motion) */
:root[data-theme="washi"] body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5; mix-blend-mode: multiply;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="240" height="240"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="2" stitchTiles="stitch"/><feColorMatrix values="0 0 0 0 .45  0 0 0 0 .38  0 0 0 0 .28  0 0 0 .22 0"/></filter><rect width="100%" height="100%" filter="url(%23n)"/><g stroke="%23a08a63" stroke-opacity=".18" fill="none" stroke-width=".6"><path d="M12 40c40 6 80-10 130 4M60 150c30-8 70 12 140-2M5 210c50 10 90-6 120 2"/></g></svg>'); }
@media (prefers-color-scheme: dark) { :root[data-theme="washi"] body::before { mix-blend-mode: screen; opacity: .18; } }
/* the sun: one soft vermilion disc instead of many blobs */
:root[data-theme="washi"] .ambient i { opacity: .5; }
:root[data-theme="washi"] .ambient i:nth-child(1) { width: 34vmax; height: 34vmax; left: auto; right: -8vmax; top: -10vmax; background: #e8a493; filter: blur(50px); }
/* shoji: frosted panels with a fine frame and a kumiko corner */
:root[data-theme="washi"] .glass:not(.chip):not(.seg):not(.search-wrap):not(.tabbar)::after { content: ""; position: absolute; inset: 5px; border: 1px solid rgb(27 25 21 / .06); border-radius: calc(var(--r-lg) - 5px); pointer-events: none; }
:root[data-theme="washi"] .section { position: relative; }
/* titles: ink lettering with a kintsugi seam */
:root[data-theme="washi"] .jt b::after { background: linear-gradient(90deg, var(--kin), #e3c77d 40%, var(--kin) 70%, #8c6a22); height: max(2px, .045em); }
:root[data-theme="washi"] .section-head h3 { color: var(--ink); }
:root[data-theme="washi"] .section-head { border-bottom: 1px solid transparent; border-image: linear-gradient(90deg, var(--kin), transparent 70%) 1; padding-bottom: .5rem; }
/* chips and segments: noren — flat-topped cloth tabs */
:root[data-theme="washi"] .chip { border-radius: 3px 3px 12px 12px; }
:root[data-theme="washi"] .chip.on { background: var(--ai); color: #f4efe5; }
:root[data-theme="washi"] .seg button.on { background: var(--ink); }
:root[data-theme="washi"] .btn-primary { border-radius: 4px; background: var(--accent); box-shadow: 0 10px 24px -12px rgb(200 55 45 / .8); letter-spacing: .02em; }
:root[data-theme="washi"] .fab { border-radius: 4px; background: var(--accent); }
:root[data-theme="washi"] input, :root[data-theme="washi"] select, :root[data-theme="washi"] textarea { border-radius: 4px; }
/* cards: a print on paper with a frosted caption like a shoji pane */
:root[data-theme="washi"] .card { border-radius: 6px; box-shadow: 0 0 0 1px rgb(27 25 21 / .08), 0 20px 34px -22px rgb(40 30 20 / .6); }
:root[data-theme="washi"] .card .caption { border-radius: 4px; background: linear-gradient(170deg, rgb(250 247 240 / .72), rgb(245 240 230 / .55)); color: var(--ink); }
:root[data-theme="washi"] .card .caption h3 { font-family: var(--letter); font-weight: 400; letter-spacing: -0.02em; font-size: 1.05rem; color: #1b1915; text-shadow: none; }
:root[data-theme="washi"] .card .caption .meta { color: rgb(27 25 21 / .65); }
:root[data-theme="washi"] .card .tag { border-radius: 2px; }
/* the hero: indigo night with seigaiha waves */
:root[data-theme="washi"] .home-hero { background-color: #1d2a3a; border-radius: 10px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="64" height="32" viewBox="0 0 64 32"><g fill="none" stroke="%23ffffff" stroke-opacity=".07" stroke-width="1.2"><circle cx="32" cy="32" r="30"/><circle cx="32" cy="32" r="22"/><circle cx="32" cy="32" r="14"/><circle cx="0" cy="16" r="30"/><circle cx="0" cy="16" r="22"/><circle cx="0" cy="16" r="14"/><circle cx="64" cy="16" r="30"/><circle cx="64" cy="16" r="22"/><circle cx="64" cy="16" r="14"/></g></svg>'); }
:root[data-theme="washi"] .home-hero::after { background: radial-gradient(40% 70% at 8% 10%, rgb(200 55 45 / .35), transparent 70%); }
:root[data-theme="washi"] .hh-week { border-radius: 3px; }
/* the bowl menu: vermilion lacquer with faint waves */
:root[data-theme="washi"] .cup-menu { --cup: #c8372d;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="64" height="32" viewBox="0 0 64 32"><g fill="none" stroke="%23ffffff" stroke-opacity=".045" stroke-width="1.2"><circle cx="32" cy="32" r="30"/><circle cx="32" cy="32" r="22"/><circle cx="32" cy="32" r="14"/><circle cx="0" cy="16" r="30"/><circle cx="0" cy="16" r="22"/><circle cx="0" cy="16" r="14"/><circle cx="64" cy="16" r="30"/><circle cx="64" cy="16" r="22"/><circle cx="64" cy="16" r="14"/></g></svg>');
  background-position: 0 100%; }
:root[data-theme="washi"] .menu-btn { border-radius: 2px; color: var(--accent); border-color: var(--accent); }
/* list items and steps: ink numbering like a hanko */
:root[data-theme="washi"] .step .n, :root[data-theme="washi"] .step-num { border-radius: 3px; }
@media (max-width: 767px) {
  body.route-detail .topbar { padding-right: 1.25rem; }
  .topbar .fab { position: fixed; z-index: 30; right: 1.25rem; bottom: calc(1.25rem + env(safe-area-inset-bottom)); width: 3.5rem; height: 3.5rem; margin: 0; }
  #toast { bottom: calc(5.75rem + env(safe-area-inset-bottom)); }
  .timer-tray { bottom: calc(5.75rem + env(safe-area-inset-bottom)); }
  body { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
}


/* =====================================================================
   Proposal: "Umami" — tactile and immersive.
   Neumorphism for what you touch (soft extruded / pressed-in), liquid glass for
   overlays and containers, Material 3 logic for states (state layers, tonal
   containers, selected checks, focus rings). Sumi black + shu red + rice cream.
   ===================================================================== */
:root[data-theme="umami"] {
  --bg: #f5eee3; --ink: #17130f; --ink-2: rgb(23 19 15 / .62); --ink-3: rgb(23 19 15 / .4); --hair: rgb(23 19 15 / .08);
  --accent: #e3202c; --accent-2: #f2434b; --accent-soft: rgb(227 32 44 / .1); --on-accent: #fff;
  --tonal: #fbd9d4; --on-tonal: #5e0d10;
  --amb1: #f9c9c2; --amb2: #f3e6d2; --amb3: #f6d3cc; --amb4: #ece4d4;
  --r-sm: 12px; --r-md: 16px; --r-lg: 24px; --r-xl: 28px;
  --neo-hi: rgb(255 255 255 / .95); --neo-lo: rgb(166 132 100 / .32);
  --neo: -5px -5px 12px var(--neo-hi), 7px 7px 16px var(--neo-lo);
  --neo-sm: -3px -3px 7px var(--neo-hi), 4px 4px 9px var(--neo-lo);
  --neo-in: inset 3px 3px 7px var(--neo-lo), inset -3px -3px 7px var(--neo-hi);
  --state-hover: rgb(23 19 15 / .06); --state-press: rgb(23 19 15 / .1);
  --glass-fill: linear-gradient(160deg, rgb(255 251 245 / .62), rgb(255 248 240 / .36));
  --glass-fill-thick: linear-gradient(160deg, rgb(255 251 245 / .86), rgb(250 243 233 / .74));
  --glass-blur: blur(26px) saturate(180%);
  --glass-edge: linear-gradient(160deg, rgb(255 255 255 / 1), rgb(255 255 255 / .25) 35%, rgb(255 255 255 / .05) 60%, rgb(255 255 255 / .7));
  --glass-shadow: 0 1px 0 rgb(255 255 255 / .8) inset, 0 -1px 0 rgb(255 255 255 / .2) inset, 0 20px 40px -24px rgb(90 50 20 / .35);
  --bar-fill: linear-gradient(160deg, rgb(255 251 245 / .8), rgb(250 243 233 / .66));
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="umami"] { --bg: #1b1714; --ink: #f3ece2; --ink-2: rgb(243 236 226 / .64); --ink-3: rgb(243 236 226 / .4); --hair: rgb(255 255 255 / .08);
    --accent: #ff4650; --accent-2: #ff6b72; --tonal: #4a1518; --on-tonal: #ffd9d6; --amb1: #4a1418; --amb2: #2a2118; --amb3: #3a1416; --amb4: #1f231c;
    --neo-hi: rgb(255 255 255 / .05); --neo-lo: rgb(0 0 0 / .6); --state-hover: rgb(255 255 255 / .06); --state-press: rgb(255 255 255 / .1);
    --glass-fill: linear-gradient(160deg, rgb(255 255 255 / .1), rgb(255 255 255 / .04)); --glass-fill-thick: linear-gradient(160deg, rgb(44 38 33 / .9), rgb(30 26 22 / .86));
    --glass-edge: linear-gradient(160deg, rgb(255 255 255 / .35), rgb(255 255 255 / .05) 40%, rgb(255 255 255 / .15));
    --glass-shadow: 0 1px 0 rgb(255 255 255 / .1) inset, 0 20px 40px -20px rgb(0 0 0 / .7); --bar-fill: linear-gradient(160deg, rgb(44 38 33 / .86), rgb(30 26 22 / .8)); }
}

/* ---- Material 3 states on everything you can touch ---- */
:root[data-theme="umami"] :is(button, .chip, .card, .btn-primary, .hh-ghost, .seg button, .theme-opt):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
:root[data-theme="umami"] :is(.chip, .seg button:not(.on), .mini-seg button:not(.on), .stepper button, .text-btn):hover { background-image: linear-gradient(var(--state-hover), var(--state-hover)); }
:root[data-theme="umami"] :is(.chip, .seg button, .stepper button):active { background-image: linear-gradient(var(--state-press), var(--state-press)); }

/* ---- Neumorphism: extruded controls that press in ---- */
:root[data-theme="umami"] .chip { background: var(--bg); box-shadow: var(--neo-sm); border-radius: 12px; -webkit-backdrop-filter: none; backdrop-filter: none; }
:root[data-theme="umami"] .chip::before { display: none; }
:root[data-theme="umami"] .chip:active { box-shadow: var(--neo-in); }
:root[data-theme="umami"] .chip.on { background: var(--tonal); color: var(--on-tonal); box-shadow: var(--neo-in); }
:root[data-theme="umami"] .chip.on:not(.chip-bimby)::before { display: inline-block; content: ""; position: static; width: .5rem; height: .85rem; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -2px); margin-right: .15rem; padding: 0; background: none; -webkit-mask: none; mask: none; }
/* categories become underline tabs (structure: MD3 primary tabs) */
:root[data-theme="umami"] .chips.cats { gap: 1.4rem; padding-bottom: .4rem; }
:root[data-theme="umami"] .chips.cats .chip { box-shadow: none; background: none; border-radius: 0; padding: 0 .1rem; height: 2.4rem; font-size: 1rem; font-weight: 600; color: var(--ink-3); position: relative; }
:root[data-theme="umami"] .chips.cats .chip.on { color: var(--ink); box-shadow: none; }
:root[data-theme="umami"] .chips.cats .chip.on::before { display: none; }
:root[data-theme="umami"] .chips.cats .chip::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: .15rem; height: 3px; border-radius: 3px; background: var(--ink); transform: scaleX(0); transition: transform .35s var(--ease-jelly); }
:root[data-theme="umami"] .chips.cats .chip.on::after { transform: none; }
:root[data-theme="umami"] .seg, :root[data-theme="umami"] .mini-seg { background: var(--bg); box-shadow: var(--neo-in); -webkit-backdrop-filter: none; backdrop-filter: none; }
:root[data-theme="umami"] .seg::before { display: none; }
:root[data-theme="umami"] .seg button.on, :root[data-theme="umami"] .mini-seg button.on { background: var(--ink); color: var(--bg); box-shadow: 0 6px 14px -6px rgb(0 0 0 / .45); }
:root[data-theme="umami"] .search-wrap { background: var(--bg); box-shadow: var(--neo-in); -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 16px; }
:root[data-theme="umami"] .search-wrap::before { display: none; }
:root[data-theme="umami"] input:not([type=checkbox]):not([type=radio]), :root[data-theme="umami"] textarea, :root[data-theme="umami"] select { background-color: var(--bg); border-color: transparent; box-shadow: var(--neo-in); border-radius: 14px; }
:root[data-theme="umami"] .stepper { background: var(--bg); box-shadow: var(--neo-sm); }
:root[data-theme="umami"] .stepper button { color: var(--ink); } :root[data-theme="umami"] .stepper output { color: var(--ink); }
:root[data-theme="umami"] .stepper button:active { box-shadow: var(--neo-in); }
:root[data-theme="umami"] .ing input, :root[data-theme="umami"] .ing-check input, :root[data-theme="umami"] .litem input { border-radius: 8px; border-color: transparent; background: var(--bg); box-shadow: var(--neo-in); }
:root[data-theme="umami"] .ing input:checked, :root[data-theme="umami"] .ing-check input:checked { background: var(--accent); box-shadow: 0 4px 10px -3px rgb(227 32 44 / .6); }
/* MD3 filled button in sumi black (like a lacquer tray); tonal red reserved for the FAB and the hero */
:root[data-theme="umami"] .btn-primary { background: var(--ink); color: var(--bg); border-radius: 18px; box-shadow: var(--neo-sm), 0 12px 24px -14px rgb(0 0 0 / .6); }
:root[data-theme="umami"] .btn-primary:active { transform: scale(.98); box-shadow: inset 0 3px 8px rgb(0 0 0 / .45); }
:root[data-theme="umami"] .fab { border-radius: 18px; background: var(--accent); box-shadow: var(--neo-sm), 0 14px 26px -10px rgb(227 32 44 / .7); }
:root[data-theme="umami"] .fab:active { box-shadow: inset 0 3px 10px rgb(0 0 0 / .3); }
:root[data-theme="umami"] .menu-btn { border: 0; border-radius: 14px; background: var(--bg); color: var(--ink); box-shadow: var(--neo-sm); }
:root[data-theme="umami"] body.menu-open .menu-btn { box-shadow: var(--neo-in); background: var(--bg); }

/* ---- Recipe tiles: a bowl on a cream tile, waves behind ---- */
:root[data-theme="umami"] .card { aspect-ratio: 3 / 4.1; background: var(--bg); box-shadow: var(--neo); border-radius: 26px; }
:root[data-theme="umami"] .card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 58%; z-index: -2; background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="24" viewBox="0 0 64 32"><g fill="none" stroke="%2317130f" stroke-opacity=".06" stroke-width="1.4"><circle cx="32" cy="32" r="30"/><circle cx="32" cy="32" r="22"/><circle cx="32" cy="32" r="14"/><circle cx="0" cy="16" r="30"/><circle cx="0" cy="16" r="22"/><circle cx="0" cy="16" r="14"/><circle cx="64" cy="16" r="30"/><circle cx="64" cy="16" r="22"/><circle cx="64" cy="16" r="14"/></g></svg>'); border-radius: 26px 26px 0 0;
  -webkit-mask: linear-gradient(#000 40%, transparent); mask: linear-gradient(#000 40%, transparent); }
:root[data-theme="umami"] .card:active { box-shadow: var(--neo-in); transform: none; }
:root[data-theme="umami"] .card .photo, :root[data-theme="umami"] .card .ph-fallback { inset: auto; left: 13%; top: 9%; width: 74%; height: auto; aspect-ratio: 1; border-radius: 50%; z-index: 0;
  box-shadow: 0 16px 24px -12px rgb(60 30 10 / .55), 0 0 0 5px rgb(255 255 255 / .55); }
:root[data-theme="umami"] .card:hover .photo { transform: rotate(-8deg) scale(1.04); }
:root[data-theme="umami"] .card .caption { left: .5rem; right: .5rem; bottom: .55rem; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; text-align: center; align-items: center; color: var(--ink); }
:root[data-theme="umami"] .card .caption::before { display: none; }
:root[data-theme="umami"] .card .caption h3 { color: var(--ink); text-shadow: none; font-size: .95rem; }
:root[data-theme="umami"] .card .caption .meta { color: var(--ink-2); justify-content: center; }
:root[data-theme="umami"] .card .tag, :root[data-theme="umami"] .card .badge-cook, :root[data-theme="umami"] .card .fav { background: rgb(23 19 15 / .06); color: var(--ink); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
:root[data-theme="umami"] .card .tag::before, :root[data-theme="umami"] .card .badge-cook::before, :root[data-theme="umami"] .card .fav::before { display: none; }
:root[data-theme="umami"] .card .top { z-index: 1; }

/* ---- Hero: sumi night with seigaiha and a red sun; bowl in a circle ---- */
:root[data-theme="umami"] .home-hero { background-color: #121010; background-image: radial-gradient(circle at 88% 30%, #e3202c 0 24%, transparent 24.3%), url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="24" viewBox="0 0 64 32"><g fill="none" stroke="%23ffffff" stroke-opacity=".07" stroke-width="1.4"><circle cx="32" cy="32" r="30"/><circle cx="32" cy="32" r="22"/><circle cx="32" cy="32" r="14"/><circle cx="0" cy="16" r="30"/><circle cx="0" cy="16" r="22"/><circle cx="0" cy="16" r="14"/><circle cx="64" cy="16" r="30"/><circle cx="64" cy="16" r="22"/><circle cx="64" cy="16" r="14"/></g></svg>'); border-radius: 28px; }
:root[data-theme="umami"] .home-hero::after { background: none; }
:root[data-theme="umami"] .hh-bg { display: none; }
:root[data-theme="umami"] .home-hero h2 { font-family: var(--font); font-weight: 900; text-transform: uppercase; letter-spacing: .02em; font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.05; max-width: 14ch; }
:root[data-theme="umami"] .home-hero h2 em { font-style: normal; color: var(--accent-2); }
:root[data-theme="umami"] .hh-greet { color: #ff8c8f; }
:root[data-theme="umami"] .hh-actions .btn-primary { background: var(--accent); color: #fff; border-radius: 10px; box-shadow: 0 12px 24px -12px rgb(227 32 44 / .8); }
:root[data-theme="umami"] .hh-ghost { border-radius: 10px; }
:root[data-theme="umami"] .hh-week { transform: none; background: none; box-shadow: none; padding: 0; width: min(100%, 19rem); }
:root[data-theme="umami"] .hh-week:hover { transform: rotate(-6deg); }
:root[data-theme="umami"] .hh-week img { aspect-ratio: 1; border-radius: 50%; margin: 0; box-shadow: 0 30px 40px -20px rgb(0 0 0 / .8), 0 0 0 8px #1d1a19; }
:root[data-theme="umami"] .hh-week .eyebrow, :root[data-theme="umami"] .hh-week b, :root[data-theme="umami"] .hh-week i { display: none; }
/* the phone gets the immersive hero too */
@media (max-width: 767px) {
  :root[data-theme="umami"] .home-hero { display: grid; grid-template-columns: 1fr 42%; align-items: center; gap: .5rem; position: relative; overflow: hidden; color: #fff8ef;
    margin: 0 0 1.25rem; padding: 1.4rem 1.2rem; min-height: 12.5rem; }
  :root[data-theme="umami"] .home-hero h2 { margin: 0; font-size: 1.45rem; }
  :root[data-theme="umami"] .hh-greet { margin: 0 0 .4rem; font-size: .9rem; font-family: var(--serif); font-style: italic; }
  :root[data-theme="umami"] .hh-sub, :root[data-theme="umami"] .hh-stats, :root[data-theme="umami"] .hh-ghost { display: none; }
  :root[data-theme="umami"] .hh-actions { margin-top: 1rem; }
  :root[data-theme="umami"] .hh-actions .btn-primary { min-height: 2.5rem; padding: 0 1rem; font-size: .875rem; }
  :root[data-theme="umami"] .hh-week { display: block; width: 100%; margin-right: -2.2rem; }
  :root[data-theme="umami"] .home-grid { margin-top: 0; }
}

/* ---- Recipe page: red seigaiha stage with the dish in a bowl ---- */
:root[data-theme="umami"] .hero { background-color: #e3202c; background-image: radial-gradient(circle at 10% 18%, #a90f19 0 20%, transparent 20.3%), url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="24" viewBox="0 0 64 32"><g fill="none" stroke="%23ffffff" stroke-opacity=".14" stroke-width="1.4"><circle cx="32" cy="32" r="30"/><circle cx="32" cy="32" r="22"/><circle cx="32" cy="32" r="14"/><circle cx="0" cy="16" r="30"/><circle cx="0" cy="16" r="22"/><circle cx="0" cy="16" r="14"/><circle cx="64" cy="16" r="30"/><circle cx="64" cy="16" r="22"/><circle cx="64" cy="16" r="14"/></g></svg>'); height: min(56vh, 28rem); }
:root[data-theme="umami"] .hero img, :root[data-theme="umami"] .hero .ph { inset: auto; width: min(78vw, 22rem); height: auto; aspect-ratio: 1; left: 50%; top: 13%; transform: translateX(-50%); border-radius: 50%;
  box-shadow: 0 34px 50px -24px rgb(60 0 0 / .85), 0 0 0 10px rgb(20 14 12 / .9); }
:root[data-theme="umami"] .hero::after { background: linear-gradient(180deg, transparent 60%, rgb(0 0 0 / .45)); }

/* ---- Liquid glass: overlays breathe over the cream ---- */
:root[data-theme="umami"] .cup-menu { --cup: rgb(227 32 44 / .84); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .45), inset 0 -30px 60px -30px rgb(255 255 255 / .25), 0 40px 80px -30px rgb(120 10 10 / .55); background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="24" viewBox="0 0 64 32"><g fill="none" stroke="%23ffffff" stroke-opacity=".05" stroke-width="1.4"><circle cx="32" cy="32" r="30"/><circle cx="32" cy="32" r="22"/><circle cx="32" cy="32" r="14"/><circle cx="0" cy="16" r="30"/><circle cx="0" cy="16" r="22"/><circle cx="0" cy="16" r="14"/><circle cx="64" cy="16" r="30"/><circle cx="64" cy="16" r="22"/><circle cx="64" cy="16" r="14"/></g></svg>'); }
:root[data-theme="umami"] .cup-menu::before { background: radial-gradient(ellipse 100% 100% at 0 100%, transparent 98%, rgb(227 32 44 / .84) 100%); }
:root[data-theme="umami"] .cup-menu::after { background: radial-gradient(ellipse 100% 100% at 100% 100%, transparent 98%, rgb(227 32 44 / .84) 100%); }
:root[data-theme="umami"] .section.glass, :root[data-theme="umami"] .home-side { border-radius: 24px; }
:root[data-theme="umami"] .jt b::after { background: var(--accent); }
@media (max-width: 767px) {
  :root[data-theme="umami"] .hh-week { justify-self: end; width: 150%; max-width: 13rem; margin-right: -3rem; }
  :root[data-theme="umami"] .hh-week img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
  :root[data-theme="umami"] .home-hero { background-image: radial-gradient(circle at 96% 50%, #e3202c 0 30%, transparent 30.3%), url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="24" viewBox="0 0 64 32"><g fill="none" stroke="%23ffffff" stroke-opacity=".07" stroke-width="1.4"><circle cx="32" cy="32" r="30"/><circle cx="32" cy="32" r="22"/><circle cx="32" cy="32" r="14"/><circle cx="0" cy="16" r="30"/><circle cx="0" cy="16" r="22"/><circle cx="0" cy="16" r="14"/><circle cx="64" cy="16" r="30"/><circle cx="64" cy="16" r="22"/><circle cx="64" cy="16" r="14"/></g></svg>'); }
}
:root[data-theme="umami"] .hero { height: min(60vh, 30rem); }
:root[data-theme="umami"] .hero img, :root[data-theme="umami"] .hero .ph { width: min(56vw, 17rem); top: 11%; }
:root[data-theme="umami"] .hero h2 { text-shadow: 0 2px 14px rgb(80 0 0 / .5); }
:root[data-theme="umami"] .card { aspect-ratio: 3 / 4.4; }
:root[data-theme="umami"] .card .photo, :root[data-theme="umami"] .card .ph-fallback { left: 16%; top: 17%; width: 68%; }
:root[data-theme="umami"] .hero img, :root[data-theme="umami"] .hero .ph { width: min(50vw, 15.5rem); top: 9%; }
@media (min-width: 768px) { :root[data-theme="umami"] .hero img, :root[data-theme="umami"] .hero .ph { width: min(30vw, 19rem); } }


/* =====================================================================
   Seigaiha (青海波), the classic way: overlapping scales, three concentric arcs each,
   lower rows covering the ones above. Drawn as a mask so the colour follows the theme:
   set --wave on any surface; the base is whatever is underneath.
   ===================================================================== */
:root { --seigaiha: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 50' width='100' height='50'><filter id='a' x='0' y='0' width='1' height='1'><feColorMatrix type='matrix' values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  1 0 0 0 0'/></filter><g filter='url(%23a)'><rect width='100' height='50' fill='black'/><circle cx='0' cy='0' r='50' fill='black'/><circle cx='0' cy='0' r='47.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='0' cy='0' r='35.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='0' cy='0' r='23.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='100' cy='0' r='50' fill='black'/><circle cx='100' cy='0' r='47.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='100' cy='0' r='35.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='100' cy='0' r='23.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='50' cy='25' r='50' fill='black'/><circle cx='50' cy='25' r='47.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='50' cy='25' r='35.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='50' cy='25' r='23.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='0' cy='50' r='50' fill='black'/><circle cx='0' cy='50' r='47.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='0' cy='50' r='35.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='0' cy='50' r='23.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='100' cy='50' r='50' fill='black'/><circle cx='100' cy='50' r='47.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='100' cy='50' r='35.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='100' cy='50' r='23.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='50' cy='75' r='50' fill='black'/><circle cx='50' cy='75' r='47.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='50' cy='75' r='35.5' stroke='white' stroke-width='3.6' fill='none'/><circle cx='50' cy='75' r='23.5' stroke='white' stroke-width='3.6' fill='none'/></g></svg>"); --wave-size: 56px 28px; }
.wave-layer { position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: var(--wave, rgb(255 255 255 / .08));
  -webkit-mask: var(--seigaiha) 0 0 / var(--wave-size) repeat; mask: var(--seigaiha) 0 0 / var(--wave-size) repeat; }
.home-hero { --wave: rgb(255 255 255 / .07); }
.hero { --wave: rgb(255 255 255 / .16); }
.hero .wave-layer { z-index: -3; }
.cup-menu { --wave: rgb(255 255 255 / .1); }
.cup-menu .wave-layer { z-index: 0; -webkit-mask-position: 0 100%; mask-position: 0 100%;
  -webkit-mask-image: var(--seigaiha), linear-gradient(transparent 35%, #000); -webkit-mask-composite: source-in;
  mask-image: var(--seigaiha), linear-gradient(transparent 35%, #000); mask-composite: intersect; mask-size: var(--wave-size), 100% 100%; -webkit-mask-size: var(--wave-size), 100% 100%; mask-repeat: repeat, no-repeat; -webkit-mask-repeat: repeat, no-repeat; }
.cup-menu > :not(.wave-layer) { position: relative; z-index: 1; }
/* the detail photo hides the waves until a theme stages the dish in a bowl */
:root:not([data-theme="umami"]) .hero .wave-layer { display: none; }
/* theme colours */
:root[data-theme="washi"] .home-hero { --wave: rgb(244 239 229 / .1); background-image: none; }
:root[data-theme="washi"] .cup-menu { --wave: rgb(255 240 225 / .12); background-image: none; }
:root[data-theme="umami"] .home-hero { --wave: rgb(255 255 255 / .06); background-image: radial-gradient(circle at 88% 30%, #e3202c 0 24%, transparent 24.3%); }
:root[data-theme="umami"] .hero { --wave: rgb(255 255 255 / .14); background-image: radial-gradient(circle at 10% 18%, #a90f19 0 20%, transparent 20.3%); }
:root[data-theme="umami"] .cup-menu { --wave: rgb(255 255 255 / .12); background-image: none; }
:root[data-theme="umami"] .card::before { background: color-mix(in srgb, var(--ink) 7%, transparent);
  -webkit-mask: var(--seigaiha) 0 0 / 44px 22px repeat, linear-gradient(#000 35%, transparent) no-repeat; -webkit-mask-composite: source-in;
  mask: var(--seigaiha) 0 0 / 44px 22px repeat, linear-gradient(#000 35%, transparent) 0 0 / 100% 100% no-repeat; mask-composite: intersect; }
@media (max-width: 767px) { :root[data-theme="umami"] .home-hero { background-image: radial-gradient(circle at 96% 50%, #e3202c 0 30%, transparent 30.3%); } }

/* =====================================================================
   Harmony: one control language for segments, search and tabs, tied to the lettering.
   Same height, same radius family, same type; the selected state is a raised surface,
   and the tab underline is the title's rule (accent, 2px).
   ===================================================================== */
:root { --ctl-h: 2.75rem; --ctl-r: 14px; }
.seg { border-radius: var(--ctl-r); padding: .25rem; gap: .25rem; }
.seg button { height: calc(var(--ctl-h) - .5rem); border-radius: calc(var(--ctl-r) - .25rem); font-size: .9375rem; font-weight: 600; letter-spacing: -0.01em; color: var(--ink-2); }
.seg button.on { background: var(--bg); color: var(--ink); box-shadow: 0 1px 0 rgb(255 255 255 / .8) inset, 0 4px 12px -4px rgb(40 20 10 / .25); }
.seg button.on svg { color: var(--accent); }
.search-wrap { border-radius: var(--ctl-r); }
.search-wrap input.search { height: var(--ctl-h); font-size: .9375rem; }
/* categories: text tabs with the lettering's rule */
.chips.cats { gap: 1.5rem; padding: .1rem 1.25rem .5rem; }
.chips.cats .chip { background: none; box-shadow: none; border-radius: 0; padding: 0 .05rem; height: 2.4rem; font-size: .9375rem; font-weight: 600;
  letter-spacing: -0.01em; color: var(--ink-3); position: relative; -webkit-backdrop-filter: none; backdrop-filter: none; }
.chips.cats .chip::before { display: none !important; }
.chips.cats .chip.on { color: var(--ink); background: none; box-shadow: none; }
.chips.cats .chip::after { content: ""; position: absolute; left: 0; right: 0; bottom: .2rem; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform .4s var(--ease-soft); }
.chips.cats .chip.on::after { transform: none; }
.chips.cats .chip svg { color: currentColor; }
.home-main .chips.cats { padding: 0; }
/* the title rule and the tab underline are the same mark */
.jt b::after { height: 2px; background: var(--accent); }
/* buttons share the control radius; the primary keeps its weight but not a pill */
.btn-primary { border-radius: var(--ctl-r); font-weight: 650; letter-spacing: -0.01em; }
.hh-ghost, .cm-import { border-radius: var(--ctl-r); }
:root[data-theme="umami"] { --ctl-r: 16px; }
:root[data-theme="umami"] .seg button.on { background: var(--bg); color: var(--ink); box-shadow: var(--neo-sm); }
:root[data-theme="umami"] .chips.cats .chip::after { left: 0; right: 0; height: 2px; border-radius: 2px; background: var(--accent); }
:root[data-theme="umami"] .btn-primary { border-radius: var(--ctl-r); }
:root[data-theme="washi"] { --ctl-r: 6px; }
:root[data-theme="washi"] .jt b::after { background: linear-gradient(90deg, var(--kin), #e3c77d 40%, var(--kin) 70%, #8c6a22); }
:root[data-theme="washi"] .chips.cats .chip::after { background: var(--kin); }

/* Stats block: breathing room inside each column, labels never touch the edges */
.stats { padding: 1rem .5rem .95rem; }
.stat { min-width: 0; padding: 0 .45rem; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.stat b { font-size: 1.0625rem; line-height: 1.15; white-space: nowrap; }
.stat span { display: block; max-width: 100%; font-size: .625rem; letter-spacing: .04em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat + .stat::after { top: 14%; bottom: 14%; }
@media (max-width: 380px) { .stat span { letter-spacing: .02em; } .stat { padding: 0 .25rem; } }
/* inner padding: captions, tags and summaries keep at least ~12px from their edges */
.card .caption { padding: .7rem .8rem .75rem; }
.tags span { padding: .35rem .85rem; }
.week-sum { padding: .75rem .5rem; }
.week-sum div { padding: 0 .4rem; min-width: 0; gap: .2rem; }
.week-sum span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* every heading outside a card speaks the same lettering */
.block-head h3 { font-family: var(--letter); font-weight: 300; font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0; font-size: 1.5rem; letter-spacing: -0.03em; text-transform: lowercase; }


/* =====================================================================
   Bimby display on each step (time · temperature · speed), like the machine's screen
   ===================================================================== */
.step-body { flex: 1; min-width: 0; }
.tm-display { display: flex; flex-wrap: wrap; align-items: stretch; gap: .4rem; margin-top: .6rem; padding: .45rem; border-radius: 16px;
  background: #1c1a19; color: #f5efe6; box-shadow: inset 0 1px 0 rgb(255 255 255 / .08), 0 8px 18px -12px rgb(0 0 0 / .6); width: fit-content; max-width: 100%; }
.tm-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; min-width: 4.2rem; padding: .4rem .7rem;
  border-radius: 11px; background: rgb(255 255 255 / .06); font: inherit; color: inherit; border: 0; }
.tm-cell b { font-size: .9375rem; font-weight: 700; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; }
.tm-cell b svg { width: .95rem; height: .95rem; color: #6fd3a0; }
.tm-cell small { font-size: .625rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .6; }
.tm-display .tm-time { background: #2fa36b; color: #fff; cursor: pointer; }
.tm-display .tm-time:hover { background: #33b376; }
.tm-display .tm-time small { opacity: .85; }
.tm-display .timer-chip svg { display: none; }
.tm-wide { min-width: 5.5rem; }
.tm-acc { align-self: center; font-size: .75rem; font-weight: 600; padding: .3rem .6rem; border-radius: 999px; background: rgb(255 255 255 / .1); }
.cook .tm-display { margin-top: 1rem; background: rgb(0 0 0 / .35); }
.cook .tm-cell b { font-size: 1.15rem; }

.bimby-cta { display: flex; align-items: center; gap: .9rem; }
.bimby-cta > div:nth-child(2) { flex: 1; min-width: 0; }
.bimby-cta h4 { margin: 0 0 .15rem; font-family: var(--letter); font-weight: 400; font-size: 1.25rem; letter-spacing: -0.02em; }
.bimby-cta .meta { display: block; margin: 0; }
.bc-ico { width: 2.9rem; height: 2.9rem; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.bc-ico svg { width: 1.5rem; height: 1.5rem; }
.bimby-origin { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-radius: var(--r-lg); color: var(--ink-2); font-size: .875rem; }
.bimby-origin svg { color: var(--accent); width: 1.2rem; height: 1.2rem; }
.bimby-origin b { color: var(--accent); font-weight: 650; }
.bz-intro { display: flex; gap: .9rem; align-items: flex-start; }
.bz-intro p { margin: 0; line-height: 1.5; }
.bz-wait { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border-radius: 14px; background: var(--accent-soft); font-weight: 600; }
.bz-wait[hidden] { display: none; }

/* =====================================================================
   Button language (after the reference): thin-outline pills, lowercase labels,
   sizes as circles (S · M · L), counters as outlined pills; one filled action per screen.
   ===================================================================== */
:root { --ctl-r: 999px; --line: color-mix(in srgb, var(--ink) 55%, transparent); }
html:root .btn-outline, html:root[data-theme] .btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 2.75rem; padding: 0 1.5rem; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); font-size: .9375rem; font-weight: 500; text-transform: lowercase; letter-spacing: .01em; flex: none; transition: background-color .2s, transform .15s; }
html:root .btn-outline:hover, html:root[data-theme] .btn-outline:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
html:root .btn-outline:active, html:root[data-theme] .btn-outline:active, html:root .btn-primary:active, html:root[data-theme] .btn-primary:active, html:root .size-opt:active, html:root[data-theme] .size-opt:active { transform: scale(.97); }
html:root .btn-primary, html:root[data-theme] .btn-primary { border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 500; text-transform: lowercase; letter-spacing: .01em; box-shadow: 0 10px 22px -14px rgb(0 0 0 / .6); border: 1.5px solid var(--ink); }
html:root .hh-actions .btn-primary, html:root[data-theme] .hh-actions .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
html:root .hh-ghost, html:root[data-theme] .hh-ghost, html:root .cm-import, html:root[data-theme] .cm-import { border-radius: 999px; background: transparent; box-shadow: none; border: 1.5px solid rgb(255 255 255 / .7); font-weight: 500; text-transform: lowercase; }
html:root .detail-actions > button:not(.btn-primary), html:root[data-theme] .detail-actions > button:not(.btn-primary) { background: transparent; border: 1.5px solid var(--line); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
html:root .detail-actions > button:not(.btn-primary)::before, html:root[data-theme] .detail-actions > button:not(.btn-primary)::before { display: none; }
html:root .size-picker, html:root[data-theme] .size-picker { display: flex; gap: .7rem; align-items: center; }
html:root .size-opt, html:root[data-theme] .size-opt { width: 3.3rem; height: 3.3rem; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; color: var(--ink); font-weight: 600; font-size: .875rem; display: grid; place-items: center; transition: background-color .2s, color .2s; }
html:root .size-opt.on, html:root[data-theme] .size-opt.on { background: color-mix(in srgb, var(--ink) 55%, var(--bg)); border-color: color-mix(in srgb, var(--ink) 55%, var(--bg)); color: var(--bg); }
html:root .mini-seg, html:root[data-theme] .mini-seg { background: transparent; box-shadow: none; padding: 0; gap: .5rem; }
html:root .mini-seg button, html:root[data-theme] .mini-seg button { width: 2.6rem; min-width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; color: var(--ink); box-shadow: none; }
html:root .mini-seg button.on, html:root[data-theme] .mini-seg button.on { background: color-mix(in srgb, var(--ink) 55%, var(--bg)); border-color: transparent; color: var(--bg); box-shadow: none; }
html:root .stepper, html:root[data-theme] .stepper { background: transparent; box-shadow: none; border: 1.5px solid var(--line); padding: .15rem .3rem; }
html:root .stepper button, html:root[data-theme] .stepper button, html:root .stepper output, html:root[data-theme] .stepper output { color: var(--ink); box-shadow: none; }
html:root .seg, html:root[data-theme] .seg { background: transparent; box-shadow: none; padding: 0; gap: .5rem; -webkit-backdrop-filter: none; backdrop-filter: none; }
html:root .seg::before, html:root[data-theme] .seg::before { display: none; }
html:root .seg button, html:root[data-theme] .seg button { border-radius: 999px; border: 1.5px solid var(--line); height: 2.6rem; font-weight: 500; }
html:root .seg button.on, html:root[data-theme] .seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); box-shadow: none; }
html:root .seg button.on svg, html:root[data-theme] .seg button.on svg { color: currentColor; }
html:root .search-wrap, html:root[data-theme] .search-wrap { border-radius: 999px; }
html:root .chip:not(.cats .chip), html:root[data-theme] .chip:not(.cats .chip) { border-radius: 999px; }
html:root .menu-btn, html:root[data-theme] .menu-btn { border-radius: 50%; border: 1.5px solid currentColor; background: transparent; box-shadow: none; }
html:root .fab, html:root[data-theme] .fab { border-radius: 50%; }
/* dark surfaces flip the outline to light */
.home-hero, .cup-menu, .cook { --line: rgb(255 255 255 / .7); }
.stat { padding: 0 .2rem; }
.stat span { letter-spacing: .02em; font-size: .6rem; }
/* rows that scroll sideways bleed to the screen edge instead of being clipped by the gutter */
html:root .seg, html:root[data-theme] .seg { margin-left: -1.25rem; margin-right: -1.25rem; padding: .1rem 1.25rem; overflow-x: auto; }
html:root .seg button, html:root[data-theme] .seg button { flex: 0 0 auto; }
@media (max-width: 767px) { .home-main .chips.cats { padding: .1rem 1.25rem .5rem; } }
@media (min-width: 768px) { html:root .seg, html:root[data-theme] .seg { margin-left: 0; margin-right: 0; padding: .1rem 0; } }

/* Labels sit in the optical centre of every control */
button, .btn-primary, .btn-outline, .chip, .seg button, .size-opt, .mini-seg button, .hh-ghost, .cm-import, .tm-cell, .text-btn, .tag, .badge-cook {
  line-height: 1; }
html:root .stepper, html:root[data-theme] .stepper { display: inline-flex; align-items: center; }
html:root .stepper output, html:root[data-theme] .stepper output { display: inline-flex; align-items: center; justify-content: center; height: 2rem; line-height: 1; }
html:root .stepper button, html:root[data-theme] .stepper button { display: inline-flex; align-items: center; justify-content: center; }
.btn-primary, .btn-outline, .hh-ghost, .cm-import, .seg button, .chip { display: inline-flex; align-items: center; justify-content: center; }
@supports (text-box: trim-both cap alphabetic) {
  :is(.btn-primary, .btn-outline, .seg button, .size-opt, .mini-seg button, .stepper output, .chip, .hh-ghost, .cm-import) { text-box: trim-both cap alphabetic; }
}


/* No carved (inset) surfaces anywhere: fields are flat with a thin outline, like the buttons */
html:root .search-wrap, html:root[data-theme] .search-wrap { background: color-mix(in srgb, var(--bg) 70%, #fff); box-shadow: none; border: 1.5px solid color-mix(in srgb, var(--ink) 22%, transparent); -webkit-backdrop-filter: none; backdrop-filter: none; }
html:root .search-wrap::before, html:root[data-theme] .search-wrap::before { display: none; }
html:root .search-wrap:focus-within, html:root[data-theme] .search-wrap:focus-within { border-color: var(--ink); }
html:root .search-wrap input.search, html:root[data-theme] .search-wrap input.search { background: transparent; box-shadow: none; border: 0; }
html:root input:not([type=checkbox]):not([type=radio]):not(.search), html:root[data-theme] input:not([type=checkbox]):not([type=radio]):not(.search), html:root textarea, html:root[data-theme] textarea, html:root select, html:root[data-theme] select { box-shadow: none; background-color: color-mix(in srgb, var(--bg) 70%, #fff); border: 1.5px solid color-mix(in srgb, var(--ink) 22%, transparent); border-radius: 14px; }
html:root input:not([type=checkbox]):not([type=radio]):not(.search):focus, html:root[data-theme] input:not([type=checkbox]):not([type=radio]):not(.search):focus, html:root textarea:focus, html:root[data-theme] textarea:focus, html:root select:focus, html:root[data-theme] select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
html:root .ing input, html:root[data-theme] .ing input, html:root .ing-check input, html:root[data-theme] .ing-check input, html:root .litem input, html:root[data-theme] .litem input { box-shadow: none; background: transparent; border: 1.5px solid var(--line); }
html:root .ing input:checked, html:root[data-theme] .ing input:checked, html:root .ing-check input:checked, html:root[data-theme] .ing-check input:checked, html:root .litem input:checked, html:root[data-theme] .litem input:checked { background: var(--accent); border-color: var(--accent); box-shadow: none; }
html:root .card:active, html:root[data-theme] .card:active { box-shadow: var(--neo, 0 14px 30px -12px rgb(73 38 12 / .45)); transform: scale(.98); }
html:root body.menu-open .menu-btn, html:root[data-theme] body.menu-open .menu-btn, html:root .stepper button:active, html:root[data-theme] .stepper button:active, html:root .chip:active, html:root[data-theme] .chip:active, html:root .chip.on, html:root[data-theme] .chip.on, html:root .fab:active, html:root[data-theme] .fab:active, html:root .btn-primary:active, html:root[data-theme] .btn-primary:active { box-shadow: none; }
@media (prefers-color-scheme: dark) {
  html:root .search-wrap, html:root[data-theme] .search-wrap,
  html:root input:not([type=checkbox]):not([type=radio]):not(.search), html:root[data-theme] input:not([type=checkbox]):not([type=radio]):not(.search),
  html:root textarea, html:root[data-theme] textarea, html:root select, html:root[data-theme] select { background-color: rgb(255 255 255 / .05); border-color: rgb(255 255 255 / .18); }
}
:root[data-theme="meianoite"] .search-wrap, :root[data-theme="meianoite"] input:not([type=checkbox]):not([type=radio]):not(.search) { background-color: rgb(255 255 255 / .05); border-color: rgb(255 255 255 / .18); }
:root[data-theme="umami"] { --neo-in: 0 0 0 0 transparent; }

.home-hero { --wave: rgb(255 255 255 / .1); }
.cup-menu { --wave: rgb(255 255 255 / .14); }
:root[data-theme="umami"] .home-hero { --wave: rgb(255 255 255 / .09); }
:root[data-theme="umami"] .hero { --wave: rgb(255 255 255 / .2); }
:root[data-theme="umami"] .cup-menu { --wave: rgb(255 255 255 / .16); }
:root[data-theme="washi"] .home-hero { --wave: rgb(244 239 229 / .13); }
:root[data-theme="gohan"] .home-hero { --wave: rgb(255 90 69 / .12); }
:root[data-theme="umami"] .card::before { background: color-mix(in srgb, var(--ink) 10%, transparent); }

/* =====================================================================
   Concentric corners (Apple): inner radius = outer radius − inset.
   Cards: R 24px, inset 8px → every chip on a card is 32px tall with a 16px radius,
   so its curve runs parallel to the card's corner. Same rule for captions,
   the Bimby display and grouped rows.
   ===================================================================== */
:root { --card-r: 24px; --card-in: 8px; }
:root[data-theme="washi"] { --card-r: 8px; --card-in: 6px; }
html:root .card, html:root[data-theme] .card { border-radius: var(--card-r); }
html:root .card .top, html:root[data-theme] .card .top { top: var(--card-in); left: var(--card-in); right: var(--card-in); align-items: center; }
html:root .card .top :is(.tag, .badge-cook, .fav), html:root[data-theme] .card .top :is(.tag, .badge-cook, .fav) {
  height: calc(2 * (var(--card-r) - var(--card-in))); min-height: 2rem; max-height: 2rem; border-radius: max(2px, calc(var(--card-r) - var(--card-in)));
  display: inline-flex; align-items: center; gap: .3rem; padding: 0 .75rem; font-size: .75rem; line-height: 1; }
html:root .card .top .fav, html:root[data-theme] .card .top .fav { width: 2rem; padding: 0; justify-content: center; }
html:root .card .top .badges, html:root[data-theme] .card .top .badges { display: inline-flex; align-items: center; gap: .3rem; }
html:root .card .top .by .avatar, html:root[data-theme] .card .top .by .avatar,
html:root .card .top .by > *, html:root[data-theme] .card .top .by > * { width: 2rem; height: 2rem; border-radius: 50%; }
html:root .card .caption, html:root[data-theme] .card .caption { left: var(--card-in); right: var(--card-in); bottom: var(--card-in); border-radius: max(2px, calc(var(--card-r) - var(--card-in))); }
html:root[data-theme="umami"] .card::before { border-radius: var(--card-r) var(--card-r) 0 0; }
/* Bimby display: 16px outer, 6px inset → 10px cells */
.tm-display { border-radius: 16px; padding: 6px; gap: 6px; }
.tm-cell { border-radius: 10px; }
.tm-acc { border-radius: 10px; }
/* sections: 24px outer with ~18px padding; anything flush to the padding edge uses 6px+ less */
.stats { border-radius: var(--card-r); }
.share-line, .bimby-origin { border-radius: var(--card-r); }
.home-side .hs-meals a { border-radius: calc(var(--card-r) - 10px); }

/* =====================================================================
   Type system. Two voices only:
   · Fraunces (light, high optical size) — titles and moments: page titles, recipe names,
     greetings, hero lines. Always weight 300–400, tight tracking.
   · System sans (SF on Apple, Inter elsewhere) — the interface. Weights 400 / 500 / 600 only,
     tracking tuned per size the way iOS does (bigger = tighter, tiny caps = looser).
   ===================================================================== */
:root { --w-regular: 400; --w-medium: 500; --w-semibold: 600; }
html { font-feature-settings: "kern", "calt"; }
body { letter-spacing: -0.011em; }
b, strong { font-weight: var(--w-semibold); }
.meta, .subtitle, small { letter-spacing: -0.003em; }
.eyebrow { font-weight: var(--w-semibold); letter-spacing: .07em; font-size: .6875rem; }
/* no heavy sans weights anywhere */
.large-title, .hero h2, .home-hero h2 { font-weight: 400; }
.stat b, .week-sum b, .tm-cell b, .section-head + .stat b { font-weight: var(--w-semibold); letter-spacing: -0.02em; }
.hs-meals b, .meal-main b, .litem b, .group-row b, .rank-row b, .option b, .feed b, .list-card b, .trip-card b { font-weight: var(--w-semibold); letter-spacing: -0.012em; }
.card .caption h3 { font-weight: var(--w-semibold); letter-spacing: -0.015em; font-size: .9375rem; line-height: 1.22; }
.btn-primary, .btn-outline, .seg button, .chip, .hh-ghost, .cm-import, .size-opt, .mini-seg button, .text-btn { font-weight: var(--w-medium); letter-spacing: -0.005em; }
.text-btn.strong { font-weight: var(--w-semibold); }
.tabbar button { font-weight: var(--w-medium); }
.step p, .ing .txt, .sheet-body p { letter-spacing: -0.014em; }
.stat span, .tm-cell small, .week-sum span { font-weight: var(--w-medium); }

/* serif voice: page titles that aren't lettering (group names, list names, trips) */
.large-title { font-family: var(--letter); font-weight: 300; font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0; letter-spacing: -0.035em; font-size: 2.3rem; line-height: 1.04; }
/* recipe names on the photo */
.hero h2 { font-family: var(--letter); font-weight: 400; font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0; letter-spacing: -0.03em; font-size: 2.35rem; line-height: 1.02; }
.nav-title { font-weight: var(--w-semibold); letter-spacing: -0.02em; }
/* hero: one serif line in every theme; the accent word in italic */
html:root .home-hero h2, html:root[data-theme] .home-hero h2 { font-family: var(--letter); font-weight: 400; text-transform: none; letter-spacing: -0.035em;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0; line-height: 1.02; }
html:root .home-hero h2 em, html:root[data-theme] .home-hero h2 em { font-style: italic; font-weight: 400; }
html:root .hh-greet, html:root[data-theme] .hh-greet { font-family: var(--letter); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
.hh-sub { letter-spacing: -0.012em; }
.hh-stats { font-variant-numeric: tabular-nums; letter-spacing: -0.005em; }
.hh-stats b { font-weight: var(--w-semibold); }
@media (max-width: 767px) { html:root[data-theme="umami"] .home-hero h2 { font-size: 1.85rem; } }
/* numbers line up */
.stat b, .week-sum b, .tm-cell b, .stepper output, .hh-stats, .meta { font-variant-numeric: tabular-nums; }


/* Interface face: Zen Kaku Gothic New (400 / 500 / 700). Open, calm, a little Japanese. */
:root { --font: "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont, "Hiragino Sans", system-ui, sans-serif;
  --jp: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif; --w-semibold: 700; }
html { font-family: var(--font); }
button, input, textarea, select { font-family: inherit; }
body { letter-spacing: 0; }
.meta, .subtitle, small, .step p, .ing .txt, .sheet-body p, .hh-sub { letter-spacing: 0; }
.btn-primary, .btn-outline, .seg button, .chip, .hh-ghost, .cm-import, .size-opt, .mini-seg button, .text-btn { letter-spacing: .01em; }
.hs-meals b, .meal-main b, .litem b, .group-row b, .rank-row b, .option b, .feed b, .list-card b, .trip-card b, .card .caption h3, .nav-title { letter-spacing: -0.005em; }
.stat b, .week-sum b, .tm-cell b { letter-spacing: -0.01em; }
.eyebrow { letter-spacing: .1em; }
:root[data-theme="umami"] .card::before { background: color-mix(in srgb, var(--ink) 6%, transparent); }
html:root[data-theme] .card .top :is(.tag, .badge-cook, .fav) { background: color-mix(in srgb, var(--bg) 88%, var(--ink)); }
html:root[data-theme="gohan"] .card .top :is(.tag, .badge-cook, .fav), html:root[data-theme="quente"] .card .top :is(.tag, .badge-cook, .fav),
html:root[data-theme="washi"] .card .top :is(.tag, .badge-cook, .fav) { background: rgb(20 14 10 / .38); color: #fff; }
@media (max-width: 767px) {
  html:root[data-theme="umami"] .home-hero h2 { font-size: 1.7rem; position: relative; z-index: 1; }
  html:root[data-theme="umami"] .hh-text { position: relative; z-index: 1; min-width: 0; }
  html:root[data-theme="umami"] .hh-week { width: 128%; margin-right: -2.4rem; }
}

/* Buttons: small capitals, tracked out — quiet, precise labels */
html:root :is(.btn-primary, .btn-outline, .hh-ghost, .cm-import, .btn-solid, .seg button, .danger-link),
html:root[data-theme] :is(.btn-primary, .btn-outline, .hh-ghost, .cm-import, .btn-solid, .seg button, .danger-link) {
  text-transform: uppercase; font-size: .75rem; font-weight: 700; letter-spacing: .12em; line-height: 1; white-space: nowrap; }
html:root :is(.btn-primary, .btn-outline, .hh-ghost, .cm-import, .btn-solid) svg,
html:root[data-theme] :is(.btn-primary, .btn-outline, .hh-ghost, .cm-import, .btn-solid) svg { width: 1rem; height: 1rem; }
html:root .btn-solid, html:root[data-theme] .btn-solid { border-radius: 999px; padding: 0 1.25rem; min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; }
html:root .seg button, html:root[data-theme] .seg button { font-size: .6875rem; letter-spacing: .1em; }
html:root .hh-actions :is(.btn-primary, .hh-ghost), html:root[data-theme] .hh-actions :is(.btn-primary, .hh-ghost) { min-height: 2.9rem; padding: 0 1.4rem; gap: .6rem; }
html:root .cup-menu .cm-import, html:root[data-theme] .cup-menu .cm-import { padding: .8rem 1.2rem; }
html:root[data-theme] .hh-actions .btn-primary, html:root[data-theme] .hh-ghost { border-radius: 999px; }

/* Sheet header buttons: same small capitals as the rest; cancel quieter, confirm in accent */
html:root .sheet-head .text-btn, html:root[data-theme] .sheet-head .text-btn {
  text-transform: uppercase; font-size: .75rem; font-weight: 700; letter-spacing: .12em; line-height: 1; white-space: nowrap;
  min-height: 2.75rem; padding: 0 .25rem; display: inline-flex; align-items: center; }
html:root .sheet-head [data-close], html:root[data-theme] .sheet-head [data-close] { color: var(--ink-2); justify-self: start; }
html:root .sheet-head [type=submit], html:root[data-theme] .sheet-head [type=submit] { color: var(--accent); }
html:root .sheet-head [type=submit]:disabled, html:root[data-theme] .sheet-head [type=submit]:disabled { opacity: .4; }
html:root #pasteBtn, html:root[data-theme] #pasteBtn { text-transform: uppercase; font-size: .6875rem; font-weight: 700; letter-spacing: .12em; line-height: 1; border-radius: 999px; }


/* =====================================================================
   Final pass: type scale, legibility and accessibility (iOS, iPad, desktop)
   ---------------------------------------------------------------------
   Scale (rem at 16px, iOS names):
     Display (Fraunces 300–400) ... hero 2.4–3.2rem · large title 2.125rem · section 1.375rem
     Title 3 (sans 700) ........... 1.25rem   sheet titles, nav
     Headline (sans 700) .......... 1.0625rem list item names
     Body (sans 400) .............. 1rem / reading text 1.0625rem
     Subhead (sans 400/500) ....... .9375rem  buttons in rows, card titles
     Footnote (sans 400) .......... .8125rem  meta
     Caption (sans 500/700) ....... .75rem    small labels;  .6875rem minimum (eyebrows)
   Contrast: secondary text ≥ 4.5:1 on every theme; accent text uses a darker ink.
   Targets: 44×44px minimum.
   ===================================================================== */
:root { --text-scale: 1; --accent-ink: color-mix(in srgb, var(--accent) 80%, #000); --ok-ink: #1f7a4a; }
@media (prefers-color-scheme: dark) { :root { --accent-ink: color-mix(in srgb, var(--accent) 70%, #fff); --ok-ink: #6fd3a0; } }
html { font-size: calc(100% * var(--text-scale)); font-synthesis-weight: none; }
@media (min-width: 1024px) { html { font-size: calc(106.25% * var(--text-scale)); } }   /* 17px body at desk distance */
/* secondary inks pass 4.5:1 in every theme and mode */
html:root, html:root[data-theme] { --ink-2: color-mix(in srgb, var(--ink) 76%, transparent); --ink-3: color-mix(in srgb, var(--ink) 66%, transparent); }
@media (prefers-contrast: more) {
  html:root, html:root[data-theme] { --ink-2: var(--ink); --ink-3: color-mix(in srgb, var(--ink) 85%, transparent); --glass-fill: var(--glass-fill-thick); }
  .glass, .glass-photo { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .glass-photo, .topbar::after, .cup-menu, .sheet { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  html:root, html:root[data-theme] { --glass-fill: var(--glass-fill-thick); }
}

/* display voice (Fraunces) — the polaroid and day headers join it; ui-serif fallbacks removed */
.hh-week b, .hh-week i { font-family: var(--letter); }
.day-head b { font-family: var(--letter); font-weight: 400; font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0; font-size: 1.25rem; letter-spacing: -0.02em; text-transform: none; }
.day-head b::first-letter { text-transform: uppercase; }
html:root .section-head h3, html:root[data-theme] .section-head h3, .block-head h3 { font-size: 1.375rem; }
.large-title { font-size: 2.125rem; }
@media (min-width: 768px) { .large-title { font-size: 2.5rem; } html:root .section-head h3, html:root[data-theme] .section-head h3, .block-head h3 { font-size: 1.5rem; } }

/* sans scale */
.sheet-head h2 { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.005em; }
.nav-title { font-size: 1.0625rem; font-weight: 700; }
.step p, .cook .step-card p:not(.eyebrow) { font-size: 1.0625rem; line-height: 1.55; }
.step p { max-width: 68ch; }
.ing .txt { font-size: 1rem; }
.meta, .subtitle { font-size: .875rem; }
.subtitle { font-size: 1rem; }
.hs-meals b, .meal-main b, .group-row b, .rank-row b, .list-card b, .trip-card b { font-size: 1rem; font-weight: 700; }
.hs-meals small, .hs-list small, .slot-label, .note, .ev-status { font-size: .8125rem; }
.card .caption .meta { font-size: .8125rem; }
.eyebrow { font-size: .6875rem; color: var(--ink-2); }
.stat b { font-size: 1.125rem; }
.stat span { font-size: .75rem; text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.week-sum span { font-size: .75rem; color: var(--ink-2); }
.tm-cell small { font-size: .6875rem; text-transform: none; letter-spacing: .01em; opacity: .8; }
.tm-cell b { font-size: 1rem; }
.litem small, .litem .qty, .comprados, .litems-done span { font-size: .8125rem; }
/* weights: only 400 / 500 / 700 exist in Zen Kaku */
[style*="font-weight:650"], .text-btn.strong { font-weight: 700; }

/* accent and success used as text get a darker ink */
a, .text-btn, .pill-btn, .danger-link, .hs-link, .bimby-origin b, .home-head .eyebrow, .add-meal { color: var(--accent-ink); }
html:root .sheet-head [type=submit], html:root[data-theme] .sheet-head [type=submit] { color: var(--accent-ink); }
.score, .ev-status, .rank-row .score { color: var(--ok-ink); }
.pill-btn { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tm-display .tm-time { background: #1d7f50; }
html:root .chips.cats .chip, html:root[data-theme] .chips.cats .chip { color: var(--ink-2); }
html:root .chips.cats .chip.on, html:root[data-theme] .chips.cats .chip.on { color: var(--ink); }
html:root[data-theme="gohan"] .card .top :is(.tag, .badge-cook, .fav), html:root[data-theme="quente"] .card .top :is(.tag, .badge-cook, .fav),
html:root[data-theme="washi"] .card .top :is(.tag, .badge-cook, .fav) { background: rgb(20 14 10 / .58); }
.source { background: rgb(20 14 10 / .45); }

/* 44px targets: grow small controls, or give inline ones an invisible hit area */
html:root .chips.cats .chip, html:root[data-theme] .chips.cats .chip { height: 2.75rem; }
.pill-btn, .add-meal, .danger-link, .tm-display .tm-time { min-height: 2.75rem; }
.price-chip, .bring, .mini, .mini-del, .serv-pill, .source { position: relative; }
.price-chip::after, .bring::after, .mini::after, .mini-del::after, .serv-pill::after { content: ""; position: absolute; inset: -10px -6px; }

/* visible focus everywhere (keyboard on iPad / desktop) */
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 3px; border-radius: 10px; }
.card:focus-visible { outline-offset: 4px; border-radius: var(--card-r); }
/* text-size picker: four "A"s growing */
.text-size .size-opt { font-family: var(--letter); font-weight: 400; }
.progress-ring { width: 4.8rem; height: 4.8rem; }
.progress-ring span { font-size: .6875rem; font-weight: 500; }
.chip { height: 2.5rem; }
.chip::after { content: ""; position: absolute; inset: -3px 0; }
.chip { position: relative; }
html:root .chips.cats .chip::after, html:root[data-theme] .chips.cats .chip::after { inset: auto 0 .2rem 0; }
html:root .stepper button, html:root[data-theme] .stepper button { width: 2.5rem; height: 2.5rem; position: relative; }
html:root .stepper button::after, html:root[data-theme] .stepper button::after { content: ""; position: absolute; inset: -4px; }
.tm-display small { opacity: .9; }

/* Reflow instead of breaking when text is large (text-size setting, small phones) */
.stats { grid-template-columns: repeat(auto-fit, minmax(4.6rem, 1fr)); row-gap: .6rem; }
.stat + .stat::after { display: none; }
.stat:not(:first-child) { border-left: 1px solid var(--hair); }
.week-sum { grid-template-columns: repeat(auto-fit, minmax(4.4rem, 1fr)); row-gap: .4rem; min-width: 0; }
.week-sum b { white-space: nowrap; }
html:root :is(.btn-primary, .btn-glass).wide, html:root[data-theme] :is(.btn-primary, .btn-glass).wide { white-space: normal; text-align: center; height: auto; min-height: 2.9rem; padding: .85rem 1.25rem; line-height: 1.3; }
.detail-actions { flex-wrap: wrap; row-gap: .65rem; }
.detail-actions .btn-primary { flex: 1 1 8rem; }
.detail-actions > button:not(.btn-primary) { flex: none; }
/* normal size: one row; only larger text sizes (or very narrow screens) reflow */
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat:not(:first-child) { border-left: 1px solid var(--hair); }
.detail-actions { flex-wrap: nowrap; }
.detail-actions .btn-primary { flex: 1 1 0; min-width: 0; padding: 0 1rem; }
.week-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html[style*="--text-scale: 1.125"] .stats, html[style*="--text-scale: 1.25"] .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html[style*="--text-scale: 1.125"] .stat:nth-child(3), html[style*="--text-scale: 1.25"] .stat:nth-child(3) { border-left: 0; }
html[style*="--text-scale: 1.125"] .detail-actions, html[style*="--text-scale: 1.25"] .detail-actions { flex-wrap: wrap; }
html[style*="--text-scale: 1.125"] .detail-actions .btn-primary, html[style*="--text-scale: 1.25"] .detail-actions .btn-primary { flex: 1 1 100%; }
html[style*="--text-scale: 1.125"] .week-sum, html[style*="--text-scale: 1.25"] .week-sum { grid-template-columns: repeat(auto-fit, minmax(4.4rem, 1fr)); }
@media (max-width: 359px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat:nth-child(3) { border-left: 0; } }
.section-head { flex-wrap: wrap; row-gap: .6rem; }
html:root .stepper button, html:root[data-theme] .stepper button { width: 2.25rem; height: 2.25rem; }
html:root .stepper button::after, html:root[data-theme] .stepper button::after { inset: -6px -3px; }
@media (max-width: 359px) {
  .detail-actions { gap: .45rem; }
  .detail-actions > button:not(.btn-primary) { width: 2.9rem; height: 2.9rem; }
  html:root .detail-actions .btn-primary, html:root[data-theme] .detail-actions .btn-primary { letter-spacing: .08em; padding: 0 .7rem; gap: .4rem; }
}
/* last contrast + target fixes from the audit */
html:root, html:root[data-theme] { --ink-2: color-mix(in srgb, var(--ink) 80%, transparent); --ink-3: color-mix(in srgb, var(--ink) 72%, transparent);
  --accent-ink: color-mix(in srgb, var(--accent) 72%, #000); --ok-ink: #1a6b40; }
@media (prefers-color-scheme: dark) { html:root, html:root[data-theme] { --accent-ink: color-mix(in srgb, var(--accent) 60%, #fff); --ok-ink: #7fdcab; } }
html:root[data-theme="meianoite"] { --accent-ink: color-mix(in srgb, var(--accent) 60%, #fff); --ok-ink: #7fdcab; }
.slot-label, .slot small, .add-meal, .aisle-head, .link, .ev-status { font-weight: 700; }
.aisle-head { color: var(--accent-ink); }
.today-pill { background: var(--accent-ink); font-weight: 700; }
.ev-status { color: var(--ok-ink); }
.litem.done { opacity: 1; }
.litem.done .txt, .litem.done .qty, .litem.done .note, .ing.done .txt { color: var(--ink-2); }
html:root .mini-seg button.on, html:root[data-theme] .mini-seg button.on,
html:root .size-opt.on, html:root[data-theme] .size-opt.on { background: color-mix(in srgb, var(--ink) 78%, var(--bg)); border-color: transparent; }
.tm-display .tm-time { background: #176a42; }
html:root button.chip, html:root[data-theme] button.chip, .pantry-chip { min-height: 2.75rem; }
.ev-status.open { color: var(--accent-ink); } .ev-status.done { color: var(--ok-ink); }
.share-line .link { color: var(--accent-ink); font-weight: 700; }
.slot-label, .slot small { color: var(--ink-2); }
.add-meal { color: color-mix(in srgb, var(--accent-ink) 85%, var(--ink)); }
.today-pill { color: var(--bg); }
.pantry-chip button { position: relative; }
.pantry-chip button::after { content: ""; position: absolute; inset: -9px; }
.slot-label, .slot small { color: var(--ink); opacity: .82; }
.add-meal { color: var(--ink); } .add-meal svg { color: var(--accent-ink); }
.slot-label, .slot small { opacity: .9; }
