* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 1200px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: titleBounce 2s ease-in-out infinite;
}

@keyframes titleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Game Controls */
.game-controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #667eea;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

#seed-input {
    padding: 12px 20px;
    border: 2px solid #667eea;
    border-radius: 25px;
    font-size: 1rem;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    transition: all 0.3s;
}

#seed-input:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

button {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

button:active {
    transform: translateY(0);
}

/* Game Board */
.game-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Cards */
.card {
    aspect-ratio: 1;
    perspective: 1000px;
    cursor: pointer;
    animation: cardAppear 0.5s ease-out backwards;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.5) rotateY(180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.5s; }
.card:nth-child(11) { animation-delay: 0.55s; }
.card:nth-child(12) { animation-delay: 0.6s; }
.card:nth-child(13) { animation-delay: 0.65s; }
.card:nth-child(14) { animation-delay: 0.7s; }
.card:nth-child(15) { animation-delay: 0.75s; }
.card:nth-child(16) { animation-delay: 0.8s; }

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner,
.card.matched .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.card-front {
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    border: 3px solid #667eea;
}

.card-logo {
    font-size: 4rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.card-back {
    transform: rotateY(180deg);
    color: white;
    text-align: center;
}

.card-emoji {
    font-size: 3rem;
    margin-bottom: 10px;
}

.card-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.card-role {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.card-quote {
    font-size: 0.85rem;
    font-style: italic;
    opacity: 0.85;
}

.card.matched .card-inner {
    animation: matchSuccess 0.5s ease-out;
}

@keyframes matchSuccess {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    animation: modalSlideIn 0.5s;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #667eea;
}

.victory-stats {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #333;
}

.victory-stats span {
    font-weight: bold;
    color: #667eea;
}

.victory-seed {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 30px;
    word-break: break-all;
}

.victory-seed span {
    font-family: monospace;
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 5px;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Footer */
footer {
    text-align: center;
    color: white;
    margin-top: 30px;
}

footer p {
    margin: 5px 0;
    opacity: 0.9;
}

.tip {
    font-size: 0.9rem;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .game-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .card-emoji {
        font-size: 2rem;
    }

    .card-name {
        font-size: 0.9rem;
    }

    .card-role,
    .card-quote {
        font-size: 0.7rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .card-logo {
        font-size: 2.5rem;
    }
}
