/* ───────────────────── palette & base ───────────────────── */
:root {
  --peach: #ffd9c2;
  --peach-deep: #ffb596;
  --cream: #fff4e6;
  --butter: #fff0b8;
  --rose: #ffd2e0;
  --rose-deep: #ff9fbd;
  --lilac: #e0d4ff;
  --lilac-deep: #c3a9ff;
  --mint: #cfeedd;
  --mint-deep: #8fd8b3;
  --sky: #cde6ff;
  --ink: #3a2a3f;
  --ink-soft: #6b5a70;
  --line: rgba(58, 42, 63, 0.10);
  --line-soft: rgba(58, 42, 63, 0.06);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --shadow-soft: 0 10px 30px rgba(255, 149, 168, 0.18), 0 2px 8px rgba(58, 42, 63, 0.06);
  --shadow-pop: 0 18px 40px rgba(195, 169, 255, 0.35), 0 4px 14px rgba(58, 42, 63, 0.08);
  --radius: 28px;
  --radius-sm: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Fredoka', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh; /* iOS Safari dynamic viewport */
  overflow-x: hidden;
  font-weight: 400;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ───────────────────── sticky background ─────────────────────
   the gradient lives on the canvas and is sized to the viewport, so it
   stays put while the content scrolls over it instead of stretching
   across the whole document height. */
html {
  background: linear-gradient(135deg, #fff1e8 0%, #ffe3ee 35%, #ece0ff 70%, #d9f1e6 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  background-color: #ffe3ee; /* fills the overscroll / rubber-band area */
}
body { background: transparent; }

/* ───────────── kill the injected top-bar gap ─────────────
   the host (kritrim.space) injects a KRITRIM_SITEFIX <style> AFTER our
   stylesheet that reserves a strip for a top anchor ad:
       body { padding-top: 98px }
       @media (max-width: 767px) { body { padding-top: 56px } }
   that ad never renders, so it just leaves an empty band above the header.
   `html body` (specificity 0,0,2) outranks their `body` (0,0,1), so this
   wins without !important even though their rule comes later.
   Best fix is still to delete the injected block — this is the safety net. */
html body { padding-top: 0; }

/* ───────────────────── no zoom ─────────────────────
   pan-x pan-y allows scrolling and the horizontal pantry swipe but
   removes pinch-zoom and double-tap-zoom. this is the part iOS Safari
   actually honours — it ignores user-scalable=no in the viewport tag. */
html {
  touch-action: pan-x pan-y;
}

/* ───────────────────── no text copying ─────────────────────
   casual protection only — view-source and devtools can always read a
   static page. IMAGES are deliberately left alone: the guide tells
   people to long-press / right-click a mashup to save it. */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
img {
  -webkit-touch-callout: default;
  -webkit-user-drag: auto;
  user-select: none;
}

/* nothing to highlight, even if a selection somehow starts */
::selection { background: transparent; color: inherit; }
::-moz-selection { background: transparent; color: inherit; }

/* print / "save as PDF" is the one route that sidesteps selection blocking,
   so the printed page carries the notice instead of the content */
@media print {
  body > * { display: none !important; }
  body::after {
    content: "Emoji Blend ♡ visit emojiblend.kritrim.space";
    display: block;
    padding: 40px;
    font-family: 'Fredoka', system-ui, sans-serif;
    font-size: 18px;
    text-align: center;
    color: #3a2a3f;
  }
  html { background: #fff !important; }
}

button, a {
  -webkit-tap-highlight-color: rgba(255, 159, 189, 0.18);
}

/* visible keyboard focus — the whole site was unnavigable without it */
:focus-visible {
  outline: 3px solid var(--rose-deep);
  outline-offset: 3px;
  border-radius: 6px;
}
.em:focus-visible, .chip:focus-visible, .btn:focus-visible,
.slot:focus-visible, .vibe:focus-visible, .fridge-item:focus-visible {
  outline-offset: 2px;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,0.55) 0, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(255,255,255,0.4) 0, transparent 45%);
  pointer-events: none;
  z-index: 0;
}

/* subtle grain */
body::after {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.9  0 0 0 0 0.7  0 0 0 0 0.8  0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.35;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}

/* ───────────────────── floating blobs ───────────────────── */
.bg-blobs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: float 18s ease-in-out infinite;
}
.blob-1 { width: 420px; height: 420px; background: var(--rose); top: -120px; left: -120px; }
.blob-2 { width: 360px; height: 360px; background: var(--lilac); top: 20%; right: -140px; animation-delay: -4s; }
.blob-3 { width: 320px; height: 320px; background: var(--mint); bottom: -120px; left: 20%; animation-delay: -8s; }
.blob-4 { width: 280px; height: 280px; background: var(--butter); bottom: 10%; right: 10%; animation-delay: -12s; }

