:root {
    /* 主色：蓝灰墨色，低饱和度 */
    --primary-color: #4b5563;      /* slate-600 */
    /* 次色：柔和砖红，作为强调与按钮 hover */
    --secondary-color: #a0563b;    /* muted terracotta */
    /* 强调色：暖金黄但不过亮 */
    --accent-color: #c8a04a;       /* muted ochre */
    /* 玻璃背景更柔和一些 */
    --glass-bg: rgba(240, 240, 236, 0.12);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* 悬停高亮更克制 */
    --highlight-color: rgba(160, 86, 59, 0.18);
    --hover-bg: rgba(75, 85, 99, 0.10);
    /* 按钮 hover 用更深砖红 */
    --button-hover: #8b4634;
    /* 页脚背景与文字对比提升但不刺眼 */
    --footer-bg: #3f4a56;
    --footer-text: #f3efe7;
    /* 背景：米灰偏暖，降低明度 */
    --background-bg: #ebe6db;
    --background-movebg: #d9cfbf;
    /* 中性色 */
    --ink-black: #2f2f2f;
    --bamboo-green: #6f7d4f;       /* 更低饱和度的绿 */
    --lotus-pink: #d8a8b3;         /* 柔和粉 */
    /* 阴影稍微收敛 */
    --shadow: 0 6px 18px rgba(75, 85, 99, 0.18);
}

/* 关键：让动态背景可见，避免被默认白底遮住 */
html, body {
    background: transparent;
}

/* 背景容器固定在最底层，带一个渐变兜底（即使 JS 失败也有淡淡的背景） */
.dynamic-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(1200px 800px at 20% 20%, rgba(200,160,74,0.28), transparent 60%),
                radial-gradient(1000px 700px at 80% 30%, rgba(160,86,59,0.22), transparent 60%),
                radial-gradient(900px 900px at 50% 80%, rgba(75,85,99,0.18), transparent 60%),
                linear-gradient(180deg, rgba(235,230,219,0.75), rgba(235,230,219,0.45));
}

/* 让 canvas 铺满容器 */
#bg-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

body {
    margin: 0;
    padding: 0;
    color: #333;
    font-family: 'BerkshireSwash-Regular', sans-serif;
}

h1 {
    font-size: 1.7rem;
    font-weight: 700;
    margin: 0;
    color: var(--accent-color);

}

.more-games {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--background-bg);
    text-align: center;
    margin: 2rem 0 0;
    position: relative;
}

.more-games::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background-color: var(--background-bg);
    border-radius: 5px;
}

a {
    text-decoration: none;
}


header {
    padding: 0.5rem;
    background-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    transition: box-shadow 0.3s ease;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    gap: 20px;
}

.header-title {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    width: 40px;
    transition: transform 0.3s ease;
}

.site-logo:hover {
    transform: scale(1.05);
}

.navbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.menu {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    padding: 0;
}

.menu a {
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    /* padding: 0.5rem; */
    border-radius: 5px;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 30px;
    text-align: center;
}

.menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu a:hover {
    background-color: var(--primary-color);
    color: var(--button-hover);
}

.menu a:hover::after {
    opacity: 1;
}

.menu-toggle {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.menu-toggle img {
    width: 40px;
    height: 40px;
    transition: transform 0.3s ease;
}

.menu-toggle span {
    width: 30px;
    height: 3px;
    background-color: #333;
    border-radius: 2px;
}

.search-item {
    display: flex;
    align-items: center;
    margin-left: auto;
}

#search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 200px;
}

#search-input {
    width: 100%;
    padding: 0.3rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease, background 0.3s ease;
}

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

#search-input:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.2);
}

#search-form button {
    /* background: var(--accent-color); */
    color: #fff;
    border: none;
    padding: .1rem .35rem;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#search-form button:hover {
    background: var(--button-hover);
}

@media (max-width: 1150px) {

    .menu {
        display: none;
        position: absolute;
        top: 60px;
        right: 0;
        height: calc(100vh - 120px);
        background-color: var(--secondary-color);
        width: 200px;
        border-radius: 15px;
        flex-direction: column;
        padding: 1.5rem;
        margin: 0;
        gap: 1.2rem;
        transform: translateX(100%);
        transition: transform 0.3s ease, background-color 0.3s ease;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }

    .menu.active {
        display: flex;
        transform: translateX(0);
    }

    .menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
        z-index: 11;
    }

    .menu-toggle span {
        width: 30px;
        height: 3px;
        background-color: var(--background-bg);
        border-radius: 2px;
        transition: background-color 0.3s ease;
    }

    .menu-toggle:hover span {
        background-color: #ccc;
    }

    .menu a {
        text-decoration: none;
        color: #fff;
        font-weight: 600;
        font-size: 1.1rem;
        padding: 0.8rem 1.5rem;
        border-radius: 10px;
        position: relative;
        transition: background-color 0.3s ease, transform 0.3s ease;
        line-height: 3rem;
    }

    .menu a:hover {
        background-color: var(--secondary-color);
        transform: scale(1.05);
    }

    .menu a::after {
        content: '';
        position: absolute;
        bottom: -4px;
        left: 0;
        width: 0;
        height: 2px;
        background-color: var(--primary-color);
        transition: width 0.3s ease;
    }

    .menu a:hover::after {
        width: 100%;
    }

    .menu a.active {
        background-color: var(--primary-color);
        color: #fff;
    }

    .search-item {
        margin-left: 0;
    }
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    grid-auto-rows: 1fr;
    gap: 1.5rem;
    padding: 1rem;
    max-width: 1200px;
    margin: calc(60px + 1rem) auto 1rem;
    min-height: calc(100vh - 250px);
    grid-auto-flow: dense;
    /* padding-top: 250px; */
}

.game-card {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: var(--shadow);
    transition: var(--transition);
    aspect-ratio: 1;
    cursor: pointer;
    backdrop-filter: blur(20px);
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
    /* 确保遮罩层不阻止点击 */
}

.game-card:hover::before {
    opacity: 1;
}

.game-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 0;
    border-radius: 15px;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.3));
    mask: linear-gradient(to bottom,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 1) 8%,
            rgba(0, 0, 0, 1) 92%,
            rgba(0, 0, 0, 0) 100%);
    transition: transform 0.3s ease;
}

.game-card:hover .game-logo {
    transform: scale(1.1);
    filter: brightness(1) contrast(1);
}

.game-card::after {
    content: '►';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(45deg, var(--accent-color), var(--button-hover));
    padding: 0.8rem 1.1rem;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(240, 113, 103, 0.4);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
    pointer-events: none;
}

.game-card:hover::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: pulse 1.5s infinite;
}

.game-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.game-card.large {
    grid-column: span 2;
    grid-row: span 2;
}

.game-card.medium {
    grid-column: span 1;
    grid-row: span 1;
}

@media (max-width: 768px) {
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 1rem;
    }

    .game-card.large {
        grid-column: span 2;
        grid-row: span 2;
    }
}

@media (min-width: 1200px) {
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 2rem .5rem;
    text-align: center;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 10px;
}

.footer-logo img {
    width: 80px;
    height: 100%;
    border-radius: 10px;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-links ul li {
    display: inline;
    margin: 0 auto;
}

.footer-links a {
    text-decoration: none;
    color: var(--footer-text);
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--button-hover);
}

.footer-copyright {
    font-size: 0.9rem;
}

.pag {
    margin: calc(80px + 1rem) auto 1rem;
    max-width: 1200px;
    min-height: calc(100vh - 250px);
    font-size: 1.2rem;
    line-height: 2.2rem;
}