/* ==========================================================================
   1. BAZOWE STYLE PORTALU I WCAG 2.1
   ========================================================================== */
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition: background 0.2s, color 0.2s;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 15px;
    box-sizing: border-box;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 12px;
    z-index: 10000;
    padding: 12px 16px;
    background: #fff;
    color: #111827;
    border: 3px solid #1d4ed8;
    border-radius: 8px;
    font-weight: bold;
}
.skip-link:focus { top: 12px; }

.home-hero {
    position: relative;
    overflow: hidden;
    text-align: center;
    background:
        radial-gradient(circle at 88% 18%, rgba(255,255,255,0.16) 0 70px, transparent 71px),
        radial-gradient(circle at 8% 100%, rgba(45,212,191,0.2) 0 110px, transparent 111px),
        linear-gradient(120deg, #123b68, #176b87 58%, #1b7a77);
    color: white;
    padding: 48px 24px;
    border-radius: 24px;
    margin: 20px 0;
    box-shadow: 0 14px 32px rgba(15, 54, 80, 0.16);
}
.home-hero-eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    color: #d7f7f0;
    font-size: 0.82em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.home-hero h1 { margin: 0; font-size: 2.45em; font-weight: 800; letter-spacing: -0.025em; }
.home-hero p { max-width: 720px; margin: 12px auto 0; font-size: 1.12em; color: #f0fdfa; }
.domain-notice {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    margin: 0 0 32px;
    border: 1px solid #bfdbfe;
    border-left: 6px solid #147d78;
    border-radius: 14px;
    background: linear-gradient(110deg, #eff8ff, #f0fdfa);
    color: #16334d;
    font-size: 1.05em;
    box-shadow: 0 5px 16px rgba(24, 58, 84, 0.06);
}
.domain-notice-icon {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50%;
    background: #d1fae5;
    color: #08665e;
    font-size: 1.45em;
    font-weight: 800;
}
.domain-notice p { margin: 4px 0 0; color: #3b5368; }
.domain-notice a { color: #075985; font-weight: 800; text-underline-offset: 3px; }
.site-footer {
    margin-top: 50px;
    text-align: center;
    color: #475569;
    font-size: 0.95em;
    padding: 20px 15px;
    border-top: 2px solid #cbd5e1;
}
.site-footer > p { margin: 0 0 12px; }
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px 22px;
}
.footer-links a,
.footer-cookie-settings {
    color: #174b72;
    font-weight: 700;
    text-underline-offset: 3px;
}
.footer-cookie-settings {
    padding: 6px 10px;
    border: 1px solid #9aafbf;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.legal-hero {
    margin: 20px 0 24px;
    padding: 32px;
    border-radius: 20px;
    background: linear-gradient(120deg, #123b68, #176b87 58%, #1b7a77);
    color: #fff;
    box-shadow: 0 10px 26px rgba(15, 54, 80, 0.14);
}
.legal-hero h1 {
    margin: 0;
    color: #fff;
    font-size: 2em;
    line-height: 1.25;
}
.legal-hero > p:not(.home-hero-eyebrow) { max-width: 760px; margin: 10px 0 0; color: #f0fdfa; }
.legal-hero .home-hero-eyebrow { color: #d7f7f0; }
.legal-hero .legal-updated { font-size: 0.85em; }
.legal-layout {
    display: grid;
    grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.legal-toc {
    position: sticky;
    top: 16px;
    padding: 20px;
    border: 1px solid #d5e0e8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(21, 48, 69, 0.06);
}
.legal-toc h2 { margin: 0 0 12px; font-size: 1.1em; }
.legal-toc ol { margin: 0; padding-left: 1.4em; }
.legal-toc li { margin: 8px 0; padding-left: 2px; }
.legal-toc a,
.legal-content a { color: #075985; text-underline-offset: 3px; }
.legal-doc-links {
    display: grid;
    gap: 9px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #d5e0e8;
}
.legal-toc a { font-weight: 600; }
.legal-content { min-width: 0; }
.legal-content section { scroll-margin-top: 18px; }
.legal-content .exercise-card { padding: 26px; }
.legal-content h2 { margin-top: 0; color: #18344b; }
.legal-content h3 { margin-bottom: 8px; color: #23435a; font-size: 1.1em; }
.legal-content li { margin-bottom: 8px; }
.legal-address { margin: 14px 0; font-style: normal; line-height: 1.8; }
body.theme-high-contrast .legal-toc,
body.theme-high-contrast .legal-content .exercise-card {
    background: #000 !important;
    color: #ff0 !important;
    border-color: #ff0 !important;
}
body.theme-high-contrast .legal-toc a,
body.theme-high-contrast .legal-content a,
body.theme-high-contrast .legal-content h2,
body.theme-high-contrast .legal-content h3,
body.theme-high-contrast .footer-links a,
body.theme-high-contrast .footer-cookie-settings { color: #ff0 !important; }
body.theme-high-contrast .legal-doc-links { border-color: #ff0; }

.cookie-banner[hidden],
.cookie-settings-panel[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    z-index: 10001;
    right: 20px;
    bottom: 20px;
    left: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px 24px;
    max-width: 1120px;
    max-height: min(80vh, 720px);
    overflow: auto;
    margin: 0 auto;
    padding: 22px;
    border: 2px solid #52758e;
    border-radius: 18px;
    background: #fff;
    color: #1c3447;
    box-shadow: 0 12px 40px rgba(10, 28, 42, 0.28);
}
.cookie-banner h2,
.cookie-settings-panel h3 { margin: 0 0 8px; color: #18344b; font-size: 1.15em; }
.cookie-banner p { margin: 6px 0 10px; font-size: 0.88em; line-height: 1.55; }
.cookie-banner-copy a { color: #075985; font-weight: 700; text-underline-offset: 3px; }
.cookie-banner-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 9px;
    min-width: 210px;
}
.cookie-banner-actions button,
.cookie-settings-panel button { width: 100%; margin: 0; }
.cookie-manage-button {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #9aafbf;
    border-radius: 10px;
    background: #f7fafc;
    color: #23435a;
    font: inherit;
    font-size: 0.88em;
    font-weight: 700;
    cursor: pointer;
}
.cookie-settings-panel {
    grid-column: 1 / -1;
    padding-top: 16px;
    border-top: 1px solid #cbd8e2;
}
.cookie-toggle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 12px 0;
    padding: 12px;
    border: 1px solid #cbd8e2;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 0.9em;
}
.cookie-toggle input { flex: 0 0 auto; width: 22px; height: 22px; margin: 2px 0 0; }
body.theme-high-contrast .cookie-banner,
body.theme-high-contrast .cookie-settings-panel,
body.theme-high-contrast .cookie-toggle {
    background: #000 !important;
    color: #ff0 !important;
    border-color: #ff0 !important;
}
body.theme-high-contrast .cookie-banner h2,
body.theme-high-contrast .cookie-settings-panel h3,
body.theme-high-contrast .cookie-banner a,
body.theme-high-contrast .cookie-manage-button { color: #ff0 !important; }
body.theme-high-contrast .cookie-manage-button { background: #000 !important; }

/* ROZMIARY CZCIONEK (SKALOWANIE WCAG) */
body.font-small { font-size: 17px; }
body.font-normal { font-size: 21px; }
body.font-large { font-size: 25px; }
body.font-xlarge { font-size: 29px; }

/* TRYBY KOLORYSTYCZNE */
body.theme-standard { background-color: #fbf9f3; color: #2c3e50; }
body.theme-standard .menu-card {
    background: white;
    border: 1px solid #d5e0e8;
    border-top: 5px solid var(--topic-color, #1a73e8);
}
body.theme-standard .exercise-card { background: white; border: 3px solid #cbd5e1; }

body.theme-high-contrast { background-color: #000000 !important; color: #ffff00 !important; }
body.theme-high-contrast header, 
body.theme-high-contrast .menu-card, 
body.theme-high-contrast .exercise-card,
body.theme-high-contrast .top-navbar, 
body.theme-high-contrast .ai-modal-content {
    background-color: #000000 !important; 
    color: #ffff00 !important; 
    border: 3px solid #ffff00 !important; 
    box-shadow: none !important;
}
body.theme-high-contrast a, 
body.theme-high-contrast button, 
body.theme-high-contrast h1, 
body.theme-high-contrast h2, 
body.theme-high-contrast h3 { color: #ffff00 !important; }

body.theme-high-contrast .btn-main, 
body.theme-high-contrast .btn-knowledge, 
body.theme-high-contrast .nav-back, 
body.theme-high-contrast .nav-ai-btn {
    background-color: #000000 !important; 
    color: #ffff00 !important; 
    border: 3px solid #ffff00 !important; 
    box-shadow: none !important;
}
body.theme-high-contrast .menu-card-label {
    background: #000 !important;
    color: #ff0 !important;
    border: 1px solid #ff0;
}
body.theme-high-contrast .domain-notice,
body.theme-high-contrast .site-footer,
body.theme-high-contrast .accessibility-bar {
    background-color: #000 !important;
    color: #ff0 !important;
    border-color: #ff0 !important;
}
body.theme-high-contrast .domain-notice a { color: #ff0 !important; }
body.theme-high-contrast .privacy-reminder { color: #ff0 !important; }

/* PASEK DOSTĘPNOŚCI WCAG */
.accessibility-bar {
    background: #1e293b;
    color: white;
    padding: 8px 0;
    border-bottom: 3px solid #3b82f6;
}
.acc-flex {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}
.acc-group { display: flex; align-items: center; gap: 8px; }
.acc-label { font-weight: bold; font-size: 17px; margin-right: 5px; }
.acc-btn {
    background: #334155;
    color: white;
    border: 2px solid #64748b;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    min-height: 44px;
}
.acc-btn:hover { background: #475569; }
.acc-hc { background: #facc15; color: #000; border-color: #eab308; }


/* ==========================================================================
   2. GÓRNE MENU NAWIGACYJNE
   ========================================================================== */
.top-navbar {
    background-color: #ffffff;
    border-bottom: 3px solid #cbd5e1;
    box-shadow: 0 4px 6px rgba(0,0,0,0.03);
}
.nav-flex {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
}
.nav-brand {
    font-size: 1.4em;
    font-weight: 800;
    color: #1a73e8;
    text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.nav-item {
    color: #334155;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.05em;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background 0.1s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}
.nav-item:hover { background: #f1f5f9; color: #1a73e8; }

.nav-ai-btn {
    background-color: #dc2626;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1.05em;
    cursor: pointer;
    box-shadow: 0 4px 0 #991b1b;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-ai-btn:active { transform: translateY(3px); box-shadow: none; }
.ai-badge {
    background: #fef08a;
    color: #854d0e;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 10px;
}

.nav-back {
    display: inline-block;
    padding: 10px 18px;
    background-color: #e2e8f0;
    color: #1e293b !important;
    text-decoration: none;
    font-weight: bold;
    border-radius: 10px;
    margin-bottom: 20px;
    transition: background 0.2s;
}
.nav-back:hover { background-color: #cbd5e1; }


/* ==========================================================================
   3. SIATKA KART NA STRONIE GŁÓWNEJ (INDEX.PHP)
   ========================================================================== */
.grid-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 22px;
    margin-top: 24px;
}

.menu-card {
    position: relative;
    overflow: hidden;
    background: white;
    border: 1px solid #d5e0e8;
    border-top: 5px solid var(--topic-color, #1a73e8);
    border-radius: 18px;
    padding: 24px;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 330px;
    box-sizing: border-box;
    box-shadow: 0 6px 18px rgba(21, 48, 69, 0.06);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.menu-card:hover {
    transform: translateY(-3px);
    border-color: #b7c8d6;
    box-shadow: 0 12px 26px rgba(21, 48, 69, 0.12);
}

.menu-card-label {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #edf4fa;
    color: var(--topic-color, #1a73e8);
    font-size: 0.72em;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.menu-card h2, .menu-card h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #18344b;
    font-size: 1.3em;
    line-height: 1.3;
}

.menu-card p {
    color: #526579;
    font-size: 0.96em;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* KONTENER PRZYCISKÓW W KARCIE */
.card-actions, .card-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
    width: 100%;
}

/* PRZYCISKI AKCJI NA KARTACH */
.btn-main, .btn-knowledge {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1.05em;
    text-decoration: none !important;
    text-align: center;
    box-sizing: border-box;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    min-height: 48px;
    cursor: pointer;
    border: none;
}

.btn-main {
    background-color: var(--topic-color, #1a73e8);
    color: white !important;
    box-shadow: 0 3px 0 var(--topic-shadow, #1355b0);
}
.btn-main:hover {
    opacity: 0.95;
    transform: translateY(-2px);
}
.btn-main:active {
    transform: translateY(2px);
    box-shadow: none;
}

.btn-knowledge {
    background-color: #f7fafc;
    color: #23435a !important;
    border: 1px solid #cbd8e2;
}
.btn-knowledge:hover {
    background-color: #e2e8f0;
    color: #0f172a !important;
}


/* ==========================================================================
   4. KARTY LEKCJI I INTERAKTYWNE ĆWICZENIA
   ========================================================================== */
.exercise-card {
    background: white;
    border: 3px solid #cbd5e1;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    box-sizing: border-box;
}

.lesson-lead {
    max-width: 900px;
    margin: 0 auto 24px;
    padding: 18px 22px;
    border-left: 5px solid #147d78;
    border-radius: 10px;
    background: #edf7f5;
    color: #23435a;
    font-size: 1.08em;
    line-height: 1.7;
}

.lesson-prompt,
.lesson-key-point,
.lesson-example {
    margin: 20px 0;
    padding: 14px 18px;
    border-radius: 10px;
    line-height: 1.65;
}

.lesson-prompt {
    border-left: 4px solid #d18a28;
    background: #fff8e9;
    color: #4a3b20;
}

.lesson-key-point {
    border-left: 4px solid #147d78;
    background: #edf7f5;
    color: #183f3b;
}

.lesson-example {
    border-left: 4px solid #5276a5;
    background: #f0f5fb;
    color: #263d57;
}

.exercise-card details {
    margin: 12px 0;
    padding: 14px 16px;
    border: 1px solid #cbd8e2;
    border-radius: 10px;
    background: #f8fafc;
}

.exercise-card details summary {
    cursor: pointer;
    line-height: 1.6;
}

.exercise-card details[open] summary {
    margin-bottom: 12px;
}

.exercise-card details.lesson-topic {
    margin: 14px 0;
    background: #fff;
}

.exercise-card details.lesson-topic summary {
    color: #18344b;
    font-size: 1.04em;
}

.exercise-card details.lesson-topic[open] {
    border-left: 4px solid #147d78;
}

.exercise-card details.lesson-topic p:last-child {
    margin-bottom: 4px;
}

body.theme-high-contrast .lesson-lead,
body.theme-high-contrast .lesson-prompt,
body.theme-high-contrast .lesson-key-point,
body.theme-high-contrast .lesson-example,
body.theme-high-contrast .exercise-card details {
    background: #000 !important;
    color: #ff0 !important;
    border-color: #ff0 !important;
}

body.theme-high-contrast .exercise-card details.lesson-topic summary {
    color: #ff0 !important;
}

.result-box {
    display: none;
    padding: 16px 20px;
    border-radius: 12px;
    margin-top: 15px;
    font-weight: bold;
    line-height: 1.5;
}
.result-success {
    background-color: #dcfce7;
    color: #15803d;
    border: 2px solid #86efac;
}
.result-error {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 2px solid #fca5a5;
}


/* ==========================================================================
   5. OKNO ASYSTENTA ORAZ MIKROFON
   ========================================================================== */
.ai-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.ai-modal-content {
    background: white;
    width: 92%;
    max-width: 680px;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-sizing: border-box;
}
.ai-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid #e2e8f0; padding-bottom: 10px; }
.ai-header h3 { margin: 0; font-size: 1.3em; color: #1a73e8; }
.ai-close-btn { background: none; border: none; font-size: 32px; font-weight: bold; cursor: pointer; color: #64748b; }

.ai-chat-box {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    margin: 15px 0;
    min-height: 250px;
    max-height: 450px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg { padding: 14px 18px; border-radius: 16px; max-width: 90%; line-height: 1.5; font-size: 0.95em; word-wrap: break-word; }
.chat-msg-bot { background: #e0f2fe; color: #0369a1; align-self: flex-start; border-bottom-left-radius: 2px; }
.chat-msg-user { background: #16a34a; color: white; align-self: flex-end; border-bottom-right-radius: 2px; font-weight: bold; }

.chat-msg-bot h3, .chat-msg-bot h4 { margin: 12px 0 6px 0; color: #1e40af; font-size: 1.05em; font-weight: bold; }
.chat-msg-bot p { margin: 6px 0; }
.chat-msg-bot ul, .chat-msg-bot ol { margin: 6px 0; padding-left: 22px; }
.chat-msg-bot li { margin-bottom: 4px; }

.ai-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}
.ai-controls input {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 17px;
    padding: 12px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    outline: none;
    box-sizing: border-box;
}
.mic-btn {
    flex: 0 0 auto;
    background: #e11d48;
    color: white;
    border: none;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.ai-send-btn {
    flex: 0 0 auto;
    background: #1a73e8;
    color: white;
    border: none;
    padding: 12px 18px;
    font-size: 17px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    min-height: 48px;
}

.mic-listening {
    animation: pulse 1.2s infinite;
    background: #16a34a !important;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.tut-steps { display: flex; flex-direction: column; gap: 12px; margin-top: 15px; }
.tut-step { background: #f1f5f9; padding: 12px; border-radius: 10px; border-left: 4px solid #1a73e8; }
.btn-sub-help { background: none; border: none; color: #64748b; font-size: 15px; text-decoration: underline; cursor: pointer; margin-top: 8px; }
.privacy-reminder { margin: 8px 0 0; font-size: 0.9em; color: #475569; }

.scroll-hint-bar {
    background-color: #fef08a;
    color: #854d0e;
    border: 2px solid #eab308;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.85em;
    font-weight: bold;
    text-align: center;
    margin-top: -8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.08);
    animation: bounce 2s infinite;
    user-select: none;
    pointer-events: none;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}


/* ==========================================================================
   6. RESPONSYWNOŚĆ (MOBILE)
   ========================================================================== */
@media (max-width: 480px) {
    .ai-modal-content { padding: 14px; width: 96%; }
    .mic-btn span#mic-text { display: none; }
    .mic-btn { padding: 12px 12px; }
    .ai-send-btn { padding: 12px 14px; }
    .ai-footer-help { flex-direction: column; gap: 5px; align-items: flex-start !important; }
    .grid-menu { grid-template-columns: minmax(0, 1fr); }
    .home-hero { padding: 36px 20px; border-radius: 18px; }
    .home-hero h1 { font-size: 2em; }
    .domain-notice { align-items: flex-start; padding: 16px; }
    .menu-card { min-height: 0; padding: 20px; }
    .legal-layout { grid-template-columns: minmax(0, 1fr); }
    .legal-toc { position: static; }
    .legal-hero { padding: 24px 20px; }
    .legal-content .exercise-card { padding: 20px; }
    .cookie-banner {
        right: 10px;
        bottom: 10px;
        left: 10px;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        max-height: 88vh;
        padding: 18px;
    }
    .cookie-banner-actions { min-width: 0; }
}

.guide-page { max-width: 1180px; }
.guide-page h1,
.guide-page h2,
.guide-page h3,
.guide-page h4 { line-height: 1.3; }
.guide-hero {
    margin: 20px 0 28px;
    padding: 34px;
    border-radius: 20px;
    background: linear-gradient(120deg, #123b68, #176b87 58%, #1b7a77);
    color: #fff;
    box-shadow: 0 10px 26px rgba(15, 54, 80, 0.14);
}
.guide-hero h1 { margin: 0; color: #fff; font-size: 2.2em; }
.guide-hero > p:not(.guide-eyebrow) { max-width: 850px; margin: 12px 0 0; color: #f0fdfa; font-size: 1.08em; }
.guide-eyebrow {
    margin: 0 0 8px;
    color: #d7f7f0;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.guide-count strong { font-size: 1.2em; }
.guide-trails,
.guide-controls,
.guide-glossary {
    margin: 28px 0;
    padding: 24px;
    border: 1px solid #d5e0e8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(21, 48, 69, 0.05);
}
.guide-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}
.guide-section-heading h2,
.guide-controls > h2 { margin: 0; color: #163d5a; font-size: 1.55em; }
.guide-section-heading p { margin: 5px 0 0; color: #475569; }
.guide-usage {
    margin: 22px 0;
    padding: 18px 22px;
    border: 1px solid #bfdbd7;
    border-left: 5px solid #147d78;
    border-radius: 12px;
    background: #f4faf9;
}
.guide-usage h2 { margin: 0; color: #163d5a; font-size: 1.25em; }
.guide-usage p { margin: 6px 0; color: #475569; }
.guide-usage ol { margin: 8px 0 0; padding-left: 1.4em; }
.guide-usage li { margin: 5px 0; }
.guide-usage[hidden] { display: none !important; }
.guide-trail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}
.guide-trail {
    padding: 18px;
    border: 1px solid #bfdbd7;
    border-left: 5px solid #147d78;
    border-radius: 12px;
    background: #f4faf9;
}
.guide-trail h3 { margin: 0 0 6px; color: #163d5a; font-size: 1.12em; }
.guide-trail p { margin: 0 0 10px; color: #475569; }
.guide-trail ol { margin: 0; padding-left: 1.3em; }
.guide-trail li { margin: 7px 0; }
.guide-trail a,
.guide-related a { color: #075985; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.guide-search-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr) minmax(180px, 1fr);
    gap: 14px;
    margin-top: 16px;
}
.guide-search-grid label,
.guide-glossary > label {
    display: block;
    margin-bottom: 6px;
    color: #243f55;
    font-weight: 700;
}
.guide-search-grid input,
.guide-search-grid select,
.guide-glossary > input {
    width: 100%;
    min-height: 48px;
    padding: 9px 12px;
    border: 2px solid #9aafbf;
    border-radius: 8px;
    background: #fff;
    color: #172b3a;
}
.guide-category-filter {
    margin: 20px 0 0;
    padding: 14px;
    border: 1px solid #cbd8e2;
    border-radius: 12px;
}
.guide-category-filter legend { padding: 0 6px; color: #243f55; font-weight: 700; }
.guide-category-filter legend span { color: #526579; font-size: 0.9em; font-weight: 400; }
.guide-category-list { display: flex; flex-wrap: wrap; gap: 9px; }
.guide-category-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 6px 11px;
    border: 1px solid #c1d0dc;
    border-radius: 999px;
    background: #f8fafc;
    cursor: pointer;
}
.guide-category-option input { width: 18px; height: 18px; accent-color: #147d78; }
.guide-quick-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.guide-quick-filters span { color: #334e62; font-weight: 700; }
.guide-quick-filters button,
.guide-print-all,
.guide-feedback button,
.guide-print-one {
    min-height: 44px;
    padding: 8px 13px;
    border: 1px solid #8da7ba;
    border-radius: 8px;
    background: #f5f9fc;
    color: #163d5a;
    font-weight: 700;
    cursor: pointer;
}
.guide-quick-filters button:hover,
.guide-print-all:hover,
.guide-feedback button:hover,
.guide-print-one:hover { background: #e4eff5; }
.guide-result-count { margin: 14px 0 0; color: #334e62; font-weight: 700; }
.guide-list { margin: 32px 0; }
.guide-card {
    margin: 16px 0;
    padding: 20px;
    border: 1px solid #cbd8e2;
    border-left: 5px solid #176b87;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(21, 48, 69, 0.045);
    scroll-margin-top: 20px;
}
.guide-card[hidden],
.guide-glossary-item[hidden] { display: none !important; }
.guide-card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.guide-card-heading h3 { margin: 0; color: #173c58; font-size: 1.25em; }
.guide-card-heading p { margin: 6px 0 0; color: #455b6d; }
.guide-level { flex: 0 0 auto; padding: 5px 10px; border: 1px solid #aec4d2; border-radius: 999px; background: #edf4f8; color: #24465d; font-size: 0.9em; font-weight: 700; }
.guide-level-sredni { border-color: #e5c27b; background: #fff8e9; color: #744d0b; }
.guide-level-zaawansowany { border-color: #d8a4a4; background: #fff0f0; color: #8c2525; }
.guide-meta,
.guide-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.guide-meta span { color: #526579; font-size: 0.93em; }
.guide-meta span + span::before { content: "•"; margin-right: 8px; color: #8ca0af; }
.guide-tag { padding: 3px 9px; border-radius: 999px; background: #edf4f8; color: #25465e; font-size: 0.88em; }
.guide-details { margin-top: 14px; border-top: 1px solid #d8e2e9; }
.guide-details > summary { padding: 13px 3px 2px; color: #075985; font-weight: 700; cursor: pointer; text-underline-offset: 3px; }
.guide-details[open] > summary { margin-bottom: 10px; }
.guide-content { line-height: 1.7; }
.guide-content h4 { margin: 18px 0 7px; color: #173c58; font-size: 1.08em; }
.guide-content > p { margin: 7px 0 13px; }
.guide-content ol { padding-left: 1.6em; }
.guide-content li { margin: 8px 0; padding-left: 3px; }
.guide-warning {
    margin: 16px 0;
    padding: 14px 16px;
    border-left: 5px solid #bc7b14;
    border-radius: 8px;
    background: #fff8e9;
    color: #493811;
}
.guide-lesson-link { display: inline-flex; align-items: center; margin: 7px 0 12px; padding: 10px 16px; text-decoration: none; }
.guide-related { margin-top: 10px; padding: 12px 16px; border-radius: 9px; background: #f3f7fa; }
.guide-related h4 { margin-top: 3px; }
.guide-related ul { margin-bottom: 4px; padding-left: 1.3em; }
.guide-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; padding-top: 13px; border-top: 1px solid #d8e2e9; }
.guide-feedback > span:first-child { margin-right: 4px; font-weight: 700; }
.guide-feedback button[aria-pressed="true"] { border-color: #147d78; background: #e6f4f1; box-shadow: inset 0 0 0 1px #147d78; }
.guide-feedback-status { color: #315746; font-size: 0.92em; }
.guide-print-one { margin-top: 10px; }
.guide-empty { padding: 14px; border-radius: 8px; background: #f4f7fa; color: #334e62; }
.guide-glossary > input { margin-bottom: 14px; }
.guide-glossary-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 0; }
.guide-glossary-item { padding: 13px 15px; border: 1px solid #d5e0e8; border-radius: 10px; background: #f8fafc; }
.guide-glossary-item dt { color: #173c58; font-weight: 800; }
.guide-glossary-item dd { margin: 5px 0 0; color: #334e62; line-height: 1.55; }
.guide-feedback-note { color: #526579; font-size: 0.92em; }
.guide-video { max-width: 720px; margin: 18px 0; }
.guide-video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; }
body.theme-high-contrast .guide-hero,
body.theme-high-contrast .guide-trails,
body.theme-high-contrast .guide-controls,
body.theme-high-contrast .guide-trail,
body.theme-high-contrast .guide-card,
body.theme-high-contrast .guide-glossary,
body.theme-high-contrast .guide-glossary-item,
body.theme-high-contrast .guide-usage,
body.theme-high-contrast .guide-related,
body.theme-high-contrast .guide-category-option,
body.theme-high-contrast .guide-warning,
body.theme-high-contrast .guide-search-grid input,
body.theme-high-contrast .guide-search-grid select,
body.theme-high-contrast .guide-glossary > input {
    background: #000 !important;
    color: #ff0 !important;
    border-color: #ff0 !important;
}
body.theme-high-contrast .guide-page h1,
body.theme-high-contrast .guide-page h2,
body.theme-high-contrast .guide-page h3,
body.theme-high-contrast .guide-page h4,
body.theme-high-contrast .guide-page p,
body.theme-high-contrast .guide-page label,
body.theme-high-contrast .guide-page legend,
body.theme-high-contrast .guide-page span,
body.theme-high-contrast .guide-page li,
body.theme-high-contrast .guide-page dd,
body.theme-high-contrast .guide-page dt,
body.theme-high-contrast .guide-page a,
body.theme-high-contrast .guide-page button { color: #ff0 !important; }
body.theme-high-contrast .guide-hero .guide-eyebrow,
body.theme-high-contrast .guide-hero > p:not(.guide-eyebrow) { color: #ff0 !important; }

@media (max-width: 720px) {
    .guide-search-grid { grid-template-columns: minmax(0, 1fr); }
    .guide-trails,
    .guide-usage,
    .guide-controls,
    .guide-glossary { padding: 18px; }
    .guide-hero { padding: 26px 20px; }
    .guide-hero h1 { font-size: 1.85em; }
    .guide-card { padding: 16px; }
}
@media (max-width: 480px) {
    .guide-card-heading { flex-direction: column-reverse; gap: 8px; }
    .guide-section-heading { flex-direction: column; }
    .guide-category-filter legend span { display: block; margin-top: 4px; }
    .guide-glossary-list { grid-template-columns: minmax(0, 1fr); }
}
@media print {
    body.print-single .guide-page > :not(.guide-list),
    body.print-all .guide-page > :not(.guide-list),
    .accessibility-bar,
    .top-navbar,
    .site-footer,
    .skip-link,
    .guide-print-one,
    .guide-print-all,
    .guide-feedback,
    .guide-trails,
    .guide-controls,
    .guide-glossary,
    .nav-back { display: none !important; }
    body.print-single .guide-card:not(.print-target) { display: none !important; }
    .guide-page { max-width: none; padding: 0; }
    .guide-card { break-inside: avoid; border: 1px solid #777; box-shadow: none; }
    .guide-details > summary { display: none; }
    .guide-details:not([open]) .guide-content { display: block !important; }
    .guide-card[hidden] { display: none !important; }
}

:focus-visible {
    outline: 4px solid #f59e0b;
    outline-offset: 3px;
}

button, input, select, textarea { font: inherit; }
button, select { min-height: 44px; }
input, textarea, select { max-width: 100%; }

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