* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 30px;
    text-align: center;
    max-width: 500px;
    width: 100%;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    background: #f0f0f0;
    padding: 15px;
    border-radius: 10px;
}

.info-item {
    font-weight: bold;
    font-size: 1.1rem;
}

.info-item span:first-child {
    color: #666;
}

.info-item span:last-child {
    color: #333;
}

.difficulty-selector, .theme-selector {
    margin: 15px 0;
    text-align: left;
    display: inline-block;
    margin-right: 20px;
}

label {
    font-weight: bold;
    margin-right: 10px;
    color: #333;
}

select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    background: white;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
    perspective: 1000px;
}

.card {
    aspect-ratio: 1;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    cursor: pointer;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    transform: rotateY(180deg);
    box-shadow: 0 0 15px #4CAF50;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
}

.card-front {
    background: #2196F3;
    color: white;
    transform: rotateY(180deg);
}

.card-back {
    background: #FFC107;
    color: #333;
    border: 2px solid #333;
}

.reset-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.reset-btn:hover {
    background: #45a049;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.result-info, .best-info {
    margin: 15px 0;
    text-align: left;
}

.result-info h3, .best-info h3 {
    color: #333;
    margin-bottom: 10px;
}

.result-info p, .best-info p {
    margin: 5px 0;
    font-size: 1.1rem;
}

.modal-buttons {
    margin-top: 20px;
}

.modal-buttons button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 0 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

.modal-buttons button:hover {
    background: #1976D2;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .difficulty-selector, .theme-selector {
        display: block;
        margin: 10px 0;
    }
    
    .game-board {
        gap: 5px;
    }
    
    .card-front, .card-back {
        font-size: 1.5rem;
    }
}