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

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

header p {
    opacity: 0.9;
    font-size: 1rem;
}

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

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

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

/* License Selection */
.license-selection, .mode-selection {
    margin-bottom: 40px;
}

.license-selection h2, .mode-selection h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text);
}

.license-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.license-btn {
    padding: 20px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

/* Mode Selection */
.mode-grid {
    display: grid;
    gap: 16px;
}

.mode-btn {
    padding: 24px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.mode-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.mode-btn .icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 12px;
}

.mode-btn h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text);
}

.mode-btn p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Progress Bar */
.progress-bar {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.progress-fill {
    height: 8px;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
    margin-bottom: 8px;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Question Card */
.question-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.question-number {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.question-category {
    font-size: 0.85rem;
    color: var(--text-light);
}

.question-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 24px;
    color: var(--text);
}

.question-image {
    margin-bottom: 24px;
}

.question-image img {
    max-width: 100%;
    border-radius: 8px;
}

/* Options */
.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.option {
    padding: 16px 20px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.option:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

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

.option.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.option.incorrect {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.option-label {
    font-weight: 700;
    margin-right: 12px;
    color: var(--primary);
}

.option.correct .option-label {
    color: var(--success);
}

.option.incorrect .option-label {
    color: var(--danger);
}

/* Explanation */
.explanation {
    padding: 16px;
    background: rgba(37, 99, 235, 0.05);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    display: none;
}

.explanation.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

.explanation h4 {
    margin-bottom: 8px;
    color: var(--primary);
}

/* Navigation */
.navigation {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.nav-btn {
    flex: 1;
    padding: 14px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

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

/* Buttons */
.back-btn, .submit-btn, .action-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.back-btn:hover {
    border-color: var(--text-light);
}

.submit-btn {
    background: var(--success);
    color: white;
    margin-bottom: 16px;
}

.submit-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.action-btn {
    background: var(--primary);
    color: white;
    margin-bottom: 12px;
}

.action-btn:hover {
    background: var(--primary-dark);
}

/* Exam Header */
.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.timer {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.timer.warning {
    color: var(--warning);
}

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

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

.exam-progress {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* Result Card */
.result-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.result-status {
    font-size: 3rem;
    margin-bottom: 16px;
}

.result-score {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.result-score.pass {
    color: var(--success);
}

.result-score.fail {
    color: var(--danger);
}

.result-time {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 24px;
}

.result-details {
    text-align: left;
    padding-top: 24px;
    border-top: 2px solid var(--border);
}

.result-details h3 {
    margin-bottom: 12px;
}

.wrong-answer {
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

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

    header h1 {
        font-size: 1.5rem;
    }

    .license-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

    .navigation {
        flex-direction: column;
    }
}
