:root {
  --bg: #f2f3f4;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --text: #212529;
  --muted: #6b7075;
  --line: #d5d8dc;
  --line-soft: #e9ecef;
  --brand: #00866f;
  --brand-dark: #006b59;
  --brand-text: #ffffff;
  --link: #0b6e8a;
  --lv1: #2b8a3e;
  --lv2: #1864ab;
  --lv3: #9c36b5;
  --lv1-bg: #ebfbee;
  --lv2-bg: #e7f5ff;
  --lv3-bg: #f8f0fc;
  --missing: #e03131;
  --badge-bg: #fff3bf;
  --badge-text: #7a5510;
  --ok-bg: #e3efe3;
  --ok-text: #2c6131;
  --path-line: #c9d6e6;
  --mm-line: #adb5bd;
  --mm-seed: #fff9db;
  --mm-seed-line: #f08c00;
  --mm-q: #e7f5ff;
  --mm-q-line: #1c7ed6;
  --shadow: 0 6px 24px rgba(30, 28, 24, 0.14);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141517;
    --surface: #1d1f21;
    --surface-2: #25272a;
    --text: #e9ecef;
    --muted: #a5abb1;
    --line: #3a3d41;
    --line-soft: #2c2e31;
    --brand: #0c6b5b;
    --brand-dark: #0a5649;
    --link: #66c2d9;
    --lv1: #69db7c;
    --lv2: #74c0fc;
    --lv3: #e599f7;
    --lv1-bg: #1f2d22;
    --lv2-bg: #1b2833;
    --lv3-bg: #2c2031;
    --missing: #ff8787;
    --badge-bg: #3b3221;
    --badge-text: #e9c98a;
    --ok-bg: #233525;
    --ok-text: #9fd3a4;
    --path-line: #3a4a5e;
    --mm-line: #5c636a;
    --mm-seed: #3a3220;
    --mm-seed-line: #ffa94d;
    --mm-q: #1b2833;
    --mm-q-line: #74c0fc;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #141517;
  --surface: #1d1f21;
  --surface-2: #25272a;
  --text: #e9ecef;
  --muted: #a5abb1;
  --line: #3a3d41;
  --line-soft: #2c2e31;
  --brand: #0c6b5b;
  --brand-dark: #0a5649;
  --link: #66c2d9;
  --lv1: #69db7c;
  --lv2: #74c0fc;
  --lv3: #e599f7;
  --lv1-bg: #1f2d22;
  --lv2-bg: #1b2833;
  --lv3-bg: #2c2031;
  --missing: #ff8787;
  --badge-bg: #3b3221;
  --badge-text: #e9c98a;
  --ok-bg: #233525;
  --ok-text: #9fd3a4;
  --path-line: #3a4a5e;
  --mm-line: #5c636a;
  --mm-seed: #3a3220;
  --mm-seed-line: #ffa94d;
  --mm-q: #1b2833;
  --mm-q-line: #74c0fc;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  word-break: keep-all;
  overflow-wrap: break-word;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* 위쪽 막대 */
.top { background: var(--brand); position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08); }
.top-inner { max-width: 62rem; margin: 0 auto; padding: 9px 16px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 800; color: var(--brand-text); font-size: 18px; white-space: nowrap; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.search { position: relative; flex: 1; max-width: 22rem; margin-left: auto; }
.search input {
  width: 100%; font: inherit; font-size: 15px; padding: 6px 10px;
  border: 1px solid transparent; border-radius: 4px; background: var(--surface); color: var(--text);
}
.search input:focus { outline: 2px solid var(--brand-dark); outline-offset: 0; }
.results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); z-index: 20;
}
.results li a { display: block; padding: 6px 10px; color: var(--text); font-size: 15px; line-height: 1.45; }
.results li a:hover, .results li a.active { background: var(--surface-2); text-decoration: none; }
.results .r-kind { color: var(--muted); font-size: 12px; margin-right: 6px; }
.results .r-empty { padding: 6px 10px; color: var(--muted); font-size: 14px; }

