:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece4;
  --text: #22231f;
  --muted: #6a6b64;
  --line: #ddd8cc;
  --accent: #2f6b4f;
  --accent-soft: #e2efe7;
  --slang: #9a4b12;
  --slang-soft: #fbeadb;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --radius: 12px;
  --topbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161714; --surface: #1f201c; --surface-2: #2a2b26; --text: #ecebe5; --muted: #a3a39a;
    --line: #36372f; --accent: #7cc4a0; --accent-soft: #23362c; --slang: #f0a46a; --slang-soft: #3a2a1d;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #161714; --surface: #1f201c; --surface-2: #2a2b26; --text: #ecebe5; --muted: #a3a39a;
  --line: #36372f; --accent: #7cc4a0; --accent-soft: #23362c; --slang: #f0a46a; --slang-soft: #3a2a1d;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.65; font-size: 15px;
  word-break: keep-all; overflow-wrap: anywhere;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: var(--surface); font-size: 16px;
}
.search-wrap { flex: 1; max-width: 560px; }
#search {
  width: 100%; height: 40px; padding: 0 14px; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid transparent; border-radius: 999px; outline: none;
}
#search:focus { border-color: var(--accent); background: var(--surface); }
.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.topnav a:hover { background: var(--surface-2); text-decoration: none; }
.topnav a.active { color: var(--accent); background: var(--accent-soft); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); max-width: 1280px; margin: 0 auto; }
.sidebar {
  position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 20px 12px; border-right: 1px solid var(--line);
}
.sidebar h2 { font-size: 12px; color: var(--muted); letter-spacing: .04em; margin: 4px 10px 8px; font-weight: 500; }
.cat-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text); font-size: 14px;
}
.cat-link:hover { background: var(--surface-2); text-decoration: none; }
.cat-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.cat-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.cat-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.content { padding: 28px 32px 64px; min-width: 0; outline: none; }

