:root {
  --bg: #fbf7f1;
  --surface: #ffffff;
  --surface-2: #f4ede3;
  --text: #2a211b;
  --muted: #7a6c60;
  --border: #e8ddd0;
  --accent: #d9542b;
  --accent-strong: #b8411d;
  --accent-soft: #fbe4d9;
  --on-accent: #ffffff;
  --green: #3f7d4e;
  --green-soft: #e1f0e4;
  --shadow: 0 1px 2px rgba(60, 35, 15, .06), 0 8px 24px rgba(60, 35, 15, .08);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130f;
    --surface: #221c17;
    --surface-2: #2c241e;
    --text: #f3ebe2;
    --muted: #a99a8c;
    --border: #3a3029;
    --accent: #f0703f;
    --accent-strong: #ff8a5c;
    --accent-soft: #3d241a;
    --on-accent: #1b120c;
    --green: #7cc28c;
    --green-soft: #1f3324;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

kbd {
  font-family: var(--font-body);
  font-size: .8em;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { font-size: 1.5rem; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 999px; font-weight: 500; font-size: .9rem;
}
.nav-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.count-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: .75rem;
  display: inline-grid; place-items: center;
}
.nav-btn[aria-pressed="true"] .count-badge { background: var(--on-accent); color: var(--accent); }

/* Hero */
.hero { padding: 48px 0 24px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.05; letter-spacing: -.02em;
  margin: 0 0 12px;
}
.lede { font-size: 1.125rem; margin: 0 0 28px; max-width: 60ch; }

.controls { display: grid; gap: 14px; margin-bottom: 28px; }
.control-group { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: start; }
.control-label {
  font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding-top: 9px;
}
@media (max-width: 640px) {
  .control-group { grid-template-columns: 1fr; gap: 6px; }
  .control-label { padding-top: 0; }
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: .9rem; font-weight: 500;
  transition: background .15s, border-color .15s, transform .1s;
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: scale(.97); }
.chip[aria-checked="true"], .chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
.chip .n { font-size: .75rem; opacity: .7; }

.cta-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 999px;
  padding: 16px 30px; font-size: 1.125rem; font-weight: 600;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .12s, background .15s;
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary .dice { font-size: 1.3rem; display: inline-block; }
.btn-primary.rolling .dice { animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pool-info { color: var(--muted); font-size: .9rem; }

/* Result */
.result { padding-top: 8px; padding-bottom: 32px; scroll-margin-top: 72px; }
.result:empty { display: none; }
.placeholder {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 48px 16px; text-align: center; color: var(--muted);
}
.placeholder-emoji { font-size: 3rem; margin-bottom: 8px; }
.placeholder p { margin: 4px 0; }

.slot {
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  padding: 64px 16px; text-align: center;
}
.slot-emoji { font-size: 4rem; line-height: 1; }
.slot-name { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; margin-top: 12px; color: var(--muted); }

.recipe {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop .35s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .recipe, .btn-primary.rolling .dice { animation: none; }
}

.recipe-head {
  display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 0;
}
.recipe-media { margin: 0; background: var(--surface-2); aspect-ratio: 1 / 1; overflow: hidden; }
.recipe-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-media--emoji { display: grid; place-items: center; font-size: 6rem; background: linear-gradient(135deg, var(--accent-soft), var(--surface-2)); }
.recipe-intro { padding: 28px 28px 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.recipe-kicker { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-strong); }
.recipe h2 {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -.01em;
  font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.1; margin: -4px 0 0;
}
.recipe-desc { margin: 0; max-width: 65ch; }
@media (max-width: 820px) {
  .recipe-head { grid-template-columns: 1fr; }
  .recipe-media { aspect-ratio: 16 / 10; }
  .recipe-intro { padding: 20px 18px; }
}

.meta {
  display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 4px 0 0;
  padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.meta dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.meta dd { margin: 2px 0 0; font-weight: 600; font-size: 1.02rem; }

.recipe-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: .78rem; font-weight: 500; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text);
}
.tag.veg { background: var(--green-soft); color: var(--green); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px; font-weight: 500; font-size: .9rem;
  background: var(--surface); border: 1px solid var(--border);
}
.btn:hover { border-color: var(--accent); }
.btn.is-fav { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.btn.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.accent:hover { background: var(--accent-strong); }
.linklike { background: none; border: none; padding: 0; color: var(--accent-strong); font-weight: 600; text-decoration: underline; }

.recipe-body { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; border-top: 1px solid var(--border); }
.recipe-body h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; margin: 0 0 14px; }
.ingredients { padding: 24px 28px; background: var(--surface-2); }
.method { padding: 24px 28px; }
@media (max-width: 760px) {
  .recipe-body { grid-template-columns: 1fr; }
  .ingredients, .method { padding: 20px 18px; }
}

.ing-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ing-head h3 { margin: 0; }
.people {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px;
}
.people-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--accent-soft); color: var(--accent-strong); font-size: 1.15rem; font-weight: 700; line-height: 1;
  display: grid; place-items: center;
}
.people-btn:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); }
.people-btn:disabled { opacity: .4; cursor: not-allowed; }
.people-val { min-width: 92px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.people-unit { font-weight: 500; color: var(--muted); font-size: .85rem; }
.scale-note, .method-note { font-size: .82rem; color: var(--muted); margin: 0 0 10px; }
.method-note { margin: -6px 0 14px; }
b.q { font-weight: 700; color: var(--accent-strong); }

.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li { border-bottom: 1px solid var(--border); }
.ing-list li:last-child { border-bottom: none; }
.ing-list label { display: flex; gap: 10px; padding: 8px 0; cursor: pointer; align-items: flex-start; }
.ing-list input { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.ing-list input:checked + span { text-decoration: line-through; color: var(--muted); }
.ing-list input:checked + span b.q { color: var(--muted); }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  counter-increment: step; position: relative;
  padding: 0 0 18px 48px; cursor: pointer;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong);
  font-weight: 700; font-size: .9rem;
}
.steps li.done { color: var(--muted); }
.steps li.done::before { content: "✓"; background: var(--green-soft); color: var(--green); }
.steps-hint { font-size: .8rem; color: var(--muted); margin: -8px 0 14px; }

