* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #333;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.stat span:last-child {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.restart-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.restart-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.card {
    aspect-ratio: 1;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    perspective: 1000px;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: scale(1.05);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    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: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card-back {
    background: white;
    color: #333;
    transform: rotateY(180deg);
    border: 2px solid #e0e0e0;
}

.card-back.organelle {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.card-back.function {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    height: 100%;
    justify-content: center;
}

.organelle-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.card-description {
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.3;
    opacity: 0.8;
}

.card.matched {
    opacity: 0.7;
    transform: scale(0.95);
    pointer-events: none;
}

.card.matched .card-back {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
}

.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: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2rem;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    margin: 15px 0;
    outline: none;
    transition: border-color 0.3s ease;
}

.modal-content input:focus {
    border-color: #667eea;
}

.start-game-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.start-game-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.start-game-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.qr-container {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.qr-container p {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

#qr-code {
    border: 2px solid #ddd;
    border-radius: 8px;
}

.victory-stats {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 1.1rem;
}

.play-again-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.play-again-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .game-board {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .game-stats {
        gap: 20px;
    }
    
    .card-title {
        font-size: 0.9rem;
    }
    
    .card-description {
        font-size: 0.8rem;
    }
}