/* public/css/main.style.css */
/* CSS重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

* {
    -webkit-tap-highlight-color: transparent;
}

/* 2. (可选但推荐) 禁用长按时的菜单或文本选择 */
/* 这会让你的网页更像一个原生App */
button,
a,
.nav-arrow,
.logo,
.search-button,
.mobile-nav-trigger,
.mobile-search-trigger {
    -webkit-touch-callout: none;
    /* 禁用长按菜单 */
    -webkit-user-select: none;
    /* 禁用文本选择 */
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 3. (重要) 重新为输入框和文本域启用文本选择 */
/* 这样用户依然可以正常输入和编辑文字 */
input,
textarea {
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}

html {
    overflow-y: scroll;
    /* 始终显示垂直滚动条轨道，防止页面跳动 */
}

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #fdfdfd;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 0;
}

header {
    width: 100%;
    background-color: #fdfdfd;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
    position: sticky;
    top: 0;
    z-index: 1000;
    transform: translateZ(0);
}

.header-content {
    display: grid;
    /* 保持三列布局：Logo自动宽度 | 搜索框占满剩余 | 导航栏自动宽度 */
    grid-template-columns: auto 1fr auto;

    /* 【关键修改 1】将 Grid 统一间距设为 0，改用 Margin 单独控制 */
    gap: 0;

    align-items: center;
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px 0;
}

/* 【关键修改 2】控制 Logo 右侧间距 (Logo <-> 搜索框) */
/* 使用 clamp 让这个间距是“动态”的：
   - 空间充足时：最大 100px
   - 窗口变窄时：优先压缩这个间距，最小缩到 20px
*/
.logo {
    margin-right: clamp(20px, 10vw, 232px);
}

/* 【关键修改 3】控制 Nav 左侧间距 (搜索框 <-> Nav) */
/* 这是一个“固定”间距：无论窗口怎么变窄，这个 100px 雷打不动 */

.logo a img {
    height: 45px;
    display: block;
}

.search-bar {
    padding: 0;
    text-align: left;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 525px;
}

.search-container input {
    width: 100%;
    padding: 12px 45px 12px 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}

.search-button {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    background: none;
    border: none;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;

    color: #aaa;
    cursor: pointer;
    transition: color 0.2s ease;
}

.search-button:hover {
    color: #3B1977;
}


.search-container input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}

.main-content {
    display: grid;
    grid-template-columns: clamp(180px, 15vw, 250px) 1fr;
    gap: 40px;
    margin-top: 15px;
    align-items: start;
    position: relative;
    transition: grid-template-columns 0.7s ease, gap 0.7s ease;
}

body.sidebar-collapsed .main-content {
    grid-template-columns: 0px 1fr;
    gap: 0px;
}

main {
    flex: 1;
}

.sidebar {
    margin-top: 179px;
    transition: opacity 0.25s ease-in-out 0.62s;
}

.sidebar-header {
    display: none;
}

body.sidebar-collapsed .sidebar {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s linear;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.results-area {
    width: auto;
    min-width: 0;
    transition: width 0.7s ease 0.1s;
}

body.sidebar-collapsed .results-area {
    width: 100%;
}

.view-toggle {
    display: flex;
    gap: 10px;

}

.view-toggle button {
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
    cursor: pointer;
}

.view-toggle button svg {
    fill: #d1d1d1;
    display: block;
    width: 24px;
    height: 24px;
}

.view-toggle button.active svg {
    fill: #3B1977;
}

.sidebar h3 {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 5px;
    padding-right: 9px;
    font-size: 1.1rem;
    color: #3B1977;
}

.sidebar ul {
    list-style: none;
    font-weight: 450;
    padding-left: 4px;
    padding-right: 8px;
}

.sidebar li {
    margin-bottom: 15px;
    display: block;
}

.sidebar-header-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.sidebar-header-text {
    margin-right: 10px;
}

.mini-sort-controls {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #eef2f5;
    padding: 2px;
    border-radius: 20px;
    box-shadow: inset 1px 1px 3px #dbe0e3, inset -1px -1px 3px #ffffff;
    position: relative;
    margin-top: 5px;
    height: 28px;
}

.mini-sort-controls button {
    background: none;
    border: none;
    width: 28px;
    height: 24px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    color: #adb5bd;
    transition: color 0.3s ease;
    z-index: 2;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.mini-sort-controls button.active {
    color: #3B1977;
}

.mini-sort-controls .mini-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 28px;
    height: 24px;
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 1px 1px 3px #dbe0e3, -1px -1px 3px #ffffff;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1;
}

.mini-sort-controls button[data-sort="zh"].active~.mini-slider {
    transform: translateX(28px);
}

.custom-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 5px 5px 5px 10px;
}

.custom-checkbox .label-text {
    flex-grow: 1;
    margin-right: 15px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.custom-checkbox input {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
}

.checkmark {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 1px solid #ccc;
    border-radius: 3px;
    flex-shrink: 0;
}

.custom-checkbox input:checked~.checkmark {
    background-color: #3B1977;
    border-color: #3B1977;
}

.custom-checkbox input:checked~.checkmark::after {
    content: '';
    position: absolute;
    display: block;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.label-text {
    line-height: 1.2;
    font-weight: 500;
    color: #000000b5;
}

.label-text .sub-text {
    display: block;
    color: #888;
    font-size: 0.9em;
    font-weight: 400;
    margin-top: 4px;
}

.filter-group {
    margin-bottom: 20px;
}

.featured-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.featured-control h3 {
    gap: 5px;
    margin-bottom: 3px;
}

.collapsible-header {
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}


.collapsible-header .nav-arrow {
    transition: transform 0.3s ease;
    transform: rotate(180deg);

    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: auto;
    margin-right: -4px;
    margin-top: 3px;
}

.collapsible-header.collapsed .nav-arrow {
    transform: rotate(0deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 1s ease-in-out;
    max-height: 10000px;
}

.collapsible-content.hidden {
    transition: max-height 0.25s ease-in-out;
    max-height: 0;
}

.sidebar .collapsible-content li {
    border-radius: 10px;
    transition: background-color 0.2s ease;
    margin: 5px -5px 0px -5px;
}

.sidebar .collapsible-content li:hover {
    background-color: #f1e9ff;
}

.sidebar .collapsible-content li.no-hover:hover {
    background-color: transparent;
    cursor: default;
}

.custom-checkbox * {
    cursor: pointer;
}


.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}


.results-header .title h1 {
    font-size: 2.5rem;
    font-weight: bold;
    color: #3B1977;
    margin: 0;
    line-height: 1.2;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.results-header .title p {
    font-size: 1.5rem;
    font-weight: 500;
    color: #3B1977;
    min-height: 2.15rem;
}

.results-header .title {
    padding-top: 0px;
    min-width: 0;
}

.category-badge,
.search-category-badge {
    display: inline-block;
    color: #3B1977;
    border: 1.5px solid #3B1977;
    background-color: transparent;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 0px;
    line-height: 1;
    transition: all 0.2s ease;
}

.category-badge:hover {
    background-color: #3B1977;
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(59, 25, 119, 0.2);
}

@media (max-width: 768px) {
    .category-badge {
        font-size: 0.7rem;
        padding: 3px 6px;
        margin-bottom: 5px;
    }
}

.controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-count {
    color: #666;
    font-size: 1rem;
    font-weight: 600;
}


.filter-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filter-controls>.custom-checkbox {
    justify-content: flex-start;
    gap: 8px;
}

.filter-controls .filter-control-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-label {
    color: #3B1977;
    font-weight: 700;
    white-space: nowrap;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: clamp(2px, 2vw, 35px);
    row-gap: clamp(2px, 3vw, 55px);
    margin-top: 30px;
    align-items: end;
    opacity: 1;
    transition: row-gap 0.7s ease, opacity 0.2s ease-out;
    ;

}

body.sidebar-collapsed .results-grid {
    row-gap: clamp(2px, 4.4vw, 80px);
    transition: row-gap 0.7s ease, opacity 0.2s ease-out;
    ;

}

.results-grid.fade-start {
    opacity: 0 !important;
    transition: none !important;
    /* 关键：进入隐身状态时不需要动画，瞬间隐藏 */
}

.results-grid:not(:has(.book-item)) {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0px;
}

.no-results-message {
    text-align: center;
    line-height: 1.6;
    color: #6c757d;
    font-size: 1.5rem;
}

.no-results-zh {
    font-size: 0.9em;
    color: #868e96;
}

.results-grid>p {
    grid-column: auto;
}

.results-grid.compact-view {
    grid-template-columns: repeat(5, 1fr);
    row-gap: clamp(2px, 2.4vw, 44px);
    transition: row-gap 0.7s ease, opacity 0.2s ease-out;
}

body.sidebar-collapsed .results-grid.compact-view {
    row-gap: clamp(2px, 3vw, 55px);
    transition: row-gap 0.7s ease, opacity 0.2s ease-out;

}

.book-item {
    position: relative;
    border-radius: 5px;
    box-shadow:
        0px 2px 4px 0px rgba(0, 0, 0, 0.12),
        0px 8px 16px 0px rgba(0, 0, 0, 0.16);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #ffffff;
    width: fit-content;
    margin: 0 auto;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    flex-direction: column;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

.book-cover-wrapper {
    position: relative;
    background-color: #e9ecef;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    z-index: 1;
}


.book-cover-wrapper img {
    height: clamp(10px, 17vw, 280px);
    width: auto;
    display: block;
    border-radius: 5px;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
    image-rendering: -webkit-optimize-contrast;
    transition: height 0.7s ease;
}

.results-grid.compact-view .book-cover-wrapper img {
    height: clamp(10px, 14vw, 230px);
    transition: height 0.7s ease;
}

body.sidebar-collapsed .book-cover-wrapper img,
body.sidebar-collapsed .no-cover-placeholder {
    height: clamp(10px, 24vw, 340px);
    transition: height 0.7s ease;
}

body.sidebar-collapsed .results-grid.compact-view .book-cover-wrapper img,
body.sidebar-collapsed .results-grid.compact-view .no-cover-placeholder {
    height: clamp(10px, 18vw, 280px);
    transition: height 0.7s ease;
}




.year-badge {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    background-color: #f0ad4e;
    color: white;
    padding: 2.5px 7px;
    border-radius: 0 5px 0 5px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 2;
    transform: translateZ(0);

}

.results-grid:not(.compact-view) .year-badge {
    transform: translateZ(0);
    transition:
        padding 0.7s ease,
        font-size 0.7s ease;
}

.results-grid.compact-view .year-badge {
    transform: translateZ(0);
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 700;
    transition:
        padding 0.7s ease,
        font-size 0.7s ease;
}

body.sidebar-collapsed .results-grid:not(.compact-view) .year-badge {
    transform: translateZ(0);
    padding: 3px 9px;
    font-size: 0.95rem;
    transition:
        padding 0.7s ease,
        font-size 0.7s ease;
}


body.sidebar-collapsed .results-grid.compact-view .year-badge {
    transform: translateZ(0);
    padding: 2.5px 7px;
    font-size: 0.85rem;
    transition:
        padding 0.7s ease,
        font-size 0.7s ease;
}



.book-item:hover {
    transform: scale(1.05) translateZ(0) translateY(-13px);
    box-shadow:
        /* 第一层: 近处阴影变得更深、更远 */
        0px 4px 8px 0px rgba(0, 0, 0, 0.12),
        /* 第二层: 远处阴影变得更弥散、更深 */
        0px 12px 28px 0px rgba(0, 0, 0, 0.16);
    z-index: 10;
}

.book-item.expanded {
    overflow: visible;
    z-index: 11;
}

.book-details {
    display: none;
}

/* =================================================================
   END: Book Grid & Item Styles
   ================================================================= */
@media (min-width: 769px) {
    nav {
        margin-left: clamp(20px, 3vw, 120px);
    }

    .results-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        overflow: hidden;
    }

    .results-header .title {
        flex: 1;
        min-width: 0;
        margin-right: 20px;
    }

    .results-header .title h1 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;

        display: block;
        width: 100%;

        line-height: 1.2;
        padding-bottom: 5px;
        margin-bottom: -5px;
    }

    .book-details {
        display: flex;
        position: absolute;
        top: 0;
        min-height: 100%;
        height: auto;
        grid-column: 1 / -1;
        grid-row: 1 / -1;
        z-index: 0;
        padding: 25px 30px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(60px) saturate(1000%);
        -webkit-backdrop-filter: blur(60px) saturate(1000%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s ease, visibility 0s ease, box-shadow 0.3s ease;
        color: #2c3e50;
        font-size: 0.9rem;
        font-weight: 600;
        line-height: 1.7;
        display: flex;
        flex-direction: column;
        justify-content: center;
        box-shadow: 5px 0px 20px -5px rgba(0, 0, 0, 0.1);
        left: 100%;
        margin-left: 0;
        margin-top: 20px;
        border-radius: 0 8px 8px 8px;
    }

    /* =================================================================
   START: Desktop-Only Dynamic Scaling (Container Queries)
   仅在电脑端生效：内容大小随容器宽度自动缩放
   ================================================================= */

    @media (min-width: 769px) {

        /* 1. 激活容器查询：告诉浏览器监测 .book-details 的宽度 */
        .book-details {
            container-type: inline-size;
            container-name: book-details-container;
            padding: clamp(5px, 1.5cqi, 25px) clamp(6px, 1.8cqi, 30px) !important;
            margin-top: clamp(15px, 1.3cqi, 20px);
        }

        .results-grid.compact-view .book-details {
            margin-top: clamp(15px, 1.4cqi, 18px);
        }

        /* 2. 标题文字大小 */
        .book-details h3,
        body.sidebar-collapsed .results-grid.compact-view .book-details h3 {
            font-size: clamp(0.7rem, 5cqi, 1.3rem) !important;

        }

        /* 3. 正文基础文字 (Label, Strong, Span) */
        .book-details,
        .book-details strong,
        .book-details .label-text,
        .book-details .year-value,
        .book-details .edition-text span {
            /* 最小 0.85rem，基准 3.2%，最大 1rem */
            font-size: clamp(0.7rem, 3.2cqi, 0.9rem);
        }

        .book-details .title-with-donor {
            margin-bottom: clamp(4px, 2.5cqi, 8px) !important;
        }

        /* 4. 分组线条的间距 */
        .book-details .detail-group {

            padding-top: clamp(8px, 2.2cqi, 14px) !important;
        }

        /* 5. 标签胶囊 (Tags) */
        .tag-capsule {
            font-size: clamp(0.6rem, 3cqi, 0.8rem) !important;
            padding: 0.1cqi 1cqi !important;
            gap: 0.8cqi !important;
        }

        .tags-group {
            gap: clamp(10px, 4cqi, 30px) !important;
        }

        /* 6. 图标与圆点大小 */
        .status-dot {
            width: clamp(10px, 3cqi, 18px) !important;
            height: clamp(10px, 3cqi, 18px) !important;
        }

        .availability-item .icon-help {
            width: clamp(12px, 2.8cqi, 16px) !important;
            height: clamp(12px, 2.8cqi, 16px) !important;
            font-size: clamp(10px, 2cqi, 12px) !important;
            margin-left: 1cqi !important;
            margin-right: 0cqi;
        }


        .user-page .book-details .availability-item .icon-help::after {
            left: auto;
            /* Unset the default 'left' */
            right: clamp(14px, 4.2cqi, 25px) !important;
            /* Position the arrow near the right corner of the icon */
            transform: none;
            /* Remove any centering transform */
        }

        .status-dot,
        .icon-help {
            flex-shrink: 0 !important;
        }

        /* 7. 下载图标大小 */
        .download-icon img {
            height: clamp(12px, 3.6cqi, 18px) !important;
        }

        /* 8. 捐赠者图标大小 */
        .donor-info-icon img {
            height: clamp(24px, 5.2cqi, 32px) !important;
            width: auto !important;
        }

        /* 9. 下载区域的间距布局 */
        .book-details .download-row {
            gap: clamp(0px, 8cqi, 50px) !important;
        }

        .download-row {
            grid-template-columns: minmax(0, 1fr) clamp(120px, 36cqi, 500px) !important;

            gap: 0px;
        }

        .download-rows-container {
            gap: clamp(0px, 0.7cqi, 3px) !important;
        }

        .book-details .icon-group {
            gap: 4cqi !important;
        }

        .book-details .availability-item {
            padding-right: 0;
        }

        .book-details .availability {
            display: grid !important;
            /* 使用你要求的精确尺寸规则 */
            grid-template-columns: minmax(0, 1fr) clamp(120px, 36cqi, 500px) !important;
            gap: 0px !important;
            align-items: center;
            /* 垂直居中 */
            justify-content: start;
            /* 覆盖原本的 space-between */
        }

        .book-details .file-type-badge span {
            font-size: 0.85em;
            padding: 1px 5px;
            margin-top: 2px;
        }

        .book-details .download-section {
            gap: 0 !important;
        }

        .series-badge {
            padding: 0px 5px;
            border-radius: 4px;
            font-size: clamp(0.7rem, 3.2cqi, 0.9rem);
        }

        @container book-details-container (max-width: 380px) {
            .download-title-area {
                display: none !important;
                /* 隐藏标题区域 */
            }

            .detail-group.download-section {
                gap: 0 !important;
                /* 移除标题和链接之间的间距，让链接靠左对齐 */
            }


            .file-type-badge .text-full {
                display: none !important;
                /* 隐藏全称 (Publisher PDF) */
            }

            .file-type-badge .text-short {
                display: inline !important;
                /* 显示缩写 (PP) */
            }
        }
    }

    .book-item.expanded .book-details {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(-5px);
    }

    .results-grid:not(.compact-view) .book-details {
        width: clamp(20px, 36vw, 585px);
    }

    body.sidebar-collapsed .results-grid:not(.compact-view) .book-details {
        padding: 30px 35px;
        font-size: 1rem;
        line-height: 1.8;
        width: clamp(20px, 45vw, 720px);
    }

    .results-grid:not(.compact-view) .book-item:nth-child(4n-1) .book-details,
    .results-grid:not(.compact-view) .book-item:nth-child(4n) .book-details {
        left: auto;
        right: calc(100%);
        border-radius: 8px 0 8px 8px;
        box-shadow: -5px 0px 20px -5px rgba(0, 0, 0, 0.1);
        transform: translateX(5px);
    }

    .results-grid.compact-view .book-details {
        padding: 20px 25px;
        font-size: 0.8rem;
        line-height: 1.6;
        width: clamp(20px, 30vw, 465px);
    }

    body.sidebar-collapsed .results-grid.compact-view .book-details {
        padding: 25px 30px;
        font-size: 0.9rem;
        line-height: 1.7;
        width: clamp(20px, 36vw, 585px);
    }

    .results-grid.compact-view .book-item:nth-child(5n-1) .book-details,
    .results-grid.compact-view .book-item:nth-child(5n) .book-details {
        left: auto;
        right: calc(100%);
        border-radius: 8px 0 8px 8px;
        box-shadow: -5px 0px 20px -5px rgba(0, 0, 0, 0.1);
        transform: translateX(4px);
    }
}


.book-details h3,
body.sidebar-collapsed .results-grid.compact-view .book-details h3 {
    font-size: 1.3rem;
    font-weight: bold;

    color: #3B1977;
    line-height: 1.5;
}

body.sidebar-collapsed .book-details h3 {
    font-size: 1.4rem;

}

.book-details .detail-group {
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 51, 102, 0.2);
}

.book-details> :last-child {
    margin-bottom: 0;
}

.book-details .detail-group:first-of-type {
    border-top: none;
    padding-top: 0;
}

.book-details .tags-group {
    border-top: none;
    padding-top: 0;
}

.book-details strong {
    font-weight: 600;
    color: #49346e;
    white-space: nowrap;

}

.book-details .availability .form-row {
    display: flex;
    align-items: center;

    justify-content: flex-start;
    gap: 75px;
}


.book-details .custom-checkbox .label-text {
    margin-right: 8px;
}


.admin-page .availability-item.featured-item .label-text {
    margin-right: 10px;
}

.admin-page .availability-item.featured-item {
    grid-column: 2;
    justify-self: center;
}

.user-page .book-details .availability {
    display: flex;
    justify-content: space-between;
    align-items: center;

}


.availability-item,
body.sidebar-collapsed .results-grid.compact-view .availability-item {
    display: flex;
    align-items: center;
    padding-right: 115px;
}

.admin-page .availability-item {
    padding-right: 0px;
}

.results-grid.compact-view .availability-item {
    padding-right: 80px;
}

body.sidebar-collapsed .results-grid:not(.compact-view) .availability-item {
    display: flex;
    align-items: center;
    padding-right: 115px;
}

.availability-item strong {
    margin-right: clamp(0px, 2cqi, 9px);
}

.availability .status-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 25%;
    vertical-align: middle;
    margin: 0 0px;

}


.icon-help {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 15px;
    height: 15px;
    position: relative;
    border: 1.5px solid #49346e;
    color: #49346e;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    vertical-align: middle;
    cursor: help;
    margin: 0 5px;

}

.icon-help:hover {
    background-color: #49346e;
    color: white;
}

nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 118px;
}

