/* Mochi Kitchen - pastel Korean/Japanese "kawaii" look. Plum outlines, hard sticker shadows. */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600&family=Gamja+Flower&family=Jua&family=Zen+Maru+Gothic:wght@400;500;700&display=swap');

:root {
  --cream: #fff8f0;
  --paper: #ffffff;
  --ink: #4a3b47;
  --ink-soft: #75606f;
  --line: #4a3b47;

  --sakura: #ffd6e0;
  --sakura-deep: #ff8fb1;
  --matcha: #d6efc9;
  --matcha-deep: #6fae68;
  --lavender: #e8e0ff;
  --lavender-deep: #8f7fd0;
  --peach: #ffe6cc;
  --sky: #daf0ff;
  --butter: #fff3bd;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 4px 5px 0 rgba(74, 59, 71, 0.2);
  --shadow-lg: 6px 8px 0 rgba(74, 59, 71, 0.2);

  --font-body: 'Zen Maru Gothic', 'Malgun Gothic', 'Yu Gothic UI', 'Hiragino Maru Gothic ProN', system-ui, sans-serif;
  --font-head: 'Jua', 'Zen Maru Gothic', 'Malgun Gothic', 'Yu Gothic UI', system-ui, sans-serif;
  --font-hand: 'Gamja Flower', 'Jua', 'Malgun Gothic', cursive;
  --font-num: 'Fredoka', 'Zen Maru Gothic', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 20px 20px, rgba(255, 143, 177, 0.16) 3px, transparent 3.5px),
    radial-gradient(circle at 50px 50px, rgba(143, 127, 208, 0.12) 2.5px, transparent 3px);
  background-size: 60px 60px;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 400; line-height: 1.2; margin: 0 0 0.4em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3.4vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 0.8em; }
a { color: var(--lavender-deep); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--lavender-deep); outline-offset: 3px; border-radius: 10px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 12px; z-index: 100; }
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------ layout */
.shell { width: min(1120px, 100% - 32px); margin: 0 auto; padding-bottom: 110px; position: relative; z-index: 1; }

.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 0 10px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand .mochi { width: 52px; height: 52px; margin-bottom: -4px; }
.brand-name { font-family: var(--font-head); font-size: 1.6rem; line-height: 1; }
.brand-jp { display: block; font-family: var(--font-hand); font-size: 0.95rem; color: var(--ink-soft); letter-spacing: 0.08em; }

.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a, .nav button {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 0.95rem var(--font-body); color: var(--ink); text-decoration: none; cursor: pointer;
  background: var(--paper); border: 2.5px solid var(--line); border-radius: 999px; padding: 6px 14px;
  box-shadow: 2px 3px 0 rgba(74, 59, 71, 0.18); transition: transform 0.15s, background 0.15s;
}
.nav a:hover, .nav button:hover { transform: translateY(-2px) rotate(-1deg); background: var(--sakura); }
.nav a[aria-current='page'] { background: var(--sakura-deep); }
.nav svg { width: 20px; height: 20px; }

/* bottom tab bar on phones */
@media (max-width: 760px) {
  .topbar { justify-content: space-between; }
  .nav.main {
    position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 50; justify-content: space-around; gap: 2px;
    background: var(--paper); border: 2.5px solid var(--line); border-radius: 26px; padding: 6px; box-shadow: var(--shadow-lg);
  }
  .nav.main a { flex-direction: column; gap: 0; font-size: 0.7rem; border: 0; box-shadow: none; padding: 4px 6px; border-radius: 16px; background: transparent; }
  .nav.main a[aria-current='page'] { background: var(--sakura); }
  .brand .mochi { width: 44px; height: 44px; }
}

main, main:focus, main:focus-visible { outline: none; }
.page { animation: pop-in 0.35s ease both; }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.page-head { position: relative; margin: 10px 0 18px; padding: 8px 0; }
.page-head .doodles { position: absolute; top: 0; right: 0; width: min(380px, 50%); height: 100%; z-index: -1; opacity: 0.7; }
.page-head p { color: var(--ink-soft); max-width: 60ch; }
.hand { font-family: var(--font-hand); font-size: 1.25rem; color: var(--ink-soft); }

