/* 냉장고 퍼먹기 스타일
   디자인 기준: .agents/skills/design-taste-frontend/SKILL.md
   - 다이얼: DESIGN_VARIANCE 5 / MOTION_INTENSITY 4 / VISUAL_DENSITY 5
   - 강조색은 초록 하나만 사용 (경고색은 "부족한 재료" 상태 표시에만)
   - 모서리 규칙: 버튼·칩·탭·태그 = 알약(999px) / 입력창·목록 항목·아이콘 타일 = 12px / 카드·패널·팝업 = 16px
   - z-index 단계: 드롭다운 20, 타이머 30, 토스트 100 (팝업은 브라우저 top-layer 사용)
   - 라이트/다크 모두 CSS 변수로 관리 */

:root {
  --bg: #f3f4f1;
  --surface: #fbfbf9;
  --surface-2: #eaece7;
  --line: #d9ddd6;
  --text: #1d211e;
  --text-sub: #545b56;
  --text-faint: #646b66;
  --accent: #23794d;
  --accent-hover: #1c6640;
  --accent-soft: #e4f1e9;
  --on-accent: #fbfbf9;
  --warn: #a3471c;
  --warn-soft: #f6e6db;
  --shadow-sm: 0 1px 2px rgb(29 33 30 / 0.06);
  --shadow: 0 1px 2px rgb(29 33 30 / 0.05), 0 10px 28px rgb(29 33 30 / 0.07);
  --shadow-lg: 0 2px 6px rgb(29 33 30 / 0.06), 0 24px 60px rgb(29 33 30 / 0.16);

  --r-pill: 999px;
  --r-input: 12px;
  --r-card: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --z-dropdown: 20;
  --z-timer: 30;
  --z-toast: 100;

  --font: "Wanted Sans Variable", "Wanted Sans", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: light;
}

/* 시스템 설정(data-theme 없음)일 때 기기가 다크 모드면 다크 색 사용 */
/* 시스템 설정(data-theme 없음)일 때 기기가 다크 모드면 다크 색 사용 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #111412;
    --surface: #181c19;
    --surface-2: #232824;
    --line: #313832;
    --text: #e8ebe8;
    --text-sub: #a6aea8;
    --text-faint: #929a94;
    --accent: #54b783;
    --accent-hover: #68c592;
    --accent-soft: #1c3226;
    --on-accent: #0d1811;
    --warn: #e6976a;
    --warn-soft: #3a2519;
    --shadow-sm: none;
    --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset;
    --shadow-lg: 0 24px 60px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

/* 직접 고른 테마 (라이트는 맨 위 :root 기본값) */
:root[data-theme="dark"] {
  --bg: #111412;
  --surface: #181c19;
  --surface-2: #232824;
  --line: #313832;
  --text: #e8ebe8;
  --text-sub: #a6aea8;
  --text-faint: #929a94;
  --accent: #54b783;
  --accent-hover: #68c592;
  --accent-soft: #1c3226;
  --on-accent: #0d1811;
  --warn: #e6976a;
  --warn-soft: #3a2519;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset;
  --shadow-lg: 0 24px 60px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}

/* 토마토: 밝은 바탕 + 토마토 빨강 */
:root[data-theme="tomato"] {
  --bg: #f5f3f2;
  --surface: #fcfbfa;
  --surface-2: #efe8e6;
  --line: #e2d9d6;
  --text: #241b19;
  --text-sub: #5c514e;
  --text-faint: #6b5f5c;
  --accent: #b3372a;
  --accent-hover: #992e22;
  --accent-soft: #f7e2dd;
  --on-accent: #fdf8f6;
  --warn: #875200;
  --warn-soft: #f6ead5;
  --shadow-sm: 0 1px 2px rgb(36 27 25 / 0.06);
  --shadow: 0 1px 2px rgb(36 27 25 / 0.05), 0 10px 28px rgb(36 27 25 / 0.07);
  --shadow-lg: 0 2px 6px rgb(36 27 25 / 0.06), 0 24px 60px rgb(36 27 25 / 0.16);
  color-scheme: light;
}

/* 블루베리: 어두운 남색 + 블루베리 파랑 */
:root[data-theme="blueberry"] {
  --bg: #0f1220;
  --surface: #161a2b;
  --surface-2: #20263b;
  --line: #2d344d;
  --text: #e7e9f3;
  --text-sub: #a9b0c8;
  --text-faint: #9399b4;
  --accent: #82a8ff;
  --accent-hover: #9cbaff;
  --accent-soft: #1d2a4e;
  --on-accent: #0b1230;
  --warn: #f0a47c;
  --warn-soft: #3b2622;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset;
  --shadow-lg: 0 24px 60px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}

/* 흑임자: 어두운 먹색 + 호박색 */
:root[data-theme="sesame"] {
  --bg: #141312;
  --surface: #1c1b19;
  --surface-2: #272522;
  --line: #37342f;
  --text: #ece8e2;
  --text-sub: #b1aba2;
  --text-faint: #9b958c;
  --accent: #e0a449;
  --accent-hover: #ebb566;
  --accent-soft: #3a2d18;
  --on-accent: #1c1406;
  --warn: #ee8f7b;
  --warn-soft: #3d231d;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset;
  --shadow-lg: 0 24px 60px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}

/* 토마토 다크: 따뜻한 먹색 + 밝은 토마토색 */
:root[data-theme="tomato-dark"] {
  --bg: #171211;
  --surface: #1f1817;
  --surface-2: #2a2220;
  --line: #3b302d;
  --text: #f0e8e6;
  --text-sub: #bbaca8;
  --text-faint: #a5958f;
  --accent: #f17a63;
  --accent-hover: #f6917d;
  --accent-soft: #3e1f19;
  --on-accent: #230c07;
  --warn: #e2b45e;
  --warn-soft: #3a2e16;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset;
  --shadow-lg: 0 24px 60px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}

