/* Odkrywanie języka polskiego — shared styles */

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f3efe9;
  --text: #1f1c19;
  --muted: #6b645c;
  --border: #e5ded4;
  --accent: #c8102e;
  --accent-soft: #fbe7ea;
  --ok: #1d7f48;
  --ok-soft: #e2f3e9;
  --bad: #bf3326;
  --bad-soft: #fbe9e6;
  --warn: #a8690e;
  --warn-soft: #fcf1dd;
  --info: #2462c9;
  --info-soft: #e6eefb;
  --l1: #2a9656;
  --l2: #2d6bd6;
  --l3: #8447d1;
  --l4: #c07f06;
  --end: #c8102e;
  --swap: #2462c9;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 20px rgb(0 0 0 / 0.05);
  --font: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131211;
    --surface: #1c1b19;
    --surface-2: #262421;
    --text: #ece7e1;
    --muted: #a39a90;
    --border: #36322d;
    --accent: #ff5c70;
    --accent-soft: #3b1b21;
    --ok: #4cc281;
    --ok-soft: #16301f;
    --bad: #ff7b6b;
    --bad-soft: #3a1c18;
    --warn: #e9b14c;
    --warn-soft: #342913;
    --info: #7fb0ff;
    --info-soft: #172640;
    --l1: #4cc281;
    --l2: #6f9fff;
    --l3: #b78dff;
    --l4: #e9b14c;
    --end: #ff6e80;
    --swap: #7fb0ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131211;
  --surface: #1c1b19;
  --surface-2: #262421;
  --text: #ece7e1;
  --muted: #a39a90;
  --border: #36322d;
  --accent: #ff5c70;
  --accent-soft: #3b1b21;
  --ok: #4cc281;
  --ok-soft: #16301f;
  --bad: #ff7b6b;
  --bad-soft: #3a1c18;
  --warn: #e9b14c;
  --warn-soft: #342913;
  --info: #7fb0ff;
  --info-soft: #172640;
  --l1: #4cc281;
  --l2: #6f9fff;
  --l3: #b78dff;
  --l4: #e9b14c;
  --end: #ff6e80;
  --swap: #7fb0ff;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 350;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; }
h2 { font-size: 1.55rem; margin: 2.4rem 0 0.8rem; }
h3 { font-size: 1.15rem; margin: 1.8rem 0 0.6rem; }
h2 small, h3 small { font-weight: 400; color: var(--muted); font-size: 0.7em; margin-left: 0.4em; }
p { margin: 0.6rem 0; }
code, kbd { font-family: var(--mono); font-size: 0.9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.topbar .brand { font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; }
.crumbs { display: flex; gap: 6px; flex-wrap: wrap; color: var(--muted); min-width: 0; flex: 1; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs span.sep { opacity: 0.5; }
.tools { display: flex; gap: 6px; }
.tools button, .btn {
  font: inherit; font-size: 0.85rem; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 5px 12px; line-height: 1.3;
}
.tools button:hover, .btn:hover { border-color: var(--accent); }
.tools button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- layout ---------- */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr);
  max-width: 1180px; margin: 0 auto; padding: 0 16px 80px; gap: 40px;
}
@media (min-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 860px) 230px; padding: 0 32px 80px; }
}
@media (min-width: 1100px) {
  .layout:not(:has(.toc)) { grid-template-columns: minmax(0, 1000px); justify-content: center; }
}
.content { min-width: 0; }
.toc { display: none; }
@media (min-width: 1100px) {
  .toc { display: block; position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 90px); overflow: auto; padding-top: 32px; font-size: 0.85rem; }
  .toc h4 { margin: 0 0 8px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; }
  .toc a { display: block; padding: 4px 10px; color: var(--muted); text-decoration: none; border-left: 2px solid var(--border); }
  .toc a:hover { color: var(--text); }
  .toc a.active { color: var(--accent); border-left-color: var(--accent); }
  .toc a[data-level] { font-weight: 500; }
}

