:root {
    --bg: #f5f3ff;
    --surface: #ffffff;
    --surface-soft: #faf9ff;
    --surface-tint: #f0edff;
    --ink: #25233b;
    --muted: #625d78;
    --faint: #6d6880;
    --purple: #6750c7;
    --purple-dark: #4c389d;
    /* Osobna zmienna dla `--purple` użytego jako TŁO pod białym tekstem.
     * Bez niej nie da się rozjaśnić `--purple` w trybie ciemnym — biały napis
     * na rozjaśnionym tle straciłby czytelność. */
    --purple-bg: #6750c7;
    --purple-soft: #e8e2ff;
    --blue: #398fc0;
    --blue-soft: #dff3fb;
    --green: #3d9a7a;
    --green-soft: #def5eb;
    --orange: #d27c45;
    --orange-soft: #ffebdc;
    --line: #e8e4f0;
    --shadow: 0 18px 55px rgba(61, 46, 117, 0.1);
    --shadow-soft: 0 8px 24px rgba(61, 46, 117, 0.08);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: var(--font);
    line-height: 1.5;
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    content: "";
    opacity: 0.28;
    background-image: url("img/tlo1.webp");
    background-size: 260px;
    pointer-events: none;
}

body.is-dark {
    --bg: #141321;
    --surface: #201e31;
    --surface-soft: #28253c;
    --surface-tint: #2d2847;
    --ink: #f4f1ff;
    --muted: #b1abc8;
    /* #77718e dawalo 3,01:1 na --surface-tint, czyli ponizej AA dla
     * 10-pikselowych etykiet (resource-type, resource-subject, stopka).
     * Ta wartosc daje 4,85:1 na najjasniejszym z ciemnych tl i nadal
     * siedzi wyraznie ponizej --muted, wiec hierarchia zostaje. */
    --faint: #9b95af;
    --purple-soft: #3b3264;
    --blue-soft: #23495b;
    --green-soft: #234c43;
    --orange-soft: #57382a;
    --line: #39344e;
    --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.2);

    /* Akcenty musza byc jasniejsze na ciemnym tle. Bez tych wpisow
     * `--purple` zostawalo #6750c7, wartosc dobrana pod biala karte:
     * na --surface-tint dawalo kontrast 2,36:1, a link „Przejdz do…”
     * byl ledwo czytelny. Najgorszy przypadek to akcent na
     * --purple-soft — stad wartosc ponizej (5,20:1).
     * Te same barwy co w materialy-web/motyw-ciemny.css. */
    --purple: #b3a3f7;
    --purple-dark: #c4b5ff;
    --purple-bg: #5b4bb8;
    --blue: #7fc3e8;
    --green: #6fd4ab;
    --orange: #f0a879;
}

body.is-dark::before {
    opacity: 0.08;
    filter: invert(1);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(103, 80, 199, 0.38);
    outline-offset: 3px;
}

.dashboard-shell {
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 84px;
    padding: 16px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #8d78e8, #5b45b3);
    border-radius: 12px 4px 12px 4px;
    box-shadow: 0 7px 16px rgba(103, 80, 199, 0.25);
    font-family: var(--font-display);
    font-size: 25px;
    font-weight: 700;
}

.brand-copy {
    display: grid;
    gap: 1px;
}

.brand-copy strong {
    font-size: 15px;
    letter-spacing: 0.02em;
}

.brand-copy small {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 28px;
}

.nav-link {
    padding: 8px 12px;
    color: var(--muted);
    border-radius: 9px;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    transition: color 150ms ease, background 150ms ease;
}

.nav-link:hover,
.nav-link.is-active {
    color: var(--purple);
    background: var(--purple-soft);
}

/* Rozwijane menu „Pracownie". Pozycjonuje je JS względem okna
 * (position: fixed), więc nie obcina go poziome przewijanie nawigacji
 * na wąskich ekranach ani żaden overflow rodzica. */
