/* 나뭇잎 디지털 교과서 — 공통 스타일 */
:root {
  --ink: #232326;
  --ink-2: #5d5d61;
  --ink-3: #8d8d92;
  --rule: #d9dad2;
  --grid: rgba(35, 35, 38, .055);
  --paper: #f3f4ef;
  --paper-2: #ebece5;
  --card: #fbfbf8;
  --leaf: #74ab66;
  --forest: #3b7c2a;
  --sprout: #b5d7ac;
  --warn: #b5532f;
  --warn-bg: #f7efe9;
  --night: #1c1e1b;
  --on-night: #f3f4ef;
  --top-bg: rgba(243, 244, 239, .9);
  --raised: #fff;
  --right-bg: #eef5eb;
  --hl: #fbe38a;
  --memo-bg: #fffdf3;
  --memo-rule: #e6c34a;
  --fig-bg: #fff;
  --on-accent: #fff;

  --pad: clamp(16px, 4vw, 56px);
  --max: 1240px;
  --f-kr: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --f-serif: "Newsreader", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-kr); line-height: 1.65;
  word-break: keep-all; overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: inherit; }
canvas { display: block; }
/* 카드 캔버스는 칸 폭을 따른다. CSS 폭이 없으면 화면 크기가 width 속성(= 화면 크기 × 화소 배율)을 따라가
   배율이 1보다 큰 화면에서 그릴 때마다 커지며 칸 밖으로 넘친다(NM.fit의 되먹임). */
.card canvas { max-width: 100%; }
.card-fig canvas { width: 100%; }
[hidden] { display: none !important; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.mono { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: .01em; }
.small { font-size: 12px; }
.dim { color: var(--ink-3); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

/* ───── 상단바 ───── */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding: 0 var(--pad);
  background: var(--top-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark { width: 24px; height: 24px; color: var(--ink); flex: none; }
.brand small { font-family: var(--f-mono); font-weight: 400; font-size: 11px; color: var(--ink-3); letter-spacing: 0; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--ink-2); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs span[aria-hidden] { color: var(--ink-3); }
.top-right { margin-left: auto; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
.top-right a { text-decoration: none; }

/* ───── 공통 요소 ───── */
.btn {
  display: inline-block; padding: 9px 16px;
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink); border-radius: 2px;
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--forest); border-color: var(--forest); }
.chip {
  padding: 4px 11px; border: 1px solid var(--rule); border-radius: 2px;
  background: var(--card); font-family: var(--f-mono); font-size: 12px; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
input[type=range] { width: 100%; accent-color: var(--forest); margin: 6px 0; }
select { padding: 4px 8px; border: 1px solid var(--rule); background: var(--card); border-radius: 2px; font-size: 14px; }
.tag-pill { display: inline-block; font-family: var(--f-mono); font-size: 11px; padding: 1px 7px; border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.tag-pill.live { border-color: var(--forest); color: var(--forest); }

/* ═════════ 메인(목차) 페이지 ═════════ */
.intro { padding: clamp(40px, 7vw, 88px) 0 clamp(28px, 4vw, 48px); display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(24px, 5vw, 72px); align-items: end; }
.intro h1 { font-size: clamp(34px, 5vw, 64px); font-weight: 800; line-height: 1.15; letter-spacing: -.045em; }
.intro h1 em { font-family: var(--f-serif); font-style: italic; font-weight: 400; color: var(--forest); }
.intro p { margin-top: 18px; color: var(--ink-2); max-width: 34em; font-size: clamp(15px, 1.2vw, 17px); }
.legend-steps { border: 1px solid var(--ink); background: var(--card); }
.legend-steps h2 { font-size: 13px; font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--ink); display: flex; justify-content: space-between; }
.legend-steps ol { display: grid; grid-template-columns: repeat(3, 1fr); }
.legend-steps li { padding: 10px 14px; border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); font-size: 13px; line-height: 1.45; }
.legend-steps li:nth-child(3n) { border-right: 0; }
.legend-steps li:nth-child(n+4) { border-bottom: 0; }
.legend-steps b { display: block; font-size: 14px; }
.legend-steps .mono { color: var(--forest); font-size: 11px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 14px 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); position: sticky; top: 56px; background: var(--paper); z-index: 5; }
.toolbar input[type=search] { margin-left: auto; min-width: 220px; padding: 7px 12px; border: 1px solid var(--rule); background: var(--card); border-radius: 2px; font-size: 14px; }
.toolbar input[type=search]:focus { outline: 2px solid var(--leaf); outline-offset: -1px; }

.course { display: grid; grid-template-columns: 240px 1fr; gap: 0 clamp(20px, 4vw, 56px); padding: 36px 0; border-bottom: 1px solid var(--rule); }
.course-head h2 { font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; letter-spacing: -.03em; line-height: 1.25; }
.course-head .mono { color: var(--ink-3); display: block; margin-bottom: 6px; }
.course-head p { margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }
.course-head .count { margin-top: 14px; }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-content: start; }
.topic {
  display: flex; flex-direction: column; gap: 6px; min-height: 148px;
  padding: 14px 16px 14px; border: 1px solid var(--rule); background: transparent; text-decoration: none;
  position: relative;
}
.topic .unit { font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); }
.topic h3 { font-size: 17px; letter-spacing: -.02em; line-height: 1.35; }
.topic p { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.topic .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 8px; }
.topic.soon { color: var(--ink-3); border-style: dashed; }
.topic.soon h3 { color: var(--ink-2); font-weight: 600; }
a.topic { border-color: var(--ink); background: var(--card); }
a.topic:hover { background: var(--raised); box-shadow: 4px 4px 0 var(--ink); transform: translate(-2px, -2px); }
a.topic { transition: transform .15s, box-shadow .15s, background .15s; }
.topic .cards-mini { display: flex; gap: 4px; }
.topic .cards-mini i { width: 16px; height: 20px; border: 1px solid var(--ink); background: var(--sprout); }
.topic.soon .cards-mini i { border-color: var(--rule); background: none; }
.empty { padding: 40px 0; color: var(--ink-3); display: none; }

.site-foot { padding: 32px 0 48px; display: grid; gap: 6px; }
.site-foot .foot-org { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding-top: 22px; margin-bottom: 4px; border-top: 1px solid var(--rule); }
.foot-home { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.foot-home .brand-mark { width: 22px; height: 22px; }
.foot-home b { font-size: 15px; }
.foot-home .mono, .foot-mail { font-size: 12.5px; color: var(--ink-3); }
.foot-home:hover .mono, .foot-mail:hover { color: var(--forest); }

/* ═════════ 주제 페이지 ═════════ */
.topic-hero { padding: clamp(36px, 6vw, 72px) 0 clamp(24px, 4vw, 40px); border-bottom: 2px solid var(--ink); }
.topic-hero .meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-bottom: 16px; }
.topic-hero h1 { font-size: clamp(32px, 4.6vw, 56px); font-weight: 800; line-height: 1.18; letter-spacing: -.04em; }
.topic-hero .lead { margin-top: 16px; max-width: 40em; color: var(--ink-2); font-size: clamp(15px, 1.25vw, 18px); }
.prereq { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13.5px; }
.prereq .mono { color: var(--ink-3); }
.prereq span.p { padding: 2px 9px; background: var(--paper-2); }
/* 누를 수 있는 선수 개념: 카드로 가는 링크(→)와 중학교 개념 설명 창 버튼(js/prereq.js) */
.prereq .p-card, .prereq .p-basic { padding: 1px 9px; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--rule); text-decoration: none; cursor: pointer; }
.prereq .p-card:hover, .prereq .p-basic:hover { border-color: var(--ink-3); }
.prereq .p-card::after { content: "→"; margin-left: 5px; color: var(--ink-3); }
.prereq .p-basic { border-style: dashed; }
.prereq .p-basic::after { content: "설명"; margin-left: 6px; font-family: var(--f-mono); font-size: 10.5px; color: var(--forest); }
dialog.basic-card { width: min(640px, calc(100vw - 32px)); max-height: min(80vh, 760px); padding: 0; color: var(--ink); background: var(--card); border: 1px solid var(--ink); }
dialog.basic-card::backdrop { background: rgba(10, 10, 12, .45); }
.basic-card header { position: sticky; top: 0; z-index: 2; display: flex; align-items: baseline; gap: 12px; padding: 14px 20px; background: var(--card); border-bottom: 1px solid var(--ink); }
.basic-card header .mono { font-size: 11.5px; color: var(--forest); }
.basic-card h2 { font-size: 20px; letter-spacing: -.02em; }
.basic-x { margin-left: auto; font-size: 22px; line-height: 1; color: var(--ink-3); background: none; border: 0; cursor: pointer; }
.basic-x:hover { color: var(--ink); }
.basic-body { padding: 16px 20px 22px; font-size: 15.5px; line-height: 1.75; }
.basic-body p + p, .basic-body p + figure, .basic-body figure + p, .basic-body ul, .basic-body ol { margin-top: 10px; }
.basic-body figure { margin: 14px 0; text-align: center; }
.basic-body figure svg { max-width: 100%; height: auto; }
.basic-body figcaption { font-size: 13px; color: var(--ink-3); }
.basic-body .ex { margin-top: 12px; padding: 10px 14px; background: var(--paper-2); }

