/* 基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 20px;
    max-width: 95vw;
    width: 100%;
    text-align: center;
}

header {
    margin-bottom: 20px;
}

h1 {
    color: #4a5568;
    margin-bottom: 15px;
}

.game-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

button {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #5a6fd8;
}

/* 游戏主面板 */
.game-board {
    display: grid;
    grid-gap: 10px;
    justify-content: center;
    margin: 0 auto;
}

/* 卡片样式 */
.card {
    width: 80px;
    height: 80px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.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: 24px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.card-front {
    background: #764ba2;
    color: white;
}

.card-back {
    background: white;
    transform: rotateY(180deg);
    border: 2px solid #667eea;
}

.card.matched .card-back {
    background: #a3f7bf;
}

/* 模态框（结果弹窗） */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none;
}

/* 响应式设计：平板 */
@media (max-width: 768px) {
    .game-container {
        padding: 15px;
        margin: 10px;
    }

    .card {
        width: 70px;
        height: 70px;
    }

    h1 {
        font-size: 1.5rem;
    }
}

/* 响应式设计：手机 */
@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }

    .card {
        width: 60px;
        height: 60px;
    }

    .game-info {
        flex-direction: column;
        gap: 5px;
    }

    h1 {
        font-size: 1.3rem;
    }

    button {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}