/* 블루베리 라이트: 푸른 흰 바탕 + 짙은 블루베리 파랑 */
:root[data-theme="blueberry-light"] {
  --bg: #f2f3f8;
  --surface: #fbfbfe;
  --surface-2: #e8eaf3;
  --line: #d6daea;
  --text: #171a2b;
  --text-sub: #4f5570;
  --text-faint: #5f6580;
  --accent: #3156c4;
  --accent-hover: #2848a8;
  --accent-soft: #e2e8fa;
  --on-accent: #fbfbfe;
  --warn: #a3471c;
  --warn-soft: #f6e6db;
  --shadow-sm: 0 1px 2px rgb(23 26 43 / 0.06);
  --shadow: 0 1px 2px rgb(23 26 43 / 0.05), 0 10px 28px rgb(23 26 43 / 0.07);
  --shadow-lg: 0 2px 6px rgb(23 26 43 / 0.06), 0 24px 60px rgb(23 26 43 / 0.16);
  color-scheme: light;
}

/* 흑임자 라이트: 깨 빛깔 회백색 + 검은깨 먹색 */
:root[data-theme="sesame-light"] {
  --bg: #f4f3f1;
  --surface: #fcfcfb;
  --surface-2: #ebe9e5;
  --line: #dcd8d2;
  --text: #1c1a17;
  --text-sub: #57524b;
  --text-faint: #67615a;
  --accent: #2f2b26;
  --accent-hover: #1c1a17;
  --accent-soft: #e9e5df;
  --on-accent: #fcfcfb;
  --warn: #b0392b;
  --warn-soft: #f7e1dd;
  --shadow-sm: 0 1px 2px rgb(28 26 23 / 0.06);
  --shadow: 0 1px 2px rgb(28 26 23 / 0.05), 0 10px 28px rgb(28 26 23 / 0.07);
  --shadow-lg: 0 2px 6px rgb(28 26 23 / 0.06), 0 24px 60px rgb(28 26 23 / 0.16);
  color-scheme: light;
}

/* ================= 기본 ================= */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
small { color: var(--text-faint); font-weight: 400; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ph { line-height: 1; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 20px;
}

/* ================= 버튼 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-weight: 650;
  font-size: 0.97rem;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; }
.btn .ph { font-size: 1.15em; }

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--text-faint); }
.btn-ghost.danger { color: var(--warn); }
.btn-ghost.is-on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.88rem; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 1.15rem;
  transition: border-color 0.2s var(--ease), transform 0.15s var(--ease);
}
.btn-icon:hover { border-color: var(--text-faint); }
.btn-icon:active { transform: scale(0.96); }

.btn-link {
  border: 0;
  background: none;
  padding: 4px 2px;
  color: var(--accent);
  font-weight: 650;
  font-size: 0.88rem;
}
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ================= 상단 바 ================= */
.topbar { border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar-row { display: flex; align-items: center; gap: 24px; height: 64px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark { width: 22px; height: 28px; flex: none; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-sub);
  font-weight: 600;
  font-size: 0.93rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link.active { background: var(--surface-2); color: var(--text); }
.nav-link .ph { font-size: 1.1rem; }
.nav-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.74rem;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.auth-area { display: flex; align-items: center; gap: 8px; }

/* 테마 메뉴 (상단 바 오른쪽) */
.theme-switch { position: relative; }
.theme-menu {
  position: absolute;
  z-index: var(--z-dropdown);
  top: calc(100% + 8px);
  right: 0;
  width: 296px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.theme-menu-title { padding: 6px 10px 4px; font-size: 0.8rem; font-weight: 650; color: var(--text-faint); }
.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-input);
  background: none;
  font-size: 0.93rem;
  font-weight: 550;
  text-align: left;
}
.theme-option:hover, .theme-option:focus-visible { background: var(--surface-2); outline: none; }
.theme-option[aria-checked="true"] { font-weight: 700; }
.theme-option .ph-check { margin-left: auto; color: var(--accent); visibility: hidden; }
.theme-option[aria-checked="true"] .ph-check { visibility: visible; }

/* 맛별 한 줄: 이름 | 라이트 | 다크 */
.theme-row { display: grid; grid-template-columns: 72px 1fr 1fr; gap: 4px; align-items: center; margin-top: 2px; }
.theme-row-name { padding-left: 10px; font-size: 0.86rem; font-weight: 650; color: var(--text-sub); }
.theme-row .theme-option { min-height: 38px; gap: 8px; padding: 0 10px; border: 1px solid transparent; font-size: 0.88rem; }
.theme-row .theme-option[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.theme-row .swatch { width: 18px; height: 18px; }
/* 테마 미리보기: 왼쪽 위 바탕색 / 오른쪽 아래 강조색 */
.swatch {
  flex: none;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--sw-bg) 50%, var(--sw-accent) 50%);
}
.user-email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.86rem; color: var(--text-sub); }
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-sub);
  font-size: 0.8rem;
  font-weight: 600;
}

.demo-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.86rem;
  color: var(--text-sub);
}
.demo-banner code { font-size: 0.82rem; }

