/* Shared design system for every subject on finki.vasojevich.com.
   Layout: sticky glass top bar (vasofinki · subject · menu), one centred reading column,
   floating bottom navigation, contents drawer from the right. */
@import url("https://fonts.googleapis.com/css2?family=Golos+Text:wght@400..800&family=Manrope:wght@500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface2: #eceef2; --ink: #0e1116; --muted: #5b6270; --line: #dfe2e8;
  --accent: #2f5bdb; --accent-soft: #e7edfd; --ok: #13804b; --ok-soft: #e3f4ea; --bad: #c0281c; --bad-soft: #fdeceb;
  --warn: #8f5600; --warn-soft: #fff3d6; --why: #6a3fb0; --why-soft: #f1eafb; --exam: #0b6e6e; --exam-soft: #e1f4f3;
  --extra: #7a4b16; --extra-soft: #f6efe6; --wave: #2f5bdb; --wave2: #c2410c;
  --shadow: 0 1px 2px rgba(14, 17, 22, .04), 0 8px 24px -12px rgba(14, 17, 22, .12);
  --float: 0 12px 32px -12px rgba(14, 17, 22, .28);
  --f-body: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --f-label: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --f-head: "Manrope", "Golos Text", "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --col: 812px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #000000; --surface: #0c0c0d; --surface2: #151517; --ink: #ececef; --muted: #8d8f98; --line: #222226;
  --accent: #8aa9ff; --accent-soft: #10182e; --ok: #5fd39a; --ok-soft: #0a1d13; --bad: #ff8a80; --bad-soft: #240e0d;
  --warn: #f3bd55; --warn-soft: #201807; --why: #c3a6ff; --why-soft: #171027; --exam: #5fd4cf; --exam-soft: #071d1c;
  --extra: #e2b47a; --extra-soft: #1d150b; --wave: #8aa9ff; --wave2: #ff9e6b; --shadow: none; --float: 0 12px 40px -8px rgba(0, 0, 0, .9); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #000000; --surface: #0c0c0d; --surface2: #151517; --ink: #ececef; --muted: #8d8f98; --line: #222226;
  --accent: #8aa9ff; --accent-soft: #10182e; --ok: #5fd39a; --ok-soft: #0a1d13; --bad: #ff8a80; --bad-soft: #240e0d;
  --warn: #f3bd55; --warn-soft: #201807; --why: #c3a6ff; --why-soft: #171027; --exam: #5fd4cf; --exam-soft: #071d1c;
  --extra: #e2b47a; --extra-soft: #1d150b; --wave: #8aa9ff; --wave2: #ff9e6b; --shadow: none; --float: 0 12px 40px -8px rgba(0, 0, 0, .9); color-scheme: dark; }

* { box-sizing: border-box; }
html { scroll-padding-top: 76px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%;
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16.5px/1.7 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
img, svg, canvas { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--ink); }

/* custom scrollbar (WebKit; Firefox and new Chrome use scrollbar-color above) */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 38%, transparent); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 70%, transparent); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* no tap flash / focus ring on click; keyboard focus stays visible */
a, button, summary, label, input, select { -webkit-tap-highlight-color: transparent; }
button, summary, .btn, .mast, .theme-btn, .bnav a, .menu-btn { user-select: none; -webkit-user-select: none; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* top bar: vasofinki left, subject centred, menu / theme right */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1240px; margin: 0 auto; min-height: 60px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-left, 0px)); }
.hub { grid-column: 1; justify-self: start; font: 800 17px/1 var(--f-head); letter-spacing: -.01em; color: var(--ink); text-decoration: none; transition: opacity .2s; }
.hub span { color: var(--accent); }
.hub:hover { opacity: .75; }
.brand { grid-column: 2; justify-self: center; font: 800 16px/1 var(--f-head); color: var(--ink); text-decoration: none; white-space: nowrap; letter-spacing: -.01em; }
.brand b { color: var(--accent); font-weight: 700; }
.brand .bt { font: 600 15px var(--f-body); color: var(--ink); letter-spacing: 0; }
.topbar-in > .theme-btn, .topbar-in > .menu-btn { grid-column: 3; justify-self: end; }
.theme-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 7px 13px;
  cursor: pointer; font: 600 13.5px var(--f-body); transition: transform .12s var(--ease), border-color .2s, background .2s; }