/* ---------- hero ---------- */
.hero { padding: 36px 0 12px; }
.kicker { color: var(--accent); font-weight: 500; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 3.6rem); margin: 4px 0 0; letter-spacing: -0.02em; }
.hero .sub { font-size: 1.2rem; color: var(--muted); margin: 2px 0 14px; }
.hero .lead { font-size: 1.08rem; max-width: 64ch; }
.qwords { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.qwords span {
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 4px 14px; font-weight: 600; font-size: 1rem;
}
.qwords span em { font-style: normal; font-weight: 400; opacity: 0.8; font-size: 0.85em; }
.levelnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.levelnav a {
  text-decoration: none; color: var(--text); border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; padding: 8px 14px; font-size: 0.9rem; display: flex; flex-direction: column; line-height: 1.3;
  border-top: 3px solid var(--lc, var(--border));
}
.levelnav a b { font-weight: 600; }
.levelnav a small { color: var(--muted); }
.levelnav a:hover { box-shadow: var(--shadow); }

/* ---------- review / filters ---------- */
.review, .filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 0.88rem; color: var(--muted); margin: 10px 0;
}
.review .due { color: var(--warn); font-weight: 500; }
.review .ok { color: var(--ok); font-weight: 500; }
.filters .chip {
  font: inherit; font-size: 0.82rem; cursor: pointer; border-radius: 999px; padding: 3px 11px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.filters .chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- level sections ---------- */
section.level {
  --lc: var(--l1);
  margin-top: 48px; padding: 4px 0 0 22px; border-left: 4px solid var(--lc); position: relative;
}
section.level[data-level="2"] { --lc: var(--l2); }
section.level[data-level="3"] { --lc: var(--l3); }
section.level[data-level="4"] { --lc: var(--l4); }
.levelnav a[data-level="1"] { --lc: var(--l1); }
.levelnav a[data-level="2"] { --lc: var(--l2); }
.levelnav a[data-level="3"] { --lc: var(--l3); }
.levelnav a[data-level="4"] { --lc: var(--l4); }
section.level > h2:first-child { margin-top: 0.5rem; }
.lvbadge {
  display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: #fff; background: var(--lc); border-radius: 6px; padding: 2px 9px; margin-bottom: 4px;
}
.master {
  display: flex; align-items: center; gap: 10px; margin-top: 26px; padding: 12px 16px;
  border: 1px dashed var(--lc); border-radius: var(--radius); cursor: pointer; font-size: 0.92rem;
}
.master input { width: 18px; height: 18px; accent-color: var(--lc); }
.master.done { background: color-mix(in srgb, var(--lc) 12%, transparent); border-style: solid; }

/* ---------- boxes ---------- */
.box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin: 16px 0; box-shadow: var(--shadow);
}
.callout { border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; border: 1px solid transparent; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout .ttl { font-weight: 600; display: block; margin-bottom: 4px; }
.callout.rule { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.callout.tip { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.callout.native { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.callout.big { font-size: 1.1rem; }

.golden { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); margin: 18px 0; }
.golden > div > b { display: block; line-height: 1.3; }
.golden > div {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.golden .n {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 0.9rem; margin-bottom: 8px;
}
.golden p { margin: 4px 0 0; }

/* ---------- inline highlights ---------- */
.pl b, td b, .card b, .ex b, .idiom b, li b.e, .e { color: var(--end); font-weight: 600; }
mark.sw, .sw { background: none; color: var(--swap); font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.pl { font-weight: 450; }
.gloss { color: var(--muted); font-style: italic; }

/* ---------- tables ---------- */
.tw { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.t th, table.t td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t thead th { background: var(--surface-2); font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
table.t tbody th { font-weight: 500; background: color-mix(in srgb, var(--surface-2) 50%, transparent); white-space: nowrap; }
table.t td.pl, table.t [data-say] { cursor: pointer; }
table.t td.pl:hover, [data-say]:hover { background: var(--accent-soft); }
table.t .grp td { background: var(--surface-2); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

/* ---------- examples ---------- */
.exs { display: grid; gap: 10px; margin: 14px 0; }
@media (min-width: 720px) { .exs.two { grid-template-columns: 1fr 1fr; } }
.ex {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px 10px 16px;
  border-left: 4px solid var(--tc, var(--border)); position: relative;
}
.ex .pl { margin: 0; font-size: 1.04rem; padding-right: 30px; }
.ex .en { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.ex .tag { position: absolute; top: 8px; right: 10px; }
.ex .note { margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); }
.tag {
  font-size: 0.72rem; border-radius: 999px; padding: 1px 8px; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.ex .spk { margin-left: 6px; }
.ex[hidden] { display: none; }
.spk {
  border: 0; background: none; cursor: pointer; font-size: 0.9rem; padding: 0 2px; opacity: 0.55; vertical-align: baseline;
}
.spk:hover { opacity: 1; }

/* hide English (active recall) */
body.hide-en .en:not(.shown) { filter: blur(5px); cursor: pointer; user-select: none; }
body.hide-en .en:not(.shown):hover { filter: blur(3px); }

/* ---------- chips / verb lists ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; padding: 0; list-style: none; }
.chips li { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px 10px; font-size: 0.92rem; }
.chips li small { color: var(--muted); }

/* ---------- decision flow ---------- */
.flow { display: grid; gap: 12px; margin: 18px 0; }
.flow .step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.flow .step > .q { font-weight: 600; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.flow .step > .q::before {
  content: attr(data-n); display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%;
  background: var(--text); color: var(--bg); font-size: 0.8rem;
}
.flow .branches { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.flow .br { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 0.93rem; }
.flow .br .if { display: block; color: var(--muted); font-size: 0.82rem; }
.flow .br .then { display: block; font-weight: 600; margin: 2px 0; }
.flow .br .then b { color: var(--end); }

/* ---------- swap grid (alternations) ---------- */
.swaps { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin: 16px 0; }
.swaps > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.swaps .rule { font-family: var(--mono); font-size: 1.15rem; font-weight: 600; }
.swaps .rule .to { color: var(--swap); }
.swaps .ex2 { font-size: 0.88rem; color: var(--muted); margin-top: 2px; }
.swaps .ex2 b { color: var(--text); font-weight: 500; }

/* ---------- motion vs location ---------- */
.vs { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 16px 0; background: var(--surface); box-shadow: var(--shadow); }
.vs .row { display: grid; grid-template-columns: 1fr 34px 1fr; align-items: center; border-bottom: 1px solid var(--border); }
.vs .row:last-child { border-bottom: 0; }
.vs .row > div { padding: 9px 14px; }
.vs .row .arrow { text-align: center; color: var(--muted); padding: 0; }
.vs .head { background: var(--surface-2); font-weight: 600; font-size: 0.85rem; }
.vs .head > div:first-child { color: var(--info); }
.vs .head > div:last-child { color: var(--ok); }
.vs .c { display: block; font-size: 0.75rem; color: var(--muted); }
@media (max-width: 560px) { .vs .row { grid-template-columns: 1fr; } .vs .row .arrow { display: none; } .vs .row > div:last-child { padding-top: 0; } }

/* ---------- mistakes ---------- */
.mistakes { display: grid; gap: 8px; margin: 14px 0; }
.mistake { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.mistake > div { padding: 9px 14px; }
.mistake .no { background: var(--bad-soft); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.mistake .no::before { content: "✗ "; color: var(--bad); font-weight: 700; }
.mistake .yes { background: var(--ok-soft); }
.mistake .yes::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.mistake .why { grid-column: 1 / -1; font-size: 0.85rem; color: var(--muted); padding-top: 6px; background: var(--surface); }
@media (max-width: 560px) { .mistake { grid-template-columns: 1fr; } }

/* ---------- idioms ---------- */
.idioms { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 16px 0; }
.idiom { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; border-top: 3px solid var(--tc, var(--l4)); }
.idiom .pl { font-size: 1.05rem; font-weight: 600; margin: 0 0 4px; padding-right: 26px; }
.idiom .lit { font-size: 0.82rem; color: var(--muted); margin: 0; }
.idiom .en { font-weight: 500; margin: 6px 0; }
.idiom .use { font-size: 0.9rem; margin: 6px 0 0; padding-top: 8px; border-top: 1px dashed var(--border); }
.idiom .tag { position: absolute; bottom: 10px; right: 12px; }
.idiom .use { padding-right: 70px; }

/* ---------- quizzes ---------- */
.quiz { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 20px 0; box-shadow: var(--shadow); }
.quiz > h4, .mcqset > h4 { margin: 0 0 4px; font-size: 1.05rem; }
.quiz > h4::before, .mcqset > h4::before { content: "✎ "; color: var(--accent); }
.quiz .instr, .mcqset .instr { color: var(--muted); font-size: 0.88rem; margin: 0 0 10px; }
.quiz ol { padding-left: 1.4em; margin: 0; }
.quiz li { padding: 7px 0; border-bottom: 1px dashed var(--border); }
.quiz li:last-child { border-bottom: 0; }
.quiz input {
  font: inherit; font-size: 1rem; border: 0; border-bottom: 2px solid var(--muted); background: var(--surface-2);
  color: var(--text); padding: 1px 6px; border-radius: 4px 4px 0 0; min-width: 5ch; outline: none;
}
.quiz input:focus { border-bottom-color: var(--accent); }
.quiz input.ok { border-bottom-color: var(--ok); background: var(--ok-soft); }
.quiz input.bad { border-bottom-color: var(--bad); background: var(--bad-soft); }
.quiz input.almost { border-bottom-color: var(--warn); background: var(--warn-soft); }
.quiz .hint { color: var(--muted); font-size: 0.88rem; }
.quiz .ans { color: var(--ok); font-weight: 600; margin-left: 8px; font-size: 0.92rem; }
.quiz .why { display: block; font-size: 0.84rem; color: var(--muted); margin-top: 2px; }
.qbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.qbar .score { font-weight: 600; margin-left: auto; }

.mcqset { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 20px 0; box-shadow: var(--shadow); }
.mcq { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.mcq:last-of-type { border-bottom: 0; }
.mcq > p { margin: 0 0 6px; font-weight: 450; }
.mcq .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.mcq .opts button {
  font: inherit; font-size: 0.95rem; cursor: pointer; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); border-radius: 8px; padding: 4px 14px;
}
.mcq .opts button:hover:not(:disabled) { border-color: var(--accent); }
.mcq .opts button.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.mcq .opts button.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); text-decoration: line-through; }
.mcq .opts button:disabled { cursor: default; }
.mcq .why { display: none; font-size: 0.86rem; color: var(--muted); margin: 6px 0 0; }
.mcq.answered .why { display: block; }

details.reveal { background: var(--surface-2); border-radius: 10px; padding: 8px 14px; margin: 10px 0; }
details.reveal summary { cursor: pointer; font-weight: 500; }

/* ---------- flashcards ---------- */
.cardbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin: 12px 0; }
.card { perspective: 800px; height: 118px; cursor: pointer; outline: none; }
.card .in { position: relative; width: 100%; height: 100%; transition: transform 0.45s; transform-style: preserve-3d; }
.card.flip .in { transform: rotateY(180deg); }
.card .f, .card .b {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius); border: 1px solid var(--border);
  display: grid; place-items: center; text-align: center; padding: 10px; box-shadow: var(--shadow); font-size: 1.02rem;
}
.card .f { background: var(--surface); }
.card .f small, .card .b small { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.card .b { background: var(--accent-soft); transform: rotateY(180deg); font-weight: 600; }
.card:focus-visible .f, .card:focus-visible .b { outline: 2px solid var(--accent); }

/* ---------- cheat sheet ---------- */
.cheat { border: 2px solid var(--text); border-radius: var(--radius); padding: 18px 22px; background: var(--surface); }
.cheat h3 { margin-top: 0.4rem; }
.cheat .cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---------- section index / home ---------- */
.cards-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 18px 0; }
.tcard {
  display: block; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s;
}
.tcard:hover { transform: translateY(-2px); border-color: var(--accent); }
.tcard .n { color: var(--muted); font-size: 0.8rem; }
.tcard h3 { margin: 2px 0; font-size: 1.12rem; }
.tcard .en { color: var(--muted); font-size: 0.9rem; margin: 0; }
.tcard .sum { font-size: 0.88rem; margin: 8px 0 0; }
.tcard .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pill { font-size: 0.72rem; border-radius: 999px; padding: 2px 9px; background: var(--surface-2); color: var(--muted); }
.pill.ready { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.pill.soon { background: var(--surface-2); }
.pill.lv { background: var(--info-soft); color: var(--info); }
.pill.prog { background: var(--accent-soft); color: var(--accent); }
.pill.due { background: var(--warn-soft); color: var(--warn); font-weight: 600; }

.sec { margin: 34px 0; }
.sec > h2 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sec > h2 a { color: var(--text); text-decoration: none; }
.sec > h2 .num { color: var(--accent); font-variant-numeric: tabular-nums; }
.sec ul.tl { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.sec ul.tl li a {
  display: flex; justify-content: space-between; gap: 8px; align-items: center; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 0.93rem;
}
.sec ul.tl li a:hover { border-color: var(--accent); }
.sec ul.tl li a .en { color: var(--muted); font-size: 0.8rem; display: block; }

.stub { text-align: center; padding: 34px 20px; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); margin: 30px 0; }
.stub .big { font-size: 2.4rem; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pager a {
  text-decoration: none; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; background: var(--surface);
}
.pager a:hover { border-color: var(--accent); }
.pager a small { display: block; color: var(--muted); }
.pager .next { text-align: right; grid-column: 2; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.85rem; color: var(--muted); margin: 8px 0; }
.legend b { color: var(--end); }

/* ---------- home: track chooser ---------- */
.tracks { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); margin: 22px 0 30px; }
.track {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column; transition: border-color 0.15s, transform 0.15s;
}
.track:hover { border-color: var(--accent); transform: translateY(-2px); }
.track .go { display: block; padding: 22px 22px 16px; text-decoration: none; color: var(--text); flex: 1; }
.track .ic { font-size: 2.2rem; line-height: 1; }
.track h2 { margin: 10px 0 6px; font-size: 1.6rem; }
.track h2 small { display: block; font-size: 0.95rem; font-weight: 400; color: var(--muted); }
.track p { margin: 0 0 12px; font-size: 0.94rem; }
.track .secs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 22px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.track .secs a {
  font-size: 0.8rem; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px;
}
.track .secs a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- bilingual reading blocks (Wiedza o Polsce) ---------- */
.bi { margin: 0 0 14px; }
.bi > .pl { margin: 0; font-weight: 400; }
.bi .pl b { color: var(--text); font-weight: 600; }
.golden p .en, .vs .en { display: block; color: var(--muted); font-size: 0.86rem; }
.bi > .en { margin: 3px 0 0; color: var(--muted); font-size: 0.9rem; border-left: 3px solid var(--border); padding-left: 10px; }
li.bi > .en { display: block; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 16px 0; padding: 0 0 0 18px; border-left: 3px solid var(--accent); }
.timeline li { position: relative; margin: 0 0 14px; padding-left: 12px; }
.timeline li::before {
  content: ""; position: absolute; left: -26px; top: 6px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--accent);
}
.timeline .yr { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; margin-right: 6px; }
.timeline .en { display: block; color: var(--muted); font-size: 0.88rem; }

/* ---------- exam sets (Pisanie i mówienie) ---------- */
.gov { color: var(--muted); font-size: 0.82em; font-weight: 400; font-style: italic; }
.steps { margin: 6px 0 0; padding-left: 20px; }
.steps li { margin: 3px 0; }
section.zestaw { border-top: 2px solid var(--border); margin-top: 34px; padding-top: 6px; }
.zgrid { display: grid; gap: 18px; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); align-items: start; margin: 12px 0; }
.zgrid figure { margin: 0; }
.zgrid img { width: 100%; height: auto; display: block; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.zgrid figcaption { font-size: 0.86rem; margin-top: 6px; }
.zgrid figcaption .en { display: block; color: var(--muted); }
.ztasks { margin: 0; padding-left: 22px; }
.ztasks li { margin: 0 0 8px; }
.ztask h3 { margin: 18px 0 4px; }
details.recall > summary { line-height: 1.5; }
details.recall > summary .muted { display: block; font-weight: 400; font-size: 0.88rem; }
details.recall[open] > summary { margin-bottom: 8px; }
details.recall h4 { margin: 14px 0 4px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
table.t.vocab td { padding: 6px 12px; }
table.t.vocab td.pl { width: 50%; font-weight: 500; }
table.t.vocab td.en { color: var(--muted); }
ul.frames, ul.keys { margin: 6px 0 10px; padding-left: 20px; }
ul.frames li, ul.keys li { margin: 4px 0; }
ul.frames .pl { font-weight: 500; cursor: pointer; }
ul.frames .en, ul.keys .en { display: block; color: var(--muted); font-size: 0.86rem; }
details.model p { margin: 8px 0; }
details.model b { color: var(--accent); font-weight: 600; }
details.deck .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 640px) { .zgrid { grid-template-columns: 1fr; } table.t.vocab td.pl { width: auto; } }

/* ---------- diagrams (inline SVG, theme-aware) ---------- */
.diagrams { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin: 16px 0; }
.diagrams figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.diagrams figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 6px; text-align: center; }
svg.diagram { width: 100%; height: auto; display: block; font-family: var(--font); }
svg.diagram .dg-frame { fill: var(--surface-2); stroke: var(--text); stroke-width: 3; }
svg.diagram .dg-grid { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 6 6; fill: none; }
svg.diagram .dg-t { fill: var(--text); font-size: 17px; font-weight: 500; text-anchor: middle; }
svg.diagram .dg-s { fill: var(--muted); font-size: 14px; text-anchor: middle; }
svg.diagram .dg-c { fill: var(--accent); font-weight: 600; }
svg.diagram .dg-sky { fill: color-mix(in srgb, var(--info) 10%, transparent); }
svg.diagram .dg-b1 { fill: color-mix(in srgb, var(--l1) 24%, transparent); stroke: var(--l1); stroke-width: 1.5; }
svg.diagram .dg-b2 { fill: color-mix(in srgb, var(--l2) 22%, transparent); stroke: var(--l2); stroke-width: 1.5; }
svg.diagram .dg-b3 { fill: color-mix(in srgb, var(--l3) 22%, transparent); stroke: var(--l3); stroke-width: 1.5; }
svg.diagram .dg-p { fill: var(--text); opacity: 0.75; }
svg.diagram .dg-tree { fill: var(--l1); opacity: 0.6; }
.zmini { display: grid; gap: 14px; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); align-items: start; }
@media (max-width: 640px) { .zmini { grid-template-columns: 1fr; } }

/* ---------- lightbox ---------- */
img.zoomable { cursor: zoom-in; transition: transform 0.15s; }
img.zoomable:hover { transform: scale(1.02); }
img.zoomable:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgb(0 0 0 / 0.95); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { height: auto; max-width: 94vw; border-radius: 8px; box-shadow: 0 10px 40px rgb(0 0 0 / 0.5); }
.lightbox .lb-cap { color: #eee; font-size: 0.95rem; margin: 10px 0 0; text-align: center; max-width: 90vw; }
.lightbox .lb-close { position: absolute; top: 12px; right: 16px; background: rgb(255 255 255 / 0.15); color: #fff; border: 0;
  border-radius: 50%; width: 40px; height: 40px; font-size: 1.2rem; cursor: pointer; }
body.lb-open { overflow: hidden; }

footer.site { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 30px 16px; border-top: 1px solid var(--border); }

@media print {
  .topbar, .toc, .tools, .review, .filters, .qbar, .master, .pager, .cardbar, .spk, footer.site { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .box, .tw, .ex, .quiz, .idiom { box-shadow: none; break-inside: avoid; }
  body.print-cheat .content > *:not(#sciaga) { display: none !important; }
}
