:root {
  color-scheme: light;
  --bg:#f4f7f9; --surface:#fff; --soft:#f7f9fa; --hover:#eef3f5;
  --text:#152632; --muted:#536773; --line:#dbe4e8; --accent:#006d61;
  --tint:#e3f4ee; --strong:#004940; --inverse:#eafaf7; --yellow:#a36206;
  --warning:#fff4db; --fail:#9e3829; --fail-bg:#ffede8; --shadow:0 2px 4px #15263208;
  --sans:"Pretendard","Malgun Gothic","Apple SD Gothic Neo",system-ui,sans-serif;
  --mono:"Cascadia Code","SFMono-Regular",Consolas,monospace;
}
:root[data-theme="dark"] {
  color-scheme:dark;
  --bg:#111c23; --surface:#172831; --soft:#1c2e38; --hover:#203641;
  --text:#edf5f6; --muted:#aec3cb; --line:#36515b; --accent:#7ce2c7;
  --tint:#1a403b; --strong:#aceaef; --inverse:#0c2926; --yellow:#ffda8f;
  --warning:#483a21; --fail:#ffc0b0; --fail-bg:#4a2b28; --shadow:none;
}
*,*::before,*::after {box-sizing:border-box}
body {margin:0;background:var(--bg);color:var(--text);font:15px/1.62 var(--sans);word-break:keep-all;overflow-wrap:anywhere}
h1,h2,h3,p {margin:0}
a {color:inherit;text-decoration:none}
button,input {font:inherit}
button {cursor:pointer}
button:disabled {cursor:default;opacity:.65}
button,a,input,summary {-webkit-tap-highlight-color:transparent}
:focus-visible {outline:3px solid var(--accent);outline-offset:3px}
[hidden] {display:none!important}
svg {display:block}
.sr-only,.skip:not(:focus) {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.skip:focus {position:fixed;z-index:10;top:10px;left:10px;padding:8px 14px;background:var(--surface)}
.topbar {position:sticky;top:0;z-index:4;border-bottom:1px solid var(--line);background:var(--surface)}
.topbar-inner {max-width:1520px;min-height:74px;margin:auto;padding:0 40px;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:28px}
.brand {display:inline-flex;justify-self:start;align-items:center;gap:11px;line-height:1.14;white-space:nowrap}
.brand-mark {display:grid;place-items:center;width:40px;height:40px;color:#b1f5dc;background:#072c2a;border-radius:11px}
.brand-mark svg {width:32px;height:32px}
.brand strong {display:block;font-size:15px;letter-spacing:-.03em}
.brand small {display:block;margin-top:5px;font:700 9px var(--mono);letter-spacing:.21em;color:var(--accent)}
.primary {display:flex;align-items:stretch;gap:25px;height:74px}
.primary a {position:relative;display:grid;place-items:center;white-space:nowrap;font-size:14px;font-weight:700;color:var(--muted)}
.primary a:hover,.primary a[aria-current] {color:var(--accent)}
.primary a[aria-current]::after {content:"";position:absolute;inset:auto 0 0;height:3px;background:var(--accent);border-radius:3px 3px 0 0}
.header-actions {display:flex;gap:9px;justify-self:end}
.icon-button {display:inline-flex;justify-content:center;align-items:center;gap:8px;min-height:38px;min-width:38px;padding:6px 8px;border:1px solid var(--line);border-radius:9px;color:var(--muted);background:var(--surface);font-weight:700}
.icon-button:hover,.button:hover {background:var(--hover)}
.icon-button svg,.button svg,.nav-icon {width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.search-trigger {padding-inline:10px;font-size:12px}
kbd {font:10px var(--mono);border:1px solid var(--line);padding:2px 4px;border-radius:4px;background:var(--soft);white-space:nowrap}
.shell {max-width:1520px;margin:auto;display:grid;grid-template-columns:282px minmax(0,1fr);gap:32px;padding:32px 40px 24px;align-items:start}
.sidebar {min-width:0;position:sticky;top:103px;max-height:calc(100vh - 118px);overflow:auto;scrollbar-width:thin;padding-bottom:2px}
.progress-card,.toc-card,.card,.index-part,.ref-entry {border:1px solid var(--line);border-radius:15px;background:var(--surface);box-shadow:var(--shadow)}
.progress-card {padding:19px;margin-bottom:17px}
.progress-top,.progress-count,.part-title,.crumb,.section-label,.section-head,.meta,.button-row,.options label,.ref-title {display:flex;align-items:center;gap:8px}
.progress-top {justify-content:space-between}
.progress-top strong {font-size:13px}
.progress-top svg {color:var(--accent)}
.progress-count {margin:8px 0 7px;align-items:baseline}
.progress-count b {font-size:31px;letter-spacing:-.07em;line-height:1.25}
.progress-count span {font-size:12px;color:var(--muted)}
progress {display:block;width:100%;height:7px;border:none;border-radius:7px;background:var(--hover);overflow:hidden}
progress::-webkit-progress-bar {background:var(--hover);border-radius:7px}
progress::-webkit-progress-value {background:var(--accent);border-radius:7px}
progress::-moz-progress-bar {background:var(--accent);border-radius:7px}
.progress-foot {display:flex;justify-content:space-between;gap:8px;margin-top:10px;color:var(--muted);font-size:11px}
.progress-foot b {color:var(--accent)}
.toc-card {padding:17px 12px 12px}
.toc-head {display:flex;justify-content:space-between;align-items:center;margin:0 6px 12px}
.toc-head h2 {font-size:14px}
.toc-head a,.text-link,.link-button {color:var(--accent);font-weight:700}
.toc-head a {font-size:11px}
details.part + details.part {border-top:1px solid var(--line)}
summary {cursor:pointer}
.part summary {display:flex;align-items:center;gap:8px;padding:11px 6px;list-style:none}
.part summary::-webkit-details-marker {display:none}
.part summary strong {font-size:13px;flex:1}
.part summary .nav-icon {width:14px;height:14px;color:var(--muted)}
.part[open] summary .nav-icon {transform:rotate(90deg)}
.part-no {display:inline-grid;place-items:center;min-width:26px;height:24px;border-radius:6px;background:var(--soft);color:var(--muted);font:700 11px var(--mono)}
.part[open] .part-no {color:var(--accent);background:var(--tint)}
.toc-lesson {display:grid;grid-template-columns:24px 1fr 13px;align-items:center;gap:6px;padding:8px;border-radius:7px;margin:2px 0;font-size:12px;color:var(--muted);line-height:1.45}
.toc-lesson:hover {background:var(--soft);color:var(--text)}
.toc-lesson[aria-current] {background:var(--tint);color:var(--strong);font-weight:800}
.toc-lesson span:first-child {font:11px var(--mono)}
.toc-lesson svg {width:13px;height:13px;stroke:var(--accent)}
#main {min-width:0;outline:none}
.crumb {color:var(--muted);font-size:12px;font-weight:700;margin-bottom:14px}
.crumb a:hover {color:var(--accent)}
.crumb svg {width:12px;height:12px}
.hero {position:relative;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,36%);min-height:243px;overflow:hidden;border-radius:17px;background:linear-gradient(118deg,#092734,#0c383e 65%,#104848);color:#effaf8;border:1px solid #164e54}
.hero-copy {position:relative;z-index:1;padding:31px 0 30px 34px;align-self:center}
.hero-kicker {display:flex;align-items:center;gap:9px;color:#bce9db;font:700 11px var(--mono);letter-spacing:.055em}
.hero-kicker span {display:inline-block;border:1px solid #68d1b45e;border-radius:5px;padding:5px 8px;background:#62d4a818;color:#9cebd0}
.hero h1 {font-size:clamp(29px,3.25vw,49px);letter-spacing:-.065em;line-height:1.22;margin:15px 0 9px;word-break:keep-all}
.hero p {color:#d1e9e5;font-size:14px;line-height:1.65;max-width:47ch}
.hero-meta {display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-top:19px;font-size:12px;color:#c5e2de}
.hero-meta span {display:inline-flex;align-items:center;gap:5px}
.hero-meta svg {width:15px;height:15px}
.hero-meta span + span::before {content:"";width:3px;height:3px;border-radius:50%;background:#89bfb5;margin-right:5px}
.hero-art {width:100%;height:100%;min-height:190px;align-self:center;opacity:.92;overflow:visible}
.lesson-nav {display:flex;align-items:center;gap:6px;margin:17px 0 18px;padding:5px;border:1px solid var(--line);border-radius:11px;background:var(--surface);overflow:auto}
.lesson-nav a {display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:7px;font-size:13px;font-weight:700;color:var(--muted);white-space:nowrap}
.lesson-nav a:hover,.lesson-nav a[aria-current] {background:var(--tint);color:var(--strong)}
.lesson-nav a svg {width:15px;height:15px}
.lesson-nav a:last-child {margin-left:auto}
.lesson-body {display:grid;grid-template-columns:minmax(0,1fr) minmax(200px,25%);gap:19px;align-items:start}
.main-sections,.lesson-aside,.index-grid,.reference-list {display:grid;gap:15px;min-width:0}
.card {padding:23px}
.card h2 {font-size:20px;letter-spacing:-.045em;line-height:1.35}
.card h3 {font-size:15px;letter-spacing:-.025em}
.section-head {gap:10px;margin-bottom:12px}
.section-symbol {display:grid;place-items:center;border-radius:8px;width:30px;height:30px;flex:none;background:var(--tint);color:var(--accent);font:700 13px var(--mono)}
.card p + p,.card ul + p {margin-top:11px}
.card .section-copy {color:var(--muted);line-height:1.85}
.card .goal {font-weight:700;font-size:15px}
.prerequisites {font-size:12px;color:var(--muted)}
.prerequisites a {white-space:normal}
.lesson-aside .card {padding:17px}
.lesson-aside h2 {font-size:14px;letter-spacing:0;margin-bottom:9px}
.lesson-aside p,.lesson-aside a {font-size:12px;color:var(--muted)}
.lesson-aside .button {margin-top:12px;width:100%;justify-content:center;font-size:12px}
.aside-status {display:grid;gap:8px;margin:12px 0 0}
.aside-status div {display:flex;align-items:center;justify-content:space-between;gap:5px;font-size:11px}
.aside-status dt {color:var(--muted)}
.aside-status dd {margin:0;text-align:right;font-weight:800}
.aside-status .met {color:var(--accent)}
.aside-index {list-style:none;margin:0;padding:0;display:grid;gap:5px}
.aside-index a {display:block;padding:3px 0}
.aside-index a:hover,.source-list a:hover,.text-link:hover {text-decoration:underline;text-underline-offset:3px}
.notice {padding:10px 12px;background:var(--warning);color:var(--yellow);border-radius:8px;font-size:13px}
.sections-anchor,[id^="question-"] {scroll-margin-top:106px}
.formula {margin:12px 0 0;border:1px solid var(--line);border-radius:11px;overflow:hidden}
.equation {margin:0;padding:15px;color:var(--strong);background:var(--tint);font:700 17px/1.65 var(--mono);overflow-wrap:anywhere}
.formula .conditions {padding:9px 13px;color:var(--muted);font-size:13px}
.table-wrap {max-width:100%;overflow:auto}
table {width:100%;border-collapse:collapse;font-size:12px;line-height:1.5}
th,td {text-align:left;padding:9px 11px;border-top:1px solid var(--line);vertical-align:top}
thead {background:var(--soft);color:var(--muted)}
td:first-child,th:first-child {white-space:nowrap}
.symbol {font:700 13px var(--mono);color:var(--accent)}
td small {display:block;margin-top:3px;color:var(--muted);min-width:12ch;font-size:11px}
.graph {margin:0}
.graph svg {width:100%;height:auto;max-height:340px;border:1px solid var(--line);border-radius:10px;background:var(--soft);color:var(--muted)}
.graph text {fill:currentColor;font:11px var(--sans)}
.graph .grid {stroke:var(--line);stroke-width:1}
.graph .frame {stroke:var(--muted);stroke-width:1}
.graph .curve {fill:none;stroke:var(--accent);stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
.graph .second {stroke:#c68550;stroke-dasharray:6 4}
.graph .point {fill:var(--accent)}
.graph .second-point {fill:#b87534}
.graph .hole {fill:var(--soft);stroke:var(--accent);stroke-width:2}
.graph .area {fill:var(--accent);opacity:.16}
figcaption {color:var(--muted);font-size:13px;margin-top:9px}
.steps {margin:0;display:grid;gap:0}
.steps div {padding:10px 0;border-top:1px solid var(--line)}
.steps dt {font-size:12px;font-weight:800;color:var(--accent)}
.steps dd {margin:4px 0 0}
.steps code,.calc-vars,.result-value {font:14px/1.6 var(--mono);color:var(--strong)}
.source-list {margin:0;padding-left:18px;color:var(--accent);font-size:13px}
.source-list a {text-decoration:underline;text-underline-offset:2px}
.button {display:inline-flex;align-items:center;gap:7px;background:var(--surface);color:var(--text);padding:9px 13px;border:1px solid var(--line);border-radius:8px;font-weight:750;font-size:13px;text-align:left}
.primary-button {background:var(--accent);color:var(--inverse);border-color:var(--accent)}
.primary-button:hover {filter:brightness(.9);background:var(--accent)}
.button-row {flex-wrap:wrap;margin-top:12px}
.lesson-pagination {display:flex;justify-content:space-between;gap:8px;margin-top:2px}
.lesson-pagination .button:last-child {margin-left:auto}
.quiz-intro {font-size:13px;color:var(--muted)}
fieldset {min-width:0;margin:16px 0;padding:12px;border:1px solid var(--line);border-radius:10px}
legend {padding:0 4px;font-size:14px;line-height:1.5;font-weight:800}
.options {display:grid;gap:5px}
.options label {align-items:baseline;padding:5px;border-radius:6px}
.options label:hover {background:var(--soft)}
input[type="radio"] {accent-color:var(--accent)}
input[type="text"],input[type="search"] {width:100%;padding:9px 11px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text)}
.numeric {max-width:240px}
.answer-note {margin-top:8px;padding:8px 10px;font-size:13px;background:var(--tint);color:var(--strong);border-radius:7px}
.answer-note.wrong {background:var(--fail-bg);color:var(--fail)}
.score {margin-top:13px;padding:12px;background:var(--soft);border-radius:8px}
.score b {font-size:19px;color:var(--accent)}
.page-head {padding:11px 0 21px}
.page-head h1 {font-size:34px;letter-spacing:-.07em;line-height:1.22;margin-bottom:8px}
.page-head p {color:var(--muted)}
.index-grid {grid-template-columns:1fr 1fr}
.index-part {padding:17px}
.index-part h2 {font-size:18px}
.index-part p {color:var(--muted);font-size:13px;margin:5px 0 12px}
.index-part .toc-lesson {font-size:13px}
.reference-list {margin-top:13px}
.ref-entry {padding:10px 14px}
.ref-entry summary {font-weight:800;color:var(--text)}
.ref-entry .formula:last-child {margin-bottom:6px}
.ref-title {justify-content:space-between}
.ref-title p {color:var(--muted);font-size:13px}
.link-button {border:none;background:none;padding:4px 0;font-size:12px;text-align:left}
.site-footer {max-width:1520px;margin:auto;padding:14px 40px 24px;display:flex;justify-content:space-between;color:var(--muted);border-top:1px solid var(--line);font-size:11px}
dialog {width:min(540px,calc(100% - 24px));max-height:80vh;border:1px solid var(--line);border-radius:15px;background:var(--surface);color:var(--text);padding:17px;box-shadow:0 15px 55px #06191e55}
dialog::backdrop {background:#091d2bbb}
.dialog-head {display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
.dialog-head h2 {font-size:19px}
.dialog-head .icon-button {font-size:20px}
.dialog-results {margin-top:10px;display:grid;gap:3px}
.search-result {display:grid;padding:9px;border-radius:7px}
.search-result:hover {background:var(--tint)}
.search-result small {color:var(--muted)}
.toast {position:fixed;bottom:18px;right:18px;z-index:9;padding:10px 14px;border-radius:9px;background:var(--text);color:var(--surface);font-size:13px;max-width:calc(100% - 36px)}
.narrow {max-width:68ch}
@media(max-width:1190px) {
  .shell {grid-template-columns:230px minmax(0,1fr);gap:23px;padding-inline:27px}
  .topbar-inner,.site-footer {padding-inline:27px}
  .topbar-inner {gap:16px}
  .primary {gap:17px}
  .lesson-body {grid-template-columns:minmax(0,1fr) minmax(172px,23%)}
  .card {padding:18px}
}
@media(max-width:1000px) {
  .lesson-body {grid-template-columns:minmax(0,1fr)}
  .lesson-aside {grid-row:1;grid-template-columns:minmax(0,1fr)}
  .lesson-aside .quick-index {display:none}
  .lesson-aside .tracking {display:grid;grid-template-columns:1fr auto;gap:4px 12px;align-items:center}
  .tracking h2 {margin:0}
  .tracking .aside-status {grid-column:1;margin-top:0;max-width:210px}
  .tracking .button {grid-column:2;grid-row:1 / 3;width:auto;margin:0}
  .search-trigger kbd,.search-trigger span {display:none}
}
@media(max-width:760px) {
  .topbar-inner {grid-template-columns:1fr auto;gap:0;padding-inline:15px;min-height:0}
  .brand,.header-actions {margin:9px 0}
  .brand-mark {width:35px;height:35px}
  .primary {grid-column:1/-1;grid-row:2;height:40px;justify-content:space-between;gap:7px}
  .primary a {font-size:12px}
  .shell {display:block;padding:14px 12px 22px}
  .sidebar {position:static;max-height:none;display:grid;padding:0;margin-bottom:13px}
  .progress-card {margin:0;padding:9px 12px;display:grid;grid-template-columns:1fr auto;column-gap:12px;align-items:center;border-radius:10px}
  .progress-count {margin:0}
  .progress-count b {font-size:19px}
  .progress-foot {grid-column:1/-1;margin-top:4px}
  .progress-card progress {grid-column:1/-1;height:5px;margin-top:4px}
  .toc-card {display:none}
  .crumb {margin-bottom:8px}
  .hero {min-height:177px;grid-template-columns:minmax(0,1fr) minmax(0,24%);border-radius:12px}
  .hero-copy {padding:20px 0 20px 15px}
  .hero h1 {font-size:clamp(24px,6vw,34px);margin:10px 0 6px}
  .hero p {font-size:12px}
  .hero-meta {margin-top:12px;font-size:11px}
  .hero-art {min-height:0;transform:scale(1.75);transform-origin:left center;opacity:.42;pointer-events:none}
  .lesson-nav {margin:10px 0;gap:1px}
  .lesson-nav a {font-size:11px;padding:6px 7px}
  .lesson-nav a svg {width:13px;height:13px}
  .lesson-body {gap:11px}
  .main-sections {gap:11px}
  .card {padding:14px;border-radius:11px}
  .card h2 {font-size:18px}
  .lesson-aside .card {padding:11px 13px}
  .lesson-aside h2 {font-size:13px}
  .lesson-aside .button {padding:6px 8px}
  .equation {font-size:15px;padding:11px}
  .index-grid {grid-template-columns:1fr}
  .site-footer {padding:12px 14px;gap:6px}
  .sections-anchor {scroll-margin-top:106px}
}
@media(max-width:345px) {
  .hero {grid-template-columns:1fr}
  .hero-copy {padding-right:12px}
  .hero-art,.lesson-nav a svg {display:none}
  .primary a {font-size:11px}
}
@media(prefers-reduced-motion:no-preference) {
  .button,.primary a,.toc-lesson,.icon-button {transition:background .15s,color .15s}
}

.install-trigger {font-size:12px;white-space:nowrap}
.install-guide {margin:0 0 12px;padding-left:20px}
.install-guide li + li {margin-top:7px}
.offline-status {margin-top:12px;color:var(--accent);font-size:13px;font-weight:700}
@media(max-width:1000px) {
  .install-trigger span {display:none}
}
@media(max-width:380px) {
  .header-actions {gap:5px}
  .header-actions .icon-button {min-width:34px}
}

.minor-heading {margin-top:13px}
.status-chip {display:inline-flex;align-items:center;padding:3px 8px;border-radius:6px;background:var(--tint);color:var(--strong);font-size:12px}
.index-part .toc-lesson {grid-template-columns:24px minmax(0,1fr) auto}
.toc-status {font-size:11px;color:var(--muted);white-space:nowrap}
.toc-status.met {color:var(--accent);font-weight:800}
.question-category {margin:1px 0 6px;color:var(--muted);font-size:11px;font-weight:700}
.calculation-explanation {margin:7px 0;padding-left:19px}
.calculation-explanation li + li {margin-top:4px}
.calculation-explanation code,.note-example code {font-family:var(--mono);overflow-wrap:anywhere}
.review-item {margin-top:12px}
.review-practice {margin-top:6px}
.formula-note {margin-top:16px}
.formula-note h3 {font-size:15px}
.formula-note + .formula-note {padding-top:14px;border-top:1px solid var(--line)}
.note-example {padding:10px 12px;background:var(--soft);font-size:13px;border-radius:8px;margin-top:7px}
.note-example h4 {margin:0 0 5px}
.note-example p + p {margin-top:4px}
.glossary-label {display:block;margin:12px 0 4px;font-size:13px;font-weight:750}
.sim-inputs {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr));gap:11px;margin:13px 0}
.sim-inputs label {display:grid;gap:5px;align-content:start;font-size:13px;font-weight:700}
.sim-inputs input {width:100%;min-width:0;accent-color:var(--accent)}
.sim-inputs input[type="number"] {padding:8px;border:1px solid var(--line);border-radius:7px;color:var(--text);background:var(--surface)}
.sim-value {color:var(--accent);margin-left:5px}
.sim-readout {display:flex;flex-wrap:wrap;gap:8px;margin:0 0 12px}
.sim-readout div {padding:7px 10px;border-radius:8px;background:var(--tint);color:var(--strong)}
.sim-readout dt {font-size:11px}
.sim-readout dd {margin:3px 0 0;font:700 14px var(--mono)}
.graph .third {stroke:#886bcc;stroke-dasharray:3 3}
.graph .highlight {fill:var(--surface);stroke:var(--accent);stroke-width:2.5}
.footer-actions {display:flex;align-items:center;flex-wrap:wrap;gap:6px 13px}
@media(max-width:760px) {
  .primary a {font-size:11px}
  .table-wrap table {min-width:390px}
  .table-wrap {scrollbar-width:thin}
  .equation,.steps code,.calc-vars {overflow-wrap:anywhere}
}

/* Keep the formula table's scrolling within its card on narrow screens. */
.main-sections,.lesson-aside,.reference-list {grid-template-columns:minmax(0,1fr)}
.card,.ref-entry {min-width:0}