/* 본문 틀 */
.page { max-width: 62rem; margin: 0 auto; padding: 20px 16px 48px; }
.wiki, .home { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 20px 28px 28px; }
.wiki-head { border-bottom: 2px solid var(--line); margin-bottom: 12px; }
.wiki-title { font-size: 30px; line-height: 1.3; margin: 4px 0 6px; letter-spacing: -0.02em; }
.wiki-meta { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.lead { font-size: 17px; font-weight: 500; margin: 4px 0 10px; }
p { margin: 0 0 14px; }
ul, ol { padding-left: 1.4em; margin: 0 0 14px; }
li { margin: 4px 0; }
strong { font-weight: 650; }
blockquote { margin: 0 0 14px; padding: 2px 0 2px 14px; border-left: 3px solid var(--line); color: var(--muted); }

/* 확인 상태와 색 안내 */
.status { font-size: 14px; color: var(--muted); margin: 6px 0 8px; line-height: 1.6; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: var(--badge-bg); color: var(--badge-text); margin-right: 6px; vertical-align: 1px;
}
.status.ok .badge { background: var(--ok-bg); color: var(--ok-text); }
.legend { font-size: 14px; color: var(--muted); margin: 0 0 16px; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 4px; }
.lg { display: inline-block; font-size: 12px; font-weight: 700; padding: 0 8px; border-radius: 4px; margin-right: 4px; line-height: 1.7; }
.lg.lv1 { color: var(--lv1); background: var(--lv1-bg); }
.lg.lv2 { color: var(--lv2); background: var(--lv2-bg); }
.lg.lv3 { color: var(--lv3); background: var(--lv3-bg); }
.legend .lg:last-of-type { margin-right: 8px; }

/* 논문 정보 상자 */
.infobox { float: right; width: 19rem; margin: 0 0 16px 20px; border-collapse: collapse; font-size: 14px; line-height: 1.55; border: 1px solid var(--line); background: var(--surface); }
.infobox caption { caption-side: top; background: var(--brand); color: var(--brand-text); font-weight: 700; padding: 8px 10px; text-align: center; border: 1px solid var(--brand); }
.infobox th { background: var(--surface-2); color: var(--muted); font-weight: 600; text-align: left; padding: 6px 10px; border: 1px solid var(--line); width: 5.5em; vertical-align: top; white-space: nowrap; }
.infobox td { padding: 6px 10px; border: 1px solid var(--line); overflow-wrap: anywhere; }

/* 목차 */
.toc { display: inline-block; min-width: 14rem; max-width: 100%; border: 1px solid var(--line); background: var(--surface-2); padding: 10px 18px 6px 14px; margin: 0 0 20px; border-radius: 4px; }
.toc-title { margin: 0 0 4px; font-weight: 700; font-size: 15px; }
.toc ol { list-style: none; padding-left: 0; margin: 0 0 6px; font-size: 15px; }
.toc ol ol { padding-left: 1.4em; margin: 0; }
.toc li { margin: 2px 0; }
.toc .tn { color: var(--link); margin-right: 2px; }
.toc a { color: var(--text); }
.toc a:hover .tn { text-decoration: underline; }

/* 문단 제목 (번호, 접기) */
.wiki-body { clear: none; }
.wh { position: relative; display: flex; align-items: baseline; gap: 6px; scroll-margin-top: 64px; }
.footnotes li, .toc { scroll-margin-top: 64px; }
h2.wh { font-size: 22px; line-height: 1.4; margin: 30px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
h3.wh { font-size: 18px; margin: 22px 0 8px; }
.wh .num { color: var(--link); font-weight: 700; }
.wh .wt { flex: 1; }
.fold { flex: 0 0 auto; width: 28px; height: 28px; border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 4px; align-self: center; }
.fold::before { content: "▾"; font-size: 14px; }
.fold:hover { background: var(--surface-2); color: var(--text); }
.sec.folded .fold::before { content: "▸"; }
.sec.folded .sec-body { display: none; }
.sec.folded h2.wh { color: var(--muted); }

/* 용어 링크: 난이도별 색 */
a.term { text-decoration: none; -webkit-user-drag: none; }
a.term:hover { text-decoration: underline; }
a.term.lv1 { color: var(--lv1); }
a.term.lv2 { color: var(--lv2); }
a.term.lv3 { color: var(--lv3); }
a.term.missing { color: var(--missing); cursor: help; }

/* 각주 */
sup.fn { font-size: 11px; line-height: 0; margin-left: 1px; }
sup.fn a { color: var(--link); }
.footnotes { clear: both; margin-top: 28px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.fn-title { font-weight: 700; margin: 0 0 6px; }
.footnotes ol { list-style: none; padding-left: 0; }
.footnotes li { margin: 2px 0; }
.footnotes li:target { background: var(--badge-bg); }
.fn-back { margin-right: 4px; }

/* 읽기 순서 */
.hint { color: var(--muted); font-size: 15px; }
.path { list-style: none; padding: 0; margin: 0 0 14px; counter-reset: step; position: relative; }
.path li { counter-increment: step; position: relative; padding: 0 0 12px 40px; margin: 0; line-height: 1.55; }
.path li::before {
  content: counter(step); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); border: 1.5px solid var(--path-line); color: var(--muted);
  font-size: 13px; font-weight: 600; display: grid; place-items: center; line-height: 1;
}
.path li::after { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 1.5px; background: var(--path-line); }
.path li:last-child::after { display: none; }
.path .def, .terms-list .def { display: block; color: var(--muted); font-size: 15px; }

/* 난이도별 낱말 */
.levels { border: 1px solid var(--line-soft); border-radius: 4px; margin: 0 0 16px; }
.level-row { display: flex; gap: 12px; align-items: baseline; padding: 8px 12px; border-top: 1px solid var(--line-soft); }
.level-row:first-child { border-top: 0; }
.level-row .lg { flex: 0 0 auto; }
.level-row .chips { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* 표 */
table:not(.infobox) { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 15px; line-height: 1.5; display: block; overflow-x: auto; }
table:not(.infobox) th, table:not(.infobox) td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
table:not(.infobox) th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }

/* 목록 */
.plain { list-style: none; padding: 0; }
.terms-list { list-style: none; padding: 0; }
.terms-list li { margin: 0 0 10px; line-height: 1.5; }

.home h1 { font-size: 30px; margin: 4px 0 8px; }
.home h2 { font-size: 21px; margin: 32px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.home .intro { font-size: 17px; color: var(--muted); }
.count { color: var(--muted); font-size: 15px; font-weight: 400; margin-left: 4px; }
.paper-list { list-style: none; padding: 0; }
.paper-list li { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.paper-list li:first-child { padding-top: 0; }
.paper-title { font-size: 19px; font-weight: 650; }
.paper-list .meta { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.paper-list .def { display: block; margin-top: 6px; }

/* 알려 주기 */
.feedback { margin-top: 36px; }
.feedback h2 { font-size: 18px; margin: 0 0 8px; }
.feedback p { color: var(--muted); font-size: 15px; }
.fb-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-buttons button {
  font: inherit; font-size: 15px; padding: 6px 14px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.fb-buttons button:hover { border-color: var(--brand); }
.fb-note { margin-top: 10px; }

/* 아래쪽 */
.foot-inner { max-width: 62rem; margin: 0 auto; padding: 4px 16px 32px; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 14px; }

/* 용어 미리보기 */
.preview {
  position: absolute; z-index: 30; max-width: 22rem; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  font-size: 15px; line-height: 1.6; pointer-events: none;
}
.preview strong { display: block; font-size: 16px; }
.preview .p-en { color: var(--muted); font-size: 13px; }
.preview p { margin: 6px 0 0; }

/* ---------- 원문 읽기 ---------- */
.credit { border: 1px solid var(--line); border-left: 4px solid var(--brand); background: var(--surface-2); border-radius: 4px; padding: 10px 14px 2px; margin: 0 0 14px; font-size: 14px; line-height: 1.6; }
.credit-title { font-weight: 700; margin: 0 0 4px; }
.credit p { margin: 0 0 8px; }
.credit-note { color: var(--muted); }
.src-ref { font-size: 13px; margin: -4px 0 10px; }
.para-title { margin: 18px 0 4px; }
.fig-cap { font-size: 14px; color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 6px 10px; }
.fig-kind { font-weight: 700; color: var(--text); margin-right: 4px; }
.cite-ref { color: var(--muted); font-size: 0.92em; }
.tex-block { overflow-x: auto; margin: 0 0 14px; padding: 4px 0; }
.tex-block .tex-display { display: block; }
.doc-page .wiki-body { line-height: 1.8; }
.doc-page .katex { font-size: 1.05em; }

/* ---------- 마인드맵 ---------- */
.seed-btn {
  position: absolute; z-index: 40; font-size: 14px; font-weight: 700; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 0; background: var(--brand); color: var(--brand-text); box-shadow: var(--shadow); white-space: nowrap;
}
.seed-btn:hover { background: var(--brand-dark); }
.mm-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 35; font-size: 14px; font-weight: 700; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow); cursor: pointer;
}
.mm-fab:hover { border-color: var(--brand); }

.mm-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.45); display: flex; padding: 16px; }
.mm-panel { flex: 1; display: flex; flex-direction: column; background: var(--bg); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); min-width: 0; }
.mm-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mm-title { margin: 0; font-weight: 800; font-size: 16px; }
.mm-src { margin: 0; color: var(--muted); font-size: 13px; flex: 1; min-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-pick { font: inherit; font-size: 13px; max-width: 14rem; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); }
.mm-btn { font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.mm-btn:hover { border-color: var(--brand); }
.mm-note { margin: 0; padding: 8px 14px; font-size: 13px; background: var(--badge-bg); color: var(--badge-text); }
.mm-canvas { flex: 1; overflow: auto; padding: 24px 16px 40px; }

.mm-tree, .mm-tree ul { display: flex; justify-content: center; list-style: none; margin: 0; padding: 0; position: relative; }
.mm-tree { width: max-content; min-width: 100%; }
.mm-tree ul { padding-top: 22px; }
.mm-tree li { display: flex; flex-direction: column; align-items: center; position: relative; padding: 22px 8px 0; margin: 0; }
.mm-tree > li { padding-top: 0; }
.mm-tree li::before, .mm-tree li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 22px; border-top: 2px solid var(--mm-line); }
.mm-tree li::after { right: auto; left: 50%; border-left: 2px solid var(--mm-line); }
.mm-tree > li::before, .mm-tree > li::after { display: none; }
.mm-tree li:only-child::before { display: none; }
.mm-tree li:only-child::after { border-top: 0; }
.mm-tree li:first-child::before, .mm-tree li:last-child::after { border: 0 none; }
.mm-tree li:last-child::before { border-right: 2px solid var(--mm-line); border-radius: 0 8px 0 0; }
.mm-tree li:first-child::after { border-radius: 8px 0 0 0; }
.mm-tree li:only-child::after { border-left: 2px solid var(--mm-line); border-radius: 0; }
.mm-tree ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid var(--mm-line); }

