/* =========================================================================
   Smart Kids Chef AI — PyWebView edition
   Modern Warm Pastel design. Fonts: Prompt (headings) + Sarabun (body) from
   Google Fonts, with local fallbacks from ../assets/fonts for offline use.
   ========================================================================= */


:root {
  --font-head: "Prompt", "Leelawadee UI", "Noto Sans Thai", "Thonburi", "Tahoma", sans-serif;
  --font-body: "Sarabun", "Leelawadee UI", "Noto Sans Thai", "Thonburi", "Tahoma", sans-serif;

  --bg: #fff7ef;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --line: #f1e2d4;
  --text: #3b322c;
  --muted: #74685f;

  --peach: #ff9a76;
  --peach-deep: #e2622f;
  --peach-ink: #b4461d;
  --peach-soft: #ffeadf;
  --mint: #5cc9a7;
  --mint-deep: #1f8f74;
  --mint-ink: #146a56;
  --mint-soft: #ddf5ec;
  --butter: #ffe7a3;
  --butter-ink: #8a5a06;
  --butter-soft: #fff6d8;
  --lilac: #b9a7ff;
  --lilac-ink: #5a47b5;
  --lilac-soft: #efeaff;
  --sky-soft: #e5f1ff;
  --sky-ink: #2a64a6;
  --rose-soft: #ffe4e6;
  --rose-ink: #b4232f;

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 2px 8px rgba(176, 96, 58, 0.08);
  --shadow-md: 0 12px 30px -10px rgba(176, 96, 58, 0.22);
  --shadow-lg: 0 24px 60px -20px rgba(150, 80, 40, 0.30);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(226, 98, 47, 0.45); outline-offset: 2px; border-radius: 12px; }
[hidden] { display: none !important; }
.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; }

