/* --- 关键改动 1: 从Google Fonts引入专业字体 Inter --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

/* --- 步骤 1: 定义颜色变量 --- */
:root {
    /* 默认是暗色模式的颜色 */
    --color-bg: #050507;
    --color-title: #e3e3e3;
    --color-summary: rgba(227, 227, 227, 0.85);
    --color-text-shadow: rgba(0, 0, 0, 0.5);
    --color-summary-text-shadow: rgba(0, 0, 0, 0.4);
    --color-icon: #ffffff;
    --color-button-bg: rgba(255, 255, 255, 0.1);
    --color-button-border: rgba(255, 255, 255, 0.2);
    --color-progress-bar-bg: rgba(0, 0, 0, 0.3);
    --color-progress-bar-border: rgba(255, 255, 255, 0.2);
    --color-progress-bar-fill: #ffffff;
    --color-progress-bar-shadow: #ffffff;
}

body.light-theme {
    /* 当 body 有 .light-theme class 时，切换到亮色模式的颜色 */
    --color-bg: #f4f4f5;
    --color-title: #27272a;
    --color-summary: #52525b;
    --color-text-shadow: rgba(0, 0, 0, 0.05);
    --color-summary-text-shadow: rgba(0, 0, 0, 0.05);
    --color-icon: #18181b;
    --color-button-bg: rgba(0, 0, 0, 0.05);
    --color-button-border: rgba(0, 0, 0, 0.1);
    --color-progress-bar-bg: rgba(0, 0, 0, 0.1);
    --color-progress-bar-border: rgba(0, 0, 0, 0.15);
    --color-progress-bar-fill: #27272a;
    --color-progress-bar-shadow: #27272a;
}


/* --- 步骤 2: 应用颜色变量 --- */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 20px;
    overflow: hidden;
    
    background-color: var(--color-bg); 
    color: var(--color-title); /* 为 body 设置一个基础文字颜色 */
    transition: background-color 0.4s ease, color 0.4s ease; /* 平滑过渡动画 */
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* 关键：确保它在所有页面内容的后面 */
}

/* --- 进度条样式 --- */
#progress-container {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 250px; height: 16px; 
    border-radius: 8px;
    padding: 3px; box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 9999; opacity: 1; transition: opacity 0.5s ease-out, background-color 0.4s ease, border-color 0.4s ease;

    background-color: var(--color-progress-bar-bg);
    border: 2px solid var(--color-progress-bar-border);
}
#progress-container.hidden { opacity: 0; }
#progress-bar {
    width: 0%; height: 100%; 
    border-radius: 5px;
    animation: varied-loading 25s ease-in-out forwards;
    transition: background-color 0.4s ease, box-shadow 0.4s ease;

    background-color: var(--color-progress-bar-fill);
    box-shadow: 0 0 15px var(--color-progress-bar-shadow);
}
@keyframes varied-loading {
    0% { width: 0%; } 20% { width: 60%; }
    70% { width: 90%; } 100% { width: 99%; }
}

/* --- 浮动文本样式 --- */
.floating-title, .floating-summary {
    position: absolute;
    opacity: 0;
    transition: opacity 1.5s ease-in-out, transform 1.5s ease-in-out, color 0.4s ease;
    max-width: 92vw;
    backface-visibility: hidden;
}

.floating-title {
    font-weight: 600;
    font-size: 1.4em;
    letter-spacing: 0.03em;
    color: var(--color-title);
    text-shadow: 0 0 15px var(--color-text-shadow);
}

.floating-summary {
    font-weight: 400;
    font-size: 1.4em;
    transition-delay: 0.2s;
    color: var(--color-summary);
    text-shadow: 0 0 12px var(--color-summary-text-shadow);
}

/* --- 媒体查询 (同步更新字体大小和层次感) --- */
@media (min-width: 768px) {
    .floating-title { font-size: 2.0em; }
    .floating-summary { font-size: 1.6em; line-height: 1.8; }
    .floating-title, .floating-summary { max-width: 700px; }
}

@media (min-width: 1024px) {
    .floating-title {
        font-size: 2.2em;
        letter-spacing: 0.04em;
    }
    .floating-summary {
        font-size: 1.4em;
        line-height: 1.7;
    }
    .floating-title, .floating-summary { max-width: 750px; }
}


#theme-toggle-button {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 1000;
    
    width: 24px;
    height: 24px;
    padding: 6px;
    
    cursor: pointer;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    border-radius: 50%;
    border: 1px solid var(--color-button-border);
    
    /* 步骤 1: 提供一个对所有浏览器都安全的、半透明的背景作为后备 */
    background-color: var(--color-button-bg); 
    
    transition: transform 0.2s ease, background-color 0.4s ease, border-color 0.4s ease;
}

/* 步骤 2: 使用 @supports 查询，只有支持 backdrop-filter 的浏览器才会应用模糊效果 */
@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
    #theme-toggle-button {
        /* 在支持的浏览器中，可以把背景设得更透明一些，因为有模糊效果 */
        background-color: rgba(128, 128, 128, 0.15); 
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px); /* 兼容旧版 Safari */
    }
    
    /* 针对亮色模式，也在这里面覆盖 */
    body.light-theme #theme-toggle-button {
        background-color: rgba(255, 255, 255, 0.2);
    }
}


#theme-toggle-button:hover {
    transform: scale(1.1);
}

#theme-toggle-button svg {
    color: var(--color-icon);
    transition: color 0.4s ease;
}

/* 默认显示月亮，隐藏太阳 (这段逻辑保持不变) */
.sun-icon {
    display: none;
}
.moon-icon {
    display: block;
}

/* 在亮色模式下，反转显示图标 (这段逻辑保持不变) */
body.light-theme .sun-icon {
    display: block;
}
body.light-theme .moon-icon {
    display: none;
}

/* ======================================================= */
/*             在 style.css 文件末尾追加这些样式             */
/* ======================================================= */

/* --- 音乐播放按钮样式 (复用主题按钮风格) --- */
#music-toggle-button {
    position: fixed;
    top: 15px;      /* 定位在右上角 */
    right: 15px;
    z-index: 1000;
    
    width: 24px;
    height: 24px;
    padding: 6px;
    
    cursor: pointer;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    border-radius: 50%;
    border: 1px solid var(--color-button-border);
    background-color: var(--color-button-bg); 
    
    transition: transform 0.2s ease, background-color 0.4s ease, border-color 0.4s ease;
}

/* 复用玻璃模糊效果 */
@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
    #music-toggle-button {
        background-color: rgba(128, 128, 128, 0.15); 
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    
    body.light-theme #music-toggle-button {
        background-color: rgba(255, 255, 255, 0.2);
    }
}

#music-toggle-button:hover {
    transform: scale(1.1);
}

#music-toggle-button svg {
    color: var(--color-icon);
    transition: color 0.4s ease;
    position: absolute; /* 让图标重叠，方便切换 */
}

/* --- 音乐按钮图标的显示/隐藏逻辑 --- */
.play-icon, .pause-icon, .loading-icon {
    display: none; /* 默认全部隐藏 */
}

/* 默认状态: 显示播放图标 */
#music-toggle-button.is-paused .play-icon {
    display: block;
}

/* 播放中状态: 显示暂停图标 */
#music-toggle-button.is-playing .pause-icon {
    display: block;
}

/* 加载中状态: 显示加载图标并旋转 */
#music-toggle-button.is-loading .loading-icon {
    display: block;
    animation: music-spin 1.2s linear infinite;
}

@keyframes music-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}