* {
    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;
    color: #333;
}

.game-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 20px;
    max-width: 800px;
    width: 100%;
    text-align: center;
}

h1 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    background: #f7fafc;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    flex-wrap: wrap;
    gap: 10px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.info-item span:first-child {
    color: #718096;
}

.info-item span:last-child {
    color: #2d3748;
    font-weight: bold;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    margin: 20px 0;
    justify-items: center;
}

.card {
    width: 100px;
    height: 100px;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
}

.card-front {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.card-back {
    background: white;
    color: #2d3748;
    border: 2px solid #4facfe;
    transform: rotateY(180deg);
}

.card.matched {
    cursor: default;
}

.card.matched .card-back {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    animation: match 0.6s ease;
}

@keyframes match {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
    100% { transform: rotateY(180deg) scale(1); }
}

.card.hint {
    animation: hint 1s ease;
}

@keyframes hint {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.control-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #4299e1;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

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

.control-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#resetBtn {
    background: #f56565;
}

#hintBtn {
    background: #ed8936;
}

.instructions {
    background: #f7fafc;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
}

.instructions h3 {
    color: #4a5568;
    margin-bottom: 10px;
}

.instructions p {
    color: #718096;
    margin: 5px 0;
    font-size: 0.95rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        margin: 10px;
        padding: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        align-items: center;
    }
    
    .info-item {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .game-board {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 10px;
        padding: 15px;
    }
    
    .card {
        width: 80px;
        height: 80px;
    }
    
    .card-front, .card-back {
        font-size: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 80%;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .game-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 10px;
    }
    
    .card {
        width: 70px;
        height: 70px;
    }
    
    .card-front, .card-back {
        font-size: 1.2rem;
    }
}