nav .nav-item {
    position: relative;
}

nav .nav-item>a {
    display: flex;
    align-items: center;
    padding: 15px 0px;
    text-decoration: none;
    color: #3B1977;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

nav .nav-item>a:hover {
    color: #5d00ff;
}

nav .nav-arrow {
    margin-left: 8px;
    margin-top: 4px;
    transition: transform 0.2s ease;
    display: inline-flex;
    align-items: center;

}


nav .nav-arrow svg {
    width: 14px;
    height: 14px;
}

.dropdown-content {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    position: absolute;
    top: 100%;
    left: -22%;
    background-color: #ffffff;
    width: 555px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    border-radius: 8px;
    z-index: 9999;
    padding: 10px;
    display: flex;
}

#explore-menu .dropdown-content {
    min-width: auto;
    width: max-content;
    left: -31%;
}

.dropdown.open .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown.open .nav-arrow {
    transform: rotate(180deg);
}

.discipline-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-right: 1px solid #e9ecef;
    flex: 0 0 250px;
}

.discipline-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: #212529;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
}

.discipline-name {
    text-overflow: ellipsis;
    overflow: hidden;
    padding-right: 15px;
}

.discipline-list li a::after {
    content: '›';
    font-size: 1.2em;
    color: #adb5bd;
    line-height: 1;
    flex-shrink: 0;
    position: relative;
    top: -1px;
}

.subject-list-container {
    flex-grow: 1;
    padding: 0 0px 0 10px;
}

.subject-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
}

.subject-list.active {
    display: block;
}

.subject-list li a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    font-weight: 400;
    border-radius: 10px;
    line-height: 1.4;
}

.subject-list .subject-en {
    display: block;
    color: #495057;
    font-weight: 500;
}

.subject-list .subject-zh {
    display: block;
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 2px;
}

.discipline-list li.active a,
.discipline-list li:hover a {
    background-color: #f1e9ff;
    color: #3B1977;
}

.subject-list li a:hover {
    background-color: #f1e9ff;
}

.dropdown-content .simple-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-content .simple-list li a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: #212529;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 10px;
}

.dropdown-content .simple-list li a:hover {
    background-color: #f1e9ff;
    color: #3B1977;
}

.custom-select-wrapper {
    position: relative;
    user-select: none;
}

.results-per-page-select .select-selected {
    width: 60px;
}

.sort-by-select .select-selected {
    width: 125px;
}

.custom-select-wrapper select {
    display: none;
}

.select-selected {
    background-color: white;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    font-weight: 600;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
    gap: 8px;
}

.select-selected .select-arrow {
    position: static;
    transform: none;
    color: #888;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
}

.select-selected.select-arrow-active {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.select-selected.select-arrow-active .select-arrow {
    transform: rotate(180deg);
}

.select-items {
    position: absolute;
    background-color: white;
    top: 100%;
    left: 0;
    right: 0;
    border: 1px solid #ccc;
    border-top: none;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    overflow: hidden;
    z-index: 99;
}

.select-hide {
    display: none;
}

.select-items div {
    padding: 4px 8px;
    cursor: pointer;
    font-weight: 600;
    border-bottom: 1px solid #f4f4f4;
}

.select-items div:last-child {
    border-bottom: none;
}

.select-items div:hover,
.same-as-selected {
    background-color: #f4f4f4;
}

.download-section {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.download-rows-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 3px;
}

.download-row,
body.sidebar-collapsed .results-grid.compact-view .download-row {
    display: grid;

    align-items: center;

}

.results-grid.compact-view .download-row {
    min-height: 0px;
}


/* 
   【核心修改 2】
   我们将版本号和文件类型徽章都放在一个 Flexbox 容器中，
   并精确控制它们的伸缩行为。
*/
.edition-text {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    min-height: 1.4em;
}

.edition-text>span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.edition-text .file-type-badge {
    flex-shrink: 0;
}

.icon-group,
body.sidebar-collapsed .results-grid.compact-view .icon-group {
    display: grid;

    flex-shrink: 0;
}



.download-icon {
    display: flex;
    justify-content: flex-start;
    align-items: center;

    vertical-align: middle;
}

/* 将带有 .drive-a 类的图标明确放入第一列 */
.download-icon.drive-a {
    grid-column: 1;
}

/* 将带有 .drive-b 类的图标明确放入第二列 */
.download-icon.drive-b {
    grid-column: 2;
}


.icon-group:not(:has(.drive-a)) .drive-b {
    /* 当这个条件满足时，我们强制把夸克网盘链接移动到网格的第一列 */
    grid-column: 1;
}

.download-icon img,
body.sidebar-collapsed .results-grid.compact-view .download-icon img {
    height: 24px;
    width: auto;
    display: block;
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0.9;
    background-color: rgba(255, 255, 255, 0);

}



body.sidebar-collapsed .results-grid:not(.compact-view) .download-icon img {
    height: 26px;
}

.download-icon:hover img {
    opacity: 1;
    transform: scale(1.05) translateZ(0);
}


/* --- Dynamic Color & Visibility Styles --- */
.year-badge {
    background-color: #6c757d;
    color: white;
}

.year-badge.status-green {
    background-color: #28a745;
}

.year-badge.status-yellow {
    background-color: #ffc107;
    color: #212529;
}

.year-badge.status-red {
    background-color: #dc3545;
}

.status-dot {
    background-color: #6c757d;
}

.status-dot.status-green {
    background-color: #28a745;
}

.status-dot.status-yellow {
    background-color: #ffc107;
}

.status-dot.status-red {
    background-color: #dc3545;
}

.book-item .year-badge {
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

.book-item.expanded .year-badge {
    opacity: 0;
    pointer-events: none;
}


.results-grid.compact-view .book-details h3 {
    font-size: 1.1rem;
    line-height: 1.3;
}

.results-grid.compact-view .book-details .detail-group {
    padding-top: 8px;
    margin-bottom: 8px;
}


.results-grid.compact-view .download-row {

    gap: 0px;
}

.results-grid.compact-view .icon-group {
    gap: 0px;
    /* 从 25px 减小 */
}

.results-grid.compact-view .download-icon img {
    height: 20px;
}

.results-grid.compact-view .icon-placeholder {
    height: 20px;
}

.user-page .results-grid.compact-view .book-details .availability {
    display: flex;
    justify-content: space-between;
    /* 让年份和可用性两端对齐 */
    align-items: center;
}

/* main.style.css (追加在文件最末尾) */

/* =================================================================
   START: Tag Capsule Styles
   ================================================================= */

/* 1. "Tags:" 标题和所有标签胶囊的容器 */
.tags-group,
body.sidebar-collapsed .results-grid.compact-view .tags-group {
    display: flex;
    align-items: flex-start;
    gap: 33px;
}

.results-grid.compact-view .tags-group {
    gap: 30px;
}

body.sidebar-collapsed .tags-group {
    gap: 36px;
}


/* 2. 所有标签胶囊的 flex 容器，支持换行 */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    /* 允许标签换行 */
    gap: 0.4em;
    /* 标签之间的间距 */
    flex-grow: 1;
}

/* 3. 单个标签胶囊的样式 */
.tag-capsule {
    display: inline-flex;
    padding: 0px 5px;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: 500;
    color: #49346e;
    text-decoration: none;
    gap: 5px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* 添加一个非常淡的边框增加质感 */
    align-items: baseline
}

/* 4. 悬停效果 */
.tag-capsule:hover {
    transform: scale(1.05) translateZ(0);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0);
}

.tag-capsule .tag-zh {
    font-size: 0.9em;
    color: #49346e;
    font-weight: 500;
}

.file-type-badge {
    display: inline-block;
    padding-bottom: 2px;
    border-radius: 5px;
    font-weight: 600;
    line-height: 1.2;
    color: white;
    font-size: 0.85em;
    margin-left: clamp(0px, 1cqi, 5px);
    vertical-align: middle;
}

.edition-text>.file-type-badge:first-child {
    margin-left: 0 !important;
}

.file-type-badge.badge-green {
    background-color: #28a745;
}

.file-type-badge.badge-red {
    background-color: #dc3545;
}

.file-type-badge .text-short {
    display: none;
}

.file-type-badge .text-full {
    display: inline;
}


@media (max-width: 768px) {
    .file-type-badge .text-full {
        display: none;
    }

    .file-type-badge .text-short {
        display: inline;
    }

    .file-type-badge {
        font-size: 0.85em;

    }

    .file-type-badge {
        padding: 1px 5px;
    }

    .series-badge {
        font-size: 0.9em;

    }
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
    /* 与书籍网格保持距离 */
    padding-bottom: 20px;
}

