.mobile-topbar-brand {
    display: none;
}

.challenge-switcher {
    position: relative;
}

.challenge-switcher::after {
    position: absolute;
    top: 50%;
    right: 13px;
    color: #d94d19;
    font-size: 17px;
    line-height: 1;
    content: "⌄";
    pointer-events: none;
    transform: translateY(-55%);
}

.challenge-switcher select {
    min-height: 42px;
    padding: 0 38px 0 13px;
    appearance: none;
    border: 1px solid #efd4c5;
    border-radius: 13px;
    background: linear-gradient(135deg, #fffaf6, #fff);
    color: #342a24;
    box-shadow: 0 4px 12px rgba(72, 47, 32, .055);
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.challenge-switcher select:hover {
    border-color: #f1a17a;
    background: #fff7f1;
}

.challenge-switcher select:focus-visible {
    border-color: #f15a24;
    outline: 3px solid rgba(241, 90, 36, .18);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .member-portal .topbar,
    .editor-portal .topbar,
    .admin-portal .topbar {
        position: relative;
        z-index: 25;
    }

    .member-portal .sidebar.open,
    .editor-portal .sidebar.open,
    .admin-portal .sidebar.open {
        z-index: 40;
    }

    #sidebar.open + .main-content .challenge-switcher {
        visibility: hidden;
        pointer-events: none;
    }

    .mobile-topbar-brand {
        display: flex;
        width: 132px;
        min-width: 0;
        height: 48px;
        flex: 0 1 132px;
        align-items: center;
        margin-left: 3px;
        order: 1;
    }

    .mobile-topbar-brand img {
        display: block;
        width: 100%;
        max-height: 80px;
        object-fit: contain;
        object-position: left center;
    }

    .topbar .breadcrumb {
        display: none;
    }

    .challenge-switcher {
        margin-left: auto;
        max-width: 35vw;
        order: 2;
    }

    .top-actions {
        order: 3;
    }

    .topbar .menu-button {
        flex: 0 0 42px;
        order: 4;
    }
}

@media (max-width: 600px) {
    .mobile-topbar-brand {
        width: 120px;
        flex-basis: 120px;
    }

    .topbar {
        gap: 8px;
        padding-right: 12px;
        padding-left: 12px;
    }

    .top-actions {
        gap: 8px;
    }

    .top-user-meta {
        display: block;
        max-width: 88px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .top-user-meta strong {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .top-user-meta small {
        display: none;
    }

    .challenge-switcher {
        position: absolute;
        top: 65px;
        right: 20px;
        left: 20px;
        max-width: none;
        margin: 0;
        z-index: 1;
    }

    .challenge-switcher select {
        min-height: 42px;
        border-radius: 12px;
        font-size: 12px;
    }
}

@media (max-width: 380px) {
    .mobile-topbar-brand {
        width: 90px;
        flex-basis: 90px;
    }

    .top-user-meta {
        max-width: 66px;
    }
}