.theme-btn:hover { border-color: var(--muted); }
.theme-btn:active { transform: scale(.94); }
.menu-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer;
  display: grid; place-content: center; gap: 4px; padding: 0; transition: transform .12s var(--ease), border-color .2s; }
.menu-btn:hover { border-color: var(--muted); }
.menu-btn:active { transform: scale(.92); }
.menu-btn span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink); transition: transform .35s var(--ease), opacity .2s; }
.menu-btn.x span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-btn.x span:nth-child(2) { opacity: 0; }
.menu-btn.x span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.topbar .menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.topbar .menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.topbar .menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* page: one centred column */
.page { max-width: var(--col); margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); }
.page.wide { max-width: 1000px; }
main { min-width: 0; animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes slidein { from { opacity: 0; transform: translateX(14px); } }

/* breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font: 500 13.5px var(--f-label); color: var(--muted); margin: 0 0 22px; }
.crumbs a { color: var(--muted); text-decoration: none; transition: color .2s; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.crumbs .cs { width: 6px; height: 6px; border-right: 1.5px solid var(--line); border-top: 1.5px solid var(--line); transform: rotate(45deg); margin: 0 2px; }

/* contents drawer from the right */
.toc { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(380px, 88vw); overflow-y: auto; background: var(--surface);
  border-left: 1px solid var(--line); padding: 14px 12px calc(24px + env(safe-area-inset-bottom)); font-size: 14.5px;
  transform: translateX(102%); visibility: hidden; transition: transform .42s var(--ease), visibility 0s linear .42s; box-shadow: var(--float); }
body.menu-open .toc { transform: none; visibility: visible; transition: transform .42s var(--ease), visibility 0s; }
body.menu-open { overflow: hidden; }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .35s var(--ease);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
body.menu-open .scrim { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 14px 12px; margin: 0 0 10px; border-bottom: 1px solid var(--line); }
.drawer-head .lbl { font: 700 12px/1.4 var(--f-label); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: auto; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
body.menu-open .toc li { animation: slidein .42s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms + 60ms); }
.toc a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; line-height: 1.4;
  position: relative; transition: color .2s, background .2s; }
.toc a:hover { color: var(--ink); background: var(--surface2); }
.toc a:active { background: var(--accent-soft); }
.toc a.cur { color: var(--ink); font-weight: 600; background: var(--surface2); }
.toc a.cur::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }
.toc a .done { margin-left: auto; flex: none; width: 8px; height: 13px; border: solid transparent; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translateY(-2px); }
.toc a.ok .done { border-color: var(--ok); }

/* type */
.eyebrow { font: 700 12px/1.3 var(--f-label); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
h1 { font: 800 clamp(26px, 4vw, 40px)/1.15 var(--f-head); letter-spacing: -.02em; margin: 0 0 16px; text-wrap: balance; }
h2 { font: 700 25px/1.25 var(--f-body); letter-spacing: -.015em; margin: 64px 0 14px; padding-top: 28px; border-top: 1px solid var(--line); text-wrap: balance; }
main > h1 + section > h2:first-child { margin-top: 28px; padding-top: 0; border-top: 0; }
h3 { font: 650 19px/1.35 var(--f-body); letter-spacing: -.01em; margin: 32px 0 8px; text-wrap: balance; }
h4 { font-size: 16.5px; margin: 20px 0 6px; }
p, ul, ol { margin: 0 0 14px; }
ul, ol { padding-left: 22px; }
li { margin-bottom: 6px; }
li::marker { color: var(--muted); }
b, strong { font-weight: 650; }
.lead { font-size: 18.5px; line-height: 1.6; color: var(--muted); max-width: 66ch; }
.muted { color: var(--muted); }
small, .small { font-size: 13.5px; }
.en { color: var(--muted); font-size: .9em; font-style: italic; }
code, .mono { font-family: var(--f-mono); font-size: .9em; }
code { background: var(--surface2); border-radius: 5px; padding: 1px 5px; }
.bits { font-family: var(--f-mono); font-size: .94em; letter-spacing: .03em; overflow-wrap: anywhere; }
mark { background: var(--warn-soft); color: var(--warn); border-radius: 4px; padding: 0 3px; font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* callouts */
.note { border-radius: 14px; padding: 14px 18px 2px; margin: 0 0 18px; border: 1px solid var(--line); background: var(--surface); }
.note > .nt { display: inline-block; font: 700 11.5px/1.5 var(--f-label); letter-spacing: .09em; text-transform: uppercase; margin-bottom: 6px; }
.note.why { background: var(--why-soft); border-color: color-mix(in srgb, var(--why) 28%, transparent); } .note.why > .nt { color: var(--why); }
.note.ex { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, transparent); } .note.ex > .nt { color: var(--accent); }
.note.trap { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); } .note.trap > .nt { color: var(--warn); }
.note.exam { background: var(--exam-soft); border-color: color-mix(in srgb, var(--exam) 30%, transparent); } .note.exam > .nt { color: var(--exam); }
.note.def { background: var(--surface); } .note.def > .nt { color: var(--ink); }
.note.extra { background: var(--extra-soft); border-color: color-mix(in srgb, var(--extra) 28%, transparent); } .note.extra > .nt { color: var(--extra); }
.formula { font-family: var(--f-mono); font-size: 15.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 18px; margin: 0 0 16px; overflow-x: auto; }
.formula .fx { font-weight: 600; }
.formula small { display: block; font-family: var(--f-body); color: var(--muted); margin-top: 8px; font-size: 14px; line-height: 1.55; }

