:root {
    --primary-color: #c41e3a;
    --secondary-color: #ffd700;
    --background-color: #f8f8f8;
    --card-color: #fff;
    --text-color: #333;
}

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

body {
    font-family: "Microsoft YaHei", "STHeiti", sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0.1rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 0.3rem;
}

h1, h2 {
    color: var(--primary-color);
    margin: 0.1rem 0;
    line-height: 1;
}

h2 {
    font-size: 1.3rem;
    color: #666;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 0.5rem 0;
    font-size: 1.2rem;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.card {
    aspect-ratio: 1;
    background: var(--card-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
    position: relative;
    transform-style: preserve-3d;
}

.card:hover {
    transform: scale(1.05);
}

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

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-color), #ff4d4d);
    color: var(--card-color);
}

.card-back {
    background: linear-gradient(135deg, var(--secondary-color), #ffc107);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.card-year {
    font-size: 1.5rem;
    font-weight: bold;
}

.card-animal {
    font-size: 3rem;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #a01830;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-color);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
}

.game-rules {
    max-width: 800px;
    margin: 1rem auto;
    padding: 1rem 1.5rem;
    background: linear-gradient(to right, rgba(255,255,255,0.95), rgba(255,255,255,0.98));
    border-radius: 8px;
    border: 1px solid rgba(196, 30, 58, 0.1);
}

.game-rules h3 {
    color: var(--primary-color);
    text-align: left;
    margin-bottom: 0.6rem;
    font-size: 1rem;
    position: relative;
    display: block;
    padding: 0 1rem;
}

.rules-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    font-size: 0.85rem;
}

.rule-section h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    border-bottom: 2px solid rgba(196, 30, 58, 0.1);
    padding-bottom: 0.3rem;
    text-align: left;
}

.rule-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.rule-section li {
    margin-bottom: 0.4rem;
    padding-left: 1.2rem;
    position: relative;
    line-height: 1.3;
    text-align: left;
}

.rule-section li::before {
    content: "•";
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

@media (max-width: 768px) {
    .game-container {
        padding: 0.3rem 0.8rem;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 0.3rem;
        font-size: 1.1rem;
    }
    
    .game-board {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .card-animal {
        font-size: 2.5rem;
    }
    .card-year {
        font-size: 1.2rem;
    }
    
    .rules-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        font-size: 0.9rem;
    }
    
    .game-rules {
        margin: 0.8rem auto;
        padding: 0.8rem 1rem;
    }
    
    .game-rules h3 {
        font-size: 1.1rem;
        margin-bottom: 0.6rem;
    }
    
    .rule-section h4 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .card-animal {
        font-size: 2rem;
    }
    .card-year {
        font-size: 1rem;
    }
    
    .rules-content {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .rule-section li {
        margin-bottom: 0.3rem;
    }
}