.pagination-controls button {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px 15px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pagination-controls button:hover:not(:disabled) {
    background-color: #e9ecef;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-controls span {
    color: #6c757d;
    font-weight: 500;
}

/* main.style.css (追加在文件最末尾) */

/* =================================================================
   START: Custom Tooltip Styles
   ================================================================= */



/* 2. 提示框主体 (使用 ::before 伪元素创建) */
.icon-help::before {
    content: attr(data-tooltip);
    /* 关键：读取 data-tooltip 属性的内容 */
    position: absolute;
    bottom: 180%;
    /* 定位在问号图标的上方 */
    left: 50%;
    transform: translateX(-50%);
    /* 水平居中 */
    /* 外观样式 */
    background-color: var(--tooltip-bg-color, #3B1977);
    /* 使用 CSS 变量来控制颜色 */
    color: white;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    /* 防止提示文本换行 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    /* 【核心修改】允许换行并设置最大宽度 */
    white-space: pre-line;
    /* 关键：这个值会保留换行符并合并多余的空格 */
    width: max-content;
    /* 宽度由内容决定 */
    max-width: 300px;
    /* 设置一个最大宽度，防止过宽 */
    text-align: center;
    /* 让多行文本居中显示 */
    /* 默认隐藏，并设置过渡动画 */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateX(-50%) translateY(5px);
    /* 动画初始位置稍微偏下 */
}

/* 3. 提示框下方的小三角 (使用 ::after 伪元素创建) */
.icon-help::after {
    content: '';
    position: absolute;
    bottom: calc(150% - 5px);
    /* 定位在提示框主体的下方 */
    left: -110%;
    transform: translateX(-50%);

    /* 用边框画一个三角形 */
    border-width: 5px;
    border-style: solid;
    border-color: var(--tooltip-bg-color, #3B1977) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateX(-50%) translateY(5px);
}

.filter-group .icon-help::after {
    left: -400%;
}

.icon-help:hover::before,
.icon-help:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}


.availability-item:has(.status-green) {
    --tooltip-bg-color: #28a745;
}

.availability-item:has(.status-yellow) {
    --tooltip-bg-color: #ffc107;
}

.availability-item:has(.status-red) {
    --tooltip-bg-color: #dc3545;
}

.availability-item:has(.status-yellow) .icon-help::before {
    color: #212529;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    /* 减小元素间的默认间距 */
    margin-top: 80px;
    padding-bottom: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 2. 所有可点击的项 (页码, 上一页/下一页) 的通用样式 */
.pagination-controls .page-link,
.pagination-controls .prev-next {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border-radius: 15px;
    text-decoration: none;
    font-weight: 600;
    color: #3B1977;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* 3. 上一页 / 下一页 按钮的特定样式 */
.pagination-controls .prev-next {
    font-size: 1.2rem;
    padding-bottom: 2px;
}

/* 4. 普通页码的悬停效果 */
.pagination-controls .page-link:hover {
    background-color: #f1e9ff;
}

/* 5. 【当前页】的激活样式 */
.pagination-controls .page-link.active {
    background-color: #3B1977;
    color: white;
    font-weight: 700;
    cursor: default;
}

/* 6. 省略号 (...) 的样式 */
.pagination-controls .ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 5px;
    color: #3B1977;
    font-weight: 600;
}

/* 7. 禁用状态的按钮 */
.pagination-controls .prev-next.disabled {
    color: #adb5bd;
    cursor: not-allowed;
    pointer-events: none;
}

.no-cover-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;

    /* 关键：尺寸与 .book-item img 的尺寸保持一致 */
    height: 300px;
    width: 212px;
    /* 这是一个基于 3:4.25 经典书籍比例的估算宽度，您可以微调 */

    background-color: #e9ecef;
    /* 与封面容器的背景色一致 */
    border-radius: 8px;
    /* 与封面的圆角一致 */
    transition: height 0.7s ease;
    color: #adb5bd;
    /* 柔和的文字颜色 */
    font-size: 1.1rem;
    font-weight: 500;
}

/* 2. 在紧凑视图下，也让占位符的尺寸相应变小 */
.results-grid.compact-view .no-cover-placeholder {
    height: 230px;
    width: 163px;
    transition: height 0.7s ease;
    /* 按比例缩小 */
}



.admin-page .book-item:hover {
    transform: none;
    /* 禁用 transform (包括 scale 和 translateY) */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    /* 让阴影保持默认状态 */
    z-index: 100;
    /* 让层级也保持默认状态 */
}



/* admin-subject-template.html 的表单样式 */
.details-form {
    display: contents;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    /* 减小一点间距 */
}

/* 
【核心修改】
为不同类型的输入框设置不同的宽度和伸缩行为。
*/
.form-row input,
.form-row select {
    font-size: 1em;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
}

/* 1. Edition 输入框：固定宽度 */
.form-row input[name^="download_link_edition"] {
    flex-shrink: 0;
    width: 60px;
}

/* 2. Type 下拉框：固定宽度 */
.form-row select[name^="download_link_type"] {
    flex-shrink: 0;
    width: 140px;
}

/* 3. URL 输入框：弹性宽度，自动填充剩余空间 */
.form-row input[name^="download_link_url"] {
    flex-grow: 1;
    /* 关键！*/
    width: 100px;
    /* 设置一个最小宽度，防止被过度压缩 */
}


.form-submit-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 15px;
}

.details-submit-btn {
    background-color: #5d00ff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.details-submit-btn:hover {
    background-color: #3B1977;
}

.details-edit-btn {
    /* “Deep Edit” 按钮样式 */
    padding: 4px 10px;
    font-size: 0.8em;
    margin-left: auto;
}

.modal-overlay {
    /* 模态框遮罩层 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content-admin {
    /* 模态框内容区 */
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-cancel,
.btn-save {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel {
    background-color: #e9ecef;
}

.btn-save {
    background-color: #007bff;
    color: white;
}

/* main.style.css (追加在文件最末尾) */

/* =================================================================
   START: In-Panel Deep Edit Styles
   ================================================================= */

/* 1. 为详情框内的两个视图（预览和编辑）定义基础容器 */


/* 2. 控制视图切换的核心逻辑 */
/* 默认状态下，显示“预览”视图，隐藏“编辑”视图 */
.book-details .deep-edit-view {
    display: none;
}

.book-details .quick-edit-view {
    display: block;
}

/* 当 .book-details 被添加上 "deep-edit-mode" 类时，反转可见性 */
.book-details.deep-edit-mode .deep-edit-view {
    display: block;
}

.book-details.deep-edit-mode .quick-edit-view {
    display: none;
}

/* 3. 为“深度编辑”表单的布局进行微调 */
.deep-edit-view .form-group {
    margin-bottom: 1rem;
}

.deep-edit-view label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.deep-edit-view input[type="text"],
.deep-edit-view input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}


/* 4. 为两个按钮（Deep Edit / Cancel）创建一个容器，并放在左下角 */
.details-actions {
    position: absolute;
    /* 相对于 .book-details 定位 */
    bottom: 20px;
    left: 30px;
    display: flex;
    gap: 10px;
}

.details-action-btn {
    background: none;
    border: 1px solid #3B1977;
    color: #3B1977;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8em;
}

.details-action-btn:hover {
    background-color: #3B1977;
    color: white;
}

.deep-edit-view .form-group {
    margin-bottom: 1rem;
}



.deep-edit-view input[type="text"],
.deep-edit-view input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Choices.js 样式覆盖，确保它在详情框内看起来不错 */
.deep-edit-view .choices {
    margin-bottom: 0;
}

.deep-edit-view .choices__inner {
    display: flex;
    /* 让内部元素（标签和输入框）水平排列 */
    flex-wrap: wrap;

    font-size: 0.9em;
    border-radius: 6px;
    padding: 5px;
    /* 稍微调整内边距 */
    min-height: 40px;
    /* 保证在没有标签时也有一定的高度 */
    cursor: text;
    /* 鼠标悬停时显示文本输入光标，暗示可以点击 */
}

/* 4. 已选中的标签胶囊的样式 */
.deep-edit-view .choices__list--multiple .choices__item {
    background-color: #5e35a4;
    border: none;
    color: #ffffff;
    font-size: 0.9em;
    border-radius: 4px;
    /* 可以稍微减小圆角 */
    margin: 3px;
    /* 移除库的默认 margin */
}

.deep-edit-view .choices__list--multiple .choices__item[data-deletable] {
    padding-right: 8px;

}


/* 5. 【核心修改】让文本输入框撑满所有剩余空间 */
.deep-edit-view .choices__input {
    flex-grow: 1;
    /* 关键！让输入框占据所有可用的弹性空间 */
    min-width: 150px;
    /* 设置一个最小宽度，确保在有标签时也能看到它 */
    margin: 0 !important;
    /* 覆盖库的默认样式 */
    padding: 2px !important;
    background-color: transparent !important;
    border: none !important;
}

/* main.style.css (追加在文件末尾) */
.deep-edit-view textarea {
    /* 文本域样式 */
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: inherit;
}

.deep-edit-view .cover-upload-area {
    /* 优化封面上传框 */
    height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}


.cover-upload-area {
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    position: relative;
    /* 为预览图片提供定位基准 */
}

.cover-upload-area:hover,
.cover-upload-area.is-dragover {
    background-color: #f1e9ff;
    border-color: #3B1977;
}

.cover-upload-area.has-file {
    border-style: solid;
    border-color: #28a745;
    padding: 1rem;
}

.cover-upload-area span {
    transition: opacity 0.2s ease;
}

.cover-upload-area.has-file span {
    opacity: 0;
    display: none;
}

/* 【关键】将 ID 选择器改为类选择器 */
.cover-preview {
    max-width: 100%;
    max-height: 150px;
    margin-top: 0;
    display: none;
    position: relative;
    z-index: 1;
}

.cover-upload-area.has-file .cover-preview {
    display: block;
}

/* main.style.css (追加在文件最末尾) */

/* =================================================================
   START: Feedback Toast Styles
   ================================================================= */

.toast {
    position: fixed;
    /* 固定在视口中 */
    bottom: 25px;
    right: 25px;

    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);

    /* 默认隐藏，并为动画做准备 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease-in-out;
    z-index: 20000;
    /* 确保它在所有元素之上 */
}

/* 控制显示的类 */
.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 成功状态的颜色 */
.toast.success {
    background-color: #28a745;
}

/* 失败状态的颜色 */
.toast.error {
    background-color: #dc3545;
}


/* 1. 开关的容器 (label) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

/* 2. 隐藏原生的 checkbox */
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* 3. 开关的轨道 (slider) */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e9ecef;
    /* 关闭时的背景色 */
    border-radius: 20px;
    /* 实现胶囊形状 */
    transition: background-color 0.4s;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.1);
    /* 内阴影，实现凹陷感 */
}

/* 4. 开关的滑块 (pill) */
.slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    /* 实现圆形 */
    transition: transform 0.4s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    /* 外阴影，实现凸起感 */
}

/* 5. 【核心】当 checkbox 被选中时，改变轨道和滑块的样式 */
input:checked+.slider {
    background-color: #3B1977;
    /* 打开时的背景色 (您的主题色) */
}

input:checked+.slider::before {
    /* 将滑块向右移动：轨道宽度 - 滑块宽度 - 左右边距 */
    /* 50px - 22px - (3px * 2) = 22px */
    transform: translateX(14px);
}

.series-badge {
    display: inline-flex;
    align-self: flex-start;
    background-color: #5d00ff;
    /* 一个中性的背景色 */
    color: #ffffff;
    padding: 0px 5px;
    border-radius: 4px;
    font-size: clamp(0.6rem, 3cqi, 0.8rem);
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 3px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    align-items: baseline;
    gap: 6px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.series-badge .series-en,
.series-badge .series-zh {
    display: inline;
    /* 确保它们是行内元素 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.series-badge:hover {

    /* 您的主题色 */
    color: white;
    transform: scale(1.02) translateZ(0);
}


/* 中文部分的样式 */
.series-badge .series-zh {
    font-size: 0.85em;
    /* 让中文稍微小一点 */

    color: inherit;
    opacity: 1;
    /* 默认状态下让中文稍微柔和一些 */
    font-weight: 600;

    /* 添加过渡效果 */
}




/* 1. 创建一个 Flexbox 容器来包裹“下载链接”和“捐赠者”两个部分 */
.download-and-donor-wrapper {
    display: flex;
    align-items: flex-start;
    /* 顶部对齐 */

    /* 继承 detail-group 的样式，因为它取代了原来的 download-section */
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 51, 102, 0.2);
}

.download-title-area {
    display: flex;
    flex-direction: column;
    /* 垂直排列 */
    align-items: flex-start;
    /* 左对齐 */

    /* 标题和图标之间的垂直间距 */
    flex-shrink: 0;
}


.download-title-area strong {
    white-space: nowrap;
    /* 确保“下载链接”不换行 */
    margin-right: clamp(0px, 2cqi, 9px);
}

.title-with-donor {
    display: flex;
    align-items: center;
    /* 垂直居中对齐标题和图标 */
    gap: 8px;
    /* 在标题和图标之间添加一些间距 */
}

/* 2. 移除原 h3 的下边距，因为它现在由容器处理 */
.title-with-donor h3 {
    margin-bottom: 0;
}

/* 3. 为容器本身恢复原 h3 的下边距，以保持整体布局不变 */
.book-details .title-with-donor {
    margin-bottom: 18px;
}

/* 4. 在紧凑视图下，也为容器恢复下边距 */
.results-grid.compact-view .book-details .title-with-donor {
    margin-bottom: 0px;
}

/* 5. 确保图标在 flex 容器中不会被压缩 */
.title-with-donor .donor-info-icon {
    flex-shrink: 0;
}

/* 4. 捐赠者图标的样式 */
.donor-info-icon {
    position: relative;
    display: flex;
    align-items: center;
    color: #6c757d;
    padding: 0 0px;
    /* 增加一点点击区域 */
}

.donor-info-icon img,
body.sidebar-collapsed .results-grid.compact-view .donor-info-icon img {
    height: 30px;
    /* 控制图标的高度 */
    width: 27px;
    /* 控制图标的宽度 */
    cursor: help;

}

.results-grid.compact-view .donor-info-icon img {

    /* 从 20px 相应缩小 */
    height: 25px;
    width: 22.5px;
    /* 从 20px 相应缩小 */
}

body.sidebar-collapsed .donor-info-icon img {
    height: 35px;
    /* 控制图标的高度 */
    width: 31.5px;


}

/* 5. 为捐赠者 tooltip 创建专属样式 (复用并修改问号图标的) */
.donor-info-icon::before {
    content: attr(data-tooltip);
    position: absolute;
    /* 定位在图标的【下方】 */
    top: 125%;
    right: 0%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    background-color: #f1e9ff;
    color: #3B1977;
    padding: 2px 6px;
    border-radius: 6px;
    white-space: pre-line;
    width: max-content;
    max-width: 500px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
    transform: translateY(-5px);
    /* 从上方滑入 */
}

/* 6. 创建小三角 */
.donor-info-icon::after {
    content: '';
    position: absolute;
    /* 定位在 tooltip 的【上方】 */
    top: 95%;
    left: 20%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    /* 边框颜色顺序：下 右 上 左 */
    border-color: transparent transparent #f1e9ff transparent;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
    transform: translateY(-5px);
}


/* 7. 悬停时显示 */
.donor-info-icon:hover::before,
.donor-info-icon:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) translateZ(0);
}

/* main.style.css (追加在文件最末尾) */

/* =================================================================

/* 1. 按钮的基础样式 */
.sidebar-toggle-pill {
    position: absolute;
    top: 134px;
    left: clamp(138px, 12.6vw, 208px);

    align-items: center;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    height: 45px;
    border-radius: 25px;
    width: 45px;
    transition: left 0.5s cubic-bezier(0.24, 0, 0.24, 1),
        width 0.5s ease,
        margin-left 0.5s cubic-bezier(0.76, 0, 0.24, 1),
        transform 0.2s ease,
        box-shadow 0.3s ease;


}

.sidebar-toggle-pill:hover {
    transform: scale(1.03) translateZ(0);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.sidebar-toggle-pill .icon-logo {
    width: 36px;
    height: 32px;
}

.toggle-logo-wrapper {
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    margin-left: 4px;
    transition: margin-left 0.5s cubic-bezier(0.76, 0, 0.24, 1);
}

body.sidebar-collapsed .toggle-logo-wrapper {
    margin-left: 6px
}

body.sidebar-collapsed .sidebar-toggle-pill {
    left: 160px;
    width: 110px;
}

body.sidebar-collapsed .icon-paths>path {
    transform: none;
    opacity: 1;
}

.toggle-text-wrapper {
    display: flex;
    flex-direction: column;
    color: #3B1977;
    margin-left: 8px;
    margin-bottom: 2px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;

    transform: translateX(-10px);
    white-space: nowrap;
    overflow: hidden;
}

body.sidebar-collapsed .toggle-text-wrapper {
    opacity: 1;
    transform: translateX(0);
}

.toggle-text-wrapper .text-en {
    font-size: 1.2rem;
    font-weight: 700;
}

.toggle-text-wrapper .text-zh {
    font-size: 0.7rem;
    font-weight: 600;
}

.icon-paths>path {
    transition: transform 0.7s cubic-bezier(0.24, 0, 0.24, 1);
    transform-origin: 265px 279px;
}

.logo-pupil {
    transform: translate(-200px, 280px) rotate(30deg);
}

.logo-eyelid-fade {

    transform: translate(-25px, -60px) rotate(80deg);
}

.logo-lash-top {
    transform: translate(-25px, -60px) rotate(80deg);
}

.logo-lash-bottom {
    transform: translate(-65px, 145px) rotate(90deg);
}

.logo-eyelid-main {
    transform: translate(-20px, -60px) rotate(35deg);
}

body.sidebar-collapsed .icon-paths>path {
    transform: none;
}

@keyframes pupilWiggle {


    0%,
    100% {
        transform: translate(-200px, 280px) rotate(30deg);
    }

    20% {
        transform: translate(-125px, 275px) rotate(25deg);
    }

    45% {
        transform: translate(-140px, 290px) rotate(35deg);
    }

    60% {
        transform: translate(-210px, 270px) rotate(30deg);
    }

    85% {
        transform: translate(-160px, 300px) rotate(25deg);
    }


}

body:not(.sidebar-collapsed) .sidebar-toggle-pill:hover .logo-pupil {
    animation: pupilWiggle 2s infinite cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
}




/* --- 主页专属的额外样式 --- */
.hero-section {
    text-align: center;
    padding: 1rem 1rem 2rem 1rem;
}

.admin-actions {
    font-size: 1.1rem;
    color: #3B1977;

    font-weight: 700;
}

.hero-section h1 {
    font-size: 2.5rem;
    color: #3B1977;
    margin-bottom: 1rem;
    font-weight: 700;
}

/* --- 1. 交互主页容器 --- */
#interactive-homepage {
    width: 100%;
    aspect-ratio: 16 / 12;
    margin: 0 auto 0rem auto;
    position: relative;
    background: #fdfdfd;
    border-radius: 25px;
    overflow: hidden;
    container-type: inline-size;

}

/* --- 2. 学科面板 --- */
.discipline-panel {
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: clip-path 0.8s cubic-bezier(0.76, 0, 0.24, 1);
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    /* 2. 使用 fadeIn 动画 */
    will-change: opacity;
}

/* mai
n.style.css (文件顶部或底部) */


@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.discipline-panel .bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    object-fit: cover;
    z-index: 1;
    filter: brightness(0.7) contrast(1.1);
    transition: transform 0.8s ease, opacity 0.5s ease, filter 0.5s ease;
}

.discipline-panel:hover .bg-image {
    transform: scale(1.03) translateZ(0);
    filter: brightness(0.9) contrast(1.1);
}

.discipline-panel .title {
    position: absolute;
    z-index: 4;
    color: white;
    font-size: 2.9cqi;
    font-weight: bold;
    text-shadow: 1px 1px 6px rgba(0, 0, 0, 0.9);
    transition: opacity 0.5s ease, top 0.8s cubic-bezier(0.76, 0, 0.24, 1), bottom 0.8s cubic-bezier(0.76, 0, 0.24, 1);
    pointer-events: none;
    /* 从变量读取位置，并设置 auto 作为回退 */
    top: var(--title-top, auto);
    left: var(--title-left, auto);
    bottom: var(--title-bottom, auto);
    right: var(--title-right, auto);
    padding: 1.47cqi 2.75cqi;
}

.panel-content-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
    /* <-- 核心新增 */
    height: 100%;
    /* <-- 核心新增 */
}

[data-discipline="Natural Sciences"] .bg-image {
    width: 90%;
    height: 60%;
    top: 0%;
    right: 10%;
    object-position: 0% 40%;
}

[data-discipline="Engineering and Technology"] .bg-image {
    width: 80%;
    height: 60%;
    top: auto;
    right: auto;
    left: 35%;
    bottom: 40%;
    object-position: 0% 0%;
}

