:root {
  --green: #2e9c5b;
  --green-dark: #237544;
  --green-soft: #e8f6ee;
  --bg: #f6f8f7;
  --card: #ffffff;
  --text: #1f2a24;
  --muted: #6b776f;
  --border: #e3e9e5;
  --shadow: 0 2px 12px rgba(31, 42, 36, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Pretendard", "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── Header ─────────────────────────────── */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--green-dark);
  display: flex;
  align-items: center;
  cursor: pointer;
}
.logo span { color: var(--green); }
/* 영양(비타민 휠) 벡터 로고 아이콘 — 각 칸에 식품 이모지, 중앙 ND */
.logo-mark {
  width: 52px;
  height: 52px;
  flex: none;
  margin-right: 9px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3));
}
.logo-mark-emoji text {
  font-size: 17px;
}
.logo-mark-text {
  fill: var(--green-dark);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.search-box {
  flex: 1;
  max-width: 360px;
  min-width: 200px;
  margin-left: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  position: relative;
}
/* 즐겨찾기 아이콘 — 헤더 오른쪽 끝 */
.fav-btn {
  margin-left: auto;
  flex-shrink: 0;
  min-width: 48px;
  padding: 5px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.fav-btn .fav-icon { font-size: 1.15rem; line-height: 1; }
.fav-btn .fav-label { font-size: 0.62rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.fav-btn:hover { background: var(--green-soft); border-color: var(--green); transform: translateY(-1px); }
.fav-btn.on { background: var(--green-soft); border-color: var(--green); }
/* 검색 미리보기(자동완성) */
.search-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 80;
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(31, 42, 36, 0.14);
}
.sg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text);
}
.sg-item:hover { background: var(--green-soft); }
.sg-item .sg-emoji { font-size: 1.2rem; }
.sg-item .sg-name { font-weight: 600; }
.sg-item .sg-tag {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 6px;
  padding: 2px 8px;
}
.sg-empty {
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.95rem;
  color: var(--text);
}
.search-btn {
  flex-shrink: 0;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  transition: background 0.15s;
  white-space: nowrap;
}
.search-btn:hover { background: var(--green-dark); }
.search-btn:active { transform: scale(0.97); }

/* ── Layout ─────────────────────────────── */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 24px;
}

/* ── Category chips ─────────────────────── */
.categories {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 14px 7px 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.15s;
}
.chip:hover { border-color: var(--green); color: var(--green-dark); }
.chip.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.chip-emoji { font-size: 1.05rem; }
/* 홈 칩(이모지)은 가로 폭을 조금만 줄임 */
.chip[data-cat="all"] { padding-left: 12px; padding-right: 11px; gap: 5px; }
.chip-imgs { display: inline-flex; flex: none; align-items: center; gap: 2px; }
.chip-imgs .chip-emo { font-size: 1.05rem; line-height: 1; }

.list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  /* 품종 박스와 동일한 테두리 (배경색은 기존 그대로 유지) */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.section-sub {
  color: var(--muted);
  font-size: 0.88rem;
}

/* 정렬 / 바로가기 selectbox */
.header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.sort-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sort-box select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 320px;
  background-color: #fff;
  border: 2px solid var(--green);
  border-radius: 12px;
  padding: 12px 46px 12px 22px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-dark);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(46, 156, 91, 0.25);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  /* 커스텀 화살표 */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%232e9c5b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 18px center;
}
.sort-box select:hover {
  background-color: var(--green-soft);
  box-shadow: 0 6px 18px rgba(46, 156, 91, 0.32);
  transform: translateY(-1px);
}
.sort-box select:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--green-soft), 0 3px 10px rgba(46, 156, 91, 0.2);
}

/* 바로가기 커스텀 드롭다운 (사진 썸네일) */
.jump-select { position: relative; }
.jump-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 320px;
  width: 100%;
  background-color: #fff;
  border: 2px solid var(--green);
  border-radius: 12px;
  padding: 8px 44px 8px 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-dark);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(46, 156, 91, 0.25);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.jump-toggle:hover { background-color: var(--green-soft); }
.jump-current { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.jump-placeholder { color: var(--green-dark); }
.jump-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--green);
}
.jump-select.open .jump-arrow { transform: translateY(-50%) rotate(180deg); }
.jump-thumb {
  display: inline-flex;
  flex: none;
  width: 30px;
  height: 30px;
}
.jump-thumb .food-illust {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 1.05rem;
}
.jump-thumb { font-size: 1.3rem; align-items: center; justify-content: center; }

