:root {
    --primary-color: #4A90E2;
    --text-color: #333;
    --hover-color: rgba(74, 144, 226, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: rgba(255, 255, 255, 0.95);
    --surface-soft: rgba(255, 255, 255, 0.8);
    --muted-text: #666;
}

body.dark-mode {
    --primary-color: #7FB3F5;
    --text-color: #e8e8e8;
    --hover-color: rgba(127, 179, 245, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --surface: rgba(30, 32, 40, 0.9);
    --surface-strong: rgba(30, 32, 40, 0.95);
    --surface-soft: rgba(40, 42, 52, 0.85);
    --muted-text: #aaa;
}

body {
    margin: 0;
    padding: 0;
    background: url('pic/5.png') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-color);
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
}

/* 工具页统一的暗色遮罩；主页和工具箱页自带 bgLayer，跳过 */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(180deg,
        rgba(20, 24, 34, 0.45) 0%,
        rgba(20, 24, 34, 0.72) 100%);
}

body.home::before,
body.toolbox-page::before {
    content: none;
}

/* ---- 顶部导航：顶部与背景融合，下滑收缩成居中药丸 ---- */
.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    padding: 0.7rem 1rem;
    pointer-events: none;
    transition: padding 0.35s ease;
}

.topbar-inner {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    max-width: 1200px;
    min-height: 44px;
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    background: transparent;
    border: 1px solid transparent;
    box-sizing: border-box;
    transition: max-width 0.45s ease, background 0.35s ease,
                border-color 0.35s ease, box-shadow 0.35s ease;
}

body.scrolled .topbar-inner {
    width: 80%;
    max-width: none;
    background: rgba(18, 22, 32, 0.68);
    backdrop-filter: blur(18px) saturate(125%);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.32);
}

body.scrolled .topbar {
    padding-top: 0.85rem;
}

.topbar .site-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
    white-space: nowrap;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    margin-left: auto;
}

.topbar nav a,
.topbar .nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    min-height: 34px;
    padding: 0.38rem 0.8rem;
    border-radius: 999px;
    font-size: 0.93rem;
    font-family: inherit;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
}

.topbar nav a:hover,
.topbar nav a.active,
.topbar .nav-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* 夜间模式按钮：挂在导航栏里 */
.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* ---- 通用玻璃卡 ---- */
.glass {
    background: rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
}

/* ---- 工具页正文：居中列，顶部让开固定导航 ---- */
.content {
    max-width: 960px;
    margin: 0 auto;
    padding: calc(58px + 2.2rem) 2rem 3rem;
    box-sizing: border-box;
    animation: fadeIn 0.8s ease;
}

.content > h1 {
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.content > p {
    color: rgba(255, 255, 255, 0.78);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin-bottom: 1.2rem;
    font-weight: 600;
}

/* ---- 音乐播放器 ---- */
.music-player {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background: var(--surface);
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.music-player:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.music-player.minimized {
    transform: translateX(calc(100% - 40px));
}

.toggle-player {
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
}

.toggle-player:hover {
    background: var(--primary-color);
    color: white;
}

@media (max-width: 768px) {
    .content {
        padding: calc(58px + 1.2rem) 1.2rem 2rem;
    }

    .topbar { padding: 0.5rem 0.6rem; }
    body.scrolled .topbar-inner { width: 100%; }
    .topbar .site-name { font-size: 1rem; }
}

@media (max-width: 520px) {
    .topbar-inner { gap: 0.25rem; padding-inline: 0.55rem; }
    .topbar .site-name { font-size: 0; width: 30px; }
    .topbar .site-name::after { content: 'A'; font-size: 1.05rem; }
    .topbar nav { gap: 0; }
    .topbar nav a, .topbar .nav-btn { padding-inline: 0.55rem; font-size: 0.88rem; }
}