@keyframes float {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(40px,-30px) scale(1.05); }
  66% { transform: translate(-30px,30px) scale(0.95); }
}

/* sparkle sprinkles */
/* overflow:hidden keeps a randomly-placed sparkle from poking past the edge */
.sprinkles { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.sparkle {
  position: absolute;
  font-size: 14px;
  opacity: 0;
  animation: sparkle-pop 4s ease-in-out infinite;
}
@keyframes sparkle-pop {
  0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); }
  50% { opacity: 0.9; transform: scale(1) rotate(180deg); }
}

/* ───────────────────── layout ───────────────────── */
/* max-width + padding match .wrap so the logo/nav line up with the cards */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 22px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.logo-link { text-decoration: none; color: inherit; }
.logo-emoji {
  font-size: 28px;
  display: inline-block;
  animation: wiggle 3s ease-in-out infinite;
}
.logo-text em {
  font-style: normal;
  color: var(--rose-deep);
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 28px;
  margin-left: 2px;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(8deg); }
}

.pill {
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
  box-shadow: var(--shadow-soft);
  display: inline-block;
}

.nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pill-ads {
  background: linear-gradient(135deg, var(--butter), var(--peach));
  color: var(--ink);
  font-weight: 500;
  border-color: rgba(255, 181, 150, 0.4);
}

.ads-note {
  margin-top: 8px !important;
  color: var(--ink-soft);
  opacity: 0.75;
  font-style: italic;
}

.pill-link {
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.pill-link:hover {
  transform: translateY(-2px);
  color: var(--rose-deep);
  box-shadow: var(--shadow-pop);
}

.foot-link {
  color: var(--rose-deep);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dashed var(--rose-deep);
  padding-bottom: 1px;
  transition: color 0.15s ease, border-color 0.15s ease;
  position: relative;
  display: inline-block;
}
/* the link text is only ~18px tall — widen the touch target to 44px
   without moving the underline */
.foot-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 44px;
}
.foot-link:hover {
  color: var(--lilac-deep);
  border-color: var(--lilac-deep);
}

.wrap {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px 60px;
}

/* ───────────────────── hero ───────────────────── */
.hero {
  text-align: center;
  padding: 28px 12px 44px;
}
.kicker {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-family: 'Caveat', cursive;
  font-size: 22px;
  letter-spacing: 0.02em;
}
.hero h1 {
  font-size: clamp(42px, 7vw, 78px);
  margin: 0 0 18px;
  line-height: 0.98;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.hero h1 em {
  font-style: normal;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  background: linear-gradient(135deg, var(--rose-deep), var(--lilac-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.1em;
  display: inline-block;
  transform: rotate(-2deg);
}
.hero .sub {
  max-width: 560px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.55;
}
.hero .sub b { color: var(--ink); font-weight: 600; }

/* ───────────────────── card base ───────────────────── */
.card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 28px;
  position: relative;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), transparent 40%);
  pointer-events: none;
}

