/* Recipe Scaler: a pasted recipe becomes a ruled index card whose amounts
 * roll to new values like an odometer. One Page Toys tool family,
 * self-contained, theme-aware. The card is paper in both themes (a dark
 * index card is not a thing); the page around it follows the theme. */

@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@600&family=Courier+Prime:wght@400;700&family=Fraunces:opsz,wght@9..144,600;9..144,800&family=Inter:wght@400;500;600;700;800&display=swap");

@property --hl {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(255, 214, 64, 0.62);
}

:root{
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-type: "Courier Prime", "Courier New", Courier, monospace;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  --ink: #231e18;
  --bg: #f6f1e8;
  --surface: #fffdf8;
  --surface-2: #efe7da;
  --muted: #6c6256;
  --line: #e5dccd;
  --line-strong: #d0c3af;
  --accent: #c2412d;
  --accent-soft: rgba(194, 65, 45, 0.13);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 8px rgba(60, 40, 20, 0.06);
  --shadow-md: 0 8px 22px rgba(60, 40, 20, 0.1);
  --glass: rgba(255, 253, 248, 0.82);
  --glow: rgba(255, 196, 120, 0.22);

  /* the card: paper, ink, a red header rule and blue lines */
  --paper: #fffdf4;
  --paper-back: #f3ead6;
  --type: #2b2731;
  --type-soft: #4f4a55;
  --rule: rgba(110, 160, 205, 0.42);
  --rule-red: #d4473a;
  --hl-base: rgba(255, 214, 64, 0.62);
  --hl-fresh: rgba(255, 128, 92, 0.72);
  --hl-temp: rgba(140, 200, 255, 0.5);
  --pencil: #c0392b;
  --stamp: #c4342b;
  --note-paper: #fff2a6;
  --card-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 22px 46px -22px rgba(70, 45, 20, 0.5), 0 3px 8px rgba(70, 45, 20, 0.12);
  --fs: 16.5px;
  --lh: 30px;
}
:root[data-theme="dark"]{
  --ink: #f2ebe0;
  --bg: #13110e;
  --surface: #1d1a15;
  --surface-2: #27221b;
  --muted: #a99d8c;
  --line: #2d271f;
  --line-strong: #40372c;
  --accent: #f07a5f;
  --accent-soft: rgba(240, 122, 95, 0.16);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 30px -6px rgba(0, 0, 0, 0.55);
  --glass: rgba(29, 26, 21, 0.84);
  --glow: rgba(255, 170, 90, 0.12);
  /* the same card, under a warm lamp instead of daylight */
  --paper: #f4ecd9;
  --paper-back: #d9ccb0;
  --rule: rgba(95, 140, 185, 0.4);
  --card-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.85), 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 240, 210, 0.06);
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{ -webkit-tap-highlight-color: transparent; }
html{ min-height: 100%; }
body{
  margin: 0; min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: var(--font-sans); color: var(--ink);
  background:
    radial-gradient(70% 40% at 50% 0%, var(--accent-soft), transparent 72%),
    radial-gradient(60% 50% at 50% 62%, var(--glow), transparent 70%),
    var(--bg);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
.sr-only{ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Top bar (family chrome) ---------- */
.topbar{
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 30px);
  padding-top: max(14px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand{ display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-sans); font-weight: 800; font-size: 0.82rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
.brand__mark{ width: 1.1em; height: 1.1em; border: 1.5px solid var(--ink); border-radius: 6px; background: linear-gradient(90deg, var(--ink) 0 50%, var(--surface) 50% 100%); }
.topbar__right{ display: inline-flex; align-items: center; gap: 10px; }
.topbar__tag{ font-size: 0.7rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.iconbtn{ appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; font-size: 1rem; line-height: 1; border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease; }
.iconbtn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.iconbtn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.iconbtn svg{ width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#soundBtn .snd-off{ display: none; }
#soundBtn[aria-pressed="false"] .snd-on{ display: none; }
#soundBtn[aria-pressed="false"] .snd-off{ display: inline; }
.theme-toggle__sun, .theme-toggle__moon, .theme-toggle__auto{ display: none; }
:root[data-theme-mode="system"] .theme-toggle__auto{ display: inline; }
:root[data-theme-mode="light"] .theme-toggle__sun{ display: inline; }
:root[data-theme-mode="dark"] .theme-toggle__moon{ display: inline; }

/* ---------- Stage ---------- */
.stage{
  position: relative; z-index: 2; flex: 1 0 auto;
  width: 100%; max-width: 720px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: stretch;
  gap: 18px;
  padding: clamp(22px, 4vw, 40px) 16px clamp(48px, 6vw, 72px);
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(clamp(56px, 6vw, 80px), env(safe-area-inset-bottom));
  overflow-x: clip;   /* the stamp lands from 1.9x its size; it must never widen the page */
}
.hero{ text-align: center; }
.eyebrow{ margin: 0 0 6px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.headline{ margin: 0; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.9rem, 7vw, 3rem); line-height: 1.04; letter-spacing: -0.008em; word-spacing: 0.06em; font-variation-settings: "opsz" 72; }
.lede{ margin: 12px auto 0; max-width: 34em; font-size: clamp(0.95rem, 2.6vw, 1.04rem); line-height: 1.55; color: var(--muted); }

/* ---------- Pills ---------- */
.pill{
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  font-family: var(--font-sans); font-size: 0.88rem; font-weight: 600; letter-spacing: 0.005em;
  border: 1.5px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.pill:hover{ transform: translateY(-1px); border-color: var(--ink); box-shadow: var(--shadow-md); }
.pill:active{ transform: translateY(1px) scale(0.98); box-shadow: none; }
.pill:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.pill--solid{ background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pill svg{ width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Paste panel ---------- */
.paste{
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 12px 12px 12px 18px;
}
.paste__bar{ display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.paste__now{ display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 200px; }
.paste__k{ font-size: 0.64rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.paste__name{ font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paste__acts{ display: flex; gap: 8px; flex-wrap: wrap; }
.paste__acts .pill{ min-height: 40px; padding: 0 14px; font-size: 0.82rem; }
.paste__box{ margin-top: 12px; padding-right: 6px; }
.paste__box[hidden]{ display: none; }
.paste__label{ display: block; margin: 0 0 8px; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }
#src{
  display: block; width: 100%; min-height: 220px; resize: vertical;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-family: var(--font-type); font-size: 15px; line-height: 1.55;
  outline: none; transition: border-color 140ms ease, box-shadow 140ms ease;
}
#src:focus{ border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
#src::placeholder{ color: color-mix(in srgb, var(--muted) 70%, transparent); }
.paste__fine{ margin: 8px 2px 0; font-size: 0.74rem; color: var(--muted); }
.paste__fine.is-warn{ color: var(--accent); font-weight: 600; }

/* ---------- Scale controls ---------- */
.dash{
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-md);
  padding: 16px clamp(14px, 3vw, 22px) 14px;
}
.dash__top{ display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; }
.stepper{ display: flex; align-items: center; gap: 10px; }
.stepper__b{
  appearance: none; width: 48px; height: 48px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
  font-family: var(--font-sans); font-size: 1.5rem; font-weight: 500; line-height: 1; cursor: pointer;
  transition: transform 120ms ease, background 140ms ease, border-color 140ms ease;
  touch-action: manipulation;
}
.stepper__b:hover{ border-color: var(--ink); }
.stepper__b:active{ transform: scale(0.92); }
.stepper__b:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 5px var(--accent); }
.stepper__b:disabled{ opacity: 0.35; cursor: default; transform: none; }
.stepper__mid{ display: inline-flex; align-items: baseline; gap: 8px; cursor: text; }
#servings{
  width: 3.2ch; min-width: 2ch; padding: 0 2px 2px;
  border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink);
  font-family: var(--font-display); font-weight: 800; font-size: 2.3rem; line-height: 1; letter-spacing: -0.02em;
  text-align: center; outline: none; font-variant-numeric: tabular-nums;
  transition: border-color 140ms ease;
}
#servings:hover{ border-bottom-color: var(--line-strong); }
#servings:focus{ border-bottom-color: var(--accent); }
.stepper__noun{ font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: var(--muted); white-space: nowrap; }
.orig{ display: inline-flex; align-items: baseline; gap: 6px; font-size: 0.8rem; color: var(--muted); }
#origIn{
  width: 3.4ch; padding: 2px 2px; border: 0; border-bottom: 1.5px dashed var(--line-strong);
  background: transparent; color: var(--ink); font: 700 0.9rem var(--font-sans); text-align: center; outline: none;
}
#origIn:focus{ border-bottom: 1.5px solid var(--accent); }
.dash__row{ margin-top: 14px; display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.chips, .seg{ display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.chips button, .seg button{
  appearance: none; border: 0; background: transparent; color: var(--muted);
  min-height: 40px; min-width: 44px; padding: 0 12px; border-radius: 999px;
  font-family: var(--font-sans); font-size: 0.86rem; font-weight: 700; cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
  touch-action: manipulation;
}
.chips button:hover, .seg button:hover{ color: var(--ink); }
.chips button:active, .seg button:active{ transform: scale(0.95); }
.chips button[aria-pressed="true"], .seg button[aria-pressed="true"]{ background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 0 0 1px var(--line-strong); }
.chips button:focus-visible, .seg button:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--accent); }
.dash__tip{
  margin: 14px 0 0; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start;
  border-radius: var(--radius-sm); background: var(--accent-soft);
  font-size: 0.84rem; line-height: 1.45; color: var(--ink);
}
.dash__tip b{ font-weight: 700; }
.dash__tipicon{ flex: none; width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.dash__tip.is-used{ background: transparent; padding-left: 0; padding-right: 0; color: var(--muted); }

/* the compact bar that follows you down a long card */
.mini{
  position: fixed; z-index: 20; left: 50%; top: max(10px, env(safe-area-inset-top));
  transform: translate(-50%, -140%);
  display: flex; align-items: center; gap: 6px; padding: 5px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  transition: transform 260ms cubic-bezier(.2, .9, .3, 1.1);
}
.mini.is-on{ transform: translate(-50%, 0); }
.mini[hidden]{ display: none; }
.mini__b{
  appearance: none; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--surface-2); color: var(--ink); font-size: 1.3rem; cursor: pointer; touch-action: manipulation;
}
.mini__b:focus-visible{ outline: none; box-shadow: 0 0 0 3px var(--accent); }
.mini__v{ padding: 0 10px; font-family: var(--font-display); font-weight: 700; font-size: 1rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- The card ---------- */
.desk{ position: relative; padding: 6px 0 10px; }
.desk::before{
  /* the card underneath, slightly askew */
  content: ""; position: absolute; left: 10px; right: -4px; top: 18px; bottom: 0;
  border-radius: 8px; background: var(--paper-back);
  transform: rotate(1.4deg); transform-origin: 30% 0;
  box-shadow: 0 16px 30px -18px rgba(60, 40, 20, 0.45);
}
.card{
  position: relative; z-index: 1;
  border-radius: 8px;
  background-color: var(--paper);
  background-image:
    radial-gradient(120% 60% at 10% 0%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(90% 80% at 100% 100%, rgba(170, 130, 70, 0.07), transparent 70%);
  box-shadow: var(--card-shadow);
  color: var(--type);
  padding-bottom: 22px;
}
.card::after{
  /* paper tooth */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .35  0 0 0 0 .25  0 0 0 0 .15  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.16; mix-blend-mode: multiply;
}
.card__head{
  position: relative;
  padding: 20px clamp(16px, 4.4vw, 30px) 14px;
  border-bottom: 2px solid var(--rule-red);
  box-shadow: 0 4px 0 -2px var(--paper), 0 5px 0 -2px var(--rule-red);
  margin-bottom: 6px;
}
.card__label{ margin: 0; font-family: var(--font-sans); font-size: 0.6rem; font-weight: 800; letter-spacing: 0.26em; text-transform: uppercase; color: var(--rule-red); }
.card__title{
  margin: 6px 0 6px; padding-right: 128px;
  font-family: var(--font-display); font-weight: 600; font-variation-settings: "opsz" 48;
  font-size: clamp(1.32rem, 4.8vw, 1.95rem); line-height: 1.12; letter-spacing: -0.01em;
  color: var(--type); overflow-wrap: anywhere;
}
.card__title.is-empty{ color: rgba(43, 39, 49, 0.4); font-style: italic; }
.card__meta{ margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding-right: 120px; font-family: var(--font-type); font-size: 0.98rem; line-height: 30px; color: var(--type-soft); }
.card__units{ font-family: var(--font-sans); font-size: 0.6rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--rule-red); }
.card__units:empty{ display: none; }

.card__lines{
  position: relative; z-index: 1;
  list-style: none; margin: 0; padding: 12px clamp(16px, 4.4vw, 30px) 0;
  font-family: var(--font-type); font-size: var(--fs); line-height: var(--lh);
  color: var(--type);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px), var(--rule) var(--lh));
  background-position: 0 5px;
  background-clip: content-box, padding-box;
  min-height: calc(var(--lh) * 6 + 12px);
}
.ln{
  position: relative; min-height: var(--lh);
  margin: 0 -8px; padding: 0 8px;
  border-radius: 5px;
  overflow-wrap: anywhere;
  text-shadow: 0 0 0.6px rgba(43, 39, 49, 0.35);   /* typewriter ink, slightly bled */
}
.ln--method{ color: var(--type-soft); }
.ln--head{ font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: calc(var(--fs) - 1.5px); color: var(--type); }
.ln--text{ color: var(--type-soft); }
.ln--empty{ color: rgba(43, 39, 49, 0.42); font-style: italic; }
.ln--warn{ font-family: var(--font-hand); font-size: 1.32rem; color: var(--pencil); }

.ln.is-have{ cursor: pointer; transition: background 160ms ease, transform 110ms ease, box-shadow 160ms ease; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ln.is-have:hover{ background: rgba(255, 214, 64, 0.16); }
.ln.is-have:focus-visible{ outline: none; background: rgba(255, 214, 64, 0.2); box-shadow: 0 0 0 2px var(--rule-red); }
.ln.is-pressed{ transform: translateY(1px) scale(0.994); background: rgba(80, 60, 30, 0.08) !important; box-shadow: inset 0 1px 3px rgba(60, 40, 20, 0.18); }
.ln.is-open{ background: rgba(255, 214, 64, 0.24); }
.ln.is-anchor .ln__t::before{
  content: ""; display: inline-block; width: 0.62em; height: 0.62em; margin-right: 0.4em; vertical-align: 0.05em;
  border-radius: 50%; background: var(--pencil); box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.2);
}
.ln__have{
  position: absolute; right: 6px; top: 50%; transform: translate(4px, -50%);
  padding: 4px 10px; border-radius: 999px;
  background: var(--type); color: var(--paper);
  font-family: var(--font-sans); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em; line-height: 1.2;
  opacity: 0; pointer-events: none; text-shadow: none; white-space: nowrap;
  transition: opacity 160ms ease, transform 160ms ease;
}
.ln.is-have:hover .ln__have, .ln.is-have:focus-visible .ln__have, .ln.is-hint .ln__have{ opacity: 1; transform: translate(0, -50%); }
.ln.is-hint .ln__have{ animation: nudge 2.4s ease-in-out 0.8s 2; }
@keyframes nudge{ 0%, 100%{ transform: translate(0, -50%); } 40%{ transform: translate(-6px, -50%); } 60%{ transform: translate(0, -50%); } }
.ln.is-open .ln__have{ opacity: 0; }

.ln--note{
  padding-left: calc(8px + 1.4em);
  font-family: var(--font-hand); font-size: 1.28rem; color: var(--pencil);
  text-shadow: none; line-height: var(--lh);
  animation: noteIn 420ms ease-out both;
}
.ln--note::before{ content: "\21b3"; position: absolute; left: 10px; top: 0; font-family: var(--font-sans); font-size: 0.9rem; }
@keyframes noteIn{ from{ opacity: 0; transform: translateX(-6px); } to{ opacity: 1; transform: none; } }

/* a figure: one amount, under a highlighter stroke */
.fig{
  --hl: var(--hl-base);
  position: relative; display: inline; white-space: nowrap;
  font-weight: 700; color: var(--type);
  padding: 0 0.18em; margin: 0 -0.08em;
  border-radius: 0.3em 0.45em 0.35em 0.5em;
  background-image: linear-gradient(98deg, transparent 0, var(--hl) 0.22em, var(--hl) calc(100% - 0.28em), transparent 100%);
  background-repeat: no-repeat; background-size: 100% 0.94em; background-position: 0 62%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.fig.is-fresh{ animation: fresh 1500ms ease-out both; }
@keyframes fresh{ 0%, 30%{ --hl: var(--hl-fresh); } 100%{ --hl: var(--hl-base); } }
.fig--temp{ --hl: var(--hl-temp); }
.fig--temp.is-fresh{ animation-name: freshT; }
@keyframes freshT{ 0%, 30%{ --hl: var(--hl-fresh); } 100%{ --hl: var(--hl-temp); } }
.fig--size{ background: none; font-weight: 400; padding: 0; margin: 0; border-bottom: 1.5px dotted rgba(43, 39, 49, 0.45); border-radius: 0; }
.fig--flag{ box-shadow: 0 0 0 1.6px var(--pencil); border-radius: 46% 54% 44% 56% / 60% 48% 52% 40%; }
.vol{
  margin-left: 0.35em; padding: 1px 5px; vertical-align: 0.15em;
  border: 1px solid rgba(43, 39, 49, 0.28); border-radius: 4px;
  font-family: var(--font-sans); font-size: 0.56rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--type-soft); text-shadow: none; cursor: help;
}

/* odometer columns, built only while a figure rolls */
.col{ position: relative; display: inline-block; clip-path: inset(0 -2px); transition: width var(--dur, 500ms) cubic-bezier(.3, 1.2, .4, 1); }
.col__ph{ visibility: hidden; }
.col__strip{ position: absolute; left: 0; right: 0; top: 0; text-align: center; will-change: transform; }
.col__strip > span{ display: block; height: var(--rl, 30px); line-height: var(--rl, 30px); white-space: pre; }

/* the stamp */
.stamp{
  position: absolute; z-index: 2; top: 16px; right: clamp(12px, 3vw, 22px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 104px; padding: 6px 12px 7px;
  color: var(--stamp);
  border: 3px solid currentColor; border-radius: 7px;
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3.5px currentColor;
  font-family: var(--font-sans); text-transform: uppercase; text-align: center; line-height: 1;
  transform: rotate(-9deg); opacity: 0; visibility: hidden;
  mix-blend-mode: multiply;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -2.4 2.15'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -2.4 2.15'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}
.stamp.is-on{ opacity: 0.88; visibility: visible; }
.stamp.is-thunk{ animation: thunk 460ms cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes thunk{
  0%{ opacity: 0; transform: rotate(-17deg) scale(1.9); }
  55%{ opacity: 0.95; transform: rotate(-8deg) scale(0.93); }
  100%{ opacity: 0.88; transform: rotate(-9deg) scale(1); }
}
.stamp__top, .stamp__bot{ font-size: 0.56rem; font-weight: 800; letter-spacing: 0.2em; }
.stamp__big{ margin: 3px 0 2px; font-size: 1.32rem; font-weight: 800; letter-spacing: 0.04em; }
.stamp__bot:empty{ display: none; }

/* "how much do you have?": a sticky note laid on the card */
.have{
  position: absolute; z-index: 5; left: clamp(10px, 4vw, 34px);
  width: min(360px, calc(100% - 20px));
  padding: 14px 16px 14px;
  background: var(--note-paper);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 40%), linear-gradient(0deg, rgba(160, 120, 0, 0.08), transparent 30%);
  color: #2b2731;
  border-radius: 3px 3px 10px 3px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08), 0 18px 30px -12px rgba(70, 50, 0, 0.45);
  transform-origin: 20% 0;
  animation: noteDrop 300ms cubic-bezier(.2, 1.3, .4, 1) both;
}
.have[hidden]{ display: none; }
@keyframes noteDrop{ from{ opacity: 0; transform: translateY(-10px) rotate(-3deg) scale(0.96); } to{ opacity: 1; transform: rotate(-0.8deg); } }
.have__q{ margin: 0; font-family: var(--font-hand); font-size: 1.55rem; line-height: 1.05; }
.have__of{ margin: 2px 0 10px; font-family: var(--font-type); font-size: 0.82rem; color: #5a5260; }
.have__row{ display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.have__step{
  appearance: none; width: 44px; height: 44px; flex: none; border-radius: 50%;
  border: 1.5px solid rgba(43, 39, 49, 0.3); background: rgba(255, 255, 255, 0.55); color: #2b2731;
  font-size: 1.3rem; cursor: pointer; touch-action: manipulation; transition: transform 110ms ease;
}
.have__step:active{ transform: scale(0.9); }
.have__amt{
  width: 5.2ch; min-height: 44px; padding: 4px 6px;
  border: 0; border-bottom: 2px solid #2b2731; background: transparent; color: #2b2731;
  font: 700 1.5rem var(--font-type); text-align: center; outline: none;
}
.have__amt:focus{ border-bottom-color: var(--pencil); }
.have__unit{
  min-height: 44px; padding: 0 30px 0 12px; border-radius: 999px;
  border: 1.5px solid rgba(43, 39, 49, 0.3); background: rgba(255, 255, 255, 0.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%232b2731' stroke-width='1.6'/%3E%3C/svg%3E") right 11px center / 11px no-repeat;
  appearance: none; -webkit-appearance: none; color: #2b2731; font: 600 0.92rem var(--font-sans); cursor: pointer;
}
.have__unit[hidden]{ display: none; }
.have__noun{ font: 700 1rem var(--font-type); }
.have__err{ margin: 6px 0 0; min-height: 0; font-size: 0.78rem; font-weight: 600; color: #a3281d; }
.have__err:empty{ display: none; }
.have__acts{ margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.have .pill{ min-height: 44px; box-shadow: none; }
.have .pill:not(.pill--solid){ background: transparent; border-color: rgba(43, 39, 49, 0.3); color: #2b2731; }
.have .pill--solid{ background: #2b2731; border-color: #2b2731; color: var(--note-paper); }
.have button:focus-visible, .have select:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--note-paper), 0 0 0 4px var(--pencil); }
.have__amt::selection{ background: rgba(192, 57, 43, 0.22); }

/* ---------- Under the card ---------- */
.actions{ display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.share-row{ display: flex; justify-content: center; }
.share-row .opt-share{ --ops-fg: var(--ink); margin-top: 0; min-height: 44px; }
.fine{ margin: 4px auto 0; max-width: 36em; text-align: center; font-size: 0.76rem; line-height: 1.55; color: var(--muted); }
.backlink{ align-self: center; margin-top: 6px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; transition: color 140ms ease, border-color 140ms ease; }
.backlink:hover{ color: var(--ink); border-bottom-color: var(--accent); }
.backlink:focus-visible{ outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }

/* the tip jar and full-screen badges default to right-center, which is the
   end of every line on the card; tuck them into the bottom-right corner */
.opt-tipjar.opt-tipjar{ top: auto; bottom: max(14px, env(safe-area-inset-bottom)); transform: none; }
.opt-fs.opt-fs{ top: auto; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 54px); transform: none; }
.opt-tipjar.opt-tipjar.tj-nudge{ animation: none; }

@media (max-width: 560px){
  :root{ --fs: 15px; --lh: 28px; }
  .stage{ gap: 14px; }
  .paste{ padding: 12px; }
  .paste__acts{ width: 100%; flex-wrap: nowrap; gap: 6px; }
  .paste__acts .pill{ flex: 1 1 auto; padding: 0 10px; font-size: 0.8rem; white-space: nowrap; }
  .hero .lede{ margin-top: 8px; font-size: 0.92rem; }
  .dash{ padding-top: 12px; }
  .dash__row{ margin-top: 10px; gap: 8px; }
  .dash__tip{ margin-top: 10px; }
  .dash__top{ justify-content: center; }
  .stepper{ width: 100%; justify-content: space-between; }
  .orig{ width: 100%; justify-content: center; }
  .dash__row{ justify-content: center; }
  .chips, .seg{ width: 100%; }
  .chips button, .seg button{ flex: 1 1 0; padding: 0 6px; min-width: 0; }
  .card__title{ padding-right: 92px; }
  .card__meta{ padding-right: 0; }
  .stamp{ min-width: 82px; padding: 5px 8px 6px; top: 14px; }
  .stamp__big{ font-size: 1.05rem; }
  .stamp__top, .stamp__bot{ font-size: 0.5rem; letter-spacing: 0.16em; }
  .ln__have{ font-size: 0.62rem; padding: 3px 8px; }
}
@media (max-width: 380px){
  .paste__acts{ flex-wrap: wrap; }
}
@media (max-width: 360px){
  .chips button, .seg button{ font-size: 0.78rem; }
  #servings{ font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce){
  .pill, .iconbtn, .ln, .ln__have, .mini, .stepper__b, .chips button, .seg button{ transition: none; }
  .ln.is-hint .ln__have, .ln--note, .have{ animation: none; }
  .stamp.is-thunk{ animation: none; }
  .fig.is-fresh{ animation-duration: 900ms; }
}

@media print{
  @page{ margin: 14mm; }
  html, body{ background: #fff !important; color: #000; }
  body{ display: block; }
  .topbar, .hero, .paste, .dash, .actions, .fine, .backlink, .mini, .have, .ln__have, .vol,
  .opt-tipjar, .opt-fs, .opt-tickets, .opt-share, .mg-root, [class*="tipjar"], [class*="fullscreen"]{ display: none !important; }
  .stage{ padding: 0; max-width: none; }
  .desk{ padding: 0; }
  .desk::before, .card::after{ display: none; }
  .card{ box-shadow: none; border: 1px solid #bbb; background: #fff; }
  .card__lines{ background-image: none; min-height: 0; }
  .fig{ background: none; padding: 0; margin: 0; }
  .fig--flag{ box-shadow: none; text-decoration: underline; }
  .stamp{ mix-blend-mode: normal; }
  .ln{ break-inside: avoid; text-shadow: none; }
}