/* tables */
.tw { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface2); font: 600 12.5px/1.4 var(--f-label); letter-spacing: .02em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.n, th.n { font-family: var(--f-mono); white-space: nowrap; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 0 0 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
a.card { color: inherit; text-decoration: none; display: block; transition: border-color .25s var(--ease), transform .25s var(--ease), background .25s; }
a.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); transform: translateY(-2px); }
a.card:active { transform: translateY(0) scale(.985); transition-duration: .1s; }
.card .tag { display: inline-block; font: 700 11.5px/1.8 var(--f-label); letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 0 8px; margin-bottom: 8px; }
.pill { display: inline-block; font: 600 12px/1.8 var(--f-label); border-radius: 6px; padding: 0 9px; background: var(--surface2); color: var(--muted); }

/* widgets */
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; margin: 0 0 22px; overflow: hidden; box-shadow: var(--shadow); }
.widget > .wt { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line); font: 600 13.5px/1.35 var(--f-body); }
.widget > .wt::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex: none; }
.widget > .wb { padding: 16px 18px; }
.row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-bottom: 12px; }
.row label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.row label.grow { flex: 1 1 200px; }
input[type=text], input[type=number], input[type=search], select { font: 14.5px var(--f-mono); padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); width: 100%; min-width: 0; transition: border-color .2s, box-shadow .2s; }
input[type=text]:focus, input[type=number]:focus, input[type=search]:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=number] { width: 120px; }
input[type=range] { width: 170px; accent-color: var(--accent); }
.btn, button.btn { font: 600 14px var(--f-body); padding: 8px 16px; border-radius: 10px; border: 1px solid var(--ink); background: var(--ink);
  color: var(--bg); cursor: pointer; transition: transform .12s var(--ease), background .2s, border-color .2s, opacity .2s; }
