/* 像素记忆挑战游戏样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: manipulation;
    user-select: none;
}

.game-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* 状态栏 */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 20px;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.status-bar div {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 游戏区域 */
.game-area {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 15px;
    width: 200px;
    height: 200px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.grid-button {
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.grid-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.grid-button:active::before {
    transform: translateX(100%);
}

.grid-button.red {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.3),
        0 4px 8px rgba(238, 90, 82, 0.4);
}

.grid-button.blue {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.3),
        0 4px 8px rgba(68, 160, 141, 0.4);
}

.grid-button.green {
    background: linear-gradient(135deg, #95e1d3, #3fc1c9);
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.3),
        0 4px 8px rgba(63, 193, 201, 0.4);
}

.grid-button.yellow {
    background: linear-gradient(135deg, #fce38a, #f38ba8);
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.3),
        0 4px 8px rgba(243, 139, 168, 0.4);
}

.grid-button:hover {
    transform: scale(1.05);
}

.grid-button:active {
    transform: scale(0.95);
}

.grid-button.active {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); filter: brightness(1.3); }
    100% { transform: scale(1); }
}

/* 控制区域 */
.control-area {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.start-btn, .restart-btn {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.start-btn:hover, .restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.start-btn:active, .restart-btn:active {
    transform: translateY(0);
}

/* 游戏信息 */
.game-info {
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

#message {
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .game-container {
        padding: 15px;
    }
    
    .grid {
        width: 160px;
        height: 160px;
        gap: 10px;
        padding: 15px;
    }
    
    .status-bar {
        padding: 10px;
        font-size: 12px;
    }
    
    .start-btn, .restart-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    #message {
        font-size: 14px;
    }
}

@media (max-width: 320px) {
    .grid {
        width: 120px;
        height: 120px;
        gap: 8px;
        padding: 10px;
    }
    
    .start-btn, .restart-btn {
        padding: 10px 20px;
        font-size: 12px;
    }
}

/* 8位像素风格效果 */
.pixel-border {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 闪烁效果 */
.flash {
    animation: flash 0.5s ease-in-out;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}