* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 600px;
    width: 100%;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-header h1 {
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.info-item {
    text-align: center;
}

.info-item .label {
    color: #666;
    font-size: 0.9em;
    display: block;
    margin-bottom: 5px;
}

.info-item .score,
.info-item .moves,
.info-item .target {
    color: #667eea;
    font-size: 1.8em;
    font-weight: bold;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    background: #e9ecef;
    padding: 10px;
    border-radius: 15px;
    margin: 20px 0;
    aspect-ratio: 1;
}

.cell {
    background: white;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.cell.selected {
    background: #fff3cd;
    border: 3px solid #ffc107;
    transform: scale(1.1);
}

.cell.matched {
    animation: pulse 0.5s ease;
}

.cell.falling {
    animation: fall 0.5s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

@keyframes fall {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.cell.invalid {
    animation: shake 0.3s ease;
}

.game-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-audio {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    transition: all 0.3s ease;
}

.btn-audio.muted {
    background: linear-gradient(135deg, #a8a8a8 0%, #6c6c6c 100%);
    opacity: 0.7;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.modal-content h2 {
    color: #667eea;
    font-size: 2em;
    margin-bottom: 20px;
}

.modal-content p {
    font-size: 1.3em;
    margin-bottom: 30px;
    color: #333;
}

#finalScore {
    color: #667eea;
    font-weight: bold;
    font-size: 1.5em;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 600px) {
    .game-container {
        padding: 15px;
    }

    .game-header h1 {
        font-size: 1.8em;
    }

    .cell {
        font-size: 1.5em;
    }

    .btn {
        padding: 10px 20px;
        font-size: 1em;
    }
}

/* 粒子效果 */
.particle {
    position: absolute;
    pointer-events: none;
    animation: particle-explode 0.6s ease-out forwards;
}

@keyframes particle-explode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

