/* ═══ TOKENY (kierunek „Nori") ════════════════════════════════════════════════
   Jedno źródło prawdy dla kolorów/promieni/cieni. Nowe i migrowane widoki używają
   var(--token) zamiast hardkodowanych hexów. Ciemny motyw jest opt-in — aktywny
   TYLKO gdy <html data-theme="dark">; żywa strona pozostaje jasna aż świadomie
   włączymy przełącznik (patrz plan migracji). Nie podąża jeszcze za systemem. */
:root {
    /* Neutralne (lekko przesunięte ku fioletowi — „wybrane, nie odziedziczone") */
    --paper:    #ffffff;
    --paper-2:  #f6f5fb;
    --paper-3:  #efedf7;
    --ink:      #17152b;
    --ink-soft: #565073;
    --ink-mut:  #8b86a3;
    --line:     #e9e6f3;

    /* Marka: fiolet = jedyny akcent; nori = motyw/wzrost/sukces */
    --brand:      #6d28d9;
    --brand-tint: #f1ecfe;
    --nori:       #0f766e;
    --nori-tint:  #e2f4f1;
    --gold:       #f59e0b;

    /* Semantyczne */
    --ok:     #16a34a;
    --warn:   #d97706;
    --danger: #dc2626;

    /* Kształt / cień */
    --radius:      15px;
    --radius-sm:   10px;
    --radius-pill: 999px;
    --shadow:      0 1px 2px rgba(23,21,43,.04), 0 8px 24px -12px rgba(23,21,43,.14);
    --shadow-lift: 0 12px 34px -14px rgba(109,40,217,.34);

    /* Taksonomia przedmiotów — 12 hue'ów; locale.js mapuje przedmiot → nazwę hue */
    --subj-blue:   #2563eb;
    --subj-rose:   #e11d48;
    --subj-violet: #7c3aed;   /* NIE marka - hue przedmiotu; ten sam hex to zbieg okolicznosci */
    --subj-amber:  #d97706;
    --subj-green:  #16a34a;
    --subj-teal:   #0d9488;
    --subj-indigo: #4f46e5;
    --subj-cyan:   #0891b2;
    --subj-lime:   #65a30d;
    --subj-slate:  #475569;
    --subj-orange: #ea580c;
    --subj-pink:   #db2777;
}

:root[data-theme="dark"] {
    --paper:    #141221;
    --paper-2:  #1b1830;
    --paper-3:  #241f3b;
    --ink:      #f4f2fb;
    --ink-soft: #c3bdd8;
    --ink-mut:  #8f89a8;
    --line:     #2c2745;

    --brand:      #a78bfa;
    --brand-tint: #251b40;
    --nori:       #5eead4;
    --nori-tint:  #173430;
    --gold:       #fbbf24;

    --ok:     #4ade80;
    --warn:   #fbbf24;
    --danger: #f87171;

    --shadow:      0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    --shadow-lift: 0 14px 40px -14px rgba(139,92,246,.5);

    --subj-blue:   #60a5fa;
    --subj-rose:   #fb7185;
    --subj-violet: #a78bfa;
    --subj-amber:  #fbbf24;
    --subj-green:  #4ade80;
    --subj-teal:   #2dd4bf;
    --subj-indigo: #818cf8;
    --subj-cyan:   #22d3ee;
    --subj-lime:   #a3e635;
    --subj-slate:  #94a3b8;
    --subj-orange: #fb923c;
    --subj-pink:   #f472b6;
}

/* ─── Czcionka ─────────────────────────────────────────────────────────────── */
:root {
    font-size: 17px; /* 1rem = 17px; zmień tę wartość żeby skalować całą typografię */
}

body {
    font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--paper-2);
    color: var(--ink);
}

/* ─── Navbar ────────────────────────────────────────────────────────────────── */
.navbar-brand {
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

/* ─── Hero gradient ─────────────────────────────────────────────────────────── */
.hero-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.hero-gradient-green {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
}

.hero-gradient-orange {
    background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
    color: #1a1a2e;
}

/* ─── Karty kategorii ───────────────────────────────────────────────────────── */
.category-card {
    border: none;
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12) !important;
    color: inherit;
}

.category-card .card-icon {
    font-size: 2.4rem;
    line-height: 1;
}

/* ─── Sekcja statystyk ──────────────────────────────────────────────────────── */
.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

