/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #fff;
    min-height: 100vh;
    background: linear-gradient(135deg, #4B0082, #800080, #BA55D3);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

/* 波浪背景效果 */
.wave-bg {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    opacity: 0.1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23ffffff' fill-opacity='0.2' d='M0,128L48,144C96,160,192,192,288,197.3C384,203,480,181,576,181.3C672,181,768,203,864,197.3C960,192,1056,160,1152,144C1248,128,1344,128,1392,128L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E");
    background-position: center bottom;
    background-repeat: no-repeat;
    background-size: 200% 100%;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 2rem;
    padding-top: 1rem;
}

h1 {
    font-size: 2.8rem;
    color: #fff;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.title-text, .subtitle {
    white-space: nowrap;
}

.divider {
    color: rgba(255,255,255,0.8);
    margin: 0 0.2rem;
    font-weight: 300;
}

/* 时间日期样式 */
.datetime {
    display: flex;
    flex-direction: column;
    align-items: center;
    white-space: nowrap;
}

.time {
    font-size: 1.8rem;
    font-weight: 400;
    line-height: 1;
}

.date {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 0.3rem;
}

/* 搜索框样式 */
.search-container {
    margin: 2rem auto;
    max-width: 800px;
    position: relative;
    padding: 0 1rem;
}

.search-box {
    position: relative;
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* 搜索引擎选择器样式 */
.search-engines {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 1rem;
}

.current-engine,
.search-engine {
    width: 24px;
    height: 24px;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.current-engine img,
.search-engine img {
    width: 16px;
    height: 16px;
    display: block;
    filter: brightness(1.2);
}

.current-engine:hover,
.search-engine:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.search-engine.active {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.engine-dropdown {
    position: absolute;
    top: 120%;
    left: 0;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
}

.engine-dropdown.show {
    display: flex;
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 1.1rem;
    color: #fff;
    padding: 0.3rem 0;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-input:focus {
    outline: none;
}

/* 导航区域样式 */
.nav-section {
    margin-bottom: 2.5rem;
}

.nav-section h2 {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.8rem;
}

/* 导航项目样式 */
.nav-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.nav-item-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-item-content {
    flex: 1;
    min-width: 0;
}

.nav-item h3 {
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item p {
    color: rgba(255,255,255,0.7);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 2rem 0;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.runtime {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
}

/* 响应式设计 */
@media (max-width: 1400px) {
    .nav-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1200px) {
    .nav-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .container {
        max-width: 960px;
    }
}

@media (max-width: 992px) {
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        max-width: 720px;
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin: 0 10px;
    }
    
    h1 {
        font-size: 1.6rem;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.3rem;
    }

    .title-text, .subtitle {
        display: inline-block;
    }

    .datetime {
        width: 100%;
        margin-top: 0.5rem;
    }

    .time {
        font-size: 1.4rem;
    }

    .date {
        display: none;
    }

    .seconds {
        font-size: 1rem;
        opacity: 0.8;
    }

    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    .nav-section h2 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }

    .search-container {
        padding: 0;
        margin: 1.2rem auto;
    }
    
    .search-box {
        padding: 0.6rem 0.8rem;
    }
    
    .search-input {
        font-size: 0.95rem;
    }
    
    .search-engines {
        gap: 6px;
    }
    
    .search-engine {
        width: 20px;
        height: 20px;
        padding: 3px;
    }
    
    .search-engine img {
        width: 14px;
        height: 14px;
    }

    .nav-item {
        padding: 0.4rem 0.5rem;
        gap: 0.3rem;
    }

    .nav-item-icon {
        width: 32px;
        height: 32px;
        border-radius: 6px;
    }

    .nav-item h3 {
        font-size: 0.8rem;
        margin-bottom: 0.1rem;
    }

    .nav-item p {
        font-size: 0.65rem;
    }
}

@media (max-width: 576px) {
    .nav-grid {
        gap: 0.4rem;
    }

    h1 {
        font-size: 1.4rem;
    }

    .search-input {
        font-size: 0.9rem;
    }

    .nav-item {
        padding: 0.4rem 0.5rem;
    }

    .nav-item-icon {
        width: 32px;
        height: 32px;
    }

    .nav-item h3 {
        font-size: 0.8rem;
    }

    .nav-item p {
        font-size: 0.65rem;
    }

    footer {
        padding: 1.5rem 0;
        font-size: 0.8rem;
    }

    .runtime {
        font-size: 0.75rem;
    }
}

/* 适配超小屏幕 */
@media (max-width: 360px) {
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    h1 {
        font-size: 1.3rem;
    }

    .nav-item {
        padding: 0.4rem 0.5rem;
    }

    .search-box {
        padding: 0.5rem 0.6rem;
    }
}

/* 适配横屏模式 */
@media (orientation: landscape) and (max-height: 576px) {
    .container {
        padding: 0.8rem;
    }

    h1 {
        margin-bottom: 0.3rem;
    }

    .search-container {
        margin: 1rem auto;
    }

    .nav-section {
        margin-bottom: 1.5rem;
    }

    .nav-grid {
        gap: 0.6rem;
    }
}

/* 适配深色模式 */
@media (prefers-color-scheme: dark) {
    .nav-item {
        background: rgba(255, 255, 255, 0.08);
    }

    .nav-item:hover {
        background: rgba(255, 255, 255, 0.12);
    }
}

/* 适配高分辨率屏幕 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 1000;
    padding: 0;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.back-to-top:hover svg {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .back-to-top {
        right: 15px;
        bottom: 15px;
        width: 36px;
        height: 36px;
    }

    .back-to-top svg {
        width: 20px;
        height: 20px;
    }
}

/* 主题相关样式 */
:root {
    --bg-gradient-dark: linear-gradient(135deg, #4B0082, #800080, #BA55D3);
    --bg-gradient-light: linear-gradient(135deg, #87CEEB, #6495ED, #4169E1);
    --text-color-dark: #fff;
    --text-color-light: #333;
    --card-bg-dark: rgba(255, 255, 255, 0.1);
    --card-bg-light: rgba(255, 255, 255, 0.8);
    --card-hover-dark: rgba(255, 255, 255, 0.15);
    --card-hover-light: rgba(255, 255, 255, 0.95);
}

body {
    background: var(--bg-gradient-dark);
    color: var(--text-color-dark);
}

body.light-mode {
    background: var(--bg-gradient-light);
    color: var(--text-color-light);
}

.light-mode .nav-item {
    background: var(--card-bg-light);
    color: var(--text-color-light);
}

.light-mode .nav-item:hover {
    background: var(--card-hover-light);
}

.light-mode .nav-item h3 {
    color: var(--text-color-light);
}

.light-mode .nav-item p {
    color: rgba(0, 0, 0, 0.7);
}

/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    right: 20px;
    bottom: 70px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    padding: 0;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.theme-toggle .sun {
    display: none;
}

.light-mode .theme-toggle .sun {
    display: block;
}

.light-mode .theme-toggle .moon {
    display: none;
}

.light-mode .theme-toggle {
    color: #333;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .theme-toggle {
        right: 15px;
        bottom: 65px;
        width: 36px;
        height: 36px;
    }

    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }
}

/* 搜索框明亮模式样式 */
.light-mode .search-box {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-color-light);
}

.light-mode .search-input {
    color: var(--text-color-light);
}

.light-mode .search-input::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

/* 返回顶部按钮明亮模式样式 */
.light-mode .back-to-top {
    color: #333;
}