
.nav-panel-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    background: var(--accent-2);
    border: none;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.15s ease;
    letter-spacing: 0.01em;
    line-height: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-panel-btn:hover {
    background: #f5c040;
    transform: translateY(-1px);
    text-decoration: none;
    color: var(--primary-color);
}

.nav-panel-btn.nav-panel-logged {
    background: rgba(255,255,255,0.18);
    color: white;
    border: 1.5px solid rgba(255,255,255,0.4);
}

.nav-panel-btn.nav-panel-logged:hover {
    background: rgba(255,255,255,0.28);
    color: white;
    transform: translateY(-1px);
}

/* ── Header ── */

header {
    background: var(--primary-color);
    color: white;
    width: 100%;
    z-index: 400;
}

.nav-container {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    gap: 16px;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

#menu {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    z-index: 430;
}

/* ── Hamburger ── */

#menu-bar {
    display: none;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    border-radius: 10px;
    margin: 0;
    padding: 8px;
    line-height: 0;
    appearance: none;
    -webkit-appearance: none;
}

#menu-bar:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
}

.bar {
    display: block;
    width: 28px;
    height: 3px;
    border-radius: 999px;
    background-color: var(--accent-2);
    transition: transform 0.25s ease, opacity 0.2s ease, background-color 0.25s ease;
}

#bar1, #bar2, #bar3 {
    transform: none;
}

/* ── Nav (desktop domyślny) ── */

.nav {
    display: block;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.nav li {
    list-style: none;
}

.nav-panel-item {
    display: flex;
}

.nav li a:not(.nav-panel-btn) {
    display: block;
    color: white;
    font-size: 1.1rem;
    text-decoration: none;
    font-weight: 450;
    padding: 8px 12px;
    border-radius: 8px;
    transition: color 0.25s ease, background-color 0.25s ease;
}

.nav li a:not(.nav-panel-btn):hover,
.nav li a:not(.nav-panel-btn):focus-visible {
    color: var(--accent-2);
    background: rgba(255, 255, 255, 0.12);
}

/* ── Bąbel (domyślnie ukryty) ── */

.menu-bg {
    display: none;
    width: 0;
    height: 0;
    opacity: 0;
}

/* ─────────────────────────────────────────────
   MOBILE  max-width: 769px
───────────────────────────────────────────── */

@media screen and (max-width: 769px) {

    body.public-page {
        padding-top: 72px;
        overflow-x: clip;
    }

    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
    }

    .nav-container {
        padding: 12px 16px;
    }

    .logo-text {
        font-size: clamp(1rem, 4.2vw, 1.3rem);
        letter-spacing: 0.06em;
    }

    /* ── Hamburger (mobilny) ── */

    #menu-bar {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        width: 44px;
        height: 40px;
        padding: 10px 8px;
        position: relative;
        z-index: 430;
    }

    .bar {
        height: 4px;
    }

    /* ── Bąbel ── */

    .menu-bg {
        display: block;
        position: fixed;
        top: -180px;
        right: -180px;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: radial-gradient(circle at 30% 30%, #ffe8a6 0%, var(--accent-2) 72%, #f4b01e 100%);
        transition: width 0.38s ease, height 0.38s ease, opacity 0.2s ease;
        z-index: 410;
        pointer-events: none;
        opacity: 0;
    }

    .change-bg {
        width: 550px;
        height: 550px;
        opacity: 1;
    }

    /* ── Nav panel (zamknięty) ── */

    .nav {
        position: fixed;
        top: 0;
        right: 0;
        display: none !important;
        width: 330px;
        height: 330px;
        z-index: 420;
        pointer-events: none;
        padding: 0;
        align-items: center;
        justify-content: center;
    }

    /* ── Nav panel (otwarty — JS dodaje .change) ── */

    .nav.change {
        display: flex !important;
        pointer-events: auto;
    }

    /* ── Lista linków ── */

    .nav-links {
        flex-direction: column;
        align-items: center;
        gap: 16px;
        width: 100%;
        padding-top: 25px;
        padding-left: 60px;
        text-align: center;
    }

    .nav-panel-item {
        width: 100%;
        justify-content: center;
    }

    /* ── Linki zwykłe ── */

    .nav li a:not(.nav-panel-btn) {
        font-size: 1.05rem;
        color: var(--primary-color);
        font-weight: 700;
        background: transparent;
        border-radius: 999px;
        padding: 8px 10px;
        text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    }

    .nav li a:not(.nav-panel-btn):hover,
    .nav li a:not(.nav-panel-btn):focus-visible {
        color: #ffffff;
        background: color-mix(in srgb, var(--medium-gray) 25%, transparent);    
    }

    /* ── Panel ucznia (mobilny) — pasuje do zwykłych linków ── */

    .nav-panel-btn {
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--primary-color);
        background: transparent;
        border: none;
        border-radius: 999px;
        padding: 8px 10px;
        text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
        align-self: center;
        margin-top: 0;
    }

    .nav-panel-btn.nav-panel-logged {
        color: var(--primary-color);
        background: transparent;
        border-color: transparent;
    }

    .nav-panel-btn:hover,
    .nav-panel-btn.nav-panel-logged:hover {
        color: #ffffff;
        background: color-mix(in srgb, var(--medium-gray) 25%, transparent);
    }

    /* ── Hamburger → X (JS dodaje .change do #menu) ── */

    .change .bar {
        background-color: var(--primary-color);
    }

    .change #bar1 {
        transform: translateY(8px) rotate(45deg);
    }

    .change #bar2 {
        opacity: 0;
    }

    .change #bar3 {
        transform: translateY(-8px) rotate(-45deg);
    }
}