.nav-drop {
    position: static;
    flex: 0 0 auto;
}
.nav-drop-btn {
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
}
.nav-drop-btn:hover,
.nav-drop-btn[aria-expanded="true"] {
    color: var(--purple);
    background: var(--purple-soft);
}
.nav-drop-btn span {
    font-size: 10px;
}
.nav-menu {
    position: fixed;
    z-index: 60;
    min-width: 250px;
    max-width: calc(100vw - 16px);
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}
.nav-menu[hidden] {
    display: none;
}
.nav-menu-item {
    display: grid;
    gap: 1px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
}
.nav-menu-item:hover {
    background: var(--purple-soft);
}
.nav-menu-item strong {
    color: var(--ink);
    font-size: 13px;
}
.nav-menu-item small {
    color: var(--muted);
    font-size: 11px;
}
.nav-menu-sep {
    height: 1px;
    margin: 5px 4px;
    background: var(--line);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.button,
.icon-button,
.text-button,
.view-button,
.category-tab {
    border: 0;
    cursor: pointer;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 15px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
    transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button--primary {
    color: #fff;
    background: linear-gradient(135deg, #8069dc, #5a43b3);
    box-shadow: 0 8px 18px rgba(103, 80, 199, 0.22);
}

.button--primary:hover {
    box-shadow: 0 11px 24px rgba(103, 80, 199, 0.3);
}

.button--secondary {
    color: var(--purple);
    background: var(--purple-soft);
}

.button--secondary:hover {
    background: #dcd3ff;
}

.button--light {
    color: #30235f;
    background: #fff;
    box-shadow: 0 8px 18px rgba(40, 24, 93, 0.14);
}

.icon-button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    font-size: 18px;
    transition: color 150ms ease, background 150ms ease;
}

.icon-button:hover {
    color: var(--purple);
    background: var(--purple-soft);
}

.hero-section {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    min-height: 330px;
    margin-top: 14px;
    padding: 52px 60px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 80% 20%, rgba(126, 102, 222, 0.24), transparent 18rem),
        linear-gradient(120deg, #e9e4ff 0%, #f5f2ff 54%, #e5f5fb 100%);
    box-shadow: var(--shadow);
}

body.is-dark .hero-section {
    background:
        radial-gradient(circle at 80% 20%, rgba(126, 102, 222, 0.25), transparent 18rem),
        linear-gradient(120deg, #2a2448 0%, #24213b 54%, #1c3542 100%);
}

.hero-copy {
    position: relative;
    z-index: 2;
    align-self: center;
    max-width: 590px;
}

.eyebrow {
    display: block;
    color: var(--purple);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.hero-copy .eyebrow {
    color: #6b58bb;
}

/* Powyższy kolor jest wartością dobraną pod jasne tło i ma wyższą
 * specyficzność niż `.eyebrow`, więc w trybie ciemnym właśnie on
 * obowiązywał — jasny fiolet na ciemnym tle dawał 3,27:1.
 * Powtórzenie z `body.is-dark` wygrywa specyficznością. */
body.is-dark .hero-copy .eyebrow {
    color: var(--purple);
}

.hero-copy h1 {
    margin: 12px 0 13px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(42px, 6vw, 72px);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 0.92;
}

.hero-copy h1 em {
    color: var(--purple);
    font-style: italic;
}

.hero-copy p {
    max-width: 480px;
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 25px;
}

.hero-orbit {
    position: relative;
    min-height: 220px;
    opacity: 0.92;
}

.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(103, 80, 199, 0.23);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotate(-25deg);
}

.orbit-ring--one {
    width: 270px;
    height: 110px;
}

.orbit-ring--two {
    width: 360px;
    height: 160px;
    border-color: rgba(57, 143, 192, 0.22);
    transform: translate(-50%, -50%) rotate(35deg);
}

.orbit-core {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    width: 80px;
    height: 80px;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #8c76e5, #4d389e);
    border: 8px solid rgba(255, 255, 255, 0.52);
    border-radius: 50%;
    box-shadow: 0 16px 35px rgba(73, 53, 159, 0.26);
    font-family: var(--font-display);
    font-size: 43px;
    transform: translate(-50%, -50%);
}

.orbit-dot {
    position: absolute;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.35);
}

.orbit-dot--one {
    top: 26px;
    left: 42%;
    background: var(--blue);
}

.orbit-dot--two {
    right: 14%;
    bottom: 38px;
    background: var(--orange);
}

.orbit-dot--three {
    bottom: 16px;
    left: 31%;
    background: var(--green);
}

.workspace-section {
    scroll-margin-top: 20px;
}

.section-heading,
.card-heading-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.section-heading {
    margin-bottom: 18px;
}

.section-heading h2,
.card-heading-row h2,
.lab-callout h2 {
    margin: 5px 0 0;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 500;
    letter-spacing: -0.035em;
    line-height: 1.05;
}

.text-button {
    padding: 6px 0;
    color: var(--muted);
    background: transparent;
    font-size: 11px;
}

.text-button:hover {
    color: var(--purple);
}

.filter-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 13px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.search-field {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 9px;
    min-width: 180px;
    min-height: 40px;
    padding: 0 11px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.search-field:focus-within {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(103, 80, 199, 0.1);
}

.search-field input {
    width: 100%;
    min-width: 0;
    color: var(--ink);
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 12px;
}

.search-field input::placeholder {
    color: var(--faint);
}

.search-field kbd {
    min-width: 19px;
    padding: 2px 5px;
    color: var(--faint);
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 10px;
    text-align: center;
}

.select-field select {
    min-height: 40px;
    padding: 0 30px 0 11px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: 0;
    background: var(--surface-soft);
    font-size: 12px;
    cursor: pointer;
}

.view-switch {
    display: flex;
    gap: 3px;
    padding: 3px;
    border-radius: 9px;
    background: var(--surface-soft);
}

.view-button {
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    color: var(--muted);
    border-radius: 7px;
    background: transparent;
    font-size: 17px;
}

.view-button:hover,
.view-button.is-selected {
    color: var(--purple);
    background: var(--surface);
    box-shadow: 0 2px 7px rgba(50, 38, 98, 0.08);
}

/* Paski na stronie głównej: „Proponowane” (ręczne przypięcia) i
   „Najnowsze materiały” (automatycznie według daty publikacji). */
.featured-strip {
    margin-bottom: 20px;
    padding: 15px 16px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(105, 80, 199, .07), rgba(44, 79, 124, .05));
}

.featured-strip--recommended {
    border-color: rgba(105, 80, 199, .3);
    background: linear-gradient(135deg, rgba(105, 80, 199, .13), rgba(44, 79, 124, .04));
}

.featured-strip[hidden] {
    display: none;
}

.featured-title {
    margin: 0 0 11px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.featured-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.featured-row:empty {
    display: none;
}

.featured-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 11px;
    align-items: start;
    padding: 12px 13px;
    color: inherit;
    border: 1px solid var(--line);
    border-radius: 12px;
    /* `var(--surface)`, a nie `#fff`: zmienna zmienia sie razem z motywem,
     * a twarde `#fff` zostawialo karte jasna w trybie ciemnym, gdzie tekst
     * dziedziczy juz jasny `--ink` — wychodzil jasny napis na bialym tle. */
    background: var(--surface);
    text-align: left;
    text-decoration: none;
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

a.featured-card:hover {
    border-color: var(--purple);
    box-shadow: 0 8px 22px rgba(50, 38, 98, .12);
    transform: translateY(-2px);
}

.featured-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: #fff;
    border-radius: 10px;
    /* `--purple-bg`, bo pod spodem stoi bialy napis — patrz :root. */
    background: linear-gradient(135deg, var(--purple-bg), #2c4f7c);
    font-size: 15px;
}

.featured-card h4 {
    margin: 0 0 3px;
    font-size: 13.5px;
    line-height: 1.35;
}

.featured-card p {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.5;
}

.featured-card .featured-go {
    display: inline-block;
    margin-top: 6px;
    color: var(--purple);
    font-size: 11px;
    font-weight: 800;
}

@media (max-width: 620px) {
    .featured-row {
        grid-template-columns: 1fr;
    }
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

/* Wyjasnienie rozjezdu sumy filtrów. Bez niego liczby wyglądają
 * jak błąd, bo sandbox, Playground i gra należą do dwóch kategorii. */
.category-note {
    margin: -8px 0 18px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
}

.category-note[hidden] {
    display: none;
}

body.is-dark .category-note {
    color: var(--muted);
}

.category-tab {
    padding: 8px 12px;
    color: var(--muted);
    border-radius: 9px;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
}

.category-tab span {
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    padding: 0 5px;
    color: var(--faint);
    border-radius: 999px;
    background: var(--surface-tint);
    font-size: 10px;
}

.category-tab:hover,
.category-tab.is-active {
    color: var(--purple);
    background: var(--purple-soft);
}

.category-tab.is-active span {
    color: #fff;
    /* Tlo pod bialym tekstem — patrz :root. */
    background: var(--purple-bg);
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.resource-grid.is-list {
    grid-template-columns: 1fr;
}

.resource-card {
    display: flex;
    min-height: 245px;
    flex-direction: column;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
    cursor: pointer;
}
.resource-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong, var(--shadow-soft));
    border-color: var(--purple, #6750c7);
}

.resource-card:hover {
    border-color: rgba(103, 80, 199, 0.32);
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.resource-card.is-featured {
    border-color: rgba(57, 143, 192, 0.32);
    background: linear-gradient(145deg, var(--surface), #f0faff);
}

body.is-dark .resource-card.is-featured {
    background: linear-gradient(145deg, var(--surface), #1d3540);
}

body.is-dark .featured-card:hover {
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

.resource-card-head,
.resource-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.resource-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 12px;
    font-size: 20px;
}

.tone-purple .resource-icon { color: var(--purple); background: var(--purple-soft); }
.tone-blue .resource-icon { color: var(--blue); background: var(--blue-soft); }
.tone-green .resource-icon { color: var(--green); background: var(--green-soft); }
.tone-orange .resource-icon { color: var(--orange); background: var(--orange-soft); }

.resource-type {
    color: var(--faint);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.resource-card h3 {
    margin: 18px 0 7px;
    color: var(--ink);
    font-size: 17px;
    line-height: 1.2;
}

.resource-card p {
    display: -webkit-box;
    min-height: 43px;
    margin: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.resource-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 14px;
}

.resource-tag {
    padding: 4px 7px;
    color: var(--muted);
    border-radius: 6px;
    background: var(--surface-tint);
    font-size: 10px;
}

.resource-card-footer {
    margin-top: auto;
    padding-top: 17px;
}

.resource-subject {
    color: var(--faint);
    font-size: 10px;
}

.resource-action {
    padding: 6px 0;
    color: var(--purple);
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.resource-action:hover {
    color: var(--purple-dark);
}

/* Przycisk kopiujący adres /<przedmiot>/<tytuł>.
 *
 * Celowo wariant ikony, a nie napisu „Skopiuj adres": stopka karty
 * ma już dział i „Otwórz", trzeci wyraz wciskałby się w wąski
 * widok listy. Ikona ma title i aria-label, więc nadal ma nazwę
 * dla czytnika ekranu i podpowiedź po najechaniu myszą. */
.resource-permalink {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.resource-permalink:hover {
    border-color: var(--purple);
    color: var(--purple);
}

/* Stopka ma trzy elementy: dział, akcja i przycisk adresu. Przy
 * justify-content: space-between środkowy wylądowałby na środku
 * szerokości, więc odsuwamy akcję do prawej — wtedy akcja i ikona
 * stoją obok siebie, a sam dział zostaje po lewej. */
.resource-card-footer .resource-action {
    margin-left: auto;
}

.resource-permalink:focus-visible {
    outline: 2px solid var(--purple);
    outline-offset: 2px;
}

.resource-grid.is-list .resource-card {
    display: grid;
    /* 64px zamiast 48px: kolumna musi zmieścić ikonę (40px) i jedną
     * literę skrótu typu. Przy 48px litera wychodziła poza kolumnę
     * i nachodziła na tytuł karty. */
    grid-template-columns: 64px minmax(150px, 0.7fr) minmax(220px, 1.5fr) auto;
    min-height: 0;
    align-items: center;
    gap: 14px;
}

/* W widoku listy skrót typu dostaje własne gniazdo obok ikony. */
.resource-grid.is-list .resource-card-head {
    gap: 6px;
}

.resource-type--skrot {
    display: grid;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    place-items: center;
    border-radius: 6px;
    letter-spacing: 0;
    background: var(--surface-soft);
}

.resource-grid.is-list .resource-card h3,
.resource-grid.is-list .resource-card p,
.resource-grid.is-list .resource-tags,
.resource-grid.is-list .resource-card-footer {
    margin: 0;
    padding: 0;
}

.resource-grid.is-list .resource-card h3 {
    font-size: 14px;
}

.resource-grid.is-list .resource-card p {
    min-height: 0;
    -webkit-line-clamp: 2;
}

.resource-grid.is-list .resource-tags {
    display: none;
}

.resource-grid.is-list .resource-card-footer {
    justify-content: flex-end;
}

.empty-state {
    padding: 50px 20px;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.empty-state[hidden] {
    display: none;
}

.empty-icon {
    display: inline-grid;
    width: 48px;
    height: 48px;
    place-items: center;
    color: var(--purple);
    border-radius: 15px;
    background: var(--purple-soft);
    font-size: 24px;
}

.empty-state h3 {
    margin: 14px 0 5px;
    font-size: 18px;
}

.empty-state p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 13px;
}

.bottom-section {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 14px;
    margin: 48px 0 20px;
}

.bottom-section--invite {
    display: block;
}

.classes-invite {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 42px 32px;
    color: #f8f6ff;
    text-align: center;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #5d47b2, #397fae);
    box-shadow: var(--shadow-soft);
}

.classes-invite-copy {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
}

.classes-invite .eyebrow {
    color: #d5ccff;
}

.classes-invite h2 {
    max-width: 1000px;
    margin: 10px auto 13px;
    color: #fff;
    font-size: clamp(28px, 3vw, 38px);
}

.classes-invite-copy p {
    max-width: 1000px;
    margin: 0 auto 22px;
    color: #ded8fa;
    font-size: 13px;
}

.activity-card,
.lab-callout {
    min-height: 250px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.card-heading-row {
    align-items: flex-start;
}

.card-heading-row h2 {
    font-size: 24px;
}

.small-badge {
    padding: 5px 8px;
    color: var(--purple);
    border-radius: 999px;
    background: var(--purple-soft);
    font-size: 10px;
    font-weight: 800;
}

.activity-list {
    display: grid;
    gap: 10px;
    margin-top: 21px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

.activity-item::before {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    content: "";
    border-radius: 50%;
    background: var(--purple);
}

.activity-item time {
    margin-left: auto;
    color: var(--faint);
    font-size: 10px;
}

.lab-callout {
    position: relative;
    overflow: hidden;
    color: #f8f6ff;
    border-color: transparent;
    background: linear-gradient(135deg, #5d47b2, #397fae);
}

.lab-callout .eyebrow {
    position: relative;
    color: #d5ccff;
}

.lab-callout h2 {
    position: relative;
    max-width: 440px;
    color: #fff;
    font-size: 34px;
}

.lab-callout p {
    position: relative;
    max-width: 470px;
    margin: 13px 0 21px;
    color: #ded8fa;
    font-size: 13px;
}

.callout-glow {
    position: absolute;
    right: -65px;
    bottom: -95px;
    width: 260px;
    height: 260px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    box-shadow: 0 0 0 22px rgba(255, 255, 255, 0.04), 0 0 0 45px rgba(255, 255, 255, 0.035);
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 0 30px;
    color: var(--faint);
    font-size: 10px;
}

.modal-dialog {
    width: min(520px, calc(100% - 28px));
    padding: 25px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 25px 80px rgba(23, 14, 61, 0.25);
}

.modal-dialog::backdrop {
    background: rgba(24, 17, 51, 0.46);
    backdrop-filter: blur(4px);
}

.modal-dialog--wide {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: var(--surface);
}

.modal-dialog--wide:not([open]) {
    display: none;
}

.modal-dialog--wide[open] {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-dialog--wide .modal-header {
    flex: 0 0 auto;
    min-height: 62px;
    padding: 13px 22px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.modal-dialog--wide h2 {
    flex: 0 0 auto;
    margin: 16px 24px 0;
    font-size: clamp(26px, 3vw, 36px);
}

.modal-dialog--wide > p {
    flex: 0 0 auto;
    margin: 8px 24px 14px;
}

.modal-dialog--wide::backdrop {
    background: rgba(24, 17, 51, 0.72);
    backdrop-filter: blur(4px);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.close-button {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
    cursor: pointer;
    font-size: 21px;
    line-height: 1;
}

.close-button:hover {
    color: var(--purple);
    background: var(--purple-soft);
}

.modal-dialog h2 {
    margin: 14px 0 8px;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 500;
    line-height: 1.05;
}

.modal-dialog > p,
.dialog-intro {
    color: var(--muted);
    font-size: 13px;
}

.dialog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 17px 0;
}

.dialog-meta span {
    padding: 5px 8px;
    color: var(--purple);
    border-radius: 7px;
    background: var(--purple-soft);
    font-size: 10px;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 22px;
}

.resource-form {
    display: grid;
    gap: 13px;
    margin-top: 19px;
}

.resource-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

.resource-form input,
.resource-form select,
.resource-form textarea {
    width: 100%;
    padding: 10px 11px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: 0;
    resize: vertical;
    background: var(--surface-soft);
    font-size: 12px;
}

.resource-form input:focus,
.resource-form select:focus,
.resource-form textarea:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(103, 80, 199, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.lab-content {
    min-height: 250px;
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
}

.modal-dialog--wide .lab-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    margin: 0 20px 20px;
    overflow: auto;
}

.modal-dialog--immersive .modal-header {
    position: absolute;
    z-index: 4;
    top: 0;
    right: 0;
    left: 0;
    min-height: 0;
    padding: 12px 14px;
    border: 0;
    background: linear-gradient(180deg, rgba(11, 16, 32, 0.72), transparent);
    pointer-events: none;
}

.modal-dialog--immersive .modal-header .eyebrow {
    display: none;
}

.modal-dialog--immersive .close-button {
    pointer-events: auto;
    background: rgba(17, 24, 42, 0.86);
}

.modal-dialog--immersive h2,
.modal-dialog--immersive > p {
    display: none;
}

.modal-dialog--immersive .lab-content {
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.modal-dialog--immersive .lab-terminal-frame,
.modal-dialog--immersive .lab-php-web-frame {
    border-radius: 0;
}

.lab-custom-frame {
    display: block;
    width: 100%;
    min-height: 480px;
    border: 0;
    border-radius: 10px;
    background: #f7f6fc;
}

.lab-terminal-frame,
.lab-php-web-frame {
    display: block;
    width: 100%;
    height: 760px;
    min-height: 760px;
    border: 0;
    border-radius: 10px;
    background: #0b1020;
}

.modal-dialog--wide .lab-terminal-frame,
.modal-dialog--wide .lab-php-web-frame {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.lab-php-web-frame {
    height: 860px;
    min-height: 860px;
    background: #eef3fb;
}

.modal-dialog--wide .lab-php-web-frame {
    background: #eef3fb;
}

.lab-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.lab-control {
    display: grid;
    flex: 1;
    min-width: 145px;
    gap: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.lab-control input[type="range"] {
    width: 100%;
    accent-color: var(--purple);
}

.lab-output {
    color: var(--purple);
    font-size: 12px;
    font-weight: 800;
}

.lab-canvas {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
}

.energy-result {
    display: grid;
    min-height: 170px;
    place-items: center;
    text-align: center;
}

.energy-result strong {
    display: block;
    color: var(--purple);
    font-size: 36px;
}

.energy-result span {
    color: var(--muted);
    font-size: 12px;
}

.toast {
    position: fixed;
    z-index: 20;
    right: 20px;
    bottom: 20px;
    max-width: min(360px, calc(100% - 40px));
    padding: 11px 14px;
    color: #fff;
    border-radius: 10px;
    background: #2d2548;
    box-shadow: var(--shadow);
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.is-error {
    background: #9b4e54;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 980px) {
    .hero-section {
        padding-inline: 38px;
    }

    .resource-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bottom-section {
        grid-template-columns: 1fr;
    }

    .classes-invite {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .modal-dialog--wide .modal-header {
        min-height: 54px;
        padding: 9px 14px;
    }

    .modal-dialog--wide h2 {
        margin: 12px 14px 0;
        font-size: 26px;
    }

    .modal-dialog--wide > p {
        margin: 6px 14px 10px;
    }

    .modal-dialog--wide .lab-content {
        margin: 0 10px 10px;
        padding: 8px;
    }

    .dashboard-shell {
        width: min(100% - 24px, 600px);
    }

    .topbar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .main-nav {
        order: 3;
        width: 100%;
        margin-left: 0;
        overflow-x: auto;
    }

    .nav-link {
        flex: 0 0 auto;
    }

    .topbar-actions {
        margin-left: auto;
    }

    .hero-section {
        grid-template-columns: 1fr;
        min-height: 0;
        padding: 34px 25px 20px;
    }

    .hero-orbit {
        position: absolute;
        right: -20px;
        bottom: -60px;
        width: 230px;
        min-height: 180px;
        opacity: 0.58;
    }

    .hero-copy {
        max-width: 100%;
    }

    .hero-copy p {
        max-width: 82%;
    }

    .filter-panel {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .search-field {
        flex-basis: 100%;
    }

    .select-field {
        flex: 1;
    }

    .select-field select {
        width: 100%;
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }

    .resource-grid.is-list .resource-card {
        display: flex;
    }

    .resource-grid.is-list .resource-card h3,
    .resource-grid.is-list .resource-card p,
    .resource-grid.is-list .resource-tags,
    .resource-grid.is-list .resource-card-footer {
        margin-top: initial;
        margin-bottom: initial;
    }

    .resource-grid.is-list .resource-card h3 {
        margin-top: 15px;
    }

    .resource-grid.is-list .resource-card p {
        min-height: 43px;
    }

    .resource-grid.is-list .resource-tags {
        display: flex;
    }

    .resource-grid.is-list .resource-card-footer {
        width: 100%;
        margin-top: auto;
        padding-top: 17px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .classes-invite {
        padding: 24px 20px;
    }

    .class-offers {
        grid-template-columns: 1fr;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 460px) {
    .topbar-actions .button {
        padding-inline: 10px;
    }

    .brand-copy small {
        display: none;
    }

    .hero-copy h1 {
        font-size: 48px;
    }

    .hero-copy p {
        max-width: 100%;
        font-size: 13px;
    }

    .hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .hero-actions .button {
        width: 100%;
    }

    .category-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 3px;
    }

    .category-tab {
        flex: 0 0 auto;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Strona gier: jedna karta nie musi zajmować pełnej szerokości siatki 3-kolumnowej. */
.gry-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 420px));
}