/* ─── Search bar ────────────────────────────────────────────────────────────── */
.search-hero input {
    border-radius: 50px 0 0 50px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border: none;
    box-shadow: none;
}

.search-hero input:focus {
    box-shadow: none;
    outline: none;
}

.search-hero button {
    border-radius: 0 50px 50px 0;
    padding: 0.75rem 1.75rem;
}

/* ─── Karty treści ──────────────────────────────────────────────────────────── */
.content-card {
    border: none;
    border-radius: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.content-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09) !important;
}

/* ─── Styl Wersja 4 (Glassmorphism & Hover) ─────────────────────────────────── */
.backdrop-blur {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.hover-lift {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    text-decoration: none;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1) !important;
}

.text-purple {
    color: #8b5cf6 !important;
}

.bg-purple {
    background-color: #8b5cf6 !important;
}

/* ─── Badge poziomów ────────────────────────────────────────────────────────── */
.badge-level {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3em 0.7em;
    border-radius: 20px;
}

/* ─── Styl Wersja 5 (Edu Inspiracja) ────────────────────────────────────────── */
.bg-dark-purple {
    background-color: #100b2c !important;
}

.bg-dark-purple-light {
    border: 1px solid rgba(255, 255, 255, 0.05);
    background-color: #1a153a !important;
}

.text-violet {
    color: var(--brand) !important;
}

.bg-violet {
    background-color: var(--brand) !important;
    color: #fff;
}

.btn-violet {
    background-color: var(--brand);
    color: #fff;
    border: none;
    transition: background-color .15s ease, transform .1s ease, box-shadow .15s ease;
}

.btn-violet:hover {
    background-color: #7c3aed;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lift);
}

.btn-violet:active {
    background-color: var(--brand);
    color: #fff;
    transform: translateY(0);
}

.btn-outline-violet {
    border: 1.5px solid var(--brand);
    color: var(--brand);
    background: transparent;
    transition: background-color .15s ease, transform .1s ease, color .15s ease;
}

.btn-outline-violet:hover {
    background-color: var(--brand-tint);
    color: var(--brand);
    border-color: var(--brand) !important;
    transform: translateY(-1px);
}

.btn-outline-violet:active {
    transform: translateY(0);
}

.rounded-xl {
    border-radius: 1.25rem !important;
}

.rounded-4-top {
    border-radius: 1rem 1rem 0 0 !important;
}

.card-image-placeholder {
    aspect-ratio: 16 / 9;
    height: auto;
    background: var(--paper-3);
    object-fit: cover;
    width: 100%;
}
.card-image-placeholder-a4 {
    aspect-ratio: 595 / 842;
    height: auto;
    background: var(--paper-3);
    object-fit: cover;
    width: 100%;
}

.section-icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: color-mix(in srgb, var(--brand) 10%, transparent);
    border-radius: 8px;
}

.newsletter-box {
    background-color: #100b2c;
    border-radius: 1.5rem;
}

/* ─── Custom Navbar ─────────────────────────────────────────────────────────── */
.navbar-dark-custom {
    background-color: var(--paper) !important;
    border-bottom: 1px solid var(--line);
}

.navbar-dark-custom .nav-link {
    color: var(--ink-soft) !important;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.navbar-dark-custom .nav-link:hover {
    color: var(--brand) !important;
    background-color: var(--brand-tint);
}

.navbar-dark-custom .nav-link.active {
    color: var(--brand) !important;
    background-color: var(--brand-tint);
}

.navbar-logo-text {
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--brand) !important;
}

.navbar-dark-custom .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2876%2C 29%2C 149%2C 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.search-input-dark {
    background-color: var(--paper-2) !important;
    border: 1px solid var(--line) !important;
    color: var(--ink) !important;
}

.search-input-dark::placeholder {
    color: var(--ink-mut);
}

/* Szukajka w navbarze (styl z makiety — pigułka) */
.nav-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--paper-2); border: 1px solid var(--line);
    border-radius: 999px; padding: 7px 14px; min-width: 200px;
}
.nav-search i { color: var(--ink-mut); font-size: .9rem; }
.nav-search input {
    border: 0; background: transparent; outline: none; padding: 0;
    font-size: .82rem; color: var(--ink); width: 100%;
}
.nav-search input::placeholder { color: var(--ink-mut); }

