/* ========== 1. 全局基础 ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: url('../images/background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px) saturate(0.8);
    -webkit-backdrop-filter: blur(8px) saturate(0.8);
    z-index: -1;
}

body.custom-bg::before {
    background-image: var(--custom-bg) !important;
    background-size: cover !important;
    background-position: center !important;
}

#particles-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

#container {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

#top-bar {
    text-align: center;
    padding: 10px 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#time {
    font-size: 6.5em;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 20px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ========== 3. 搜索区域 ========== */
.search-container {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    position: relative;
}

.search-engine-btn {
    width: 60px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 6px 0 0 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.search-engine-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 15px rgba(255, 200, 100, 0.4);
}

.search-engine-btn .fa-chevron-down {
    font-size: 0.6em;
    margin-left: 3px;
    opacity: 0.7;
}

.engine-indicator {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75em;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.engine-indicator.show {
    opacity: 1;
}

#search-input {
    width: 250px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-left: none;
    border-radius: 0 6px 6px 0;
    font-size: 1em;
    color: #fff;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: box-shadow 0.3s, background-color 0.3s;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#search-input:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(255, 200, 100, 0.3);
    background-color: rgba(255, 255, 255, 0.2);
}

.engine-tooltip {
    position: absolute;
    top: -35px;
    left: 0;
    background-color: rgba(0, 0, 0, 0.8);
    color: #ffd700;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.3s, transform 0.3s;
}

.engine-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.result-time {
    font-size: 0.7em;
    color: rgba(255, 255, 255, 0.3);
    display: block;
    margin-top: 2px;
}

/* ========== 5. 导航按钮组（胶囊式三卡片） ========== */
.trigger-button {
    display: none;
}

.nav-grid {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 16px;
}

.nav-card {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 16px 20px;
    min-width: 200px;
    flex: 1;
    max-width: 280px;
    transition: background 0.3s, border-color 0.3s;
}

.nav-card-title {
    font-size: 0.7em;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    font-weight: 600;
}

.nav-card-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    color: rgba(255,255,255,0.7);
    font-size: 0.82em;
    transition: all 0.25s;
    border: 1px solid transparent;
    background: rgba(255,255,255,0.04);
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.nav-item i {
    font-size: 0.85em;
    opacity: 0.5;
    width: 16px;
    text-align: center;
}

.nav-item:hover i { opacity: 0.9; }

/* 卡片色系 */
.nav-card.ai .nav-card-title { color: rgba(139,146,255,0.6); }
.nav-card.ai .nav-item:hover { background: rgba(79,110,247,0.15); border-color: rgba(79,110,247,0.25); }

.nav-card.tools .nav-card-title { color: rgba(74,222,128,0.6); }
.nav-card.tools .nav-item:hover { background: rgba(74,222,128,0.1); border-color: rgba(74,222,128,0.2); }

.nav-card.fun .nav-card-title { color: rgba(251,191,36,0.6); }
.nav-card.fun .nav-item:hover { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.2); }

@media (max-width: 768px) {
    #container {
        justify-content: flex-start;
        padding-top: 15vh;
    }

    #time {
        font-size: 3em !important;
        margin-bottom: 20px;
    }

    .search-container {
        width: 88vw;
        max-width: 400px;
        margin: 0 auto 24px;
    }

    .search-engine-btn {
        width: 48px;
        height: 48px;
        border-radius: 12px 0 0 12px;
        font-size: 1.2em;
    }

    #search-input {
        width: 100%;
        height: 48px;
        font-size: 1em;
        border-radius: 0 12px 12px 0;
        text-align: left;
        padding-left: 14px;
    }

    .nav-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 12px;
        margin-top: 20px;
        justify-content: center;
        background: transparent;
        border: none;
        backdrop-filter: none;
    }

    .nav-card {
        display: contents;
    }

    .nav-card-title {
        display: none;
    }

    .nav-card-items {
        display: contents;
    }

    .nav-item {
        padding: 10px 16px;
        font-size: 0.82em;
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.06);
        color: rgba(255, 255, 255, 0.75);
        text-decoration: none;
        white-space: nowrap;
    }

    .nav-item:active {
        background: rgba(79, 110, 247, 0.25);
        color: #fff;
    }

    footer {
        padding-bottom: 30px;
    }

}

/* ========== 6. 关于 & 隐私弹窗 ========== */
.info-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.info-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.info-panel {
    width: 90%;
    max-width: 450px;
    max-height: 70vh;
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 1em;
    font-weight: 600;
    color: #ddd;
}

.info-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.3em;
    cursor: pointer;
    transition: color 0.3s;
}

.info-close:hover {
    color: #fff;
}

.info-body {
    padding: 18px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
    overflow-y: auto;
    max-height: 50vh;
}

.info-name {
    font-size: 1.3em;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.info-version {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
}

.info-desc {
    margin-bottom: 16px;
}

.info-tech {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.85em;
}

.info-label {
    color: rgba(255, 255, 255, 0.4);
    min-width: 60px;
    flex-shrink: 0;
}

.privacy-content p {
    margin-bottom: 10px;
}

.privacy-content strong {
    color: rgba(255, 255, 255, 0.85);
}

footer a {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    margin-left: 12px;
    font-size: 0.85em;
    transition: color 0.3s;
}

footer a:hover {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: underline;
}

.rate-limit-hint {
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(5px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    75% { opacity: 1; }
    100% { opacity: 0; }
}