h2 {
  font-size: 24px;
  margin: 0 0 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.tag {
  background: var(--lilac);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* ───────────────────── stove / slots ───────────────────── */
.stove { padding: 32px 28px 24px; }

.slots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.slot {
  background: var(--glass-strong);
  border: 2px dashed rgba(195, 169, 255, 0.55);
  border-radius: 26px;
  width: 150px;
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  font-family: inherit;
  color: var(--ink);
  position: relative;
}
.slot:hover {
  transform: translateY(-4px) rotate(-1.5deg);
  border-color: var(--rose-deep);
  box-shadow: var(--shadow-pop);
}
.slot.is-filled {
  border-style: solid;
  border-color: rgba(255, 159, 189, 0.7);
}
.slot-label {
  font-size: 12px;
  color: var(--ink-soft);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}
.slot-emoji {
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(255, 149, 168, 0.25));
  animation: wiggle 4s ease-in-out infinite;
}
.slot-hint {
  font-size: 11px;
  color: var(--ink-soft);
  opacity: 0.7;
}

.plus, .equals {
  font-size: 32px;
  color: var(--rose-deep);
  font-weight: 600;
  width: 40px;
  text-align: center;
  position: relative;
  font-family: 'Caveat', cursive;
}
.plus-sign { position: relative; z-index: 2; font-size: 34px; }
.plus-ring {
  position: absolute; inset: 0; margin: auto;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--butter);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* plate */
.plate {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.plate-inner {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #ffffff 0%, #fff4e6 50%, #ffd9c2 100%);
  box-shadow:
    inset 0 -6px 20px rgba(255, 149, 168, 0.25),
    inset 0 3px 10px rgba(255, 255, 255, 0.9),
    0 12px 30px rgba(195, 169, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.plate-inner::before {
  content: "";
  position: absolute;
  top: 10%; left: 15%;
  width: 40%; height: 20%;
  background: rgba(255,255,255,0.6);
  border-radius: 50%;
  filter: blur(6px);
}
.plate-shadow {
  position: absolute;
  bottom: -10px;
  width: 140px; height: 16px;
  background: rgba(58, 42, 63, 0.12);
  filter: blur(10px);
  border-radius: 50%;
  left: 50%; transform: translateX(-50%);
}

.result { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.result img {
  width: 128px; height: 128px;
  filter: drop-shadow(0 8px 12px rgba(58, 42, 63, 0.18));
  animation: pop-in 0.5s cubic-bezier(.34,1.56,.64,1);
}
.result .big-emoji {
  font-size: 70px;
  opacity: 0.55;
  animation: wiggle 3s ease-in-out infinite;
}
.result-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.placeholder-text {
  color: var(--ink-soft);
  font-family: 'Caveat', cursive;
  font-size: 15px;
}

@keyframes pop-in {
  0% { transform: scale(0.4) rotate(-20deg); opacity: 0; }
  70% { transform: scale(1.1) rotate(4deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* steam */
.steam {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 8px;
  opacity: 0;
  transition: opacity 0.3s;
}
.plate.is-cooking .steam { opacity: 1; }
.steam span {
  display: block;
  width: 8px; height: 28px;
  background: linear-gradient(to top, rgba(255,255,255,0.7), transparent);
  border-radius: 8px;
  animation: steam 2s ease-in-out infinite;
}
.steam span:nth-child(2) { animation-delay: 0.3s; }
.steam span:nth-child(3) { animation-delay: 0.6s; }
@keyframes steam {
  0% { transform: translateY(0) scaleX(1); opacity: 0; }
  30% { opacity: 0.9; }
  100% { transform: translateY(-30px) scaleX(0.4); opacity: 0; }
}

/* controls */
.controls {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin-top: 6px;
}
.btn {
  border: none;
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  letter-spacing: 0.01em;
}
.btn-ico { font-size: 16px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn:not(:disabled):active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--rose-deep), var(--lilac-deep));
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 159, 189, 0.45);
}
.btn-primary:not(:disabled):hover { box-shadow: 0 12px 26px rgba(195, 169, 255, 0.55); }
.btn-soft {
  background: var(--butter);
  color: var(--ink);
  box-shadow: 0 6px 14px rgba(255, 240, 184, 0.5);
}
.btn-ghost {
  background: var(--glass-strong);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-xs { padding: 7px 12px; font-size: 12px; }

.status {
  text-align: center;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-family: 'Caveat', cursive;
  font-size: 18px;
  min-height: 24px;
}

.cozy-msg {
  text-align: center;
  margin: 12px auto 0;
  max-width: 440px;
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--butter), var(--peach));
  border-radius: 22px 22px 22px 4px;
  color: var(--ink);
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
  box-shadow: 0 8px 20px rgba(255, 181, 150, 0.3);
  position: relative;
  animation: msg-pop 0.45s cubic-bezier(.34,1.56,.64,1);
  letter-spacing: 0.01em;
}
.cozy-msg::before {
  content: "♡";
  position: absolute;
  top: -10px; left: -8px;
  font-size: 18px;
  color: var(--rose-deep);
  animation: wiggle 2s ease-in-out infinite;
}

@keyframes msg-pop {
  0% { transform: scale(0.8) rotate(-3deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin { display: inline-block; animation: spin 1.2s linear infinite; }

/* ───────────────────── pantry ───────────────────── */
.pantry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.pantry-head h2 { margin: 0; }

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.chip {
  background: var(--glass-strong);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.18s ease;
}
.chip:hover { transform: translateY(-2px); color: var(--ink); }
.chip.is-active {
  background: linear-gradient(135deg, var(--peach), var(--rose));
  color: var(--ink);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(255, 181, 150, 0.4);
}

/* horizontal slide-pantry: 4 visible rows, swipe / scroll left-to-right ♡ */
.grid {
  display: grid;
  grid-template-rows: repeat(4, 72px);
  grid-auto-flow: column;
  grid-auto-columns: 72px;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,0.45), rgba(255,240,230,0.35));
  border: 1px solid var(--line-soft);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--rose) transparent;
  /* fade the right edge so users see there's more to scroll */
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 30px), transparent 100%);
          mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 30px), transparent 100%);
  position: relative;
}
.grid::-webkit-scrollbar { height: 8px; }
.grid::-webkit-scrollbar-thumb {
  background: var(--rose);
  border-radius: 99px;
}
.grid::-webkit-scrollbar-track { background: transparent; }