/* ---------- home ---------- */
.hero h1 { font-size: 28px; margin: 0 0 6px; }
.hero p { margin: 0; color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); }
.stat b { color: var(--text); }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; }
.section-title h2 { margin: 0; font-size: 20px; }
.section-title span { color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: var(--text); box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.thumb { aspect-ratio: 4 / 3; background: var(--surface-2); position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
  font-size: 34px; font-weight: 700; letter-spacing: -.02em;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.08) 0 10px, transparent 10px 20px);
}
.placeholder small { position: absolute; bottom: 8px; right: 10px; font-size: 11px; font-weight: 400; opacity: .85; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-weight: 700; font-size: 16px; }
.card-en { color: var(--muted); font-size: 12px; }
.card-sum { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.slang { background: var(--slang-soft); color: var(--slang); font-weight: 500; }

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

/* ---------- detail ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; margin-bottom: 8px; }
.detail-head h1 { margin: 0; font-size: 32px; line-height: 1.2; }
.detail-head .en { color: var(--muted); font-size: 16px; }
.aka { color: var(--muted); font-size: 14px; margin: 4px 0 16px; }
.summary { font-size: 16px; margin: 0 0 24px; }

.slang-box { background: var(--slang-soft); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 24px; }
.slang-box h3 { margin: 0 0 8px; font-size: 14px; color: var(--slang); }
.slang-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.slang-list li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.slang-term { font-weight: 700; color: var(--slang); }
.slang-origin { color: var(--muted); font-size: 12px; }

.gallery-wrap { margin-bottom: 28px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: zoom-in; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figcaption { font-size: 12px; color: var(--muted); padding: 6px 10px; }
.photo-slot { grid-column: 1 / -1;
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 18px; color: var(--muted); font-size: 13px;
  background: var(--surface);
}
.photo-slot code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

.sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.panel.wide { grid-column: 1 / -1; }
.panel h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.panel h3::before { content: ''; width: 4px; height: 14px; border-radius: 2px; background: var(--accent); }
.panel ul, .panel ol { margin: 0; padding-left: 20px; }
.panel li + li { margin-top: 4px; }
.props { width: 100%; border-collapse: collapse; font-size: 14px; }
.props th, .props td { text-align: left; padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.props th { color: var(--muted); font-weight: 500; width: 34%; padding-right: 12px; }
.props tr:last-child th, .props tr:last-child td { border-bottom: 0; }
.pros li::marker { content: '＋ '; color: var(--accent); }
.cons li::marker { content: '－ '; color: #c0533a; }
.steps { counter-reset: s; list-style: none; padding-left: 0 !important; }
.steps li { counter-increment: s; position: relative; padding-left: 34px; min-height: 24px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--surface); font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.cost { letter-spacing: 2px; color: var(--accent); font-weight: 700; }
.cost .off { color: var(--line); }

.related { margin-top: 24px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.pager a { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; max-width: 48%; }
.tools { margin-left: auto; display: flex; gap: 8px; }
.btn {
  font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- slang page ---------- */
.tabs { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.tab { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; font: inherit; font-size: 14px; }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.gtable { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.gtable th, .gtable td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.gtable th { background: var(--surface-2); font-weight: 500; color: var(--muted); font-size: 13px; position: sticky; top: 0; }
.gtable tr:last-child td { border-bottom: 0; }
.gtable .term { font-weight: 700; color: var(--slang); white-space: nowrap; }
.note { font-size: 13px; color: var(--muted); margin-top: 12px; }

/* ---------- about ---------- */
.prose { max-width: 760px; }
.prose h2 { font-size: 18px; margin-top: 28px; }
.prose code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.prose pre { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; font-size: 13px; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; place-items: center; z-index: 50; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-height: 86vh; border-radius: 8px; }
.lightbox p { color: #eee; text-align: center; font-size: 14px; }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px 40px; border-top: 1px solid var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line);
    display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px;
  }
  .sidebar h2 { display: none; }
  .cat-link { flex: none; background: var(--surface); border: 1px solid var(--line); padding: 6px 12px; }
  .cat-count { display: none; }
  .content { padding: 20px 16px 48px; }
  .sections { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px; }
  .brand-text { font-size: 15px; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .topnav a { padding: 6px 8px; font-size: 14px; }
  .sidebar { position: static; }
  .detail-head h1 { font-size: 26px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card-sum { display: none; }
  .slang-list li { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* ---------- print / PDF ---------- */
@media print {
  .topbar, .sidebar, .footer, .tools, .pager, .photo-slot { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  body { background: #fff; color: #000; font-size: 12px; }
  .panel, .summary, .slang-box { break-inside: avoid; border-color: #ccc; }
  .card { break-inside: avoid; }
}

/* ---------- section diagrams ---------- */
.section-wrap { margin-top: 28px; }
.section-figure { padding: 12px; }
.section-scroll { overflow-x: auto; }
.section-svg { display: block; width: 100%; min-width: 600px; height: auto; }
.section-note { margin: 8px 4px 0; font-size: 12px; }

/* ---------- photo credits ---------- */
.gallery figcaption .credit { display: block; font-size: 11px; opacity: .85; margin-top: 2px; }
.gallery figcaption .credit a { color: inherit; text-decoration: underline; }
.gallery img { cursor: zoom-in; }
.gallery figure { cursor: default; }

/* ---------- compare ---------- */
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 16px 0 10px; }
.preset-label { font-size: 13px; color: var(--muted); margin-right: 4px; }
.chip.preset { background: var(--surface); border: 1px solid var(--line); color: var(--text); padding: 4px 12px; font-size: 13px; }
.chip.preset:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.cmp-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.cmp-chip { background: var(--accent-soft); color: var(--accent); font-size: 14px; padding: 4px 6px 4px 12px; display: inline-flex; align-items: center; gap: 4px; }
.cmp-chip button { border: 0; background: transparent; color: inherit; font-size: 16px; cursor: pointer; line-height: 1; padding: 0 4px; }
#cmp-add { font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.cmp-table { min-width: 720px; table-layout: fixed; }
.cmp-table th[scope="row"] { width: 110px; position: sticky; left: 0; background: var(--surface-2); z-index: 1; }
.cmp-table thead th { position: static; vertical-align: top; }
.cmp-table thead th:first-child { position: sticky; left: 0; z-index: 2; }
.cmp-table td ul { margin: 0; padding-left: 18px; }
.cmp-table tr.hl td { font-weight: 500; }
.cmp-table tr.pros-row li::marker { content: '＋ '; color: var(--accent); }
.cmp-table tr.cons-row li::marker { content: '－ '; color: #c0533a; }
.cmp-head { display: flex; flex-direction: column; gap: 2px; color: var(--text); margin-bottom: 6px; }
.cmp-head:hover { text-decoration: none; }
.cmp-head b { font-size: 15px; }
.cmp-head span { font-size: 12px; color: var(--muted); font-weight: 400; }
.cmp-thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface-2); margin-bottom: 6px; }
.cmp-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cmp-thumb .placeholder { font-size: 24px; }
.dash { color: var(--muted); }
@media print {
  .preset-row, .cmp-picker { display: none !important; }
  .section-figure { break-inside: avoid; }
}
@media (max-width: 640px) {
  .cmp-table { min-width: 560px; }
  .cmp-table th[scope="row"] { width: 76px; font-size: 12px; padding: 10px 8px; }
}

/* ---------- section stepper ---------- */
.sec-tabs { margin-bottom: 10px; }
.sec-stepper { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin-top: 10px; }
.sec-stepper[hidden] { display: none; }
.sec-cap { text-align: center; font-size: 14px; }
.sec-cap b { margin-right: 6px; }
.sec-dots { display: flex; justify-content: center; margin-top: 4px; }
.sec-dots button { border: 0; padding: 0; cursor: pointer; }

/* ---------- refs & price ---------- */
.refs-panel { margin-top: 24px; }
.refs { margin: 0; padding-left: 18px; font-size: 14px; }
.refs li + li { margin-top: 4px; }
.price-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ref-list { padding-left: 22px; }
.ref-list > li { margin-bottom: 12px; }
.ref-list .chips { margin-top: 4px; }

/* ---------- guide ---------- */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 20px; }
.guide-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.guide-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.guide-card b { font-size: 16px; }
.guide-q { color: var(--muted); font-size: 14px; }
.guide-meta { font-size: 12px; color: var(--accent); margin-top: auto; }
.consider { margin: 16px 0 8px; }
.guide-option { margin-top: 28px; }
.guide-opt-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.guide-opt-head h2 { font-size: 18px; margin: 0; }
.guide-opt-head .btn { margin-left: auto; }
.guide-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.guide-why { color: var(--text); margin: 8px 0 12px; }
.btn.primary { background: var(--accent); color: var(--surface); border-color: var(--accent); font-size: 15px; padding: 10px 18px; }
.btn.primary:hover { color: var(--surface); opacity: .9; }

/* ---------- book (전체 PDF) ---------- */
.book-tools { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px; }
.book-tools h1 { font-size: 22px; margin: 0 0 4px; }
.book-tools p { margin: 0 0 8px; color: var(--muted); }
.book-tools label { font-size: 14px; margin-right: 12px; }
.book { background: #fff; color: #1d1d1d; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 32px; }
.book a { color: #2f6b4f; }
.book .dash, .book .aka, .book .note { color: #666; }
.book .summary { background: #f6f4ef; color: #1d1d1d; }
.book .props th { color: #666; }
.book .props th, .book .props td { border-color: #e2ded3; }
.book .gtable th { background: #efece4; color: #555; }
.book .gtable td, .book .gtable th { border-color: #e2ded3; }
.book .gtable .term { color: #9a4b12; }
.book-cover { min-height: 640px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 48px 0; border-bottom: 1px solid #e2ded3; }
.cover-mark { width: 64px; height: 64px; border-radius: 14px; background: #2f6b4f; color: #fff; display: grid; place-items: center; font-size: 32px; font-weight: 700; margin-bottom: 24px; }
.book-cover h1 { font-size: 44px; margin: 0; }
.cover-sub { font-size: 18px; color: #555; margin: 8px 0 40px; }
.cover-fields { display: grid; gap: 10px; min-width: 320px; }
.cover-fields div { display: grid; grid-template-columns: 110px 1fr; border-bottom: 1px solid #ccc; padding: 6px 0; }
.cover-fields span { color: #777; font-size: 14px; }
.cover-fields b[contenteditable] { outline: none; font-weight: 500; }
.cover-fields b[contenteditable]:focus { background: #fff6d6; }
.cover-note { margin-top: 32px; color: #888; font-size: 13px; }
.book-toc { padding: 32px 0; border-bottom: 1px solid #e2ded3; columns: 2; column-gap: 32px; }
.book-toc h2 { column-span: all; margin-top: 0; }
.toc-cat { break-inside: avoid; margin-bottom: 14px; }
.toc-cat h3 { font-size: 15px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.toc-cat ol { margin: 0; padding-left: 22px; font-size: 13px; }
.book-entry { padding: 28px 0; border-bottom: 1px solid #e2ded3; }
.be-head h2 { margin: 6px 0 2px; font-size: 26px; }
.be-head h2 small { font-size: 14px; color: #777; font-weight: 400; }
.be-top { display: grid; grid-template-columns: 260px 1fr; gap: 18px; margin: 12px 0; }
.be-top:not(:has(figure)) { grid-template-columns: 1fr; }
.be-photo { margin: 0; }
.be-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.be-photo figcaption { font-size: 10.5px; color: #777; margin-top: 4px; }
.be-slang { font-size: 13px; background: #fbeadb; border-radius: 8px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.be-slang b { color: #9a4b12; width: 100%; }
.be-slang em { font-style: normal; font-weight: 700; color: #9a4b12; }
.be-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; font-size: 13.5px; }
.book-entry h4 { margin: 14px 0 6px; font-size: 14px; color: #2f6b4f; }
.book-entry ul, .book-entry ol { margin: 0; padding-left: 18px; }
.book-entry .steps li::before { background: #2f6b4f; color: #fff; }
.be-sec .section-svg { min-width: 0; max-width: 680px; }
.book.no-photo .be-photo { display: none; }
.book.no-photo .be-top { grid-template-columns: 1fr; }
.book.no-sec .be-sec { display: none; }

@media (max-width: 640px) {
  .topnav { flex-basis: 100%; order: 2; overflow-x: auto; margin-left: 0; }
  .sec-stepper { grid-template-columns: 1fr 1fr; }
  .sec-cap { grid-column: 1 / -1; grid-row: 1; }
  .book { padding: 0 14px; }
  .be-top, .be-grid { grid-template-columns: 1fr; }
  .book-toc { columns: 1; }
  .book-cover h1 { font-size: 32px; }
  .cover-fields { min-width: 0; width: 100%; }
}

@media print {
  .refs-panel { break-inside: avoid; }
  .sec-tabs, .sec-stepper { display: none !important; }
  body.is-book .book-tools { display: none !important; }
  body.is-book .book { border: 0; padding: 0; }
  body.is-book .book-cover { min-height: 0; height: 250mm; break-after: page; border: 0; }
  body.is-book .book-toc { break-after: page; border: 0; }
  body.is-book .book-entry { break-before: page; border: 0; padding-top: 0; }
  body.is-book .be-sec, body.is-book .be-top { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.chip.conf-high { background: var(--accent-soft); color: var(--accent); }
.chip.conf-low { background: var(--slang-soft); color: var(--slang); }

/* ---------- sidebar tools ---------- */
.sidebar h2.side-tools { margin-top: 20px; }
.tool-link { font-size: 13.5px; color: var(--muted); }

/* ---------- calculator ---------- */
.calc-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.chip.preset.on { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.calc-box { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.calc-inputs { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.calc-inputs h2 { margin: 0 0 4px; font-size: 18px; }
.calc-inputs p { margin: 0 0 12px; font-size: 13px; }
.calc-field { display: grid; grid-template-columns: 1fr 96px auto; gap: 8px; align-items: center; margin-top: 8px; font-size: 14px; }
.calc-field input, .calc-field select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; }
.calc-field b { font-weight: 500; color: var(--muted); font-size: 13px; }
.calc-table .num { text-align: right; white-space: nowrap; }
.calc-table tfoot th { background: var(--surface-2); color: var(--text); font-weight: 700; }
.calc-how { font-size: 12px; color: var(--muted); }

/* ---------- defects ---------- */
.defect-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin: 20px 0; }
.defect-pair figure { margin: 0; }
.defect-pair figcaption { font-size: 14px; margin-bottom: 6px; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-right: 4px; }

/* ---------- decide ---------- */
:root { --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; } }
:root[data-theme="dark"] { --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; }
.c1 { background: var(--c1); } .c2 { background: var(--c2); } .c3 { background: var(--c3); } .c4 { background: var(--c4); } .c5 { background: var(--c5); }
.decide-top { margin: 16px 0; max-width: 560px; }
.decide-top .calc-field { grid-template-columns: 90px 1fr; }
.decide-box { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.weights { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.weight { display: grid; grid-template-columns: 1fr 100px 18px; gap: 8px; align-items: center; padding: 6px 0; }
.wname { display: flex; flex-direction: column; font-size: 14px; font-weight: 500; }
.wname small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.wname .sw { display: inline-block; }
.weight input { accent-color: var(--accent); width: 100%; }
.weight b { text-align: right; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.weight-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.weight-presets .btn { font-size: 12px; padding: 4px 8px; }
.decide-chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 44px; gap: 10px; align-items: center; padding: 5px 0; }
.bar-name { font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: flex; gap: 2px; height: 18px; background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 1px), var(--line) calc(20% - 1px) 20%); }
.bar-track .seg { height: 100%; min-width: 2px; }
.bar-track .seg:last-child { border-radius: 0 4px 4px 0; }
.bar-val { font-size: 13px; text-align: right; color: var(--text); }
.bar-axis { display: flex; justify-content: space-between; margin-left: 160px; margin-right: 54px; font-size: 11px; color: var(--muted); }
.decide-table { margin-top: 14px; }
.decide-table summary { cursor: pointer; color: var(--accent); font-size: 14px; margin-bottom: 8px; }
.viz-tip { position: fixed; z-index: 30; background: var(--text); color: var(--surface); font-size: 12px; padding: 6px 9px; border-radius: 6px; pointer-events: none; max-width: 280px; }


@media (max-width: 900px) {
  .calc-box, .decide-box, .defect-pair { grid-template-columns: minmax(0, 1fr); }
  .bar-row { grid-template-columns: 110px minmax(0, 1fr) 38px; }
  .bar-axis { margin-left: 120px; margin-right: 48px; }
}
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 4px 0 8px; }
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.tool-card:hover { border-color: var(--accent); text-decoration: none; }
.tool-card b { font-size: 14px; }
.tool-card span { font-size: 12px; color: var(--muted); }
.verify-panel { margin-top: 24px; }
.verify-panel summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; cursor: pointer; list-style: none; }
.verify-panel summary::-webkit-details-marker { display: none; }
.verify-panel summary h3 { margin: 0; }
.verify-panel summary::after { content: '펼치기 ▾'; font-size: 12px; color: var(--muted); margin-left: auto; }
.verify-panel[open] summary::after { content: '접기 ▴'; }
.vcount { display: flex; gap: 6px; }
.vtag { font-size: 11.5px; padding: 1px 7px; border-radius: 6px; font-weight: 700; white-space: nowrap; }
.vtag.ok { background: #e2efe7; color: #1f5a3f; }
.vtag.fix { background: #fff1d6; color: #8a5a00; }
.vtag.na { background: var(--surface-2); color: var(--muted); }
.verify-list { list-style: none; padding: 0 !important; margin: 12px 0 0; font-size: 13.5px; }
.verify-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.vmeta { font-size: 12px; color: var(--muted); margin-top: 2px; }
