/* =====================================================================
 * FVO stylesheet. Colors are tokens on :root — dark by default, with a
 * light theme via prefers-color-scheme or [data-theme="light"].
 * ===================================================================== */
:root {
  --bg: #0b1020;
  --bg2: #0f162b;
  --panel: #121a33;
  --panel2: #18213f;
  --line: #24304f;
  --text: #e6eaf5;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent2: #8b5cf6;
  --ok: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --code-bg: #0a0f1e;
  --code-text: #dbe4ff;
  --t-kw: #c084fc;
  --t-com: #64748b;
  --t-str: #fbbf24;
  --t-num: #f472b6;
  --t-sys: #22d3ee;
  --t-op: #34d399;
  --grad: linear-gradient(120deg, #22d3ee, #8b5cf6);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side-w: 290px;
  --toc-w: 220px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f8fc; --bg2: #eef1f8; --panel: #ffffff; --panel2: #f2f4fa; --line: #dfe4ef;
    --text: #0f172a; --muted: #5b6477; --accent: #0891b2; --accent2: #7c3aed;
    --ok: #16a34a; --bad: #dc2626; --warn: #d97706;
    --code-bg: #0d1326; --code-text: #e2e8f0;
    --shadow: 0 8px 24px rgba(15, 23, 42, .08); color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f7f8fc; --bg2: #eef1f8; --panel: #ffffff; --panel2: #f2f4fa; --line: #dfe4ef;
  --text: #0f172a; --muted: #5b6477; --accent: #0891b2; --accent2: #7c3aed;
  --ok: #16a34a; --bad: #dc2626; --warn: #d97706;
  --code-bg: #0d1326; --code-text: #e2e8f0;
  --shadow: 0 8px 24px rgba(15, 23, 42, .08); color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16.5px; line-height: 1.7; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); margin: .2em 0 .5em; }
h2 { font-size: 1.45rem; margin: 2.1em 0 .6em; padding-top: .3em; border-top: 1px solid var(--line); }
h3 { font-size: 1.15rem; margin: 1.6em 0 .4em; }
code { font-family: var(--mono); font-size: .88em; background: var(--panel2); border: 1px solid var(--line); padding: .08em .35em; border-radius: 6px; }
dfn { font-style: normal; font-weight: 600; color: var(--accent); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--panel); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 18px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand img { display: block; height: 40px; width: auto; }
.icon-btn {
  background: var(--panel); border: 1px solid var(--line); color: var(--text); width: 40px; height: 40px;
  border-radius: 10px; cursor: pointer; font-size: 18px; flex: none;
}
.icon-btn:hover { border-color: var(--accent); }
#menu-toggle { display: none; }
.search { position: relative; margin-left: auto; width: min(420px, 45vw); }
.search input {
  width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); padding: 0 14px; font: inherit; font-size: 15px;
}
.search input:focus { outline: none; border-color: var(--accent); }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); max-height: 70vh; overflow: auto; padding: 6px;
}
.search-results a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.search-results a:hover { background: var(--panel2); text-decoration: none; }
.search-results b { display: block; font-size: 14.5px; }
.search-results span { display: block; font-size: 13px; color: var(--muted); line-height: 1.4; }
.sr-empty { padding: 10px; color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w); min-height: calc(100vh - 64px); }
.sidebar {
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; border-right: 1px solid var(--line);
  background: var(--bg2); padding: 14px 10px 40px; font-size: 14.5px;
}
.main { padding: 26px clamp(18px, 4vw, 56px) 80px; max-width: 900px; width: 100%; margin: 0 auto; }
.main:focus { outline: none; }
.toc { position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; padding: 30px 16px; font-size: 13.5px; }
.toc-title { text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc li a { display: block; padding: 4px 0 4px 12px; color: var(--muted); line-height: 1.4; }
.toc li a:hover { color: var(--accent); text-decoration: none; }

/* --------------------------------------------------------------- sidebar */
.side-home, .side-extra a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 600; }
.side-home:hover, .side-extra a:hover { background: var(--panel); text-decoration: none; }
.side-extra { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.side-ch summary {
  list-style: none; display: flex; gap: 8px; align-items: flex-start; cursor: pointer; padding: 8px 8px;
  border-radius: 8px; font-weight: 600; line-height: 1.35;
}
.side-ch summary::-webkit-details-marker { display: none; }
.side-ch summary:hover { background: var(--panel); }
.side-ch[open] summary { color: var(--accent); }
.side-num {
  flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
}
.side-ch[open] .side-num { background: var(--grad); color: #fff; border: 0; }
.side-title { flex: 1; }
.side-prog { font-size: 11px; color: var(--muted); font-weight: 600; }
.side-prog.full { color: var(--ok); }
.side-ch ul { list-style: none; margin: 2px 0 8px; padding: 0 0 0 20px; }
.side-ch li a {
  display: flex; gap: 8px; align-items: baseline; padding: 4px 8px; border-radius: 7px; color: var(--muted); line-height: 1.4;
}
.side-ch li a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.side-ch li a.active { color: var(--text); background: var(--panel); box-shadow: inset 3px 0 0 var(--accent); }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--line); transform: translateY(-1px); }
a.done .dot { background: var(--ok); border-color: var(--ok); }