.topic-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(20px, 3vw, 44px); padding-top: 32px; }
.toc { position: sticky; top: 80px; align-self: start; font-size: 13.5px; }
.toc p { color: var(--ink-3); margin-bottom: 8px; }
.toc li a { display: grid; grid-template-columns: 46px 1fr; padding: 8px 0; border-top: 1px solid var(--rule); text-decoration: none; color: var(--ink-2); line-height: 1.4; }
.toc li a .mono { color: var(--ink-3); }
.toc li a.on { color: var(--ink); font-weight: 700; }
.toc li a.on .mono { color: var(--forest); }
.toc .progress { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--ink); color: var(--ink-3); }

/* ───── 개념 카드 ───── */
.card { border: 1px solid var(--ink); background: var(--card); margin-bottom: clamp(28px, 4vw, 44px); }
.card-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 14px 22px; border-bottom: 1px solid var(--ink);
}
.card-head .no { font-family: var(--f-mono); font-size: 13px; color: var(--forest); }
.card-head h2 { font-size: clamp(20px, 2.1vw, 26px); letter-spacing: -.03em; line-height: 1.3; }
.card-head .kind { margin-left: auto; font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); }
.card-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.card-fig { padding: 18px 22px 22px; border-right: 1px solid var(--rule); min-width: 0; }
.ctl { margin-top: 10px; }
.ctl label.mono { display: block; }
.ctl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.toggles { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 12px; font-size: 13.5px; }
.toggles label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.toggles input { accent-color: var(--ink); margin: 0; }
.toggles i { width: 14px; height: 3px; background: var(--c); display: inline-block; }
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 8px; }
.nums.n4 { grid-template-columns: repeat(4, 1fr); }
.nums div { border-top: 1px solid var(--rule); padding-top: 7px; min-width: 0; }
.nums dt { color: var(--ink-3); font-size: 11px; font-family: var(--f-mono); }
.nums dd { font-family: var(--f-mono); font-size: 16px; color: var(--ink); }
.nums dd.bad, .bad { color: var(--warn); }
.nums dd.good { color: var(--forest); }
.legend { color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 6px; }
.dot.real { background: var(--ink); }
.dot.ghost { border: 1.5px dashed var(--forest); }
.line-key { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--c, var(--ink)); margin-left: 6px; vertical-align: middle; }
.line-key.dash { border-top-style: dashed; }
.fig-note { margin-top: 8px; font-size: 12px; color: var(--ink-3); }

.cv-wide { width: 100%; aspect-ratio: 16 / 9; }
.cv-sq { width: 100%; aspect-ratio: 1 / 1; }
.fig-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-content: start; }
.fig-2 > .ctl { grid-column: 1 / -1; }

.readout { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding-top: 12px; border-top: 1px solid var(--rule); }
.readout .mid { text-align: center; }
.swatch-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.swatch { width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); background: #888; }
.swatch-wrap .small { color: var(--ink-3); max-width: 9em; line-height: 1.35; font-family: var(--f-mono); }

.steps { padding: 8px 0; }
.steps li { position: relative; padding: 11px 22px 11px 84px; font-size: 14.5px; line-height: 1.65; border-bottom: 1px dotted var(--rule); }
.steps li:last-child { border-bottom: 0; }
.steps .tag { position: absolute; left: 22px; top: 14px; font-family: var(--f-mono); font-size: 11.5px; color: var(--forest); }
.steps li.warn { background: var(--warn-bg); }
.steps li.warn .tag { color: var(--warn); }
.steps em { font-style: normal; font-weight: 700; }
.formula { font-family: var(--f-serif); font-style: italic; font-size: 17px; background: var(--paper-2); padding: 1px 8px; white-space: nowrap; }

/* ───── 확인 문제 ───── */
.quiz { border-top: 1px solid var(--ink); padding: 16px 22px 20px; background: var(--raised); }
.quiz h3 { font-size: 15px; display: flex; gap: 10px; align-items: baseline; }
.quiz h3 .mono { color: var(--forest); font-weight: 400; }
.quiz .q { margin: 6px 0 12px; font-size: 15px; }
.quiz ol { display: grid; gap: 6px; }
.quiz button.opt {
  width: 100%; text-align: left; display: grid; grid-template-columns: 26px 1fr; gap: 8px;
  padding: 9px 12px; background: var(--card); border: 1px solid var(--rule); border-radius: 2px; font-size: 14.5px;
}
.quiz button.opt:hover { border-color: var(--ink); }
.quiz button.opt .mono { color: var(--ink-3); padding-top: 2px; }
.quiz button.opt.right { border-color: var(--forest); background: var(--right-bg); }
.quiz button.opt.wrong { border-color: var(--warn); background: var(--warn-bg); }
.quiz .why { display: none; grid-column: 2; font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.quiz button.opt.right .why, .quiz button.opt.wrong .why { display: block; }
.quiz button.opt .why b { color: var(--ink); }

/* ───── 영상 블록 ───── */
.video-block { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(20px, 4vw, 56px); align-items: center; background: var(--night); color: var(--on-night); padding: clamp(24px, 4vw, 44px); margin-bottom: 44px; }
.video-block .mono { color: var(--sprout); }
.video-block h2 { font-size: clamp(22px, 2.6vw, 32px); letter-spacing: -.03em; margin: 10px 0 12px; line-height: 1.3; }
.video-block p { color: rgba(243,244,239,.72); max-width: 30em; }
.phone { position: relative; width: min(300px, 78vw); border: 1px solid rgba(255,255,255,.18); border-radius: 2px; overflow: hidden; background: #111; }
.phone canvas { width: 100%; height: auto; aspect-ratio: 9 / 16; cursor: pointer; }
.reel-play { position: absolute; left: 50%; top: 45%; translate: -50% -50%; width: 60px; height: 60px; border-radius: 50%; border: 0; background: rgba(243,244,239,.92); color: var(--night); display: none; place-items: center; }
.reel-play svg { width: 24px; height: 24px; margin-left: 3px; }
.phone.paused .reel-play { display: grid; }
.reel-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px 10px; background: #111; }
.reel-bar button { background: none; border: 0; color: rgba(243,244,239,.8); padding: 0; min-width: 5em; text-align: left; }
.reel-bar input { accent-color: var(--leaf); margin: 0; flex: 1; }
.reel-bar span { color: rgba(243,244,239,.6); }

/* ───── 다음 주제 ───── */
.next { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 56px; }
.next a, .next div { border: 1px solid var(--ink); padding: 16px 18px; text-decoration: none; background: var(--card); }
.next div { border-style: dashed; border-color: var(--rule); color: var(--ink-3); background: none; }
.next a:hover { box-shadow: 4px 4px 0 var(--ink); transform: translate(-2px, -2px); }
.next .mono { color: var(--ink-3); display: block; }
.next b { font-size: 17px; }

/* ───── 반응형 ───── */
@media (max-width: 1000px) {
  .card-body { grid-template-columns: 1fr; }
  .card-fig { border-right: 0; border-bottom: 1px solid var(--rule); }
  .topic-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 12px; }
  .intro { grid-template-columns: 1fr; }
  .course { grid-template-columns: 1fr; gap: 16px; }
  .video-block { grid-template-columns: 1fr; justify-items: center; }
}
@media (max-width: 640px) {
  .crumbs { display: none; }
  .brand small { display: none; }
  .toolbar { position: static; }
  .toolbar input[type=search] { margin-left: 0; width: 100%; min-width: 0; }
  .legend-steps ol { grid-template-columns: repeat(2, 1fr); }
  .legend-steps li { border-right: 1px solid var(--rule) !important; border-bottom: 1px solid var(--rule) !important; }
  .legend-steps li:nth-child(2n) { border-right: 0 !important; }
  .legend-steps li:nth-child(n+5) { border-bottom: 0 !important; }
  .card-head, .card-fig { padding-left: 14px; padding-right: 14px; }
  .card-head .kind { margin-left: 0; width: 100%; }
  .steps li { padding: 11px 14px; }
  .steps .tag { position: static; display: block; margin-bottom: 1px; }
  .quiz { padding: 14px; }
  .ctl-row { grid-template-columns: 1fr; }
  .readout { grid-template-columns: 1fr 1fr; }
  .readout .mid { grid-column: 1 / -1; grid-row: 1; }
  .nums dd { font-size: 14px; }
  .nums.n4 { grid-template-columns: repeat(2, 1fr); }
  .next { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ═════════ 목차 화면 (메인·과목) — js/home.js ═════════ */
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px 24px; align-content: start; }
.course-head h2 a { text-decoration: none; }
.course-head h2 a:hover { color: var(--forest); }
.link { font-size: 14px; color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule); }
.link:hover { color: var(--ink); border-color: var(--ink); }
.chapter h3 { font-size: 15px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); display: flex; gap: 8px; align-items: baseline; letter-spacing: -.01em; }
.chapter h3 .mono { color: var(--forest); }
.chapter ol > li > a, .chapter ol > li > div { display: grid; grid-template-columns: 34px 1fr auto; gap: 6px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--rule); text-decoration: none; font-size: 14.5px; line-height: 1.4; }
.chapter ol > li > a:hover .t { text-decoration: underline; }
.chapter ol > li > a .mono { color: var(--ink-3); font-size: 11.5px; }
.chapter .cnt { font-size: 11px; color: var(--forest); }
.chapter li.soon > div { color: var(--ink-3); }
.chapter .hits { display: none; padding: 2px 0 6px 40px; font-size: 13px; color: var(--ink-2); }
.searching .chapter .hits { display: block; }
.chapter .hits li::before { content: "· "; color: var(--leaf); }

