/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Press Start 2P', cursive, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 基础颜色为红白机风格 */
body {
    background-color: #1a1a1a; /* 深灰色背景 */
    color: #ffffff;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 加载动画 - 修复版本 */
.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

/* 修改加载器样式，移除旋转动画 */
.loader {
    width: 280px;
    height: 30px;
    background: #2a2a2a;
    border: 4px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
    position: relative;
    margin-bottom: 20px;
    overflow: hidden;
    animation: none !important;
    border-radius: 0;
}

/* 确保进度条样式正确 */
.loader-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: repeating-linear-gradient(
        45deg,
        #8a2be2,
        #8a2be2 10px,
        #ffffff 10px,
        #ffffff 20px
    );
    transition: width 0.1s linear;
}

.loader-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    text-shadow: 1px 1px 0 #000;
    z-index: 1;
}

.loader-text {
    font-size: 16px;
    letter-spacing: 2px;
    color: #8a2be2;
    font-family: 'Press Start 2P', cursive;
    margin-top: 10px;
    animation: blink 1s steps(2) infinite;
}

/* 网格背景 */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(0deg, transparent 24%, rgba(138, 43, 226, 0.05) 25%, rgba(138, 43, 226, 0.05) 26%, transparent 27%, transparent 74%, rgba(138, 43, 226, 0.05) 75%, rgba(138, 43, 226, 0.05) 76%, transparent 77%, transparent), linear-gradient(90deg, transparent 24%, rgba(138, 43, 226, 0.05) 25%, rgba(138, 43, 226, 0.05) 26%, transparent 27%, transparent 74%, rgba(138, 43, 226, 0.05) 75%, rgba(138, 43, 226, 0.05) 76%, transparent 77%, transparent);
    background-size: 50px 50px;
    z-index: -2;
}

/* 粒子背景 */
#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* 主容器 */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

/* 游戏网格 */
.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.game-card {
    background: #2a2a2a;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    min-height: 200px;
    position: relative;
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: 0;
    transform: translateY(0) rotateX(0);
}

.pixel-border {
    box-shadow: 
        0 0 0 1px #ffffff,
        0 0 0 2px #7837fa;
}

.game-card-inner {
    padding: 20px;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}


.pixel-icon {
    width: 64px;
    height: 64px;
    image-rendering: pixelated; /* 保持像素清晰 */
    image-rendering: crisp-edges;
    display: inline-block;
}

.game-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    min-height: 60px; /* 确保图标区域有足够空间 */
}

.game-icon {
    font-size: 40px;
    margin-bottom: 15px;
    color: #8a2be2;
    transition: transform 0.3s ease;
}

.game-card:hover .game-icon {
    transform: scale(1.2);
}

.game-card h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #ffffff;
}

.game-card p {
    font-size: 12px;
    color: #cccccc;
    margin-bottom: 15px;
}

.game-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #8a2be2;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
    text-transform: uppercase;
    border-radius: 0;
    font-size: 12px;
    font-family: 'Press Start 2P', cursive;
}

.game-btn:hover {
    background: #ffffff;
    color: #8a2be2;
    box-shadow: 
        0 0 0 2px #ffffff,
        0 0 10px rgba(255, 255, 255, 0.5);
}

/* 页脚 */
.retro-footer {
    text-align: center;
    padding: 10px;
    color: #8a2be2;
    font-size: 10px;
    width: 100%;
    background-color: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10;
    border-top: 2px solid #8a2be2;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
}

@media (max-width: 576px) {
    .games-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(6, 1fr);
    }
    
    .container {
        padding: 10px;
    }
    
    .game-card-inner {
        padding: 15px;
    }
    
    .game-icon {
        font-size: 30px;
        margin-bottom: 10px;
    }
    
    .game-card h3 {
        font-size: 14px;
    }
    
    .game-card p {
        font-size: 10px;
        margin-bottom: 10px;
    }
    
    .game-btn {
        padding: 6px 12px;
        font-size: 10px;
    }
}

/* 霓虹文字 */
.neon-text {
    font-family: 'Press Start 2P', cursive;
    color: #fff;
    text-shadow: 
        0 0 5px #8a2be2, 
        0 0 10px #8a2be2, 
        0 0 20px #8a2be2, 
        0 0 40px #8a2be2;
    animation: neon-flicker 2s infinite alternate;
}

@keyframes neon-flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow: 
            0 0 5px #8a2be2, 
            0 0 10px #8a2be2, 
            0 0 20px #8a2be2, 
            0 0 40px #8a2be2;
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* 扫描线效果 */
.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, transparent 50%, rgba(0, 0, 0, 0.3) 50%, transparent 51%);
    background-size: 100% 4px;
    z-index: 2;
    pointer-events: none;
    animation: scanline 10s linear infinite;
}

@keyframes scanline {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 100%;
    }
}

/* 复古标题 */
.retro-title {
    text-align: center;
    padding: 20px 0;
    position: relative;
    z-index: 999;
}

.retro-title h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* 像素文字 */
.pixel-text {
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.4;
}

/* 添加闪烁效果 */
.blink {
    animation: blink 1s steps(2) infinite;
}

@keyframes blink {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* 打字机效果 */
.typewriter {
    border-right: 2px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

/* 鼠标跟随效果 */
.mouse-follower {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 0;
    background: rgba(138, 43, 226, 0.3);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s, background 0.3s;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
    display: block !important;
}

.mouse-follower.active {
    width: 40px;
    height: 40px;
    background: rgba(138, 43, 226, 0.2);
}

/* 红白机特有的像素纹理背景 */
.retro-bg {
    background-color: #1a1a1a;
    background-image: 
        linear-gradient(rgba(26, 26, 26, 0.9), rgba(26, 26, 26, 0.9)),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4" viewBox="0 0 4 4"><path fill="%238a2be2" d="M1 3h1v1H1V3zm2-2h1v1H3V1z"/></svg>');
}