/* --- 医疗健康 (Medical): 按您的要求实现 --- */
[data-discipline="Medical and Health Sciences"] .bg-image {
    width: 70%;
    height: 60%;
    bottom: 20%;
    right: 30%;
    top: auto;
    right: auto;
    object-position: 0% 50%;
}

/* --- 工程技术 (Engineering): 示例 - 左下角80%大小 --- */


[data-discipline="Agricultural and Veterinary Sciences"] .bg-image {
    object-position: 50% 30%;
    width: 70%;
    height: 60%;
    top: 20%;
    left: 30%;

    /* 焦点偏上，看更多灯光 */
}

[data-discipline="Humanities and the Arts"] .bg-image {
    width: 60%;
    height: 60%;
    top: 40%;
    right: 40%;
    object-position: 0% 40%;
}

[data-discipline="Social Sciences"] .bg-image {
    object-position: 50% 40%;
    width: 90%;
    height: 60%;
    top: 40%;
    left: 10%;

    /* 焦点偏下 */
}



/* 
   您可以按照上面的格式，为您关心的其他学科面板
   添加独立的 .panel-content-wrapper 和 .bg-image 规则。
   如果某个学科没有被特别设置，它的图片将默认充满整个容器。
*/

/* =================================================================
   END: Partial Image Fill & Positioning
   ================================================================= */
/* --- 3. 激活状态 --- */
.discipline-panel.active .title {
    opacity: 0;
}



/* =================================================================
   START: Inactive Panel Overlay Styles
   ================================================================= */

/* 1. 为内容包装器创建一个默认隐藏的、带颜色的伪元素作为蒙版 */
.panel-content-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* <-- 在这里更改您想要的蒙版颜色和不透明度 */
    /* 示例: 一个带有70%不透明度的深紫色蒙版 */
    background-color: rgba(45, 25, 80, 0.7);

    z-index: 3;
    /* 确保蒙版在图片之上，但在文字链接之下 */
    opacity: 0;
    /* 默认状态下完全透明 */
    pointer-events: none;
    /* 确保蒙版不会干扰鼠标点击 */
    transition: opacity 0.7s ease;
    /* 添加平滑的淡入淡出效果 */
}

/* 2. 当面板变为“未激活”状态时，让蒙版显示出来 */
#interactive-homepage[class^="state-"] .discipline-panel:not(.active) .panel-content-wrapper::before {
    opacity: 1;
}

/* 3. 同时，只对“未激活”的背景图片应用模糊效果，不再需要降低亮度 */
/* ... */
/* 3. 同时，对“未激活”的背景图片应用模糊效果，并【保持】其亮度不变以防止闪烁 */
#interactive-homepage[class^="state-"] .discipline-panel:not(.active) .bg-image {
    /* 【核心修改】在这里保留一个 brightness 值，与其初始状态一致 */
    filter: blur(4px) brightness(0.7);
}

/* ... */

/* =================================================================
   END: Inactive Panel Overlay Styles
   ================================================================= */

/* --- 4. Subjects 视图 --- */
.subjects-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;

    pointer-events: none;
    visibility: hidden;
    display: flex;
    flex-wrap: wrap;
    gap: 1.8cqi;

}

.discipline-panel.active .subjects-view {
    visibility: visible;
    pointer-events: auto;
}

.subject-card-dynamic {
    opacity: 0;
    backdrop-filter: blur(5px);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);

    border-radius: 20px;
    text-decoration: none;
    font-size: 1.9cqi;
    padding: 0.7cqi 1.5cqi;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.5s ease 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    /* 从 inline-flex 修改为此 */
    display: inline-flex;
    /* 保持其行内特性，但让内部元素可以使用flex布局 */
    flex-direction: column;
    /* 让内部的span垂直堆叠 */
    justify-content: center;
    /* 垂直居中内容 */
    align-items: center;
    /* 水平居中内容 */
    text-align: center;
}

.subject-card-dynamic .subject-en {
    line-height: 1.2;
    /* 设置一个合适的行高 */
}

/* 3. 中文行的样式 */
.subject-card-dynamic .subject-zh {
    font-size: 0.7em;
    /* 让中文字体比英文小一些 */
    margin-top: 3px;
    /* 在中英文之间增加一点点间距 */
    opacity: 0.9;
    /* 让中文稍微柔和一些，突出英文主标题 */
    font-weight: 500;
    /* 可以使用稍细的字重 */
}

.discipline-panel.active .subject-card-dynamic {
    opacity: 1;
}

.subject-card-dynamic:hover {
    transform: scale(1.05) translateZ(0);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}


@media (min-width: 769px) {
    [data-discipline="Engineering and Technology"] .subject-card-dynamic {
        font-size: 1.7cqi;
        padding: 0.5cqi 1.0cqi;
        border-radius: 18px;
    }



    [data-discipline="Engineering and Technology"] .subjects-view {
        /* 
          原来的 gap 是 1vw。
          你可以改成任何你想要的值，比如 0.5vw 让它更紧凑，
          或者 1.5vw 让它更稀疏。
        */
        gap: 1.4cqi;
    }

    [data-discipline="Engineering and Technology"] .subjects-view::after {
        content: "";
        flex-basis: 100%;
        /* 占据一整行的宽度 */
        height: 0;
        /* 确保它没有高度 */
        order: 1;
        /* 关键：设置其排列顺序 */
    }

    /* --- 3. 调整第一个 subject card 的顺序 --- */
    /* 
      我们让第一个 card 的 order 为 0，这样它就会排在
      order 为 1 的“换行符”前面。
    */
    [data-discipline="Engineering and Technology"] .subjects-view>.subject-card-dynamic:first-child {
        order: 0;
        margin-bottom: -1.4cqi;
        /* 关键：确保它是第一个被排列的元素 */
    }

    /* --- 4. 调整剩余所有 subject cards 的顺序 --- */
    /*
      我们让所有其他的 card 的 order 为 2，这样它们就会自动
      排在 order 为 1 的“换行符”后面，从而出现在新的一行。
    */
    [data-discipline="Engineering and Technology"] .subjects-view>.subject-card-dynamic {
        order: 2;
        /* 关键：确保它们都排在换行符后面 */
    }

}



/* --- Top-Left Panel --- */
[data-discipline="Natural Sciences"] .subjects-view {
    padding: 8% 50% 6% 5%;
    /* top right bottom left */
    justify-content: flex-start;
    align-content: flex-start;
}

/* --- Top-Right Panel --- */
[data-discipline="Engineering and Technology"] .subjects-view {
    padding: 5% 4% 6% 40%;
    justify-content: flex-end;
    align-content: flex-start;
}

/* --- Middle-Left Panel --- */
[data-discipline="Medical and Health Sciences"] .subjects-view {
    padding: 5% 75% 5% 5%;
    justify-content: flex-start;
    align-content: center;
}

/* --- Middle-Right Panel --- */
[data-discipline="Agricultural and Veterinary Sciences"] .subjects-view {
    padding: 5% 5% 5% 70%;
    justify-content: flex-end;
    align-content: center;
}

/* --- Bottom-Left Panel --- */
[data-discipline="Humanities and the Arts"] .subjects-view {
    padding: 5% 60% 8% 5%;
    justify-content: flex-start;
    align-content: flex-end;
}

/* --- Bottom-Right Panel --- */
[data-discipline="Social Sciences"] .subjects-view {
    padding: 6% 5% 4% 45%;
    justify-content: flex-end;
    align-content: flex-end;
}

/* =================================================================
   END: Independent Subject View Positioning
   ================================================================= */
/* --- 5. 核心: 定义所有 Clip-Path 形状和标题位置 --- */

/* --- 默认状态 (三行等高) --- */


/* 2. 定义【默认状态】下每个标题的位置变量 */
[data-discipline="Engineering and Technology"] .title,
[data-discipline="Agricultural and Veterinary Sciences"] .title,
[data-discipline="Social Sciences"] .title {
    text-align: right;
}

/* -- 左侧三个标题 (左上角) -- */
[data-discipline="Natural Sciences"] {
    --title-top: 0;
    --title-left: 0;
}

[data-discipline="Medical and Health Sciences"] {
    --title-top: 35.1%;
    /* 可见区域的顶部边缘 */
    --title-left: 0;
}

[data-discipline="Humanities and the Arts"] {
    --title-top: 70.2%;
    /* 可见区域的顶部边缘 */
    --title-left: 0;
}

/* -- 右侧三个标题 (右下角) -- */
[data-discipline="Engineering and Technology"] {
    --title-bottom: 70.7%;
    /* 100% - 可见区域的底部边缘 */
    --title-right: 0;
}

[data-discipline="Agricultural and Veterinary Sciences"] {
    --title-bottom: 35.6%;
    /* 100% - 可见区域的底部边缘 */
    --title-right: 0;
}

[data-discipline="Social Sciences"] {
    --title-bottom: 0.5%;
    --title-right: 0;
}


/* 3. 定义【激活状态】下，其他面板标题的位置变量 (覆盖默认值) */

/* -- 当 Natural 或 Engineering 激活时 (第一行展开) -- */
.state-natural-sciences [data-discipline="Engineering and Technology"] {
    --title-bottom: 40.5%;
}

.state-engineering-technology [data-discipline="Natural Sciences"] {
    --title-top: 0;
}

.state-natural-sciences [data-discipline="Medical and Health Sciences"],
.state-engineering-technology [data-discipline="Medical and Health Sciences"] {
    --title-top: 65.3%;
}

.state-natural-sciences [data-discipline="Agricultural and Veterinary Sciences"],
.state-engineering-technology [data-discipline="Agricultural and Veterinary Sciences"] {
    --title-bottom: 20.5%;
}

.state-natural-sciences [data-discipline="Humanities and the Arts"],
.state-engineering-technology [data-discipline="Humanities and the Arts"] {
    --title-top: 85.3%;
}

.state-natural-sciences [data-discipline="Social Sciences"],
.state-engineering-technology [data-discipline="Social Sciences"] {
    --title-bottom: 0.5%;
}


/* -- 状态二: Medical 或 Agricultural 激活时 (第二行展开) -- */
.state-medical-health-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
    --title-bottom: 20.5%;
}

.state-agricultural-veterinary-sciences [data-discipline="Medical and Health Sciences"] {
    --title-top: 20%;
}

.state-medical-health-sciences [data-discipline="Natural Sciences"],
.state-agricultural-veterinary-sciences [data-discipline="Natural Sciences"] {
    --title-top: 0;
}

.state-medical-health-sciences [data-discipline="Engineering and Technology"],
.state-agricultural-veterinary-sciences [data-discipline="Engineering and Technology"] {
    --title-bottom: 85.8%;
}

.state-medical-health-sciences [data-discipline="Humanities and the Arts"],
.state-agricultural-veterinary-sciences [data-discipline="Humanities and the Arts"] {
    --title-top: 85.3%;
}

.state-medical-health-sciences [data-discipline="Social Sciences"],
.state-agricultural-veterinary-sciences [data-discipline="Social Sciences"] {
    --title-bottom: 0.5%;
}


/* -- 状态三: Humanities 或 Social 激活时 (第三行展开) -- */
.state-social-sciences [data-discipline="Humanities and the Arts"] {
    --title-top: 40%;
}

.state-humanities-the-arts [data-discipline="Social Sciences"] {
    --title-bottom: 0.5%;
}

.state-humanities-the-arts [data-discipline="Natural Sciences"],
.state-social-sciences [data-discipline="Natural Sciences"] {
    --title-top: 0;
}

.state-humanities-the-arts [data-discipline="Engineering and Technology"],
.state-social-sciences [data-discipline="Engineering and Technology"] {
    --title-bottom: 85.8%;
}

.state-humanities-the-arts [data-discipline="Medical and Health Sciences"],
.state-social-sciences [data-discipline="Medical and Health Sciences"] {
    --title-top: 20%;
}

.state-humanities-the-arts [data-discipline="Agricultural and Veterinary Sciences"],
.state-social-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
    --title-bottom: 65.8%;
}





[data-discipline="Natural Sciences"] {
    clip-path: polygon(0% 0%, 65% 0%, 54.57% 29.8%, 0% 29.8%);
}

[data-discipline="Engineering and Technology"] {
    clip-path: polygon(70% 0%, 100% 0%, 100% 29.8%, 59.57% 29.8%);
}

[data-discipline="Medical and Health Sciences"] {
    clip-path: polygon(0% 35.1%, 52.715% 35.1%, 42.285% 64.9%, 0% 64.9%);
}

[data-discipline="Agricultural and Veterinary Sciences"] {
    clip-path: polygon(57.715% 35.1%, 100% 35.1%, 100% 64.9%, 47.285% 64.9%);
}

[data-discipline="Humanities and the Arts"] {
    clip-path: polygon(0% 70.2%, 40.43% 70.2%, 30% 100%, 0% 100%);
}

[data-discipline="Social Sciences"] {
    clip-path: polygon(45.43% 70.2%, 100% 70.2%, 100% 100%, 35% 100%);
}

/* --- Natural Sciences Active (第一行展开) --- */
.state-natural-sciences [data-discipline="Natural Sciences"] {
    clip-path: polygon(0% 0%, 70% 0%, 49% 60%, 0% 60%);
}

.state-natural-sciences [data-discipline="Engineering and Technology"] {
    clip-path: polygon(75% 0%, 100% 0%, 100% 60%, 54% 60%);
}

.state-natural-sciences [data-discipline="Medical and Health Sciences"] {
    clip-path: polygon(0% 65.3%, 47.145% 65.3%, 42% 80%, 0% 80%);
}

.state-natural-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
    clip-path: polygon(52.145% 65.3%, 100% 65.3%, 100% 80%, 47% 80%);
}

.state-natural-sciences [data-discipline="Humanities and the Arts"] {
    clip-path: polygon(0% 85.3%, 40.145% 85.3%, 35% 100%, 0% 100%);
}

.state-natural-sciences [data-discipline="Social Sciences"] {
    clip-path: polygon(45.145% 85.3%, 100% 85.3%, 100% 100%, 40% 100%);
}

/* --- Engineering and Technology Active (第一行展开) --- */
.state-engineering-technology [data-discipline="Natural Sciences"] {
    clip-path: polygon(0% 0%, 55% 0%, 34% 60%, 0% 60%);
}

.state-engineering-technology [data-discipline="Engineering and Technology"] {
    clip-path: polygon(60% 0%, 100% 0%, 100% 60%, 39% 60%);
}

.state-engineering-technology [data-discipline="Medical and Health Sciences"] {
    clip-path: polygon(0% 65.3%, 32.145% 65.3%, 27% 80%, 0% 80%);
}

.state-engineering-technology [data-discipline="Agricultural and Veterinary Sciences"] {
    clip-path: polygon(37.145% 65.3%, 100% 65.3%, 100% 80%, 32% 80%);
}

.state-engineering-technology [data-discipline="Humanities and the Arts"] {
    clip-path: polygon(0% 85.3%, 25.145% 85.3%, 20% 100%, 0% 100%);
}

.state-engineering-technology [data-discipline="Social Sciences"] {
    clip-path: polygon(30.145% 85.3%, 100% 85.3%, 100% 100%, 25% 100%);
}

/* --- Engineering and Technology Active (第一行展开) --- */
/* .state-engineering-technology [data-discipline="Natural Sciences"] {
    clip-path: polygon(0% 0%, 15% 0%, 36% 60%, 0% 60%);
}

.state-engineering-technology [data-discipline="Engineering and Technology"] {
    clip-path: polygon(20% 0%, 100% 0%, 100% 60%, 41% 60%);
}

.state-engineering-technology [data-discipline="Medical and Health Sciences"] {
    clip-path: polygon(0% 65.3%, 37.855% 65.3%, 43% 80%, 0% 80%);
}

.state-engineering-technology [data-discipline="Agricultural and Veterinary Sciences"] {
    clip-path: polygon(42.855% 65.3%, 100% 65.3%, 100% 80%, 48% 80%);
}

.state-engineering-technology [data-discipline="Humanities and the Arts"] {
    clip-path: polygon(0% 85.3%, 44.855% 85.3%, 50% 100%, 0% 100%);
}

.state-engineering-technology [data-discipline="Social Sciences"] {
    clip-path: polygon(49.855% 85.3%, 100% 85.3%, 100% 100%, 55% 100%);
} */

/* --- Medical & Agricultural Active (第二行展开) --- */
.state-medical-health-sciences [data-discipline="Natural Sciences"] {
    clip-path: polygon(0% 0%, 70% 0%, 64.855% 14.7%, 0% 14.7%);
}

.state-medical-health-sciences [data-discipline="Engineering and Technology"] {
    clip-path: polygon(75% 0%, 100% 0%, 100% 14.7%, 69.855% 14.7%);
}

.state-medical-health-sciences [data-discipline="Medical and Health Sciences"] {
    clip-path: polygon(0% 20%, 63% 20%, 42% 80%, 0% 80%);
}

.state-medical-health-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
    clip-path: polygon(68% 20%, 100% 20%, 100% 80%, 47% 80%);
}