/* ================= 히어로 (왼쪽 문구 · 오른쪽 실제 재료 선택 도구) ================= */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
  padding-top: 56px;
  padding-bottom: 48px;
}
.hero h1 {
  font-size: clamp(2.1rem, 1.3rem + 2.6vw, 3.3rem);
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1.18;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { margin-top: 18px; max-width: 30em; font-size: 1.08rem; color: var(--text-sub); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }

/* ================= 재료 선택 카드 ================= */
.picker {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.picker-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.picker-head h2 { font-size: 1.12rem; }

.dropdown { position: relative; }
.dd-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-input);
  background: var(--surface);
  font-weight: 650;
  text-align: left;
  transition: border-color 0.2s var(--ease);
}
.dd-trigger:hover, .dd-trigger[aria-expanded="true"] { border-color: var(--accent); }
.dd-trigger > .ph:first-child { font-size: 1.25rem; color: var(--accent); }
.dd-label { flex: 1; }
.dd-count {
  min-width: 24px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8rem;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.dd-caret { color: var(--text-faint); transition: transform 0.25s var(--ease); }
.dd-trigger[aria-expanded="true"] .dd-caret { transform: rotate(180deg); }

.dd-panel {
  position: absolute;
  z-index: var(--z-dropdown);
  top: calc(100% + 8px);
  right: 0;
  width: max(100%, min(560px, calc(100vw - 40px)));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform-origin: top center;
}

.search {
  width: 100%;
  min-height: 44px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}
.search::placeholder { color: var(--text-faint); }
.search-wrap { position: relative; }
.search-wrap .ph { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }

.dd-body { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 14px; margin-top: 12px; min-height: 300px; }
.dd-cats { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-right: 12px; border-right: 1px solid var(--line); }
.dd-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-input);
  background: none;
  color: var(--text-sub);
  font-size: 0.93rem;
  font-weight: 550;
  text-align: left;
  white-space: nowrap;
}
.dd-cat:hover { background: var(--surface-2); color: var(--text); }
.dd-cat.active { background: var(--accent-soft); color: var(--text); font-weight: 700; }
.dd-cat-name { flex: 1; }
.dd-cat-count { font-size: 0.78rem; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

.dd-items { min-width: 0; max-height: 340px; overflow-y: auto; overscroll-behavior: contain; }
.dd-items-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; padding-left: 4px; font-size: 0.93rem; }

/* 재료 타일: 체크박스는 숨기고(키보드 · 스크린리더용으로 유지) 타일 자체가 눌린 상태를 보여준다 */
.ing-grid { list-style: none; margin: 0; padding: 4px 2px; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ing-tile { position: relative; display: block; cursor: pointer; }
.ing-tile input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.ing-tile-face {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 92px;
  padding: 12px 6px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  text-align: center;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.ing-tile-emoji {
  font-size: 1.9rem;
  line-height: 1;
  filter: grayscale(0.35);
  opacity: 0.8;
  transition: transform 0.25s var(--ease), filter 0.2s var(--ease), opacity 0.2s var(--ease);
}
.ing-tile-name { font-size: 0.84rem; font-weight: 600; line-height: 1.3; color: var(--text-sub); word-break: keep-all; }
.ing-tile-check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.72rem;
  opacity: 0;
  transform: scale(0.3);
  transition: opacity 0.2s var(--ease), transform 0.3s var(--ease);
}

.ing-tile:hover .ing-tile-face { border-color: var(--text-faint); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.ing-tile:hover .ing-tile-emoji { transform: scale(1.1) rotate(-6deg); filter: none; opacity: 1; }
.ing-tile:active .ing-tile-face { transform: scale(0.95); }
.ing-tile input:focus-visible + .ing-tile-face { outline: 2px solid var(--accent); outline-offset: 2px; }

.ing-tile input:checked + .ing-tile-face { background: var(--accent-soft); border-color: var(--accent); }
.ing-tile input:checked + .ing-tile-face .ing-tile-emoji { filter: none; opacity: 1; }
.ing-tile input:checked + .ing-tile-face .ing-tile-name { color: var(--text); font-weight: 700; }
.ing-tile input:checked + .ing-tile-face .ing-tile-check { opacity: 1; transform: scale(1); }

.dd-foot { display: flex; justify-content: flex-end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.tags { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  padding: 0 4px 0 12px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  font-size: 0.88rem;
  font-weight: 600;
}
.tag-x {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--text-sub);
}
.tag-x:hover { background: var(--surface); color: var(--text); }
.tags-empty { font-size: 0.9rem; color: var(--text-faint); }

.picker-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pantry-note { display: flex; align-items: flex-start; gap: 6px; font-size: 0.84rem; color: var(--text-sub); }
.pantry-note .ph { margin-top: 3px; color: var(--accent); }

/* ================= 추천 결과 ================= */
.results-section { padding-top: 24px; padding-bottom: 64px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.section-head h2 { font-size: 1.5rem; font-weight: 740; }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 0.88rem;
  font-weight: 600;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--text-faint); }
.chip:active { transform: scale(0.97); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip .ph { font-size: 1.05rem; }

.segmented { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--surface-2); }
.seg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-sub);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-count { font-size: 0.78rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.result-head { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 1.05rem; font-weight: 700; }
.cards + .result-head { margin-top: 36px; }
.count {
  min-width: 24px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.count.muted { background: var(--surface-2); color: var(--text-sub); }

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  text-align: left;
  text-decoration: none;
  transition: border-color 0.2s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.card:active { transform: scale(0.99); }

.tile {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-input);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.5rem;
}
.card-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-name { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1.02rem; }
.card-name .ph-fill { color: var(--accent); font-size: 0.95rem; }
.card-missing { display: flex; align-items: center; gap: 4px; font-size: 0.84rem; color: var(--warn); font-weight: 600; }
.card-note { font-size: 0.84rem; color: var(--text-sub); }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 0.84rem; color: var(--text-sub); }
.meta-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.meta-item .ph { font-size: 1rem; color: var(--text-faint); }
.label {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-sub);
  font-size: 0.76rem;
  font-weight: 700;
}

.none { color: var(--text-faint); font-size: 0.92rem; list-style: none; }

/* 빈 화면 */
.empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px 18px;
  align-items: start;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--r-card);
}
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-input); background: var(--surface-2); color: var(--text-sub); font-size: 1.6rem; }
.empty h3 { font-size: 1.08rem; }
.empty p { margin-top: 4px; color: var(--text-sub); font-size: 0.95rem; }
.empty .quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.empty .btn { margin-top: 14px; }

