/* PillNav 样式 */
.pill-nav {
    position: fixed;
    top: 1.3em;
    z-index: 1000;
    width: 100%;
    left: 0;
    padding: 0 1rem;
    display: flex;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

/* 滚动隐藏状态 */
.pill-nav.hidden {
    transform: translateY(calc(-100% - 1.3em));
}


@media (min-width: 768px) {
    .pill-nav {
        width: 100%;
        left: 0;
        padding: 0 1rem;
        justify-content: center;
    }
}

.pill-nav nav {
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0;
}

@media (min-width: 768px) {
    .pill-nav nav {
        width: auto;
        justify-content: center;
        padding: 0;
    }
}

.pill-nav .logo-link {
    border-radius: 0;
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    width: auto;
    min-width: 48px;
    height: 48px;
    background: transparent;
    transition: transform 0.2s ease;
    font-family: "Dashboard", "Montserrat", sans-serif;
    font-size: 20px;
    font-weight: 400;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.pill-nav .logo-link:hover {
    transform: scale(1.05);
}

.pill-nav .logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 旋转文字容器样式 */
.pill-nav .logo-fixed {
    display: inline-block;
    color: #fff;
}

.pill-nav .logo-rotating {
    display: inline-block;
    position: relative;
    min-width: 80px;
    min-height: 1.2em;
    color: #fff;
}

.pill-nav .nav-items {
    position: relative;
    align-items: center;
    border-radius: 50px;
    display: none;
    margin-left: 0;
    height: 48px;
    background: #121212;
    border: 2px solid #121212;
    padding: 0 0.5rem;
}

@media (min-width: 768px) {
    .pill-nav .nav-items {
        display: flex;
    }
}

.pill-nav .nav-list {
    list-style: none;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 3px 3px 3px 0;
    height: 100%;
    gap: 3px;
}

.pill-nav .nav-item {
    display: flex;
    height: 100%;
}

.pill-nav .pill-link {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-decoration: none;
    border-radius: 50px;
    box-sizing: border-box;
    font-family: "Dashboard", "Montserrat", sans-serif;
    font-weight: 400;
    font-size: 20px;
    line-height: 0;
    text-transform: capitalize;
    letter-spacing: 0.2px;
    white-space: nowrap;
    cursor: pointer;
    padding: 0 18px;
    background: transparent;
    color: #666;
    transition: all 0.3s ease;
}

.pill-nav .pill-label {
    display: inline-block;
    line-height: 1;
    transition: opacity 0.3s ease;
}

/* 选中状态样式 */
.pill-nav .pill-link[data-active="true"] {
    background: #121212;
    color: #fff;
}


/* 回顶部按钮 */
.pill-nav .back-to-top-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    position: relative;
    border-radius: 50%;
    border: 2px solid #121212;
    width: 48px;
    height: 48px;
    background: #121212;
    margin-left: 0.5rem;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    flex-shrink: 0; /* 防止按钮被压缩 */
}

.pill-nav .back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.pill-nav .back-to-top-btn:hover {
    transform: scale(1.05);
    background: #333;
    border-color: #333;
}

.pill-nav .back-to-top-icon {
    width: 20px;
    height: 20px;
    stroke: #fff;
    transition: transform 0.3s ease;
}

/* 电脑端图标颜色 */
@media (min-width: 768px) {
    .pill-nav .back-to-top-icon {
        stroke: #72B888;
    }
}

.pill-nav .back-to-top-btn:hover .back-to-top-icon {
    transform: translateY(-2px);
}

/* 移动端菜单按钮 */
.pill-nav .mobile-menu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    padding: 0;
    position: relative;
    border-radius: 50%;
    border: none;
    width: 48px;
    height: 48px;
    background: #121212;
    margin-left: 0.5rem;
}

@media (min-width: 768px) {
    .pill-nav .mobile-menu-btn {
        display: none;
    }
}