.state-medical-health-sciences [data-discipline="Humanities and the Arts"] {
    clip-path: polygon(0% 85.3%, 40.145% 85.3%, 35% 100%, 0% 100%);
}

.state-medical-health-sciences [data-discipline="Social Sciences"] {
    clip-path: polygon(45.145% 85.3%, 100% 85.3%, 100% 100%, 40% 100%);
}




.state-agricultural-veterinary-sciences [data-discipline="Natural Sciences"] {
    clip-path: polygon(0% 0%, 55% 0%, 49.855% 14.7%, 0% 14.7%);
}


.state-agricultural-veterinary-sciences [data-discipline="Engineering and Technology"] {
    clip-path: polygon(60% 0%, 100% 0%, 100% 14.7%, 54.855% 14.7%);
}


.state-agricultural-veterinary-sciences [data-discipline="Medical and Health Sciences"] {
    clip-path: polygon(0% 20%, 48% 20%, 27% 80%, 0% 80%);
}


.state-agricultural-veterinary-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
    clip-path: polygon(53% 20%, 100% 20%, 100% 80%, 32% 80%);
}


.state-agricultural-veterinary-sciences [data-discipline="Humanities and the Arts"] {
    clip-path: polygon(0% 85.3%, 25.145% 85.3%, 20% 100%, 0% 100%);
}


.state-agricultural-veterinary-sciences [data-discipline="Social Sciences"] {
    clip-path: polygon(30.145% 85.3%, 100% 85.3%, 100% 100%, 25% 100%);
}

/* --- Humanities Active (第三行展开) --- */
.state-humanities-the-arts [data-discipline="Natural Sciences"] {
    clip-path: polygon(0% 0%, 70% 0%, 64.855% 14.7%, 0% 14.7%);
}

.state-humanities-the-arts [data-discipline="Engineering and Technology"] {
    clip-path: polygon(75% 0%, 100% 0%, 100% 14.7%, 69.855% 14.7%);
}

.state-humanities-the-arts [data-discipline="Medical and Health Sciences"] {
    clip-path: polygon(0% 20%, 63% 20%, 57.855% 34.7%, 0% 34.7%);
}

.state-humanities-the-arts [data-discipline="Agricultural and Veterinary Sciences"] {
    clip-path: polygon(68% 20%, 100% 20%, 100% 34.7%, 62.855% 34.7%);
}

.state-humanities-the-arts [data-discipline="Humanities and the Arts"] {
    clip-path: polygon(0% 40%, 56% 40%, 35% 100%, 0% 100%);
}

.state-humanities-the-arts [data-discipline="Social Sciences"] {
    clip-path: polygon(61% 40%, 100% 40%, 100% 100%, 40% 100%);
}

/* --- Social Sciences Active (第三行展开) --- */
.state-social-sciences [data-discipline="Natural Sciences"] {
    clip-path: polygon(0% 0%, 55% 0%, 49.855% 14.7%, 0% 14.7%);
}

.state-social-sciences [data-discipline="Engineering and Technology"] {
    clip-path: polygon(60% 0%, 100% 0%, 100% 14.7%, 54.855% 14.7%);
}

.state-social-sciences [data-discipline="Medical and Health Sciences"] {
    clip-path: polygon(0% 20%, 48% 20%, 42.855% 34.7%, 0% 34.7%);
}

.state-social-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
    clip-path: polygon(53% 20%, 100% 20%, 100% 34.7%, 47.855% 34.7%);
}

.state-social-sciences [data-discipline="Humanities and the Arts"] {
    clip-path: polygon(0% 40%, 41% 40%, 20% 100%, 0% 100%);
}

.state-social-sciences [data-discipline="Social Sciences"] {
    clip-path: polygon(46% 40%, 100% 40%, 100% 100%, 25% 100%);
}

@media (max-width: 768px) {
    [data-discipline="Natural Sciences"] {
        clip-path: polygon(0% 0%, 65.5% 0%, 54.51% 31.4%, 0% 31.4%);
    }

    [data-discipline="Engineering and Technology"] {
        clip-path: polygon(70% 0%, 100% 0%, 100% 31.4%, 59.01% 31.4%);
    }

    [data-discipline="Medical and Health Sciences"] {
        clip-path: polygon(0% 34.3%, 53.495% 34.3%, 42.505% 65.7%, 0% 65.7%);
    }

    [data-discipline="Agricultural and Veterinary Sciences"] {
        clip-path: polygon(57.995% 34.3%, 100% 34.3%, 100% 65.7%, 47.005% 65.7%);
    }

    [data-discipline="Humanities and the Arts"] {
        clip-path: polygon(0% 68.6%, 41.49% 68.6%, 30.5% 100%, 0% 100%);
    }

    [data-discipline="Social Sciences"] {
        clip-path: polygon(45.99% 68.6%, 100% 68.6%, 100% 100%, 35% 100%);
    }

    /* --- Natural Sciences Active (第一行展开) --- */
    .state-natural-sciences [data-discipline="Natural Sciences"] {
        clip-path: polygon(0% 0%, 78.485% 0%, 51.5% 77.1%, 0% 77.1%);
    }

    .state-natural-sciences [data-discipline="Engineering and Technology"] {
        clip-path: polygon(82.985% 0%, 100% 0%, 100% 77.1%, 56% 77.1%);
    }

    .state-natural-sciences [data-discipline="Medical and Health Sciences"] {
        clip-path: polygon(0% 80%, 50.5% 80%, 47.5% 88.55%, 0% 88.55%);
    }

    .state-natural-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
        clip-path: polygon(55% 80%, 100% 80%, 100% 88.55%, 52% 88.55%);
    }

    .state-natural-sciences [data-discipline="Humanities and the Arts"] {
        clip-path: polygon(0% 91.45%, 46.5% 91.45%, 43.5% 100%, 0% 100%);
    }

    .state-natural-sciences [data-discipline="Social Sciences"] {
        clip-path: polygon(51% 91.45%, 100% 91.45%, 100% 100%, 48% 100%);
    }

    /* --- Engineering Active (第一行展开) --- */
    .state-engineering-technology [data-discipline="Natural Sciences"] {
        clip-path: polygon(0% 0%, 26.985% 0%, 0% 77.1%, 0% 77.1%);
    }

    .state-engineering-technology [data-discipline="Engineering and Technology"] {
        clip-path: polygon(31.485% 0%, 100% 0%, 100% 77.1%, 4.5% 77.1%);
    }

    .state-engineering-technology [data-discipline="Medical and Health Sciences"] {
        clip-path: polygon(0% 80%, 50.5% 80%, 47.5% 88.55%, 0% 88.55%);
    }

    .state-engineering-technology [data-discipline="Agricultural and Veterinary Sciences"] {
        clip-path: polygon(55% 80%, 100% 80%, 100% 88.55%, 52% 88.55%);
    }

    .state-engineering-technology [data-discipline="Humanities and the Arts"] {
        clip-path: polygon(0% 91.45%, 46.5% 91.45%, 43.5% 100%, 0% 100%);
    }

    .state-engineering-technology [data-discipline="Social Sciences"] {
        clip-path: polygon(51% 91.45%, 100% 91.45%, 100% 100%, 48% 100%);
    }

    /* --- Medical Active (第二行展开) --- */
    .state-medical-health-sciences [data-discipline="Natural Sciences"] {
        clip-path: polygon(0% 0%, 53.5% 0%, 50.5% 8.55%, 0% 8.55%);
    }

    .state-medical-health-sciences [data-discipline="Engineering and Technology"] {
        clip-path: polygon(58% 0%, 100% 0%, 100% 8.55%, 55% 8.55%);
    }

    .state-medical-health-sciences [data-discipline="Medical and Health Sciences"] {
        clip-path: polygon(0% 11.45%, 74.485% 11.45%, 47.5% 88.55%, 0% 88.55%);
    }

    .state-medical-health-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
        clip-path: polygon(78.985% 11.45%, 100% 11.45%, 100% 88.55%, 52% 88.55%);
    }

    .state-medical-health-sciences [data-discipline="Humanities and the Arts"] {
        clip-path: polygon(0% 91.45%, 46.5% 91.45%, 43.5% 100%, 0% 100%);
    }

    .state-medical-health-sciences [data-discipline="Social Sciences"] {
        clip-path: polygon(51% 91.45%, 100% 91.45%, 100% 100%, 48% 100%);
    }

    /* --- Agricultural Active (第二行展开) --- */
    .state-agricultural-veterinary-sciences [data-discipline="Natural Sciences"] {
        clip-path: polygon(0% 0%, 53.5% 0%, 50.5% 8.55%, 0% 8.55%);
    }

    .state-agricultural-veterinary-sciences [data-discipline="Engineering and Technology"] {
        clip-path: polygon(58% 0%, 100% 0%, 100% 8.55%, 55% 8.55%);
    }

    .state-agricultural-veterinary-sciences [data-discipline="Medical and Health Sciences"] {
        clip-path: polygon(0% 11.45%, 49.5% 11.45%, 22.515% 88.55%, 0% 88.55%);
    }

    .state-agricultural-veterinary-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
        clip-path: polygon(54% 11.45%, 100% 11.45%, 100% 88.55%, 27.015% 88.55%);
    }

    .state-agricultural-veterinary-sciences [data-discipline="Humanities and the Arts"] {
        clip-path: polygon(0% 91.45%, 46.5% 91.45%, 43.5% 100%, 0% 100%);
    }

    .state-agricultural-veterinary-sciences [data-discipline="Social Sciences"] {
        clip-path: polygon(51% 91.45%, 100% 91.45%, 100% 100%, 48% 100%);
    }

    /* --- Humanities Active (第三行展开) --- */
    .state-humanities-the-arts [data-discipline="Natural Sciences"] {
        clip-path: polygon(0% 0%, 53.5% 0%, 50.5% 8.55%, 0% 8.55%);
    }

    .state-humanities-the-arts [data-discipline="Engineering and Technology"] {
        clip-path: polygon(58% 0%, 100% 0%, 100% 8.55%, 55% 8.55%);
    }

    .state-humanities-the-arts [data-discipline="Medical and Health Sciences"] {
        clip-path: polygon(0% 11.45%, 49.5% 11.45%, 46.5% 20%, 0% 20%);
    }

    .state-humanities-the-arts [data-discipline="Agricultural and Veterinary Sciences"] {
        clip-path: polygon(54% 11.45%, 100% 11.45%, 100% 20%, 51% 20%);
    }

    .state-humanities-the-arts [data-discipline="Humanities and the Arts"] {
        clip-path: polygon(0% 22.9%, 92.485% 22.9%, 65.5% 100%, 0% 100%);
    }

    .state-humanities-the-arts [data-discipline="Social Sciences"] {
        clip-path: polygon(96.985% 22.9%, 100% 22.9%, 100% 100%, 70% 100%);
    }

    /* --- Social Sciences Active (第三行展开) --- */
    .state-social-sciences [data-discipline="Natural Sciences"] {
        clip-path: polygon(0% 0%, 53.5% 0%, 50.5% 8.55%, 0% 8.55%);
    }

    .state-social-sciences [data-discipline="Engineering and Technology"] {
        clip-path: polygon(58% 0%, 100% 0%, 100% 8.55%, 55% 8.55%);
    }

    .state-social-sciences [data-discipline="Medical and Health Sciences"] {
        clip-path: polygon(0% 11.45%, 49.5% 11.45%, 46.5% 20%, 0% 20%);
    }

    .state-social-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
        clip-path: polygon(54% 11.45%, 100% 11.45%, 100% 20%, 51% 20%);
    }

    .state-social-sciences [data-discipline="Humanities and the Arts"] {
        clip-path: polygon(0% 22.9%, 32.5% 22.9%, 5.515% 100%, 0% 100%);
    }

    .state-social-sciences [data-discipline="Social Sciences"] {
        clip-path: polygon(37% 22.9%, 100% 22.9%, 100% 100%, 10.015% 100%);
    }


    [data-discipline="Engineering and Technology"] .title,
    [data-discipline="Agricultural and Veterinary Sciences"] .title,
    [data-discipline="Social Sciences"] .title {
        text-align: right;
    }

    /* -- 左侧三个标题 (左上角) -- */
    [data-discipline="Natural Sciences"] {
        --title-top: 0;
        --title-left: 0;
    }

    [data-discipline="Medical and Health Sciences"] {
        --title-top: 34.3%;
        /* 可见区域的顶部边缘 */
        --title-left: 0;
    }

    [data-discipline="Humanities and the Arts"] {
        --title-top: 68.6%;
        /* 可见区域的顶部边缘 */
        --title-left: 0;
    }

    /* -- 右侧三个标题 (右下角) -- */
    [data-discipline="Engineering and Technology"] {
        --title-bottom: 69.2%;
        /* 100% - 可见区域的底部边缘 */
        --title-right: 0;
    }

    [data-discipline="Agricultural and Veterinary Sciences"] {
        --title-bottom: 34.9%;
        /* 100% - 可见区域的底部边缘 */
        --title-right: 0;
    }

    [data-discipline="Social Sciences"] {
        --title-bottom: 0.6%;
        --title-right: 0;
    }

    .state-natural-sciences [data-discipline="Engineering and Technology"] {
        --title-bottom: 23.5%;
    }

    .state-engineering-technology [data-discipline="Natural Sciences"] {
        --title-top: 0;
    }

    .state-natural-sciences [data-discipline="Medical and Health Sciences"],
    .state-engineering-technology [data-discipline="Medical and Health Sciences"] {
        --title-top: 80.1%;
    }

    .state-natural-sciences [data-discipline="Agricultural and Veterinary Sciences"],
    .state-engineering-technology [data-discipline="Agricultural and Veterinary Sciences"] {
        --title-bottom: 11.9%;
    }

    .state-natural-sciences [data-discipline="Humanities and the Arts"],
    .state-engineering-technology [data-discipline="Humanities and the Arts"] {
        --title-top: 91.45%;
    }

    .state-natural-sciences [data-discipline="Social Sciences"],
    .state-engineering-technology [data-discipline="Social Sciences"] {
        --title-bottom: 0.6%;
    }


    /* -- 状态二: Medical 或 Agricultural 激活时 (第二行展开) -- */
    .state-medical-health-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
        --title-bottom: 11.9%;
    }

    .state-agricultural-veterinary-sciences [data-discipline="Medical and Health Sciences"] {
        --title-top: 11.45%;
    }

    .state-medical-health-sciences [data-discipline="Natural Sciences"],
    .state-agricultural-veterinary-sciences [data-discipline="Natural Sciences"] {
        --title-top: 0;
    }

    .state-medical-health-sciences [data-discipline="Engineering and Technology"],
    .state-agricultural-veterinary-sciences [data-discipline="Engineering and Technology"] {
        --title-bottom: calc(100% - 8%);
    }

    .state-medical-health-sciences [data-discipline="Humanities and the Arts"],
    .state-agricultural-veterinary-sciences [data-discipline="Humanities and the Arts"] {
        --title-top: 91.45%;
    }

    .state-medical-health-sciences [data-discipline="Social Sciences"],
    .state-agricultural-veterinary-sciences [data-discipline="Social Sciences"] {
        --title-bottom: 0.6%;
    }


    /* -- 状态三: Humanities 或 Social 激活时 (第三行展开) -- */
    .state-social-sciences [data-discipline="Humanities and the Arts"] {
        --title-top: 23%;
    }

    .state-humanities-the-arts [data-discipline="Social Sciences"] {
        --title-bottom: 0;
    }

    .state-humanities-the-arts [data-discipline="Natural Sciences"],
    .state-social-sciences [data-discipline="Natural Sciences"] {
        --title-top: 0;
    }

    .state-humanities-the-arts [data-discipline="Engineering and Technology"],
    .state-social-sciences [data-discipline="Engineering and Technology"] {
        --title-bottom: calc(100% - 8%);
    }

    .state-humanities-the-arts [data-discipline="Medical and Health Sciences"],
    .state-social-sciences [data-discipline="Medical and Health Sciences"] {
        --title-top: 11.45%;
    }

    .state-humanities-the-arts [data-discipline="Agricultural and Veterinary Sciences"],
    .state-social-sciences [data-discipline="Agricultural and Veterinary Sciences"] {
        --title-bottom: calc(100% - 19.5%);
    }

    [data-discipline="Natural Sciences"] .bg-image {
        width: 90%;
        height: 80%;
        top: 0%;
        right: 10%;
        object-position: 0% 40%;
    }

    [data-discipline="Engineering and Technology"] .bg-image {
        width: 100%;
        height: 80%;
        top: auto;
        right: auto;
        left: 0%;
        bottom: 20%;
        object-position: 0% 0%;
    }

    [data-discipline="Medical and Health Sciences"] .bg-image {
        width: 100%;
        height: 80%;
        bottom: 10%;
        right: 0%;
        top: auto;
        right: auto;
        object-position: 90% 20%;
        /* 默认居中 */
    }

    [data-discipline="Agricultural and Veterinary Sciences"] .bg-image {
        object-position: 40% 30%;
        width: 80%;
        height: 80%;
        top: 10%;
        left: 20%;

        /* 焦点偏上，看更多灯光 */
    }

    [data-discipline="Humanities and the Arts"] .bg-image {
        width: 100%;
        height: 80%;
        top: 20%;
        right: 0%;
        object-position: 0% 40%;
        /* 焦点偏下 */
    }

    [data-discipline="Social Sciences"] .bg-image {
        object-position: 50% 40%;
        width: 100%;
        height: 80%;
        top: 20%;

        /* 焦点偏下 */
    }
}