/* ================= 즐겨찾기 ================= */
.page-section { padding-top: 40px; padding-bottom: 64px; }
.page-title { font-size: 1.9rem; font-weight: 760; letter-spacing: -0.035em; margin-bottom: 20px; }

.fav-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.fav-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}
.fav-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fav-main strong { font-size: 1.05rem; }
.fav-ings { font-size: 0.85rem; color: var(--text-sub); }
.fav-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }

/* 불러오는 중 (실제 카드 모양과 같은 뼈대) */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-input); }
.skeleton-card { height: 132px; border-radius: var(--r-card); }

/* ================= 팝업 공통 ================= */
dialog {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgb(17 20 18 / 0.5); }
.dialog-inner { position: relative; padding: 28px; }
.dialog-close { position: absolute; top: 16px; right: 16px; }

/* ================= 레시피 상세 (팝업 · 레시피 페이지 공용) ================= */
.r-head { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; align-items: center; padding-right: 48px; }
.r-head .tile { width: 56px; height: 56px; font-size: 1.8rem; }
.r-title { font-size: 1.6rem; font-weight: 760; letter-spacing: -0.035em; margin-top: 4px; }
.r-base-name { margin-top: 2px; font-size: 0.86rem; color: var(--text-faint); }
.adapt-note { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; padding: 10px 14px; border-radius: var(--r-input); background: var(--accent-soft); font-size: 0.88rem; line-height: 1.5; }
.adapt-note .ph { margin-top: 3px; color: var(--accent); }
.adapt-skip { color: var(--text-sub); }
.r-desc { margin-top: 14px; max-width: 65ch; color: var(--text-sub); }

.r-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 22px 0 12px; }
.r-actions { display: flex; gap: 6px; }

.stepper { display: inline-flex; align-items: center; height: 44px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); }
.stepper button { display: grid; place-items: center; width: 44px; height: 42px; border: 0; border-radius: var(--r-pill); background: none; font-size: 1.1rem; }
.stepper button:hover:not(:disabled) { background: var(--surface-2); }
.stepper button:disabled { opacity: 0.3; }
.stepper output { min-width: 64px; text-align: center; font-size: 0.95rem; }
.stepper output strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.kcal {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 24px;
  align-items: center;
  margin-top: 22px;
  padding: 18px 20px;
  border-radius: var(--r-card);
  background: var(--bg);
}
.kcal-main { display: flex; align-items: baseline; gap: 6px; }
.kcal-num { font-size: 2.2rem; font-weight: 760; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.kcal-unit { font-weight: 650; color: var(--text-sub); }
.kcal-cap { display: block; font-size: 0.8rem; color: var(--text-faint); }
.kcal-side { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 0.9rem; color: var(--text-sub); }
.kcal-side strong { color: var(--text); font-weight: 650; }
.kcal-tag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--r-pill); font-size: 0.8rem; font-weight: 700; }
.kcal-light .kcal-tag { background: var(--accent-soft); color: var(--accent); }
.kcal-normal .kcal-tag { background: var(--surface-2); color: var(--text); }
.kcal-heavy .kcal-tag { background: var(--warn-soft); color: var(--warn); }
.note { margin-top: 8px; font-size: 0.8rem; color: var(--text-faint); }

.r-section-title { display: flex; align-items: baseline; gap: 8px; margin: 32px 0 12px; font-size: 1.1rem; font-weight: 720; }
.r-sub-title { margin: 20px 0 8px; font-size: 0.95rem; font-weight: 700; color: var(--text-sub); }

/* 재료: 줄마다 선을 긋지 않고 2열 묶음으로 */
.ings { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; }
.ing { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 44px; }
.ing-status { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-pill); font-size: 0.95rem; }
.ing--has .ing-status { background: var(--accent-soft); color: var(--accent); }
.ing--lack .ing-status { background: var(--warn-soft); color: var(--warn); }
.ing--lack .ing-name { color: var(--text-sub); }
.ing--req .ing-status { background: none; }
.ing--basic .ing-status { background: var(--surface-2); color: var(--text-sub); font-size: 0.66rem; font-weight: 700; width: 34px; }
.ing-name { min-width: 0; font-size: 0.95rem; }
.ing-name small { font-size: 0.8rem; }
.ing-amt { text-align: right; line-height: 1.3; }
.ing-amt b { display: block; font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.ing-amt span { font-size: 0.76rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.measure-help { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; font-size: 0.8rem; color: var(--text-faint); }
.measure-help b { color: var(--text-sub); font-weight: 650; }

/* 조리 순서: 번호 원 */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 750;
  font-size: 0.9rem;
}
.steps li > span { padding-top: 4px; }
.amt { color: var(--accent); font-weight: 700; }
.amt-opt { color: var(--text-faint); font-weight: 600; }

.tip { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; margin-top: 28px; padding: 18px; border-radius: var(--r-card); background: var(--accent-soft); }
.tip .ph { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-pill); background: var(--surface); color: var(--accent); font-size: 1.3rem; }
.tip-title { font-weight: 720; margin-bottom: 2px; }
.tip-title ~ p + p { margin-top: 6px; }

/* ================= 요리 모드 ================= */
.cook-dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.cook-inner { max-width: 760px; min-height: 100%; margin: 0 auto; padding: 24px 24px 112px; display: flex; flex-direction: column; }
#cook-body { flex: 1; display: flex; flex-direction: column; }
.cook-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cook-name { font-weight: 650; color: var(--text-sub); }
.cook-count { font-size: 1rem; color: var(--text-sub); font-variant-numeric: tabular-nums; }
.cook-count strong { font-size: 1.7rem; color: var(--accent); font-weight: 760; }
.cook-progress { height: 4px; margin: 18px 0 36px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.cook-progress div { height: 100%; background: var(--accent); transition: width 0.35s var(--ease); }
.cook-step { font-size: clamp(1.4rem, 1rem + 2vw, 2rem); line-height: 1.55; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 28px; }
.cook-timers { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.cook-ings { margin-top: auto; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--r-card); }
.cook-ings summary { cursor: pointer; font-weight: 650; }
.cook-ings ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 16px; font-size: 0.93rem; }
.cook-ings b { font-weight: 700; }
.cook-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 16px; }
.cook-wake { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 14px; min-height: 1.4em; font-size: 0.82rem; color: var(--text-faint); }

