/* 顶部工具栏 · 背景音乐 */

.navbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "logo nav right";
    align-items: center;
    column-gap: 20px;
    row-gap: 12px;
}

.navbar .logo {
    grid-area: logo;
    flex-shrink: 0;
}

.navbar .nav-links {
    grid-area: nav;
    justify-content: center;
    margin: 0;
}

.navbar-right {
    grid-area: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
}

.site-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.site-tool-wrap {
    position: relative;
    flex-shrink: 0;
}

.site-tool-wrap-music .site-tool-btn.is-open,
.site-tool-wrap-music .site-tool-btn.is-playing {
    border-color: rgba(253, 224, 71, 0.55);
    background: linear-gradient(145deg, rgba(184, 124, 255, 0.35), rgba(79, 70, 229, 0.45));
    color: #fff;
}

.site-tool-wrap-lang .site-tool-btn.is-open,
.site-tool-wrap-lang .site-tool-btn-lang:hover {
    border-color: rgba(196, 181, 253, 0.55);
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.32), rgba(79, 70, 229, 0.42));
    color: #fff;
}

.site-lang-icon {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.site-tool-wrap-lang .site-tool-btn-lang {
    width: 2rem;
    height: 2rem;
}

.site-tool-wrap-lang .site-tool-btn-lang:hover {
    background: rgba(168, 85, 247, 0.1);
}

.site-tool-wrap-theme .site-tool-btn-theme {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 999px;
}

.site-tool-wrap-theme .site-tool-btn-theme:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.15);
    color: inherit;
}

.site-lang-panel {
    min-width: 168px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(184, 124, 255, 0.35);
    background: rgba(12, 8, 22, 0.97);
    box-shadow:
        0 0 0 1px rgba(184, 124, 255, 0.08),
        0 16px 48px rgba(0, 0, 0, 0.55),
        0 0 32px rgba(124, 58, 237, 0.15);
}

.site-lang-head {
    margin: 0 0 8px;
    padding: 0 6px 8px;
    border-bottom: 1px solid rgba(184, 124, 255, 0.15);
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(196, 181, 253, 0.75);
    letter-spacing: 0.06em;
}

.site-lang-option {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 9px 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(240, 238, 247, 0.88);
    font-size: 0.86rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.site-lang-option:hover {
    background: rgba(184, 124, 255, 0.14);
    color: #fff;
}

.site-lang-option.is-active {
    background: rgba(124, 58, 237, 0.28);
    color: #fde68a;
    font-weight: 600;
}

.site-lang-option.is-active::after {
    content: '✓';
    margin-left: auto;
    font-size: 0.75rem;
    color: #fde68a;
}

/* 背景音乐下拉面板 */
.site-music-panel {
    min-width: 260px;
    max-width: min(300px, 92vw);
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(184, 124, 255, 0.35);
    background: rgba(12, 8, 22, 0.97);
    box-shadow:
        0 0 0 1px rgba(184, 124, 255, 0.08),
        0 16px 48px rgba(0, 0, 0, 0.55),
        0 0 32px rgba(124, 58, 237, 0.15);
}

.site-music-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(184, 124, 255, 0.15);
}

.site-music-head-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f5f3ff;
}

.site-music-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(184, 124, 255, 0.12);
    color: rgba(196, 181, 253, 0.85);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.2s;
}

.site-music-refresh:hover {
    background: rgba(184, 124, 255, 0.25);
    color: #fde68a;
}

.site-music-refresh.is-spinning i {
    animation: site-refresh-spin 0.6s linear;
}

@keyframes site-refresh-spin {
    to { transform: rotate(360deg); }
}

.site-music-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.site-music-play-btn {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #a78bfa, #7c3aed);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.45);
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.site-music-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.55);
}