.year-badge.status-blue,
.status-dot.status-blue {
    background-color: #0d6efd;
    /* 一个标准的蓝色 */
}

/* 2. 管理员快速筛选按钮的样式 */
.admin-quick-filter-btn {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    /* 与下方的 Featured 保持距离 */
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.admin-quick-filter-btn:hover {
    background-color: #e9ecef;
}

/* 3. 按钮的“激活”状态 */
.admin-quick-filter-btn.active {
    background-color: #3B1977;
    /* 您的主题色 */
    color: white;
    border-color: #3B1977;
}

.featured-control-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    /* 覆盖 filter-group 的默认边距 */
}

.featured-control-inline h3 {
    margin: 0;
    font-size: 1rem;
    /* 与 "Sort by" 等文字大小一致 */
    font-weight: 600;
    color: #666;
}

@media (max-width: 768px) {

    .hero-section {
        text-align: center;
        padding: 0.4rem 1rem 2rem 1rem;
    }

    .hero-section h1 {
        font-size: 7vw;
        margin-bottom: 0rem;
    }

    /* --- 3. 核心：按比例缩小交互式网格 --- */
    #interactive-homepage {
        border-radius: 10px;
        aspect-ratio: 2 / 3;
    }

    /* --- 4. 调整网格内部元素的字体和间距 --- */
    .discipline-panel .title {
        font-size: 4vw;
        /* 进一步增大相对字体大小 */
        line-height: 1.1;
        /* 减小行高，以适应可能的多行文本 */
        padding: 1vw 2vw;
        /* 减小内边距 */
    }

    /* 调整 subject 卡片，使其更紧凑 */
    .subjects-view {
        gap: 2vw;
        /* 减小卡片之间的间距 */
    }

    .subject-card-dynamic {
        font-size: 3.8vw;
        /* 增大相对字体大小 */
        padding: 0.8vw 1.5vw;
        border-radius: 10px;
    }

    .subject-card-dynamic .subject-zh {
        font-size: 0.65em;
        margin-top: 2px;
    }

    [data-discipline="Natural Sciences"] .subjects-view {
        flex-direction: column;
        align-items: flex-start;
        padding-right: 6%;
    }


    [data-discipline="Natural Sciences"] .subject-card-dynamic {
        font-size: 3.1vw;
        border-radius: 8px;
    }

    [data-discipline="Natural Sciences"] .subject-card-dynamic .subject-zh {
        font-size: 0.8em;
    }

    [data-discipline="Engineering and Technology"] .subject-card-dynamic {
        font-size: 2.8vw;
        border-radius: 7px;
        /* 将字体大小调整为比默认值 clamp(20px, 1vw, 40px) 更小 */
    }

    [data-discipline="Engineering and Technology"] .subject-card-dynamic .subject-zh {
        font-size: 0.85em;
    }

    [data-discipline="Engineering and Technology"] .subjects-view {
        gap: 20vw;
        row-gap: 2vw;
        /* 减小卡片之间的间距 */
    }

    @supports (-webkit-touch-callout: none) {

        /* 进一步减小 Natural Sciences 在 iOS 上的字体大小 */
        [data-discipline="Natural Sciences"] .subject-card-dynamic {
            font-size: 2.8vw;
        }

        /* 进一步减小 Engineering and Technology 在 iOS 上的字体大小 */
        [data-discipline="Engineering and Technology"] .subject-card-dynamic {
            font-size: 2.5vw;
        }

        [data-discipline="Natural Sciences"] .subject-card-dynamic .subject-zh {
            font-size: 0.9em;
        }

        [data-discipline="Engineering and Technology"] .subject-card-dynamic .subject-zh {
            font-size: 1em;
        }
    }


    [data-discipline="Natural Sciences"] .subjects-view {
        padding: 19% 25% 6% 4%;
    }

    [data-discipline="Engineering and Technology"] .subjects-view {
        padding: 8% 4% 6% 21%;
    }

    [data-discipline="Medical and Health Sciences"] .subjects-view {
        padding: 5% 55% 5% 4%;
    }

    [data-discipline="Agricultural and Veterinary Sciences"] .subjects-view {
        padding: 5% 4% 5% 45%;
    }

    [data-discipline="Humanities and the Arts"] .subjects-view {
        padding: 6% 25% 33% 4%;
    }

    [data-discipline="Social Sciences"] .subjects-view {
        padding: 6% 4% 10% 25%;
    }
}

/* =================================================================
   START: Mobile Navigation Styles
   ================================================================= */
.mobile-nav-trigger,
.mobile-search-trigger {
    display: none;
    /* 默认在桌面端隐藏 */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1002;
    color: #3B1977;
}


@media (max-width: 768px) {

    /* 调整图标按钮的内边距和外边距来微调其位置和点击区域 */
    .mobile-search-trigger {
        padding: 8px;
        /* 减小内边距，让图标更紧凑 */
        margin-top: 3px;
        margin-right: 4px;
        /* 在搜索图标和右边的菜单图标之间增加一点空隙 */
    }

    .mobile-nav-trigger {
        margin-right: -9px;
        /* 增加这个属性 */
    }

    /* 调整SVG本身的大小 */
    .mobile-search-trigger svg {
        width: 22px;
        /* 将宽度从默认的24px减小 */
        height: 22px;
        /* 将高度从默认的24px减小 */
    }
}

.mobile-nav-trigger .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #3B1977;
    margin: 5px 0;
    transition: all 0.3s ease-in-out;
}


@media (max-width: 768px) {
    .header-content {
        grid-template-columns: auto 1fr auto auto;
        /* Logo | 弹性空间 | 搜索图标 | 菜单图标 */
        gap: 15px;
        width: 90%;
        padding-top: 6px;
        padding-bottom: 6px;
        min-height: 60px;

        /* 
          【优化】
          确保在所有状态下，内部元素都是垂直居中的。
          这样当显示较矮的搜索框时，它不会贴在顶部，而是居中显示，更美观。
        */
        align-items: center;
    }

    .logo a img {
        /* 将 Logo 的高度从 50px (桌面端默认值) 减小到 40px */
        height: 40px;
    }

    /* 隐藏桌面版导航和搜索框 */
    .search-bar {
        display: none;
    }

    /* 显示移动版图标 */
    .mobile-nav-trigger,
    .mobile-search-trigger {
        display: block;
    }

    .logo {
        grid-column: 1;
    }

    .mobile-search-trigger {
        grid-column: 3;
    }

    .mobile-nav-trigger {
        grid-column: 4;
    }
}