.em {
  scroll-snap-align: start;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: linear-gradient(155deg, rgba(255,255,255,0.85), rgba(255,240,230,0.55));
  font-size: 42px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 18px;
  box-shadow:
    0 4px 10px rgba(255, 159, 189, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -4px 8px rgba(255, 210, 224, 0.15);
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1),
              box-shadow 0.2s ease,
              background 0.2s ease;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  line-height: 1;
  padding: 0;
  position: relative;
  overflow: hidden;
}
.em::after {
  content: "";
  position: absolute;
  top: 6px; left: 8px;
  width: 40%; height: 22%;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  filter: blur(3px);
  pointer-events: none;
  opacity: 0.8;
}
.em:hover {
  background: linear-gradient(155deg, #fff4e6, #ffd9eb);
  transform: translateY(-5px) scale(1.14) rotate(-5deg);
  box-shadow:
    0 10px 22px rgba(255, 159, 189, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}
.em:active {
  transform: translateY(-2px) scale(1.06) rotate(0deg);
}
.em.is-picked {
  background: linear-gradient(135deg, var(--rose), var(--lilac));
  box-shadow:
    0 6px 16px rgba(255, 159, 189, 0.45),
    inset 0 0 0 2px var(--rose-deep),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translateY(-2px) scale(1.05);
}

.skeleton {
  display: contents;
}
.skeleton span {
  aspect-ratio: 1/1;
  background: linear-gradient(90deg, rgba(255,255,255,0.5), rgba(255,255,255,0.8), rgba(255,255,255,0.5));
  background-size: 200% 100%;
  border-radius: 14px;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ───────────────────── fridge ───────────────────── */
.fridge-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.fridge-head h2 { margin: 0; }
.fridge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
}
.fridge-item {
  position: relative;
  aspect-ratio: 1/1;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.fridge-item:hover { transform: translateY(-3px) rotate(-2deg); box-shadow: var(--shadow-pop); }
.fridge-item img { width: 72%; height: 72%; }
.fridge-item .x {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--rose-deep);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s;
}
.fridge-item:hover .x,
.fridge-item .x:focus-visible { opacity: 1; }

/* on touch there is no hover, so the remove button would be invisible
   (but still tappable) — always show it there */
@media (hover: none) {
  .fridge-item .x { opacity: 1; }
}

/* ───────────────────── vibes ───────────────────── */
.vibes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
}
.vibe {
  background: linear-gradient(135deg, var(--glass-strong), rgba(255, 240, 184, 0.5));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.vibe:hover {
  transform: translateY(-4px) rotate(-1deg);
  box-shadow: var(--shadow-pop);
}
.vibe .combo {
  font-size: 22px;
  color: var(--ink-soft);
  margin-bottom: 4px;
  font-family: 'Caveat', cursive;
}
.vibe img { width: 60px; height: 60px; margin: 4px 0; }
.vibe .lbl {
  font-size: 12px;
  color: var(--ink-soft);
}

/* ───────────────────── ad units (AdSterra) ───────────────────── */
.ad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 8px auto 28px;
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.55), rgba(255,240,230,0.35));
  border: 1px solid var(--line-soft);
  position: relative;
  z-index: 2;
}
.ad-slot {
  display: block;
  border: 0;
  line-height: 0;
  background: transparent;
  max-width: 100%;
}

