.mobile-menu {
    display: none;
}

@media (max-width: 900px) {
    body.has-mobile-menu {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-menu {
        display: block;
        position: relative;
        z-index: 1000;
    }

    .mobile-menu__toggle {
        position: fixed;
        top: calc(12px + env(safe-area-inset-top));
        right: 14px;
        z-index: 1002;
        width: 44px;
        height: 44px;
        margin: 0;
        padding: 10px;
        border: 1px solid rgba(130, 159, 177, 0.38);
        border-radius: 12px;
        background: rgba(6, 22, 36, 0.94);
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
        cursor: pointer;
    }

    .mobile-menu__toggle span {
        display: block;
        width: 100%;
        height: 2px;
        margin: 4px 0;
        border-radius: 2px;
        background: #f5f8fb;
        transition: transform 180ms ease, opacity 180ms ease;
    }

    .mobile-menu.is-open .mobile-menu__toggle span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .mobile-menu.is-open .mobile-menu__toggle span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu.is-open .mobile-menu__toggle span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    .mobile-menu__backdrop {
        position: fixed;
        inset: 0;
        z-index: 1000;
        width: auto;
        height: auto;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: rgba(0, 8, 17, 0.62);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    .mobile-menu__panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 1001;
        display: flex;
        width: min(86vw, 340px);
        padding: calc(22px + env(safe-area-inset-top)) 22px
            calc(22px + env(safe-area-inset-bottom));
        border: 0;
        border-left: 1px solid rgba(135, 174, 196, 0.24);
        border-radius: 0;
        background: #071b2c;
        box-shadow: -20px 0 60px rgba(0, 0, 0, 0.38);
        color: #f5f8fb;
        flex-direction: column;
        transform: translateX(105%);
        transition: transform 220ms ease;
        overflow-y: auto;
    }

    .mobile-menu.is-open .mobile-menu__backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-menu.is-open .mobile-menu__panel {
        transform: translateX(0);
    }

    .mobile-menu__heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 24px;
        padding-bottom: 17px;
        border-bottom: 1px solid rgba(135, 174, 196, 0.22);
    }

    .mobile-menu__heading strong {
        color: #51ddc5;
        font-size: 0.8rem;
        letter-spacing: 0.14em;
        text-transform: uppercase;
    }

    .mobile-menu__heading button {
        width: 40px;
        min-height: 40px;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: #f5f8fb;
        font-size: 2rem;
        line-height: 1;
        cursor: pointer;
    }

    .mobile-menu__links {
        display: grid;
        gap: 7px;
    }

    .mobile-menu__links a {
        display: block;
        padding: 13px 14px;
        border: 1px solid transparent;
        border-radius: 10px;
        background: transparent;
        color: #dbe8ef;
        font-size: 0.98rem;
        font-weight: 700;
        text-decoration: none;
    }

    .mobile-menu__links a:hover,
    .mobile-menu__links a:focus-visible {
        border-color: rgba(81, 221, 197, 0.35);
        background: #102d42;
    }

    .mobile-menu__links a[aria-current="page"] {
        border-color: rgba(81, 221, 197, 0.42);
        background: #12384a;
        color: #73ead6;
    }

    .mobile-menu__panel form {
        margin-top: auto;
        padding-top: 24px;
    }

    .mobile-menu__logout {
        width: 100%;
        min-height: 48px;
        margin: 0;
        border: 1px solid #365166;
        border-radius: 10px;
        background: #102a3e;
        color: #eaf3f8;
        font: inherit;
        font-weight: 800;
        cursor: pointer;
    }

    body.has-mobile-menu.menu-open {
        overflow: hidden;
    }

    body.has-mobile-menu .topbar .nav-actions a.status,
    body.has-mobile-menu .topbar #mode,
    body.has-mobile-menu .topbar .avatar,
    body.has-mobile-menu .bar .switch,
    body.has-mobile-menu .bar .connection,
    body.has-mobile-menu > header > nav {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-menu__toggle span,
    .mobile-menu__backdrop,
    .mobile-menu__panel {
        transition: none;
    }
}