.tip {
  margin-top: 8px; padding: 14px 16px; border-radius: 12px;
  background: var(--accent-soft); border-left: 4px solid var(--accent);
}
.tip strong { color: var(--accent-strong); }
.credit { font-size: .82rem; color: var(--muted); margin: 18px 0 0; }
.credit a { color: var(--muted); }
.credit a:hover { color: var(--accent-strong); }

/* Browse grid */
.browse { padding-top: 24px; padding-bottom: 64px; scroll-margin-top: 72px; }
.browse-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.browse-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; margin: 0; }
.browse-tools { display: flex; gap: 8px; flex: 1 1 320px; max-width: 480px; }
.search {
  flex: 1 1 0; min-width: 0; width: 100%;
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}
.sort {
  padding: 10px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: .9rem;
}
@media (max-width: 560px) { .browse-tools { max-width: none; flex-basis: 100%; min-width: 0; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.card {
  text-align: left; display: flex; flex-direction: column; padding: 0; overflow: hidden;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-media { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-emoji { display: grid; place-items: center; height: 100%; font-size: 2.6rem; }
.card-fav {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--accent); font-size: .9rem;
  box-shadow: var(--shadow);
}
.card-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.card-name { font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { font-size: .78rem; color: var(--muted); }
.empty-grid { text-align: center; padding: 24px 0; }
.more-row { display: flex; justify-content: center; margin-top: 24px; }

.site-footer { border-top: 1px solid var(--border); padding: 20px 0; }
.site-footer p { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: .9rem; font-weight: 500;
  box-shadow: var(--shadow); z-index: 50;
  opacity: 0; transition: opacity .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* Print: just the recipe */
@media print {
  .site-header, .hero, .browse, .site-footer, .actions, .steps-hint, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .recipe { box-shadow: none; animation: none; }
  .recipe-head { grid-template-columns: 220px 1fr; }
  .people-btn, .scale-note button, .credit { display: none !important; }
  .recipe-head { background: none; }
  .ingredients { background: none; }
  .steps li.done { color: #000; }
  .ing-list input { display: none; }
}

/* ---------- Secondary CTA ---------- */
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 999px;
  padding: 14px 22px; font-size: 1rem; font-weight: 600;
  transition: border-color .15s, transform .12s;
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-secondary:active { transform: scale(.97); }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- More filters ---------- */
.more-filters { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.more-filters summary {
  cursor: pointer; list-style: none; padding: 12px 16px; font-weight: 600; font-size: .92rem;
  display: flex; align-items: center; gap: 8px;
}
.more-filters summary::-webkit-details-marker { display: none; }
.more-filters summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.more-filters[open] summary::before { transform: rotate(90deg); }
.more-filters .count-badge { background: var(--accent); color: var(--on-accent); }
.more-body { display: grid; gap: 14px; padding: 4px 16px 16px; }
.exclude-form { display: flex; gap: 8px; margin: 10px 0 8px; max-width: 420px; }
.exclude-input {
  flex: 1 1 0; min-width: 0; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: .9rem;
}
.chip.excluded { background: var(--surface-2); }
.chip.excluded .x { margin-left: 2px; opacity: .6; }

/* ---------- Units toggle ---------- */
.ing-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.units { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.units button {
  border: none; background: none; padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--muted);
}
.units button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- Reel (spin) ---------- */
.reel {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); padding: 22px 0;
}
.reel-track { display: flex; gap: 12px; padding: 0 12px; will-change: transform; }
.reel-item {
  flex: 0 0 180px; border-radius: 14px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--border); transition: transform .3s, box-shadow .3s, border-color .3s;
}
.reel-item img, .reel-item .reel-emoji { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.reel-item .reel-emoji { display: grid; place-items: center; font-size: 3rem; }
.reel-item span.reel-name {
  display: block; padding: 8px 10px; font-size: .82rem; font-weight: 600; line-height: 1.25;
  height: 3.2em; overflow: hidden;
}
.reel-fade { position: absolute; top: 0; bottom: 0; width: 14%; z-index: 1; pointer-events: none; }
.reel-fade.l { left: 0; background: linear-gradient(90deg, var(--surface), transparent); }
.reel-fade.r { right: 0; background: linear-gradient(270deg, var(--surface), transparent); }
.reel-pointer {
  position: absolute; z-index: 2; left: 50%; top: 6px; bottom: 6px; width: 0; transform: translateX(-50%);
  border-left: 0;
}
.reel-pointer::before, .reel-pointer::after {
  content: ""; position: absolute; left: -11px; border: 9px solid transparent;
}
.reel-pointer::before { top: -6px; border-top: 12px solid var(--accent); }
.reel-pointer::after { bottom: -6px; border-bottom: 12px solid var(--accent); }
.reel.spinning .reel-item img { filter: blur(1.5px); }
.reel-item.win { transform: scale(1.08); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
@media (max-width: 560px) { .reel-item { flex-basis: 132px; } }

/* ---------- Today ---------- */
.today { padding-top: 8px; padding-bottom: 24px; }
.today-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .today-grid { grid-template-columns: minmax(0, 1fr); } }
.section-kicker { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-strong); }
.dotd {
  display: block; width: 100%; text-align: left; padding: 0; overflow: hidden;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform .12s, border-color .15s;
}
.dotd:hover { transform: translateY(-2px); border-color: var(--accent); }
.dotd-media { display: block; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; position: relative; }
.dotd-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dotd-badge {
  position: absolute; left: 12px; top: 12px; background: var(--surface); color: var(--text);
  padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; box-shadow: var(--shadow);
}
.dotd-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; }
.dotd-name { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; line-height: 1.15; }
.dotd-sub { font-size: .85rem; color: var(--muted); }
.season-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.season-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; margin: 2px 0 0; }
.season-head p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.season-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 190px); gap: 12px;
  overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
}
.season-row .card { scroll-snap-align: start; }

/* ---------- Swipe mode ---------- */
.swipe {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: flex; justify-content: center; overflow-y: auto;
}
.swipe[hidden] { display: none; }
.swipe-inner { width: 100%; max-width: 460px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.swipe-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.swipe-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; margin: 0; }
.swipe-sub { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.swipe-close {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  font-size: 1.1rem; flex-shrink: 0;
}
.swipe-stack { position: relative; width: min(100%, calc(62vh * .75)); aspect-ratio: 3 / 4; margin: 0 auto; }
.sw-card {
  position: absolute; inset: 0; border-radius: 22px; overflow: hidden; background: var(--surface-2);
  box-shadow: var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform .3s ease, opacity .3s ease; cursor: grab;
}
.sw-card.dragging { transition: none; cursor: grabbing; }
.sw-card img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.sw-card .sw-emoji { display: grid; place-items: center; height: 100%; font-size: 6rem; }
.sw-card.back { transform: scale(.94) translateY(14px); opacity: .7; pointer-events: none; }
.sw-info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 70px 18px 18px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8));
}
.sw-name { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; line-height: 1.1; }
.sw-meta { font-size: .88rem; opacity: .92; margin-top: 4px; }
.sw-stamp {
  position: absolute; top: 22px; padding: 6px 14px; border: 4px solid; border-radius: 10px;
  font-weight: 800; font-size: 1.6rem; letter-spacing: .06em; opacity: 0; transform: rotate(-14deg);
  background: rgba(255, 255, 255, .88); pointer-events: none;
}
.sw-stamp.like { left: 18px; color: #2f8a4a; }
.sw-stamp.nope { right: 18px; color: #c9372c; transform: rotate(14deg); }
.swipe-actions { display: flex; justify-content: center; align-items: center; gap: 16px; }
.sw-btn {
  width: 58px; height: 58px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  font-size: 1.5rem; box-shadow: var(--shadow); display: grid; place-items: center; transition: transform .12s;
}
.sw-btn:active { transform: scale(.92); }
.sw-btn.sw-undo, .sw-btn.sw-cook { width: 46px; height: 46px; font-size: 1.15rem; }
.sw-nope { color: #c9372c; }
.sw-like { color: var(--accent); }
.sw-btn:disabled { opacity: .4; cursor: not-allowed; }
.swipe-hint { text-align: center; font-size: .78rem; color: var(--muted); margin: 0; }
.swipe-empty {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; padding: 24px;
  border: 2px dashed var(--border); border-radius: 22px;
}
body.no-scroll { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .sw-card { transition: none; } }

@media print {
  .today, .swipe, .reel, .units { display: none !important; }
}
.count-badge[hidden] { display: none; }

/* =================================================================== Navigation & views */
.header-inner { height: auto; min-height: 60px; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex: 1 1 auto; justify-content: center; }
.tabs a {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap;
}
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); }
@media (max-width: 900px) {
  .tabs { order: 3; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .header-inner { padding-top: 6px; }
}
@media (max-width: 480px) { .fav-label { display: none; } }
.view { padding-top: 32px; padding-bottom: 64px; }
[data-view][hidden] { display: none !important; }
.feature-hero h1 {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 5.5vw, 3rem);
  line-height: 1.05; letter-spacing: -.02em; margin: 4px 0 10px;
}
.feature-hero .lede { margin-bottom: 24px; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.panel h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; margin: 0 0 12px; }
.panel h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; margin: 16px 0 8px; }
.notice {
  border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; background: var(--surface-2); border: 1px solid var(--border);
}
.notice.warn, .warn { color: #b3261e; }
.notice.warn { background: #fdecea; border-color: #f5c2bd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .notice.warn { background: #3a1f1c; border-color: #6b2f29; color: #ffb4ab; } }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.field input, .field select, .field textarea, .menu-settings select, .menu-settings input {
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit;
}
.field textarea { resize: vertical; }
.muted.small a { color: var(--accent-strong); }

/* =================================================================== Context (weather/evening/holidays) */
.ctx { margin-bottom: 28px; }
.ctx-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ctx-label { font-weight: 600; font-size: .9rem; align-self: center; margin-right: 2px; }
.ctx-note { font-size: .82rem; color: var(--muted); align-self: center; }
.ctx-links { display: flex; gap: 16px; flex-wrap: wrap; }
.ctx-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.ctx-panel .exclude-form { max-width: 560px; }
.ctx-holiday { margin-top: 22px; }

/* =================================================================== Dinner Duel */
.duel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 24px; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 0; list-style: none; counter-reset: how; }
.how li { counter-increment: how; position: relative; padding: 14px 14px 14px 52px; background: var(--surface-2); border-radius: 14px; font-size: .92rem; }
.how li::before { content: counter(how); position: absolute; left: 14px; top: 12px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; }
.duel-room { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .duel-room { grid-template-columns: 1fr; } .duel-side { order: 2; } }
.duel-code { font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; letter-spacing: .14em; color: var(--accent-strong); line-height: 1; margin: 4px 0; }
.duel-title { font-size: 1.1rem !important; margin-bottom: 10px !important; }
.duel-qr { background: #fff; border-radius: 12px; padding: 8px; width: 180px; max-width: 100%; }
.duel-qr svg { display: block; width: 100%; height: auto; }
.duel-url { word-break: break-all; font-weight: 600; color: var(--text); }
.duel-members { list-style: none; padding: 0; margin: 0 0 12px; }
.duel-members li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.duel-members li.offline { opacity: .5; }
.duel-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.duel-members li.offline .duel-dot { background: var(--muted); }
.duel-mname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-prog { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.duel-hostbox { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.duel-hostbox p { margin: 0 0 8px; }
.duel-main { min-width: 0; }
.duel-stack { width: min(100%, 380px); max-height: none; }
.duel-progress { display: flex; align-items: center; gap: 10px; max-width: 380px; margin: 0 auto 10px; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.duel-progress .bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.duel-progress .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
#duel-stage .swipe-actions { margin: 14px 0 6px; }
.sw-veto { color: #7a5cc2; width: 46px !important; height: 46px !important; font-size: 1.1rem !important; }
.duel-done, .duel-winner { text-align: center; }
.duel-winner .duel-win-card { max-width: 280px; margin: 0 auto 14px; display: flex; }
.duel-hint { margin-top: 18px; }
#duel-matches h3, #duel-favs h3 { font-family: var(--font-display); font-size: 1.15rem; margin: 22px 0 10px; }
.duel-favlist { list-style: none; padding: 0; margin: 0; }
.duel-favlist li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.duel-favlist li a { flex: 1; min-width: 160px; color: var(--text); font-weight: 600; text-decoration: none; }
.duel-favlist li.vetoed a { text-decoration: line-through; color: var(--muted); }
.duel-likes { color: var(--accent); font-size: .85rem; letter-spacing: .05em; }
.duel-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(20, 12, 6, .6); display: grid; place-items: center; padding: 16px; animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; } }
.duel-overlay-box { background: var(--surface); border-radius: 22px; padding: 24px; max-width: 420px; width: 100%; text-align: center; box-shadow: var(--shadow); max-height: 92vh; overflow-y: auto; }
.duel-overlay-box h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; margin: 4px 0 12px; }
.match-burst { font-size: 3.4rem; animation: burst .6s cubic-bezier(.2,1.6,.4,1); }
@keyframes burst { from { transform: scale(.2); opacity: 0; } }
.match-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 14px; margin-bottom: 10px; }
.overlay-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.overlay-actions a.btn { text-decoration: none; }
.wheel-wrap { position: relative; width: 300px; max-width: 100%; margin: 8px auto; }
.wheel { width: 100%; height: auto; display: block; border-radius: 50%; box-shadow: 0 0 0 6px var(--surface-2), var(--shadow); }
.wheel-pointer { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); z-index: 2; border: 14px solid transparent; border-top: 22px solid var(--text); }
@media (prefers-reduced-motion: reduce) { .match-burst, .duel-overlay { animation: none; } }

