:root {
  --bg: #faf8f5;
  --card: #ffffff;
  --text: #222;
  --muted: #777;
  --line: #e8e3dc;
  --accent: #d9480f;
  --accent-soft: #fff1e8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.5;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 24px 48px; }
@media (max-width: 520px) { .wrap { padding: 24px 16px 40px; } }

h1 { margin: 0; font-size: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 30px; letter-spacing: -0.02em; }
.brand em { font-style: normal; color: var(--accent); }
.brand-mark {
  display: grid; place-items: center; width: 44px; height: 44px; font-size: 24px;
  border-radius: 14px; background: var(--accent-soft); border: 1px solid #f3c9b3;
}
.sub { margin: 4px 0 24px; color: var(--muted); }

.search { display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0;
  padding: 14px 16px; font-size: 17px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card);
}
.search input:focus { outline: none; border-color: var(--accent); }

button {
  font: inherit; cursor: pointer;
  border: 0; border-radius: 12px;
  padding: 12px 20px; background: var(--accent); color: #fff; font-weight: 600;
}
button.ghost { background: transparent; color: var(--muted); padding: 6px 10px; }
button.ghost:hover { color: var(--accent); }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 16px 0 20px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 8px 12px; border-radius: 10px 10px 0 0; font-weight: 500;
  background: transparent; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.chip {
  padding: 6px 12px; font-size: 14px; font-weight: 500;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 999px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.options.grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.options.grid .option { padding: 12px 14px; }
.options.grid .option b { font-size: 16px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
}
.card h2 { margin: 0 0 4px; font-size: 20px; }
.card .hint { color: var(--muted); margin: 0 0 16px; font-size: 14px; }

.options { display: grid; gap: 10px; }
.option {
  text-align: left; background: var(--bg); color: var(--text); font-weight: 400;
  border: 2px solid var(--line); padding: 14px 16px;
}
.option:hover { border-color: var(--accent); background: var(--accent-soft); }
.option b { display: block; font-size: 17px; }
.option span { color: var(--muted); font-size: 14px; }

.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

.controls { clear: both; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 12px 0 16px; font-size: 14px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { border-radius: 0; padding: 6px 12px; background: var(--bg); color: var(--text); }
.stepper output { min-width: 56px; text-align: center; font-weight: 600; }
label.toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:nth-child(2), td:nth-child(2) { text-align: left; white-space: normal; }
td:nth-child(2) { min-width: 90px; word-break: keep-all; }
td.unit { white-space: normal; max-width: 320px; }
td.unit small { word-break: keep-all; }
th { font-size: 13px; color: var(--muted); font-weight: 500; }
td small { display: block; color: var(--muted); font-size: 12px; }
tr.group td { background: var(--bg); color: var(--muted); font-size: 13px; text-align: left !important; padding: 6px; }
tr.off td { color: #b5b0aa; }
tr.off td.cost { text-decoration: line-through; }
th.have, td.have { width: 44px; text-align: center; padding-left: 0; padding-right: 0; }
td.have input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
th.have { font-size: 11px; line-height: 1.2; }
.quick { display: inline-flex; gap: 4px; }
.quick .ghost { font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
td.cost { font-weight: 600; }
td.buy { font-weight: 600; color: var(--accent); }
td.buy small { font-weight: 400; }
tr.off td.buy { text-decoration: none; }
th.compare, td.compare { text-align: center; width: 124px; }
.shops-inline { display: none; }
.shops { display: grid; grid-template-columns: repeat(2, 56px); justify-content: center; gap: 4px; font-size: 12px; }
.shops a {
  display: block; width: 56px; padding: 2px 0; border: 1px solid var(--line); border-radius: 6px; text-align: center;
  color: var(--text); text-decoration: none; background: var(--card);
}
.shops a:hover { border-color: var(--accent); color: var(--accent); }

.total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 16px; padding: 16px; border-radius: 12px; background: var(--accent-soft);
}
.total b { font-size: 24px; color: var(--accent); }
.total small { color: var(--muted); }
.total.shop { margin-top: 8px; background: var(--bg); border: 1px solid var(--line); }
.total.shop b { font-size: 20px; color: var(--text); }

.empty { color: var(--muted); }


td small.src { font-size: 11px; }
td small.src.kamis { color: #2f7d4f; }
td small.src.mart { color: #2c63a8; }
td small.src.estimate { color: var(--muted); }
td small.src.mine { color: var(--accent); font-weight: 600; }

.edit-price {
  display: inline-block; margin-top: 3px; padding: 1px 6px; font-size: 11px; font-weight: 400;
  background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 6px;
}
.edit-price:hover { color: var(--accent); border-color: var(--accent); }
tr.edit-row td { background: var(--accent-soft); text-align: left; white-space: normal; padding: 10px; }
.price-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.price-form input { width: 90px; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.price-form button { padding: 6px 12px; font-size: 14px; }
.price-form .ghost { border: 1px solid var(--line); border-radius: 8px; }
.price-form small { flex-basis: 100%; color: var(--muted); font-size: 12px; }

.howto { margin-top: 20px; }
.howto-toggle {
  width: 100%; padding: 12px; font-size: 15px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #f3c9b3; border-radius: 12px;
}
.howto-toggle:hover { border-color: var(--accent); }
.howto-toggle[aria-expanded="true"] { background: var(--bg); color: var(--muted); border-color: var(--line); }
#howto-body { margin-top: 12px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.steps li {
  counter-increment: step; display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: start;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.steps li::before {
  content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
}
.steps p { margin: 3px 0 0; line-height: 1.6; }
.steps img { width: 160px; height: 110px; object-fit: cover; border-radius: 8px; }
.tip { margin: 12px 0 4px; padding: 12px 14px; border-radius: 12px; background: #eef7f0; color: #285d3b; line-height: 1.6; }
.tip b { margin-right: 6px; }
@media (max-width: 520px) {
  .steps li { grid-template-columns: 28px 1fr; }
  .steps img { grid-column: 2; width: 100%; height: auto; max-height: 200px; }
}

.recs { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.recs-head h3 { margin: 0 0 4px; font-size: 17px; }
.recs-head .hint { margin: 0; }
.recs-sub { margin: 18px 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rec-card {
  display: flex; flex-direction: column; gap: 8px; text-align: left; font-weight: 400;
  padding: 16px; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.rec-card, a.option { text-decoration: none; color: var(--text); }
a.option { display: block; border-radius: 12px; cursor: pointer; }
.rec-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(217,72,15,.12); transform: translateY(-1px); }
.rec-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.rec-role, .rec-famous { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.rec-role { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.rec-famous { background: #fff6dd; color: #9a6a00; }
.rec-name { font-size: 17px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-meter { display: block; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rec-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4caf72, #2f7d4f); }
.rec-meter-label { font-size: 12px; color: var(--muted); margin-top: -2px; }
.rec-meter-label b { color: #2f7d4f; }
.rec-row { display: grid; grid-template-columns: 64px 1fr; align-items: start; gap: 8px; }
.rec-label { font-size: 12px; color: var(--muted); padding-top: 3px; }
.rec-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.rec-chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.rec-chip.ok { background: #e8f5ec; color: #2f7d4f; }
.rec-chip.buy { background: var(--accent-soft); color: var(--accent); }
.rec-chip.none { background: var(--bg); color: var(--muted); }
.rec-chip.more { background: var(--bg); color: var(--muted); font-weight: 600; }
.rec-go { margin-top: auto; padding-top: 4px; font-size: 13px; color: var(--accent); font-weight: 600; text-align: right; }
.hint.section { margin: 20px 0 8px; font-weight: 600; }
.hint.note { margin: 10px 0 0; }
/* 건강 레시피 사진: 원본(대부분 320~600px)보다 크게 늘리지 않도록 제목 옆에 정사각형으로 */
.photo-box { float: right; width: 240px; margin: 0 0 12px 20px; }
.photo-box img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover; object-position: center;
  border-radius: 14px; background: var(--bg); border: 1px solid var(--line);
}
@media (max-width: 520px) {
  .photo-box { float: none; width: 100%; margin: 4px 0 12px; }
  .photo-box img { aspect-ratio: 4 / 3; }
}

footer { margin-top: 32px; font-size: 13px; color: var(--muted); }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; }

@media (max-width: 520px) {
  th.unit, td.unit { display: none; }
  table { font-size: 13px; }
  th, td { padding: 8px 3px; }
  th.have, td.have { width: 30px; }
  td:nth-child(2) { min-width: 76px; word-break: keep-all; }
  /* 좁은 화면: '가격 비교' 칸 대신 재료 이름 아래에 가로로 */
  th.compare, td.compare { display: none; }
  .shops-inline { display: block; margin-top: 4px; }
  .shops-inline .shops { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 3px; font-size: 11px; }
  .shops-inline .shops a { width: auto; padding: 1px 5px; }
  td small { font-size: 11px; }
  /* 탭은 한 줄로 두고 옆으로 밀어서 넘기기 */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }
}

/* 홈의 전체 요리 목록 (사이트 만들기에서 넣습니다) */
.all-dishes { margin-top: 32px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.all-dishes h2 { margin: 0 0 12px; font-size: 17px; }
.all-dishes div { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.all-dishes h3 { flex-basis: 100%; margin: 0 0 2px; font-size: 13px; color: var(--muted); font-weight: 600; }
.all-dishes a { color: var(--text); text-decoration: none; font-size: 14px; }
.all-dishes a:hover { color: var(--accent); text-decoration: underline; }
