/* Reset and Base Styles */
* {
    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;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: block;
}

/* Avatar Selection Screen */
#avatar-selection {
    text-align: center;
}

#avatar-selection h1 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 40px;
    opacity: 0.9;
}

.avatar-options {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.avatar-card {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    width: 250px;
}

.avatar-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

.avatar-preview {
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 5px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.avatar-placeholder {
    font-size: 80px;
    display: block;
}

.avatar-preview img.active {
    display: block;
}

.avatar-preview .avatar-placeholder {
    display: none;
}

.avatar-card h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.select-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: bold;
}

.select-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.select-btn:active {
    transform: scale(0.98);
}

/* Game Screen */
#game-screen {
    text-align: center;
}

.avatar-display {
    margin-bottom: 20px;
}

.avatar-display img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    animation: wave 2s ease-in-out infinite;
    display: none;
}

.avatar-display img.active {
    display: inline-block;
}

.avatar-placeholder-display {
    font-size: 60px;
    display: inline-block;
    animation: wave 2s ease-in-out infinite;
}

.avatar-display img.active ~ .avatar-placeholder-display,
.avatar-display img.active + .avatar-placeholder-display {
    display: none;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
}

.avatar-display img.correct {
    animation: celebrate 0.5s ease-in-out;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(15deg); }
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px 25px;
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.score-display {
    font-size: 1.3rem;
    font-weight: bold;
    color: #667eea;
}

.score-label {
    margin-right: 10px;
}

.timer-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.timer-bar-container {
    width: 200px;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
    width: 100%;
    transition: width 0.1s linear, background 0.3s ease;
    border-radius: 5px;
}

.timer-bar.warning {
    background: linear-gradient(90deg, #FF9800 0%, #FFC107 100%);
}

.timer-bar.danger {
    background: linear-gradient(90deg, #f44336 0%, #FF5722 100%);
}

#timer-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    min-width: 40px;
}

/* Question Card */
.question-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.question-number {
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.question-text {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 30px;
    line-height: 1.6;
}

.answers-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 30px;
}

.answer-btn {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border: 3px solid transparent;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #333;
    font-weight: 500;
}

.answer-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border-color: #667eea;
}

.answer-btn:active {
    transform: translateY(0);
}

.answer-btn.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
    color: #fff;
    border-color: #4CAF50;
    animation: pulse 0.5s ease;
}

.answer-btn.wrong {
    background: linear-gradient(135deg, #f44336 0%, #FF5722 100%);
    color: #fff;
    border-color: #f44336;
}

.answer-btn.disabled {
    pointer-events: none;
    opacity: 0.7;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.option-label {
    font-weight: bold;
    font-size: 1.3rem;
    min-width: 30px;
}

.option-text {
    flex: 1;
}

/* Feedback Message */
.feedback-message {
    margin-top: 20px;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    display: none;
    animation: fadeIn 0.3s ease;
}

.feedback-message.show {
    display: inline-block;
}

.feedback-message.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
    color: #fff;
}

.feedback-message.wrong {
    background: linear-gradient(135deg, #f44336 0%, #FF5722 100%);
    color: #fff;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Shake Animation for Wrong Answer */
.question-card.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Results Screen */
#results-screen {
    text-align: center;
}

.results-card {
    background: #fff;
    border-radius: 20px;
    padding: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.results-card h1 {
    color: #667eea;
    font-size: 2.5rem;
    margin-bottom: 30px;
}

.final-score {
    margin-bottom: 30px;
}

.score-text {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 10px;
}

.score-text span {
    color: #667eea;
    font-weight: bold;
    font-size: 2rem;
}

.score-message {
    font-size: 1.3rem;
    color: #666;
    margin-bottom: 20px;
}

.motivational-message {
    font-size: 1.4rem;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    font-weight: bold;
}

.motivational-message.practice {
    background: linear-gradient(135deg, #FF9800 0%, #FFC107 100%);
    color: #fff;
}

.motivational-message.good {
    background: linear-gradient(135deg, #2196F3 0%, #03A9F4 100%);
    color: #fff;
}

.motivational-message.excellent {
    background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
    color: #fff;
}

.play-again-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: bold;
}

.play-again-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.play-again-btn:active {
    transform: scale(0.98);
}

/* Confetti Animation */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f44336;
    position: absolute;
    animation: confetti-fall 3s ease-out forwards;
}

.confetti:nth-child(2n) { background: #4CAF50; }
.confetti:nth-child(3n) { background: #2196F3; }
.confetti:nth-child(4n) { background: #FF9800; }
.confetti:nth-child(5n) { background: #9C27B0; }

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    #avatar-selection h1 {
        font-size: 2rem;
    }

    .avatar-options {
        flex-direction: column;
        align-items: center;
    }

    .avatar-card {
        width: 100%;
        max-width: 300px;
    }

    .answers-container {
        grid-template-columns: 1fr;
    }

    .question-text {
        font-size: 1.4rem;
    }

    .game-header {
        flex-direction: column;
        gap: 15px;
    }

    .timer-bar-container {
        width: 150px;
    }
}