@media screen and (max-width: 1079px) {
    .logo-text {
        font-size: clamp(1rem, 4vw, 1.15rem);
    }
}

/* ─────────────────────────────────────────────
   TABLET  min-width: 770px max-width: 1439px
───────────────────────────────────────────── */

@media screen and (min-width: 770px) and (max-width: 1439px) {

    /* ── Tablet: nawigacja w żółtym bąblu ── */

    body.public-page {
        padding-top: 72px;
        overflow-x: clip;
    }

    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
    }

    /* ── Hamburger ── */

    #menu-bar {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        width: 48px;
        height: 44px;
        padding: 10px 8px;
        position: relative;
        z-index: 430;
    }

    .bar {
        height: 4px;
    }

    /* ── Żółty bąbel — większy niż na telefonie ── */

    .menu-bg {
        display: block;
        position: fixed;
        top: -220px;
        right: -220px;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: radial-gradient(
            circle at 30% 30%,
            #ffe8a6 0%,
            var(--accent-2) 72%,
            #f4b01e 100%
        );
        transition: width 0.38s ease, height 0.38s ease, opacity 0.2s ease;
        z-index: 410;
        pointer-events: none;
        opacity: 0;
    }

    .change-bg {
        width: 720px;
        height: 720px;
        opacity: 1;
    }

    /* ── Panel nawigacji ── */

    .nav {
        position: fixed;
        top: 0;
        right: 0;
        display: none !important;
        width: 440px;
        height: 440px;
        z-index: 420;
        pointer-events: none;
        padding: 0;
        align-items: center;
        justify-content: center;
    }

    .nav.change {
        display: flex !important;
        pointer-events: auto;
    }

    /* ── Lista linków ── */

    .nav-links {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        width: 100%;
        padding-top: 35px;
        padding-left: 70px;
        text-align: center;
    }

    .nav-panel-item {
        width: 100%;
        justify-content: center;
    }

    /* ── Większy tekst na tabletach ── */

    .nav li a:not(.nav-panel-btn) {
        font-size: 1.35rem;
        color: var(--primary-color);
        font-weight: 700;
        background: transparent;
        border-radius: 999px;
        padding: 10px 14px;
        text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    }

    .nav li a:not(.nav-panel-btn):hover,
    .nav li a:not(.nav-panel-btn):focus-visible {
        color: #ffffff;
        background: color-mix(in srgb, var(--medium-gray) 25%, transparent);
    }

    /* ── Panel ucznia ── */

    .nav-panel-btn {
        font-size: 1.35rem;
        font-weight: 700;
        color: var(--primary-color);
        background: transparent;
        border: none;
        border-radius: 999px;
        padding: 10px 14px;
        text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
        align-self: center;
        margin-top: 0;
    }

    .nav-panel-btn.nav-panel-logged {
        color: var(--primary-color);
        background: transparent;
        border-color: transparent;
    }

    .nav-panel-btn:hover,
    .nav-panel-btn.nav-panel-logged:hover {
        color: #ffffff;
        background: color-mix(in srgb, var(--medium-gray) 25%, transparent);
    }

    /* ── Hamburger → X ── */

    .change .bar {
        background-color: var(--primary-color);
    }

    .change #bar1 {
        transform: translateY(10px) rotate(45deg);
    }

    .change #bar2 {
        opacity: 0;
    }

    .change #bar3 {
        transform: translateY(-10px) rotate(-45deg);
    }
}

/* ─────────────────────────────────────────────
   DESKTOP  min-width: 1440px
───────────────────────────────────────────── */

@media screen and (min-width: 1440px) {

    body.public-page {
        padding-top: 0;
    }

    #menu-bar {
        display: none;
    }

    .menu-bg {
        display: none;
    }

    .nav {
        display: block !important;
        position: static;
        width: auto;
        height: auto;
        min-height: 0;
        pointer-events: auto;
        padding: 0;
    }

    .nav-links {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 0;
    }

    .nav li a:not(.nav-panel-btn) {
        color: white;
        background: transparent;
        border-radius: 8px;
        padding: 8px 12px;
        font-size: 1.1rem;
        font-weight: 450;
        text-shadow: none;
    }

    .nav li a:not(.nav-panel-btn):hover,
    .nav li a:not(.nav-panel-btn):focus-visible {
        color: var(--accent-2);
        background: color-mix(in srgb, var(--medium-gray) 25%, transparent);    }
}