/* ----------------------------------------------------- background blobs */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.55; animation: float 18s ease-in-out infinite; }
.b1 { width: 520px; height: 520px; background: #ffd3bf; top: -160px; left: -120px; }
.b2 { width: 460px; height: 460px; background: #cdeee2; bottom: -180px; right: -100px; animation-delay: -6s; }
.b3 { width: 360px; height: 360px; background: #fff0bd; top: 30%; right: 22%; animation-delay: -11s; }
.b4 { width: 300px; height: 300px; background: #e6ddff; bottom: 8%; left: 28%; animation-delay: -3s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 25px) scale(0.97); }
}

/* --------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 14px 32px;
  background: rgba(255, 249, 243, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(241, 226, 212, 0.8);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-size: 26px;
  background: linear-gradient(135deg, #ffb592, #ff8a65); box-shadow: var(--shadow-md);
}
.brand-name { font-family: var(--font-head); font-weight: 600; font-size: 20px; line-height: 1.35; }
.brand-sub { font-size: 13px; color: var(--muted); }

.tabs {
  position: relative; display: flex; gap: 4px; padding: 5px;
  background: rgba(255, 255, 255, 0.75); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow-sm);
}
.tab {
  position: relative; z-index: 1; border: 0; background: transparent;
  padding: 10px 20px; border-radius: 999px;
  font-family: var(--font-head); font-weight: 500; font-size: 15px; color: var(--muted);
  transition: color 0.3s var(--ease-out);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.tab.active { color: #fff; }
.tab-indicator {
  position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 5px; width: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9a76, #f2734a);
  box-shadow: 0 8px 18px -6px rgba(226, 98, 47, 0.55);
  transition: transform 0.45s var(--ease-spring), width 0.45s var(--ease-spring);
}
.tab-badge {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: 12px; font-family: var(--font-body);
  background: var(--peach-soft); color: var(--peach-ink);
}
.tab.active .tab-badge { background: rgba(255, 255, 255, 0.28); color: #fff; }

.status-pill {
  justify-self: end; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px; font-size: 13px;
  background: var(--mint-soft); color: var(--mint-ink);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint-deep); box-shadow: 0 0 0 4px rgba(31, 143, 116, 0.18); }
.status-pill.warn { background: var(--rose-soft); color: var(--rose-ink); }
.status-pill.warn .dot { background: var(--rose-ink); box-shadow: 0 0 0 4px rgba(180, 35, 47, 0.15); }

/* ----------------------------------------------------------------- pages */
main { padding: 28px 32px 48px; max-width: 1560px; margin: 0 auto; }
.page { animation: pageIn 0.55s var(--ease-out) both; }
.page.leaving { animation: pageOut 0.22s ease-in both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(18px) scale(0.99); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes pageOut { to { opacity: 0; transform: translateY(-10px); filter: blur(3px); } }

.panel {
  background: var(--surface); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.9); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.hero-title { font-family: var(--font-head); font-weight: 600; font-size: 30px; line-height: 1.45; margin: 0; }
.hero-sub { margin: 6px 0 0; color: var(--muted); }

/* --------------------------------------------------------------- planner */
.planner-grid { display: grid; grid-template-columns: minmax(360px, 430px) 1fr; gap: 28px; align-items: start; }
.form-panel { position: sticky; top: 104px; padding: 28px; max-height: calc(100vh - 128px); overflow: auto; scrollbar-width: thin; }
.field { margin-top: 24px; }
.field-head { display: flex; align-items: center; justify-content: space-between; }
.field-title { display: block; font-family: var(--font-head); font-weight: 500; font-size: 16px; margin-bottom: 10px; }
.hint { font-family: var(--font-body); font-size: 13px; color: var(--rose-ink); font-weight: 400; }
.count-badge {
  font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--peach-soft); color: var(--peach-ink);
  animation: pop 0.35s var(--ease-spring);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface-solid);
  font-size: 15px; color: var(--text);
  transition: transform 0.2s var(--ease-spring), background 0.25s, border-color 0.25s, box-shadow 0.25s;
  user-select: none;
}
.chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: #f5cdb8; }
.chip:active { transform: scale(0.96); }
.chip .emoji { font-size: 17px; line-height: 1; }
.chip .check { width: 0; overflow: hidden; transition: width 0.25s var(--ease-out); font-weight: 700; }
.chip[aria-pressed="true"] {
  background: linear-gradient(135deg, #fff1e9, #ffe0d1); border-color: var(--peach); color: var(--peach-ink);
  box-shadow: 0 6px 14px -8px rgba(226, 98, 47, 0.6);
}
.chip[aria-pressed="true"] .check { width: 14px; }
.chip[aria-pressed="true"] .emoji { animation: wiggle 0.5s var(--ease-spring); }
@keyframes wiggle { 30% { transform: rotate(-14deg) scale(1.2); } 60% { transform: rotate(10deg); } }

.allergy-chips .chip[aria-pressed="true"] {
  background: linear-gradient(135deg, #fff0f1, #ffe0e3); border-color: #f08a94; color: var(--rose-ink);
  box-shadow: 0 6px 14px -8px rgba(180, 35, 47, 0.5);
}
.custom-chips { margin-top: 10px; }
.custom-chips .chip { background: var(--mint-soft); border-color: #a9e3cf; color: var(--mint-ink); animation: pop 0.35s var(--ease-spring); }
.chip-remove { min-width: 32px; min-height: 32px; margin-right: -8px; border: 0; border-radius: 50%; background: transparent; font-size: 14px; color: inherit; opacity: 0.7; }
.chip-remove:hover { opacity: 1; }

.input {
  width: 100%; margin-top: 10px; padding: 12px 16px; border-radius: var(--radius-md);
  border: 1.5px solid var(--line); background: #fffaf6; font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input:focus { outline: none; border-color: var(--peach); background: #fff; box-shadow: 0 0 0 4px rgba(255, 154, 118, 0.18); }
.add-row { display: flex; gap: 8px; align-items: stretch; }
.add-row .input { flex: 1; }
.btn-soft {
  margin-top: 10px; padding: 0 16px; border-radius: var(--radius-md); border: 0;
  background: var(--mint-soft); color: var(--mint-ink); font-family: var(--font-head); font-weight: 500;
  transition: transform 0.2s var(--ease-spring), background 0.2s;
}
.btn-soft:hover { background: #c9eedf; transform: translateY(-1px); }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: #fbf1e8; border-radius: var(--radius-md); }
.seg {
  border: 0; background: transparent; padding: 9px 6px; border-radius: 12px; font-size: 14px; color: var(--muted);
  transition: background 0.3s var(--ease-out), color 0.3s, box-shadow 0.3s;
}
.seg[aria-checked="true"] { background: #fff; color: var(--mint-ink); font-weight: 600; box-shadow: var(--shadow-sm); }

.cta-row {
  /* stays visible at the bottom of the scrollable form panel */
  position: sticky; bottom: -28px; z-index: 3; display: flex; gap: 10px;
  margin: 24px -28px 0; padding: 16px 28px 20px;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 72%, rgba(255, 255, 255, 0));
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.btn-primary {
  position: relative; overflow: hidden; flex: 1; border: 0; border-radius: 18px; padding: 16px 20px;
  font-family: var(--font-head); font-weight: 600; font-size: 17px; color: #fff;
  /* white text keeps >= 3:1 contrast across the whole gradient (large bold text) */
  background: linear-gradient(135deg, #ea5a2a 0%, #dd4c1c 55%, #c83d0f 100%);
  box-shadow: 0 14px 28px -12px rgba(200, 61, 15, 0.65);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s, filter 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(226, 98, 47, 0.8); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { cursor: progress; filter: saturate(0.7); transform: none; }
.btn-shine {
  position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-100%); transition: transform 0.8s;
}
.btn-primary:hover .btn-shine, .btn-primary.loading .btn-shine { transform: translateX(100%); }
.btn-primary.loading .btn-shine { animation: shine 1.4s linear infinite; }
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.btn-label { position: relative; }
.btn-ghost {
  border: 1.5px solid var(--line); background: transparent; border-radius: 18px; padding: 0 18px; color: var(--muted);
  transition: background 0.2s;
}
.btn-ghost:hover { background: #fff3ea; }
.disclaimer { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }

/* --------------------------------------------------------------- results */
.results-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 16px; animation: pageIn 0.5s var(--ease-out); }
.results-title { font-family: var(--font-head); font-weight: 600; font-size: 24px; margin: 0; }
.results-meta { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.empty {
  display: grid; place-items: center; text-align: center; padding: 64px 24px; border-radius: var(--radius-xl);
  border: 2px dashed #f0d9c8; background: rgba(255, 255, 255, 0.5);
}
.empty-plate {
  width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 52px;
  background: radial-gradient(circle at 50% 50%, #fff 55%, #ffeadf 56%, #ffeadf 70%, #fff 71%);
  box-shadow: var(--shadow-md); animation: bob 3.2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }
.empty h3 { font-family: var(--font-head); font-weight: 600; margin: 18px 0 4px; }
.empty p { margin: 0; color: var(--muted); }

/* ------------------------------------------------------------------ loader */
.loader { display: grid; place-items: center; text-align: center; padding: 48px 24px 56px; }
.pot-scene { position: relative; width: 220px; height: 190px; }
.pot {
  position: absolute; bottom: 10px; left: 50%; width: 150px; height: 92px; transform: translateX(-50%);
  background: linear-gradient(180deg, #ffb08c, #f07a4c); border-radius: 18px 18px 60px 60px;
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.06), var(--shadow-md);
}
.pot::before { /* rim */
  content: ""; position: absolute; top: -10px; left: -10px; right: -10px; height: 18px;
  background: #f26b3c; border-radius: 12px;
}
.pot::after { /* handles */
  content: ""; position: absolute; top: 18px; left: -26px; right: -26px; height: 16px;
  border-left: 16px solid #e2622f; border-right: 16px solid #e2622f; border-radius: 10px;
}
.pot-face { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); font-size: 22px; color: #7a2e12; letter-spacing: 6px; }
.lid { position: absolute; bottom: 104px; left: 50%; width: 120px; height: 18px; margin-left: -60px;
  background: #ff9a76; border-radius: 60px 60px 8px 8px; animation: lid 0.9s ease-in-out infinite; }
.lid::before { content: ""; position: absolute; top: -10px; left: 50%; width: 22px; height: 12px; margin-left: -11px; background: #e2622f; border-radius: 8px 8px 2px 2px; }
@keyframes lid { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-7px) rotate(-5deg); } 75% { transform: translateY(-4px) rotate(4deg); } }
.veggie { position: absolute; bottom: 100px; left: 50%; font-size: 26px; opacity: 0; animation: jump 2.4s ease-in-out infinite; }
.veggie:nth-child(4) { animation-delay: 0.6s; margin-left: -50px; }
.veggie:nth-child(5) { animation-delay: 1.2s; margin-left: 20px; }
.veggie:nth-child(6) { animation-delay: 1.8s; margin-left: -15px; }
@keyframes jump {
  0% { opacity: 0; transform: translateY(20px) rotate(0) scale(0.6); }
  20% { opacity: 1; }
  50% { opacity: 1; transform: translateY(-70px) rotate(180deg) scale(1); }
  80% { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(10px) rotate(360deg) scale(0.7); }
}
.steam { position: absolute; bottom: 120px; width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 10px rgba(255, 200, 170, 0.8); animation: steam 2s ease-out infinite; }
.steam.s1 { left: 70px; } .steam.s2 { left: 104px; animation-delay: 0.7s; } .steam.s3 { left: 138px; animation-delay: 1.3s; }
@keyframes steam { from { opacity: 0.9; transform: translateY(0) scale(0.6); } to { opacity: 0; transform: translateY(-80px) scale(1.8); } }
.loader-text { font-family: var(--font-head); font-weight: 500; font-size: 19px; margin: 18px 0 6px; min-height: 30px; transition: opacity 0.3s; }
.loader-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.progress { width: min(360px, 80%); height: 10px; border-radius: 999px; background: var(--peach-soft); overflow: hidden; }
.progress span { display: block; height: 100%; width: 40%; border-radius: inherit;
  background: linear-gradient(90deg, #ffb592, #f0703f, #ffb592); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-110%); } to { transform: translateX(260%); } }

/* ---------------------------------------------------------- recipe cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 22px; align-items: start; }
.card {
  position: relative; overflow: hidden; background: var(--surface-solid);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-md); border: 1px solid #fbeee4;
  animation: cardUp 0.7s var(--ease-spring) both;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
@keyframes cardUp { from { opacity: 0; transform: translateY(40px) scale(0.94); } to { opacity: 1; transform: none; } }
.card-head { position: relative; padding: 22px 22px 20px; color: #4a2a1a; }
.card.theme-0 .card-head { background: linear-gradient(135deg, #ffd9c7 0%, #ffc1a6 100%); }
.card.theme-1 .card-head { background: linear-gradient(135deg, #d4f3e6 0%, #b5e8d5 100%); color: #12463a; }
.card.theme-2 .card-head { background: linear-gradient(135deg, #fff0c4 0%, #ffe199 100%); color: #5a3d06; }
.card-emoji {
  width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center; font-size: 34px;
  background: rgba(255, 255, 255, 0.85); box-shadow: var(--shadow-sm); float: left; margin-right: 14px;
}
.card-num { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.75); }
.card-title { font-family: var(--font-head); font-weight: 600; font-size: 21px; line-height: 1.45; margin: 6px 56px 0 0; }
.heart {
  position: absolute; top: 18px; right: 18px; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.9); box-shadow: var(--shadow-sm); font-size: 22px; line-height: 1;
  display: grid; place-items: center; transition: transform 0.25s var(--ease-spring), background 0.2s;
}
.heart:hover { transform: scale(1.1); }
.heart .h-on { display: none; }
.heart[aria-pressed="true"] .h-on { display: inline; }
.heart[aria-pressed="true"] .h-off { display: none; }
.heart[aria-pressed="true"] { background: #fff0f2; }
.heart.burst { animation: heartPop 0.55s var(--ease-spring); }
@keyframes heartPop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
.heart:disabled { opacity: 0.6; cursor: progress; }

.card-meta { display: flex; flex-wrap: wrap; gap: 8px; clear: both; padding-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13.5px; background: rgba(255, 255, 255, 0.75); }

.card-body { padding: 18px 22px 22px; }
.desc { margin: 0 0 4px; color: var(--muted); }
.warn {
  display: flex; gap: 10px; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--radius-md);
  background: var(--rose-soft); color: var(--rose-ink); font-size: 14.5px; animation: shake 0.6s ease-in-out 0.4s both;
}
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.highlight {
  display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 4px; padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--mint-soft); color: var(--mint-ink); font-size: 14.5px;
}
.highlight strong { display: block; font-family: var(--font-head); font-weight: 500; }
.sec-title { display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; font-family: var(--font-head); font-weight: 600; font-size: 16px; }
.sec-title .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; }
.ico.mint { background: var(--mint-soft); } .ico.peach { background: var(--peach-soft); } .ico.butter { background: var(--butter-soft); } .ico.lilac { background: var(--lilac-soft); }

.ing-list, .step-list, .tip-list { list-style: none; padding: 0; margin: 0; }
.ing {
  display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: 10px; cursor: pointer;
  transition: background 0.2s;
}
.ing:hover { background: #f7fbf9; }
.ing .box { width: 20px; height: 20px; flex: none; border-radius: 6px; border: 2px solid #a9e3cf; display: grid; place-items: center;
  font-size: 13px; color: transparent; transition: all 0.2s var(--ease-spring); transform: translateY(3px); }
.ing .name { flex: 1; }
.ing .amt { color: var(--muted); font-size: 14px; text-align: right; }
.ing.done .box { background: var(--mint-deep); border-color: var(--mint-deep); color: #fff; }
.ing.done .name { text-decoration: line-through; color: var(--muted); }
.extra { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--sky-soft); color: var(--sky-ink); font-size: 14px; }

.step { display: flex; gap: 12px; padding: 8px 10px; border-radius: 12px; cursor: pointer; transition: background 0.2s; }
.step:hover { background: #fff8f3; }
.step .num {
  width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #ffb592, #f0703f); color: #fff; font-family: var(--font-head); font-weight: 600; font-size: 14px;
  transition: transform 0.25s var(--ease-spring);
}
.step.done .num { background: var(--mint-deep); transform: scale(0.9); }
.step.done .txt { color: var(--muted); text-decoration: line-through; }
.tip { display: flex; gap: 10px; padding: 6px 10px; }
.tip .star { color: #f2a33a; }
.note { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-md); font-size: 14.5px; }
.note strong { display: block; font-family: var(--font-head); font-weight: 500; }
.note.safety { background: var(--lilac-soft); color: #3c3070; }
.reminder { margin: 12px 2px 0; font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------- favorites */
.fav-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.search {
  display: flex; align-items: center; gap: 8px; width: min(380px, 100%); padding: 0 16px; border-radius: 999px;
  background: var(--surface-solid); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm);
}
.search input { flex: 1; border: 0; outline: none; background: transparent; padding: 12px 0; }
.search:focus-within { border-color: var(--peach); box-shadow: 0 0 0 4px rgba(255, 154, 118, 0.18); }
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.fav {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; text-align: left;
  border-radius: var(--radius-lg); border: 1px solid #fbeee4; background: var(--surface-solid); box-shadow: var(--shadow-md);
  animation: cardUp 0.6s var(--ease-spring) both; transition: transform 0.25s var(--ease-out), box-shadow 0.25s;
}
.fav:hover { transform: translateY(-4px) rotate(-0.3deg); box-shadow: var(--shadow-lg); }
.fav-top { display: flex; gap: 12px; align-items: center; padding-right: 48px; }
.fav-emoji { width: 52px; height: 52px; flex: none; border-radius: 16px; display: grid; place-items: center; font-size: 28px; }
.fav.theme-0 .fav-emoji { background: var(--peach-soft); } .fav.theme-1 .fav-emoji { background: var(--mint-soft); } .fav.theme-2 .fav-emoji { background: var(--butter-soft); }
.fav-name { font-family: var(--font-head); font-weight: 600; font-size: 17px; line-height: 1.35; }
.fav-date { font-size: 13px; color: var(--muted); }
.fav-desc { margin: 0; color: var(--muted); font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fav-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.fav-pills .pill { background: #fbf3ec; }
.fav .heart { top: 16px; right: 16px; width: 44px; height: 44px; font-size: 19px; }
.fav-open { align-self: flex-start; border: 0; border-radius: 12px; padding: 8px 16px; background: var(--peach-soft); color: var(--peach-ink);
  font-family: var(--font-head); font-weight: 500; transition: background 0.2s, transform 0.2s var(--ease-spring); }
.fav-open:hover { background: #ffdccc; transform: translateX(2px); }
.fav.removing { animation: cardOut 0.35s ease-in both; }
@keyframes cardOut { to { opacity: 0; transform: scale(0.9) translateY(10px); } }

/* ----------------------------------------------------------------- modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(70, 40, 25, 0.35); backdrop-filter: blur(6px); animation: fade 0.3s both; }
.modal-sheet { position: relative; width: min(760px, 100%); max-height: calc(100vh - 48px); overflow: auto;
  border-radius: var(--radius-xl); animation: sheetIn 0.5s var(--ease-spring) both; scrollbar-width: thin; }
.modal-sheet .card { animation: none; box-shadow: none; }
.modal-sheet .card:hover { transform: none; }
.modal-close { position: sticky; top: 14px; float: right; margin: 14px 14px -60px 0; z-index: 2; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow-sm); font-size: 16px; }
.modal-sheet .heart { right: 66px; }
@keyframes fade { from { opacity: 0; } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(40px) scale(0.96); } }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 10px; justify-items: center; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 16px; background: #3b322c; color: #fff;
  box-shadow: var(--shadow-lg); font-size: 15px; animation: toastIn 0.45s var(--ease-spring) both;
}
.toast.error { background: #9f1d2a; }
.toast.ok { background: #1f6f5c; }
.toast button { border: 0; background: rgba(255, 255, 255, 0.18); color: #fff; padding: 4px 12px; border-radius: 10px; font-family: var(--font-head); }
.toast.out { animation: toastOut 0.3s ease-in both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(0.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .cta-row { position: static; margin: 24px 0 0; padding: 0; background: none; }
  .planner-grid { grid-template-columns: 1fr; }
  .form-panel { position: static; max-height: none; }
  .topbar { grid-template-columns: 1fr auto; }
  .status-pill { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ===================================================================
 * Web version additions (Daily Spark Lab) — mobile-first refinements
 * =================================================================== */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
html, body { height: auto; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { width: 100%; flex: 1; }
a { color: var(--peach-ink); }
.hint-muted { color: var(--muted); }
.span-all { grid-column: 1 / -1; }
.tab-short { display: none; }

.back-home {
  width: 40px; height: 40px; flex: none; border-radius: 14px; display: grid; place-items: center;
  text-decoration: none; font-size: 20px; color: var(--muted);
  background: rgba(255, 255, 255, 0.8); border: 1px solid var(--line);
  transition: transform 0.25s var(--ease-spring), color 0.2s;
}
.back-home:hover { color: var(--peach-ink); transform: translateX(-2px); }

.quota-note {
  margin: 12px 0 0; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; text-align: center;
  background: var(--mint-soft); color: var(--mint-ink);
}
.quota-note.empty-quota { background: var(--butter-soft); color: var(--butter-ink); }

.privacy-note { margin: 28px auto 0; max-width: 720px; text-align: center; font-size: 13.5px; color: var(--muted); }
.site-foot { padding: 18px 20px 26px; text-align: center; font-size: 13px; color: var(--muted); }
.site-foot a { color: var(--peach-ink); font-weight: 600; text-decoration: none; }

#resultsHead, .loader { scroll-margin-top: 96px; }

/* safety text must stay readable */
.disclaimer, .reminder { font-size: 13.5px; line-height: 1.65; color: #5f544c; }

/* comfortable touch targets (>= 44px) */
.seg { min-height: 44px; }
.chip-remove { min-width: 40px; min-height: 40px; }
.ing, .step { min-height: 44px; align-items: center; }

/* touch screens: no keyboard shortcut hint, no hover lift */
@media (hover: none) {
  .kbd-hint { display: none; }
  .card:hover, .fav:hover { transform: none; }
}

/* ------------------------------------------------------------ phone */
@media (max-width: 720px) {
  html { scroll-padding-top: 76px; }
  #resultsHead, .loader { scroll-margin-top: 76px; }
  .topbar {
    /* no backdrop-filter here: it would trap the fixed bottom tab bar inside the header */
    -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(255, 249, 243, 0.97);
    grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  }
  .brand { gap: 10px; min-width: 0; }
  .brand > div:last-child { min-width: 0; }
  .brand-logo { width: 40px; height: 40px; flex: none; border-radius: 14px; font-size: 22px; }
  .brand-name { font-size: 17px; }
  .brand-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .back-home { width: 44px; height: 44px; border-radius: 14px; font-size: 18px; }

  /* tabs become a floating bottom navigation bar (thumb reach) */
  .tabs {
    position: fixed; z-index: 30; left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(16px) saturate(1.4);
    box-shadow: 0 14px 36px -12px rgba(120, 60, 30, 0.35);
  }
  .tab { flex: 1; justify-content: center; padding: 12px 8px; font-size: 15px; min-height: 48px; }
  .tab-long { display: none; }
  .tab-short { display: inline; }

  main { padding: 18px 14px calc(104px + env(safe-area-inset-bottom)); }
  .site-foot { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(92px + env(safe-area-inset-bottom)); width: calc(100% - 24px); }
  .toast { width: 100%; justify-content: space-between; }

  .form-panel { padding: 20px 16px; border-radius: var(--radius-lg); }
  .hero-title { font-size: 24px; }
  .hero-sub { font-size: 15px; }
  .planner-grid { gap: 18px; }
  .cta-row { flex-direction: column; }
  .cta-row .btn-ghost { padding: 12px; }
  .input, .search input { font-size: 16px; }   /* >= 16px: iOS Safari does not zoom into the field */

  .results-title { font-size: 21px; }
  .cards { gap: 16px; }
  .card-title { font-size: 19px; }
  .fav-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .search { width: 100%; }

  /* recipe modal becomes a bottom sheet */
  .modal { padding: 0; place-items: end stretch; }
  .modal-sheet {
    width: 100%; max-height: 92dvh; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding-bottom: env(safe-area-inset-bottom); animation-name: sheetUp;
  }

  /* lighter background on phones (large blur filters are expensive) */
  .b3, .b4 { display: none; }
  .blob { filter: blur(40px); animation: none; }
  .b1 { width: 320px; height: 320px; }
  .b2 { width: 300px; height: 300px; }
}
@keyframes sheetUp { from { transform: translateY(100%); } }

@media (max-width: 380px) {
  .brand-sub { display: none; }
  .seg { font-size: 13px; padding: 9px 2px; }
}