.pill-nav .hamburger-line {
    width: 16px;
    height: 2px;
    border-radius: 1px;
    background: var(--pill-bg, #fff);
    transition: all 0.3s ease;
    transform-origin: center;
}

/* 移动端菜单 */
.pill-nav .mobile-menu {
    position: fixed;
    top: 4em;
    left: 1rem;
    right: 1rem;
    border-radius: 27px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 998;
    transform-origin: top;
    background: #FFFFFF;
    display: none;
}

@media (min-width: 768px) {
    .pill-nav .mobile-menu {
        display: none;
    }
}

.pill-nav .mobile-menu.active {
    display: block;
}

.pill-nav .mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 3px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pill-nav .mobile-menu-item {
    display: block;
    padding: 12px 16px;
    border-radius: 50px;
    transition: all 0.2s ease;
    text-decoration: none;
    background: var(--pill-bg, #fff);
    color: #999999;
}

/* 手机端移动菜单项字体设置 */
@media (max-width: 767px) {
    .pill-nav .mobile-menu-item {
        font-family: inherit;
        font-size: inherit;
        font-weight: 900;
        text-transform: none;
    }
}

.pill-nav .mobile-menu-item:hover {
    background: #121212;
    color: var(--hover-text, #fff);
}

/* 移动端菜单项选中状态 */
.pill-nav .mobile-menu-item[data-active="true"] {
    color: #000000;
}

/* 悬停效果 */
.pill-nav .pill-link:hover {
    background: #121212;
    color: #fff;
    opacity: 0.8;
}

/* 响应式调整 */
@media (max-width: 767px) {
    .pill-nav {
        padding: 0 1rem;
        justify-content: space-between; /* 手机端使用space-between布局 */
    }
    
    .pill-nav nav {
        padding: 0;
        width: 100%; /* 确保nav占满整个宽度 */
        justify-content: space-between; /* 手机端nav也使用space-between */
    }
    
    .pill-nav .logo-link {
        font-size: 1rem;
        padding: 0.3rem;
        min-width: 36px;
        height: 36px;
    }
    
    .pill-nav .logo-rotating {
        min-width: 60px;
    }
    
    /* 手机端按钮布局调整 */
    .pill-nav .mobile-menu-btn {
        margin-left: 0; /* 移除左边距，让汉堡菜单按钮靠左 */
        order: 1; /* 确保汉堡菜单按钮在最左边 */
    }
    
    .pill-nav .back-to-top-btn {
        margin-left: 0; /* 移除左边距 */
        margin-right: 0; /* 移除右边距，让回到顶部按钮靠右 */
        order: 3; /* 确保回到顶部按钮在最右边 */
    }
    
    /* 手机端logo居中 */
    .pill-nav .logo-link {
        order: 2; /* logo在中间 */
        margin: 0 auto; /* 让logo居中 */
    }
}


/* 隐藏旧的回到顶部控件 */
.back-to-top {
    display: none !important;
}

.back-to-top.show {
    display: none !important;
}

/* CSS 变量定义 */
:root {
    --base: #000000;
    --pill-bg: #ffffff;
    --hover-text: #ffffff;
    --pill-text: #000000;
    --nav-h: 42px;
    --logo: 36px;
    --pill-pad-x: 18px;
    --pill-gap: 3px;
}

/* 随机弹窗样式 */
.random-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.random-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.random-modal-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.random-modal-overlay.active .random-modal-content {
    transform: scale(1);
}

.random-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    transition: all 0.2s ease;
    line-height: 1;
}

.random-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.random-modal-source {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    font-family: 'SmileySans', 'Montserrat', sans-serif;
}

.random-modal-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
    font-family: 'SmileySans', 'Montserrat', sans-serif;
}

.random-modal-text .typing-p {
    margin: 0 0 1rem 0;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.random-modal-text .typing-p.active-typing {
    opacity: 1;
}

.random-modal-text .typing-p:last-child {
    margin-bottom: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .random-modal-content {
        width: 95%;
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .random-modal-text {
        font-size: 1rem;
    }
}