/* a slot that never got filled (blocked / no fill) is hidden by script.js
   rather than left as an empty labelled box */
.ad.is-unfilled { display: none !important; }

/* top leaderboard 728x90 — desktop only.
   hidden below 781px, exactly where the sticky mobile banner takes over */
.ad-leaderboard { max-width: 748px; }
.ad-leaderboard iframe.ad-slot { width: 728px; height: 90px; }
@media (max-width: 780px) { .ad-leaderboard { display: none; } }

/* in-content 300x250 — visible on all screens */
.ad-rectangle { max-width: 320px; }
.ad-rectangle iframe.ad-slot { width: 300px; height: 250px; }

/* skyscrapers 160x600 — desktop only, one on each side */
.ad-sky {
  position: fixed;
  top: 90px;
  z-index: 10;
  margin: 0;
  padding: 6px 8px;
  width: 176px;
}
.ad-sky-left  { left: 12px; }
.ad-sky-right { right: 12px; }
.ad-sky iframe.ad-slot { width: 160px; height: 600px; }

/* a sky ad clears the content only when the gutter fits it:
   (vw − 1100 wrap) / 2 ≥ 12 offset + 176 width + 8 breathing room
   → vw ≥ 1492. below that they'd sit on top of the cards, so hide both. */
@media (max-width: 1491px) {
  .ad-sky { display: none; }
}
/* and never let them run past the bottom of a short window */
@media (max-height: 700px) {
  .ad-sky { display: none; }
}

/* mobile banner 320x50 — sticky bottom, mobile only */
/* stacked, and with no side padding, so the full 320px creative fits
   even on a 320px-wide phone */
.ad-mobile {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 4px 0 calc(4px + env(safe-area-inset-bottom, 0px));
}
.ad-mobile iframe.ad-slot { width: 320px; height: 50px; max-width: 100%; }
@media (min-width: 781px) { .ad-mobile { display: none; } }

/* leave space at bottom of page on mobile so sticky banner doesn't cover content */
@media (max-width: 780px) {
  body { padding-bottom: 68px; }
}


/* ───────────────────── toast ───────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(36px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(58, 42, 63, 0.3);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* must come AFTER the .toast rule above, or it loses the cascade and the
   toast ends up sitting on top of the sticky mobile ad bar */