.cook-timer {
  position: fixed;
  z-index: var(--z-timer);
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  height: 56px;
  padding: 0 8px 0 22px;
  border-radius: var(--r-pill);
  background: var(--text);
  color: var(--bg);
  font-size: 1.3rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-lg);
}
.cook-timer.ring { background: var(--warn); color: var(--bg); }
.cook-timer-btn { height: 40px; padding: 0 16px; border: 0; border-radius: var(--r-pill); background: rgb(255 255 255 / 0.18); color: inherit; font-size: 0.9rem; font-weight: 700; }

/* ================= 로그인 ================= */
#auth-dialog { width: min(420px, calc(100% - 32px)); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form h2 { font-size: 1.4rem; font-weight: 740; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.9rem; font-weight: 650; }
.field input {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field-help { font-size: 0.8rem; color: var(--text-faint); }
.auth-msg { min-height: 1.3em; font-size: 0.88rem; color: var(--warn); font-weight: 600; }

/* ================= 토스트 · 푸터 ================= */
.toast {
  position: fixed;
  z-index: var(--z-toast);
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: var(--text);
  color: var(--bg);
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}

.site-footer { display: grid; gap: 20px; padding-top: 24px; padding-bottom: 40px; border-top: 1px solid var(--line); font-size: 0.86rem; color: var(--text-faint); }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer-info { display: grid; gap: 4px; padding-top: 18px; border-top: 1px solid var(--line); font-style: normal; font-size: 0.8rem; line-height: 1.6; }
.footer-info strong { margin-right: 8px; color: var(--text-sub); font-weight: 700; }
.site-footer .footer-info a { font-weight: 500; }
.footer-copy { margin-top: 4px; letter-spacing: 0.02em; }
.site-footer a { color: var(--text-sub); font-weight: 650; text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.footer-links { display: flex; gap: 16px; }

/* ================= 재료별 페이지 · 레시피 페이지 보강 ================= */
.ing-cta { margin-top: 20px; }
.ing-page .note { margin-top: 10px; }
.ing-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ing-links .chip { text-decoration: none; }
.ing-name a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.ing-name a:hover { color: var(--accent); text-decoration-color: currentColor; }
.variant-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.variant-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-input); }
.variant-list span { font-size: 0.86rem; color: var(--text-sub); }

/* ================= 레시피 페이지 · 전체 레시피 ================= */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 20px; font-size: 0.85rem; color: var(--text-faint); }
.breadcrumb a { color: var(--text-sub); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .ph { font-size: 0.8rem; }

.recipe-page { padding-top: 24px; padding-bottom: 64px; }
.recipe-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }
.recipe-aside { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 12px; }
.recipe-aside .kcal { margin-top: 0; grid-template-columns: 1fr; }
.related { padding-top: 8px; padding-bottom: 64px; }
.related .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.index-page { padding-top: 32px; padding-bottom: 64px; }
.index-intro { max-width: 60ch; margin-top: -8px; color: var(--text-sub); }
.index-group h2 { display: flex; align-items: baseline; gap: 8px; margin: 40px 0 14px; font-size: 1.3rem; font-weight: 740; }

/* ================= 모두의 레시피 (사용자 레시피) ================= */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.page-head .page-title { margin-bottom: 6px; }
.page-sub { max-width: 52ch; color: var(--text-sub); }
.cm-search { flex: 1 1 260px; max-width: 360px; }
.cm-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-empty { grid-column: 1 / -1; }
.more-row { display: flex; justify-content: center; margin-top: 24px; }

.card-by { display: flex; align-items: center; gap: 4px; font-size: 0.82rem; color: var(--text-faint); }
.card-by .ph { font-size: 1rem; }
.mine-badge { margin-left: 4px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: 0.74rem; font-weight: 700; }

/* 레시피 팝업: 만든 사람 줄 */
.r-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 16px; font-size: 0.88rem; color: var(--text-sub); }
.by-badge { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text); font-size: 0.8rem; font-weight: 650; }
.r-owner { display: flex; gap: 10px; margin-left: auto; }
.r-owner .btn-link { display: inline-flex; align-items: center; gap: 4px; }
.btn-link.danger { color: var(--warn); }
.ing--free .ing-status { background: var(--surface-2); color: var(--text-faint); }

/* 작성 폼 */
.editor-dialog { width: min(780px, calc(100% - 32px)); }
.editor { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 28px; border-bottom: 1px solid var(--line); }
.editor-head h2 { font-size: 1.3rem; font-weight: 740; }
.editor-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 28px 28px; }
.editor-foot { display: flex; align-items: center; gap: 8px; padding: 14px 28px; border-top: 1px solid var(--line); background: var(--surface); }
.editor-foot .auth-msg { flex: 1; min-height: 0; }

