* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 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: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
}

.info-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-box .label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.info-box .value {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

.game-board {
    display: grid;
    gap: 10px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 15px;
    margin-bottom: 25px;
    min-height: 400px;
    justify-items: center;
    align-items: center;
}

.card {
    width: 100%;
    height: 100%;
    min-width: 80px;
    min-height: 100px;
    max-width: 120px;
    max-height: 150px;
    position: relative;
    cursor: pointer;
    perspective: 1000px;
    transition: transform 0.2s;
}

.card:hover:not(.flipped):not(.matched) {
    transform: scale(1.05);
}

.card.flipped .card-front {
    transform: rotateY(180deg);
}

.card.flipped .card-back {
    transform: rotateY(0deg);
}

.card.matched {
    opacity: 0.6;
    cursor: default;
}

.card.matched .card-back {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    font-weight: bold;
    transition: transform 0.6s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: rotateY(0deg);
}

.card-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    transform: rotateY(180deg);
}

.game-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.game-status {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: bold;
    display: none;
}

.game-status.success {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #2d5016;
}

.game-status.error {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #8b0000;
}

.game-status.info {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.leaderboard {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.leaderboard h3 {
    margin-bottom: 12px;
    color: #333;
}

.leaderboard ol {
    list-style-position: inside;
    color: #333;
    line-height: 1.8;
}

.leaderboard li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed #ddd;
}

.leaderboard li:last-child {
    border-bottom: none;
}

.leaderboard li .time {
    color: #667eea;
    font-weight: bold;
}

.leaderboard li.empty {
    justify-content: center;
    color: #888;
    border-bottom: none;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .game-header {
        grid-template-columns: repeat(2, 1fr);
        padding: 15px;
    }
    
    .card {
        min-width: 60px;
        min-height: 80px;
        max-width: 90px;
        max-height: 110px;
    }
    
    .card-front,
    .card-back {
        font-size: 1.5em;
    }
    
    .game-controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}