.site-music-play-btn.is-playing {
    background: linear-gradient(145deg, #86efac, #22c55e);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

.site-music-play-btn i {
    font-size: 0.95rem;
    margin-left: 2px;
}

.site-music-play-btn.is-playing i {
    margin-left: 0;
}

.site-music-status {
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(233, 213, 255, 0.9);
}

.site-music-current {
    margin: 0 0 10px;
    font-size: 0.78rem;
    color: rgba(196, 181, 253, 0.65);
}

.site-music-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.site-music-track {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: rgba(245, 243, 255, 0.92);
    font-size: 0.86rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.site-music-track:hover {
    background: rgba(184, 124, 255, 0.1);
}

.site-music-track.is-active {
    background: rgba(124, 58, 237, 0.35);
    border-color: rgba(184, 124, 255, 0.35);
    color: #fff;
    font-weight: 600;
}

.site-music-track-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-music-eq {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    flex-shrink: 0;
}

.site-music-track.is-active.is-playing .site-music-eq {
    display: inline-flex;
}

.site-music-eq span {
    display: block;
    width: 3px;
    border-radius: 2px;
    background: #c4b5fd;
    animation: site-eq-bounce 0.55s ease-in-out infinite alternate;
}

.site-music-eq span:nth-child(1) { height: 6px; animation-delay: 0s; }
.site-music-eq span:nth-child(2) { height: 11px; animation-delay: 0.12s; }
.site-music-eq span:nth-child(3) { height: 8px; animation-delay: 0.24s; }

@keyframes site-eq-bounce {
    from { transform: scaleY(0.45); opacity: 0.65; }
    to { transform: scaleY(1); opacity: 1; }
}

.site-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    border: 1px solid rgba(184, 124, 255, 0.28);
    border-radius: 999px;
    background: rgba(20, 16, 28, 0.72);
    color: rgba(233, 213, 255, 0.92);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.site-tool-btn:hover {
    border-color: rgba(253, 224, 71, 0.45);
    color: #fde68a;
    box-shadow: 0 4px 16px rgba(184, 124, 255, 0.2);
}

.site-tool-btn.is-active {
    border-color: rgba(253, 224, 71, 0.55);
    background: linear-gradient(145deg, rgba(184, 124, 255, 0.35), rgba(79, 70, 229, 0.45));
    color: #fff;
}

.site-tool-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    max-width: min(280px, 92vw);
    padding: 8px;
    border-radius: 14px;
    border: 1px solid rgba(184, 124, 255, 0.25);
    background: rgba(14, 10, 24, 0.96);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    z-index: 200;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.site-tool-panel[hidden] {
    display: none !important;
}

.site-tool-panel-title {
    margin: 0 0 6px;
    padding: 4px 8px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(196, 181, 253, 0.55);
    border-bottom: 1px solid rgba(184, 124, 255, 0.12);
}

.site-tool-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 240px;
    overflow-y: auto;
}

.site-tool-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(245, 243, 255, 0.92);
    font-size: 0.86rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.site-tool-item:hover {
    background: rgba(184, 124, 255, 0.14);
}

.site-tool-item.is-active {
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
}

.site-tool-item i {
    width: 1rem;
    text-align: center;
    opacity: 0.75;
}

.site-tool-empty {
    margin: 0;
    padding: 10px;
    font-size: 0.82rem;
    color: rgba(196, 181, 253, 0.55);
}

.navbar .auth-buttons {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    flex-shrink: 0;
}

/* Light theme: see site-theme-light.css (loaded after page styles) */

@media (max-width: 1100px) {
    .navbar {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo right"
            "nav nav";
    }

    .navbar .nav-links {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .navbar-right {
        gap: 6px;
    }

    .site-toolbar {
        gap: 4px;
    }

    .site-tool-btn,
    .navbar .auth-buttons .btn-outline,
    .navbar .auth-buttons .btn-primary {
        padding: 8px 12px;
        font-size: 0.82rem;
    }
}

/* English locale: compact nav labels so all items stay on one row */
html[lang="en-US"] .navbar {
    column-gap: 12px;
}

html[lang="en-US"] .navbar .nav-links {
    flex-wrap: nowrap;
    gap: clamp(4px, 0.5vw, 8px);
}

html[lang="en-US"] .nav-links li {
    padding: 0;
    font-size: clamp(0.72rem, 0.72vw, 0.82rem);
    flex-shrink: 0;
}

html[lang="en-US"] .nav-links a,
html[lang="en-US"] .nav-links a:link,
html[lang="en-US"] .nav-links a:visited {
    padding: 6px clamp(8px, 0.9vw, 12px);
    font-size: clamp(0.72rem, 0.72vw, 0.82rem);
    white-space: nowrap;
    letter-spacing: 0.01em;
}

@media (min-width: 1101px) and (max-width: 1320px) {
    html[lang="en-US"] .nav-links a,
    html[lang="en-US"] .nav-links a:link,
    html[lang="en-US"] .nav-links a:visited {
        padding: 5px 7px;
        font-size: 0.7rem;
    }
}