@media (max-width: 780px) {
  .toast { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}

/* ───────────────────── footer ───────────────────── */
.foot {
  text-align: center;
  padding: 30px 0 10px;
  color: var(--ink-soft);
}
.foot p { margin: 4px 0; font-size: 14px; }
.foot .tiny { font-size: 11px; opacity: 0.7; }

/* ───────────────────── tablet portrait (721-900px) ───────────────────── */
@media (min-width: 721px) and (max-width: 900px) {
  .topbar { padding: 18px 24px; }
  .wrap { padding: 10px 20px 48px; }
  .slot { width: 130px; height: 130px; }
  .slot-emoji { font-size: 54px; }
  .plate { width: 170px; height: 170px; }
  .plate-inner { width: 160px; height: 160px; }
  .grid { grid-template-rows: repeat(4, 68px); grid-auto-columns: 68px; }
  .em { font-size: 40px; }
}

/* ───────────────────── mobile layout ───────────────────── */
@media (max-width: 720px) {
  /* topbar */
  .topbar {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .topbar .nav { gap: 6px; flex-wrap: wrap; }
  .pill { padding: 6px 12px; font-size: 12px; }
  .logo { font-size: 19px; gap: 8px; }
  .logo-emoji { font-size: 24px; }
  .logo-text em { font-size: 24px; }

  /* layout container */
  .wrap { padding: 6px 14px 32px; }
  .card { padding: 20px 16px; border-radius: 22px; margin-bottom: 20px; }

  /* hero */
  .hero { padding: 12px 4px 22px; }
  .hero h1 { font-size: 38px; line-height: 1; margin-bottom: 14px; }
  .hero h1 em { font-size: 1.05em; }
  .hero .sub { font-size: 15px; line-height: 1.5; }
  .kicker { font-size: 18px; margin-bottom: 8px; }

  /* slots grid: A + B on row 1, plate centered on row 2 */
  .slots {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 16px;
    width: 100%;
    align-items: center;
    justify-items: center;
  }
  #slotA { grid-area: 1 / 1; justify-self: end; }
  .plus  { grid-area: 1 / 2; }
  #slotB { grid-area: 1 / 3; justify-self: start; }
  .equals { display: none; }
  #plate { grid-column: 1 / 4; grid-row: 2; }

  .slot { width: 110px; height: 110px; gap: 2px; }
  .slot-label { font-size: 11px; }
  .slot-emoji { font-size: 48px; }
  .slot-hint { font-size: 10px; }

  .plus { font-size: 26px; width: 32px; }
  .plus-ring { width: 30px; height: 30px; }

  .plate { width: 190px; height: 190px; }
  .plate-inner { width: 178px; height: 178px; }
  .result img { width: 136px; height: 136px; }
  .result .big-emoji { font-size: 58px; }

  /* controls — full-width stacked buttons */
  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 8px;
  }
  .btn {
    width: 100%;
    justify-content: center;
    padding: 13px 18px;
    font-size: 15px;
  }
  .status { font-size: 17px; margin-top: 14px; }
  .cozy-msg { font-size: 19px; padding: 12px 18px; max-width: 100%; }

  /* pantry */
  .pantry-head h2 { font-size: 22px; margin-bottom: 0; }
  .tag { font-size: 11px; padding: 3px 9px; }

  /* chips: horizontal-scroll row instead of multi-line wrap */
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 14px -16px 14px;
    padding: 2px 16px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 12px;
    padding: 7px 12px;
  }

  /* pantry slide — 3 rows on phone, swipe horizontally */
  .grid {
    grid-template-rows: repeat(3, 64px);
    grid-auto-columns: 64px;
    gap: 8px;
    padding: 10px 12px;
  }
  .em { font-size: 36px; border-radius: 16px; }

  /* vibes */
  .vibes-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
  .vibe { padding: 10px 6px; border-radius: 18px; }
  .vibe img { width: 56px; height: 56px; }
  .vibe .combo { font-size: 18px; }
  .vibe .lbl { font-size: 11px; }

  /* fridge */
  .fridge-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
  .fridge-head h2 { font-size: 22px; }

  /* footer */
  .foot p { font-size: 13px; }
}

