* {
    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;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.game-header {
    margin-bottom: 30px;
}

.back-link {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    font-size: 16px;
    margin-bottom: 15px;
    transition: color 0.3s;
}

.back-link:hover {
    color: #5568d3;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 0;
    font-size: 2.5em;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    text-align: center;
}

/* Settings Panel */
.settings-panel {
    max-width: 500px;
    margin: 0 auto;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.setting-group select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.setting-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn-start,
.btn-submit,
.btn-restart,
.btn-new-quiz,
.btn-back-settings {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-start {
    background: #667eea;
    color: white;
}

.btn-start:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-submit {
    background: #48bb78;
    color: white;
}

.btn-submit:hover {
    background: #38a169;
}

.btn-new-quiz {
    background: #f59e0b;
    color: white;
}

.btn-new-quiz:hover {
    background: #d97706;
}

.btn-back-settings,
.btn-restart {
    background: #667eea;
    color: white;
}

.btn-back-settings:hover,
.btn-restart:hover {
    background: #5568d3;
}

.quiz-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button-row {
    display: flex;
    gap: 10px;
}

.button-row button {
    flex: 1;
}

/* Quiz Panel */
.quiz-panel {
    animation: fadeIn 0.5s;
}

.quiz-header {
    margin-bottom: 25px;
}

.score-display {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #667eea;
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
}

.questions-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.question-card {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
}

.question-card.correct {
    background: #c6f6d5;
    border-color: #48bb78;
}

.question-card.incorrect {
    background: #fed7d7;
    border-color: #f56565;
}

.question-number {
    font-size: 12px;
    color: #718096;
    font-weight: 600;
    margin-bottom: 10px;
}

.question-text {
    font-size: 20px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
    text-align: center;
}

.answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.answer-btn {
    padding: 10px;
    border: 2px solid #cbd5e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.answer-btn:hover {
    background: #edf2f7;
    border-color: #667eea;
}

.answer-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.answer-btn.correct-answer {
    background: #48bb78;
    color: white;
    border-color: #48bb78;
}

.answer-btn.wrong-answer {
    background: #f56565;
    color: white;
    border-color: #f56565;
}

.answer-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.correct-solution {
    margin-top: 10px;
    padding: 8px;
    background: #bee3f8;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    color: #2c5282;
    font-weight: 600;
}

/* Results Panel */
.results-panel {
    text-align: center;
    animation: fadeIn 0.5s;
}

.results-score {
    margin: 30px 0;
}

.results-score p {
    font-size: 24px;
    margin: 15px 0;
    color: #2d3748;
}

.percentage {
    font-size: 48px;
    font-weight: 700;
    color: #667eea;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Congratulations Overlay */
.congrats-overlay {
    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;
    animation: fadeIn 0.5s;
}

.congrats-overlay.hidden {
    display: none !important;
}

.congrats-content {
    background: white;
    padding: 60px 80px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: bounceIn 0.6s;
}

.congrats-content h2 {
    font-size: 3em;
    color: #667eea;
    margin-bottom: 20px;
    animation: pulse 1s infinite;
}

.congrats-content p {
    font-size: 1.5em;
    color: #555;
}

/* Fireworks Container */
.fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: explode 1s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes explode {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .questions-container {
        grid-template-columns: 1fr;
    }

    .question-text {
        font-size: 18px;
    }

    .footer {
        font-size: 0.9em;
    }
}