.jump-list {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}
.jump-select.open .jump-list { display: block; }
.jump-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.jump-item:hover { background: var(--green-soft); }
.jump-item.sel { background: var(--green-soft); color: var(--green-dark); }
.jump-item-name { line-height: 1.3; }

/* ── 소개(히어로) ───────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  border-radius: 18px;
  padding: 36px 32px;
  margin-bottom: 26px;
  box-shadow: 0 8px 24px rgba(35, 117, 68, 0.22);
}
.hero-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
}
.hero-tile {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: center;
  justify-items: center;
  gap: 1px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.hero-tile span { font-size: 0.95rem; line-height: 1; }
.hero-title {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.35;
  margin: 0;
}
.hero-desc {
  font-size: 0.98rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.92);
  max-width: 720px;
}
@media (max-width: 520px) {
  .hero { padding: 26px 22px; }
  .hero-title { font-size: 1.1rem; }
  .hero-tile { width: 42px; height: 42px; }
  .hero-head { gap: 14px; }
}

/* ── 카테고리 정보 박스 ─────────────────── */
.info-box {
  background: linear-gradient(135deg, var(--green-soft) 0%, #ffffff 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.info-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: 8px;
}
.info-title .chip-imgs { gap: 6px; }
.info-title .chip-imgs .chip-emo { font-size: 1.4rem; }
.info-desc {
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 6px;
}
.info-desc:last-of-type { margin-bottom: 0; }
.info-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.info-tips li {
  position: relative;
  padding-left: 22px;
  font-size: 0.88rem;
  color: var(--muted);
}
.info-tips li::before {
  content: "✔";
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

/* ── 카테고리 카드 (메인) ───────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
@media (max-width: 900px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
.cat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.cat-card .cat-collage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7e6 0%, #eef9f1 60%, #fdeef3 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}
/* 이모지를 작은 입체 타일에 담아 표시 (그림자로 깊이감, 선명한 자체 표현) */
.cat-card .cat-collage span {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 1.55rem;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.14), inset 0 0 0 1px rgba(0, 0, 0, 0.04);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cat-card .cat-collage span:hover {
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.cat-card .cat-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 6px;
}
.cat-card .cat-count {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 2px 10px;
  margin-top: 6px;
}
.cat-card .cat-brief {
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 7px;
  text-align: left;
}

/* ── Food grid ──────────────────────────── */
.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.food-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
}
.food-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(31,42,36,0.1); }
.food-card .emoji { font-size: 2.2rem; }
.food-card .emoji { text-align: center; }
/* 식품 이모지를 입체 색조 타일에 담아 표시 (그림자로 깊이감 + 선명한 자체 표현) */
.food-illust {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, hsl(var(--ih, 90) 70% 90%), hsl(var(--ih, 90) 60% 74%));
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  text-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.2);
  vertical-align: middle;
}
.food-card .emoji .food-illust { width: 66px; height: 66px; font-size: 2rem; }
.detail-head .emoji .food-illust { width: 104px; height: 104px; font-size: 3.2rem; border-radius: 18px; }
.food-card .fname { font-weight: 700; font-size: 1.05rem; margin-top: 6px; }
.food-card .fcat {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 6px;
  padding: 2px 8px;
  margin-top: 6px;
}
.food-card .fdesc {
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text);
  margin-top: 10px;
}
.food-card .fkcal { color: var(--muted); font-size: 0.85rem; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.compare-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compare-toggle.on { background: var(--green); border-color: var(--green); color: #fff; }
.fav-remove {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #f2c2c2;
  background: #fff;
  color: #d9534f;
  font-size: 0.85rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.fav-remove:hover { background: #d9534f; border-color: #d9534f; color: #fff; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
}

/* ── Detail view ────────────────────────── */
.detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.detail-head .emoji { font-size: 3.4rem; }
.detail-head h2 { font-size: 1.6rem; }
.detail-head h2 .name-variety {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}
.detail-head .serving { color: var(--muted); font-size: 0.9rem; }
.detail-head .origin {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
}
.detail-head .origin .brix-variety { color: var(--muted); font-size: 0.82rem; }
.detail-head .origin .origin-label {
  display: inline-block;
  font-weight: 700;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 8px;
  padding: 2px 8px;
  margin-right: 6px;
}
/* 위키백과식 상세 페이지 */
.encyclopedia { max-width: 100%; }
.varieties {
  background: var(--green-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
}
.var-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.var-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--green-dark);
}
/* 즐겨찾기 / 좋아요 액션 버튼 */
.item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.act-btn {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(31, 42, 36, 0.12);
  transition: all 0.15s;
}
.act-btn:hover { border-color: var(--green); color: var(--green-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(31, 42, 36, 0.18); }
.act-btn:active { transform: translateY(0); }
.act-btn.on { background: #fff; border-color: var(--green); color: var(--green-dark); }
.act-btn.like.on { background: #fff; border-color: #e85b5b; color: #c0392b; }
.var-chips-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.var-chips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.var-chips-row .header-controls { flex-shrink: 0; }
.var-head .header-controls { flex-shrink: 0; }
.var-chips-row .item-actions { flex-shrink: 0; }
.var-chip {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-dark);
  background: #fff;
  border: 1px solid var(--green);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.var-chip:hover { background: var(--green-soft); }
.var-chip.active {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #1f2937;
  font-weight: 700;
}
.encyclo-heading {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  padding-bottom: 8px;
  margin: 28px 0 14px;
  border-bottom: 2px solid var(--green);
}
.encyclo-heading .heading-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.food-desc {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}
.head-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 4px;
}
.head-row .detail-head { flex: 1; min-width: 0; margin-bottom: 0; }
.detail-ad {
  flex: 0 0 300px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: repeating-linear-gradient(45deg, #f4f7f5, #f4f7f5 12px, #eef3f0 12px, #eef3f0 24px);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.5;
}
@media (max-width: 760px) {
  .head-row { flex-direction: column; }
  .detail-ad { flex-basis: auto; width: 100%; }
  /* 품종 영역: 상단줄(품종 라벨 + 즐겨찾기/좋아요)은 가로 유지, 셀렉트박스는 아래 풀폭 */
  .var-head { align-items: center; gap: 8px; }
  .var-chips-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .var-chips-row .header-controls,
  .var-chips-row .sort-box,
  .var-chips-row .jump-select { width: 100%; }
  .var-chips-row .jump-toggle { min-width: 0; width: 100%; }
  /* 품종 칩 크기 축소 (모바일/태블릿) */
  .var-chips .var-chip { font-size: 0.72rem; font-weight: 600; padding: 3px 8px; border-radius: 7px; }
  /* 즐겨찾기/좋아요 버튼: 더 작고 선명하게 */
  .act-btn {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 4px 9px;
    gap: 3px;
    box-shadow: 0 1px 3px rgba(31, 42, 36, 0.18);
  }
  .item-actions { gap: 6px; }
}
.encyclo-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.95rem;
}
.encyclo-table thead th {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
  text-align: left;
  padding: 12px 18px;
}
.encyclo-table thead th:nth-child(2),
.encyclo-table thead th:nth-child(3) { text-align: right; }
.encyclo-table thead th:nth-child(4) { text-align: left; }
.encyclo-table td.feat {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
  width: 32%;
}
.encyclo-table td.extra-val {
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 600;
}
.extra-table tbody th { width: 24%; }
.encyclo-table tbody th,
.encyclo-table tbody td {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.encyclo-table tbody tr:hover { background: #f4faf6; }
.encyclo-table tbody th {
  font-weight: 700;
  color: var(--text);
  text-align: left;
  width: 18%;
}
.encyclo-table td.val { text-align: right; font-weight: 800; color: var(--text); white-space: nowrap; width: 16%; }
.encyclo-table td.val .unit { font-weight: 600; color: var(--muted); font-size: 0.82rem; margin-left: 3px; }
.encyclo-table td.dv { text-align: right; color: var(--green-dark); font-weight: 700; width: 22%; }

/* 열량 강조 행 */
.encyclo-table tr.row-cal th { font-size: 1.05rem; font-weight: 800; color: var(--text); }
.encyclo-table tr.row-cal td.val { font-size: 1.15rem; color: var(--green-dark); }
.encyclo-table tr.row-cal { background: var(--green-soft); }

/* 탄수화물 하위 항목(식이섬유·당류) 들여쓰기 */
.encyclo-table tr.row-sub th {
  padding-left: 34px;
  font-weight: 500;
  position: relative;
}
.encyclo-table tr.row-sub th::before {
  content: "└";
  position: absolute;
  left: 18px;
  color: var(--muted);
}

/* 1일 기준치 대비 막대 */
.dv-pct { display: inline-block; min-width: 36px; }
.dv-bar {
  display: block;
  width: 96px;
  margin: 5px 0 0 auto;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.dv-bar > span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 3px;
}
.dv-na { color: var(--muted); }
/* 성분·효과 */
.effects {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.effect-block {
  background: var(--green-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.effect-block h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: 6px;
}
.effect-block p {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
}
.effect-block p + p { margin-top: 8px; }
/* 주의 사항 */
.caution-list {
  list-style: none;
  background: #fff8ec;
  border: 1px solid #f5e2bf;
  border-left: 4px solid #e6a23c;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.caution-list li {
  position: relative;
  padding-left: 24px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #6b5b3a;
}
.caution-list li::before {
  content: "⚠️";
  position: absolute;
  left: 0;
  top: 0;
}

.source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.source-note {
  font-size: 0.8rem;
  color: var(--muted);
}
.to-top {
  flex-shrink: 0;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: none;
  background: var(--green);
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 3px 10px rgba(46, 156, 91, 0.3);
  transition: background 0.15s, transform 0.1s;
}
.to-top .to-top-label { font-size: 0.78rem; font-weight: 700; }
.to-top:hover { background: var(--green-dark); transform: translateY(-2px); }
.to-top:active { transform: translateY(0); }

/* ── Compare bar + view ─────────────────── */
.compare-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--green-dark);
  color: #fff;
  padding: 14px 20px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 60;
}
.compare-bar.show { display: flex; }
.compare-bar .items { font-size: 0.9rem; }
.compare-bar button {
  background: #fff;
  color: var(--green-dark);
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700;
}
.compare-bar .clear {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.5);
}
.compare-wrap { overflow-x: auto; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 480px;
}
.compare-table th, .compare-table td {
  padding: 12px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.compare-table th:first-child, .compare-table td:first-child {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}
.compare-table thead th {
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 1rem;
}
.compare-table td.best { background: var(--green-soft); font-weight: 800; color: var(--green-dark); }

/* ── 정적 콘텐츠 페이지 ─────────────────── */
.static-page {
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: var(--shadow);
}
.page-title {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--green-dark);
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--green);
}
.page-lead {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--green-soft);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 22px;
}
.page-h {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text);
  margin: 26px 0 10px;
}
.static-page p {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 10px;
}
.page-list {
  list-style: none;
  margin: 8px 0 10px;
}
.page-list li {
  position: relative;
  padding-left: 18px;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
}
.page-list li::before {
  content: "•";
  position: absolute;
  left: 2px;
  color: var(--green);
  font-weight: 700;
}
.page-list li strong { color: var(--green-dark); }
.page-meta {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem !important;
  color: var(--muted) !important;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 10px 20px 24px;
  border-top: none;
  background: #fff;
}
.footer-ad {
  max-width: 1040px;
  margin: 0 auto 10px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: none;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-bottom: 12px;
}
.footer-links a {
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  position: relative;
  transition: color 0.15s;
}
.footer-links a:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -11px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 11px;
  background: var(--border);
}
.footer-links a:hover { color: var(--green-dark); }
.footer-note { font-size: 0.78rem; color: var(--muted); margin-bottom: 12px; }
.footer-copy {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 8px;
}

@media (max-width: 520px) {
  /* 로고 + 검색창 + 즐겨찾기를 한 줄에 유지 (검색창이 남은 폭을 최대한 차지) */
  .header-inner { flex-wrap: nowrap; gap: 8px; padding: 12px 14px; }
  .logo { font-size: 1.05rem; }
  .logo-mark { width: 36px; height: 36px; margin-right: 5px; }
  .search-box {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin-left: 6px;
    padding: 8px 12px;
  }
  .search-box input { min-width: 0; text-overflow: ellipsis; }
  .search-btn { display: none; }
  .fav-btn { min-width: 40px; padding: 4px 5px; }
  .detail-head h2 { font-size: 1.3rem; }
  /* 품종/카테고리 안내 괄호 문구는 모바일에서 숨겨 한 줄로 */
  .var-hint { display: none; }
  /* 검색 추천 결과 레이어: 좁은 검색창 폭에 갇히지 않고 화면 폭으로 넓게 표시 */
  .search-suggest {
    position: fixed;
    top: 60px;
    left: 22px;
    right: 22px;
    max-height: 64vh;
  }
}
