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

:root {
    --primary-color: #009B77;
    --primary-dark: #007a5e;
    --secondary-color: #64748b;
    --accent-color: #0dcaf0;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #FAF0E6;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #e2e8f0 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}


.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

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


.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}


#splash-screen {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.splash-content {
    text-align: center;
    animation: slideInUp 1s ease-out;
}

.app-title {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 700;
    margin-bottom: 2rem;
    background: linear-gradient(45deg, #ffffff, var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }
    to {
        text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 40px rgba(13, 202, 240, 0.5);
    }
}

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


.splash-loader {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 2rem;
}

.loader-dot {
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}


#start-screen {
    background: var(--background);
}

.app-header {
    text-align: center;
    margin-bottom: 3rem;
}

.app-header .app-title {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 0.5rem;
}

.app-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.start-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: slideInUp 0.8s ease-out 0.2s both;
}

.welcome-text h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.welcome-text p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.start-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}


.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1.125rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    min-width: 200px;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}


.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--background);
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

.instruction {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.instruction-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    flex-shrink: 0;
}

.instruction-text h4 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.instruction-text p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}


.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.quiz-progress {
    flex: 1;
    margin-right: 2rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.5s ease-out;
    width: 0%;
}

.question-counter {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.quiz-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.125rem;
}

.timer {
    background: var(--warning-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    min-width: 60px;
    text-align: center;
    animation: pulse 1s ease-in-out infinite;
}

.timer.warning {
    background: var(--error-color);
    animation: shake 0.5s ease-in-out infinite;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.quiz-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.question-text {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
    line-height: 1.4;
    text-align: center;
}

.options-container {
    display: grid;
    gap: 1rem;
}

.option {
    padding: 1.25rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.3s;
}

.option:hover::before {
    left: 100%;
}

.option:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-2px);
}

.option.selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.option.correct {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    animation: correctAnswer 0.6s ease-out;
}

.option.incorrect {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    animation: incorrectAnswer 0.6s ease-out;
}

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

@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes incorrectAnswer {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}


.feedback-container {
    text-align: center;
    padding: 2rem 0;
}

.feedback-container.hidden {
    display: none;
}

.feedback-message {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--border-radius);
}

.feedback-message.correct {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.feedback-message.incorrect {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}


.results-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.results-header h2 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.score-display {
    margin-bottom: 3rem;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    animation: scaleIn 0.8s ease-out;
}

.score-circle span {
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#score-text {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.results-details {
    text-align: left;
    margin-bottom: 2rem;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.result-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.result-question {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.result-answer {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.result-answer.correct {
    color: var(--success-color);
}

.result-answer.incorrect {
    color: var(--error-color);
}

.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}


.loading-content {
    text-align: center;
    color: var(--text-primary);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 1.125rem;
    color: var(--text-secondary);
}


.error-content {
    text-align: center;
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    box-shadow: var(--shadow);
    max-width: 500px;
    margin: 0 auto;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-content h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}


.app-footer {
    background: var(--background);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    margin-top: auto;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.app-footer p {
    margin: 0.25rem 0;
}


@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .screen {
        padding: 15px;
    }
    
    .start-content {
        padding: 2rem 1.5rem;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .quiz-progress {
        margin-right: 0;
    }
    
    .quiz-timer {
        justify-content: center;
    }
    
    .quiz-content {
        padding: 1.5rem;
    }
    
    .question-text {
        font-size: 1.25rem;
    }
    
    .start-buttons {
        gap: 0.75rem;
    }
    
    .btn {
        min-width: 100%;
        padding: 1rem 1.5rem;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .modal-content {
        margin: 20px;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .instruction {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .instruction-icon {
        align-self: center;
    }
}

@media (max-width: 480px) {
    .app-title {
        font-size: 3rem;
    }
    
    .welcome-text h2 {
        font-size: 1.5rem;
    }
    
    .welcome-text p {
        font-size: 1rem;
    }
    
    .quiz-header {
        padding: 1rem;
    }
    
    .quiz-content {
        padding: 1rem;
    }
    
    .question-text {
        font-size: 1.125rem;
    }
    
    .option {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .results-content {
        padding: 2rem 1rem;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
    }
    
    .score-circle span {
        font-size: 1.5rem;
    }
}


@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


.btn:focus,
.option:focus,
.close-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}


@media (prefers-contrast: high) {
    :root {
        --border: #000000;
        --text-secondary: #000000;
    }
}
