* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f4f4f4;
    color: #333;
}

.header {
    background-color: #003366;
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    width: 40px;
    height: 40px;
    background-color: white;
    color: #003366;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.container {
    max-width: 900px;
    margin: 40px auto;
    padding: 30px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-section h2 {
    color: #003366;
    font-size: 28px;
    margin-bottom: 10px;
}

.welcome-section p {
    color: #666;
    font-size: 16px;
}

.year-selector, .paper-selector, .mode-selector {
    margin-bottom: 30px;
}

.year-selector h3, .paper-selector h3, .mode-selector h3 {
    color: #003366;
    margin-bottom: 15px;
    font-size: 18px;
}

.mode-buttons {
    display: flex;
    gap: 20px;
}

.mode-btn {
    flex: 1;
    padding: 15px;
    font-size: 18px;
    border: 2px solid #003366;
    border-radius: 6px;
    background-color: white;
    color: #003366;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background-color: #003366;
    color: white;
}

.mode-btn.selected {
    background-color: #003366;
    color: white;
}

.year-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.year-btn, .paper-btn {
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #003366;
    border-radius: 6px;
    background-color: white;
    color: #003366;
    cursor: pointer;
    transition: all 0.3s ease;
}

.year-btn:hover, .paper-btn:hover {
    background-color: #003366;
    color: white;
}

.year-btn.selected, .paper-btn.selected {
    background-color: #003366;
    color: white;
}

.paper-buttons {
    display: flex;
    gap: 20px;
}

.paper-btn {
    flex: 1;
    padding: 15px;
    font-size: 18px;
}

.start-btn {
    width: 100%;
    padding: 18px;
    font-size: 20px;
    font-weight: 600;
    background-color: #003366;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}

.start-btn:hover:not(:disabled) {
    background-color: #002244;
}

.start-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.exam-header {
    background-color: #003366;
    color: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.exam-info {
    display: flex;
    gap: 20px;
    font-size: 18px;
}

.timer {
    font-size: 24px;
    font-weight: bold;
    background-color: #ff6b35;
    padding: 8px 20px;
    border-radius: 4px;
}

.timer.warning {
    background-color: #ffcc00;
    color: #003366;
}

.timer.danger {
    background-color: #ff0000;
}

.exam-content {
    display: flex;
    gap: 30px;
    padding: 25px;
}

.question-nav {
    width: 200px;
    flex-shrink: 0;
}

.question-nav h3 {
    color: #003366;
    margin-bottom: 15px;
    font-size: 16px;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.nav-btn-item {
    width: 35px;
    height: 35px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn-item:hover {
    border-color: #003366;
}

.nav-btn-item.current {
    background-color: #003366;
    color: white;
}

.nav-btn-item.answered {
    background-color: #4caf50;
    color: white;
    border-color: #4caf50;
}

.question-area {
    flex: 1;
    background-color: #fafafa;
    padding: 25px;
    border-radius: 8px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #003366;
}

.question-number {
    font-size: 24px;
    font-weight: bold;
    color: #003366;
}

.question-progress {
    color: #666;
    font-size: 14px;
}

.question-content {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 25px;
    color: #333;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    background-color: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-item:hover {
    border-color: #003366;
}

.option-item.selected {
    border-color: #003366;
    background-color: #e6f0ff;
}

.option-item.correct {
    border-color: #4caf50;
    background-color: #e8f5e9;
}

.option-item.incorrect {
    border-color: #f44336;
    background-color: #ffebee;
}

.option-label {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #003366;
    color: white;
    border-radius: 50%;
    margin-right: 15px;
    font-weight: bold;
}

.option-text {
    flex: 1;
    font-size: 16px;
    padding-top: 4px;
}

.question-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.nav-btn {
    padding: 12px 30px;
    font-size: 16px;
    background-color: white;
    border: 2px solid #003366;
    color: #003366;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background-color: #003366;
    color: white;
}

.nav-btn:disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
}

.nav-btn:disabled:hover {
    background-color: white;
    color: #ccc;
}

.submit-btn {
    padding: 12px 40px;
    font-size: 16px;
    background-color: #ff6b35;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.submit-btn:hover {
    background-color: #e55a2b;
}

.result-header {
    text-align: center;
    margin-bottom: 30px;
}

.result-header h2 {
    font-size: 32px;
    color: #003366;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.stat-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 32px;
    font-weight: bold;
    color: #003366;
}

.answer-review {
    margin-bottom: 30px;
}

.review-item {
    padding: 20px;
    margin-bottom: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.review-item h4 {
    margin-bottom: 10px;
    color: #003366;
}

.review-item p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.review-correct {
    color: #4caf50;
    font-weight: bold;
}

.review-incorrect {
    color: #f44336;
    font-weight: bold;
}

.review-answer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

@media (max-width: 900px) {
    .exam-content {
        flex-direction: column;
    }
    
    .question-nav {
        width: 100%;
    }
    
    .nav-grid {
        grid-template-columns: repeat(10, 1fr);
    }
    
    .year-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .result-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.pdf-viewer-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    max-height: 600px;
    overflow: auto;
    display: flex;
    justify-content: center;
}

.pdf-viewer-section canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#page-indicator {
    min-width: 100px;
    text-align: center;
    font-size: 16px;
    padding: 8px 16px;
    background-color: #003366;
    color: white;
    border-radius: 4px;
}

.answer-section {
    background-color: #fafafa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.answer-section h4 {
    color: #003366;
    margin-bottom: 15px;
    font-size: 18px;
}

.answer-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.answer-option {
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #003366;
    border-radius: 6px;
    background-color: white;
    color: #003366;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.answer-option:hover {
    background-color: #003366;
    color: white;
}

.answer-option.selected {
    background-color: #4caf50;
    color: white;
    border-color: #4caf50;
}

.timer-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #ddd;
}

.timer-display {
    font-size: 28px;
    font-weight: bold;
    color: #ff6b35;
    text-align: center;
    margin-bottom: 10px;
}

.timer-display.warning {
    color: #ffcc00;
}

.timer-display.danger {
    color: #ff0000;
}

.timer-btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    background-color: #666;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.timer-btn:hover {
    background-color: #444;
}

#pdf-canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pdf-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#page-info {
    min-width: 80px;
    text-align: center;
    font-size: 16px;
}

.pdf-actions {
    padding: 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.pdf-actions .submit-btn,
.pdf-actions .start-btn {
    flex: 0 0 auto;
    padding: 12px 40px;
}

.error-message {
    background-color: #ffebee;
    border: 2px solid #f44336;
    color: #c62828;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
}

.error-message p {
    margin: 10px 0;
    font-size: 16px;
}

.pdf-container {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.retry-btn {
    padding: 10px 24px;
    font-size: 14px;
    background-color: #003366;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 15px;
    transition: background-color 0.2s ease;
}

.retry-btn:hover {
    background-color: #002244;
}