
/* 全局重置与基础样式 - 增加Safari兼容 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    /* Safari字体渲染优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
}

.container {
    position: relative;
}
.container.hide-sidebar :is(.logo,.sidebar,.menu){
    display: none;
}
.container.hide-sidebar .content {
    margin-left: 0;
    margin-top: 0;
}

html,
body {
    height: 100%;
    overflow-x: hidden;
    /* 修复Safari移动端fixed定位偏移 */
    -webkit-overflow-scrolling: touch;
}

/* 页面背景 */
body {
    background-color: rgb(22, 21, 27);
    color: #f0f0f0;
    /* 浅白色文字 */
    min-height: 100vh;
    /* Safari硬件加速，防止fixed闪烁 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Logo样式 - 修复Safari fixed定位 */
.logo {
    background: rgb(22, 21, 27);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 99;
    width: 80px;
    height: 60px;
    display: -webkit-box;
    /* Safari Flex前缀 */
    display: flex;
    -webkit-box-align: center;
    /* Safari Flex垂直居中 */
    align-items: center;
    -webkit-box-pack: center;
    /* Safari Flex水平居中 */
    justify-content: center;
    /* 防止Safari点击高亮 */
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}

.logo img {
    max-width: 80%;
    /* 修复Safari图片渲染模糊 */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.logo-text {
    display: none;
}

/* 左侧导航栏 - Safari滚动与定位优化 */
.sidebar {
    position: absolute;
    top: 60px;
    left: 0;
    width: 80px;
    bottom: 0;
    /* Safari滚动优化 */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-left: 10px;
    padding-right: 5px;
    z-index: 999;
    /* 硬件加速 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /*    隐藏滚动条*/
    scrollbar-width: none;
    -ms-overflow-style: none;

    ::-webkit-scrollbar {
        display: none;
    }
}

/* 导航卡片 - Safari Flex兼容 */
.nav-card {
    display: -webkit-box;
    display: flex;
    background-color: var(--second-bg);
    border-radius: 8px;
    padding: 5px;
    margin-bottom: 8px;
    -webkit-box-orient: vertical;
    /* Safari Flex方向 */
    -webkit-box-direction: normal;
    flex-direction: column;
    -webkit-box-align: center;
    align-items: center;
    -webkit-box-pack: center;
    justify-content: center;
    cursor: pointer;
    /* Safari过渡兼容 */
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-align: left;
    /* 防止点击高亮 */
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}
.nav-card .iconfont {
    color: #fff
}

.nav-card:hover {
    border-color: var(--primary-color);
    -webkit-transform: translateY(-2px);
    /* Safari transform前缀 */
    transform: translateY(-2px);
}
.nav-card:hover .iconfont {
    color: var(--primary-color);
}
.nav-card img {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    /* Safari object-fit兼容（旧版） */
    object-fit: cover;
    -o-object-fit: cover;
    margin-bottom: 5px;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.nav-card i {
    font-size: 3rem;
    color: black;
}

.nav-card-text {
    font-size: 12px;
    font-weight: 500;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 60px;
    text-align: center;
    /* Safari文字对齐优化 */
    -webkit-text-align: center;
    text-align: center;
}

/* 右侧内容区域 - Safari边距兼容 */
.content {
    margin-left: 80px;
    padding: 5px;
    min-height: 100vh;
    /* 防止Safari内容被遮挡 */
    position: relative;
    z-index: 1;
    margin-top: 60px;
}

.content h2 .icon {
    width: 8px;
    height: 100%;
    background: linear-gradient(to bottom, rgb(243, 220, 144), rgba(220, 146, 97));
    display: inline-block;
    margin-right: 0.6rem;
    border-radius: 5px;
}

.content h2 {
    font-family: 'test4';
    /*font-style: italic;*/
    margin: 0.5rem;
    font-size: 24px;
}

/* Grid容器 - Safari Grid兼容 */
.content-grid {
    display: -ms-grid;
    /* IE兼容（可选） */
    display: grid;
    /* Safari Grid列数兼容 */
    -ms-grid-columns: 1fr 10px 1fr;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* 内容卡片 - Safari Flex与溢出优化 */
.content-card {
    background-color: rgb(38, 37, 43);
    border-radius: 8px;
    padding: 5px;
    display: -webkit-box;
    display: flex;
    gap: 8px;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    height: 100%;
    /* 防止点击高亮 */
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
    /* Safari卡片渲染优化 */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.content-card:hover {
    background-color: #383847;
    border-color: #484857;
    -webkit-transform: translateY(-2px);
    transform: translateY(-2px);
}

.content-card a {
    color: white;
}

.content-card-img {
    width: 50px;
    height: auto;
    border-radius: 6px;
    object-fit: cover;
    -o-object-fit: cover;
    -webkit-flex-shrink: 0;
    /* Safari Flex不收缩 */
    flex-shrink: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.content-card-text {
    -webkit-box-flex: 1;
    /* Safari Flex占比 */
    flex: 1;
    display: -webkit-box;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    flex-direction: column;
    -webkit-box-pack: center;
    /* 防止文字溢出 */
    overflow: hidden;
}

.content-card-title {
    font-size: 14px;
    /*font-weight: 600;*/
    margin-bottom: 4px;
    color: #ffffff;
    font-family: 'test2';
}

/* Safari -webkit-line-clamp 兼容写法 */
.content-card-desc {
    font-size: 11px;
    color: rgb(203, 156, 99);
    /* 浅灰色介绍文字 */
    line-height: 1.4;
    /* 必须配合固定高度或flex，Safari才生效 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* 防止文字被截断异常 */
    word-break: break-all;
}

.menu {
    position: fixed;
    top: 20px;
    right: 10px;
    z-index: 9999;
    display: none;
    color: #f0f0f0;
}
.content-card-button {
    display: block;
    padding: 0 24px;
    height: 56px;
    line-height: 56px;
    color: #FFFFFF80;
    border-radius: 10px;
    border:solid 1px #FFFFFF80
}
.content-card-button:hover {
    color: var(--background);
    background-color: #FFC45C;
    border-color: #FFC45C;
}
.content-card-button-box {
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .logo {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100vw;
    }

    .logo img {
        max-width: 200px;
    }

    .sidebar {
        position: fixed;
        display: none;
    }

    .content {
        margin-left: 0;
    }

    .menu {
        display: block;
    }

    .content-card-button {
        display: none;
    }
}

/* 桌面端适配（768px以上） */
@media (min-width: 768px) {
    .logo {
        position: absolute;
        width: 280px;
        padding: 0 20px;
        -webkit-box-pack: start;
        justify-content: flex-start;
    }

    .logo-text {
        display: block;
        font-size: 18px;
        font-weight: 600;
        color: #ffffff;
        margin-left: 12px;
    }

    .sidebar {
        width: 280px;
        padding: 42px 15px;
        display: block;
    }

    .nav-card {
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        flex-direction: row;
        padding: 15px;
        margin-bottom: 12px;
    }

    .nav-card img {
        width: 50px;
        height: 50px;
        margin-bottom: 0;
        margin-right: 15px;
    }

    .nav-card i {
        font-size: 3rem;
        width: 60px;
        height: 60px;
        margin-bottom: 0;
        margin-right: 15px;
    }

    .nav-card-text {
        font-size: 16px;
        width: auto;
        -webkit-text-align: left;
        text-align: left;
    }

    .content {
        margin-left: 420px;
        padding: 10px;
        margin-top: 0;
    }

    .content-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding-top: 42px;
        max-width: 1200px;
    }

    .content-card {
        padding: 20px;
        gap: 22px;
    }

    .content-card-img {
        width: 100px;
        height: 100px;
    }

    .content-card-title {
        font-size: 18px;
        margin-bottom: 9px;
    }

    .content-card-desc {
        font-size: 14px;
        -webkit-line-clamp: unset;
        line-clamp: unset;
    }

    .content-card-button {

    }
}

/* 超小屏Safari适配 */
@media (max-width: 320px) {
    .content-card-title {
        font-size: 12px;
    }

    .content-card-desc {
        font-size: 10px;
        -webkit-line-clamp: 2;
    }
}

/* 修复Safari滚动条样式（可选） */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #22222a;
}

::-webkit-scrollbar-thumb {
    background: #484857;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #585867;
}