@media (max-width: 768px) {

    /* 当导航展开时 (通过JS添加 .mobile-nav-active 类) */
    nav {
        /* 强制布局 */
        display: flex !important;
        flex-direction: column;
        justify-content: flex-start;

        /* 关键：彻底清除间距，避免关闭时跳变 */
        gap: 0 !important;
        padding: 0 !important;

        /* 定位 */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #fdfdfd;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
        z-index: 1002;

        /* 动画属性 */
        max-height: 0;
        opacity: 0;
        overflow-y: auto;
        overflow-x: hidden;
        visibility: hidden;

        /* 这里的 transition 只负责高度和透明度，不负责 padding */
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.3s ease,
            visibility 0.4s;
    }

    /* --- 2. 激活状态：只负责“展开” --- */
    /* 这里的代码越少越好，只放变化属性 */
    .mobile-nav-active nav {
        position: fixed;
        top: 60px;
        /* Set to the exact height of your mobile header */
        z-index: 1002;
        /* Adjust height to fill the rest of the screen */
        max-height: calc(100vh - 60px);
        /* Fallback for older browsers */
        max-height: calc(100dvh - 60px);
        /* Modern unit for dynamic viewport height */

        opacity: 1;
        visibility: visible;
        overflow-y: auto;
        /* Allow the menu itself to be scrollable if content is long */

        /* Animation properties for opening */
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.3s ease,
            visibility 0s;
    }

    header:has(.mobile-nav-active) {
        z-index: 1002;
    }

    /* --- 3. 链接项：无论开关，间距必须固定 --- */
    nav .nav-item {
        width: 100%;
        margin: 0;
    }

    nav .nav-item>a {
        /* 布局结构 */
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;

        /* 关键：固定高度支撑，防止关闭瞬间塌陷 */
        padding: 24px 6vw !important;

        text-decoration: none;
        color: #3B1977;
        font-size: 1.2rem;
        font-weight: 700;
        box-sizing: border-box;
    }

    /* --- 4. 首尾补偿：必须一直生效，不能只在 active 时生效 --- */
    /* 这样关闭动画时，它们依然保持着较大的上下边距，不会突然收缩 */
    nav .nav-item:first-child>a {
        padding-top: 25px !important;
        /* 补偿容器顶部的空缺 */
    }

    nav .nav-item:last-child>a,
    nav>.nav-item:last-of-type>a {
        padding-bottom: 25px !important;
        /* 补偿容器底部的空缺 */
    }

    nav .nav-arrow svg {
        width: 16px;
        height: 16px;
    }

    .dropdown-content {
        /* 覆盖原来的 absolute 定位和 display 切换 */
        position: static !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        transform: none !important;
        background-color: #fdfdfd;
        /* 核心动画属性 */
        display: block !important;
        /* 强制显示，以便动画生效 */
        max-height: 0;
        overflow: hidden;
        opacity: 0;

        transition:
            max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            padding-top 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            padding-bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.3s ease-out,
            visibility 0s linear 0.4s;

        padding-left: 20px;
        padding-right: 6vw;
        /* 折叠时移除 padding */
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    /* 展开状态 */
    .dropdown.open .dropdown-content {
        /* 设置一个较大的 max-height，确保能容纳所有子项 */
        max-height: 2000px;
        opacity: 1;

        /* 展开时恢复 padding，注意保持与原设计一致 */
        padding-top: 0px !important;
        padding-bottom: 10px !important;
        transition:
            max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            padding-top 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            padding-bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.3s ease-in,
            visibility 0s;
    }

    .discipline-list>li .subject-list {
        display: block !important;
        /* 同样覆盖 display: none */
        max-height: 0;
        overflow: hidden;
        opacity: 0;

        /* 左侧缩进保持不变 */
        padding-left: 10px;
        margin-top: 0;

        /* 过渡效果 */
        transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
    }

    /* 展开状态 */
    .discipline-list>li.active>.subject-list {
        /* 这里的 max-height 需要估算，一般 1000px 足够 */
        max-height: 1200px;
        opacity: 1;
        margin-top: 10px;
        /* 展开时增加一点顶部间距 */
    }

    /* 箭头旋转动画优化 */
    .discipline-list {
        border-right: none !important;
        border: none !important;
        /* 双重保险 */
        width: 100% !important;
        /* 确保占满宽度，不给边框留位置 */
    }

    .discipline-name {
        font-weight: 700;
    }

    .dropdown-content .simple-list li a {
        font-weight: 700;
    }

    .mobile-nav-active .dropdown-content .discipline-list,
    .mobile-nav-active .dropdown-content .subject-list-container {
        flex: none;
        width: 100%;
        border: none;
        padding: 0;
    }

    /* 汉堡图标 -> 关闭(X)图标的变换 */
    .mobile-nav-active .mobile-nav-trigger .icon-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .mobile-nav-active .mobile-nav-trigger .icon-bar:nth-child(2) {
        opacity: 0;
    }

    .mobile-nav-active .mobile-nav-trigger .icon-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .discipline-list li a,
    .discipline-list li.active a,
    .discipline-list li:hover a,
    .subject-list li a,
    .simple-list li a,
    /* <--- 新增这行 (Explore 常态) */
    .simple-list li a:hover {
        background-color: transparent !important;
        /* 关键：强制透明 */
        color: #3B1977 !important;
        /* 保持文字颜色 */
    }

    /* 2. 确保之前用于显示激活状态的二级菜单文字颜色正确 */
    /* 当 discipline 展开时，我们只改变箭头方向，不改变背景 */
    .discipline-list li.active>a {
        background-color: transparent !important;
    }

    /* 3. 如果桌面端有伪元素（如右侧箭头），也强制隐藏 */
    .discipline-list li a::after {
        display: none !important;
        content: none !important;
    }

    .discipline-list li a,
    .dropdown-content .simple-list li a,
    .subject-list li a {
        white-space: normal !important;
        /* 核心：允许换行 */
        height: auto !important;
    }

    .discipline-list li a {
        padding-right: 0;
    }

    /* 3. 针对三级菜单 (Subject List) */
    /* 确保中英文都能正确换行 */
    .subject-list .subject-en,
    .subject-list .subject-zh {
        display: block;
        /* 确保它们各占一行（如果需要的话），或者保持内联块 */
        width: 100%;
        /* 撑满宽度 */
        white-space: normal;
        /* 允许换行 */
    }
}

@media (max-width: 768px) {

    .header-content.mobile-search-active .logo,
    .header-content.mobile-search-active .mobile-search-trigger {
        display: none;
    }

    .header-content.mobile-search-active .search-bar {
        display: flex;
        grid-column: 1 / 4;
        /* 让搜索框占据logo、空白区域和原搜索图标的位置 */
    }

    /* 将菜单图标转换为“X”关闭按钮的动画 */
    .header-content.mobile-search-active .mobile-nav-trigger .icon-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .header-content.mobile-search-active .mobile-nav-trigger .icon-bar:nth-child(2) {
        opacity: 0;
    }

    .header-content.mobile-search-active .mobile-nav-trigger .icon-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* (可选，但推荐) 防止在搜索激活时意外打开导航菜单 */
    .header-content.mobile-search-active.mobile-nav-active nav {
        display: none;
    }

    .header-content.mobile-search-active .search-container {
        width: 100%;
        /* 您可以修改这个值，例如 90% 或 100% */
        margin: 0 auto;
        /* 保持搜索框水平居中 */
    }

    /* --- 2. 调整提交按钮（SVG图标）的颜色和大小 --- */
    .header-content.mobile-search-active .search-button {
        color: #3B1977;
        /* 修改为您想要的任何颜色 */
    }

    .header-content.mobile-search-active .search-button svg {
        /* 直接设置SVG的宽高来改变图标大小 */
        width: 22px;
        /* 修改为您想要的大小 */
        height: 22px;
        /* 修改为您想要的大小 */
    }

    /* --- 3. (可选但推荐) 调整输入框的内边距以适应更大的图标 --- */
    /*
      如果您的图标变得很大，可能需要增加输入框右侧的内边距，
      以防止您输入的文字与图标重叠。
    */
    .header-content.mobile-search-active .search-container input {
        padding-right: 50px;
        /* 默认是45px，可以根据图标大小微调 */
    }

    .header-content.mobile-search-active .search-container input {
        padding-left: 12px;
        /* 您可以修改这个值，默认是 20px */
    }

    /* --- 2. 缩小提示词的字体大小 --- */
    /* 
      我们使用 ::placeholder 伪元素来单独设置提示词的样式。
      为了兼容所有浏览器，我们会写多个选择器。
    */
    .header-content.mobile-search-active .search-container input::-webkit-input-placeholder {
        /* Chrome, Safari, Edge */
        font-size: 0.85rem;
        /* 您可以修改这个值，默认是 1rem */
    }

    .header-content.mobile-search-active .search-container input:-ms-input-placeholder {
        /* Internet Explorer 10-11 */
        font-size: 0.85rem;
    }

    .header-content.mobile-search-active .search-container input::placeholder {
        /* 标准语法 */
        font-size: 0.85rem;
    }

    .header-content.mobile-search-active .search-container input[type="search"] {
        padding-right: 60px;
        /* 您可以微调这个值 */

        /* 添加一个平滑的过渡效果 */
    }

    /* 特殊状态 (当输入框为空，提示词正在显示时) */
    /* 我们使用 :placeholder-shown 来设置一个仅够容纳“提交按钮”的较小内边距 */
    .header-content.mobile-search-active .search-container input[type="search"]:placeholder-shown {
        padding-right: 45px;
        /* 这个值应该比上面的小 */
    }

    .header-content.mobile-search-active .search-container input[type="search"]::-webkit-search-cancel-button {

        /* 【关键 1】移除浏览器默认的样式和图标 */
        -webkit-appearance: none;

        /* 【关键 2】指定您的本地 SVG 文件的路径 */
        /* 请将 /public/images/close.svg 替换为您实际的 SVG 文件路径 */
        background-image: url("/public/images/clear.svg");

        /* 【关键 3】设置 SVG 的显示尺寸 */
        width: 18px;
        /* 设置您想要的尺寸 */
        height: 18px;
        /* 设置您想要的尺寸 */

        /* 确保背景图标能显示出来，并且居中 */
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        /* 确保整个 SVG 图标都显示在按钮区域内 */

        /* 保持光标样式 */
        cursor: pointer;
        margin-right: -15px;
        -webkit-tap-highlight-color: transparent;
        outline: none;
    }


}

@media (max-width: 768px) {

    /* --- 第 1 步: 移除导航项容器 (div.nav-item) 的所有外边距 --- */
    /* 这是最可能导致额外间距的“元凶”。*/
    .mobile-nav-active nav .nav-item {
        margin: 0;
    }

    /* --- 第 2 步: 移除导航父容器 (nav) 可能存在的 flex/grid 间隙 --- */
    .mobile-nav-active nav {
        gap: 0;
    }

    /* --- 第 3 步: 现在，只用这个 padding 来精确控制间距 --- */
    /* 这里的上下内边距将是各项之间唯一的垂直空间来源。*/
    .mobile-nav-active nav .nav-item>a {
        /* 
          现在，您可以完全通过修改第一个值来控制间距。
          - padding: 10px 25px;  // 上下各有10px留白，总间距20px
          - padding: 5px 25px;   // 上下各有5px留白，总间距10px
          - padding: 0 25px;     // 没有任何垂直间距，完全贴合
        */
        padding: 20px 25px;
        /* <--- 现在请只修改这个值来调整间距 */
    }

    .mobile-nav-active nav .dropdown>a {
        /* 
              之前的值是 20px，这里我们把它减小。
              您可以根据需要修改这个值，例如 8px 或 5px。
            */
        padding-bottom: 20px;
    }

    /* --- 2. 调整 "Natural Sciences" 上方的间距 --- */
    /* 
          我们给下拉菜单的内容容器添加一点上内边距，
          这样第一项就不会完全贴着上面的 "Disciplines"。
        */
    .mobile-nav-active nav .dropdown-content {
        /* 您可以修改这个值来精确控制内部的顶部间距 */
        padding-top: 0px;
    }

    .mobile-nav-active nav .dropdown>a:hover {
        color: #3B1977;
        /* 保持默认颜色 */
        background-color: transparent;
        /* 移除悬停背景 */
    }

    /* --- 2. 【核心】只在展开时改变颜色 --- */
    /* 
      这个选择器定位到拥有 .open 类的 .dropdown 元素下的直接子链接 <a>,
      从而只在菜单展开时应用样式。
    */
    .mobile-nav-active nav .dropdown.open>a {
        color: #5d00ff;
        /* 这是您在桌面端悬停时使用的“激活”颜色 */
    }


}


@media (max-width: 768px) {

    /* --- 全局 --- */
    .mobile-nav-active .subject-list-container {
        display: none;
    }

    .discipline-list>li>a,
    .simple-list li a {
        /* <--- 新增这行，让 Explore 菜单项也应用 10px 间距 */
        /* 将上下内边距从桌面端的 12px 减小 */
        padding-top: 15px !important;
        padding-bottom: 15px !important;
    }

    /* --- 3. 减小三级菜单项 (如 "Biological Sciences") 的间距 --- */
    .discipline-list>li.active>.subject-list {
        margin-top: 5px;
        /* 将列表和父项的距离从 10px 减小 */
    }

    .subject-list li a {
        /* 减小每个子项的上下内边距 */
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }

    /* 移除在展开或悬停时的紫色背景 */
    .mobile-nav-active .discipline-list>li.active>a,
    .mobile-nav-active .discipline-list>li>a:hover {
        background-color: transparent;
    }

    /* 移除桌面端残留的 '>' 箭头 */
    .mobile-nav-active .discipline-list>li>a::after {
        content: none;
    }

    /* 设置 SVG 折叠箭头的动画 */
    .mobile-nav-active .discipline-list>li>a .nav-arrow svg {
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        transform-origin: center;
        transform: rotate(0deg);
        /* 默认状态 */
    }

    .discipline-list>li>a .nav-arrow {
        /* 1. 设置固定的宽高，使其成为正方形 */
        width: 16px;
        height: 16px;

        /* 2. 使用 Flexbox 让内部的 SVG 图标绝对居中 */
        display: flex;
        align-items: center;
        justify-content: center;
        /* 3. 重置桌面端可能存在的 margin-top，防止偏下 */
        margin-top: 0;
        margin-left: auto;
        /* 确保它紧贴右侧（如果父级用了 space-between，这行是双保险） */
        margin-right: 0px;

    }

    /* 2. 定义旋转状态：只针对被激活的一级菜单项 (> li.active) 的直接子链接 (> a) */
    /* 关键在于使用了两个 ">"，阻断了样式向下级传递 */
    .dropdown-content .nav-arrow {
        transform: none !important;
    }

    /* 2. 定义一级菜单项 (Disciplines list) 箭头旋转逻辑 */
    /* 只针对 SVG 进行旋转 */
    .discipline-list>li>a .nav-arrow svg {
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        transform-origin: center;
        transform: rotate(0deg);
        /* 默认不转 */
    }

    /* 3. 激活状态：当 li 有 active 类时旋转 */
    /* 这里也不需要 .mobile-nav-active 前缀，只要 li 被激活就转 */
    .discipline-list>li.active>a .nav-arrow svg {
        transform: rotate(180deg);
    }

    /* --- 二级菜单样式 (如 "Biological Sciences") --- */

    /* 默认隐藏二级列表 */
    .mobile-nav-active .discipline-list>li .subject-list {
        display: none;
    }

    /* 展开时显示二级列表 */
    .mobile-nav-active .discipline-list>li.active>.subject-list {
        display: block;
    }

    /* 【最终修正 1】强制移除二级菜单项的背景色和悬停效果 */
    .mobile-nav-active .discipline-list>li.active .subject-list li a,
    .mobile-nav-active .subject-list li a:hover {
        background-color: transparent;
        /* 恢复原始文字颜色，防止被桌面样式覆盖 */
        color: #495057;
    }

    /* 【最终修正 2】强制移除二级菜单项右侧的小箭头 */
    .mobile-nav-active .subject-list li a::after {
        content: none !important;
        display: none !important;
    }
}


@media (max-width: 768px) {
    .results-count {
        font-size: 0.9rem;
        /* 将字体大小从 1rem 调整为 0.9rem */
    }

    .select-selected {
        font-size: 0.9rem;
    }

    .select-items div {
        font-size: 0.9rem;
    }

    .results-per-page-select .select-selected {
        width: 56px;
    }

    .sort-by-select .select-selected {
        width: 110px;
    }

    .availability-item .year-value {
        font-weight: 600;
        /* 设置为半粗体，您可以改为 bold 或 700 以获得更粗的效果 */
    }

    /* 目标是下载链接描述中的第一个span元素（即版本号） */
    .edition-text>span:first-child {
        font-weight: 600;
        /* 同样设置为半粗体 */
    }

    .results-header .title h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .results-header .title p {
        font-size: 1.2rem;
    }

    /* --- 1. 整体布局调整 & 隐藏桌面端元素 --- */
    .main-content {
        grid-template-columns: 1fr;
        /* 强制为单列布局 */
        gap: 20px;
        width: 90%;
    }

    .pagination-controls {
        /* 使用 clamp() 设置间距，屏幕越宽，间距越大，但有上下限 */
        gap: clamp(4px, 1.5vw, 10px);
        row-gap: 10px;
        margin-top: 35px;
    }

    .pagination-controls .page-link,
    .pagination-controls .prev-next {
        /* 核心：使用 clamp() 控制按钮尺寸 */
        /* 最小34x34px, 最大38x38px, 在此之间根据屏幕宽度的9vw进行缩放 */
        min-width: 2rem;
        /* ~34px */
        height: 2rem;
        /* ~34px */

        padding: 0 0.5rem;
        /* 8px */

        /* 
          圆角和字体大小的 clamp() 通常是安全的，但为了彻底稳定，
          我们也可以将它们改为固定的 rem 值。
        */
        border-radius: 0.75rem;
        /* 12px */
        font-size: 0.9rem;
    }

    .pagination-controls .prev-next {
        /* 单独调整箭头大小 */
        font-size: clamp(1.0rem, 3vw, 1.2rem);
        padding-bottom: 3px;
    }

    .pagination-controls .ellipsis {
        /* 确保省略号的高度与按钮动态高度匹配 */
        height: clamp(30px, 8.5vw, 38px);
        padding: 0 4px;
    }

    .modal-backdrop,
    .modal-close-btn,
    .mobile-filter-fab {
        -webkit-tap-highlight-color: transparent;
        /* 关键属性：将高亮色设为透明 */
        outline: none;
        /* 顺便移除可能的点击后轮廓 */
    }


    .filter-controls {
        gap: 8px;
        /* 将控件之间的水平间距从 15px 减小到 10px */
    }

    /* 隐藏桌面版的侧边栏切换器和视图切换控件 */
    #sidebar-toggle-btn,
    .controls-wrapper .view-toggle {
        display: none;
    }

    .results-area {
        width: 100%;
    }

    /* --- 2. 书籍网格布局 --- */
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 固定为两列 */
        column-gap: 2vw;
        row-gap: 8vw;
    }

    .results-grid.compact-view {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 在移动端禁用桌面版的 hover 放大和侧滑详情效果 */
    .book-item:hover {
        transform: none;
        box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.12), 0px 8px 16px 0px rgba(0, 0, 0, 0.16);
        z-index: 1;
    }


    .book-cover-wrapper img,
    .no-cover-placeholder {
        height: 48vw;
    }

    /* --- 3. 过滤器侧边栏变为覆盖层 --- */


    .mobile-filter-fab span {
        font-size: 0.7rem;
        margin-top: 2px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100%;
        background-color: #fdfdfd;
        z-index: 1003;
        margin-top: 0;
        transform: translateX(-100%);
        /* 默认隐藏在左侧 */
        transition: transform 0.4s cubic-bezier(0.76, 0, 0.24, 1);
        overflow-y: auto;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px 10px 20px;
        margin-bottom: 0;
        border-bottom: 1px solid #e0e0e0;

        /* --- START: 新增和修改的代码 --- */
        position: -webkit-sticky;
        /* 兼容旧版 Safari */
        position: sticky;
        top: 0;
        /* 将其固定在滚动容器的最顶部 */
        background-color: #fdfdfd;
        /* 必须有背景色，以遮挡下方滚动的内容 */
        z-index: 3;
        /* 设置一个较高的层级 */
        /* --- END: 新增和修改的代码 --- */
    }

    .sidebar-title {
        font-size: 1.4rem;
        /* 标题字体大小 */
        font-weight: 700;
        /* 字体加粗 */
        color: #3B1977;
        /* 使用您的主题色 */
    }

    .sidebar-close-btn {
        /* --- 布局基础 --- */
        position: relative;
        width: 40px;
        /* 按钮的点击区域宽度 */
        height: 40px;
        /* 按钮的点击区域高度 */
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        margin-right: -3px;
        /* --- 关键：隐藏原有的文字 "×" --- */
        font-size: 0;
        color: transparent;
    }

    /* 绘制两根线条 */
    .sidebar-close-btn::before,
    .sidebar-close-btn::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;

        /* --- 在这里精确控制粗细 --- */
        width: 24px;
        /* 线条的长度 */
        height: 2px;
        /* 线条的粗细 (想细一点就改成 1.5px，想粗就 3px) */

        background-color: #888;
        /* 线条颜色 */
        border-radius: 2px;
        /* 线条圆角 */
        transition: background-color 0.2s ease, transform 0.2s ease;
    }

    /* 第一根线旋转 45 度 */
    .sidebar-close-btn::before {
        transform: translate(-50%, -50%) rotate(45deg);
    }

    /* 第二根线旋转 -45 度 */
    .sidebar-close-btn::after {
        transform: translate(-50%, -50%) rotate(-45deg);
    }



    .featured-control h3 {
        margin-bottom: 10px;
    }

    .sidebar .collapsible-header {
        position: -webkit-sticky;
        position: sticky;

        /* --- START: 关键修改 --- */
        /*
         * 这个值需要等于上方 .sidebar-header 的实际高度。
         * 经过计算 (字体、内边距等)，这个高度大约是 56px。
         * 这会让这个标题“粘”在主标题栏的正下方。
        */
        top: 60px;
        /* --- END: 关键修改 --- */

        background-color: #fdfdfd;
        z-index: 2;
        /* 层级比主标题栏低，但比列表内容高 */
        padding-top: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #f0f0f0;
    }

    .sidebar-content {
        padding: 20px;
        /* 将原来 sidebar 的内边距应用到这里 */
    }

    .sidebar .collapsible-content li:hover,
    .sidebar .collapsible-content li:active,
    .sidebar .collapsible-content li:focus {
        background-color: transparent !important;
        /* 强制背景透明 */
    }

    /* 2. (可选) 如果你希望移除点击瞬间的高亮闪烁，确保这行也存在 */
    .custom-checkbox {
        -webkit-tap-highlight-color: transparent;
    }

    /* 当JS添加此类时，侧边栏滑入视图 */
    body.mobile-filters-active .sidebar {
        transform: translateX(0);
    }

    /* 侧边栏激活时的背景遮罩 */
    body.mobile-filters-active::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1002;
    }

    /* 默认隐藏浮动按钮，仅在媒体查询内显示 */
    .mini-sort-controls {
        margin-top: 3px;
    }

}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    background-color: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}



.book-modal {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%);
    width: 90vw;
    max-width: 1000px;
    max-height: 40vh;
    z-index: 1051;
    opacity: 0;
    visibility: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(60px) saturate(1000%);
    -webkit-backdrop-filter: blur(60px) saturate(1000%);
    border-radius: 8px;
}

/* 弹窗激活状态 */
.modal-backdrop.active,
.book-modal.active {
    opacity: 1;
    visibility: visible;
}

.book-modal.active {
    transform: translate(-50%);
}

.modal-backdrop.active {
    transition: opacity 0.3s ease;
}

.book-modal.active {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 关闭按钮 */
.modal-close-btn {
    /* --- 核心定位 --- */
    position: absolute;
    top: auto;
    /* 取消之前的 top 定位 */
    right: auto;
    /* 取消之前的 right 定位 */
    bottom: -70px;
    /* 【关键】将按钮定位到弹窗底部边界下方 70px 的位置 */
    left: 50%;
    /* 水平居中 */
    transform: translateX(-50%);
    /* 精确水平居中 */

    /* --- 圆形容器样式 --- */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    /* 实现圆形 */
    border: none;
    cursor: pointer;

    /* --- 背景 (与弹窗完全一致) --- */
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    /* 添加一点阴影使其有悬浮感 */

    /* --- 内部 '×' 字符样式 --- */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3B1977;
    /* 使用您的主题紫色 */
    font-size: 2rem;
    font-weight: 400;
    line-height: 1;
    text-shadow: none;
    /* 移除之前为白色文字加的阴影 */

    /* --- 交互动效 --- */
    transition: transform 0.2s ease, background-color 0.2s ease;
}


.book-modal .title-with-donor {
    margin-bottom: 0px;
}

.book-modal .year-badge {
    display: none !important;
}

/* 弹窗内容区 */
.modal-content {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 40vh;
}

.modal-cover {
    display: flex;
    justify-content: center;
    /* 水平居中内部的图片 */

    /* 重置之前方案的样式 */
    width: auto;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    /* 必须设置，否则图片的阴影会被切掉 */
}


.modal-cover img,
.modal-cover .no-cover-placeholder {
    /* 1. 【关键】为所有封面设置一个固定的、统一的高度 */
    height: 40vh;
    width: auto;

    /* 3. 将圆角和阴影直接应用在图片上 */
    display: block;
    /* 避免图片下方出现莫名的空隙 */
    border-radius: 8px;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.1),
        0 10px 25px rgba(0, 0, 0, 0.15);

    /* 4. 防止极少数特别宽的图片（如横版书）超出屏幕 */
    max-width: 90vw;
}


.modal-details {
    padding: 20px;
    padding-top: 0px;
    padding-bottom: 15px;
    margin-top: 5px;
    overflow-y: auto;
    color: #2c3e50;
    font-size: 0.9rem;
    line-height: 1.7;
    overflow-x: hidden;
}

#modal-details-container>.book-details {
    margin-top: 10px;
}

.modal-details h3 {
    font-size: 1.1rem;
    /* Adjust this value as needed */
    line-height: 1.4;
    /* Adjusted for the new font size */
    margin-bottom: 12px;
    /* Slightly reduced margin */
}

.modal-details .detail-group,
.modal-details strong {
    /* 这些样式将自动从现有CSS继承 */
}

.modal-details .availability-item .icon-help::before,
.user-page .book-details .availability-item .icon-help::before {
    left: auto;
    /* Unset the default 'left: 50%' */
    right: 0;
    /* Align the tooltip's right edge to the icon's right edge */
    transform: translateX(0);
    /* Remove the horizontal centering */
}

