:root {
  --bg: #fbf7f0;
  --paper: #ffffff;
  --ink: #2b211a;
  --ink2: #3d2a1d;   /* 보조 글자: 짙은 갈색(회색 아님) */
  --muted: #6b3f1d;  /* 덜 중요한 글자: 밤색. 흰 바탕 대비 약 9:1 */
  --line: #ebe1d3;
  --crust: #b5651d;
  --crust-d: #8a4b1f;
  --crumb: #f6ead6;
  --butter: #fff4d6;
  --warn: #b3261e;
  --warn-bg: #fdecea;
  --ok: #2f6b3a;
  --ok-bg: #e8f3ea;
  --info-bg: #eef3fb;
  --info: #2a4f86;
  --r: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 18px rgba(60, 40, 20, .06);
  /* 글꼴은 서버가 보낸다(web/fonts, tools/build_fonts.py) → OS·브라우저가 달라도 같은 글꼴 */
  font-family: "BreadSans", sans-serif;
}
* { box-sizing: border-box; }
button, input, select, textarea { font-family: inherit; }
::placeholder { color: #8a5a34; opacity: 1; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.65; word-break: keep-all; overflow-wrap: anywhere; }
a { color: var(--crust-d); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; margin-top: 1.6em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }

/* 머리 */
.top { position: sticky; top: 0; z-index: 20; background: rgba(251, 247, 240, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt b { font-size: 1.25rem; color: var(--crust-d); }
.brand-txt small { font-size: .72rem; color: var(--muted); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 7px 12px; border-radius: 999px; color: var(--ink2); font-weight: 600; font-size: .95rem; }
.nav a:hover { background: var(--crumb); text-decoration: none; }
.nav a.on { background: var(--crust-d); color: #fff; }
.search-wrap { margin-left: auto; flex: 1 1 140px; max-width: 240px; }
.search-wrap input, .field input, .field select { width: 100%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font: inherit; font-size: .95rem; color: var(--ink); }
.field select, .field input { border-radius: 10px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--crust); outline-offset: 1px; }

main { padding-top: 26px; padding-bottom: 60px; min-height: 70vh; }
.foot { border-top: 1px solid var(--line); padding: 22px 0 40px; color: var(--ink2); font-size: .9rem; background: #f6efe4; }
/* 바닥글 아래 사업자 정보·접속자 수 (목공툰·woodtools 와 같은 내용). 회색 대신 밤색(--muted) */
.foot-site { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); }
.foot-site p { margin: 0; }
.foot-biz { font-size: .78rem; line-height: 1.7; }
.foot-copy { font-size: .74rem; margin-top: 2px; }
.foot-site a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* 홈 */
.hero { background: linear-gradient(135deg, #f3dfbf 0%, #f9eedb 60%, #fff8ec 100%); border-radius: 22px; padding: 38px 34px; margin-bottom: 30px; position: relative; overflow: hidden; }
.hero h1 { font-size: 2.1rem; }
.hero p { font-size: 1.05rem; color: var(--ink2); max-width: 640px; }
.hero .stats { display: flex; gap: 26px; margin-top: 18px; flex-wrap: wrap; }
.hero .stats div { font-size: .9rem; color: var(--ink2); }
.hero .stats b { display: block; font-size: 1.7rem; color: var(--crust-d); }
.hero-art { position: absolute; right: -20px; bottom: -30px; width: 260px; opacity: .9; pointer-events: none; }
@media (max-width: 760px) { .hero-art { display: none; } .hero { padding: 26px 20px; } .hero h1 { font-size: 1.6rem; } }

.steps-road { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 10px 0 8px; counter-reset: road; }
.steps-road a { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; color: var(--ink); counter-increment: road; position: relative; padding-left: 52px; }
.steps-road a::before { content: counter(road); position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; border-radius: 50%; background: var(--crust); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .85rem; }
.steps-road a:hover { border-color: var(--crust); text-decoration: none; }
.steps-road small { display: block; color: var(--muted); font-size: .82rem; }

/* 카드·그리드 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; color: var(--ink); display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
a.card:hover { text-decoration: none; border-color: var(--crust); transform: translateY(-2px); }
.card h3 { margin: 0; font-size: 1.07rem; }
.card .en { color: var(--muted); font-size: .8rem; }
.card p { margin: 0; color: var(--ink2); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; font-size: .8rem; color: var(--muted); align-items: center; }
.cat-tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; gap: 12px; align-items: center; color: var(--ink); }
.cat-tile:hover { border-color: var(--crust); text-decoration: none; }
.cat-tile .dot { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; }
.cat-tile b { display: block; }
.cat-tile small { color: var(--muted); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--crumb); color: var(--crust-d); white-space: nowrap; }
.badge.new { background: var(--info-bg); color: var(--info); }
.badge.lv-필수 { background: #fde3c8; color: #8a3d0b; }
.badge.lv-있으면 { background: var(--ok-bg); color: var(--ok); }
.badge.lv-중급 { background: var(--info-bg); color: var(--info); }
.badge.lv-업소 { background: #ece4f7; color: #4b2a82; }
.stars { color: var(--crust-d); letter-spacing: 1px; font-size: .85rem; white-space: nowrap; }
.stars i { color: var(--crust); font-style: normal; }

/* 목록 필터 */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin: 6px 0 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); min-width: 140px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 16px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 13px; font: inherit; font-size: .88rem; color: var(--ink2); cursor: pointer; }
.chip:hover { border-color: var(--crust); }
.chip.on { background: var(--crust-d); border-color: var(--crust-d); color: #fff; }
.chip small { margin-left: 3px; font-weight: 700; color: var(--crust-d); }
.chip.on small { color: #fff; }
.count-line { color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--paper); border: 1px dashed var(--line); border-radius: var(--r); }
.group-h { margin: 28px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.group-h h2 { margin: 0; }

/* 상세 */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.detail-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: start; }
.detail-head .en { color: var(--muted); margin-top: -4px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 18px 0; }
.fact { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.fact small { display: block; color: var(--muted); font-size: .76rem; }
.fact b { font-size: .98rem; }
.lead { font-size: 1.05rem; color: var(--ink2); }
.two { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 26px; align-items: start; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }
.sticky { position: sticky; top: 84px; }
@media (max-width: 900px) { .sticky { position: static; } }

.scaler { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: .9rem; }
.scaler button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 10px; font: inherit; cursor: pointer; }
.scaler button.on { background: var(--crust-d); color: #fff; border-color: var(--crust-d); }
.scaler input { width: 84px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
table.ing { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.ing th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; padding: 4px 4px 6px; border-bottom: 1px solid var(--line); }
table.ing td { padding: 7px 4px; border-bottom: 1px dashed var(--line); vertical-align: top; }
table.ing td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
table.ing td.pct { text-align: right; color: var(--muted); white-space: nowrap; font-size: .82rem; font-variant-numeric: tabular-nums; }
table.ing td .note { display: block; color: var(--muted); font-size: .8rem; }
table.ing tr.grp td { border-bottom: none; padding-top: 14px; font-weight: 800; color: var(--crust-d); font-size: .88rem; }
table.ing tr.sum td { border-bottom: none; color: var(--muted); font-size: .82rem; }
.tool-links { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-links a { background: var(--crumb); padding: 3px 10px; border-radius: 999px; font-size: .85rem; }

ol.steps { list-style: none; padding: 0; margin: 0; counter-reset: st; }
ol.steps > li { counter-increment: st; position: relative; padding: 14px 0 14px 50px; border-bottom: 1px solid var(--line); }
ol.steps > li:last-child { border-bottom: none; }
ol.steps > li::before { content: counter(st); position: absolute; left: 0; top: 14px; width: 34px; height: 34px; border-radius: 50%; background: var(--crumb); color: var(--crust-d); font-weight: 800; display: grid; place-items: center; }
ol.steps > li.done::before { content: "✓"; background: var(--ok); color: #fff; }
ol.steps > li.done { background: #f1f8f2; }
ol.steps > li.done .st-top h3 { color: var(--ok); text-decoration: line-through; text-decoration-thickness: 2px; }
.st-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; cursor: pointer; }
.st-top h3 { margin: 0; font-size: 1.05rem; }
.st-tag { font-size: .76rem; padding: 1px 8px; border-radius: 999px; background: var(--butter); color: #7a5a10; }
.st-tag.temp { background: #fde7e3; color: #9a3412; }
.st-body p { margin: 6px 0 0; }
.tip { margin-top: 8px; background: var(--ok-bg); color: #24502c; border-radius: 10px; padding: 8px 12px; font-size: .9rem; }
.tip b { margin-right: 4px; }
.timer-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 1px 10px; font: inherit; font-size: .76rem; cursor: pointer; color: var(--ink2); }
.timer-btn.run { background: var(--crust); color: #fff; border-color: var(--crust); }

.box { border-radius: var(--r); padding: 14px 18px; margin: 14px 0; }
.box h3 { margin: 0 0 6px; font-size: 1rem; }
.box ul { margin: 0; padding-left: 20px; }
.box li { margin: 3px 0; }
.box.warn { background: var(--warn-bg); color: #5f1712; }
.box.warn h3 { color: var(--warn); }
.box.ok { background: var(--ok-bg); color: #1f4527; }
.box.ok h3 { color: var(--ok); }
.box.info { background: var(--info-bg); color: #1d3557; }
.box.info h3 { color: var(--info); }
.box.butter { background: var(--butter); color: #4a3a12; }

.ts { display: grid; gap: 10px; }
.ts details { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.ts summary { cursor: pointer; font-weight: 700; }
.ts dl { margin: 8px 0 0; display: grid; grid-template-columns: 52px 1fr; gap: 4px 10px; font-size: .93rem; }
.ts dt { color: var(--muted); }
.ts dd { margin: 0; }

ul.plain { padding-left: 20px; margin: 0; }
ul.plain li { margin: 4px 0; }
ol.howto { padding-left: 22px; margin: 0; }
ol.howto li { margin: 6px 0; padding-left: 4px; }
.sources { font-size: .85rem; color: var(--muted); }
.sources a { word-break: break-all; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: .9rem; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--crust); }
.btn.on { background: var(--butter); border-color: #e6c766; }
.btn.primary { background: var(--crust-d); color: #fff; border-color: var(--crust-d); }

/* 가이드 */
.guide-body h2 { border-left: 4px solid var(--crust); padding-left: 10px; }
.tbl-wrap { overflow-x: auto; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table.tbl { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.tbl th { background: var(--crumb); text-align: left; padding: 8px 12px; white-space: nowrap; font-size: .84rem; }
table.tbl td { padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.toc { font-size: .9rem; }
.toc a { display: block; padding: 3px 0; color: var(--ink2); }

/* 계산기 */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.calc .row { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.calc .row .field { flex: 1 1 120px; }
.calc .result { margin-top: 10px; background: var(--butter); border-radius: 10px; padding: 10px 14px; font-size: 1rem; }
.calc .result b { color: var(--crust-d); font-size: 1.25rem; }
.calc .explain { font-size: .85rem; color: var(--muted); margin-top: 8px; }

/* 검색 결과 */
.sr-sec h2 { margin-top: 1em; }
mark { background: #ffe9a8; color: inherit; border-radius: 3px; padding: 0 1px; }

.timer-float { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: flex; flex-direction: column; gap: 8px; }
.timer-float div { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: .9rem; display: flex; gap: 10px; align-items: center; }
.timer-float b { font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.timer-float button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; cursor: pointer; font: inherit; font-size: .8rem; padding: 2px 8px; }
.timer-float .ring { background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .6; } }

@media print {
  .top, .foot, .actions, .scaler, .timer-btn, .timer-float, .crumbs { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; }
  .two { grid-template-columns: 1fr; }
}

/* 좁은 화면 */
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .top-in { padding: 8px 14px; gap: 8px; }
  .nav { order: 3; flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 6px 11px; }
  .search-wrap { order: 2; max-width: none; flex: 1 1 120px; min-width: 0; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 1.55rem; }
  .panel { padding: 14px; }
  ol.steps > li { padding-left: 42px; }
  .calc-grid { grid-template-columns: minmax(0, 1fr); }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .two { gap: 16px; }
}
table.tbl td.nw { white-space: nowrap; }

/* 식사빵 */
.badge.meal { background: #e8efd9; color: #45602a; border-color: #c9d8ae; }
.chip.meal { border-color: #b9cc98; }
.chip.meal.on { background: #5f7a3a; border-color: #5f7a3a; }
.cat-tile.meal { border-color: #c9d8ae; background: #f6f9ef; }
/* 건강빵 */
.badge.health { background: #dcefe9; color: #23604f; }
.chip.health { border-color: #a9d1c5; }
.chip.health.on { background: #2f7a6b; border-color: #2f7a6b; }
.cat-tile.health { border-color: #b9dbd1; background: #f1f8f5; }
.box.health { background: #eef7f3; border-color: #cfe6dd; }
.box.health h3 { color: #23604f; }
/* 참고 사진 */
.card-photo { margin: -16px -18px 6px; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--r) var(--r) 0 0; background: #f3ece2; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
figure.photo { margin: 14px 0 6px; }
figure.photo img { display: block; max-width: 100%; max-height: 440px; border-radius: var(--r); border: 1px solid var(--line); background: #f3ece2; }
figure.photo figcaption { font-size: .78rem; color: var(--muted); margin-top: 6px; line-height: 1.5; word-break: break-all; }
figure.photo figcaption a { color: var(--muted); text-decoration: underline; }
figure.photo .similar { color: var(--crust-d); font-weight: 700; word-break: keep-all; }
@media print { .card-photo { display: none; } figure.photo img { max-height: 260px; } }
/* 언어 메뉴 */
.lang-wrap { flex: none; position: relative; }
#lang { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
#lang:hover, #lang[aria-expanded="true"] { border-color: var(--crust-d); }
#lang.busy { cursor: progress; }
#lang.busy .caret { border: 2px solid var(--line); border-top-color: var(--crust-d); border-radius: 50%; width: 10px; height: 10px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#lang .caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--ink); margin-left: 2px; }
.flag { width: 20px; height: 15px; flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); object-fit: cover; display: block; }
.zh-badge { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 800; line-height: 1; box-shadow: none; }
.zh-badge[lang="zh-Hans"] { background: var(--crust-d); font-family: "BreadSansSC", sans-serif; }
.zh-badge[lang="zh-Hant"] { background: #23604f; font-family: "BreadSansTC", sans-serif; }
#langlist { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 100%; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(60, 35, 15, .18); }
#langlist[hidden] { display: none; }
#langlist li { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 8px; color: var(--ink); font-size: .92rem; font-weight: 600; white-space: nowrap; cursor: pointer; outline: none; }
#langlist li:hover, #langlist li:focus { background: #f6ece0; }
#langlist li[aria-selected="true"] { color: var(--crust-d); font-weight: 800; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* 메뉴 글자가 긴 언어: 첫 줄 로고·검색·언어, 둘째 줄 메뉴 */
.long-nav .nav { order: 3; width: 100%; }
.long-nav .brand { margin-right: auto; }
.long-nav .search-wrap { margin-left: 0; }