/* ------------------------------------------------------------ cards, buttons, chips */
.card {
  background: var(--paper); border: 3px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card.tinted { background: var(--sakura); }
.card.matcha { background: var(--matcha); }
.card.lav { background: var(--lavender); }
.card.butter { background: var(--butter); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  font: 700 1rem var(--font-body); color: var(--ink); text-decoration: none;
  background: var(--sakura-deep); border: 3px solid var(--line); border-radius: 999px; padding: 10px 22px;
  box-shadow: 3px 4px 0 rgba(74, 59, 71, 0.28); transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}
.btn:hover { transform: translate(-1px, -2px); box-shadow: 4px 6px 0 rgba(74, 59, 71, 0.28); }
.btn:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 rgba(74, 59, 71, 0.28); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--paper); }
.btn.green { background: var(--matcha-deep); color: #fff; text-shadow: 0 1px 0 rgba(74, 59, 71, 0.4); }
.btn.lav { background: var(--lavender-deep); color: #fff; text-shadow: 0 1px 0 rgba(74, 59, 71, 0.4); }
.btn.small { font-size: 0.88rem; padding: 6px 14px; }
.btn svg { width: 20px; height: 20px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: 500 0.92rem var(--font-body); color: var(--ink);
  background: var(--paper); border: 2.5px solid var(--line); border-radius: 999px; padding: 5px 14px;
  transition: transform 0.12s, background 0.15s;
}
.chip:hover { transform: translateY(-2px); background: var(--butter); }
.chip[aria-pressed='true'] { background: var(--matcha); box-shadow: inset 0 0 0 2px var(--matcha-deep); }
.chip svg { width: 18px; height: 18px; }
.chip.removable { background: var(--lavender); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper);
}
.badge svg { width: 15px; height: 15px; }
.badge.vegan { background: var(--matcha); }
.badge.veg { background: #e9f6d8; }
.badge.gf { background: var(--butter); }
.badge.ai { background: var(--lavender); }
.badge.kcal { background: var(--peach); }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; }
.input, select.input {
  font: 500 1rem var(--font-body); color: var(--ink); width: 100%;
  background: #fff; border: 3px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px;
}
.input::placeholder { color: #9b8a97; }
.hint { font-size: 0.85rem; color: var(--ink-soft); }
.error-text { color: #b3203f; font-weight: 700; font-size: 0.9rem; min-height: 1.2em; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 220px; }
.stack > * + * { margin-top: 14px; }
.muted { color: var(--ink-soft); }

/* ------------------------------------------------------------ search */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; margin: 6px 0 16px; }
.hero h1 .jp { display: block; font-family: var(--font-hand); font-size: 0.5em; color: var(--ink-soft); letter-spacing: 0.06em; }
.hero .mochi { width: clamp(110px, 20vw, 190px); height: auto; animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; } .hero .mochi { justify-self: center; order: -1; } }

.searchbox { padding: 14px; background: var(--paper); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tab {
  font: 700 0.95rem var(--font-body); color: var(--ink); cursor: pointer;
  border: 2.5px solid var(--line); border-radius: 999px; padding: 6px 16px; background: var(--paper);
}
.tab[aria-selected='true'] { background: var(--sakura-deep); box-shadow: 2px 3px 0 rgba(74, 59, 71, 0.25); }

.bubble-input { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.bubble-input .input { flex: 1 1 260px; font-size: 1.1rem; border-radius: 999px; padding: 12px 20px; }
.bubble-input .btn { flex: 0 0 auto; }

.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 12px; }
.filters .kcal { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; }
.filters input[type='range'] { accent-color: var(--sakura-deep); width: 150px; }
.provider { display: inline-flex; border: 3px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--paper); }
.provider button {
  font: 700 0.9rem var(--font-body); color: var(--ink); background: transparent; border: 0; padding: 6px 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.provider button svg { width: 18px; height: 18px; }
.provider button[aria-pressed='true'] { background: var(--lavender); box-shadow: inset 0 0 0 2px var(--lavender-deep); }
.provider button[disabled] { opacity: 0.5; cursor: not-allowed; }

.suggestions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

.notice { margin-top: 14px; display: flex; gap: 10px; align-items: center; padding: 10px 14px; border: 2.5px dashed var(--line); border-radius: var(--radius-sm); background: var(--butter); font-weight: 500; }
.understood { margin: 14px 0 4px; font-family: var(--font-hand); font-size: 1.25rem; }
.understood b { background: linear-gradient(transparent 58%, var(--sakura) 58%); padding: 0 3px; font-weight: 400; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 22px; margin-top: 14px; }

.recipe-card { position: relative; padding: 0; display: flex; flex-direction: column; transition: transform 0.18s; background: var(--paper); }
.recipe-card:nth-child(3n + 1) { transform: rotate(-0.8deg); }
.recipe-card:nth-child(3n + 2) { transform: rotate(0.6deg); }
.recipe-card:hover, .recipe-card:focus-within { transform: translateY(-5px) rotate(0); }
.recipe-card .art { position: relative; border-radius: calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0 0; overflow: hidden; border-bottom: 3px solid var(--line); aspect-ratio: 200 / 150; }
.recipe-card .art svg, .recipe-card .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-card .art img { position: absolute; inset: 0; }
.tape {
  position: absolute; top: -9px; left: 50%; width: 84px; height: 22px; transform: translateX(-50%) rotate(-3deg);
  background: repeating-linear-gradient(45deg, rgba(255, 143, 177, 0.75) 0 7px, rgba(255, 255, 255, 0.6) 7px 14px);
  border: 2px solid rgba(74, 59, 71, 0.35); z-index: 3; border-radius: 3px;
}
.recipe-card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.recipe-card h3 { margin: 0; font-size: 1.12rem; }
.recipe-card h3 a { color: var(--ink); text-decoration: none; }
.recipe-card h3 a::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.recipe-card .meta { font-size: 0.85rem; color: var(--ink-soft); }
.recipe-card .actions { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; z-index: 2; }

.heart {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; cursor: pointer;
  border: 2.5px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink);
  box-shadow: 2px 3px 0 rgba(74, 59, 71, 0.2); transition: transform 0.15s, background 0.15s;
}
.heart:hover { transform: scale(1.1) rotate(-6deg); }
.heart[aria-pressed='true'] { background: var(--sakura-deep); animation: heart-pop 0.35s; }
@keyframes heart-pop { 40% { transform: scale(1.3); } }

.pick { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 700; cursor: pointer; }
.pick input, .check input { width: 20px; height: 20px; accent-color: var(--matcha-deep); cursor: pointer; }

.cart-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 20px;
  background: var(--paper); border: 3px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-lg);
  animation: pop-in 0.25s;
}
@media (max-width: 760px) { .cart-bar { bottom: 88px; width: calc(100% - 24px); justify-content: space-between; } }