/* =================================================================== Menu planner */
.menu-settings { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: flex-end; margin-bottom: 8px; }
.menu-settings .field { margin-bottom: 4px; }
.menu-courses { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 16px 0 24px; }
.menu-course { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.menu-course-media { display: block; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; background: var(--surface-2); margin: 4px 0; }
.menu-course-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu-course h3 { margin: 4px 0 0; font-size: 1.05rem; }
.menu-course h3 a { color: var(--text); text-decoration: none; }
.menu-course p { margin: 0 0 6px; flex: 1; }
.menu-course .btn { align-self: flex-start; }
.menu-plan { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .menu-plan { grid-template-columns: 1fr; } }
.menu-events { list-style: none; padding: 0; margin: 18px 0 0; }
.menu-events li { border-bottom: 1px solid var(--border); }
.menu-events label { display: grid; grid-template-columns: auto 92px 1fr; gap: 10px; padding: 9px 0; align-items: baseline; cursor: pointer; }
.menu-events input { accent-color: var(--accent); }
.menu-events time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-strong); font-size: .92rem; }
.menu-events li.serve { background: var(--accent-soft); border-radius: 8px; }
.menu-events li.serve label { padding-left: 6px; }
.menu-events input:checked ~ span, .menu-events input:checked ~ time { text-decoration: line-through; color: var(--muted); }
.gantt { margin-top: 10px; }
.gantt-axis { position: relative; height: 22px; margin-left: 30%; border-bottom: 1px solid var(--border); }
.gantt-axis span { position: absolute; transform: translateX(-50%); font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.gantt-row { display: grid; grid-template-columns: 30% 1fr; align-items: center; gap: 0; min-height: 34px; border-bottom: 1px dashed var(--border); }
.gantt-label { font-size: .82rem; font-weight: 600; padding-right: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-track { position: relative; height: 22px; }
.gb { position: absolute; top: 3px; height: 16px; border-radius: 5px; display: block; font-size: .65rem; font-style: normal; color: #fff; line-height: 16px; padding-left: 4px; white-space: nowrap; overflow: hidden; }
.gb.prep { background: var(--accent); }
.gb.cook { background: #f0a33b; }
.gb.oven { background: #c2412d; }
.gb.passive { background: repeating-linear-gradient(135deg, #8aa5d6 0 6px, #a9bfe6 6px 12px); color: #1d2a44; }
.gb.clipped { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.gantt-serve { position: absolute; top: -2px; width: 0; height: 26px; border-left: 3px solid var(--green); }
.gantt-serve.static { position: relative; display: inline-block; height: 14px; top: 2px; margin-right: 6px; }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: .78rem; color: var(--muted); }
.gantt-legend .gb { position: relative; display: inline-block; width: 18px; height: 10px; top: 0; margin-right: 5px; vertical-align: middle; }
.shop-h { font-size: 1rem !important; margin: 14px 0 4px !important; }
.shop-list li label { padding: 5px 0; font-size: .92rem; }
@media (max-width: 560px) { .gantt-axis { margin-left: 34%; } .gantt-row { grid-template-columns: 34% 1fr; } .menu-events label { grid-template-columns: auto 74px 1fr; } }

/* =================================================================== Pantry */
.pantry-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.6fr); gap: 20px; align-items: start; margin-bottom: 20px; }
@media (max-width: 900px) { .pantry-grid { grid-template-columns: 1fr; } }
.pantry-add { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pantry-add .exclude-input { flex: 1 1 160px; }
.pantry-add .p-date { flex: 0 1 150px; }
.p-quick { margin-bottom: 14px; }
.p-quick .chip { font-size: .8rem; padding: 5px 10px; }
.pantry-list { list-style: none; padding: 0; margin: 0 0 10px; }
.pantry-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.p-name { flex: 1 1 120px; font-weight: 600; text-transform: capitalize; }
.pantry-list input[type="date"] { border: 1px solid var(--border); border-radius: 8px; padding: 3px 6px; background: var(--bg); color: var(--text); font: inherit; font-size: .8rem; }
.xp { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.xp.bad { background: #fdecea; color: #b3261e; }
.xp.warn { background: #fff3d6; color: #8a5a00; }
.xp.ok { background: var(--green-soft); color: var(--green); }
.xp.none { background: var(--surface-2); color: var(--muted); font-weight: 500; }
.use-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.use-item { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; text-decoration: none; color: var(--text); padding: 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.use-item:hover { border-color: var(--accent); }
.use-item img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; }
.use-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.use-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.use-tags .tag { font-size: .7rem; padding: 1px 7px; text-transform: capitalize; }
.tag.hot { background: #fdecea; color: #b3261e; }
.chain .chips { margin-bottom: 16px; }
.chain-row { display: flex; align-items: stretch; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.chain-step { flex: 1 1 200px; min-width: 180px; max-width: 280px; }
.chain-card { display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); text-decoration: none; color: var(--text); background: var(--surface); margin: 6px 0; }
.chain-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.chain-card .card-name { display: block; padding: 8px 10px; }
.chain-arrow { align-self: center; font-size: 1.6rem; color: var(--accent); }
.leftover-box { border-top: 1px solid var(--border); padding: 20px 28px 24px; }
.leftover-box h3 { font-family: var(--font-display); margin: 4px 0 0; font-size: 1.2rem; }
@media (max-width: 760px) { .leftover-box { padding: 18px; } }

/* =================================================================== Mystery Basket */
.basket { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 10px; }
.basket-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 22px; min-width: 150px;
  background: var(--surface); border: 2px solid var(--accent-soft); border-radius: 20px; box-shadow: var(--shadow);
  animation: drop .5s cubic-bezier(.2,1.4,.4,1) both; animation-delay: calc(var(--i) * .15s);
}
@keyframes drop { from { transform: translateY(-20px) scale(.8); opacity: 0; } }
.basket-emoji { font-size: 2.8rem; line-height: 1; }
.basket-name { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; text-transform: capitalize; }
.basket-plus { font-size: 1.6rem; color: var(--muted); font-weight: 700; }
.basket-when { text-align: center; color: var(--muted); margin: 0 0 22px; }
@media (prefers-reduced-motion: reduce) { .basket-item { animation: none; } }
.winner-banner { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.winner-banner img { width: 90px; height: 90px; object-fit: cover; border-radius: 14px; }
.winner-banner h3 { margin: 2px 0; }
.winner-banner p { margin: 0; }
.challenge-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 24px; align-items: start; margin-bottom: 24px; }
@media (max-width: 900px) { .challenge-grid { grid-template-columns: 1fr; } }
.challenge-grid aside { display: grid; gap: 20px; }
.entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.entry { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.entry-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--surface-2); }
.entry-noimg { display: grid; place-items: center; font-size: 3rem; }
.entry-body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.entry-body h3 { margin: 0 !important; }
.entry-body p { margin: 2px 0 6px; }
.entry-desc { font-size: .9rem; flex: 1; }
.entry-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.entry-votes { font-weight: 700; color: var(--accent); }
.c-preview { width: 100%; border-radius: 12px; margin-bottom: 12px; }
.leader { padding-left: 20px; margin: 0; }
.leader li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.leader li span { display: block; font-size: .8rem; color: var(--muted); }

@media print {
  .site-header, .feature-hero, .menu-settings, .menu-courses, [data-m], .view .notice { display: none !important; }
  .menu-plan { grid-template-columns: 1fr; }
}