.mm-node {
  width: max-content; max-width: 19rem; min-width: 9rem; text-align: left; font-size: 14px; line-height: 1.6;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
.mm-node:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.mm-node.sel { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
.mm-label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; margin-bottom: 2px; }
.mm-text p { margin: 0 0 6px; }
.mm-text p:last-child { margin-bottom: 0; }
.mm-text.clamp { display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.mm-more { font: inherit; font-size: 12px; color: var(--link); background: none; border: 0; padding: 2px 0 0; cursor: pointer; }
.k-doc { background: var(--brand); border-color: var(--brand); color: var(--brand-text); font-weight: 700; max-width: 24rem; }
.k-doc .mm-label { color: var(--brand-text); opacity: 0.85; }
.k-seed { background: var(--mm-seed); border-color: var(--mm-seed-line); font-weight: 600; max-width: 22rem; }
.k-question { background: var(--mm-q); border-color: var(--mm-q-line); border-radius: 18px; }
.k-suggest {
  border-style: dashed; color: var(--muted); border-radius: 18px; background: transparent; font-size: 13px; padding: 6px 12px;
  min-width: 0; max-width: 14rem;
}
.k-suggest:hover { color: var(--text); border-color: var(--brand); }
.k-suggest::before { content: "+ "; font-weight: 700; color: var(--brand); }
.k-loading { color: var(--muted); }
.k-loading .mm-text::after { content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 6px; border: 2px solid var(--mm-line); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.k-error { border-color: var(--missing); }
.demo-tag { font-weight: 600; color: var(--badge-text); background: var(--badge-bg); border-radius: 4px; padding: 0 5px; margin-left: 4px; }

.mm-ask { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--line); flex-wrap: wrap; }
.mm-target { font-size: 13px; color: var(--muted); flex: 1 1 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-ask input { flex: 1; min-width: 0; font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
.mm-ask input:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.mm-send { font: inherit; font-size: 15px; font-weight: 700; padding: 8px 16px; border-radius: 6px; border: 0; background: var(--brand); color: var(--brand-text); cursor: pointer; }
.mm-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 760px) {
  .infobox { float: none; width: 100%; margin: 0 0 16px; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .page { padding: 12px 8px 40px; }
  .wiki, .home { padding: 14px 14px 20px; }
  .wiki-title { font-size: 25px; }
  h2.wh { font-size: 19px; }
  .top-inner { gap: 10px; }
  .toc { display: block; }
  .level-row { flex-direction: column; gap: 4px; }
  .mm-overlay { padding: 0; }
  .mm-panel { border-radius: 0; }
  .mm-node { max-width: 15rem; min-width: 7rem; }
  .k-seed { max-width: 17rem; }
}

/* ---------- 읽으면서 옆에서 자라는 지도 ---------- */
.mm-side { position: fixed; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.mm-side .mm-panel { flex: 1; border-radius: 0; box-shadow: none; min-height: 0; }
.mm-side.is-wide { top: 57px; right: 0; bottom: 0; width: 420px; border-left: 1px solid var(--line); }
body.mm-side-on .page { margin-left: max(0px, calc((100vw - 420px - 62rem) / 2)); margin-right: calc(420px + max(0px, calc((100vw - 420px - 62rem) / 2))); }
.mm-side .mm-node { max-width: 15rem; min-width: 8rem; font-size: 13px; }
.mm-side .k-doc { max-width: 17rem; }
.mm-side .mm-canvas { padding: 16px 10px 24px; }
.mm-count { font-weight: 500; color: var(--muted); font-size: 13px; }
.mm-guide { max-width: 19rem; margin: 18px auto 0; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: center; }
.mm-tab {
  position: fixed; right: 12px; top: 72px; z-index: 30; font: inherit; font-size: 13px; font-weight: 700; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--brand); background: var(--surface); color: var(--brand-dark); box-shadow: var(--shadow); cursor: pointer;
}

/* 좁은 화면: 아래에서 올라오는 판 */
.mm-side:not(.is-wide) { left: 0; right: 0; bottom: 0; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.16); }
.mm-side:not(.is-wide) .mm-panel { border-radius: 12px 12px 0 0; }
.mm-side:not(.is-wide) .mm-head { cursor: pointer; }
.mm-side:not(.is-wide):not(.is-open) .mm-panel > :not(.mm-head) { display: none; }
.mm-side:not(.is-wide).is-open { height: 80vh; }
body.mm-sheet-on .page { padding-bottom: 80px; }

/* 문장 옆 ? 와 문장 강조 */
.sent-q {
  position: absolute; z-index: 35; width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: var(--brand); color: var(--brand-text); font-weight: 800; font-size: 15px; line-height: 26px; box-shadow: var(--shadow);
}
.sent-q:hover { background: var(--brand-dark); }
::highlight(mm-sentence) { background-color: rgba(250, 204, 21, 0.32); }

/* 절 끝 질문 */
.sec-asks { margin: 18px 0 6px; padding-top: 10px; border-top: 1px dashed var(--line); }
.asks-title { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.asks { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-chip {
  font: inherit; font-size: 14px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--brand); background: var(--surface); color: var(--brand-dark); text-align: left;
}
.ask-chip:hover { background: var(--brand); color: var(--brand-text); }
.ask-chip.used { border-color: var(--line); color: var(--muted); }
.ask-chip.used::after { content: " ✓"; }

/* 색칠된 말을 누르면 뜨는 작은 창 */
.term-pop { position: absolute; z-index: 60; width: min(20rem, calc(100vw - 16px)); padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); font-size: 14px; line-height: 1.55; }
.term-pop.is-fixed { position: fixed; }
.term-pop p { margin: 0 0 6px; }
.tp-en { color: var(--muted); font-size: 13px; }
.tp-actions { display: flex; gap: 6px; margin-top: 8px; }
.tp-btn { font: inherit; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.tp-btn:hover { text-decoration: none; border-color: var(--brand); }
.tp-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }

/* 지도 칸: 절, 용어 */
.k-section { border-style: dashed; font-weight: 700; background: var(--surface-2); }
.k-term { border-left-width: 4px; }
.k-term.lv1 { border-left-color: var(--lv1); }
.k-term.lv2 { border-left-color: var(--lv2); }
.k-term.lv3 { border-left-color: var(--lv3); }
.mm-short { color: var(--muted); font-size: 12px; line-height: 1.5; }
.mm-doc-link { font-size: 12px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) ::highlight(mm-sentence) { background-color: rgba(250, 204, 21, 0.25); }
}

/* ---------- 단계별 해설 (format: ladder) ---------- */
/* 순서: 휴대폰은 읽는 순서 → 1단계 → 원문 카드 → 나머지. 컴퓨터는 읽는 순서 옆에 원문 카드. */
.ladder-body { display: grid; grid-template-columns: minmax(0, 1fr); }
.ladder-body > * { min-width: 0; order: 4; }
.ladder-body > .ladder { order: 1; }
.ladder-body > #sec-1 { order: 2; }
.ladder-body > .src-card { order: 3; }
@media (min-width: 761px) {
  .ladder-body { grid-template-columns: minmax(0, 1fr) minmax(0, 17rem); column-gap: 18px; align-items: start; }
  .ladder-body > * { grid-column: 1 / -1; }
  .ladder-body > .ladder { grid-column: 1; grid-row: 1; }
  .ladder-body > .src-card { grid-column: 2; grid-row: 1; }
}
.ladder { border: 1px solid var(--line); background: var(--surface-2); border-radius: 4px; padding: 10px 16px 6px 14px; margin: 0 0 20px; scroll-margin-top: 64px; }
.ladder-title { margin: 0; font-weight: 700; font-size: 15px; }
.ladder-hint { margin: 2px 0 6px; font-size: 13px; color: var(--muted); }
.ladder ol { list-style: none; margin: 0; padding: 0; }
.ladder li { display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 15px; }
.ladder li:first-child { border-top: 0; }
.ladder li a { flex: 1; color: var(--text); text-decoration: none; }
.ladder li a:hover .lt { text-decoration: underline; }
.ladder .ln { color: var(--link); font-weight: 700; margin-right: 2px; }
.ladder .rt { color: var(--muted); font-size: 13px; white-space: nowrap; }
.src-card { border: 1px solid var(--line); border-radius: 4px; background: var(--surface); padding: 12px 14px 10px; margin: 0 0 20px; font-size: 14px; line-height: 1.55; scroll-margin-top: 64px; }
.src-card p { margin: 0 0 8px; }
.src-card-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.src-card-title { font-weight: 700; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.src-card-meta { color: var(--muted); }
.src-card-meta a { white-space: nowrap; }
.btn-outline { display: inline-block; padding: 6px 12px; border: 1px solid var(--link); border-radius: 4px; color: var(--link); font-weight: 600; text-decoration: none; }
.btn-outline:hover { background: var(--surface-2); text-decoration: none; }
.src-card .src-card-note { margin: 0; font-size: 13px; color: var(--muted); }
.ladder-page h2.wh .num { font-size: 13px; font-weight: 700; color: var(--brand-text); background: var(--brand); border-radius: 999px; padding: 2px 9px; align-self: center; white-space: nowrap; }
.ladder-page .step-1 .sec-body > p:not(.step-next) { font-size: 20px; line-height: 1.75; font-weight: 500; }
.ladder-page #sec-1 h2.wh { margin-top: 4px; }
.step-next { margin: 20px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--line); color: var(--muted); font-size: 15px; line-height: 1.6; }
.step-next a { font-weight: 600; white-space: nowrap; }
details.prereq { border: 1px solid var(--line-soft); border-radius: 4px; padding: 8px 12px; margin: 0 0 16px; background: var(--surface-2); }
details.prereq summary { cursor: pointer; font-weight: 600; }
details.prereq summary .hint { font-weight: 400; font-size: 14px; margin-left: 4px; }
details.prereq[open] summary { margin-bottom: 12px; }
.prereq-sub { font-weight: 600; margin: 8px 0 6px; }
.has-explainer { border: 1px solid var(--line); border-left: 4px solid var(--lv1); background: var(--lv1-bg); border-radius: 4px; padding: 9px 14px; margin: 0 0 14px; font-size: 15px; }
.has-explainer a { font-weight: 600; }
@media (max-width: 560px) {
  .ladder-page .step-1 .sec-body > p:not(.step-next) { font-size: 18px; }
}
.wiki-body h4 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; }
.preview-bar { margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--line); border-left: 4px solid var(--badge-text); background: var(--badge-bg); color: var(--badge-text); border-radius: 4px; font-size: 14px; line-height: 1.5; }