.ed-section { margin: 0; padding: 22px 0 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ed-section + .ed-section { margin-top: 10px; border-top: 1px solid var(--line); }
.ed-section legend { float: left; width: 100%; padding: 0; font-size: 1.05rem; font-weight: 720; }
.ed-section legend label { font: inherit; }
.ed-section > .field-help { margin-top: -6px; }
.ed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ed-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-label { font-size: 0.9rem; font-weight: 650; }

.field select,
.editor textarea,
.ed-row input[type="text"],
.ed-row input[type="number"],
.ed-row select {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  width: 100%;
  min-width: 0;
}
.editor textarea { padding: 12px 14px; line-height: 1.5; resize: vertical; }
.field select:focus, .editor textarea:focus, .ed-row input:focus, .ed-row select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.ed-row input:disabled { opacity: 0.45; }
.editor ::placeholder { color: var(--text-faint); }

/* 라디오 · 체크박스를 칩 모양으로 */
.choice-group { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { position: relative; }
.choice input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.choice:hover span { border-color: var(--text-faint); color: var(--text); }
.choice input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 재료 줄: 이름 · 양 · 단위 · 선택 · 빼기 */
.ed-ing-head,
.ed-row { display: grid; grid-template-columns: minmax(0, 1fr) 88px 116px 64px 40px; gap: 8px; align-items: center; }
.ed-ing-head { margin-bottom: -8px; padding: 0 4px; font-size: 0.8rem; font-weight: 650; color: var(--text-faint); }
.ed-items, .ed-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ed-opt { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--text-sub); cursor: pointer; }
.ed-opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.ed-remove { width: 40px; height: 40px; color: var(--text-faint); }
.ed-section > .btn-sm { align-self: flex-start; }

/* 만드는 법: 번호 원 + 입력칸 */
.ed-steps { counter-reset: ed-step; }
.ed-step { counter-increment: ed-step; display: grid; grid-template-columns: 32px minmax(0, 1fr) 40px; gap: 10px; align-items: start; }
.ed-step::before {
  content: counter(ed-step);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-top: 7px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 750;
  font-size: 0.9rem;
}
.ed-step .ed-remove { margin-top: 3px; }

@media (max-width: 767px) {
  .page-head { align-items: stretch; flex-direction: column; }
  .page-head .btn { align-self: flex-start; }
  .cm-search { max-width: none; flex-basis: auto; }
  .cm-tabs .segmented { max-width: 100%; }

  .editor-dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border: 0; border-radius: 0; }
  .editor { height: 100%; max-height: none; }
  .editor-head, .editor-foot { padding-inline: 16px; }
  .editor-body { padding: 4px 16px 24px; }
  .editor-foot { flex-wrap: wrap; }
  .editor-foot .auth-msg { flex-basis: 100%; }
  .editor-foot .auth-msg:empty { display: none; }
  .editor-foot .btn { flex: 1; }
  .ed-grid, .ed-grid-3 { grid-template-columns: minmax(0, 1fr); }

  /* 재료 줄: 이름은 한 줄 전체, 아래에 양 · 단위 · 선택 · 빼기 */
  .ed-ing-head { display: none; }
  .ed-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto 40px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .ed-row .ed-ing-name { grid-column: 1 / -1; }
  .ed-step { grid-template-columns: 28px minmax(0, 1fr) 40px; }
  .ed-step::before { width: 28px; height: 28px; }
}

/* ================= 움직임 (상태 변화 · 피드백에만) ================= */
@media (prefers-reduced-motion: no-preference) {
  /* 결과가 바뀌었음을 알려주는 카드 등장 */
  .cards > li { animation: rise 0.45s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms); }
  .dd-panel:not([hidden]) { animation: drop 0.22s var(--ease); }
  .theme-menu:not([hidden]) { animation: drop 0.2s var(--ease); }
  dialog[open] { animation: pop 0.3s var(--ease); }
  .cook-dialog[open] { animation: fade 0.25s var(--ease); }
  .toast:not([hidden]) { animation: toast-in 0.3s var(--ease); }
  .cook-timer.ring { animation: pulse 0.8s ease-in-out infinite alternate; }
  /* 뽑기: 이름이 위에서 떨어지듯 바뀜 */
  .pick-reel span.roll { animation: reel 0.12s var(--ease); }
  .pick-result { animation: pop 0.35s var(--ease); }
  .stamp { animation: stamp-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
  /* 재료를 담을 때: 타일이 통통 튀고 이모지가 폴짝 뛰며 체크 배지가 튀어나옴 */
  .ing-tile.pop-in .ing-tile-face { animation: tile-bounce 0.45s var(--ease); }
  .ing-tile.pop-in .ing-tile-emoji { animation: emoji-hop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1); }
  .ing-tile.pop-in .ing-tile-check { animation: check-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
  .ing-tile.pop-in .ing-tile-face::after {
    content: "";
    position: absolute;
    inset: -1.5px;
    border-radius: inherit;
    border: 2px solid var(--accent);
    animation: ripple 0.5s ease-out forwards;
    pointer-events: none;
  }
  /* 재료를 뺄 때: 살짝 움츠러듦 */
  .ing-tile.pop-out .ing-tile-face { animation: tile-shrink 0.3s var(--ease); }
  /* 선택한 재료 태그 등장 */
  .tag-new { animation: tag-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
  .skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.35), transparent);
    animation: shimmer 1.4s infinite;
  }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-6px) scaleY(0.98); } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.985); } }