/* ─── Sekcja CTA ────────────────────────────────────────────────────────────── */
.cta-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ─── Chipy poziomów edukacyjnych ───────────────────────────────────────────── */
.level-chip {
    display: inline-block;
    padding: .2rem .7rem;
    font-size: .8rem;
    border: 1px solid transparent;
    border-radius: 100px;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}

.level-chip-amber {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}
.level-chip-amber:hover {
    background: #ffedd5;
    border-color: #fb923c;
    color: #7c2d12;
}

.level-chip-blue {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}
.level-chip-blue:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e3a8a;
}

.level-chip-violet {
    background: #f5f3ff;
    border-color: #ddd6fe;
    color: #6d28d9;
}
.level-chip-violet:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #4c1d95;
}

/* ─── Scroll z ukrytym scrollbarem ─────────────────────────────────────────── */
.scroll-x {
    overflow-x: auto;
    scrollbar-width: none;
}

.scroll-x::-webkit-scrollbar {
    display: none;
}

/* ─── Animacja wejścia ──────────────────────────────────────────────────────── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-up {
    animation: fadeUp 0.5s ease both;
}

.fade-up-1 {
    animation-delay: 0.1s;
}

.fade-up-2 {
    animation-delay: 0.2s;
}

.fade-up-3 {
    animation-delay: 0.3s;
}

.fade-up-4 {
    animation-delay: 0.4s;
}

/* ─── Tekst ──────────────────────────────────────────────────────────────── */
.text-light-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

.text-light-70 {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* ── Level Badge (ikona + liczba) ────────────────────────────────── */
.lvl-badge {
    display: inline-flex;
    align-items: center;
    gap: 0;
    font-size: .8rem;
    cursor: default;
    user-select: none;
    flex-shrink: 0;
    white-space: nowrap;
}
.lvl-badge .bi {
    font-size: .9em;
    line-height: 1;
}
.lvl-num {
    font-weight: 800;
    line-height: 1;
    font-size: .9em; /* w lvl-badge; nadpisane dla lvl-ring poniżej */
}
.lvl-ring .lvl-num {
    font-size: 1rem;
}
.lvl-badge.lvl-badge-sm {
    font-size: .7rem;
}
.lvl-badge.lvl-badge-lg {
    font-size: 1.25rem;
    gap: 4px;
}

/* ─── Combined level ring (P2) — wyświetlany tylko na profilu ───────────────── */
.lvl-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3.5px solid currentColor;
    font-weight: 800;
    font-size: 1rem;
    line-height: 1;
    background: #fff;
    flex-shrink: 0;
    cursor: default;
}

/* ─── Pasek poziomów (homepage) ─────────────────────────────────────────────── */
.level-nav-strip {
    background: #f8f7ff;
    border-top: 1px solid #ede9fe;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
    padding: .75rem 0;
}

.level-nav-label {
    font-size: .78rem;
    font-weight: 700;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
}