/* ------------------------------------------------------------------ home */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 36px; align-items: center; padding: 20px 0 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12.5px; font-weight: 700; color: var(--accent); margin: 0; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.12rem; color: var(--muted); }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0; }
.stats { display: flex; gap: 22px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; color: var(--muted); font-size: 14px; }
.stats b { color: var(--text); font-size: 1.3rem; font-family: var(--font-head); margin-right: 4px; }
.hero-art { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.hero-art .fig { margin: 0; }
.hero-code { margin: 12px 0 0; background: var(--code-bg); color: var(--code-text); padding: 12px 14px; border-radius: 10px; font-size: 13.5px; overflow-x: auto; }
.hero-code code { background: none; border: 0; padding: 0; }
.home-h { border-top: 0; margin-top: 2.2em; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; color: var(--text); transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); text-decoration: none; }
.card h3 { margin: 10px 0 6px; font-size: 1.08rem; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; line-height: 1.55; flex: 1; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-num { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card-meta { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); }
.card-prog { margin-left: auto; font-weight: 700; }
.card-prog.full { color: var(--ok); }
.badge { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.lvl-beginner { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.lvl-intermediate { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.lvl-advanced { color: var(--accent2); border-color: color-mix(in srgb, var(--accent2) 45%, transparent); }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.feature h3 { margin: 6px 0; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.f-icon { font-size: 22px; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--grad); color: #fff; font: inherit; font-weight: 600; font-size: 15px;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-outline:hover { border-color: var(--accent); }
.btn.is-done { background: var(--ok); }
.btn-ghost {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 6px 12px; border-radius: 9px;
  cursor: pointer; font: inherit; font-size: 14px;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); }
.btn-ghost:disabled { opacity: .5; cursor: default; }
.btn-mini {
  background: transparent; border: 1px solid rgba(255, 255, 255, .14); color: #b8c2dc; font: inherit; font-size: 12px;
  padding: 2px 8px; border-radius: 6px; cursor: pointer;
}
.btn-mini:hover { color: #fff; border-color: var(--accent); }

/* ---------------------------------------------------------- lesson parts */
.crumbs { font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs .sep { opacity: .5; }
.ch-num { text-transform: uppercase; letter-spacing: .1em; font-size: 12.5px; font-weight: 700; color: var(--accent); }
.ch-head h1, .lesson-head h1 { margin-top: .15em; }
.ch-meta { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 14px; }
.goals li { margin: .25em 0; }
.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.lesson-list a {
  display: grid; grid-template-columns: 52px 1fr 24px; grid-template-areas: "n t c" "n b c"; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--text);
}
.lesson-list a:hover { border-color: var(--accent); text-decoration: none; }
.ll-num { grid-area: n; font-family: var(--font-head); font-weight: 700; color: var(--accent); }
.ll-title { grid-area: t; font-weight: 600; }
.ll-blurb { grid-area: b; color: var(--muted); font-size: 14px; line-height: 1.45; }
.ll-check { grid-area: c; color: transparent; font-weight: 700; }
.lesson-list a.done .ll-check { color: var(--ok); }
.lesson p, .lesson li { max-width: 72ch; }
.done-row { margin: 34px 0 10px; }

.table-wrap { overflow-x: auto; margin: 1em 0; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--panel2); font-weight: 700; }
td code { white-space: nowrap; }

/* ------------------------------------------------------------- callouts */
.note { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--panel); border-radius: 10px; padding: 12px 16px; margin: 1.3em 0; }
.note-title { font-weight: 700; font-size: 14px; letter-spacing: .02em; margin-bottom: 2px; }
.note-body > :first-child { margin-top: 0; } .note-body > :last-child { margin-bottom: 0; }
.note-tip { border-left-color: var(--ok); }
.note-warn { border-left-color: var(--warn); }
.note-key { border-left-color: var(--accent2); }
.note-try { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }

/* ------------------------------------------------------------------ code */
figure { margin: 1.4em 0; }
figure.code { background: var(--code-bg); border: 1px solid #1d2846; border-radius: 12px; overflow: hidden; }
figure.code figcaption {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 12px;
  background: #111a33; border-bottom: 1px solid #1d2846; color: #9fb0d6; font-family: var(--mono); font-size: 12.5px;
}
.code-actions { display: flex; gap: 6px; flex-wrap: wrap; }
figure.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; color: var(--code-text); font-size: 13.8px; line-height: 1.6; }
figure.code code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.t-kw { color: var(--t-kw); font-weight: 600; }
.t-com { color: var(--t-com); font-style: italic; }
.t-str { color: var(--t-str); }
.t-num { color: var(--t-num); }
.t-sys { color: var(--t-sys); }
.t-op { color: var(--t-op); font-weight: 600; }
.t-sec { color: var(--t-sys); font-weight: 700; }

/* --------------------------------------------------------------- figures */
.fig { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.fig svg { max-width: 100%; height: auto; }
.fig > figcaption { color: var(--muted); font-size: 13.5px; margin-top: 8px; text-align: center; }
.wave-scroll { overflow-x: auto; }
.wave { font-family: var(--mono); }
.w-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.w-num { fill: var(--muted); font-size: 10px; text-anchor: middle; }
.w-name { fill: var(--text); font-size: 12.5px; text-anchor: end; font-weight: 600; }
.w-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.w-clk { stroke: var(--muted); stroke-width: 1.5; }
.w-bus { fill: none; stroke: var(--accent2); stroke-width: 1.8; }
.w-x { fill: var(--muted); opacity: .25; }
.w-data { fill: var(--text); font-size: 11px; }
.w-mark { font-size: 10.5px; font-weight: 700; text-anchor: middle; }
/* generic diagram classes used by inline SVG in lessons */
.d-box { fill: var(--panel2); stroke: var(--line); stroke-width: 1.5; }
.d-box-a { fill: color-mix(in srgb, var(--accent) 14%, var(--panel)); stroke: var(--accent); stroke-width: 1.5; }
.d-box-b { fill: color-mix(in srgb, var(--accent2) 14%, var(--panel)); stroke: var(--accent2); stroke-width: 1.5; }
.d-box-ok { fill: color-mix(in srgb, var(--ok) 14%, var(--panel)); stroke: var(--ok); stroke-width: 1.5; }
.d-box-bad { fill: color-mix(in srgb, var(--bad) 14%, var(--panel)); stroke: var(--bad); stroke-width: 1.5; }
.d-txt { fill: var(--text); font-family: var(--font); font-size: 13px; text-anchor: middle; }
.d-sm { fill: var(--muted); font-family: var(--font); font-size: 11.5px; text-anchor: middle; }
.d-arrow { stroke: var(--muted); stroke-width: 1.6; fill: none; marker-end: url(#arr); }
.d-line { stroke: var(--muted); stroke-width: 1.4; fill: none; }
.d-ok { stroke: var(--ok); } .d-bad { stroke: var(--bad); } .d-acc { stroke: var(--accent); }
.d-fill-ok { fill: var(--ok); } .d-fill-bad { fill: var(--bad); } .d-fill-acc { fill: var(--accent); } .d-fill-mut { fill: var(--muted); }

/* ------------------------------------------------------------------ quiz */
.quiz fieldset { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin: 0 0 14px; padding: 12px 16px 12px; }
.quiz legend { font-weight: 600; padding: 0 6px; }
.q-num { color: var(--accent); font-family: var(--font-head); margin-right: 4px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.opt:hover { background: var(--panel2); }
.opt input { margin-top: 6px; accent-color: var(--accent); }
.q.right { border-color: var(--ok); }
.q.wrong { border-color: var(--bad); }
.opt.is-answer { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.why { margin: 8px 0 6px; padding: 8px 12px; border-left: 3px solid var(--accent2); background: var(--panel2); border-radius: 6px; font-size: 14.5px; }
.js-report-q { color: var(--muted); border-color: var(--line); margin-top: 4px; }
.quiz-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.quiz-score { font-weight: 700; }

/* -------------------------------------------------------- feedback bar */
.fb-bar { margin-top: 40px; padding: 16px 18px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--bg2); }
.fb-helpful, .fb-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fb-actions { margin-top: 10px; }
.fb-thanks { color: var(--ok); font-weight: 600; font-size: 14px; }
.fb-hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.pn { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: var(--panel); color: var(--text); }
.pn:hover { border-color: var(--accent); text-decoration: none; }
.pn small { display: block; color: var(--muted); }
.pn.next { text-align: right; }

.fb-dialog {
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); padding: 0;
  width: min(560px, 94vw); box-shadow: var(--shadow);
}
.fb-dialog::backdrop { background: rgba(3, 6, 18, .6); backdrop-filter: blur(2px); }
.fb-form { padding: 18px 20px; display: grid; gap: 12px; }
.fb-form header { display: flex; justify-content: space-between; align-items: center; }
.fb-form h2 { margin: 0; border: 0; padding: 0; font-size: 1.25rem; }
.fb-x { background: none; border: 0; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }
.fb-form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.fb-form small { font-weight: 400; color: var(--muted); }
.fb-form input, .fb-form select, .fb-form textarea {
  font: inherit; font-weight: 400; font-size: 15px; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; width: 100%;
}
.fb-form textarea { resize: vertical; }
.fb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fb-ctx { font-size: 13.5px; color: var(--muted); background: var(--bg2); border-radius: 9px; padding: 8px 10px; }
.fb-ctx blockquote { margin: 6px 0 0; padding-left: 10px; border-left: 3px solid var(--accent); color: var(--text); font-style: italic; max-height: 6em; overflow: auto; }
.fb-status { margin: 0; font-size: 14px; min-height: 1em; }
.fb-status.ok { color: var(--ok); } .fb-status.bad { color: var(--bad); } .fb-status.warn { color: var(--warn); }
.fb-form footer { display: flex; justify-content: flex-end; gap: 10px; }
.hp { position: absolute; left: -5000px; }

/* --------------------------------------------------------------- glossary */
.gl-filter { width: 100%; max-width: 380px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 0 12px; font: inherit; }
.glossary { margin-top: 18px; }
.gl-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.gl-item dt { font-weight: 700; color: var(--accent); }
.gl-item dd { margin: 2px 0 0; }

.footer { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.loading { color: var(--muted); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  #menu-toggle { display: block; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 64px; width: min(320px, 86vw); z-index: 25; transform: translateX(-105%);
    transition: transform .2s; box-shadow: var(--shadow);
  }
  body.menu-open .sidebar { transform: none; }
  .hero { grid-template-columns: 1fr; }
  .brand img { height: 34px; }
  .search { width: auto; flex: 1; }
  .main { padding: 18px 16px 60px; }
  .prevnext { grid-template-columns: 1fr; }
  .fb-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .brand img { content: url(../img/logo-mark.svg); height: 36px; width: 36px; }
}
@media print {
  .topbar, .sidebar, .toc, .fb-bar, .prevnext, .done-row, .code-actions { display: none !important; }
  .layout { display: block; }
}

/* ------------------------------------------------------------- accounts */
.account-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 40px; min-width: 40px; padding: 0 14px;
  border-radius: 10px; background: var(--grad); color: #fff; font-weight: 600; font-size: 14px; flex: none; white-space: nowrap;
}
.account-btn:hover { text-decoration: none; filter: brightness(1.08); }
.account-btn.signed-in { padding: 0; width: 40px; border-radius: 50%; overflow: hidden; background: var(--panel); border: 2px solid var(--accent); }
.account-btn img { width: 100%; height: 100%; object-fit: cover; }
.acc-initials { font-weight: 700; color: var(--accent); }
.muted { color: var(--muted); }
.acc-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.acc-signin { max-width: 440px; margin: 10px 0; }
.acc-signin h2, .acc-profile h2 { border: 0; margin: 0 0 4px; padding: 0; }
.acc-provider {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 46px; margin: 10px 0; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--text); font-weight: 600;
}
.acc-provider:hover { border-color: var(--accent); text-decoration: none; }
.acc-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0 6px; }
.acc-or::before, .acc-or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.acc-form { display: grid; gap: 12px; margin-top: 10px; }
.acc-form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.acc-form input { height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); padding: 0 12px; font: inherit; }
.acc-form input:focus { outline: none; border-color: var(--accent); }
.acc-code { letter-spacing: 10px; font-size: 22px !important; font-family: var(--mono) !important; text-align: center; }
.acc-status { min-height: 1.2em; margin: 10px 0 0; font-size: 14px; }
.acc-status.bad, .acc-err { color: var(--bad); }
.acc-small { font-size: 13px; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.linklike:disabled { color: var(--muted); cursor: default; }
.acc-profile { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.acc-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-size: 26px; background: var(--panel2); border: 2px solid var(--accent); }
.acc-who { flex: 1; min-width: 200px; }
.acc-who p { margin: 0 0 4px; }
.acc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 16px 0; }
.kpi-card { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi-card b { display: block; font-size: 1.05rem; }
.kpi-card span { display: block; color: var(--muted); font-size: 13.5px; }
.kpi-card .big { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; color: var(--accent); }
.kpi-card .big small { font-size: 1rem; color: var(--muted); }
.kpi-next > div { display: grid; gap: 8px; }
.kpi-next .btn { font-size: 14px; padding: 8px 12px; }
.ring { --p: 0; width: 72px; height: 72px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--panel2) 0); }
.ring span { width: 56px; height: 56px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.bar { height: 10px; border-radius: 99px; background: var(--panel2); overflow: hidden; min-width: 120px; }
.bar span { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.acc-table td.num, .acc-table th.num { text-align: right; white-space: nowrap; }
.acc-danger { margin-top: 30px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; }
.acc-danger summary { cursor: pointer; font-weight: 600; }
.btn-danger { background: var(--bad); }
@media (max-width: 860px) { .account-btn:not(.signed-in) { padding: 0 10px; font-size: 13px; } }

/* ------------------------------------------------------------------ ads */
.ad-slot { margin: 28px 0 8px; padding: 8px 10px 10px; border: 1px dashed var(--line); border-radius: 12px; background: var(--bg2); min-height: 60px; }
.ad-label { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ad-rail { margin-top: 24px; }
.ad-house { display: flex; gap: 12px; align-items: center; color: var(--text); font-weight: 600; }
.ad-house:hover { text-decoration: none; color: var(--accent); }
.ad-house img { max-height: 90px; max-width: 100%; border-radius: 8px; }
.ad-rail .ad-house { flex-direction: column; align-items: flex-start; font-size: 13px; }
@media print { .ad-slot { display: none !important; } }