/* We also need to move the little arrow to match the new alignment */
.modal-details .availability-item .icon-help::after {
    left: auto;
    /* Unset the default 'left' */
    right: 21px;
    /* Position the arrow near the right corner of the icon */
    transform: none;
    /* Remove any centering transform */
}

.modal-details .availability-item {
    padding-right: 0px;
}

.modal-details .availability {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    margin-bottom: 8px;
}

.modal-details .download-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 15px;
}

.modal-details .download-row:last-child {
    padding-bottom: 0;
}

.modal-details .icon-group {
    display: flex;
    gap: 0px;
    justify-content: flex-end;
}

.mobile-filter-fab {
    display: none;
    /* 默认在桌面端隐藏 */
}

.modal-details .download-title-area strong {
    display: none;
}



/* =================================================================
   START: Modal Cover Pop-Out Effect
   ================================================================= */

/* 1. Allow the main modal container to show overflowing content. */
.book-modal {
    overflow: visible;
    /* CRITICAL: This is the key change */
}

/* 2. Stop the content wrapper from clipping its children. */
.modal-content {
    overflow: visible;
    /* Allow the cover to escape */
    position: relative;
    /* Establish a positioning context */
}

/* 3. Push the cover upwards, and give it rounded corners and a shadow. */
.modal-cover {
    margin-top: -35vh;

    /* Add side padding so the shadow doesn't get cut off */
    position: relative;
    /* Ensure it stacks correctly */
    z-index: 2;
    /* Place it visually above the details section */
}



/* 4. Ensure the details section stays below the cover. */
.modal-details {
    position: relative;
    z-index: 1;
}



@media (max-width: 768px) {

    /* 1. 确保“下载链接:”标题和捐赠者图标在第一行 */
    .modal-details .download-title-area {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .modal-details .download-section {
        display: block;
        padding-top: 0px;
    }

    /* 2. 让整个链接列表与上方的标题分离，并添加间距 */
    .modal-details .download-rows-container {
        display: block;
        margin-top: 10px;
        /* 在标题和第一个链接之间创建垂直间距 */
    }

    /* 3. 【核心修改】将每一行链接本身变为 flex 容器 */
    .modal-details .download-row {
        display: grid;
        /* Switch from flex to grid */
        grid-template-columns: 1fr auto;
        /* Col 1 is flexible, Col 2 fits its content */
        align-items: center;
        gap: 0px;
        /* 在文本和图标组之间增加一些间距 */
        padding-bottom: 10px;
        /* 保持每个下载链接之间的垂直间距 */
    }

    .modal-details .download-icon {
        width: 90px;
    }

    .download-icon img {
        height: clamp(5px, 6.5vw, 30px);
        padding: 3px 6px;
    }


}


@media (max-width: 768px) {

    /* ... */
    .pagination-controls {
        margin-top: 25px;
        margin-bottom: 50px;
    }

    .mobile-filter-fab {
        display: flex;
        /* 在移动端，这条规则会覆盖全局的 display: none */
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 25px;
        left: 25px;
        width: 60px;
        height: 60px;
        background: rgba(255, 255, 255, 0.7);
        -webkit-backdrop-filter: blur(15px);
        /* 兼容旧版 Safari */
        backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: #3B1977;
        border-radius: 50%;
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        z-index: 1001;
        cursor: pointer;
    }

}

.mobile-filter-fab img {
    width: 30px;
    /* 设置图标宽度 */
    height: 30px;
    /* 设置图标高度 */
}


/* 1. 全屏覆盖层样式 (保持不变) */
#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fdfdfd;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* 2. 新版加载器样式 */
.morphing-loader {
    --loader-size: 45px;
    --line-thickness: 8px;
    --loader-color: #3B1977;
    --animation-duration: 2.5s;
    /* 可以微调动画速度 */
    --easing: cubic-bezier(0.65, 0, 0.35, 1);

    position: relative;
    width: var(--loader-size);
    height: var(--loader-size);
}

.morphing-loader .line {
    position: absolute;
    top: 50%;
    left: 50%;
    background-color: var(--loader-color);
    height: var(--line-thickness);
    border-radius: calc(var(--line-thickness) / 2);
    transform-origin: center center;
}

/* 为每条线分配最终版的动画 */
.morphing-loader .line-1 {
    animation: morph-line-1-v3 var(--animation-duration) var(--easing) infinite;
}

.morphing-loader .line-2 {
    animation: morph-line-2-v3 var(--animation-duration) var(--easing) infinite;
}

.morphing-loader .line-3 {
    animation: morph-line-3-v3 var(--animation-duration) var(--easing) infinite;
}


@keyframes morph-line-2-v3 {

    0%,
    50%,
    100% {
        /* 状态 1 & 5: 竖向三点的中间点 */
        width: var(--line-thickness);
        transform: translate(-50%, -50%);
    }

    0.01% {
        /* --- 关键点: 在这里瞬间旋转 --- */
        transform: translate(-50%, -50%) rotate(55deg);
    }

    25% {
        /* 状态 4: 第二个 'XX' 的主对角线 (/) */
        width: calc(var(--loader-size) * 1.85);
        transform: translate(-50%, -50%) rotate(55deg);
    }


    49.99% {
        /* --- 关键点: 在收缩完成前保持旋转 --- */
        width: var(--line-thickness);
        transform: translate(-50%, -50%) rotate(55deg);
    }

    50.01% {
        /* --- 关键点: 瞬间旋转 --- */
        transform: translate(-50%, -50%) rotate(-55deg);
    }

    75% {
        /* 状态 2: 第一个 'XX' 的主对角线 (\) */
        width: calc(var(--loader-size) * 1.85);
        transform: translate(-50%, -50%) rotate(-55deg);
    }

    99.99% {
        /* --- 关键点: 保持旋转 --- */
        width: var(--line-thickness);
        transform: translate(-50%, -50%) rotate(-55deg);
    }
}


@keyframes morph-line-1-v3 {
    0% {
        /* 状态 3: 横向三点的右点 */
        width: var(--line-thickness);
        transform: translate(-50%, -50%) translateX(calc(var(--loader-size) * 0.48));
    }

    0.01% {
        /* --- 关键点: 瞬间旋转 --- */
        transform: translate(-50%, -50%) translateX(calc(var(--loader-size) * 0.48))rotate(-55deg);
    }

    25% {
        /* 状态 2: 第一个 'XX' 的右下交叉线 (/) */
        width: calc(var(--loader-size));
        transform: translate(-50%, -50%) translate(calc(var(--loader-size) * 0.24), calc(var(--loader-size) * 0.34)) rotate(-55deg);
    }

    49.99% {
        /* --- 关键点: 保持旋转 --- */
        width: var(--line-thickness);
        transform: translate(-50%, -50%) translateY(calc(var(--loader-size) * 0.68))rotate(-55deg);
    }

    50% {
        /* 状态 1 & 5: 竖向三点的下点 */
        width: var(--line-thickness);
        transform: translate(-50%, -50%) translateY(calc(var(--loader-size) * 0.68));
    }

    50.01% {
        transform: translate(-50%, -50%) translateY(calc(var(--loader-size) * 0.68))rotate(55deg);
    }

    75% {
        width: calc(var(--loader-size));
        transform: translate(-50%, -50%) translate(calc(var(--loader-size) * -0.24), calc(var(--loader-size) * 0.34)) rotate(55deg);
    }

    99.99% {
        width: var(--line-thickness);
        transform: translate(-50%, -50%) translateX(calc(var(--loader-size) * -0.48))rotate(55deg);
    }


    100% {
        width: var(--line-thickness);
        transform: translate(-50%, -50%) translateX(calc(var(--loader-size) * -0.48));
    }
}

/**
 * line-3 轨迹: 下 -> 右下 -> 右 -> 右上 -> 下
 */
@keyframes morph-line-3-v3 {

    0% {
        width: var(--line-thickness);
        transform: translate(-50%, -50%) translateX(calc(var(--loader-size) * -0.48));
    }

    0.01% {
        /* --- 关键点: 瞬间旋转 --- */
        transform: translate(-50%, -50%) translateX(calc(var(--loader-size) * -0.48))rotate(-55deg);
    }

    25% {
        width: calc(var(--loader-size));
        transform: translate(-50%, -50%) translate(calc(var(--loader-size) * -0.24), calc(var(--loader-size) * -0.34)) rotate(-55deg);

    }

    49.99% {
        /* --- 关键点: 保持旋转 --- */
        width: var(--line-thickness);
        transform: translate(-50%, -50%) translateY(calc(var(--loader-size) * -0.68))rotate(-55deg);
    }

    50% {
        width: var(--line-thickness);
        transform: translate(-50%, -50%) translateY(calc(var(--loader-size) * -0.68));
    }


    50.01% {
        /* --- 关键点: 在这里瞬间旋转 --- */
        transform: translate(-50%, -50%) translateY(calc(var(--loader-size) * -0.68))rotate(55deg);
    }

    75% {
        /* 状态 4: 第二个 'XX' 的右上交叉线 (\) */
        width: calc(var(--loader-size));
        transform: translate(-50%, -50%) translate(calc(var(--loader-size) * 0.24), calc(var(--loader-size) * -0.34)) rotate(55deg);
    }

    99.99% {
        /* --- 关键点: 在收缩完成前保持旋转 --- */
        width: var(--line-thickness);
        transform: translate(-50%, -50%) translateX(calc(var(--loader-size) * 0.48))rotate(55deg);
    }


    100% {
        /* 状态 3: 横向三点的右点 */
        width: var(--line-thickness);
        transform: translate(-50%, -50%) translateX(calc(var(--loader-size) * 0.48));
    }


}

.grid-loader-wrapper {
    /* 让这个容器横跨父网格的所有列 */
    grid-column: 1 / -1;

    /* 使用 Flexbox 将内部的动画（.morphing-loader）完美居中 */
    display: flex;
    justify-content: center;
    align-items: center;

    /* 给予一个最小高度，确保在加载时结果区域不会坍塌 */
    min-height: 400px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.grid-loader-wrapper.hiding {
    opacity: 0;
}

/* 
   我们复用已有的 .morphing-loader 样式，
   但可以为网格内的版本稍微调整一下尺寸，使其更协调。
*/
.grid-loader-wrapper .morphing-loader {
    --loader-size: 45px;
    --line-thickness: 8px;
}

.doody-link {
    text-decoration: none;
    /* 去掉下划线 */
    border: none;
    /* 去掉边框 */
    display: inline-block;
    /* 保持行内块级特性 */
    margin-left: 6px;
    margin-bottom: 0.3em;
    /* 间距放在链接上 */
    line-height: 1;
    /* 防止撑高行高 */
    vertical-align: middle;

}

/* 图片样式 */
.doody-logo {
    height: 1.8em;
    /* 高度随字体自适应 */
    width: auto;
    display: block;
    /* 消除图片底部的幽灵间隙 */
    cursor: pointer;
    /* 鼠标变成手型 */
    transition: transform 0.2s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

    /* --- 2. 优化图片缩放算法 --- */
    /* 对于缩小的大图，这会让它更锐利 */
    image-rendering: -webkit-optimize-contrast;
}

/* 悬停效果 */
.doody-link:hover .doody-logo {
    transform: scale(1.08);
    /* 悬停时微微放大 */
}

/* 移动端适配 */
@media (max-width: 768px) {
    .doody-link {
        margin-left: 5px;
    }

    .doody-logo {
        height: 1.5em;
    }
}

.site-footer {
    width: 100%;
    padding: 0px 0;
    margin-top: 60px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    background-color: #fdfdfd;
}

.site-footer p {
    margin: 0;
    font-size: 0.8rem;
    color: #999;
}

.site-footer a {
    text-decoration: none;
    color: #999;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: #3B1977;
}

.footer-divider {
    margin: 0 10px;
    color: #ccc;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .site-footer p {
        font-size: 0.7rem;
    }

    .footer-divider {
        margin: 0 8px;
        font-size: 0.8rem;
    }
}

.custom-checkbox[data-state="included"] .checkmark {
    background-color: #3B1977;
    border-color: #3B1977;
}

.custom-checkbox[data-state="included"] .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    display: block;
}

/* 3. 排除状态 (Excluded - Red X) */
.custom-checkbox[data-state="excluded"] .checkmark {
    background-color: #dc3545;
    /* 红色 */
    border-color: #dc3545;
}

.custom-checkbox[data-state="excluded"] .checkmark::after {
    content: '✕';
    /* Unicode 叉号 */
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    color: white;
    font-size: 13px;
    line-height: 16px;
    /* 垂直居中微调 */
    text-align: center;
    border: none;
    transform: none;
    font-weight: bold;
    display: block;
}

@supports (-webkit-touch-callout: none) {
    .custom-checkbox[data-state="excluded"] .checkmark::after {
        font-weight: 400 !important;
        font-size: 20px !important;
        line-height: 14px;
    }
}

.custom-checkbox input {
    pointer-events: none;
}

html:has(body.no-scroll),
body.no-scroll {
    overflow: hidden !important;
    height: 100vh !important;
    touch-action: none;
    overscroll-behavior: none;
}

body.mobile-filters-active #mobile-filter-trigger {
    opacity: 0;
    /* 变透明 */
    visibility: hidden;
    /* 彻底隐藏（不占位、不可点） */
    pointer-events: none;
    /* 禁止点击 */
    transform: scale(0.8);
    /* 稍微缩小，增加消失动画的质感 */
    transition: all 0.2s ease;
    /* 平滑过渡 */
}

/* 2. 【核心修复】侧边栏打开时，强制固定导航栏 (Header) */
body.mobile-filters-active header,
body.book-modal-active header {
    /* 强制固定在视口顶部，不受 Body 滚动锁定偏移的影响 */
    position: fixed !important;
    top: 0 !important;

    /* 【关键】提高层级 */
    /* 确保它在侧边栏遮罩层之上 (假设侧边栏通常是 1000-1100 左右) */
    /* 如果你希望侧边栏盖住 Header，请把这个 z-index 调低，或者去掉这一行 */

    width: 100%;

    /* 可选：防止 iOS 下的渲染闪烁 */
    transform: translateZ(0);
}

/* =================================================================
   START: Desktop Sidebar Internal Scroll Fix
   电脑端侧边栏：限制高度并开启内部独立滚动
   ================================================================= */

/* =================================================================
   START: Desktop Sidebar Internal Scroll Fix (Perfect)
   电脑端侧边栏：极速展开 + 无抖动 + 无闪现
   ================================================================= */

/* =================================================================
   START: Desktop Sidebar Internal Scroll Fix (Final Perfected)
   电脑端侧边栏：极速展开 + 无抖动 + 无闪现 + 无跳动
   ================================================================= */

@media (min-width: 769px) {

    /* 1. 定义关键帧：延迟切换 overflow 属性 */
    @keyframes delayOverflow {
        0% {
            overflow-y: hidden;
        }

        99% {
            overflow-y: hidden;
        }

        100% {
            overflow-y: auto;
        }
    }

    /* 2. 【基础设置】为所有状态设置过渡动画 */
    /* 核心修复：不仅过渡高度，还要过渡 margin 和 padding，防止折叠时跳动 */
    .sidebar .collapsible-content {
        scrollbar-gutter: stable;
        transition:
            max-height 0.3s ease-out,
            margin-bottom 0.3s ease-out,
            padding-bottom 0.3s ease-out,
            border-color 0.3s ease-out !important;
    }

    /* 3. 【折叠状态】强制归零 */
    .sidebar .collapsible-content.hidden {
        max-height: 0 !important;
        margin-bottom: 0 !important;
        /* 关键：平滑过渡到 0 */
        padding-bottom: 0 !important;
        /* 关键：平滑过渡到 0 */
        border-bottom: 1px solid transparent !important;
        /* 边框颜色淡出 */
        overflow-y: hidden !important;
        /* 折叠时绝对不能有滚动条 */
    }

    /* 4. 【展开状态】逻辑 */
    .sidebar .collapsible-content:not(.hidden) {
        /* 限制最大高度 */
        max-height: 600px !important;

        /* 恢复间距 */
        margin-bottom: 15px !important;
        padding-bottom: 10px !important;
        border-bottom: 1px solid #f0f0f0 !important;


        /* 核心属性：初始隐藏滚动条，延迟 0.3s 后开启 (防止展开时滚动条闪现) */
        overflow-y: hidden;
        animation: delayOverflow 0s 0.3s forwards;

        /* 视觉微调 */
        overscroll-behavior: contain;
        padding-right: 4px;
    }

    /* 5. 极细滚动条样式 */
    .sidebar .collapsible-content::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar .collapsible-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .sidebar .collapsible-content::-webkit-scrollbar-thumb {
        background-color: #e0e0e0;
        border-radius: 10px;
        background-clip: content-box;
        border: 1px solid transparent;
    }

    .sidebar .collapsible-content::-webkit-scrollbar-thumb:hover {
        background-color: #3B1977;
    }

    .collapsible-header .nav-arrow {
        margin-right: -2px;
    }

    .toggle-switch {

        margin-right: 2px;
    }

}