.course-hero { padding: clamp(36px, 6vw, 72px) 0 clamp(20px, 3vw, 32px); border-bottom: 2px solid var(--ink); }
.course-hero h1 { font-size: clamp(34px, 5vw, 60px); font-weight: 800; letter-spacing: -.04em; line-height: 1.15; margin: 6px 0 10px; }
.c-chapter { padding: 28px 0 8px; }
.c-chapter h2 { font-size: clamp(20px, 2.2vw, 26px); display: flex; gap: 12px; align-items: baseline; letter-spacing: -.03em; padding-bottom: 10px; border-bottom: 1px solid var(--ink); }
.c-chapter h2 .mono { color: var(--forest); font-size: 15px; }
.c-sec { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 6px 24px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.c-sec-head { display: grid; grid-template-columns: 38px 1fr; gap: 2px 6px; align-content: start; }
.c-sec-head .num { color: var(--ink-3); padding-top: 2px; }
.c-sec-head a { text-decoration: none; }
.c-sec-head a:hover b { text-decoration: underline; }
.c-sec-head b { font-size: 16px; letter-spacing: -.015em; }
.c-sec-head .code { grid-column: 2; font-size: 11px; color: var(--ink-3); }
.c-sec.soon .c-sec-head b { color: var(--ink-3); font-weight: 600; }
.c-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 16px; }
.c-items a { display: block; padding: 6px 10px; border: 1px solid var(--rule); background: var(--card); text-decoration: none; font-size: 13.5px; line-height: 1.45; }
.c-items a:hover { border-color: var(--ink); }
.c-items li.video a { background: var(--night); color: var(--on-night); border-color: var(--night); }
.c-items .mono { color: var(--sprout); font-size: 11px; margin-right: 6px; }
@media (max-width: 720px) {
  .c-sec { grid-template-columns: 1fr; }
}
.chapter .cnt.dim { color: var(--ink-3); }