.level-chip-nav {
    padding: 8px 15px;
    font-size: .82rem;
    font-weight: 700;
    border-radius: 12px;
    border: 1.5px solid var(--line);
    background: var(--paper);
    color: var(--ink-soft);
}
.level-chip-nav:hover {
    border-color: var(--brand);
    color: var(--brand);
    transform: translateY(-1px);
}
.level-chip-nav.level-chip-amber  { border-color: #fcd9a8; color: #b45309; background: #fffbf3; }
.level-chip-nav.level-chip-violet { border-color: #d9c9fb; color: var(--brand); background: var(--brand-tint); }

/* ─── Duolingo-style visual layer ───────────────────────────────────────────── */

/* Nagłówki — mocne, ale nie „krzyczące" (Nunito 800), kolor z tokenu */
h1, h2, h3, h4,
h1.fw-bold, h2.fw-bold, h3.fw-bold, h4.fw-bold,
h1.fw-semibold, h2.fw-semibold, h3.fw-semibold, h4.fw-semibold { font-weight: 800 !important; color: var(--ink); }

/* Heavier button text */
.btn { font-weight: 700; }

/* Karty (Nori): płaskie, hairline border + delikatny cień, hover-lift ku marce */
.card {
    background-color: var(--paper);
    color: var(--ink);
}

.card.border-0 {
    border: 1px solid var(--line) !important;
    border-radius: var(--radius);
    box-shadow: var(--shadow) !important;
    transition: box-shadow 0.16s ease, transform 0.13s ease, border-color 0.16s ease;
}

.card.border-0:hover {
    border-color: color-mix(in srgb, var(--brand) 40%, var(--line)) !important;
    box-shadow: var(--shadow-lift) !important;
    transform: translateY(-3px);
}

/* Form controls: more rounded corners; no !important so Bootstrap's
   input-group radius rules (which use !important) still win for search bars */
.form-control,
.form-select {
    border-radius: 12px;
}

/* Modals: softer, more rounded */
.modal-content {
    border-radius: 20px !important;
    overflow: hidden;
}

/* ─── Icon circles (section headers, Duolingo-style) ───────────────────────── */
.icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.icon-circle-sm {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
}

/* ── Comments (shared) ──────────────────────────────────────────────── */
.comments-empty { text-align: center; padding: 2rem 0 .5rem; color: #94a3b8; }
.comments-empty-icon { font-size: 2.4rem; display: block; margin-bottom: .75rem; opacity: .25; }
.comment-form textarea { border-radius: 12px; border-color: #e2e8f0; font-size: .9rem; resize: none; }
.comment-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent); outline: none; }
.notice-login { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--brand) 5%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 15%, transparent); border-radius: 10px; padding: .8rem 1rem; margin-top: 1rem; font-size: .85rem; color: #4b5563; }
.notice-login i { color: var(--brand); }
.notice-login a { color: var(--brand); font-weight: 600; }

.comments-card { background: #fff; border-radius: 22px; box-shadow: 0 6px 32px rgba(0,0,0,.09); overflow: hidden; }
.comment-mini-form textarea { border-radius: 12px; border-color: #e2e8f0; font-size: .9rem; resize: none; }
.comment-mini-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent); outline: none; }
.comment-charcount { font-size: .75rem; }

.comment-thread { padding: 1rem 0; border-bottom: 1px solid #f1f5f9; }
.comment-thread:last-child { border-bottom: 0; }
.comment { display: flex; gap: 12px; align-items: flex-start; }
.comment-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-avatar--deleted { background: #e2e8f0; }
.comment-main { flex-grow: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.comment-author { font-weight: 600; color: #1e293b; text-decoration: none; font-size: .9rem; }
.comment-author:hover { color: var(--brand); }
.comment-meta { font-size: .75rem; color: #94a3b8; }
.comment-body { margin: .25rem 0 .35rem; font-size: .92rem; color: #334155; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.comment-mention { color: var(--brand); font-weight: 600; }
.comment-deleted { font-style: italic; color: #94a3b8; font-size: .88rem; }
.comment-actions { display: flex; gap: 14px; }
.comment-act { background: none; border: 0; padding: 0; font-size: .78rem; font-weight: 600; color: #64748b; cursor: pointer; }
.comment-act:hover { color: var(--brand); }
.comment-act--danger:hover { color: #dc2626; }
.comment-act--report { color: #94a3b8; }
.comment-act--report:hover { color: #dc2626; }
.report-link { background: none; border: 0; padding: 0; font-size: .8rem; font-weight: 600; color: #94a3b8; cursor: pointer; line-height: 1; }
.report-link:hover { color: #dc2626; }

/* Dzwonek powiadomień */
.notif-toggle { color: #475569; border: 0; }
.notif-toggle:hover, .notif-toggle:focus { color: var(--brand); }
.notif-toggle .notif-badge { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; font-size: .58rem; font-weight: 700; line-height: 16px; text-align: center; }
.notif-menu { width: 360px; max-width: 92vw; }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; padding: .7rem 1rem; border-bottom: 1px solid #f1f5f9; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: #f8fafc; }
.notif-item--unread { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.notif-item--unread:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.notif-ic { flex: none; font-size: 1.1rem; width: 24px; text-align: center; padding-top: 1px; }
.notif-body { flex: 1 1 auto; min-width: 0; }
.notif-text { display: block; font-size: .85rem; color: #1e293b; line-height: 1.3; text-decoration: none; }
a.notif-text:hover { color: var(--brand); text-decoration: underline; }
.notif-time { font-size: .72rem; color: #94a3b8; margin-top: 2px; }
.notif-actions { display: flex; flex-direction: column; gap: 4px; flex: none; }
.notif-act { background: none; border: 0; padding: 3px; font-size: .8rem; line-height: 1; color: #cbd5e1; cursor: pointer; border-radius: 6px; }
.notif-act:hover { background: #eef2f7; }
.notif-read:hover { color: #10b981; }
.notif-loading-more { text-align: center; padding: .8rem 0; }
.comment-slot:not(:empty) { margin-top: .6rem; }
.comment-replies { margin: .5rem 0 0 52px; display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 575.98px) { .comment-replies { margin-left: 24px; } }

/* ─── Tag Input (shared) ────────────────────────────────────────────────────── */
.tags-input-wrapper {
    border: 1px solid #e2e8f0; border-radius: 12px;
    padding: .45rem .75rem; display: flex; flex-wrap: wrap; gap: .35rem;
    min-height: 48px; cursor: text; background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.tags-input-wrapper:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent); }
.tag-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand);
    border-radius: 7px; padding: 3px 10px;
    font-size: .85rem; font-weight: 600;
}
.tag-chip button { background: none; border: none; cursor: pointer; color: var(--brand); padding: 0 0 0 2px; font-size: 1rem; line-height: 1; }
.tag-chip button:hover { color: #ef4444; }
.tags-input-field { border: none; outline: none; flex: 1; min-width: 140px; font-size: .95rem; padding: 3px 4px; background: transparent; }

/* ─── Content info section — wspólny dla quiz/fiszki/kursy/pdf ──────────────── */
.content-stat-item {
    display: flex; align-items: center; gap: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 9px 15px; font-size: .88rem;
}
.content-stat-item i { font-size: 1.1rem; flex-shrink: 0; }

/* ─── Star rating widget ─────────────────────────────────────────────────────── */
.star-rating { display: flex; gap: 4px; }
.star-btn { background: none; border: none; padding: 0; cursor: pointer; font-size: 1.6rem; color: #d1d5db; line-height: 1; transition: color .1s, transform .1s; }
.star-btn:hover, .star-btn.active { color: #f59e0b; }
.star-btn:hover { transform: scale(1.15); }
.rating-avg { font-size: 2rem; font-weight: 800; color: var(--ink); line-height: 1; }
.rating-count { font-size: .8rem; color: var(--ink-mut); }

/* ═══ Komponenty „Nori" ═══════════════════════════════════════════════════════ */

/* Kolorowy tag przedmiotu (w treści karty) — kolor ustawiany inline: var(--subj-*) */
.subj-tag {
    font-size: .68rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
}

/* ─── Lista treści pod materiałem (views/partials/content-list.pug) ───────────
   `content-visibility: auto` na wierszu sprawia, że przeglądarka pomija layout
   i malowanie pozycji poza ekranem, a wiersz NIE jest ukryty: zostaje w normalnym
   flow, w drzewie dostępności i pod Ctrl+F. To jest cała różnica względem
   `display:none`, którym ta treść była wcześniej schowana.
   `contain-intrinsic-size: auto 64px` daje wstępne oszacowanie wysokości, żeby
   pasek przewijania nie skakał; słowo `auto` sprawia, że po pierwszym pomiarze
   przeglądarka pamięta rzeczywistą wysokość. */
.content-list {
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--paper); overflow: hidden;
}
.content-list-summary {
    cursor: pointer; padding: .85rem 1.1rem;
    font-weight: 700; color: var(--ink); font-size: .95rem;
    display: flex; align-items: center;
    list-style: none;
}
.content-list-summary::-webkit-details-marker { display: none; }
.content-list-summary::after {
    content: "\F282"; font-family: "bootstrap-icons"; font-weight: 400;
    margin-left: auto; color: var(--ink-mut); transition: transform .15s ease;
}
.content-list[open] > .content-list-summary::after { transform: rotate(180deg); }
.content-list-summary:hover { background: var(--paper-2); }
.content-list-count { font-weight: 400; color: var(--ink-mut); }

.content-list-dl { margin: 0; padding: 0 1.1rem; }
.content-list-row {
    content-visibility: auto;
    contain-intrinsic-size: auto 64px;
    display: grid; grid-template-columns: 38% minmax(0, 1fr); gap: 1rem;
    padding: .7rem 0; border-top: 1px solid var(--line);
}
/* pre-line honoruje Entery autora, ale zwija przypadkowe podwójne spacje.
   Dzięki temu nowe linie nie potrzebują <br> (mniej węzłów DOM). */
.content-list-term { font-weight: 600; color: var(--ink); margin: 0; white-space: pre-line; }
.content-list-def  { margin: 0; color: var(--ink-soft); white-space: pre-line; }
/* Tekst jest już pogrubiony jako całość - <strong> musi wyróżniać się mocniej */
.content-list-term strong { font-weight: 800; color: var(--brand); }
.content-list-hint { display: block; font-weight: 400; font-size: .8rem; color: var(--ink-mut); margin-top: .15rem; }
.content-list-extra { margin: .3rem 0 0; font-size: .82rem; color: var(--ink-mut); line-height: 1.5; }
/* Miniatura dla karty bez tekstu. Mała celowo - spis treści, nie galeria. */
.content-list-thumb {
    max-height: 48px; max-width: 100%; width: auto;
    border-radius: 6px; border: 1px solid var(--line); display: block;
}
.content-list-more { margin: .8rem 1.1rem 1rem; font-size: .82rem; color: var(--ink-mut); }

@media (max-width: 575.98px) {
    .content-list-row { grid-template-columns: 1fr; gap: .2rem; }
}

/* Pola tekstowe fiszki. `field-sizing: content` to natywne dopasowanie wysokości
   do treści, bez JS - gdzie silnik go nie zna, wysokość liczy public/js/card-textarea.js.
   min-height trzyma dwa wiersze, żeby puste pole nie było paskiem. */
.card-textarea {
    field-sizing: content;
    min-height: calc(2lh + .9rem);
    max-height: 60vh;
    resize: vertical;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ─── Podgląd pogrubienia w formularzu fiszki ──────────────────────────────────
   `<textarea>` z definicji nie potrafi pokazać formatowania w środku, więc podgląd
   to osobny element LEŻĄCY NA polu. Cały przełącznik trybów robi CSS, bez ani jednej
   linii JS-a od widoczności:

   - `pointer-events: none` sprawia, że klik przechodzi PRZEZ podgląd do textarea,
     więc pole łapie focus normalnie i nie trzeba przechwytywać kliknięć;
   - `:focus-within` chowa podgląd w momencie wejścia w pole (myszką ORAZ Tabem),
     czyli w trybie edycji widać gwiazdki;
   - `:placeholder-shown ~` chowa podgląd, gdy pole jest puste - inaczej zasłaniałby
     placeholder pustym prostokątem.

   Podgląd nosi te same klasy `.form-control.form-control-sm` co pole, więc padding,
   font i obramowanie są IDENTYCZNE z definicji - podmiana nie przeskakuje.
   Textarea zostaje w DOM i nie jest disabled, więc formularz wysyła wartość,
   a czytniki ekranu widzą prawdziwe pole (podgląd ma aria-hidden). */
.card-field { position: relative; }
.card-preview {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    white-space: pre-line;
    background: var(--paper);
    color: var(--ink);
}
.card-field:focus-within .card-preview,
.card-textarea:placeholder-shown ~ .card-preview { display: none; }
.card-preview strong { font-weight: 800; color: var(--brand); }

/* Okładka: fallback-gradient w kolorze przedmiotu, gdy brak cover URL */
.cover-fallback {
    --sc: var(--brand);
    aspect-ratio: 16 / 9; width: 100%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--sc), color-mix(in srgb, var(--sc) 60%, #000));
}
.cover-fallback.cover-a4 { aspect-ratio: 595 / 842; }
.cover-fallback i { font-size: 2.4rem; color: #fff; opacity: .92; }

/* Plakietki na okładce (poziom / liczba) */
.cover-pills {
    position: absolute; top: 9px; left: 9px; right: 9px;
    display: flex; gap: 5px; flex-wrap: wrap; pointer-events: none;
}
.cover-pill {
    font-size: .66rem; font-weight: 800; padding: 3px 8px; border-radius: 999px;
    background: rgba(255,255,255,.92); color: #333;
}
.cover-pill.lvl { background: rgba(23,21,43,.62); color: #fff; }

/* Nagłówki sekcji */
.sec-eyebrow {
    font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--brand);
}

/* Siatka przedmiotów (strona główna) — pills o szerokości treści, zawijane */
.subj-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.subj-tile {
    display: inline-flex; align-items: center; gap: 10px; padding: 9px 16px 9px 10px; border-radius: 999px;
    background: var(--paper); border: 1px solid var(--line); color: var(--ink);
    font-weight: 700; font-size: .9rem; text-decoration: none; white-space: nowrap;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.subj-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.subj-dot {
    width: 30px; height: 30px; border-radius: 9px; flex: none;
    display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .85rem;
}
.subj-hero-dot {
    width: 46px; height: 46px; border-radius: 13px; flex: none;
    display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1rem; text-transform: uppercase;
    margin-top: 9px; /* optyczne wyrównanie z nadtytułem (blok tekstu jest align-items-start) */
}

/* Hero (strona główna) */
.nori-hero {
    position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 26px;
    background: radial-gradient(120% 140% at 88% -10%, var(--brand-tint) 0%, transparent 55%), var(--paper);
}
.nori-hero-in { padding: 46px 40px 30px; }
.pill-live {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--nori-tint); color: var(--nori); font-weight: 700; font-size: .76rem;
    padding: 5px 13px; border-radius: 999px;
}
/* Wariant awaryjny: ten sam pill informuje o niedziałających sesjach.
   Czerwień stonowana, nie alarmowa - materiały działają, nie działa tylko logowanie. */
.pill-live-down {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
}
/* Zmierzone osobno na telefonie i na dużym ekranie, ale media query nie jest potrzebne:
   to są po prostu dwa końce jednego clamp(). Przy :root 17px minimum 2.4rem obowiązuje
   do ~927px szerokości (poniżej tego 4.4vw jest mniejsze), a maksimum 2.9rem od ~1120px.
   Środek jest płynny. Nagłówek jest teraz dwuzdaniowy, więc jeśli coś ma się rozjechać,
   to tuż nad progiem lg (992-1120px) - tam kolumna zwęża się do połowy, a font jest
   jeszcze blisko maksimum. */
.hero-headline { font-size: clamp(2.4rem, 4.4vw, 2.9rem); line-height: 1.12; margin: 18px 0 14px; }
.hero-headline em { font-style: normal; color: var(--brand); }
/* USUNIĘTO pasek-zakreślacz (em::after). Nie działał w żadną stronę: na dużym ekranie
   z-index:-1 chował go ZA tłem .nori-hero (rodzic ma position:relative i własny gradient,
   więc tworzy kontekst układania), a na małym <em> łamał się na dwie linie i element
   absolutny rozciągał się na cały prostokąt obejmujący obie - rysując pasek w poprzek.
   Efekt zakreślacza, gdyby wrócił, robi się gradientem na samym <em>, nie pseudoelementem:
     background: linear-gradient(transparent 60%, var(--brand-tint) 0);
     box-decoration-break: clone;              (żeby powtórzył się w każdej linii) */
.hero-metric .n { font-weight: 800; font-size: 1.4rem; color: var(--ink); line-height: 1; }
.hero-metric .l { font-size: .74rem; color: var(--ink-mut); }
.hero-wave { display: block; width: 100%; height: 40px; margin-top: 6px; }

/* Puste stany */
.empty-nori {
    text-align: center; padding: 40px 20px;
    border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--paper);
}
.empty-nori .leaf { width: 66px; height: 66px; margin: 0 auto 12px; display: block; }

/* Paginacja (Nori) */
.pagination { gap: 6px; }
.page-link {
    border: 1px solid var(--line); border-radius: 10px !important;
    color: var(--ink-soft); font-weight: 700; background: var(--paper); min-width: 38px; text-align: center;
}
.page-link:hover { border-color: var(--brand); color: var(--brand); background: var(--paper); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-item.disabled .page-link { opacity: .5; }

/* Drobne token-owe poprawki istniejących elementów */
.content-stat-item { background: var(--paper-2); border-color: var(--line); }
.level-nav-strip { background: var(--paper); border-top-color: var(--line); }
.section-icon-box { background: var(--brand-tint); }

/* Sekcja „Wyróżnione" (spotlight) */
.spotlight {
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 26px 26px 30px;
    background: radial-gradient(130% 130% at 0% 0%, var(--nori-tint), transparent 55%), var(--paper);
}

/* Pierścień poziomu wokół avatara (profil) */
.lvl-ring-wrap { position: relative; width: 104px; height: 104px; flex-shrink: 0; }
.lvl-ring-svg { position: absolute; inset: 0; display: block; }
.lvl-ring-track { stroke: var(--line); stroke-width: 6; }
.lvl-ring-arc { stroke: var(--brand); stroke-width: 6; stroke-dashoffset: var(--doff); }
/* JS on: pierścień startuje pusty i czeka na pełne załadowanie strony (klasa .ring-animate dodawana na window load) */
.js .lvl-ring-arc { stroke-dashoffset: var(--dc); }
.js .lvl-ring-wrap.ring-animate .lvl-ring-arc { animation: lvlRingFill 1s cubic-bezier(.45, .05, .2, 1) forwards; }
@keyframes lvlRingFill { from { stroke-dashoffset: var(--dc); } to { stroke-dashoffset: var(--doff); } }
.lvl-ring-photo { position: absolute; inset: 15px; border-radius: 50%; overflow: hidden; background: var(--paper-3); }
.lvl-ring-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lvl-ring-pin {
    position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%);
    min-width: 28px; height: 25px; padding: 0 10px; border-radius: 999px;
    background: var(--brand); color: #fff; font-weight: 800; font-size: .78rem; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    border: 3px solid var(--paper);
}
@media (prefers-reduced-motion: reduce) {
    .js .lvl-ring-arc { stroke-dashoffset: var(--doff); }
    .js .lvl-ring-wrap.ring-animate .lvl-ring-arc { animation: none; }
}


/* ─── Odznaki (enamel-pin: wypukła emalia, kolor = ranga) ────────────────────── */
.profile-head { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.badge-medal {
    width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 15px;
    flex: none;
    background: var(--bm);
    box-shadow: inset 0 1.5px 2px rgba(255,255,255,.35), inset 0 -1px 2px rgba(0,0,0,.2), inset 0 0 0 1px rgba(0,0,0,.09), 0 3px 8px -5px rgba(23,21,43,.4);
}
.badge-medal .bi { filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }

/* Odznaki na profilu: zwinięte = same ikony, rozwinięte = chip z paskiem postępu */
.badge-list { display: flex; flex-wrap: wrap; gap: 3px; }
.badge-list .chip { display: flex; align-items: center; gap: 10px; }
.badge-list .chip .tx { display: none; }
.badge-list.expanded { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.badge-list.expanded .chip { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 8px 12px 8px 8px; }
.badge-list.expanded .chip .tx { display: block; flex: 1; min-width: 0; }
.badge-list .chip .tx b { font-size: .82rem; display: block; line-height: 1.2; }
.badge-list .bar { height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--ink-mut) 20%, transparent); margin-top: 5px; overflow: hidden; }
.badge-list .bar i { display: block; height: 100%; border-radius: 999px; }
.badge-list .nx { font-size: .6rem; color: var(--ink-mut); margin-top: 3px; font-weight: 700; }

/* Menu konta ma kilkanaście pozycji, a dropdown Bootstrapa nie przewija się sam.
   Na niskim ekranie (telefon w poziomie, mały laptop) ostatnie pozycje - w tym
   „Wyloguj" i „Panel admina" - lądowały pod krawędzią i były nieosiągalne. */
.nav-account-menu { max-height: calc(100vh - 90px); overflow-y: auto; }

/* Poniżej lg wyszukiwarka zwija się do samej ikony prowadzącej na /szukaj.
   Rozmiar dopasowany do dzwonka obok, żeby pasek nie wyglądał na poszarpany. */
.nav-search-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 999px;
    color: var(--ink-soft); text-decoration: none;
}
.nav-search-link:hover { background: var(--paper-2); color: var(--brand); }

/* LinkedIn nie ma odpowiednika w palecie semantycznej Bootstrapa, a btn-outline-primary
   jest już zajęty przez Microsoft - dwa identyczne niebieskie przyciski obok siebie
   nie dałyby się rozróżnić inaczej niż po ikonie. Kolor to marka LinkedIna (#0A66C2). */
.btn-outline-linkedin {
    border: 1px solid #0a66c2; color: #0a66c2; background: transparent;
}
.btn-outline-linkedin:hover, .btn-outline-linkedin:focus {
    background: #0a66c2; color: #fff; border-color: #0a66c2;
}
