@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(fonts/fraunces-normal-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(fonts/fraunces-normal-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(fonts/source-serif-4-normal-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(fonts/source-serif-4-normal-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url(fonts/source-serif-4-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url(fonts/source-serif-4-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f5f1e6;
  --bg-soft: #ebe5d4;
  --card: #fbf9f2;
  --ink: #17211c;
  --ink-soft: #4a554e;
  --line: #d2cab4;
  --accent: #1d5c46;
  --accent-ink: #f5f1e6;
  --copper: #9a4614;
  --focus: #1d4ed8;
  --r-cash: #6f675c;
  --r-bank: #2b5b8c;
  --r-stock: #1d7a53;
  --loss: #a3322a;
  --grid: #d9d2bf;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --display: "Fraunces", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bar-h: 3rem;
}
html[data-theme="dark"] {
  --bg: #111613;
  --bg-soft: #18201b;
  --card: #151c18;
  --ink: #e9e6da;
  --ink-soft: #aab3a9;
  --line: #2f3a33;
  --accent: #7fcca8;
  --accent-ink: #0f1512;
  --copper: #e39a63;
  --focus: #8ab4ff;
  --r-cash: #b3aa9b;
  --r-bank: #86b4e6;
  --r-stock: #6fd49f;
  --loss: #f08a7e;
  --grid: #26302a;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #111613; --bg-soft: #18201b; --card: #151c18; --ink: #e9e6da; --ink-soft: #aab3a9;
    --line: #2f3a33; --accent: #7fcca8; --accent-ink: #0f1512; --copper: #e39a63; --focus: #8ab4ff;
    --r-cash: #b3aa9b; --r-bank: #86b4e6; --r-stock: #6fd49f; --loss: #f08a7e; --grid: #26302a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--serif); font-size: 1.125rem; line-height: 1.62;
  font-feature-settings: "kern", "liga";
}
img, svg { max-width: 100%; }
img { height: auto; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: .5rem; top: -4rem; z-index: 60; background: var(--ink); color: var(--bg); padding: .5rem .9rem; border-radius: .3rem; }
.skip:focus { top: .5rem; }
.num, .tnum { font-variant-numeric: tabular-nums lining-nums; }
.nw { white-space: nowrap; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .8rem;
  min-height: var(--bar-h); padding: .35rem 1rem; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  font-family: var(--sans); font-size: .9rem;
}
.home { color: var(--ink); font-weight: 650; text-decoration: none; white-space: nowrap; }
.topnav { display: flex; gap: .95rem; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1 1 auto; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color: var(--ink-soft); text-decoration: none; white-space: nowrap; padding: .55rem 0; }
.topnav a[aria-current="true"], .topnav a:hover { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.chip { color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .7rem; text-decoration: none; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
.icon-btn { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }

/* depth switch */
.depth {
  display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px;
  font-family: var(--sans); font-size: .86rem; background: var(--card);
}
.depth button {
  border: 0; background: transparent; color: var(--ink-soft); border-radius: 999px; padding: .45rem .85rem;
  min-height: 40px; cursor: pointer; font: inherit;
}
.depth button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.depth-float {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 25; box-shadow: 0 6px 24px rgb(0 0 0 / .14);
  transition: opacity .25s, transform .25s;
}
.depth-float.away { opacity: 0; transform: translateY(12px); pointer-events: none; }
html.js[data-depth="1"] .d2, html.js[data-depth="1"] .d3, html.js[data-depth="2"] .d3 { display: none; }
.d2, .d3 { position: relative; }
.d3 { border-left: 3px solid var(--copper); padding-left: 1rem; }
.d3 > .d-tag, .d2 > .d-tag { display: block; font-family: var(--sans); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--copper); margin-bottom: .2rem; }
.d2 > .d-tag { color: var(--accent); }

/* layout */
main { display: block; }
.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1.1rem; }
.wide { max-width: 72rem; margin: 0 auto; padding: 0 1.1rem; }
section { scroll-margin-top: calc(var(--bar-h) + .6rem); }
[id] { scroll-margin-top: calc(var(--bar-h) + .6rem); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.12; letter-spacing: -.01em; font-variation-settings: "SOFT" 50, "WONK" 0; }
h1 { font-size: clamp(2.2rem, 5.6vw, 3.7rem); margin: .2em 0 .35em; font-weight: 650; }
h2 { font-size: clamp(1.7rem, 4.2vw, 2.7rem); margin: 0 0 .5em; }
h3 { font-size: 1.3rem; margin: 1.6em 0 .4em; }
p { margin: 0 0 1em; }
.kicker { font-family: var(--sans); font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; color: var(--copper); margin: 0; font-weight: 600; }
.deck { font-size: 1.28rem; color: var(--ink-soft); max-width: 36rem; }
.byline { font-family: var(--sans); font-size: .85rem; color: var(--ink-soft); }
.lede { font-size: 1.24rem; }
.small { font-size: .9rem; color: var(--ink-soft); }
.chapter { padding: 5.5rem 0 2rem; border-top: 1px solid var(--line); }
.ch-num { font-family: var(--display); color: var(--copper); font-size: 1rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: .5rem; display: block; }
.answer { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; margin: 1.4rem 0; }
.answer strong { font-family: var(--sans); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: .25rem; }
.answer p:last-child { margin-bottom: 0; }

/* hero */
.hero { padding: 2.4rem 0 1rem; }
.hero-grid { display: grid; gap: 1.2rem; grid-template-columns: 1fr; align-items: start; }
.hero-grid { grid-template-areas: "text" "lab" "more"; }
.hero-text { grid-area: text; } .hero-more { grid-area: more; } .lab { grid-area: lab; }
@media (min-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-areas: "text lab" "more lab"; column-gap: 3rem; row-gap: 0; }
  .hero { padding-top: 3.6rem; }
}
.lab { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.1rem .9rem; box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgb(0 0 0 / .35); }
.lab-q { font-family: var(--sans); font-size: .95rem; margin: 0 0 .7rem; display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.lab-q select, .lab-q input { font: inherit; font-size: 1rem; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: .3rem .5rem; background: var(--bg); color: var(--ink); }
.lab-q input { width: 7.2rem; }
.roads { list-style: none; padding: 0; margin: .9rem 0 0; display: grid; gap: .5rem; }
.road { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: baseline; font-family: var(--sans); }
.road .sw { width: .8rem; height: .8rem; border-radius: 2px; align-self: center; }
.road .val { font-family: var(--display); font-size: 1.55rem; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }
.road .sub { grid-column: 2 / 4; font-size: .82rem; color: var(--ink-soft); margin-top: -.3rem; }
.sw.cash { background: var(--r-cash); } .sw.bank { background: var(--r-bank); } .sw.stock { background: var(--r-stock); }
.chart { width: 100%; height: auto; display: block; overflow: visible; font-family: var(--sans); }
.chart text { fill: var(--ink-soft); font-size: 12px; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--ink-soft); stroke-width: 1.2; stroke-dasharray: 3 4; }
.chart .l-cash { stroke: var(--r-cash); } .chart .l-bank { stroke: var(--r-bank); } .chart .l-stock { stroke: var(--r-stock); }
.chart .ln { fill: none; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.chart .lbl { font-size: 13px; font-weight: 650; }
.chart .lbl.cash { fill: var(--r-cash); } .chart .lbl.bank { fill: var(--r-bank); } .chart .lbl.stock { fill: var(--r-stock); }
.lab-note { font-size: .82rem; color: var(--ink-soft); font-family: var(--sans); margin: .7rem 0 0; }
.entries { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0; padding: 0; list-style: none; font-family: var(--sans); font-size: .92rem; }
.entries a { display: inline-flex; min-height: 44px; align-items: center; padding: .3rem .85rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--card); }
.entries a:hover { border-color: var(--accent); }
.depth-intro { font-family: var(--sans); font-size: .92rem; color: var(--ink-soft); display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin: 1.2rem 0 .4rem; }

/* figures */
.fig { margin: 2rem 0; }
.fig-wide { max-width: 64rem; margin: 2.2rem auto; padding: 0 1.1rem; }
.fig figcaption, .fig-cap { font-family: var(--sans); font-size: .84rem; color: var(--ink-soft); margin-top: .5rem; }
.ctrl { font-family: var(--sans); font-size: .92rem; display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; margin: .6rem 0 1rem; }
.ctrl label { display: flex; flex-direction: column; gap: .15rem; min-width: 12rem; flex: 1 1 12rem; }
.ctrl output { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 44px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; border: 0; border-right: 1px solid var(--line); background: var(--card); color: var(--ink); padding: .5rem .8rem; min-height: 44px; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0; font-family: var(--sans); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; }
.stat b { display: block; font-family: var(--display); font-size: 1.6rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; }
.stat span { font-size: .84rem; color: var(--ink-soft); }
.twins { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; font-family: var(--sans); }
.twin { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; background: var(--card); }
.twin h3 { margin: 0 0 .2rem; font-size: 1.15rem; }
.twin .big { font-family: var(--display); font-size: 1.7rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-put { fill: var(--r-cash); } .bar-grow { fill: var(--r-stock); } .bar-fee { fill: var(--loss); }
.hist .b { fill: var(--r-stock); } .hist .b.neg { fill: var(--loss); }
.strip .dot { fill: var(--r-stock); opacity: .5; } .strip .dot.neg { fill: var(--loss); opacity: .85; }
.inf .b { fill: var(--copper); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-family: var(--sans); font-size: .8rem; padding: .35rem .55rem; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); }

/* rules table */
.rules { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .93rem; margin: 1rem 0; }
.rules th, .rules td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.rules th { font-weight: 600; }
.rules td.v { font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.valid { font-family: var(--sans); font-size: .82rem; color: var(--copper); }

/* glossary */
.gloss-search { position: relative; margin: 1rem 0; }
.gloss-search input { width: 100%; font: inherit; font-family: var(--sans); font-size: 1.05rem; padding: .75rem 1rem; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.gloss-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .6rem; }
.gloss-list li a { display: block; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--card); height: 100%; }
.gloss-list li a:hover { border-color: var(--accent); }
.gloss-list b { font-family: var(--display); font-size: 1.1rem; display: block; color: var(--accent); }
.gloss-list span { font-size: .92rem; color: var(--ink-soft); }
.gloss-empty { font-family: var(--sans); color: var(--ink-soft); }
.term-def { font-size: 1.3rem; line-height: 1.5; border-left: 4px solid var(--accent); padding-left: 1rem; }
.crumbs { font-family: var(--sans); font-size: .88rem; margin: 1.4rem 0 0; color: var(--ink-soft); }
.related { font-family: var(--sans); font-size: .95rem; }

/* sources, footer */
.sources { padding: 4rem 0 2rem; border-top: 1px solid var(--line); font-size: .92rem; }
.sources ol { padding-left: 1.2rem; }
.sources li { margin-bottom: .5rem; overflow-wrap: anywhere; }
footer.site { border-top: 1px solid var(--line); padding: 2rem 1.1rem 5rem; font-family: var(--sans); font-size: .88rem; color: var(--ink-soft); text-align: center; }
footer.site a { color: var(--ink-soft); }
.siblings { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1rem; }
@media (max-width: 520px) {
  body { font-size: 1.06rem; }
  .topbar { gap: .5rem; padding: .3rem .6rem; }
  .home { font-size: .82rem; }
  .twins { grid-template-columns: 1fr; }
  .depth-float { right: .6rem; bottom: .6rem; }
  .depth button { padding: .4rem .7rem; }
  .chapter { padding-top: 4rem; }
}
.strip .lossband { fill: var(--loss); opacity: .28; }
.chart .gl.zero { stroke: var(--ink-soft); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.verdict { font-family: var(--sans); font-size: 1rem; font-weight: 600; margin: .8rem 0; min-height: 3em; }
.key { display: inline-flex; align-items: center; gap: .35rem; margin-right: .9rem; }
.key i { width: .8rem; height: .8rem; border-radius: 2px; display: inline-block; }
.k-put { background: var(--r-cash); } .k-grow { background: var(--r-stock); } .k-fee { background: var(--loss); opacity: .35; }
.table-scroll { overflow-x: auto; }
.term h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.h-rel { font-size: 1.3rem; margin-top: 2.2rem; }
.related { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; }
.related a { display: inline-flex; min-height: 44px; align-items: center; padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.scene-link { font-family: var(--sans); font-weight: 600; }
.term + #glosar { padding-top: 1rem; }
.fees .lbl { fill: var(--ink); }
.inf .cut { fill: var(--bg); font-size: 11px; font-weight: 700; }
.fig-wide .chart { max-width: 60rem; margin: 0 auto; }
@media (max-width: 640px) { .fig-wide .chart text { font-size: 17px; } .fig-wide .chart .lbl { font-size: 17px; } .inf .cut { font-size: 13px; } }
@media (max-width: 520px) { .stat { padding: .6rem .55rem; } .stat b { font-size: 1.25rem; } .stat span { font-size: .75rem; display: block; line-height: 1.25; } }
.lab-unit { font-family: var(--sans); font-size: .82rem; color: var(--ink-soft); margin: 0 0 .3rem; }
.nf { padding-top: 4rem; }
@media (max-width: 640px) {
  #reguli .rules thead { display: none; }
  #reguli .rules tr { display: block; padding: .7rem 0; border-bottom: 1px solid var(--line); }
  #reguli .rules th, #reguli .rules td { display: block; border: 0; padding: .1rem 0; }
  #reguli .rules td.v { font-family: var(--display); font-size: 1.25rem; white-space: normal; }
}
.calc { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.1rem; margin: 1.6rem 0; }
.calc h2 { font-size: 1.35rem; margin-top: 0; }
.calc-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: .7rem; font-family: var(--sans); font-size: .88rem; }
.calc-row label { display: flex; flex-direction: column; gap: .25rem; color: var(--ink-soft); }
.calc-row input, .calc-row select { font: inherit; font-size: 1.05rem; min-height: 44px; padding: .3rem .55rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.calc-out { font-family: var(--display); font-size: 1.3rem; line-height: 1.35; margin: 1rem 0 .6rem; }
.infl-table td, .infl-table th { padding: .35rem .5rem; }
.term h2 { font-size: 1.45rem; margin-top: 2rem; }
.term-src ul { font-family: var(--sans); font-size: .9rem; padding-left: 1.1rem; }
.hub-group h2 { font-size: 1.5rem; margin: 2.2rem 0 .8rem; }
.more-btn { font: inherit; font-family: var(--sans); min-height: 44px; padding: .4rem 1rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); cursor: pointer; margin: .4rem 0 1rem; }
