.math-subjects { display:flex; flex-wrap:wrap; gap:8px; padding:18px 24px; max-width:1230px; margin:auto; }
.math-subjects a { padding:10px 22px; border:1px solid var(--line); border-radius:999px; text-decoration:none; background:var(--paper,#fff); color:var(--ink,#26313e); font-weight:700; }
.math-subjects a[aria-current] { background:#167c73; color:#fff; border-color:#167c73; }
.math-filters { display:grid; grid-template-columns:2fr 1fr 1fr auto; gap:16px; align-items:end; margin-block:24px; }
.math-filters label { display:grid; gap:8px; font-weight:700; min-width:0; }
.math-filters input,.math-filters select,.math-check input { font:inherit; font-size: max(16px,1rem); border:1px solid var(--line,#bbb); border-radius:8px; padding:12px; width:100%; min-width:0; background:var(--paper,#fff); color:var(--ink,#26313e); }
.math-filters button { margin:0; }
[data-math-topic][hidden] { display:none; }
.math-lesson-main { max-width:980px; margin:auto; padding:28px 24px 64px; }
.math-lesson .math-subjects { padding-inline:0; }
.math-back { display:inline-block; padding-block:10px; }
.math-lesson-head { margin:24px 0 32px; }
.math-lesson-head h1 { font-size:clamp(2rem,5vw,3.3rem); line-height:1.15; margin-block:12px 24px; overflow-wrap:anywhere; }
.math-level-links { display:flex; flex-wrap:wrap; gap:10px; margin-top:24px; }
.math-level-links a { padding:10px 14px; border:1px solid var(--line); border-radius:8px; background:var(--paper,#fff); }
.math-lesson-section { margin-block:24px; padding:clamp(18px,4vw,36px); background:var(--paper,#fff); border:1px solid var(--line); border-radius:16px; scroll-margin-top:120px; }
.math-lesson-section h2 { font-size:clamp(1.4rem,3.5vw,2rem); line-height:1.25; margin:8px 0 18px; }
.math-lesson-section h3 { font-size:1.12rem; }
.math-lesson-section p,.math-lesson-section li { line-height:1.8; }
.math-level { font-size:.85rem; font-weight:800; color:#167c73; margin:0; }
.math-worked { border-left:4px solid #167c73; padding:4px 20px; background:#eff8f6; border-radius:0 10px 10px 0; margin-block:24px; }
.math-worked li { padding-block:4px; }
.math-watch { padding:16px; border-radius:10px; background:#fff4df; color:#60400d; }
.math-check { margin-top:28px; border-top:1px solid var(--line); padding-top:16px; }
.math-check label { display:block; line-height:1.65; }
.math-input-note { font-size:.85rem; margin:8px 0; }
.math-answer-row { display:flex; gap:12px; align-items:stretch; }
.math-answer-row input { max-width:250px; }
.math-answer-row button { margin:0; flex-shrink:0; }
.math-check-feedback { min-height:1.8em; font-weight:700; }
.math-check-feedback[data-result=correct] { color:#176846; }
.math-check-feedback[data-result=incorrect] { color:#b82b35; }
.math-check details { padding-top:12px; }
.math-check summary { cursor:pointer; font-weight:700; padding-block:6px; }
.math-tool-links { display:flex; flex-wrap:wrap; gap:12px; }
.math-tool-links a { margin:0; }
.math-sources { padding:24px 0; }
.math-sources li { margin-block:10px; }
.math-sources a { overflow-wrap:anywhere; }
html[data-theme=dark] .math-worked { background:#153d3d; }
html[data-theme=dark] .math-watch { background:#493716; color:#ffe3a7; }
html[data-theme=dark] .math-level { color:#86dfd1; }
html[data-theme=dark] .math-check-feedback[data-result=correct] { color:#91e4b9; }
html[data-theme=dark] .math-check-feedback[data-result=incorrect] { color:#ffb3b8; }
@media(max-width:760px) { .math-filters { grid-template-columns:1fr 1fr; } .math-filters label:first-child { grid-column:1/-1; } .math-filters button { grid-column:1/-1; } .math-lesson-main { padding-inline:16px; } }
@media(max-width:400px) { .math-filters { grid-template-columns:1fr; } .math-answer-row { flex-wrap:wrap; } .math-answer-row input { max-width:none; } .math-level-links { display:grid; } }

#tematy { scroll-margin-top:110px; }

/* Use the same surfaces, accents and spacing as the English knowledge library. */
.math-page .math-hub-hero { background:linear-gradient(90deg,#f7fafcf0,#fff3f0d6),url('../images/background.webp') center/cover; }
.math-page .math-hub-hero__copy,.math-page .math-hub-hero__aside { border-radius:var(--radius,8px); }
.math-knowledge-toolbar { padding:24px; border:1px solid var(--line); border-radius:var(--radius,8px); margin-bottom:24px; background:var(--paper); box-shadow:0 10px 24px #1d2a380d; }
.math-knowledge-toolbar .math-library__head { margin-bottom:16px; }
.math-knowledge-toolbar h2 { font-size:clamp(1.65rem,3vw,2rem); }
.math-knowledge-toolbar .math-filters { margin-block:20px 0; }
[data-math-topic] { --topic-accent:#167c73; --topic-soft:#edf8f4; min-height:220px; padding:22px; border-color:var(--line); border-top:3px solid var(--topic-accent); border-radius:var(--radius,8px); background:linear-gradient(180deg,#ffffffed,#fff6f48f); gap:14px; }
[data-math-topic][data-group="Funkcje i ciągi"] { --topic-accent:#3374c8; --topic-soft:#edf5ff; }
[data-math-topic][data-group="Geometria"] { --topic-accent:#7355a0; --topic-soft:#f3eef9; }
[data-math-topic][data-group="Dane i losowość"] { --topic-accent:#986711; --topic-soft:#fff6df; }
[data-math-topic] h3 { font-size:1.25rem; line-height:1.3; }
[data-math-topic] p { font-weight:500; }
[data-math-topic] .math-resource-card__meta { color:var(--topic-accent); font-size:.75rem; line-height:1.65; }
.math-topic-symbol { display:grid; place-items:center; width:44px; height:44px; border-radius:50%; background:var(--topic-soft); color:var(--topic-accent); font:700 1.15rem Georgia,serif; }
.math-topic-open { font-size:.85rem; font-weight:800; color:var(--ink); }
.math-lesson-head { padding:clamp(20px,4vw,36px); border:1px solid var(--line); border-radius:var(--radius,8px); background:linear-gradient(135deg,#fff7f5,#edf8f6); }
.math-lesson-section { border-radius:var(--radius,8px); box-shadow:0 10px 24px #1d2a380a; }
.math-worked,.math-watch { border-radius:var(--radius,8px); }
.math-level-links a { text-decoration:none; font-weight:700; font-size:.9rem; }
.math-page .math-check .button--primary { background:#167c73; color:#fff; }
.math-page .math-check .button--primary:hover { background:#10655e; }
html[data-theme=dark] .math-page .math-hub-hero { background:linear-gradient(90deg,#15232ff2,#223b48dd),url('../images/background.webp') center/cover; }
html[data-theme=dark] .math-knowledge-toolbar { background:#203441; border-color:#47606e; }
html[data-theme=dark] .math-lesson-head { background:linear-gradient(135deg,#233c4a,#1a303e); }
html[data-theme=dark] [data-math-topic] { --topic-accent:#91e0d0; --topic-soft:#244b48; border-top-color:var(--topic-accent); }
html[data-theme=dark] [data-math-topic][data-group="Funkcje i ciągi"] { --topic-accent:#bddcff; --topic-soft:#29445e; }
html[data-theme=dark] [data-math-topic][data-group="Geometria"] { --topic-accent:#e0ccff; --topic-soft:#443856; }
html[data-theme=dark] [data-math-topic][data-group="Dane i losowość"] { --topic-accent:#ffda95; --topic-soft:#50462e; }
@media(max-width:760px) { .math-knowledge-toolbar { padding:18px; } }
