/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a56db;
    --primary-dark: #1e429f;
    --success-color: #0e9f6e;
    --danger-color: #f05252;
    --warning-color: #ff8a00;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 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);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* Start Screen */
#startScreen {
    text-align: center;
    padding: 2rem 0;
}

#startScreen h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.info-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    text-align: left;
}

.info-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.info-card ul {
    list-style: none;
}

.info-card li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.info-card li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

.info-text {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-color);
}

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

/* Quiz Screen */
.quiz-header {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.progress-bar {
    height: 8px;
    background-color: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

#timer {
    font-weight: 600;
    color: var(--text-primary);
}

#timer.warning {
    color: var(--danger-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.question-container {
    background: var(--card-bg);
    padding: 2rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    min-height: 400px;
}

.question-text {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.answer-option {
    padding: 1rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 1rem;
}

.answer-option:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.answer-option.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
    font-weight: 500;
}

.answer-option.correct {
    border-color: var(--success-color);
    background: #d1fae5;
}

.answer-option.incorrect {
    border-color: var(--danger-color);
    background: #fee2e2;
}

.quiz-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quiz-controls .btn {
    flex: 1;
}

/* Navigation Dots */
.navigation-dots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.nav-dot {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--bg-color);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-dot:hover {
    border-color: var(--primary-color);
}

.nav-dot.answered {
    background: #eff6ff;
    border-color: var(--primary-color);
}

.nav-dot.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Results Screen */
.results-container {
    text-align: center;
    padding: 2rem 0;
}

#resultTitle {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.score-circle {
    width: 180px;
    height: 180px;
    margin: 0 auto 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-lg);
}

.score-circle.pass {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.score-circle.fail {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.score-number {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}

.score-label {
    font-size: 1rem;
    opacity: 0.9;
}

.result-message {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.result-message.pass {
    border-left: 4px solid var(--success-color);
}

.result-message.fail {
    border-left: 4px solid var(--danger-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

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

.review-container {
    text-align: left;
    margin-bottom: 2rem;
}

.review-question {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.review-question.correct {
    border-left: 4px solid var(--success-color);
}

.review-question.incorrect {
    border-left: 4px solid var(--danger-color);
}

.review-question-text {
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.review-answer {
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    border-radius: 6px;
    font-size: 0.875rem;
}

.review-answer.user-answer {
    background: #fee2e2;
    border-left: 3px solid var(--danger-color);
}

.review-answer.correct-answer {
    background: #d1fae5;
    border-left: 3px solid var(--success-color);
}

.review-answer.both {
    background: #d1fae5;
    border-left: 3px solid var(--success-color);
}

.results-actions {
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 0.5rem;
    }

    #startScreen h1,
    #resultTitle {
        font-size: 1.5rem;
    }

    .question-text {
        font-size: 1.125rem;
    }

    .question-container {
        padding: 1.5rem 1rem;
        min-height: 350px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .score-circle {
        width: 150px;
        height: 150px;
    }

    .score-number {
        font-size: 3rem;
    }

    .navigation-dots {
        grid-template-columns: repeat(6, 1fr);
    }

    .nav-dot {
        width: 100%;
        aspect-ratio: 1;
    }
}

@media (max-width: 400px) {
    .quiz-controls {
        flex-direction: column;
    }

    .navigation-dots {
        grid-template-columns: repeat(4, 1fr);
    }
}