@keyframes fade { from { opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes pulse { to { transform: translateX(-50%) scale(1.05); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes tile-bounce { 0% { transform: scale(0.92); } 55% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes emoji-hop { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-10px) scale(1.25) rotate(-10deg); } 100% { transform: translateY(0) scale(1); } }
@keyframes check-pop { from { opacity: 0; transform: scale(0) rotate(-90deg); } }
@keyframes ripple { from { opacity: 0.8; transform: scale(1); } to { opacity: 0; transform: scale(1.12); } }
@keyframes tile-shrink { 50% { transform: scale(0.94); } }
@keyframes reel { from { opacity: 0.2; transform: translateY(-40%); } }
@keyframes stamp-in { from { opacity: 0; transform: rotate(-12deg) scale(1.6); } }
@keyframes tag-in { from { opacity: 0; transform: scale(0.6); } }

/* ================= 공통 보조 ================= */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.btn-icon-sm { width: 32px; height: 32px; font-size: 0.95rem; }
.btn-icon:disabled { opacity: 0.35; }
.tile-photo { overflow: hidden; background: var(--surface-2); }
.tile-photo img { width: 100%; height: 100%; object-fit: cover; }
.r-photo { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 360px; margin-bottom: 20px; object-fit: cover; border-radius: var(--r-card); background: var(--surface-2); }
.tile-lg { width: 72px; height: 72px; font-size: 2.1rem; border-radius: var(--r-card); }

/* ================= 요리 찾기: 뽑기 · 공유 · 묶음 ================= */
.section-head { flex-wrap: wrap; }
.section-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.bundles { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.bundle {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: border-color 0.2s var(--ease), transform 0.15s var(--ease);
}
.bundle:hover { border-color: var(--accent); }
.bundle:active { transform: scale(0.98); }
.bundle-emoji { font-size: 1.6rem; line-height: 1; }
.bundle-main { display: flex; flex-direction: column; min-width: 0; }
.bundle-main strong { font-size: 0.95rem; }
.bundle-main span { font-size: 0.8rem; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bundle > .ph { color: var(--accent); }
.quick-label { margin-top: 16px; font-size: 0.82rem; font-weight: 650; color: var(--text-faint); }
.empty .quick-label + .quick { margin-top: 8px; }

/* 레시피 팝업: 다 만들었어요 · 장보기 */
.r-after { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* 뽑기 */
.pick-dialog { width: min(440px, calc(100% - 32px)); }
.pick-kicker { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; font-weight: 700; color: var(--accent); }
.pick-reel { display: grid; place-items: center; height: 220px; overflow: hidden; }
.pick-reel span { font-size: 1.7rem; font-weight: 760; letter-spacing: -0.03em; text-align: center; }
.pick-result { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 0 4px; text-align: center; }
.pick-name { font-size: 1.8rem; font-weight: 780; letter-spacing: -0.035em; }
.pick-result .meta { justify-content: center; }
.pick-why { color: var(--text-sub); font-size: 0.93rem; }
.pick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-top: 10px; }

/* 결과 이미지 공유 */
.share-dialog { width: min(480px, calc(100% - 32px)); }
.share-dialog h2 { font-size: 1.3rem; font-weight: 740; }
.share-preview { margin: 16px 0; }
.share-preview img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-input); }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ================= 내 부엌 ================= */
.kitchen-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; font-weight: 740; }
.panel-desc { margin-top: 4px; font-size: 0.88rem; color: var(--text-sub); }
.panel-sub { margin: 20px 0 8px; font-size: 0.95rem; font-weight: 700; }
.panel-empty { padding: 16px; border: 1px dashed var(--line); border-radius: var(--r-input); font-size: 0.9rem; color: var(--text-sub); }
.panel .note { margin-top: 10px; }

.month-nav { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.month-nav strong { min-width: 6.5em; text-align: center; font-size: 0.95rem; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; }
.stat { padding: 12px 14px; border-radius: var(--r-input); background: var(--surface-2); }
.stat dt { font-size: 0.78rem; color: var(--text-sub); }
.stat dd { white-space: nowrap; margin: 2px 0 0; font-size: 1.45rem; font-weight: 760; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat dd small { margin-left: 2px; font-size: 0.8rem; font-weight: 600; color: var(--text-sub); }
.stat:first-child { background: var(--accent-soft); }
.stat:first-child dd { color: var(--accent); }

.stamp-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.stamp-head { padding-bottom: 4px; text-align: center; font-size: 0.75rem; font-weight: 650; color: var(--text-faint); }
.stamp-cell { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--r-input); background: var(--bg); font-size: 0.8rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.stamp-cell.is-blank { background: none; }
.stamp-cell.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--text); font-weight: 700; }
.stamp-day { position: absolute; top: 4px; left: 6px; font-size: 0.7rem; }
.stamp-cell:not(.is-stamped) .stamp-day { position: static; font-size: 0.8rem; }
.stamp { position: relative; display: grid; place-items: center; width: 70%; aspect-ratio: 1; max-width: 40px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 1.1rem; transform: rotate(-12deg); }
.stamp b { position: absolute; right: -6px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--r-pill); background: var(--text); color: var(--bg); font-size: 0.68rem; line-height: 18px; transform: rotate(12deg); }

.log-list, .shop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.log-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px 4px 6px 10px; border-radius: var(--r-input); }
.log-list li:hover { background: var(--bg); }
.log-name { padding: 0; border: 0; background: none; color: var(--text); font-weight: 650; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.log-name:hover { color: var(--accent); }
.log-meta { font-size: 0.8rem; color: var(--text-faint); white-space: nowrap; }

.shop-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 12px; }
.shop-add input { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--bg); color: var(--text); font: inherit; font-size: 0.93rem; }
.shop-list { margin-bottom: 12px; }
.shop-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 2px 4px 2px 6px; border-radius: var(--r-input); }
.shop-list li:hover { background: var(--bg); }
.shop-check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.shop-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.shop-list .is-done .shop-check span { color: var(--text-faint); text-decoration: line-through; }

.plan-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.plan-hint { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; padding: 10px 14px; border-radius: var(--r-input); background: var(--surface-2); font-size: 0.86rem; color: var(--text-sub); }
.plan-hint .ph { margin-top: 3px; }
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.plan-list li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 8px; align-items: stretch; }
.plan-day { display: grid; place-items: center; border-radius: var(--r-input); background: var(--accent-soft); color: var(--accent); font-weight: 760; }
.plan-card { width: 100%; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--surface); color: var(--text); text-align: left; transition: border-color 0.2s var(--ease); }
.plan-card:hover { border-color: var(--accent); }
.plan-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plan-main strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.plan-meta { font-size: 0.8rem; color: var(--text-faint); }
.plan-buy, .plan-ok { display: flex; align-items: center; gap: 4px; font-size: 0.82rem; font-weight: 600; }
.plan-buy { color: var(--warn); }
.plan-ok { color: var(--accent); }
.plan-summary { display: grid; gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--text-sub); }
.plan-summary b { margin-right: 6px; color: var(--text); }
.plan-summary .btn { justify-self: start; margin-top: 4px; }

