/* 定义亮色模式的颜色变量 */
:root {
    --bg-color: #f4f4f9;
    --container-bg-color: #ffffff;
    --text-color: #333333;
    --header-color: #444444;
    --link-color: #007bff;
    --link-hover-color: #0056b3;
    --border-color: #eeeeee;
    --list-item-bg-color: #fafafa;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* 定义深色模式的颜色变量 */
body.dark-mode {
    --bg-color: #121212;
    --container-bg-color: #1e1e1e;
    --text-color: #e0e0e0;
    --header-color: #f0f0f0;
    --link-color: #58a6ff;
    --link-hover-color: #80bfff;
    --border-color: #333333;
    --list-item-bg-color: #2c2c2c;
    --shadow-color: rgba(0, 0, 0, 0.4);
}

/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-color) url('https://yani.xx.kg/img/wallpaper.jpg') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-color);
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 80px;
    min-height: calc(100vh - 80px);
}

/* 顶部栏 */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    /* **** 关键修改：使用 space-between 将左右元素推到两端 **** */
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--container-bg-color);
    box-shadow: 0 2px 5px var(--shadow-color);
    box-sizing: border-box;
    z-index: 100;
    transition: background-color 0.3s;
}

/* 右侧控件的容器 */
.top-bar-right {
    display: flex;
    align-items: center;
    /* **** 新增：使用 gap 属性为右侧控件之间提供间距 **** */
    gap: 20px;
}

/* 主页按钮的样式 */
.home-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.home-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode .home-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.home-button svg {
    fill: var(--text-color);
    width: 26px;
    height: 26px;
    transition: fill 0.3s;
}

.home-button:hover svg {
    fill: var(--link-color);
}

select {
    padding: 5px 8px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    /* **** 关键修改：移除此处的 margin-right，由父级的 gap 统一管理间距 **** */
    /* margin-right: 20px; */
    cursor: pointer;
}

/* 主题切换开关 */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch-wrapper span {
    margin-left: 8px;
    font-size: 14px;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--link-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* 内容容器 */
.container {
    width: 90%;
    max-width: 600px;
    background-color: var(--container-bg-color);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: background-color 0.3s, box-shadow 0.3s;
}

h1 {
    text-align: center;
    color: var(--header-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-top: 0;
    margin-bottom: 25px;
}

/* 游戏列表 */
ul {
    list-style-type: none;
    padding: 0;
}

li {
    background-color: var(--list-item-bg-color);
    margin-bottom: 12px;
    border-radius: 5px;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s;
}

li:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px var(--shadow-color);
}

a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--link-color);
    font-size: 18px;
    font-weight: 500;
    transition: color 0.3s;
}

a:hover {
    color: var(--link-hover-color);
}

.starlight {
    position: fixed;
    pointer-events: none;
    left: 0; top: 0;
    width: 16px; height: 16px;
    z-index: 9999;
    opacity: 0.9;
    /* 粒子动画：弹出到目标点 & 旋转 & 缩放 & 消失 */
    animation: starlight-fly 0.7s cubic-bezier(.2,1,.6,1) forwards;
    will-change: transform, opacity;
    transform: translate(-50%, -50%) scale(1) rotate(var(--star-rotate));
}
.starlight::before {
    content: '';
    display: block;
    width: 100%; height: 100%;
    background: none;
    /* 五角星，SVG mask；渐变色更可爱 */
    mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 50 50" width="16" height="16" xmlns="http://www.w3.org/2000/svg"><polygon fill="white" points="25,2 32,18 49,18 36,29 40,46 25,36 10,46 14,29 1,18 18,18"/></svg>') center/contain no-repeat;
    -webkit-mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 50 50" width="16" height="16" xmlns="http://www.w3.org/2000/svg"><polygon fill="white" points="25,2 32,18 49,18 36,29 40,46 25,36 10,46 14,29 1,18 18,18"/></svg>') center/contain no-repeat;
    background: radial-gradient(ellipse at 60% 30%, white 65%, var(--star-color, #ffe) 100%);
    box-shadow: 0 0 8px 2px #fff8;
}

/* 飞出动画 */
@keyframes starlight-fly {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.5) rotate(var(--star-rotate));
        filter: blur(0);
    }
    60% {
        opacity: 1;
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
                    scale(1.1) rotate(var(--star-rotate));
        filter: blur(0.5px);
    }
    85% {
        opacity: 0.8;
        filter: blur(1px);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
                    scale(0.4) rotate(calc(var(--star-rotate) + 30deg));
        filter: blur(2px);
    }
}

header {
    position: sticky;      /* 关键属性 */
    top: 0;                /* 吸附于页面顶端 */
    z-index: 2000;         /* 确保在其他层之上 */
    background: var(--header-bg-color);
    color: var(--header-text-color);
    padding: 1rem 0;
    transition: background 0.3s;
    width: 100%;           /* 保证全宽 */

}