/* ───────────────────── extra-small phones (≤ 400px) ───────────────────── */
@media (max-width: 400px) {
  .hero h1 { font-size: 32px; }
  .hero .sub { font-size: 14px; }
  .kicker { font-size: 16px; }

  .slot { width: 96px; height: 96px; }
  .slot-emoji { font-size: 42px; }
  .plus { font-size: 22px; }
  .plate { width: 170px; height: 170px; }
  .plate-inner { width: 158px; height: 158px; }
  .result img { width: 120px; height: 120px; }

  .grid { grid-template-rows: repeat(3, 56px); grid-auto-columns: 56px; gap: 6px; }
  .em { font-size: 32px; border-radius: 14px; }

  .vibes-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .vibe img { width: 48px; height: 48px; }

  .pill { font-size: 11px; padding: 5px 10px; }
  .logo { font-size: 17px; }
  .logo-emoji { font-size: 22px; }
}

/* ───────────────────── reduced motion ─────────────────────
   the page runs a dozen looping animations (blobs, wiggle, steam,
   sparkles, shimmer). honour the OS setting and settle everything down. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .blob { display: none; }
  .sprinkles { display: none; }
  .steam { display: none; }
  .em:hover, .slot:hover, .vibe:hover, .fridge-item:hover, .chip:hover,
  .btn:not(:disabled):hover, .pill-link:hover {
    transform: none;
  }
}
/* KRITRIM_ADFIT — banners, boxes and the mobile bar sit in the page flow, never
   overlaying or cropping. The side rails are handled separately below.

   This block previously forced position:static and transform:none with
   !important on every ad element. That stopped an older overlay bug, but it
   also made it impossible to SCALE an oversized unit: a 728x90 in a 347px
   column could then only be clipped, losing its right-hand half, and any
   attempt to scale it was silently discarded. Worse, an in-flow 728px frame set
   the content width of its ancestors, which stretched main.wrap to 1087px on a
   375px screen and pushed the page's own text off the edge.

   The host is now a positioned block and the frame inside it is absolute, so
   the frame contributes nothing to any ancestor's width and can be scaled to
   the column by script (see KRITRIM_ADFIT in the page). The rails keep their
   own fixed positioning below. */
.ad:not(.ad-sky){
  position: relative !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 14px auto !important;
  overflow: hidden !important;
  z-index: auto !important;
}
.ad:not(.ad-sky) > iframe.ad-slot{
  position: absolute !important;
  top: 0 !important;
  bottom: auto !important;
  right: auto !important;
  transform-origin: top left !important;
  max-width: none !important;
  display: block !important;
}
/* Anything in the article column may be no wider than the column. */
main.wrap, .hero, .card { min-width: 0; max-width: 100%; }

/* KRITRIM_RAILS — two fixed side rails pinned in the page gutters. They only
   appear once the viewport is wide enough that the 1100px content column leaves
   room on both sides, so a rail can never sit on top of the tool. */
.ad-sky{
  position: fixed !important;
  top: 90px !important;
  bottom: auto !important;
  margin: 0 !important;
  padding: 6px 8px !important;
  width: 176px !important;
  max-width: 176px !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  z-index: 10 !important;
  overflow: hidden !important;
}
.ad-sky-left  { left: 12px !important; right: auto !important; }
.ad-sky-right { right: 12px !important; left: auto !important; }
.ad-sky iframe.ad-slot { width: 160px !important; height: 600px !important; max-width: 160px !important; }
/* below 1492px the gutter can't hold a 176px rail without overlapping — hide both */
@media (max-width: 1491px){ .ad-sky,.ad-sky-left,.ad-sky-right{ display:none !important; } }
/* and never let a 600px-tall rail run off a short window */
@media (max-height: 700px){ .ad-sky,.ad-sky-left,.ad-sky-right{ display:none !important; } }

/* Sticky bottom ad clearance. The bar is position:fixed, so the footer -
   which is a sibling, not a child of the content column - sat underneath it
   and the policy links could not be clicked. Reserve the bar's height plus
   the device safe-area on the footer itself. */
footer, .site-footer { padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