/* ───── 읽기 블록 (type: text) — 인터랙티브가 어울리지 않는 내용을 글·그림·사진·표로 ───── */
.c-items li.text .mono { color: var(--forest); }
.reading-body { padding: 20px 26px 24px; font-size: 15.5px; line-height: 1.8; }
.reading-body > * + * { margin-top: 12px; }
.reading-body .ask { font-size: 16.5px; font-weight: 600; line-height: 1.6; }
.reading-body h3 { font-size: 16px; margin-top: 24px; padding-top: 14px; border-top: 1px dotted var(--rule); }
.reading-body h3 .mono { color: var(--forest); font-size: 11.5px; font-weight: 400; margin-right: 8px; }
.reading-body em { font-style: normal; font-weight: 700; }
.reading-body ul.dots { padding-left: 1.2em; list-style: disc; }
.reading-body ul.dots li + li { margin-top: 4px; }
.reading-body figure { margin: 18px 0 6px; }
.reading-body figure img, .reading-body figure svg { display: block; width: 100%; height: auto; border: 1px solid var(--rule); background: var(--fig-bg); }
.reading-body figure.half { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reading-body figure.half figcaption { grid-column: 1 / -1; }
.reading-body figcaption { margin-top: 6px; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.reading-body figcaption .src { display: block; font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.reading-body .tbl { overflow-x: auto; }
.reading-body table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.reading-body th, .reading-body td { border-top: 1px solid var(--rule); padding: 7px 10px 7px 0; text-align: left; vertical-align: top; }
.reading-body thead th { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.reading-body tbody th { font-weight: 700; white-space: nowrap; }
.reading-body .judge { background: var(--warn-bg); padding: 12px 16px; font-size: 14.5px; line-height: 1.7; }
.reading-body .judge b:first-child { font-family: var(--f-mono); font-size: 11.5px; font-weight: 400; color: var(--warn); margin-right: 10px; }
@media (max-width: 640px) {
  .reading-body { padding: 16px 14px 18px; font-size: 15px; }
  .reading-body figure.half { grid-template-columns: 1fr; }
}
.reading-body figure.third { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.reading-body figure.third figcaption { grid-column: 1 / -1; }
.reading-body figure.third img { aspect-ratio: 1; object-fit: cover; }
@media (max-width: 640px) { .reading-body figure.third { grid-template-columns: 1fr 1fr; } }
.reading-body figure.narrow { max-width: 420px; }
.reading-body .src a { color: inherit; }

/* ───── 학습 도구: 메모, 형광펜, 확인 문제 기록 (js/notes.js) ───── */
.top-right a + a { margin-left: 14px; }
.card-head .nb-memo { margin-left: 10px; flex: none; padding: 2px 10px; border: 1px solid var(--rule); border-radius: 2px; background: var(--card); font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-2); cursor: pointer; }
.card-head .nb-memo:hover { border-color: var(--ink); color: var(--ink); }
.card-head .nb-memo.has { border-color: var(--forest); color: var(--forest); }
.card-head .nb-memo.has::before { content: "● "; font-size: 8px; vertical-align: 2px; }
.nb-panel { border-top: 1px dashed var(--rule); padding: 12px 22px 14px; background: var(--memo-bg); }
.nb-panel label { display: block; color: var(--ink-3); font-size: 11.5px; margin-bottom: 6px; }
.nb-panel textarea { width: 100%; min-height: 68px; resize: vertical; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 2px; background: var(--raised); font: inherit; font-size: 14.5px; line-height: 1.6; color: var(--ink); }
.nb-panel textarea:focus { outline: none; border-color: var(--ink); }
.nb-state { margin-top: 4px; font-size: 11px; color: var(--ink-3); }
.nb-state a { color: inherit; }
mark.hl { background: var(--hl); color: inherit; padding: 0 1px; border-radius: 1px; cursor: pointer; }
.nb-fab { position: fixed; z-index: 50; padding: 6px 12px; border: 0; border-radius: 2px; background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 600; box-shadow: 0 3px 12px rgba(0,0,0,.18); cursor: pointer; }
.nb-fab::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; background: var(--hl); vertical-align: -1px; }
.nb-fab.rm::before { background: none; border: 1px solid var(--paper); }
.quiz h3 .nb-prev { margin-left: auto; font-size: 11px; color: var(--ink-3); text-decoration: none; font-weight: 400; }
.quiz h3 .nb-prev.bad { color: var(--warn); }
.toc li a { position: relative; }
.toc li a.seen:not(.on) .mono { color: var(--leaf); }
.toc li a.seen { padding-right: 14px; }
.toc li a.seen::before { content: "✓"; position: absolute; right: 0; top: 8px; font-size: 11px; color: var(--leaf); }
.toc li a.noted::after { content: ""; position: absolute; right: 2px; top: 26px; width: 6px; height: 6px; border-radius: 50%; background: #e0b400; }
.toc .toc-links { margin-top: 10px; }
.toc .toc-links a { color: var(--ink-2); }

/* 절: 카드 목록 접기(js/reader.js) — 접으면 본문이 넓어진다 */
.toc .toc-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.toc-fold { font: inherit; font-size: 11.5px; padding: 2px 8px; color: var(--ink-2); background: var(--card); border: 1px solid var(--rule); border-radius: 2px; cursor: pointer; }
.toc-fold:hover { color: var(--ink); border-color: var(--ink-3); }
body.toc-folded .topic-layout { grid-template-columns: auto minmax(0, 1fr); }
body.toc-folded .toc ol, body.toc-folded .toc .progress, body.toc-folded .toc .toc-links { display: none; }
body.toc-folded .toc .toc-title { font-size: 0; }
body.toc-folded .toc .toc-fold { font-size: 12px; }

/* 카드 크게 보기: 화면 전체를 덮는다. 캠버스는 core.js fit()의 ResizeObserver가 다시 그린다 */
.card-max { flex: none; align-self: center; display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--ink-2); background: none; border: 1px solid var(--rule); border-radius: 2px; cursor: pointer; }
.card-head .kind + .card-max { margin-left: 0; }
.card-head h2 + .card-max { margin-left: auto; }
.card-max:hover { color: var(--ink); border-color: var(--ink-3); }
.card-max svg { width: 16px; height: 16px; }
.card.is-max { position: fixed; inset: 0; z-index: 60; margin: 0; overflow-y: auto; border: 0; }
.card.is-max .card-head { position: sticky; top: 0; z-index: 2; background: var(--card); }
.card.is-max .card-head, .card.is-max .card-body { max-width: 1520px; margin-inline: auto; }
body.has-max { overflow: hidden; }

/* KaTeX 수식(js/math.js): 기본 1.21em은 한글 본문 옆에서 커 보여 줄인다 */
.katex { font-size: 1.08em; }
/* \text{} 안 한글: KaTeX 글꼴에 한글이 없어 넓은 명조체로 대체되므로, 라틴은 KaTeX_Main을 두고 한글만 본문 글꼴로 */
.katex .text { font-family: KaTeX_Main, var(--f-kr); }

/* 카드 아래 연관 카드(빌드가 graph/concepts.txt로 고른다) */
.rel { display: grid; gap: 6px; margin: calc(10px - clamp(28px, 4vw, 44px)) 0 clamp(28px, 4vw, 44px); padding: 10px 16px 12px; background: var(--paper-2); border: 1px solid var(--rule); border-top: 0; font-size: 13.5px; }
.rel > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.rel > div > .mono { flex: none; width: 9.5em; font-size: 11.5px; color: var(--ink-3); }
.rel a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); line-height: 1.5; }
.rel a:hover { border-bottom-color: var(--ink); }
.rel a small { margin-right: 5px; font-size: 11px; color: var(--ink-3); }
@media (max-width: 640px) { .rel > div > .mono { width: 100%; } }
@media (max-width: 640px) {
  .nb-panel { padding: 12px 14px; }
  .card-head .nb-memo { margin-left: 0; }
}

/* ───── 내 노트 페이지 (notes.html) ───── */
.btn.ghost { background: var(--card); color: var(--ink); cursor: pointer; }
.btn.ghost:hover { background: var(--paper-2); border-color: var(--ink); color: var(--ink); }
.btn.danger { color: var(--warn); border-color: var(--warn); }
button.btn { cursor: pointer; font-family: inherit; }
.nb-hero { padding: clamp(32px, 5vw, 60px) 0 20px; }
.nb-hero h1 { font-size: clamp(30px, 4vw, 48px); font-weight: 800; letter-spacing: -.04em; }
.nb-hero .lead { margin-top: 12px; max-width: 42em; color: var(--ink-2); }
.nb-stats { margin-top: 20px; max-width: 760px; }
.nb-stats dd small { font-size: 11px; color: var(--ink-3); }
.nb-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--ink); position: sticky; top: 56px; background: var(--paper); z-index: 5; }
.nb-tabs a { padding: 10px 16px; text-decoration: none; color: var(--ink-2); font-weight: 600; border: 1px solid transparent; border-bottom: 0; margin-bottom: -2px; }
.nb-tabs a[aria-current="page"] { color: var(--ink); background: var(--card); border-color: var(--ink); border-bottom: 2px solid var(--card); }
.nb-view { padding: 8px 0 60px; max-width: 860px; }
.nb-sec { margin-top: 28px; font-size: 17px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.nb-sec .mono { color: var(--forest); font-size: 11.5px; font-weight: 400; }
.nb-sec a { text-decoration: none; }
.nb-sec a:hover { text-decoration: underline; }
.nb-item { margin-top: 10px; padding: 14px 18px; background: var(--card); border: 1px solid var(--rule); }
.nb-title { font-weight: 700; text-decoration: none; }
a.nb-title:hover { text-decoration: underline; }
.nb-date { margin-left: 10px; font-size: 11px; color: var(--ink-3); }
.nb-note { margin-top: 8px; white-space: pre-wrap; font-size: 15px; line-height: 1.7; background: var(--memo-bg); padding: 8px 12px;  }
.nb-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; }
.nb-actions a { color: var(--forest); font-weight: 600; }
.nb-actions button, .nb-quotes button { border: 0; background: none; padding: 0; color: var(--ink-3); font-size: 13px; cursor: pointer; text-decoration: underline; }
.nb-actions button:hover, .nb-quotes button:hover { color: var(--warn); }
.nb-quotes { margin-top: 8px; display: grid; gap: 6px; }
.nb-quotes li { display: flex; gap: 10px; align-items: baseline; font-size: 14.5px; line-height: 1.6; }
.nb-quotes mark.hl { cursor: default; }
.nb-quotes button { text-decoration: none; font-size: 16px; }
.nb-wrong .nb-q { margin-top: 8px; font-size: 15px; font-weight: 600; line-height: 1.6; }
.nb-chosen { margin-top: 8px; display: grid; gap: 6px; }
.nb-chosen li { padding: 8px 12px; background: var(--warn-bg);  font-size: 14px; line-height: 1.6; }
.nb-chosen .mono { display: block; font-size: 11px; color: var(--warn); }
.nb-chosen b { display: block; }
.nb-chosen .why-t { color: var(--ink-2); font-size: 13.5px; }
.nb-wrong details { margin-top: 8px; font-size: 14px; }
.nb-wrong summary { cursor: pointer; color: var(--forest); font-weight: 600; }
.nb-wrong details p { margin-top: 6px; padding: 8px 12px; background: var(--right-bg);  line-height: 1.6; }
.nb-wrong.done { opacity: .6; }
.nb-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; margin-top: 16px; font-size: 14px; }
.nb-empty { margin-top: 24px; color: var(--ink-2); font-size: 15px; }
.nb-backup { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.nb-backup > div { padding: 18px; background: var(--card); border: 1px solid var(--rule); }
.nb-backup h2 { font-size: 16px; }
.nb-backup p { margin: 6px 0 12px; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
@media (max-width: 760px) {
  .nb-backup { grid-template-columns: 1fr; }
  .nb-stats.nums.n4 { grid-template-columns: 1fr 1fr; }
  .nb-tabs a { padding: 9px 10px; font-size: 14px; }
  .nb-item { padding: 12px 14px; }
}

/* ───── 개념 지도 (graph.html) — 색은 --gv-* 변수, 라이트 테마에서 밝게 ───── */
.gv-body {
  --gv-bg: #1c1c1f; --gv-bg-2: #232327; --gv-panel: #222226; --gv-float: rgba(38,38,43,.92); --gv-pop: rgba(34,34,38,.97); --gv-line: #34343a;
  --gv-ink: #dcdce0; --gv-ink-strong: #ececf0; --gv-ink-max: #fff; --gv-ink-2: #b8b8c0; --gv-ink-3: #9a9aa3; --gv-ink-4: #7c7c85; --gv-accent-soft: #c4b5fd;
}
[data-theme="light"] .gv-body {
  --gv-bg: #f3f4ef; --gv-bg-2: #fbfbf8; --gv-panel: #fbfbf8; --gv-float: rgba(255,255,253,.94); --gv-pop: rgba(255,255,253,.98); --gv-line: #d6d8cf;
  --gv-ink: #2a2b27; --gv-ink-strong: #1c1d1a; --gv-ink-max: #111; --gv-ink-2: #4f514a; --gv-ink-3: #6c6e66; --gv-ink-4: #8a8c84; --gv-accent-soft: #6d4fd6;
}
.gv-body { overflow: hidden; background: var(--gv-bg); color: var(--gv-ink); }
.gv-body .top { background: var(--gv-bg); border-bottom-color: var(--gv-line); }
.gv-body .brand, .gv-body .brand-mark, .gv-body .crumbs, .gv-body .crumbs b, .gv-body .top-right { color: var(--gv-ink); }
.gv-body .crumbs span[aria-hidden], .gv-body .top-right a { color: var(--gv-ink-3); }
.gv-body .top-right a:hover { color: var(--gv-ink-max); }
.gv { position: relative; height: calc(100vh - 57px); height: calc(100dvh - 57px); display: flex; }
.gv-stage { position: relative; flex: 1; min-width: 0; background: radial-gradient(ellipse at 50% 45%, var(--gv-bg-2) 0%, var(--gv-bg) 70%); }
#gv-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#gv-canvas:active { cursor: grabbing; }
.gv-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.gv-top > * { pointer-events: auto; }
.gv-top input[type=search] { width: 260px; padding: 7px 12px; border: 1px solid var(--gv-line); background: var(--gv-float); color: var(--gv-ink-strong); border-radius: 2px; font-size: 14px; outline: none; }
.gv-top input[type=search]::placeholder { color: var(--gv-ink-4); }
.gv-top input[type=search]:focus { border-color: #a78bfa; }
.gv-btns { margin-left: auto; display: flex; gap: 6px; }
.gv-btns button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--gv-line); background: var(--gv-float); color: var(--gv-ink-2); border-radius: 2px; cursor: pointer; }
.gv-btns button:hover, .gv-btns button[aria-expanded="true"] { color: var(--gv-ink-max); border-color: #a78bfa; }
.gv-btns svg { width: 18px; height: 18px; }
.gv-top .gv-domain { margin-top: 0; width: 168px; flex: none; background: var(--gv-float); border-color: var(--gv-line); }
.gv-top .gv-domain button { padding: 7px 0; }
.gv-settings { position: absolute; top: 54px; right: 12px; width: 270px; max-height: calc(100% - 70px); overflow-y: auto; background: var(--gv-pop); border: 1px solid var(--gv-line); border-radius: 2px; padding: 6px 0; box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 13px; }
.gv-settings details { border-bottom: 1px solid var(--gv-line); padding: 4px 14px 10px; }
.gv-settings details:last-child { border-bottom: 0; }
.gv-settings summary { cursor: pointer; padding: 8px 0 4px; color: var(--gv-ink-strong); font-weight: 600; list-style: none; }
.gv-settings summary::before { content: "›"; display: inline-block; width: 14px; color: var(--gv-ink-3); transition: transform .15s; }
.gv-settings details[open] summary::before { transform: rotate(90deg); }
.gv-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; color: var(--gv-ink-2); }
.gv-row.col { flex-direction: column; align-items: stretch; gap: 4px; }
.gv-row input[type=range] { width: 100%; accent-color: #a78bfa; }
.gv-row input[type=checkbox] { accent-color: #a78bfa; width: 16px; height: 16px; }
.gv-courses { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.gv-course-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 1px solid var(--gv-line); border-radius: 2px; background: none; color: var(--gv-ink); font-size: 12px; cursor: pointer; }
.gv-course-chip i, .gv-groups i, .gv-chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.gv-course-chip[aria-pressed="false"] { opacity: .35; }
.gv-seg { display: flex; margin-top: 6px; border: 1px solid var(--gv-line); border-radius: 2px; overflow: hidden; }
.gv-seg button { flex: 1; padding: 5px 0; border: 0; background: none; color: var(--gv-ink-2); font-size: 12.5px; cursor: pointer; }
.gv-seg button[aria-pressed="true"] { background: #a78bfa; color: #16161a; font-weight: 600; }
.gv-groups { margin-top: 8px; display: grid; gap: 4px; color: var(--gv-ink-2); }
.gv-groups li { display: flex; gap: 8px; align-items: center; }
.gv-groups i.ring { background: none; border: 2px solid var(--gv-ink-max); width: 9px; height: 9px; }
.gv-reset { margin-top: 8px; padding: 5px 10px; border: 1px solid var(--gv-line); background: none; color: var(--gv-ink-2); border-radius: 2px; cursor: pointer; font-size: 12px; }
.gv-reset:hover { color: var(--gv-ink-max); border-color: #a78bfa; }
.gv-hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 6px 14px; border-radius: 2px; background: var(--gv-float); color: var(--gv-ink-3); font-size: 12.5px; white-space: nowrap; transition: opacity .6s; pointer-events: none; }
.gv-hint.off { opacity: 0; }
.gv-panel { position: relative; width: 370px; flex: none; overflow-y: auto; border-left: 1px solid var(--gv-line); background: var(--gv-panel); padding: 18px 20px 30px; color: var(--gv-ink); }
.gv-close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--gv-ink-3); cursor: pointer; }
.gv-close:hover { color: var(--gv-ink-max); }
.gv-panel h2 { font-size: 22px; letter-spacing: -.03em; margin-top: 4px; padding-right: 24px; color: var(--gv-ink-strong); }
.gv-panel h3 { margin-top: 18px; font-size: 12.5px; color: var(--gv-ink-3); font-weight: 600; }
.gv-course { font-size: 11.5px; }
.gv-prog { margin-top: 6px; font-size: 13.5px; color: var(--gv-ink-2); }
.gv-prog b { color: var(--gv-ink-max); } .gv-prog .bad { color: #ff7b73; }
.gv-local { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; color: var(--gv-ink-2); padding: 8px 10px; background: var(--gv-bg); border-radius: 2px; }
.gv-local input { accent-color: #a78bfa; vertical-align: middle; }
.gv-local input[type=range] { width: 70px; }
.gv-blocks { margin-top: 10px; display: grid; }
.gv-blocks li { display: grid; grid-template-columns: 34px 1fr; gap: 0 4px; font-size: 14px; line-height: 1.45; padding: 8px 0; border-top: 1px solid var(--gv-line); }
.gv-blocks .bd { grid-row: 1; font-size: 12px; }
.gv-blocks li > a { grid-column: 2; grid-row: 1; text-decoration: none; font-weight: 600; color: var(--gv-ink-strong); }
.gv-blocks li > a:hover { color: var(--gv-accent-soft); }
.gv-secs li { grid-template-columns: 1fr auto; }
.gv-secs li > a { grid-column: 1; }
.gv-secs li > .mono { grid-column: 2; grid-row: 1; color: var(--gv-ink-3); font-size: 12px; }
.gv-blocks li .mono { grid-column: 2; font-size: 11px; color: var(--gv-ink-4); }
.gv-blocks .ok { color: #8fd16f; } .gv-blocks .no { color: var(--gv-ink-4); } .gv-blocks .bad { color: #ff7b73; } .gv-blocks .memo { color: #e0b400; font-size: 9px; }
.gv-blocks .k { font-family: var(--f-mono); font-size: 11px; font-weight: 400; color: #a78bfa; margin-right: 5px; }
.gv-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.gv-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--gv-line); border-radius: 2px; background: var(--gv-bg); color: var(--gv-ink); font-size: 13px; cursor: pointer; }
.gv-chip:hover { border-color: #a78bfa; color: var(--gv-ink-max); }
.gv-none { margin-top: 6px; font-size: 12.5px; color: var(--gv-ink-4); }
.gv-path { margin-top: 18px; padding: 8px 14px; border: 1px solid #a78bfa; border-radius: 2px; background: none; color: var(--gv-accent-soft); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.gv-path:hover { background: #a78bfa; color: #16161a; }
.gv-steps { margin-top: 10px; display: grid; gap: 4px; counter-reset: st; }
.gv-steps li { counter-increment: st; display: flex; gap: 8px; align-items: center; }
.gv-steps li::before { content: counter(st); font-family: var(--f-mono); font-size: 11px; color: var(--gv-ink-4); width: 18px; text-align: right; }
@media (max-width: 760px) {
  .gv-panel { position: absolute; left: 0; right: 0; bottom: 0; width: auto; max-height: 58%; border-left: 0; border-top: 1px solid var(--gv-line); box-shadow: 0 -8px 24px rgba(0,0,0,.4); z-index: 6; border-radius: 2px 2px 0 0; }
  .gv-top input[type=search] { width: auto; flex: 1; min-width: 0; }
  .gv-btns { margin-left: 0; }
  .gv-settings { left: 12px; width: auto; }
  .gv-hint { font-size: 11.5px; white-space: normal; width: calc(100% - 40px); text-align: center; border-radius: 2px; }
}
.gv-groups i.sh { background: var(--gv-ink-2); border-radius: 0; }
.gv-groups i.sh.dot { border-radius: 50%; }
.gv-groups i.sh.sq { width: 8px; height: 8px; }
.gv-groups i.sh.tri { width: 0; height: 0; background: none; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid var(--gv-ink-2); }
.gv-groups i.sh.course { border-radius: 50%; width: 12px; height: 12px; background: var(--gv-ink-2); box-shadow: 0 0 0 2px var(--gv-ink-max) inset; }
.gv-groups i.sh.hub { background: none; border: 2px solid var(--gv-ink-2); border-radius: 50%; width: 9px; height: 9px; }
.gv-chip i.hubdot { background: none; border: 2px solid; width: 9px; height: 9px; }
.gv-open { display: inline-block; margin-top: 12px; padding: 7px 14px; border-radius: 2px; background: #a78bfa; color: #16161a; font-weight: 700; font-size: 14px; text-decoration: none; }
.gv-open:hover { background: var(--gv-accent-soft); }

/* ───── 메인: 과목 체계도 ───── */
.tree { padding: 28px 0 36px; border-top: 2px solid var(--ink); }
.tree-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 16px; }
.tree-head h2 { font-size: clamp(20px, 2.2vw, 26px); font-weight: 800; letter-spacing: -.03em; margin: 0; }
.tree [data-track="phy"] { --tc: #4f7fd6; }
.tree [data-track="chem"] { --tc: #8a5fd0; }
.tree [data-track="bio"] { --tc: #d0702f; }
.tree [data-track="earth"] { --tc: #9a7748; }
.tree [data-track="common"] { --tc: var(--forest); }
.tree [data-track="fusion"] { --tc: #c0587e; }
.tree [data-track="math"] { --tc: #c98a12; }
.tree-band { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 12px; padding: 12px; background: var(--paper-2); border: 1px solid var(--rule); }
.tree-band > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.band-lb { color: var(--tc); font-weight: 600; font-size: 13px; }
.tree-math > div { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: start; gap: 12px; }
.m-col { display: flex; flex-direction: column; gap: 8px; }
.m-col h3 { margin: 0; padding-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--tc); border-bottom: 1px solid var(--rule); }
.tree-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 14px 0; }
.tree-col { position: relative; display: flex; flex-direction: column; gap: 10px; }
.tree-col::before { content: ""; position: absolute; left: 50%; top: -14px; bottom: -14px; width: 2px; background: var(--tc); opacity: .35; z-index: 0; }
.tree-col h3 { position: relative; margin: 0; padding: 4px 0; text-align: center; font-size: 15px; font-weight: 800; color: var(--tc); background: var(--paper); }
.tbox { --tint: 5%; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 1px; padding: 10px 12px 11px; background: var(--card); background: color-mix(in srgb, var(--tc) var(--tint), var(--card)); border: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
.tbox:hover { border-color: color-mix(in srgb, var(--tc) 55%, var(--rule)); }
.tbox .lv { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); }
.tbox .lv::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--tc); }
.tbox b { font-size: 15px; letter-spacing: -.02em; line-height: 1.35; }
.tbox .pg { font-size: 11.5px; color: var(--ink-2); }
.tbox.soon { background: var(--paper); border-style: dashed; }
/* 학습률 막대: 상자 안쪽에 얇게(테두리가 아니라 내용의 일부) */
.lp { display: block; height: 4px; margin-top: 7px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.lp i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); border-radius: 2px; background: var(--tc, var(--forest)); }
.course-head .learn { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 6px; max-width: 200px; margin-top: 8px; color: var(--ink-2); }
.course-head .learn .lp { flex-basis: 100%; margin-top: 0; }

/* 메인: 과학/수학 분야 탭 — 고른 분야만 체계도·과목 목록에 남긴다(home.js가 body[data-domain]을 정한다) */
.dom-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--ink); }
.dom-tabs button { font: inherit; font-size: 16px; font-weight: 700; letter-spacing: -.01em; padding: 10px 26px; margin-bottom: -2px; color: var(--ink-3); background: none; border: 1px solid transparent; border-bottom: 0; cursor: pointer; }
.dom-tabs button:hover { color: var(--ink); }
.dom-tabs button[aria-selected="true"] { color: var(--ink); background: var(--card); border-color: var(--ink); border-bottom: 2px solid var(--card); }
.dom-tabs button:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.dom-tabs + .tree { border-top: 0; }
body[data-domain="sci"] .tree [data-track="math"],
body[data-domain="math"] .tree-band:not([data-track="math"]),
body[data-domain="math"] .tree-cols,
body[data-domain="math"] .tree-head p,
body[data-domain="math"] #chips .chip,
body[data-domain="math"] .tree-band .band-lb { display: none; }
body[data-domain="math"] .tree-band { grid-template-columns: 1fr; }
.tbox.soon b { color: var(--ink-2); }
.tbox.soon .pg { color: var(--ink-3); }
@media (max-width: 640px) {
  .dom-tabs button { flex: 1; padding: 10px 0; }
  .tree-cols { grid-template-columns: repeat(2, 1fr); row-gap: 22px; }
  .tree-band { grid-template-columns: 1fr; gap: 6px; }
  .tree-band > div { grid-template-columns: repeat(2, 1fr); }
  .tbox { padding: 8px 10px 11px; }
  .tbox b { font-size: 14px; }
}

/* 실험 카드: NMLab 기록 표 */
.lab-tbl { max-height: 190px; overflow: auto; margin: 8px 0; border: 1px solid var(--rule); background: var(--card); }
.lab-tbl table { width: 100%; border-collapse: collapse; font-family: var(--f-mono); font-size: 12px; }
.lab-tbl th { position: sticky; top: 0; background: var(--paper-2); color: var(--ink-2); font-weight: 500; text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--rule); }
.lab-tbl td { text-align: right; padding: 3px 8px; border-bottom: 1px solid var(--grid); }
.lab-tbl th:first-child, .lab-tbl td:first-child { text-align: left; color: var(--ink-3); width: 2.5em; }
.lab-tbl td.lab-empty { text-align: center; color: var(--ink-3); padding: 10px; }
.lab-del { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; }
.lab-del:hover { color: var(--warn); }
.cv-plot { width: 100%; aspect-ratio: 16 / 10; margin-top: 6px; display: block; }
.lab-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.lab-btns .chip.go { background: var(--forest); border-color: var(--forest); color: var(--on-accent); }
.lab-btns .chip.go:hover { background: var(--ink); border-color: var(--ink); }
.verdict { margin-top: 8px; padding: 8px 10px; background: var(--paper-2); border-left: 3px solid var(--rule); }
.verdict.good {  color: var(--forest); }
.verdict.bad { }
#card-is1-new-unit .nu-pick .presets { margin: 4px 0; }
#card-is1-new-unit .nu-out { margin: 12px 0 4px; padding: 14px 16px; background: var(--paper-2);  }
#card-is1-new-unit .nu-unit { font-size: 26px; font-weight: 600; color: var(--ink); }
#card-is1-new-unit .nu-si { color: var(--ink-2); margin-top: 2px; }
#card-is1-new-unit .nu-name { margin-top: 8px; }
#card-is1-new-unit .nu-ex { color: var(--ink-2); }
.ext-tbl td b.good { color: var(--forest); } .ext-tbl td b.bad { color: var(--warn); }
.ext-tbl { max-height: none; }
.ext-tbl td { vertical-align: top; padding: 6px 8px; }
.ext-tbl td .dim { font-family: var(--f-kr); font-size: 11.5px; color: var(--ink-3); }
.ext-tbl th:first-child, .ext-tbl td:first-child { width: auto; color: var(--ink); text-align: left; }
.ext-tbl th:not(:first-child), .ext-tbl td:not(:first-child) { width: 4.2em; text-align: center; }
#card-is2-acid-plate .cls { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 10px; margin-top: 6px; }
#card-is2-acid-plate .cls .presets { margin: 2px 0; }
.verdict:empty { display: none; }

/* 증명 조립 (js/lib/proof.js NMProof): 위 = 쌓은 증명, 아래 = 남은 단계 */
.pf { margin: 8px 0 4px; }
.pf-built { counter-reset: pf; margin: 0 0 8px; padding: 0; list-style: none; min-height: 34px; border: 1px dashed var(--rule); background: var(--paper-2); }
.pf-built:empty::before { content: "아래에서 첫 단계를 고르세요"; display: block; padding: 8px 10px; font-size: 12.5px; color: var(--ink-3); }
.pf-built li { counter-increment: pf; position: relative; padding: 6px 10px 6px 34px; font-size: 13.5px; line-height: 1.55; border-bottom: 1px solid var(--rule); background: var(--card); }
.pf-built li::before { content: counter(pf); position: absolute; left: 10px; top: 6px; font-family: var(--f-mono); font-size: 11.5px; color: var(--forest); }
.pf-pool { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pf-pool li { padding: 7px 10px; font-size: 13.5px; line-height: 1.55; border: 1px solid var(--rule); background: var(--card); cursor: pointer; }
.pf-pool li:hover, .pf-pool li:focus-visible { border-color: var(--ink); outline: none; }
.pf-pool li.pf-no { border-color: var(--warn); }
.pf-why { display: none; }
.pf-pool li.pf-show .pf-why { display: block; margin-top: 4px; font-size: 12.5px; color: var(--warn); }
.pf-built .pf-why { display: none; }
.pf-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; font-size: 12.5px; }
.pf-bar .pf-reset { margin-left: auto; }
.pf-msg.good { color: var(--forest); font-weight: 600; }
.pf-msg.bad { color: var(--warn); }
.pf.pf-done .pf-built { border-style: solid; border-color: var(--forest); }

/* 반복 시행 (js/lib/sim.js NMSim) */
.sim-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.sim-btns .chip.go { background: var(--forest); border-color: var(--forest); color: var(--on-accent); }
.sim-btns .chip.go:hover { background: var(--ink); border-color: var(--ink); }

/* 오류 찾기 (NMPm.spot): 풀이 줄을 눌러 처음 틀린 곳을 찾는다 */
.spot { counter-reset: sp; margin: 8px 0 4px; padding: 0; list-style: none; border: 1px solid var(--rule); background: var(--card); }
.spot > li { counter-increment: sp; position: relative; padding: 7px 10px 7px 34px; font-size: 13.5px; line-height: 1.6; border-bottom: 1px solid var(--rule); cursor: pointer; }
.spot > li:last-child { border-bottom: 0; }
.spot > li::before { content: counter(sp); position: absolute; left: 11px; top: 7px; font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); }
.spot > li:hover, .spot > li:focus-visible { background: var(--paper-2); outline: none; }
.spot > li .why { display: none; }
.spot > li.sp-show .why { display: block; margin-top: 4px; font-size: 12.5px; }
.spot > li.sp-miss { box-shadow: inset 3px 0 0 var(--rule); }
.spot > li.sp-miss .why { color: var(--ink-2); }
.spot > li.sp-hit {  background: var(--warn-bg, var(--paper-2)); }
.spot > li.sp-hit .why { color: var(--warn); }
.spot[data-done] > li { cursor: default; }

/* 행렬 표 (고급 대수 NMLin.table) */
.lin-m { border-collapse: collapse; margin: 6px 0; font-family: var(--f-mono); font-size: 13.5px; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); }
.lin-m td { padding: 3px 10px; text-align: right; min-width: 2.6em; }
.lin-m td.bar { border-left: 1px dashed var(--ink3, var(--ink-3)); }
.lin-m tr.hi td { background: var(--paper-2); color: var(--forest); font-weight: 600; }

/* 예측 → 확인 카드: 정답을 열기 전에는 결과 칸을 흐리게 */
.predict-lock { opacity: .35; pointer-events: none; }

/* 더 읽을거리(STYLE.md 6절): 대단원 끝의 논문·preprint 목록. 색 띠 없이 네모난 상자 */
.tb-read { margin: 28px 0 8px; padding: 14px 18px 12px; background: var(--card); border: 1px solid var(--rule); border-radius: 2px; }
.tb-read > h2 { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: var(--ink); }
.tb-read > .tb-read-lead { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }
.tb-read ol { margin: 0; padding: 0; list-style: none; }
.tb-read li { padding: 10px 0; border-top: 1px solid var(--rule); font-size: 14px; line-height: 1.6; }
.tb-read .ref { margin: 0; color: var(--ink-2); }
.tb-read .ref a { color: var(--ink); font-weight: 600; text-decoration: none; }
.tb-read .ref a:hover { color: var(--forest); text-decoration: underline; }
.tb-read .lv { display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid var(--rule); border-radius: 2px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.tb-read .why { margin: 4px 0 0; color: var(--ink); }
.tb-read .on { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.tb-read .free { margin-left: 6px; font-size: 12.5px; color: var(--forest); white-space: nowrap; }

/* ═════════ 다크 모드 — <html data-theme="dark"> (head의 짧은 스크립트가 정하고 js/core.js가 버튼을 잇는다) ═════════ */
.theme-btn {
  display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 14px; padding: 0;
  vertical-align: middle; border: 1px solid var(--rule); border-radius: 2px; background: none; color: inherit;
}
.theme-btn:hover { border-color: currentColor; }
.theme-btn svg { width: 15px; height: 15px; }
.theme-btn .sun, [data-theme="dark"] .theme-btn .moon { display: none; }
[data-theme="dark"] .theme-btn .sun { display: block; }
.gv-body .theme-btn { border-color: var(--gv-line); }
/* 좁은 폰: 링크가 세 개인 절·과목 페이지는 상단바에 버튼까지 들어가지 않아 글자 로고를 숨기고 마크만 둔다 */
@media (max-width: 420px) {
  .top-right a + a, .theme-btn { margin-left: 10px; }
  body[data-sec] .brand, body[data-view="course"] .brand { font-size: 0; gap: 0; }
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6e6e2;
  --ink-2: #b3b3ae;
  --ink-3: #8c8c88;
  --rule: #3a3b3f;
  --grid: rgba(230, 230, 226, .07);
  --paper: #17181a;
  --paper-2: #232428;
  --card: #1f2023;
  --leaf: #86bf76;
  --forest: #8cc67a;
  --sprout: #9ccc8f;
  --warn: #e8896b;
  --warn-bg: #35241e;
  --night: #0e0f0e;
  --top-bg: rgba(23, 24, 26, .9);
  --raised: #26272b;
  --right-bg: #213021;
  --hl: #6e5c16;
  --memo-bg: #25241d;
  --memo-rule: #a88d2c;
  --fig-bg: #e0dfdc;   /* 뒤집으면 카드 색(#1f2023)에 가깝다 */
  --on-accent: #17181a;
}
[data-theme="dark"] .tree [data-track="phy"] { --tc: #7fa6ea; }
[data-theme="dark"] .tree [data-track="chem"] { --tc: #b08ee6; }
[data-theme="dark"] .tree [data-track="bio"] { --tc: #e8955c; }
[data-theme="dark"] .tree [data-track="earth"] { --tc: #c4a172; }
[data-theme="dark"] .tree [data-track="fusion"] { --tc: #e083a6; }
[data-theme="dark"] .tree [data-track="math"] { --tc: #e0aa3e; }
[data-theme="dark"] .tbox { --tint: 9%; }

/* 카드 그림: 카드 스크립트는 밝은 종이 색으로 그리므로 밝기만 뒤집고 색상은 되돌린다.
   사진(img), 개념 지도(#gv-canvas), 영상(.video-block — 이미 어두운 화면으로 그린다)은 그대로. */
[data-theme="dark"] .card canvas:not(.no-invert, .no-invert *) { filter: invert(1) hue-rotate(180deg); }
[data-theme="dark"] .reading-body figure svg:not(.no-invert, .no-invert *) { filter: invert(.9) hue-rotate(180deg); }   /* 흰 바탕이 완전한 검정이 되지 않게 */

/* 블록 <style>에 적힌 밝은 배경 */
[data-theme="dark"] :is(#related-photo a, #card-is1-mutation .cod, #card-info-printer .pri, #card-info-graphrep .mc, #card-info-bracket .expr) { background: var(--raised); }
[data-theme="dark"] :is(#card-is1-halogen .grid3 button.yes, #card-is1-enzyme-fit .fit-grid td.y, #card-is2-ethics .eth-table .win, #card-is2-ethics select[data-v="1"]) { background: var(--right-bg); }
[data-theme="dark"] .card:is(#card-info-bst, #card-info-sort, #card-info-queens, #card-info-maze, #card-info-power, #card-info-space, #card-info-hanoi, #card-info-bnb, #card-info-dp-knapsack, #card-info-dp-memo, #card-info-unit-test, #card-info-fibtree, #card-info-printer, #card-info-treerep, #card-info-graphrep, #card-info-sq, #card-info-callstack, #card-info-bracket, #card-info-scope) :is(.ln.on, .l.on),
[data-theme="dark"] #card-is2-ethics select[data-v="2"] { background: rgba(140, 198, 122, .22); }
[data-theme="dark"] :is(#card-info-bigo-count pre.code .l.on, #card-info-git-merge pre.code .l.b, #text-info-dp-dc .lcs td.p, #card-resr-abstract .ab-s.miss, #card-bio-seq-tree .aln .sq i.d) { background: rgba(224, 160, 42, .26); }
[data-theme="dark"] #card-info-git-merge pre.code .l.a { background: rgba(127, 166, 234, .22); }
[data-theme="dark"] :is(#card-is2-ethics select[data-v="-1"], #card-resr-abstract .ab-s[aria-pressed="true"], #card-resr-abstract .ab-s.hit) { background: var(--warn-bg); }
[data-theme="dark"] #card-is2-ethics select[data-v="-2"] { background: #4a2c22; }

/* ───── 연습문제 (practice.html, 절 끝 버튼) ───── */
.px-go { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 14px; margin: 28px 0 8px; padding: 16px 20px; background: var(--card); border: 1px solid var(--rule);  text-decoration: none; }
.px-go:hover { border-color: var(--forest); }
.px-go .mono { color: var(--forest); }
.px-go b { font-size: 16px; }
.px-go .px-n { color: var(--ink-3); }
.px-head { padding: 32px 0 12px; display: grid; gap: 8px; }
.px-head h1 { font-size: clamp(26px, 4vw, 38px); letter-spacing: -.03em; line-height: 1.2; }
.px-head h1 em { font-style: normal; color: var(--forest); }
.px-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 18px; border-bottom: 1px solid var(--rule); }
.px-list { display: grid; gap: 18px; padding: 20px 0 40px; }
.px-item { background: var(--card); border: 1px solid var(--rule); padding: 14px 18px 16px; scroll-margin-top: 72px; }
.px-item.bad { }
.px-item.ok { }
/* 텍스트로 옮겨 쓴 기출(practice.js textBody, notebook.js examText) */
.px-text { color: var(--ink); margin: 10px 0 14px; font-size: 15.5px; line-height: 1.8; max-width: 760px; }
.px-shared { margin-bottom: 12px; padding: 10px 14px; background: var(--paper-2); border: 1px solid var(--rule); }
.px-stem p + p, .px-shared p + p { margin-top: 6px; }
.px-text .box, .nb-exam-text .box { margin: 10px 0; padding: 10px 14px; border: 1px solid var(--ink-3); }
.px-text ol.gana, .nb-exam-text ol.gana { margin: 8px 0; padding: 10px 14px; list-style: none; border: 1px solid var(--ink-3); }
.px-text table, .nb-exam-text table { margin: 10px 0; border-collapse: collapse; font-size: 14px; }
.px-text td, .px-text th, .nb-exam-text td, .nb-exam-text th { padding: 4px 10px; border: 1px solid var(--rule); text-align: center; }
.px-figimg { margin: 12px 0; }
.px-figimg img { display: block; max-width: min(100%, 520px); height: auto; }
[data-theme="dark"] .px-figimg img { filter: invert(.88) hue-rotate(180deg); }
.px-opts.long { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.px-opts.long .px-opt { display: flex; align-items: baseline; gap: 8px; width: auto; height: auto; min-height: 40px; padding: 6px 12px; font-size: 15.5px; text-align: left; }
.px-opts.long .px-opt .n { flex: none; }
.px-opts.long .px-opt .c { min-width: 0; overflow-wrap: anywhere; }
.nb-exam-text { margin: 8px 0; font-size: 15px; line-height: 1.75; }
.nb-choices { margin-top: 6px; padding-left: 0; list-style: none; counter-reset: ch; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.nb-choices li { counter-increment: ch; }
.nb-choices li::before { content: counter(ch, decimal) ". "; color: var(--ink-3); font-size: 13px; }
@media (max-width: 640px) { .px-opts.long { grid-template-columns: 1fr; } }
.px-item header { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; margin-bottom: 10px; }
.px-prev { margin-left: auto; }
.px-prev.bad { color: var(--warn); }
.px-prev.ok { color: var(--forest); }
.px-fig { margin: 0 0 12px; background: #fff; border: 1px solid var(--rule); max-width: 760px; }
.px-fig img { display: block; width: 100%; height: auto; }
[data-theme="dark"] .px-fig img, [data-theme="dark"] .nb-exam { filter: invert(.88) hue-rotate(180deg); }
[data-theme="dark"] .px-fig { background: #1f2023; }
.px-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.px-opt { min-width: 52px; padding: 8px 14px; font-size: 18px; background: var(--raised); border: 1px solid var(--rule); border-radius: 2px; color: var(--ink); }
.px-opt:hover { border-color: var(--ink); }
.px-opt.right { border-color: var(--forest); background: var(--right-bg); }
.px-opt.wrong { border-color: var(--warn); background: var(--warn-bg); }
.px-short { display: flex; gap: 8px; }
.px-short input { width: 140px; padding: 8px 12px; border: 1px solid var(--rule); background: var(--raised); color: var(--ink); border-radius: 2px; font-size: 16px; }
.px-result { margin-top: 10px; font-size: 14.5px; color: var(--ink-2); min-height: 1em; }
.px-empty { padding: 40px 0; color: var(--ink-3); }
.nb-exam { display: block; max-width: 560px; width: 100%; margin: 8px 0; border: 1px solid var(--rule); background: #fff; }
@media (max-width: 640px) {
  .px-go { grid-template-columns: 1fr; gap: 4px; }
  .px-item { padding: 12px; }
  .px-opt { min-width: 44px; padding: 7px 10px; }
}