@media (max-width: 900px) {
  .kitchen-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .panel { padding: 16px; }
  .stats { gap: 6px; }
  .stat { padding: 10px; }
  .stat dd { font-size: 1.05rem; }
  .section-actions { margin-left: 0; }
}

/* ================= 추천 · 후기 · 모두의 레시피 하이라이트 ================= */
.card-likes { display: inline-flex; align-items: center; gap: 2px; margin-left: 2px; font-size: 0.8rem; font-weight: 650; color: var(--text-sub); }
.like-n { font-variant-numeric: tabular-nums; }

.cm-highlights { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.8fr); gap: 12px; margin-bottom: 20px; }
.cm-highlights.is-solo { grid-template-columns: minmax(0, 1fr); }
.hl-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.hl-challenge { background: var(--accent-soft); border-color: transparent; }
.hl-kicker { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 700; color: var(--accent); }
.hl-dday { margin-left: auto; padding: 0 8px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: 0.74rem; line-height: 20px; font-variant-numeric: tabular-nums; }
.hl-card h2 { font-size: 1.2rem; font-weight: 760; letter-spacing: -0.02em; }
.hl-text { font-size: 0.88rem; color: var(--text-sub); }
.hl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.hl-chef { font-size: 1.4rem; }
.hl-rank { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 2px; }
.hl-rank button { width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: var(--r-input); background: none; color: var(--text); text-align: left; }
.hl-rank button:hover { background: var(--bg); }
.hl-rank b { color: var(--accent); font-variant-numeric: tabular-nums; }
.hl-rank span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.hl-rank small { display: inline-flex; align-items: center; gap: 2px; font-size: 0.8rem; color: var(--text-sub); }

.cm-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 16px; padding: 10px 14px; border-radius: var(--r-input); background: var(--surface-2); font-size: 0.9rem; }
.cm-filter .btn-link { margin-left: auto; }

.reviews { margin-top: 28px; padding-top: 4px; }
.review-form { display: grid; gap: 8px; margin-bottom: 16px; }
.review-form textarea, .review-form input[type="text"] { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--bg); color: var(--text); font: inherit; font-size: 0.93rem; resize: vertical; }
.review-form-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.review-form-row input[type="text"] { min-height: 36px; padding-block: 0; }
.review-photo { cursor: pointer; }
.review-photo-name { min-height: 1em; font-size: 0.8rem; color: var(--text-sub); }
.review-login { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r-input); font-size: 0.9rem; color: var(--text-sub); }
.review-login .btn { margin-left: auto; }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.review { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-input); }
.review:not(:has(.review-img)) { grid-template-columns: minmax(0, 1fr); }
.review-img img { display: block; width: 88px; height: 88px; object-fit: cover; border-radius: var(--r-input); background: var(--surface-2); }
.review-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 0.84rem; color: var(--text-faint); }
.review-meta b { color: var(--text); font-size: 0.9rem; }
.review-meta .btn-link { margin-left: auto; font-size: 0.8rem; }
.review-body { margin-top: 4px; font-size: 0.93rem; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .cm-highlights { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .review-form-row { grid-template-columns: minmax(0, 1fr) auto; }
  .review-form-row [type="submit"] { grid-column: 1 / -1; }
  .review-img img { width: 72px; height: 72px; }
}

/* ================= 모바일 (767px 이하: 한 줄 배치) ================= */
@media (max-width: 767px) {
  .wrap { padding-inline: 16px; }
  .topbar-row { gap: 8px; height: 60px; }
  .brand-text { display: none; }
  .nav { gap: 0; }
  .nav-link { position: relative; padding: 0 9px; }
  .nav-text { display: none; }
  /* 개수 배지는 아이콘 위에 겹쳐서 메뉴 폭을 늘리지 않음 */
  .nav-count { position: absolute; top: 0; right: 0; min-width: 16px; padding: 0 4px; font-size: 0.62rem; line-height: 16px; }
  .user-email { display: none; }

  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; padding-bottom: 24px; }
  .hero-sub { font-size: 1rem; }
  .hero-cta { margin-top: 22px; }
  .picker { padding: 18px; }

  .dd-panel { left: 0; width: auto; }
  .dd-body { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .dd-cats { flex-direction: row; overflow-x: auto; padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .dd-cat { flex: none; }
  .dd-items { max-height: 45dvh; }
  .ing-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .picker-foot { flex-direction: column; align-items: flex-start; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .segmented { overflow-x: auto; }
  .cards, .fav-list, .related .cards { grid-template-columns: minmax(0, 1fr); }
  .empty { grid-template-columns: minmax(0, 1fr); padding: 22px; }

  .dialog-inner { padding: 22px 18px; }
  .r-title { font-size: 1.35rem; }
  .ings { grid-template-columns: minmax(0, 1fr); }
  .kcal { grid-template-columns: minmax(0, 1fr); }
  .cook-inner { padding: 18px 16px 112px; }
  .cook-nav { grid-template-columns: 1fr 1.6fr; }

  .recipe-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .recipe-aside { position: static; }
}

/* 로고 마크 (단순 도형) · 비활성 링크 버튼 */
.mark-body { fill: var(--accent); }
.mark-cut { fill: var(--bg); }
.btn-link:disabled { opacity: 0.4; text-decoration: none; }

/* 아주 좁은 화면 (360px 안팎): 상단 메뉴가 한 줄에 들어가도록 */
@media (max-width: 380px) {
  .nav-link { padding: 0 7px; }
  .topbar-row { gap: 6px; }
}
