/* ========================================
   移动端专用样式 v2
   布局：[漏斗icon] [🎓 icon+标题] [☰ icon]
   左侧筛选面板 ← | 右侧导航菜单 →
   ======================================== */

@media (max-width: 768px) {

    /* ========================================
       1. 隐藏桌面端元素
       ======================================== */
    .nav-buttons,
    .qr-popover,
    .bookmark-guide-badge,
    .quick-search-btn,
    .university-title {
        display: none !important;
    }

    /* ========================================
       2. 移动端顶部导航栏 - 极简纯图标风格
       ======================================== */
    .mobile-top-nav {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        height: 52px;
    }

    /* ---- 左右纯图标按钮（无背景） ---- */
    .mobile-nav-left,
    .mobile-nav-right {
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }

    .filter-menu-btn,
    .hamburger-menu {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        color: #1d1d1f;
        font-size: 1.25rem;
        transition: color 0.2s, transform 0.15s;
    }

    .filter-menu-btn:hover,
    .hamburger-menu:hover {
        color: #0071e3;
    }

    .filter-menu-btn:active,
    .hamburger-menu:active {
        transform: scale(0.88);
    }

    /* 汉堡图标 - 纯色横线 */
    .hamburger-icon {
        display: flex;
        flex-direction: column;
        gap: 4px;
        width: 18px;
        height: 14px;
        justify-content: space-between;
    }
    .hamburger-icon span {
        display: block;
        height: 2px;
        background: #1d1d1f;
        border-radius: 1px;
        transition: background 0.2s;
    }
    .hamburger-menu:hover .hamburger-icon span {
        background: #0071e3;
    }

    /* ---- 中间标题区（icon + 标题） ---- */
    .mobile-logo-area {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        overflow: hidden;
        padding: 0 8px;
    }
    .mobile-logo-icon {
        font-size: 1.3rem;
        color: #0071e3;
        flex-shrink: 0;
    }
    .mobile-logo-text {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        line-height: 1.1;
    }
    .mobile-main-title {
        font-size: 0.85rem;
        font-weight: 600;
        color: #1d1d1f;
        white-space: nowrap;
    }
    .mobile-domain {
        font-size: 0.7rem;
        color: #86868b;
        white-space: nowrap;
        font-weight: 400;
    }

    /* ========================================
       3. 遮罩层
       ======================================== */
    .sidebar-mask {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1001;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }
    .sidebar-mask.active {
        opacity: 1;
        visibility: visible;
    }

    /* ========================================
       4. 左侧筛选面板（从左侧滑入）
       ======================================== */
    .filter-panel {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px;
        max-width: 85vw;
        background: #fff;
        z-index: 1002;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
        box-shadow: 5px 0 25px rgba(0,0,0,0.12);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .filter-panel.active {
        transform: translateX(0);
    }

    .filter-panel-header {
        padding: 14px 16px;
        border-bottom: 1px solid #f0f0f0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
    }
    .filter-panel-title {
        font-size: 0.95rem;
        font-weight: 600;
        color: #1d1d1f;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .filter-panel-close {
        width: 32px; height: 32px;
        border-radius: 8px;
        background: transparent;
        border: none;
        color: #86868b;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
    }
    .filter-panel-close:hover {
        background: #f5f5f7;
        color: #1d1d1f;
    }
    .filter-panel-body {
        flex: 1;
        overflow-y: auto;
        padding: 0;
        display: flex;
        flex-direction: column;
        -webkit-overflow-scrolling: touch;
    }
    /* 筛选面板内的学科卡片充满整个body */
    #filterPanelBody > #desktopSubjectFilter {
        flex: 1;
        display: flex !important;
        flex-direction: column;
        margin-bottom: 0;
        box-shadow: none;
        border: none;
        border-radius: 0;
        height: 100%;
        background: transparent;
    }
    #filterPanelBody > #desktopSubjectFilter .card-header {
        flex-shrink: 0;
        background: transparent;
        border-bottom: 1px solid #f0f0f0;
        padding: 14px 16px;
    }
    #filterPanelBody > #desktopSubjectFilter .card-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 16px;
    }
    #filterPanelBody > #desktopSubjectFilter .subject-list {
        height: 100%;
        max-height: calc(100vh - 180px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 筛选面板内的学校列表卡片（按学校查询页）充满整个body */
    #filterPanelBody > #desktopSchoolFilter {
        flex: 1;
        display: flex !important;
        flex-direction: column;
        margin-bottom: 0;
        box-shadow: none;
        border: none;
        border-radius: 0;
        height: 100%;
        background: transparent;
    }
    #filterPanelBody > #desktopSchoolFilter .card-header {
        flex-shrink: 0;
        background: transparent;
        border-bottom: 1px solid #f0f0f0;
        padding: 14px 16px;
    }
    #filterPanelBody > #desktopSchoolFilter .card-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 16px;
        display: flex;
        flex-direction: column;
    }
    #filterPanelBody > #desktopSchoolFilter .university-list {
        flex: 1;
        overflow-y: auto;
        max-height: calc(100vh - 280px);
        -webkit-overflow-scrolling: touch;
    }
    /* 学校列表卡片内的搜索框/地区选择在面板内适配 */
    #filterPanelBody > #desktopSchoolFilter .form-select {
        height: 40px;
        font-size: 0.88rem;
        border-radius: 10px;
    }
    #filterPanelBody > #desktopSchoolFilter .search-input {
        height: 40px;
        border-radius: 10px;
    }

    /* 筛选面板内的五轮评估筛选区（高校筛选+积分规则两个卡片） */
    #filterPanelBody > #desktopRankFilter {
        flex: 1;
        display: flex !important;
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #filterPanelBody > #desktopRankFilter .card {
        margin-bottom: 0;
        box-shadow: none;
        border: 1px solid #f0f0f0;
        border-radius: 12px;
    }
    #filterPanelBody > #desktopRankFilter .filter-title {
        font-size: 0.85rem;
    }
    #filterPanelBody > #desktopRankFilter .search-input {
        height: 40px;
        border-radius: 10px;
        font-size: 0.88rem;
    }
    #filterPanelBody > #desktopRankFilter .type-btn {
        height: 40px;
        font-size: 0.88rem;
        border-radius: 10px;
    }

    /* 筛选面板内的全国高校地图筛选区 - 去掉卡片外壳，内容铺满宽度 */
    #filterPanelBody > #desktopMapFilter {
        flex: 1;
        display: block !important;
        padding: 14px 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* 去掉卡片外壳：无边框无背景无阴影无圆角 */
    #filterPanelBody > #desktopMapFilter .card {
        margin-bottom: 0;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0;
        background: transparent !important;
    }
    /* 两区域之间分割线 */
    #filterPanelBody > #desktopMapFilter .card + .card {
        border-top: 1px solid #f0f0f0 !important;
        margin-top: 14px;
        padding-top: 14px;
    }
    #filterPanelBody > #desktopMapFilter .card-header {
        background: transparent !important;
        padding: 0 0 10px;
        font-size: 0.9rem;
        border-bottom: none !important;
    }
    #filterPanelBody > #desktopMapFilter .card-body {
        padding: 0;
    }
    /* 各筛选项铺满宽度 */
    #filterPanelBody > #desktopMapFilter .mb-3,
    #filterPanelBody > #desktopMapFilter > .card > .card-body > div {
        margin-bottom: 12px;
    }
    #filterPanelBody > #desktopMapFilter .d-flex.gap-2 {
        flex-direction: column !important;
        gap: 8px !important;
    }
    #filterPanelBody > #desktopMapFilter .btn-outline-primary {
        width: 100%;
        height: 40px;
        font-size: 0.88rem;
        border-radius: 10px;
    }
    #filterPanelBody > #desktopMapFilter .form-select {
        width: 100%;
        height: 40px;
        font-size: 0.88rem;
        border-radius: 10px;
    }
    #filterPanelBody > #desktopMapFilter .search-input {
        width: 100%;
        height: 40px;
        border-radius: 10px;
        font-size: 0.88rem;
    }
    #filterPanelBody > #desktopMapFilter .school-type-filter {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    #filterPanelBody > #desktopMapFilter .school-type-filter .type-btn {
        flex: 1 1 calc(33.333% - 4px);
        min-width: 0;
        height: 36px;
        font-size: 0.82rem;
        padding: 0 8px;
        border-radius: 8px;
        text-align: center;
        white-space: nowrap;
    }

    /* 筛选面板内的专业选大学卡片（本科专业目录） */
    #filterPanelBody > #desktopMajorFilter {
        flex: 1;
        display: flex !important;
        flex-direction: column;
        margin-bottom: 0;
        box-shadow: none;
        border: none;
        border-radius: 0;
        height: 100%;
        background: transparent;
    }
    #filterPanelBody > #desktopMajorFilter .card-header {
        flex-shrink: 0;
        background: transparent;
        border-bottom: 1px solid #f0f0f0;
        padding: 14px 16px;
        font-size: 0.9rem;
        display: flex !important;
        align-items: center !important;
        flex-wrap: nowrap;
        gap: 10px;
    }
    /* 隐藏提示icon，只保留文本 */
    #filterPanelBody > #desktopMajorFilter .card-header .bi-info-circle {
        display: none !important;
    }
    /* 左侧文本左对齐 */
    #filterPanelBody > #desktopMajorFilter .card-header > span {
        flex: 1;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* 右侧开关右对齐 */
    #filterPanelBody > #desktopMajorFilter .card-header .form-check {
        flex-shrink: 0;
        margin: 0;
    }
    #filterPanelBody > #desktopMajorFilter .card-body {
        flex: 1;
        overflow: visible;
        display: flex;
        flex-direction: column;
        padding: 12px 16px;
    }
    #filterPanelBody > #desktopMajorFilter .search-container {
        position: relative;
        z-index: 10;
    }
    #filterPanelBody > #desktopMajorFilter .search-input {
        height: 40px;
        border-radius: 10px;
        font-size: 0.88rem;
    }
    #filterPanelBody > #desktopMajorFilter .major-tree-container {
        flex: 1;
        max-height: calc(100vh - 220px);
        min-height: 300px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid #f0f0f0;
    }

    /* 筛选面板内的学科专业关系卡片（一级学科目录） */
    #filterPanelBody > #desktopRelationshipFilter {
        flex: 1;
        display: flex !important;
        flex-direction: column;
        margin-bottom: 0;
        box-shadow: none;
        border: none;
        border-radius: 0;
        height: 100%;
        background: transparent;
    }
    #filterPanelBody > #desktopRelationshipFilter .card-header {
        flex-shrink: 0;
        background: transparent;
        border-bottom: 1px solid #f0f0f0;
        padding: 14px 16px;
        font-size: 0.9rem;
        display: flex !important;
        align-items: center !important;
        flex-wrap: nowrap;
        gap: 10px;
    }
    /* 左侧文本左对齐 */
    #filterPanelBody > #desktopRelationshipFilter .card-header > span {
        flex: 1;
        display: block;
    }
    /* 右侧开关右对齐 */
    #filterPanelBody > #desktopRelationshipFilter .card-header .form-check {
        flex-shrink: 0;
        margin: 0;
    }
    #filterPanelBody > #desktopRelationshipFilter .card-body {
        flex: 1;
        overflow: visible;
        display: flex;
        flex-direction: column;
        padding: 12px 16px;
    }
    #filterPanelBody > #desktopRelationshipFilter .search-container {
        position: relative;
        z-index: 10;
    }
    #filterPanelBody > #desktopRelationshipFilter .search-input {
        height: 40px;
        border-radius: 10px;
        font-size: 0.88rem;
    }
    #filterPanelBody > #desktopRelationshipFilter .relation-tree-container {
        flex: 1;
        max-height: calc(100vh - 220px);
        min-height: 300px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid #f0f0f0;
        background: transparent;
    }

    /* 学科专业关系页：在移动端主内容区隐藏筛选卡片，但在左侧筛选面板里显示 */
    .col-md-4 > #desktopRelationshipFilter {
        display: none !important;
    }
    /* 移动端科普Banner：不隐藏，缩小标题文字 */
    #relationshipBanner h4 {
        font-size: 1rem !important;
    }
    #relationshipBanner p {
        font-size: 0.8rem !important;
    }
    /* 移动端科普Banner抵消container的padding-top，留15px间距 */
    #relationshipBanner {
        margin-top: calc(-39px - max(0px, env(safe-area-inset-top)));
        margin-bottom: 0.5rem;
    }
    /* 移动端表格适配 */
    #relationTableContainer .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #relationTableContainer table {
        min-width: 550px;
    }
    #relationTableContainer th:nth-child(1),
    #relationTableContainer td:nth-child(1) {
        width: 50px !important;
        min-width: 50px;
    }
    #relationTableContainer th:nth-child(2),
    #relationTableContainer td:nth-child(2) {
        width: 90px !important;
        min-width: 90px;
    }
    #relationTableContainer th:nth-child(4),
    #relationTableContainer td:nth-child(4) {
        width: 80px !important;
        min-width: 80px;
    }
    #relationTableContainer th:nth-child(5),
    #relationTableContainer td:nth-child(5) {
        width: 70px !important;
        min-width: 70px;
    }
    /* 学科专业关系页面表格首行悬浮 + 文字大小参考大学详情页 */
    #relationTableContainer thead {
        position: sticky;
        top: 0;
        z-index: 10;
        background: #f8f9fa;
    }
    #relationTableContainer thead th {
        background: #f8f9fa !important;
        box-shadow: 0 1px 0 rgba(0,0,0,0.1);
        padding: 8px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    #relationTableContainer tbody td {
        padding: 8px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    /* 本科专业名称列：自适应文字宽度（按内容收缩，不被拉宽） */
    #relationTableContainer th:nth-child(3),
    #relationTableContainer td:nth-child(3) {
        width: 1px;
        min-width: 0 !important;
        white-space: nowrap;
    }

    /* 专业选大学页面表格首行悬浮 + 文字大小参考大学详情页 */
    #mainContent .evaluation-table thead {
        position: sticky;
        top: 0;
        z-index: 10;
        background: #f8f9fa;
    }
    #mainContent .evaluation-table thead th {
        background: #f8f9fa !important;
        box-shadow: 0 1px 0 rgba(0,0,0,0.1);
        padding: 8px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    #mainContent .evaluation-table tbody td {
        padding: 8px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* 一分一段表页面：在移动端主内容区隐藏筛选卡片，但在左侧筛选面板里显示 */
    .col-md-3 > #desktopScoreRankFilter {
        display: none !important;
    }
    /* 筛选面板内的一分一段表筛选卡片 */
    #filterPanelBody > #desktopScoreRankFilter {
        flex: 1;
        display: flex !important;
        flex-direction: column;
        margin-bottom: 0;
        box-shadow: none;
        border: none;
        border-radius: 0;
        height: 100%;
        background: transparent;
    }
    #filterPanelBody > #desktopScoreRankFilter .card-header {
        display: none;
    }
    #filterPanelBody > #desktopScoreRankFilter .card-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 16px;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    #filterPanelBody > #desktopScoreRankFilter .form-label {
        font-size: 0.85rem;
        font-weight: 500;
        margin-bottom: 8px;
    }
    #filterPanelBody > #desktopScoreRankFilter .form-select {
        height: 40px;
        font-size: 0.88rem;
        border-radius: 10px;
    }
    #filterPanelBody > #desktopScoreRankFilter .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    #filterPanelBody > #desktopScoreRankFilter .btn {
        padding: 6px 12px;
        font-size: 0.85rem;
        border-radius: 8px;
    }
    /* 移动端查询分数卡片调整 */
    #scoreQueryCard .card-header {
        font-size: 0.95rem;
    }
    #scoreQueryCard .form-control {
        height: 44px;
        font-size: 1rem;
    }
    #scoreQueryCard .btn-primary {
        height: 44px;
        font-size: 0.95rem;
    }
    /* 移动端表格适配 */
    #scoreTable thead {
        position: sticky;
        top: 0;
        background: #f8f9fa;
        z-index: 10;
    }
    #scoreTable thead th {
        background: #f8f9fa !important;
        box-shadow: 0 1px 0 rgba(0,0,0,0.1);
    }

    /* ===== 软科排名页（rankings）移动端适配 ===== */
    /* 筛选面板内的排名筛选卡片 - 去掉卡片外壳，内容铺满宽度 */
    #filterPanelBody > #desktopRankingsFilter {
        flex: 1;
        display: flex !important;
        flex-direction: column;
        padding: 12px 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 0;
        box-shadow: none;
        border: none;
        border-radius: 0;
        height: 100%;
        background: transparent;
    }
    #filterPanelBody > #desktopRankingsFilter .card-header {
        display: none !important;
    }
    #filterPanelBody > #desktopRankingsFilter .card-body {
        flex: 1;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 14px;
    }
    #filterPanelBody > #desktopRankingsFilter .form-label {
        font-size: 0.85rem;
        font-weight: 500;
        margin-bottom: 8px;
    }
    #filterPanelBody > #desktopRankingsFilter .search-input,
    #filterPanelBody > #desktopRankingsFilter .form-select {
        height: 40px;
        font-size: 0.88rem;
        border-radius: 10px;
    }
    #filterPanelBody > #desktopRankingsFilter .rank-type-filter .type-btn {
        height: 40px;
        font-size: 0.88rem;
        border-radius: 10px;
    }

    /* 分类标签横向滚动 */
    #categoryTabs.rank-category-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px !important;
        margin-bottom: 12px !important;
    }
    #categoryTabs.rank-category-tabs::-webkit-scrollbar { display: none; }
    #categoryTabs.rank-category-tabs .btn-cat {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 6px 14px;
        font-size: 0.82rem;
    }

    /* 排名表格紧凑化 + 横向滑动（不换行） */
    .ranking-table {
        margin-bottom: 0;
        white-space: nowrap;
    }
    .ranking-table thead th {
        font-size: 0.78rem;
        padding: 8px 8px;
        white-space: nowrap;
    }
    .ranking-table tbody td {
        padding: 8px 8px;
        font-size: 0.85rem;
        vertical-align: middle;
        white-space: nowrap;
    }
    .ranking-table .rank-num {
        min-width: 28px;
        font-size: 0.85rem;
    }
    .ranking-table .university-logo-thumb {
        width: 26px;
        height: 26px;
    }
    .ranking-table .uni-link,
    .ranking-table .uni-text {
        font-size: 0.85rem;
    }
    .ranking-table .rank-badge {
        font-size: 0.7rem;
    }

    /* 分页控件移动端紧凑化 */
    #rankPagination {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px !important;
    }
    #rankPagination > .d-flex {
        justify-content: center;
    }
    #rankPageInfo {
        font-size: 0.78rem;
    }
    #rankPageSize {
        font-size: 0.82rem;
    }
    .rank-page-nav {
        justify-content: center;
        flex-wrap: wrap;
    }
    .rank-page-nav .page-btn {
        min-width: 30px;
        height: 30px;
        font-size: 0.8rem;
        padding: 0 6px;
    }

    /* ========================================
       5. 右侧导航菜单（从右侧滑入）
       ======================================== */
    .mobile-sidebar {
        position: fixed;
        top: 0; right: 0; bottom: 0;
        width: 280px;
        max-width: 85vw;
        background: #fff;
        z-index: 1002;
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
        box-shadow: -5px 0 25px rgba(0,0,0,0.12);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .mobile-sidebar.active {
        transform: translateX(0);
    }

    .sidebar-header {
        padding: 14px 16px;
        border-bottom: 1px solid #f0f0f0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
    }
    .sidebar-logo {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .sidebar-logo-icon {
        font-size: 1.3rem;
        color: #0071e3;
    }
    .sidebar-logo-text-wrapper {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        line-height: 1.1;
    }
    .sidebar-logo-text {
        font-size: 0.85rem;
        font-weight: 600;
        color: #1d1d1f;
        white-space: nowrap;
    }
    .sidebar-logo-domain {
        font-size: 0.65rem;
        color: #86868b;
        white-space: nowrap;
        font-weight: 400;
    }
    .sidebar-close-btn {
        width: 32px; height: 32px;
        border-radius: 8px;
        background: transparent;
        border: none;
        color: #86868b;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
    }
    .sidebar-close-btn:hover {
        background: #f5f5f7;
        color: #1d1d1f;
    }

    .sidebar-content {
        flex: 1;
        overflow-y: auto;
        padding: 8px 12px 20px;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-menu-item {
        display: flex;
        align-items: center;
        padding: 14px 16px;
        border-radius: 12px;
        color: #1d1d1f;
        text-decoration: none;
        font-size: 0.9rem;
        font-weight: 500;
        transition: background 0.15s;
    }
    .sidebar-menu-item:hover {
        background: rgba(0,113,227,0.06);
    }
    .sidebar-menu-item:active {
        background: rgba(0,113,227,0.1);
        transform: scale(0.98);
    }
    .sidebar-menu-item.active {
        background: #0071e3;
        color: #fff;
    }
    .sidebar-menu-icon {
        width: 24px; height: 24px;
        margin-right: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.05rem;
        flex-shrink: 0;
    }
    .sidebar-menu-text {
        flex: 1;
    }

    /* 父菜单折叠子菜单 */
    .sidebar-menu-group .sidebar-menu-parent .sidebar-menu-arrow {
        transition: transform 0.25s;
        font-size: 0.8rem;
        opacity: 0.6;
    }
    .sidebar-menu-group.expanded .sidebar-menu-parent .sidebar-menu-arrow {
        transform: rotate(180deg);
    }

    .sidebar-submenu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.28s ease;
        padding-left: 8px;
    }
    .sidebar-menu-group.expanded .sidebar-submenu {
        max-height: 420px;
    }
    .sidebar-submenu-item {
        padding-left: 28px;
        font-size: 0.85rem;
        font-weight: 400;
    }
    .sidebar-submenu-item.disabled {
        color: #aeaeb2;
        cursor: not-allowed;
        opacity: 0.75;
    }
    .sidebar-submenu-item.disabled:hover {
        background: transparent;
    }
    .sidebar-menu-badge {
        font-size: 0.62rem;
        color: #fff;
        background: #adb5bd;
        padding: 1px 6px;
        border-radius: 8px;
        margin-left: 6px;
    }

    .sidebar-divider {
        height: 1px;
        background: #f0f0f0;
        margin: 8px 16px;
    }

    .sidebar-footer {
        padding: 14px 16px;
        border-top: 1px solid #f0f0f0;
        flex-shrink: 0;
        text-align: center;
        font-size: 0.72rem;
        color: #86868b;
    }

    /* ========================================
       6. 主内容区域
       ======================================== */
    .container {
        padding-top: 64px;
        max-width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* ========================================
       7. 移动端顶部紧凑筛选栏（下拉选择）
       ======================================== */
    .mobile-filter-bar {
        display: flex !important;
        margin-bottom: 12px;
        padding: 0;
    }
    .mobile-filter-selects {
        display: flex;
        gap: 8px;
        width: 100%;
        align-items: center;
    }
    .mobile-select {
        flex: 1;
        height: 36px;
        padding: 0 28px 0 10px;
        border-radius: 10px;
        border: 1px solid rgba(209,209,214,0.8);
        background: #fff;
        font-size: 0.85rem;
        color: #1d1d1f;
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2386868b' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 8px center;
        background-size: 12px;
    }
    .mobile-select:focus {
        outline: none;
        border-color: #0071e3;
        box-shadow: 0 0 0 3px rgba(0,113,227,0.1);
    }
    /* 列表内搜索框 */
    .mobile-list-search {
        display: block !important;
        margin-bottom: 12px;
    }
    .mobile-list-search .search-input {
        height: 40px;
        border-radius: 10px;
        font-size: 0.9rem;
        background: #f8f9fa;
        border: 1px solid rgba(209,209,214,0.6);
    }
    .mobile-list-search .search-input:focus {
        background: #fff;
        border-color: #0071e3;
    }
    /* 隐藏桌面端筛选卡片和结果区头部搜索 */
    #desktopFilterCard,
    .filter-search-card,
    .search-section {
        display: none !important;
    }
    /* 结果头部标题行优化 - 标题左对齐占满整行 */
    .result-card .card-header {
        padding: 12px 14px;
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        flex-direction: row;
        gap: 8px;
    }
    .result-card .card-header #resultHeader {
        flex: 1;
        text-align: left;
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ========================================
       新手引导气泡（首次提示点击筛选图标）
       ======================================== */
    .filter-menu-btn {
        position: relative;
    }
    .filter-menu-btn.guide-pulse::before {
        content: '';
        position: absolute;
        inset: -6px;
        border-radius: 50%;
        border: 2px solid #0071e3;
        animation: guidePulse 1.4s ease-out 3;
        pointer-events: none;
    }
    @keyframes guidePulse {
        0% { transform: scale(0.8); opacity: 1; }
        100% { transform: scale(1.6); opacity: 0; }
    }
    .filter-guide-bubble {
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: #0071e3;
        color: #fff;
        font-size: 0.78rem;
        font-weight: 500;
        padding: 6px 12px;
        border-radius: 8px;
        white-space: nowrap;
        z-index: 1001;
        box-shadow: 0 3px 12px rgba(40, 110, 167, 0.35);
        animation: guideBubbleIn 0.4s ease-out 1s both;
        pointer-events: none;
    }
    .filter-guide-bubble::before {
        content: '';
        position: absolute;
        left: -5px;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-right: 6px solid #0071e3;
    }
    .filter-guide-bubble.hiding {
        animation: guideBubbleOut 0.3s ease-out forwards;
    }
    @keyframes guideBubbleIn {
        from { opacity: 0; transform: translate(-8px, -50%); }
        to { opacity: 1; transform: translate(0, -50%); }
    }
    @keyframes guideBubbleOut {
        from { opacity: 1; transform: translate(0, -50%); }
        to { opacity: 0; transform: translate(-8px, -50%); }
    }

    /* ========================================
       8. 首页筛选面板（内容区）
       ======================================== */
    .mobile-filter-panel-wrapper {
        display: block !important;
        margin-bottom: 16px;
    }
    /* 在移动端主内容区隐藏筛选卡片，但在左侧筛选面板里显示 */
    .row > [class*="col-"] > #desktopSubjectFilter,
    .col-md-3 > #desktopSubjectFilter,
    .row > [class*="col-"] > #desktopSchoolFilter,
    .col-md-3 > #desktopSchoolFilter,
    .row > [class*="col-"] > #desktopRankFilter,
    .col-md-3 > #desktopRankFilter,
    .row > [class*="col-"] > #desktopMapFilter,
    .col-md-3 > #desktopMapFilter,
    .filter-sidebar > #desktopMapFilter,
    .row > [class*="col-"] > #desktopMajorFilter,
    .col-md-4 > #desktopMajorFilter,
    .row > [class*="col-"] > #desktopScoreRankFilter,
    .col-md-3 > #desktopScoreRankFilter,
    .row > [class*="col-"] > #desktopRankingsFilter,
    .col-md-3 > #desktopRankingsFilter {
        display: none !important;
    }

    /* 按学校查询页：移动端隐藏桌面端筛选卡片和学校列表占位列 */
    .col-md-3.sticky-top:empty {
        display: none;
    }

    /* 五轮评估页：门类Tab横向滚动 */
    #categoryTabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 6px !important;
    }
    #categoryTabs::-webkit-scrollbar { display: none; }
    .category-tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 8px 14px !important;
        font-size: 0.88rem !important;
        margin-right: 6px !important;
    }

    /* 五轮评估页：排行榜卡片布局优化 - 大学信息和积分保持在同一行 */
    #rankList .rank-card .card-body > .d-flex {
        flex-wrap: nowrap !important;
        gap: 8px;
    }
    #rankList .rank-card .card-body > .d-flex > .d-flex {
        min-width: 0;
        flex: 1;
    }
    /* 大学信息区域 */
    #rankList .rank-card .card-body > .d-flex > .d-flex .rank-number {
        width: 36px !important;
        height: 36px !important;
        font-size: 1.2rem !important;
        flex-shrink: 0;
    }
    #rankList .rank-card .card-body > .d-flex > .d-flex > div:not(.rank-number) {
        min-width: 0;
        flex: 1;
    }
    #rankList .rank-card .card-body > .d-flex > .d-flex h4 {
        font-size: 0.95rem !important;
        margin-bottom: 0.3rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #rankList .rank-card .card-body > .d-flex > .d-flex h4 a {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        max-width: 120px;
    }
    #rankList .rank-card .card-body > .d-flex > .d-flex h4 span.ms-2 {
        font-size: 0.75rem !important;
    }
    /* 积分展示区域 */
    #rankList .rank-card .card-body > .d-flex > .text-end {
        flex-shrink: 0;
        min-width: 70px;
    }
    #rankList .rank-card .card-body > .d-flex > .text-end .score-display {
        font-size: 1.4rem !important;
        line-height: 1.2;
    }
    #rankList .rank-card .card-body > .d-flex > .text-end .score-unit {
        font-size: 0.7rem !important;
    }
    #rankList .rank-card .card-body > .d-flex > .text-end .text-muted.small {
        font-size: 0.65rem !important;
        white-space: nowrap;
    }
    /* 学科列表区域 */
    #rankList .rank-card .card-body > .mt-3 {
        padding-top: 8px !important;
    }
    #rankList .rank-card .card-body > .mt-3 h6 {
        font-size: 0.8rem !important;
    }
    #rankList .rank-card .card-body .category-badge {
        font-size: 0.7rem !important;
        padding: 3px 6px !important;
    }
    #rankList .rank-card .card-body .disciplines-block {
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
        border-left-width: 2px !important;
        line-height: 1.5;
    }

    /* 全国高校地图页：移动端布局优化 */
    .filter-sidebar {
        display: none !important;
    }
    /* 地图模式：地图与名册堆叠，地图高度自适应 */
    #mapViewWrapper .row > .col-lg-8,
    #mapViewWrapper .row > .col-lg-4 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
    #chinaMapCanvas {
        height: 380px !important;
    }

    /* 移动端地图缩放按钮调整 */
    .map-zoom-controls {
        bottom: 10px;
        right: 10px;
        gap: 4px;
    }

    .map-zoom-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        border-radius: 6px;
    }
    .map-sidebar-card {
        height: auto !important;
        max-height: 400px;
    }
    #mapSidebarList {
        max-height: 320px !important;
    }
    /* 地图卡片头部提示文字移动端隐藏，节省空间 */
    .map-card .text-muted.small {
        display: none;
    }
    /* 联盟Banner移动端精简 */
    .alliance-banner-container {
        margin-bottom: 12px;
        perspective: none;
    }
    .alliance-banner {
        padding: 14px 16px;
        border-radius: 12px;
        box-shadow: none !important;
    }
    .alliance-banner::before {
        display: none;
    }
    .alliance-banner:hover {
        transform: none;
    }
    .alliance-banner-title {
        font-size: 0.92rem !important;
        -webkit-text-fill-color: #fff !important;
    }
    .alliance-banner-desc {
        display: none;
    }
    .alliance-banner-btn {
        padding: 6px 12px;
        font-size: 0.78rem;
        background: rgba(255, 255, 255, 0.15);
    }
    .alliance-banner:hover .alliance-banner-btn {
        transform: none;
    }

    .grade-filter {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 6px 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .grade-filter::-webkit-scrollbar { display: none; }

    /* ========================================
       8. 杂项
       ======================================== */
    .back-to-top {
        width: 44px !important; height: 44px !important;
        line-height: 44px !important;
        font-size: 1.1rem !important;
        bottom: 20px !important; right: 20px !important;
        border-radius: 12px;
        background: #0071e3 !important;
        color: #fff !important;
    }
    .search-section { width: 100% !important; }
    #universitySearch {
        width: 100%;
        font-size: 0.9rem;
        height: 40px;
        border-radius: 10px;
    }
    .result-card .card-body { padding: 12px; }
    #resultHeader { font-size: 0.95rem; }

    .mobile-visible { display: block !important; }
    .mobile-hidden { display: none !important; }
    .desktop-visible { display: none !important; }
    .desktop-hidden { display: block !important; }

    /* ========================================
       大学详情页 移动端适配
       ======================================== */

    /* 0. 隐藏学校校徽 */
    .university-info-card .logo-container {
        display: none !important;
    }
    .university-info-card .row > .col-md-4 {
        display: none !important;
    }
    .university-info-card .row > .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .university-info-card .university-name {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    .university-info-card .detail-item {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }
    .university-info-card .detail-item i {
        font-size: 0.9rem;
        width: 20px;
    }
    .university-info-card .card-header,
    .evaluation-card .card-header {
        padding: 0.6rem 0.9rem;
        font-size: 0.95rem;
    }
    .university-info-card .card-body,
    .evaluation-card .card-body {
        padding: 0.9rem;
    }
    .university-info-card .btn-back {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }

    /* 1. 评估轮次移入内容区域（由 university-detail.js 移动 #roundFilterWrapper） */
    .evaluation-card .card-body > #roundFilterWrapper {
        display: flex !important;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 12px;
        padding: 10px 12px;
        background: rgba(245, 245, 247, 0.7);
        border-radius: 12px;
    }
    .evaluation-card .card-body > #roundFilterWrapper > .text-muted {
        font-size: 0.8rem;
        margin: 0;
    }
    .evaluation-card .card-body > #roundFilterWrapper .type-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: 10px;
    }

    /* 1 & 2. 参评学科数单独一行；子评分（所有学科）同一行不换行 */
    .evaluation-card .stats-overview {
        --bs-gutter-x: 8px;
        margin: 0;
    }
    .evaluation-card .stats-overview > .col-md-3,
    .evaluation-card .stats-overview > .col-md-9 {
        flex: 0 0 100%;
        max-width: 100%;
        padding: 0;
    }
    .evaluation-card .stats-overview .total-card {
        margin-bottom: 12px;
    }
    .evaluation-card .stats-overview .total-card .card-body {
        padding: 12px;
    }
    .evaluation-card .stats-overview .total-card h3 {
        font-size: 1.4rem;
    }

    /* 子评分卡片：单行排列，等宽自适应 */
    .evaluation-card .grades-container {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        margin: 0;
    }
    .evaluation-card .grades-container > .col {
        flex: 1 1 0%;
        min-width: 0;
        max-width: none;
        padding: 0 3px;
    }
    .evaluation-card .grades-container .stat-card {
        box-shadow: none;
    }
    .evaluation-card .grades-container .stat-card .card-body {
        padding: 8px 2px;
    }
    .evaluation-card .grades-container .stat-card h3 {
        font-size: 1.05rem;
        line-height: 1.1;
    }
    .evaluation-card .grades-container .stat-card p {
        font-size: 0.66rem;
        line-height: 1;
        margin: 0;
    }

    /* 学科分类筛选按钮紧凑化 */
    .evaluation-card .category-filter-container {
        margin: 1rem 0;
    }
    .evaluation-card .category-btn {
        padding: 6px 12px;
        font-size: 0.82rem;
    }

    /* alliances页面返回按钮样式优化 */
    .d-flex.justify-content-between .btn-outline-secondary {
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
    }
    .d-flex.justify-content-between .btn-outline-secondary i {
        display: inline-flex;
        align-items: center;
    }

    /* 评估结果表格紧凑化 + 支持左右滑动查看右侧列 */
    .evaluation-card .evaluation-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .evaluation-card .evaluation-table {
        min-width: 640px;
    }
    .evaluation-card .evaluation-table th,
    .evaluation-card .evaluation-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
}

/* ========================================
   桌面端隐藏移动端元素
   ======================================== */
@media (min-width: 769px) {
    .mobile-top-nav,
    .mobile-sidebar,
    .filter-panel,
    .sidebar-mask,
    .mobile-filter-panel-wrapper { display: none !important; }
    #desktopSubjectFilter { display: block; }
}

/* ========================================
   全局优化
   ======================================== */
* {
    -webkit-tap-highlight-color: transparent;
}

@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .mobile-top-nav {
            height: calc(52px + max(0px, env(safe-area-inset-top)));
            padding-top: max(10px, env(safe-area-inset-top));
        }
        .filter-panel,
        .mobile-sidebar {
            padding-top: max(0px, env(safe-area-inset-top));
        }
        .container {
            padding-top: calc(45px + max(0px, env(safe-area-inset-top)));
        }
    }
}