/* ============================================================
   REDISH — Design System  (레퍼런스 GUI 기반)
   폰트 Kkukkukk · 종이 #fbfaf3 · 레드 #f35a42 · 파스텔 단백질 톤
   ============================================================ */

@font-face {
  font-family: "Kkukkukk";
  src: url("./assets/fonts/MemomentKkukkukk.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #050505;
  --muted: #515151;
  --paper: #fbfaf3;
  --paper-2: #ece8dd;
  --red: #f35a42;
  --red-deep: #f0522d;
  --blue: #a9c3e8;
  --lavender: #c9bfff;
  --pink: #efbed7;
  --yellow: #f2ef56;
  --green: #71b394;
  --brown: #bd806f;
  --shadow: 0 16px 36px rgba(0, 0, 0, .08);
  --sys: "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Kkukkukk", "Apple SD Gothic Neo", "Pretendard", system-ui, sans-serif;
  color: var(--ink);
  background: #e9e6dc;
}

button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* ---------- App frame (mobile) ---------- */
.app {
  position: relative;
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ---------- View router ---------- */
.view {
  display: none;
  min-height: 100vh;
  padding: 30px 28px 120px;
  animation: viewin .32s ease both;
}
.view.is-active { display: block; }
@keyframes viewin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* tab screens leave room for the tab bar */
.view--tab { padding-bottom: 108px; }
.view--cook { padding: 24px 24px 40px; background: var(--paper); }

/* ============================================================
   Mascot (레퍼런스 SVG) — 클래스에 SVG를 JS로 주입
   ============================================================ */
.radish-mascot { width: 116px; height: 122px; display: block; margin: 0 auto; }
.radish-mascot--lg { width: 150px; height: 158px; }
.radish-mascot svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* ---------- Speech bubble ---------- */
.speech-bubble {
  position: relative;
  width: min(330px, 100%);
  margin: 0 auto;
  padding: 16px 18px;
  border-radius: 28px;
  background: #fff;
  color: #000;
  text-align: center;
  font-size: 15px;
  line-height: 1.45;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .08);
}
.speech-bubble::before {
  content: "";
  position: absolute;
  left: 50%; top: -12px;
  width: 26px; height: 22px;
  background: #fff;
  border-radius: 4px 0 16px 0;
  transform: translateX(-50%) rotate(45deg);
}

/* ---------- Brand / logo ---------- */
.brand-logo { font-size: 16px; letter-spacing: .5px; color: var(--red); }
.red-word { color: var(--red); }

/* ============================================================
   A1 스플래시
   ============================================================ */
.view--splash { display: none; }
.view--splash.is-active { display: grid; }
.view--splash {
  place-items: center;
  background: var(--paper);
  text-align: center;
  cursor: pointer;
}
.splash-inner { display: grid; justify-items: center; gap: 14px; padding-bottom: 40px; }
.splash-inner .radish-mascot { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.splash-logo { margin: 4px 0 0; font-size: 56px; line-height: 1; font-weight: 400; }
.splash-logo .red-word { color: var(--red); }
.splash-tagline { margin: 2px 0 4px; font-family: var(--sys); font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #9a938c; }
.splash-copy { margin: 0; font-size: 17px; color: var(--muted); line-height: 1.55; }
.splash-hint { margin: 18px 0 0; font-size: 13px; color: rgba(0,0,0,.35); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

/* ============================================================
   A3 아이 유무 · 온보딩 공통
   ============================================================ */
/* A3 헤더: 타이틀 좌 + 마스코트 우 */
.onb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.onb-title { margin: 0; font-size: clamp(30px, 8.5vw, 40px); line-height: 1.08; font-weight: 400; text-wrap: balance; }
.onb-head .radish-mascot { width: 86px; height: 92px; flex: 0 0 auto; margin: 0; }

.onb-field { margin-top: 26px; }
.onb-field .onb-label { margin: 0 0 12px; font-size: 18px; }
.onb-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.onb-row .onb-label { margin: 0; }

/* YES / NO 세그먼트 토글 */
.seg-toggle { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--paper-2); border-radius: 999px; }
.seg-toggle .seg { border: 0; background: transparent; padding: 9px 24px; border-radius: 999px; font-size: 15px; color: var(--muted); cursor: pointer; transition: .14s ease; }
.seg-toggle .seg.on { background: #000; color: #fff; }

/* 가족 구성원 스테퍼 */
.member-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: #fff; border-radius: 20px; box-shadow: 0 6px 16px rgba(0,0,0,.05); }
.stepper-name { font-size: 16px; }
.stepper-ctrl { display: inline-flex; align-items: center; gap: 8px; }
.step-btn { width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--paper-2); font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.step-btn:hover { background: #e2ddce; }
.stepper-count { min-width: 18px; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; }

/* 맵기 1×4 직렬 리스트 (채도 점증) */
.spice-list-onb { display: grid; gap: 10px; }
.spice-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border: 2px solid transparent; border-radius: 20px;
  cursor: pointer; text-align: left; box-shadow: 0 6px 16px rgba(0,0,0,.05);
  transition: transform .14s ease, border-color .14s ease;
}
.spice-row:hover { transform: translateY(-2px); }
.spice-row.selected { border-color: #000; }
.spice-row[data-spice="no"]   { background: #ffffff; }
.spice-row[data-spice="yes"]  { background: #f8ccc0; }
.spice-row[data-spice="hot"]  { background: #f0836e; }
.spice-row[data-spice="both"] { background: linear-gradient(90deg, #ffffff 0%, #f6b6a6 50%, #f4e6a0 100%); background-clip: padding-box; }
.spice-row-key { display: inline-flex; align-items: center; gap: 5px; font-size: 18px; font-weight: 700; letter-spacing: .03em; min-width: 62px; }
.spice-row-key svg { display: block; }
.spice-row-desc { font-family: var(--sys); font-size: 13px; color: #3a3a3a; }

.onb-next { width: 100%; margin-top: 30px; }

/* ============================================================
   A4 / D1  단백질 선택 (레퍼런스)
   ============================================================ */
.hero { margin: 0; text-align: left; }
h1 {
  margin: 8px auto 0; max-width: 350px;
  font-size: clamp(38px, 11vw, 54px);
  line-height: .92; letter-spacing: 0; text-wrap: balance;
  color: var(--ink); font-weight: 400;
}
.mark { display: inline-block; color: var(--ink); }
.mascot-zone { display: grid; justify-items: center; gap: 12px; margin: 24px auto 0; }

.protein-wrap { margin-top: 16px; }
.protein-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.protein-card {
  position: relative; min-height: 90px;
  border: 0; border-radius: 24px;
  background: var(--tone); box-shadow: none; cursor: pointer;
  transform: translateY(0); overflow: hidden;
  transition: transform .16s ease, filter .16s ease, opacity .16s ease, box-shadow .16s ease;
}
.protein-card:hover { transform: translateY(-2px); }
.protein-card.selected {
  transform: translateY(-7px);
  filter: saturate(1.08) contrast(1.04);
  box-shadow: 0 22px 38px rgba(0,0,0,.24), 0 8px 14px rgba(0,0,0,.15);
}
.protein-card.was-last::after {
  content: "지난주";
  position: absolute; left: 13px; top: 13px; z-index: 2;
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff;
}
.protein-card.selected .check { opacity: 1; transform: scale(1); }
.protein-inner {
  position: relative; z-index: 1; height: 100%;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  padding: 14px 15px 12px;
}
.protein-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-top: auto; }
.protein-icon svg { width: 100%; height: 100%; display: block; overflow: visible; }
.protein-name { font-size: 18px; line-height: 1.05; color: #000; }
.check {
  position: absolute; right: 13px; bottom: 13px; z-index: 2;
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 0; border-radius: 999px; background: #000; color: #fff;
  opacity: 0; transform: scale(.6); transition: .16s ease;
}

/* ---------- action row / buttons ---------- */
.action-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; flex-wrap: nowrap; }
.action-row .make-btn { width: 166px; min-width: 166px; }
.make-btn, .reset-btn { border: 0; border-radius: 999px; padding: 12px 16px; cursor: pointer; transition: transform .12s ease, opacity .12s ease; }
.make-btn { background: #000; color: #fff; }
.make-btn:disabled { opacity: .45; cursor: not-allowed; }
.reset-btn { background: var(--paper-2); color: #000; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; padding: 0; font-size: 20px; line-height: 1; }
.counter { width: 78px; min-width: 78px; border: 0; border-radius: 999px; padding: 12px 0; background: var(--paper-2); color: #000; text-align: center; }
.make-btn:not(:disabled):hover, .reset-btn:hover { transform: translateY(-3px); }

.empty { display: none; margin-top: 18px; border-radius: 24px; padding: 14px; background: #fff; text-align: center; font-size: 14px; color: var(--muted); }
.empty.visible { display: block; }

.d1-note { margin: 12px auto 0; max-width: 340px; font-size: 14px; color: var(--muted); }

/* ---------- toggle switch ---------- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; font-size: 16px; }
.toggle-row--card { margin-top: 12px; padding: 16px 18px; background: #fff; border-radius: 22px; box-shadow: 0 6px 18px rgba(0,0,0,.05); }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.slider { position: absolute; inset: 0; background: #d9d4c6; border-radius: 999px; transition: .2s; }
.slider::before { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 2px 5px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--red); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ============================================================
   App bar (탭 화면 상단)
   ============================================================ */
.app-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.app-bar--back { gap: 8px; }
.app-bar-title { font-size: 18px; }
.app-bar-spacer, .cook-back--inline { width: 32px; }
.gear-btn { border: 0; background: transparent; font-size: 22px; cursor: pointer; padding: 4px; }
.app-bar-tools { display: flex; gap: 6px; }
.tool-btn { width: 40px; height: 40px; border: 0; border-radius: 999px; background: var(--paper-2); font-size: 19px; cursor: pointer; display: grid; place-items: center; }
.tool-btn:hover { transform: translateY(-2px); }

/* ============================================================
   B1 오늘 (홈)
   ============================================================ */
.today-eyebrow { margin: 22px 0 10px; font-size: 15px; color: var(--muted); }
.today-card {
  position: relative; border-radius: 34px; padding: 26px 24px 24px;
  background: var(--tone, #f2a095); box-shadow: var(--shadow); overflow: hidden;
  min-height: 220px; display: flex; flex-direction: column; justify-content: space-between;
}
.today-sticker { width: 92px; height: 92px; align-self: flex-end; }
.today-sticker svg { width: 100%; height: 100%; }
.today-name { font-size: 30px; line-height: 1.1; color: #000; margin-top: 6px; }
.today-meta { margin-top: 8px; font-size: 14px; color: rgba(0,0,0,.6); }
.today-badges { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 5px 11px; border-radius: 999px; background: rgba(0,0,0,.14); color: #000; }
.badge--kid { background: rgba(255,255,255,.7); }
.today-actions { display: grid; gap: 10px; margin-top: 22px; }
.cta-primary { border: 0; border-radius: 999px; padding: 17px; background: #000; color: #fff; font-size: 18px; cursor: pointer; transition: transform .12s ease; }
.cta-primary:hover { transform: translateY(-2px); }
.cta-ghost { border: 0; border-radius: 999px; padding: 15px; background: var(--paper-2); color: #000; font-size: 15px; cursor: pointer; }
.cta-ghost:hover { transform: translateY(-2px); }

/* ============================================================
   B2 식단 보드 (레퍼런스 스케줄)
   ============================================================ */
.results { margin-top: 10px; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 0 14px; }
.result-title { margin: 0; font-size: 34px; line-height: .95; color: #000; }
.remake-icon { flex: 0 0 auto; width: 42px; height: 42px; border: 0; border-radius: 999px; background: var(--paper-2); color: #000; font-size: 20px; cursor: pointer; display: grid; place-items: center; transition: transform .12s ease; }
.remake-icon:hover { transform: translateY(-2px) rotate(-40deg); }
.next-week-btn { width: 100%; margin-top: 22px; }
.result-actions { display: flex; align-items: center; gap: 7px; }
.selected-tags { display: flex; flex-wrap: nowrap; gap: 6px; justify-content: flex-end; color: rgba(0,0,0,.58); font-size: 12px; white-space: nowrap; }
.tag { padding: 0; }

.schedule { display: grid; grid-template-columns: 1fr; gap: 6px; }
/* 로그인 전: 수요일 카드부터 서서히 흰색으로 페이드 (아래 더 있음 암시) */
.schedule.sched-locked {
  -webkit-mask: linear-gradient(180deg, #000 0%, #000 50%, transparent 100%);
  mask: linear-gradient(180deg, #000 0%, #000 50%, transparent 100%);
}
/* 슬롯: 스와이프 컨테이너 */
.day-slot { position: relative; overflow: hidden; border-bottom: 1px solid #efe9dc; }
.schedule .day-slot:last-child { border-bottom: 0; }
.swap-behind { position: absolute; top: 0; right: 0; bottom: 0; width: 88px; border: 0; background: var(--red); color: #fff; font-family: var(--sys); font-size: 12px; line-height: 1.25; text-align: center; cursor: pointer; }
.day-row { position: relative; z-index: 1; display: flex; align-items: center; gap: 4px; background: var(--paper); transition: transform .18s ease; touch-action: pan-y; }
.day-row.no-anim { transition: none; }
.day-row.swiped { transform: translateX(-88px); }
.drag-handle { flex: 0 0 auto; width: 22px; margin-left: 4px; text-align: center; color: #cfc8b8; font-size: 17px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.day-slot.dragging { position: relative; z-index: 6; }

/* 메뉴 교체: 아이콘이 반짝이며 바뀌는 모션 */
@keyframes iconSwap {
  0%   { transform: rotate(5deg) scale(1); }
  30%  { transform: rotate(-10deg) scale(.55); opacity: .35; }
  55%  { transform: rotate(7deg) scale(1.22); opacity: 1; }
  100% { transform: rotate(5deg) scale(1); }
}
@keyframes sparkleBurst {
  0%   { opacity: 0; transform: translateX(-50%) scale(.3) rotate(-20deg); }
  40%  { opacity: 1; transform: translateX(-50%) scale(1.15) rotate(12deg); }
  100% { opacity: 0; transform: translateX(-50%) scale(.85) rotate(-8deg); }
}
.food-sticker.sparkle .meal-protein-icon { animation: iconSwap .5s ease; }
.food-sticker.sparkle::after {
  content: "✨"; position: absolute; left: 50%; top: -8px; z-index: 3;
  font-size: 20px; pointer-events: none; animation: sparkleBurst .6s ease forwards;
}
.day-slot.dragging .day-row { background: #fff; box-shadow: 0 12px 26px rgba(0,0,0,.16); border-radius: 14px; transition: none; }

.day-card {
  flex: 1; min-width: 0;
  display: grid; grid-template-columns: 34px 54px minmax(0, 1fr); align-items: center; gap: 10px;
  border: 0; background: transparent; padding: 12px 4px 12px 0; color: #000; text-align: left; cursor: pointer; font: inherit;
}

/* 요일 강조 */
.day-when { display: grid; justify-items: center; gap: 2px; }
.day-when .wd { font-size: 25px; line-height: 1; }
.day-when .md { font-family: var(--sys); font-size: 10px; color: var(--muted); }

/* 음식 스티커 (보드용 정적 배치) */
.food-sticker { position: relative; width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto; }
.food-sticker::before { content: ""; position: absolute; width: 54px; height: 42px; border-radius: 50%; background: var(--card-tone); filter: drop-shadow(0 8px 10px rgba(0,0,0,.14)); transform: rotate(-8deg); }
.food-sticker .meal-protein-icon { position: relative; z-index: 1; width: 40px; height: 40px; transform: rotate(5deg); }

.day-body { min-width: 0; }
.day-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meal-protein-icon { width: 32px; height: 32px; flex: 0 0 auto; }
.meal-protein-icon svg { width: 100%; height: 100%; display: block; }
.meal-name { font-size: 17px; line-height: 1.25; color: #000; }
.meal-meta { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* 맵기 배지 (no/yes/hot) */
.spice-badge { font-family: var(--sys); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .04em; white-space: nowrap; }
.spice-badge--no  { background: #efeae0; color: #6a6a6a; }
.spice-badge--yes { background: #f8ccc0; color: #8f3b2a; }
.spice-badge--hot { background: #f0836e; color: #fff; }

/* both: 매운 변형 안내 (한 줄 고정) */
.both-tip { margin-top: 4px; font-family: var(--sys); font-size: 12px; color: var(--red); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.both-tip b { font-weight: 700; }

/* 보드 안내 문구 */
.board-hint { margin: -12px 0 14px; font-family: var(--sys); font-size: 12px; color: var(--muted); }

/* B2 잠금: 3일치 후 블러 + 로그인 게이트 */
.lock-zone { position: relative; margin-top: 4px; }
.lock-blur {
  display: grid; gap: 12px; filter: blur(5px); opacity: .5; pointer-events: none;
  -webkit-mask: linear-gradient(180deg, #000 0%, rgba(0,0,0,.25) 55%, transparent 100%);
  mask: linear-gradient(180deg, #000 0%, rgba(0,0,0,.25) 55%, transparent 100%);
}
.lock-gate { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px; }
.lock-msg { margin: 0; font-size: 15px; color: var(--muted); text-align: center; line-height: 1.5; background: rgba(251,250,243,.72); padding: 6px 14px; border-radius: 12px; }
.lock-gate .cta-primary { width: auto; padding: 16px 30px; }

/* ============================================================
   B3 장보기 (영수증)
   ============================================================ */
.receipt {
  margin-top: 16px; background: #fff; border-radius: 6px;
  padding: 26px 22px 30px;
  box-shadow: 0 14px 30px rgba(0,0,0,.08);
  position: relative;
  --notch: 10px;
  -webkit-mask:
    radial-gradient(var(--notch) at var(--notch) 0, transparent 98%, #000) 0 0/22px 100% repeat-x,
    radial-gradient(var(--notch) at var(--notch) 100%, transparent 98%, #000) 0 100%/22px 100% repeat-x;
}
.receipt-logo { font-size: 26px; text-align: center; letter-spacing: 1px; }
.receipt-sub { text-align: center; font-family: var(--sys); font-size: 12px; color: var(--muted); margin-top: 4px; }
.receipt-rule { border-top: 2px dashed #d9d4c6; margin: 16px 0; }
.receipt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.receipt-item {
  display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px;
  padding: 9px 4px; border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer;
  font-family: var(--sys); font-size: 15px; border-bottom: 1px dotted #e7e2d5;
}
.receipt-item:hover { background: #faf7ee; }
.receipt-check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #cfc9b8; display: grid; place-items: center; font-size: 13px; color: #fff; }
.receipt-item.checked .receipt-check { background: var(--red); border-color: var(--red); }
.receipt-item.checked .receipt-name { text-decoration: line-through; color: rgba(0,0,0,.35); }
.receipt-name { font-family: var(--sys); }
.receipt-qty { font-family: var(--sys); font-size: 12px; color: var(--muted); }
.receipt-cart { font-size: 15px; opacity: .5; }
.receipt-foot { display: flex; justify-content: space-between; font-family: var(--sys); font-size: 12px; color: var(--muted); }
.receipt-barcode { height: 46px; margin: 20px 0 8px; background: repeating-linear-gradient(90deg, #111 0 2px, #fff 2px 4px, #111 4px 7px, #fff 7px 9px, #111 9px 12px, #fff 12px 16px); border-radius: 2px; }
.receipt-tip { text-align: center; font-family: var(--sys); font-size: 11px; color: rgba(0,0,0,.4); margin: 4px 0 0; }

/* ============================================================
   C 쿠킹모드
   ============================================================ */
.view--cook { display: none; }
.view--cook.is-active { display: flex; flex-direction: column; }
.cook-back { position: absolute; top: 22px; right: 22px; z-index: 5; width: 40px; height: 40px; border: 0; border-radius: 999px; background: rgba(0,0,0,.06); font-size: 18px; cursor: pointer; }
.cook-back--dark { right: auto; left: 22px; background: rgba(0,0,0,.06); }
.cook-back--inline { position: static; background: transparent; font-size: 26px; height: auto; width: 32px; }

/* 작은 회색 뒤로가기 (겹침 방지, 좌상단 in-flow) */
.topbar-back { display: flex; align-items: center; height: 34px; margin: -6px 0 4px -6px; }
.back-chevron { border: 0; background: transparent; color: #b3aca0; cursor: pointer; padding: 6px; display: grid; place-items: center; }
.back-chevron:hover { color: #8a8378; }
.back-chevron svg { display: block; }
.cook-topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.cook-topbar .cook-back { position: static; }
.cook-progress { flex: 1; display: flex; gap: 5px; }
.cook-progress .seg { flex: 1; height: 5px; border-radius: 999px; background: #e5e0d2; }
.cook-progress .seg.done { background: var(--red); }

.cook-c1 { padding-top: 40px; display: flex; flex-direction: column; min-height: 80vh; }
.cook-kicker { font-family: var(--sys); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--red); margin: 0; }
.cook-title { font-size: 34px; margin: 8px 0 24px; font-weight: 400; }
.prep-list { list-style: none; margin: 0 0 auto; padding: 0; display: grid; gap: 10px; }
.prep-list li { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: #fff; border-radius: 20px; font-size: 18px; box-shadow: 0 6px 16px rgba(0,0,0,.05); }
.prep-list li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--red); flex: 0 0 auto; }
.cook-next { margin-top: 28px; }

/* C2 단계 */
.cook-step { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 16px; }
.step-index { font-family: var(--sys); font-size: 13px; color: var(--muted); }
.step-title { font-size: clamp(30px, 9vw, 44px); line-height: 1.12; font-weight: 400; margin: 0; }
.step-body { font-size: 18px; color: var(--muted); line-height: 1.55; margin: 0 auto; max-width: 320px; }
.cook-step.step--kid { }
.step-kid-flag { display: inline-flex; align-items: center; gap: 8px; align-self: center; padding: 8px 16px; border-radius: 999px; background: #fff4d6; color: #8a5a00; font-size: 15px; }
.cook-step.step--kid .step-title { color: var(--red); }

/* 타이머 */
.timer { display: grid; justify-items: center; gap: 16px; margin-top: 8px; }
.timer-clock { font-size: 60px; font-variant-numeric: tabular-nums; letter-spacing: 2px; }
.timer-ring { --p: 0; width: 168px; height: 168px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--red) calc(var(--p) * 1%), #eae5d6 0); }
.timer-ring .inner { width: 140px; height: 140px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; }
.timer-btns { display: flex; gap: 10px; }
.timer-btn { border: 0; border-radius: 999px; padding: 11px 22px; background: var(--paper-2); font-size: 15px; cursor: pointer; }
.timer-btn.run { background: var(--red); color: #fff; }

.cook-nav { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 24px; align-items: center; }
.cook-prev { border: 0; border-radius: 999px; padding: 17px 22px; background: var(--paper-2); font-size: 16px; cursor: pointer; }
.cook-prev:disabled { opacity: .4; cursor: default; }

/* C4 완료 */
.view--done.is-active { justify-content: center; align-items: center; text-align: center; background: var(--paper); }
.done-inner { display: grid; justify-items: center; gap: 12px; }
.done-inner .radish-mascot { animation: bob 2.4s ease-in-out infinite; }
.done-title { font-size: 40px; margin: 12px 0 0; font-weight: 400; }
.done-sub { margin: 0; font-size: 16px; color: var(--muted); }
.done-inner .cta-primary { margin-top: 22px; width: 220px; }

/* ============================================================
   D3 메뉴 상세
   ============================================================ */
/* 뒤로가기 바 (겹침·안보임 문제 해결) */
.detail-bar { display: flex; align-items: center; height: 44px; margin-bottom: 4px; }
.icon-back { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--paper-2); color: #000; cursor: pointer; display: grid; place-items: center; }
.icon-back:hover { background: #e2ddce; }
.icon-back svg { display: block; }

.detail { padding-top: 2px; }
.detail-hero { border-radius: 34px; padding: 34px 24px; background: var(--tone, #f2a095); display: grid; justify-items: center; gap: 10px; box-shadow: var(--shadow); }
.detail-hero .food-sticker { position: static; transform: none; width: 96px; height: 96px; }
.detail-hero .food-sticker::before { width: 84px; height: 66px; }
.detail-hero .meal-protein-icon { width: 64px; height: 64px; }
.detail-name { font-size: 30px; text-align: center; margin: 18px 0 4px; }
.detail-meta { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.detail-h { font-size: 15px; color: var(--muted); margin: 20px 0 8px; }
.detail-ing { display: flex; flex-wrap: wrap; gap: 8px; }
.ing-chip { font-family: var(--sys); font-size: 14px; padding: 8px 14px; border-radius: 999px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.05); }
.detail-note { font-size: 15px; line-height: 1.6; color: #333; background: #fff; border-radius: 20px; padding: 16px 18px; }
.detail-note .batch { display: block; margin-top: 10px; color: var(--red); }

/* 조리 과정 (상세) */
.cook-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.cook-step-item { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; }
.cs-no { width: 26px; height: 26px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font-family: var(--sys); font-size: 13px; font-weight: 700; }
.cs-text { display: grid; gap: 3px; }
.cs-text b { font-size: 16px; font-weight: 700; }
.cs-text > span { font-family: var(--sys); font-size: 13px; color: var(--muted); line-height: 1.5; }
.cs-timer { color: var(--red); }
.cook-step-item.is-spicy .cs-no { background: var(--red); color: #fff; }
.cook-step-item.is-spicy .cs-text b,
.cook-step-item.is-spicy .cs-text > span { color: var(--red); }

/* 재료 하단 알림 */
.ing-note { margin: 8px 0 0; font-family: var(--sys); font-size: 12px; color: var(--muted); }

/* 하단 버튼 */
.detail-cook { width: 100%; margin-top: 28px; }
.text-btn { display: block; width: 100%; margin-top: 12px; border: 0; background: transparent; color: var(--muted); font-size: 14px; text-decoration: underline; cursor: pointer; }
.text-btn:hover { color: var(--ink); }

/* ============================================================
   E1 설정
   ============================================================ */
.setting-block { margin-top: 26px; }
.setting-h { font-size: 15px; color: var(--muted); margin: 0 0 4px; }
.setting-desc { font-size: 13px; color: rgba(0,0,0,.45); margin: 0 0 12px; }
.spice-list { display: grid; gap: 10px; margin-top: 12px; }
.spice-opt { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 16px 18px; background: #fff; border: 2px solid transparent; border-radius: 22px; cursor: pointer; text-align: left; box-shadow: 0 6px 18px rgba(0,0,0,.05); }
.spice-opt.active { border-color: var(--red); }
.spice-key { font-family: var(--sys); font-size: 12px; font-weight: 700; color: var(--red); text-transform: uppercase; width: 40px; }
.spice-main { display: grid; gap: 2px; }
.spice-label { font-size: 17px; }
.spice-desc { font-family: var(--sys); font-size: 12px; color: var(--muted); }
.spice-radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cfc9b8; display: grid; place-items: center; }
.spice-opt.active .spice-radio { border-color: var(--red); }
.spice-opt.active .spice-radio::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--red); }
.ghost-link { margin: 30px auto 0; display: block; border: 0; background: transparent; color: var(--muted); font-size: 14px; text-decoration: underline; cursor: pointer; }

/* ============================================================
   E2 푸시 (잠금화면 목업)
   ============================================================ */
.view--lock { display: none; }
.view--lock.is-active { display: flex; flex-direction: column; align-items: center; }
.view--lock {
  background: linear-gradient(180deg, #2a2622 0%, #4a4038 100%);
  color: #fff; padding-top: 90px;
}
.lock-time { text-align: center; margin-bottom: 60px; }
.lock-clock { font-size: 78px; font-weight: 400; line-height: 1; }
.lock-date { font-family: var(--sys); font-size: 15px; opacity: .8; margin-top: 6px; }
.push-card { width: 100%; text-align: left; border: 0; border-radius: 22px; padding: 16px 18px; background: rgba(255,255,255,.16); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); cursor: pointer; color: #fff; transition: transform .14s ease; }
.push-card:hover { transform: scale(1.02); }
.push-head { display: flex; justify-content: space-between; font-family: var(--sys); font-size: 12px; opacity: .85; margin-bottom: 6px; }
.push-app { display: flex; align-items: center; gap: 6px; }
.push-title { font-size: 18px; margin-bottom: 4px; }
.push-body { font-family: var(--sys); font-size: 13px; opacity: .9; line-height: 1.4; }
.lock-hint { margin-top: 22px; font-family: var(--sys); font-size: 12px; opacity: .6; }

/* ============================================================
   하단 탭 바
   ============================================================ */
.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(430px, 100%); z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(251,250,243,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #e7e2d5;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
}
.tabbar[hidden] { display: none; }   /* display:grid 가 [hidden]을 덮어쓰던 버그 수정 */
.tab { display: grid; justify-items: center; gap: 3px; border: 0; background: transparent; padding: 8px 0; cursor: pointer; color: rgba(0,0,0,.4); }
.tab-ico { font-size: 22px; filter: grayscale(1) opacity(.6); transition: .16s; }
.tab-label { font-size: 11px; }
.tab.active { color: var(--ink); }
.tab.active .tab-ico { filter: none; transform: translateY(-1px); }

/* ============================================================
   Overlays
   ============================================================ */
.overlay { position: fixed; inset: 0; z-index: 60; display: grid; }
.overlay[hidden] { display: none; }

/* A5 loading */
.overlay--loading { place-items: center; background: var(--paper); }
.loader { display: grid; justify-items: center; gap: 26px; }
.plate { position: relative; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle at 50% 45%, #fff 0 58%, #efe9db 60% 100%); box-shadow: 0 20px 40px rgba(0,0,0,.12); animation: spin 3.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ingredient { position: absolute; width: 30px; height: 30px; border-radius: 50%; }
.i1 { background: var(--red); top: 20px; left: 60px; animation: hop 1.1s ease-in-out infinite; }
.i2 { background: var(--green); top: 60px; left: 22px; animation: hop 1.1s ease-in-out .2s infinite; }
.i3 { background: var(--yellow); top: 62px; right: 22px; animation: hop 1.1s ease-in-out .4s infinite; }
.i4 { background: var(--blue); bottom: 22px; left: 60px; animation: hop 1.1s ease-in-out .6s infinite; }
@keyframes hop { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.loader-text { text-align: center; font-size: 17px; color: var(--muted); line-height: 1.5; margin: 0; }

/* A2 login over blurred B2 */
/* 로그인 게이트: 위쪽 3일치는 그대로 보이고, 아래에서 시트가 올라와 하단바를 덮음 */
.overlay--login { place-items: end center; background: linear-gradient(180deg, transparent 0%, transparent 42%, rgba(20,18,14,.18) 100%); animation: fadein .3s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.login-card {
  width: min(430px, 100%); background: var(--paper); border-radius: 34px 34px 0 0;
  padding: 22px 28px calc(28px + env(safe-area-inset-bottom, 0px));
  display: grid; justify-items: center; gap: 7px; box-shadow: 0 -14px 40px rgba(0,0,0,.2);
  animation: sheetup .34s cubic-bezier(.2,.9,.3,1);
}
@keyframes sheetup { from { transform: translateY(100%); } to { transform: none; } }
.login-card .radish-mascot { width: 68px; height: 72px; }
.login-title { font-size: 25px; margin: 4px 0 0; font-weight: 400; }
.login-sub { text-align: center; font-size: 14px; color: var(--muted); line-height: 1.5; margin: 0 0 14px; }
.social-btn { width: 100%; border: 0; border-radius: 16px; padding: 16px; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s ease; }
.social-btn:hover { transform: translateY(-2px); }
.social-btn--kakao { background: #FEE500; color: #191600; }
.social-btn--apple { background: #000; color: #fff; }
.login-skip { margin-top: 6px; border: 0; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; text-decoration: underline; }

/* D2 bottom sheet */
.overlay--sheet { align-items: end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20,18,14,.35); animation: fadein .25s ease; }
.sheet {
  position: relative; width: min(430px, 100%); margin: 0 auto;
  background: var(--paper); border-radius: 30px 30px 0 0;
  padding: 14px 24px calc(28px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -14px 40px rgba(0,0,0,.2); animation: sheetup .3s cubic-bezier(.2,.9,.3,1);
}
.sheet-grip { width: 44px; height: 5px; border-radius: 999px; background: #d9d4c6; margin: 2px auto 14px; }
.sheet-title { font-size: 24px; margin: 0; font-weight: 400; }
.sheet-sub { font-size: 13px; color: var(--muted); margin: 4px 0 16px; }
.sheet-options { display: grid; gap: 10px; }
.sheet-opt {
  display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 14px;
  border: 0; border-radius: 22px; padding: 14px 16px; background: #fff; cursor: pointer; text-align: left;
  box-shadow: 0 6px 16px rgba(0,0,0,.05); transition: transform .12s ease;
}
.sheet-opt:hover { transform: translateY(-2px); }
.sheet-opt .food-sticker { position: static; transform: none; width: 52px; height: 52px; }
.sheet-opt .food-sticker::before { width: 48px; height: 38px; }
.sheet-opt .meal-protein-icon { width: 38px; height: 38px; }
.sheet-opt-name { font-size: 17px; }
.sheet-opt-meta { font-family: var(--sys); font-size: 12px; color: var(--muted); margin-top: 2px; }
.sheet-cancel { width: 100%; margin-top: 14px; border: 0; border-radius: 999px; padding: 15px; background: var(--paper-2); font-size: 15px; cursor: pointer; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 96px;
  transform: translateX(-50%) translateY(10px);
  z-index: 80; background: #000; color: #fff; font-size: 14px;
  padding: 13px 20px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0; transition: opacity .25s ease, transform .25s ease; pointer-events: none;
  max-width: 88%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