/* ------------------------------------------------------------ empty / loading */
.empty { text-align: center; padding: 30px 16px; }
.empty .mochi { width: 130px; height: 130px; }
.empty h3 { margin-top: 6px; }
.loading { text-align: center; padding: 24px; }
.loading .mochi { width: 110px; height: 110px; animation: bob 1.1s ease-in-out infinite; }
.dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* ------------------------------------------------------------ recipe page */
.recipe-hero { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .recipe-hero { grid-template-columns: 1fr; } }
.recipe-hero .art { border: 3px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); position: relative; aspect-ratio: 4 / 3; }
.recipe-hero .art svg, .recipe-hero .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-hero .art img { position: absolute; inset: 0; }
.two-col { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 22px; margin-top: 22px; align-items: start; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }

.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 2px dotted rgba(74, 59, 71, 0.3); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients .qty { font-family: var(--font-num); color: var(--ink-soft); white-space: nowrap; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps li { counter-increment: step; position: relative; padding: 4px 0 14px 54px; min-height: 46px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 38px; height: 38px; display: grid; place-items: center;
  font-family: var(--font-head); font-size: 1.1rem; background: var(--sakura); border: 2.5px solid var(--line); border-radius: 50%;
}

.drink { display: flex; gap: 14px; align-items: center; }
.drink img { width: 84px; height: 84px; border-radius: 18px; border: 3px solid var(--line); object-fit: cover; }

/* ------------------------------------------------------------ lists / pantry / planner */
.check { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 2px dotted rgba(74, 59, 71, 0.3); cursor: pointer; }
.check:last-child { border-bottom: 0; }
.check .what { flex: 1; }
.check input:checked ~ .what { text-decoration: line-through; opacity: 0.55; }
.check .amount { font-family: var(--font-num); color: var(--ink-soft); }
.aisle { font-family: var(--font-head); font-size: 1.1rem; margin: 18px 0 4px; display: flex; align-items: center; gap: 8px; text-transform: capitalize; }
.aisle::before { content: ''; width: 14px; height: 14px; background: var(--sakura-deep); border: 2.5px solid var(--line); border-radius: 50%; }
.progress { height: 18px; border: 3px solid var(--line); border-radius: 999px; background: #fff; overflow: hidden; }
.progress > span { display: block; height: 100%; background: repeating-linear-gradient(45deg, var(--matcha-deep) 0 10px, #8cc984 10px 20px); transition: width 0.3s; }

.coverage { display: flex; align-items: center; gap: 10px; }
.coverage .progress { flex: 1; height: 14px; }
.missing { display: flex; flex-wrap: wrap; gap: 6px; }
.missing .chip { cursor: default; font-size: 0.8rem; padding: 2px 10px; }
.missing .chip:hover { transform: none; background: var(--paper); }

.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-top: 16px; }
.day-card { padding: 14px; }
.day-card h3 { display: flex; align-items: center; justify-content: space-between; }
.day-card .note { font-family: var(--font-hand); font-size: 1.1rem; color: var(--ink-soft); margin: 4px 0 10px; }
.meal { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 6px; border-radius: 14px; border: 2.5px solid transparent; }
.meal:hover { border-color: var(--line); background: var(--butter); }
.meal .thumb { flex: 0 0 64px; width: 64px; height: 50px; border: 2.5px solid var(--line); border-radius: 12px; overflow: hidden; position: relative; }
.meal .thumb svg, .meal .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meal .thumb img { position: absolute; inset: 0; }
.meal small { display: block; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.7rem; }

.list-row { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
.list-row + .list-row { margin-top: 14px; }

.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: center; max-width: 880px; margin: 14px auto; }
@media (max-width: 760px) { .auth-grid { grid-template-columns: 1fr; } }
.auth-art { text-align: center; }
.auth-art .mochi { width: min(260px, 70%); height: auto; animation: bob 3.2s ease-in-out infinite; }

/* ------------------------------------------------------------ toast + petals */
.toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100% - 24px)); }
.toast {
  background: var(--paper); border: 3px solid var(--line); border-radius: 18px; padding: 10px 16px; box-shadow: var(--shadow);
  font-weight: 700; animation: pop-in 0.25s; display: flex; align-items: center; gap: 10px;
}
.toast.ok { background: var(--matcha); }
.toast.bad { background: var(--sakura); }

.petals { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.petals svg { position: absolute; top: -30px; width: 18px; height: 18px; opacity: 0.75; animation: fall linear infinite; }
@keyframes fall { to { transform: translate(60px, 105vh) rotate(420deg); } }

footer.foot { text-align: center; padding: 30px 0 10px; color: var(--ink-soft); font-family: var(--font-hand); font-size: 1.15rem; position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .petals { display: none; }
}
