/* 首页左侧栏：头部、会员卡和帮助入口固定，中间菜单独立滚动。 */
.sidebar {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.sidebar .brand {
    flex: 0 0 auto;
}

/* Extreme browser zoom: keep both desktop and mobile brand names horizontal. */
.sidebar .brand,
.sidebar .brand>span:last-child,
.sidebar .brand b,
.mobile-brand{
    white-space:nowrap;
    word-break:keep-all;
    overflow-wrap:normal;
    writing-mode:horizontal-tb;
}
.sidebar .brand-mark{flex:0 0 42px}
.mobile-brand{flex:0 0 auto;min-width:max-content;line-height:1.2}

@media (max-width:320px){
    .topbar{gap:8px;padding-left:10px;padding-right:10px}
    .topbar .search{width:30px;flex:0 0 30px;padding:0}
    .topbar .top-actions .register{display:none}
    .mobile-brand{font-size:14px}
}

.sidebar .side-nav {
    position: relative;
    flex: 1 1 auto;
    min-height: 80px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 5px;
    scrollbar-width: thin;
    scrollbar-color: #d9d4ed transparent;
}

.sidebar .side-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar .side-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar .side-nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #d9d4ed;
}

.sidebar .side-nav::-webkit-scrollbar-thumb:hover {
    background: #bcb4df;
}

.sidebar .side-card {
    flex: 0 0 auto;
    margin-top: 14px;
}

.sidebar .side-bottom {
    flex: 0 0 auto;
}

@media (max-height: 820px) and (min-width: 821px) {
    .sidebar {
        padding-top: 18px;
        padding-bottom: 14px;
    }

    .sidebar .brand {
        padding-bottom: 17px;
    }

    .sidebar .side-nav {
        gap: 4px;
    }

    .sidebar .side-nav a {
        height: 40px;
    }

    .sidebar .side-card {
        padding: 12px;
    }

    .sidebar .side-card-icon,
    .sidebar .side-card p {
        display: none;
    }

    .sidebar .side-card a {
        margin-top: 8px;
    }

    .sidebar .side-bottom {
        padding-top: 12px;
    }
}

@media (max-width: 820px) {
    .sidebar {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .sidebar .side-nav {
        -webkit-overflow-scrolling: touch;
    }
}

/* 首页顶部用户区：在浏览器放大时保持科目、昵称和退出操作互不遮挡。 */
.top-actions .user-name {
    max-width: 190px;
    height: 38px;
    padding: 0 11px 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e7e4ef;
    border-radius: 10px;
    background: #fff;
    color: #555064;
}

.top-actions .user-name i {
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #7463dc;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
}

.top-actions .user-name b {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
}

.top-actions .logout-button {
    height: 38px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    border: 1px solid #ded9eb;
    border-radius: 9px;
    color: #706a7e;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.top-actions .logout-button:hover {
    color: #6655dc;
    border-color: #a99de5;
    background: #f7f5ff;
}

@media (max-width: 1450px) and (min-width: 821px) {
    .app-shell {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    .right-panel {
        display: none;
    }

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

    .topbar .search {
        width: auto;
        min-width: 180px;
        flex: 1 1 320px;
    }

    .topbar .home-subject-switch {
        flex: 0 1 220px;
        min-width: 0;
        margin-right: 0;
    }

    .topbar .home-subject-switch > span {
        display: none;
    }

    .top-actions {
        flex: 0 0 auto;
    }

    .top-actions .icon-button {
        display: none;
    }
}

@media (max-width: 1050px) and (min-width: 821px) {
    .top-actions .user-name {
        max-width: 120px;
    }

    .top-actions .logout-button {
        width: 38px;
        padding: 0;
        justify-content: center;
        overflow: hidden;
        font-size: 0;
    }

    .top-actions .logout-button:before {
        content: "退出";
        font-size: 11px;
    }
}

@media (max-width: 820px) {
    .top-actions .user-name,
    .top-actions .logout-button {
        display: none;
    }
}