a.btn { display: inline-block; text-decoration: none; }
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.95); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { opacity: 1; border-color: var(--muted); }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.out { font-family: var(--f-mono); font-size: 13.5px; line-height: 1.65; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  white-space: pre-wrap; overflow-x: auto; margin: 0; }
.res { margin: 10px 0 0; font-weight: 600; }
.res.err { color: var(--bad); }
.scroll { overflow-x: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* SVG helpers (theme-aware) */
svg text { fill: var(--ink); font-family: var(--f-body); }
svg .mut { fill: var(--muted); }
svg .ln { stroke: var(--line); }
svg .ink { stroke: var(--ink); }
svg .wave { fill: none; stroke: var(--wave); stroke-width: 2.4; stroke-linejoin: round; }
svg .wave2 { fill: none; stroke: var(--wave2); stroke-width: 2; }
svg .box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
svg .boxA { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
svg .boxOk { fill: var(--ok-soft); stroke: var(--ok); stroke-width: 1.5; }
svg .boxBad { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 1.5; }
svg .boxW { fill: var(--warn-soft); stroke: var(--warn); stroke-width: 1.5; }
svg .acc { fill: var(--accent); } svg .okf { fill: var(--ok); } svg .badf { fill: var(--bad); } svg .warnf { fill: var(--warn); }
svg .sacc { stroke: var(--accent); } svg .sok { stroke: var(--ok); } svg .sbad { stroke: var(--bad); }
svg rect, svg circle, svg ellipse { transition: fill .35s var(--ease), stroke .35s var(--ease); }

/* stepper */
.stepper { margin: 0 0 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.stepper .stage { padding: 16px; overflow-x: auto; }
.stepper svg { display: block; margin: 0 auto; }
.stepper [data-s] { transition: opacity .45s var(--ease); }
.stepper [data-m] { transition: transform .8s cubic-bezier(.4, .1, .2, 1); }
.stepper .off { opacity: 0; pointer-events: none; }
.stepper .hl { filter: drop-shadow(0 0 6px var(--accent)); }
.stepper .ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.stepper .ctl .cnt { font: 600 12.5px var(--f-label); color: var(--muted); margin-left: auto; }
.stepper .cap { padding: 14px 18px; min-height: 64px; border-top: 1px solid var(--line); background: var(--bg); }
.stepper ol.caps { display: none; }
.stepper figcaption.ttl { font: 600 13.5px/1.35 var(--f-body); padding: 11px 18px; border-bottom: 1px solid var(--line); }

/* disclosure (hints, solutions, OSI layers) */
details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 0 0 10px; transition: border-color .2s; }
details[open] { border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
details > summary { cursor: pointer; padding: 10px 14px 10px 38px; font-weight: 600; list-style: none; position: relative; border-radius: 12px; transition: background .2s; }
details > summary:hover { background: var(--surface2); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; position: absolute; left: 16px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .25s var(--ease); opacity: .7; }
details[open] > summary::before { transform: rotate(45deg); margin-top: -6px; }
details > .db { padding: 4px 18px 8px; animation: rise .3s var(--ease); }
details.hint > summary { color: var(--warn); }
details.sol > summary { color: var(--ok); }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding-left: 36px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 24px; height: 24px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent); font: 700 12.5px/24px var(--f-label); text-align: center; }
.ans { font-weight: 700; color: var(--ok); }

/* practice tasks */
.task { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 8px; margin: 0 0 16px; box-shadow: var(--shadow); }
.task > .tq { margin-bottom: 12px; }
.task .tn { font: 700 12px/1.6 var(--f-label); color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 9px; margin-right: 8px; }
.task .src { font: 500 12px var(--f-label); color: var(--muted); float: right; }
.task details { background: var(--bg); }

/* quiz */
.quiz .q { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin: 0 0 12px; }
.quiz .q p.t { margin: 0 0 12px; font-weight: 600; }
.quiz .opts { display: grid; gap: 7px; }
.quiz .opts button { text-align: left; font: 15px/1.45 var(--f-body); padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); cursor: pointer; transition: border-color .2s, background .2s, color .2s, transform .12s var(--ease); }
.quiz .opts button:hover:not(:disabled) { border-color: var(--muted); }
.quiz .opts button:active:not(:disabled) { transform: scale(.985); }
.quiz .opts button[aria-pressed="true"]:not(.right):not(.wrong) { border-color: var(--accent); background: var(--accent-soft); }
.quiz .opts button.right { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 600; animation: pop .35s var(--ease); }
.quiz .opts button.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); animation: shake .35s var(--ease); }
.quiz .opts button:disabled { cursor: default; }
.quiz .numrow { display: flex; gap: 8px; flex-wrap: wrap; }
.quiz .numrow input { flex: 1 1 140px; width: auto; }
.quiz input.right { border-color: var(--ok); color: var(--ok); animation: pop .35s var(--ease); }
.quiz input.wrong { border-color: var(--bad); color: var(--bad); animation: shake .35s var(--ease); }
.quiz .hintline { font-size: 13px; color: var(--muted); margin: 8px 0; }
.quiz .note2 { margin: 12px 0 0; font-size: 14.5px; color: var(--muted); animation: rise .3s var(--ease); }
.quiz .tag { font: 700 11px var(--f-label); color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 7px; margin-right: 8px; }
.quiz .okt { color: var(--ok); } .quiz .badt { color: var(--bad); }
@keyframes pop { 40% { transform: scale(1.015); } }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }
.qbar { position: sticky; top: 72px; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: color-mix(in srgb, var(--surface) 85%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 16px; margin: 0 0 14px; }
.qbar .score { font: 600 13.5px var(--f-label); margin-right: auto; }

/* "Го совладав овој дел": full-width checkbox row */
.mast { display: flex; align-items: center; gap: 12px; width: 100%; margin: 20px 0 0; padding: 13px 16px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: 600 15px var(--f-body); text-align: left; cursor: pointer;
  transition: border-color .25s var(--ease), background .25s var(--ease), color .25s var(--ease), transform .12s var(--ease); }
.mast:hover { border-color: color-mix(in srgb, var(--ok) 60%, var(--line)); }
.mast:active { transform: scale(.985); }
.mast .box { position: relative; flex: none; width: 22px; height: 22px; border: 2px solid var(--muted); border-radius: 6px; transition: background .25s var(--ease), border-color .25s var(--ease); }
.mast .box::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid var(--bg); border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.mast.on { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.mast.on .box { background: var(--ok); border-color: var(--ok); }
.mast.on .box::after { transform: rotate(45deg) scale(1); }

/* chapter nav */
.chapnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 64px; flex-wrap: wrap; }
.chapnav a { flex: 1 1 240px; border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; text-decoration: none; background: var(--surface);
  color: var(--ink); font-weight: 600; transition: border-color .25s var(--ease), transform .25s var(--ease); }
.chapnav a:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); transform: translateY(-2px); }
.chapnav a:active { transform: scale(.985); }
.chapnav a small { display: block; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.chapnav a.next { text-align: right; }

/* summary pages */
.sumlink { display: inline-block; font-size: 14px; font-weight: 600; color: var(--ink); border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 8px 14px; margin: 0 0 8px; text-decoration: none; transition: border-color .2s, transform .12s var(--ease); }
.sumlink:hover { border-color: var(--muted); }
.sumlink:active { transform: scale(.96); }
body[data-section="r"] h2 { margin-top: 44px; font-size: 22px; }
body[data-section="r"] main li { margin-bottom: 9px; }
.tst, .trp { display: inline-block; font: 700 10.5px/1.7 var(--f-label); letter-spacing: .07em; text-transform: uppercase; border-radius: 5px; padding: 0 6px; margin-right: 5px; vertical-align: 1px; }
.tst { color: var(--exam); background: var(--exam-soft); }
.trp { color: var(--warn); background: var(--warn-soft); }

/* floating bottom navigation */
.bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; pointer-events: none;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom)); }
.bnav-in { pointer-events: auto; position: relative; display: grid; grid-template-columns: repeat(4, 1fr); width: min(460px, 100%);
  background: color-mix(in srgb, var(--surface) 84%, transparent); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--float); overflow: hidden; }
.bnav a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 11px 4px 10px; color: var(--muted); text-decoration: none;
  font: 600 12px/1 var(--f-label); transition: color .3s var(--ease), background .3s var(--ease); }
.bnav a:hover { color: var(--ink); }
.bnav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .3s var(--ease); }
.bnav a:active svg { transform: scale(.85); }
.bnav a.on { color: var(--accent); background: linear-gradient(to bottom, var(--accent-soft), transparent 75%); }
.bnav a.on svg { transform: translateY(-1px); }
.bnav-ind { position: absolute; top: 0; left: 0; width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent); opacity: 0;
  box-shadow: 0 0 14px 1px var(--accent); transition: transform .5s cubic-bezier(.65, 0, .35, 1), opacity .3s; }
body.has-bnav { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

/* footer */
.sitefoot { border-top: 1px solid var(--line); margin-top: 24px; }
.sitefoot-in { max-width: var(--col); margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-left, 0px)) 26px; display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: center; gap: 8px 16px; font-size: 13.5px; color: var(--muted); }
.sitefoot .hub { font-size: 14px; }
.sitefoot a:not(.hub) { color: var(--ink); text-decoration: none; font-weight: 600; border-bottom: 1px solid var(--line); transition: border-color .2s; }
.sitefoot a:not(.hub):hover { border-color: var(--accent); }

@media (max-width: 900px) { .brand .bt { display: none; } }
@media (max-width: 560px) {
  body { font-size: 16px; }
  .theme-btn .tt { display: none; }
  input[type=range] { width: 130px; }
  table { font-size: 13.5px; }
  th, td { padding: 8px 10px; }
  h2 { font-size: 22px; margin-top: 48px; padding-top: 22px; }
  .page { padding-top: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
@media print { .topbar, .toc, .chapnav, .ctl, .mast, .bnav, .scrim, .sitefoot { display: none !important; } body { background: #fff; padding: 0; } }
