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

body {
    font-family: 'Nunito', 'Segoe UI', 'Trebuchet MS', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    min-height: 600px;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2em;
    font-weight: 600;
}

.screen {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

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

h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    padding: 10px 8px 20px;
}

@media (max-width: 700px) {
    .exam-grid {
        max-height: 60vh;
        overflow-y: auto;
    }
}

.home-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.home-actions .nav-button {
    min-width: 200px;
    padding: 12px 20px;
    font-size: 0.95em;
}

.exam-button {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 36px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 190px;
}

.exam-button:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.exam-button .icon {
    font-size: 3.6em;
    line-height: 1;
    margin-bottom: 8px;
}

.exam-button .label {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.test-setup {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.test-setup-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.test-setup-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.test-setup-controls {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.test-setup-controls label {
    font-size: 0.95em;
    font-weight: 500;
    color: #555;
}

.test-setup-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
}

.test-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 10px 5px 20px;
}

.test-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.test-card.selectable {
    cursor: pointer;
}

.test-card.selectable:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.test-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #ffffff 0%, #f0f3ff 100%);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
    transform: translateY(-2px);
}

.test-card.selected::before {
    content: "✓";
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.test-card {
    position: relative;
}

.test-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.test-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
}

.test-question-count {
    font-size: 0.9em;
    color: #666;
    background: #f5f5f5;
    padding: 5px 10px;
    border-radius: 6px;
    display: inline-block;
    align-self: flex-start;
}

.test-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.test-controls label {
    font-size: 0.9em;
    color: #555;
}

.timer-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #555;
}

.timer-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.timer-toggle input:disabled + span {
    color: #bbb;
}

.timer-duration-value {
    font-weight: 600;
    color: #333;
}

.timer-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.question-count-selector {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.question-count-selector:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.start-test-button {
    align-self: flex-start;
    padding: 14px 32px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.start-test-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.start-test-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.start-test-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    background: #999;
}

.test-button {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 1.1em;
}

.test-button:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.back-button {
    background: none;
    border: none;
    color: #667eea;
    font-size: 1em;
    cursor: pointer;
    padding: 10px;
    margin-bottom: 20px;
    font-weight: 500;
}

.back-button:hover {
    text-decoration: underline;
}

.test-header {
    margin-bottom: 30px;
    position: relative;
}

.progress-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}

.progress {
    flex: 1;
}

#question-counter {
    display: block;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    width: 2%;
}

.test-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.passage-container {
    background: white;
    border-radius: 15px;
    padding: 0;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    max-height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.passage-container h3 {
    color: #667eea;
    margin: 0;
    padding: 20px 25px;
    font-size: 1.2em;
    border-bottom: 2px solid #f0f0f0;
    background: #fafbff;
    border-radius: 15px 15px 0 0;
}

.passage-text {
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    font-size: 1em;
    padding: 25px;
    overflow-y: scroll;
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.passage-line {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-family: 'Nunito', 'Segoe UI', 'Trebuchet MS', 'Helvetica Neue', Arial, sans-serif;
}

.passage-line .line-number {
    color: #999;
    font-weight: 600;
    min-width: 32px;
    text-align: right;
    font-size: 0.9em;
}

.passage-line .line-text {
    flex: 1;
}

.passage-line.empty .line-number {
    visibility: hidden;
}

.passage-text.has-image {
    padding: 0;
    background: #fafafa;
}

.passage-text.has-image img.passage-image {
    width: 100%;
    height: auto;
    border-radius: 0 0 15px 15px;
    display: block;
}

/* Custom scrollbar styling */
.passage-text::-webkit-scrollbar {
    width: 10px;
}

.passage-text::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.passage-text::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.passage-text::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5568d3 0%, #65408b 100%);
}

/* Firefox scrollbar */
.passage-text {
    scrollbar-width: thin;
    scrollbar-color: #667eea #f1f1f1;
}

.question-container {
    flex: 1;
    background: #f8f9ff;
    border-radius: 15px;
    padding: 30px;
    min-height: 400px;
}

.question-number {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 20px;
}

.question-instruction {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    padding: 15px 20px;
    margin-bottom: 20px;
    font-size: 0.95em;
    color: #555;
    line-height: 1.5;
    font-style: italic;
}

.alphabet-reference {
    background: #fff8e1;
    border: 2px solid #ffa726;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    text-align: center;
}

.alphabet-label {
    font-size: 0.9em;
    color: #f57c00;
    font-weight: 600;
    margin-bottom: 8px;
}

.alphabet-letters {
    font-size: 1.1em;
    color: #333;
    letter-spacing: 0.3em;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.question-text {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Question time indicator in review mode */
.question-time-indicator {
    background: #e0e7ff;
    border-left: 4px solid #667eea;
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 500;
    color: #4338ca;
}

.question-image {
    margin: 0 0 20px 0;
    text-align: center;
    display: none;
}

.question-image img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.option {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.option:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.option.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.option.focused {
    border-color: #3b82f6;
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.option.correct {
    border-color: #10b981;
    background: #10b981;
    color: white;
}

.option.incorrect {
    border-color: #ef4444;
    background: #ef4444;
    color: white;
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #f0f0f0;
    font-weight: 600;
    flex-shrink: 0;
}

.option.selected .option-letter {
    background: white;
    color: #667eea;
}

.option.correct .option-letter {
    background: white;
    color: #10b981;
}

.option.incorrect .option-letter {
    background: white;
    color: #ef4444;
}

.navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.timer-display {
    margin-left: auto;
    text-align: right;
    font-weight: 600;
    color: #333;
    min-width: 160px;
    display: none;
    flex-direction: column;
    gap: 4px;
}

.timer-display span {
    display: inline-block;
}

.timer-display.timer-negative #timer-value {
    color: #e53935;
}

/* Timer Warning Levels */
.timer-display.timer-normal {
    color: #10b981;
}

.timer-display.timer-normal #timer-value {
    color: #10b981;
}

.timer-display.timer-warning {
    color: #f59e0b;
}

.timer-display.timer-warning #timer-value {
    color: #f59e0b;
}

.timer-display.timer-critical {
    color: #ef4444;
    animation: pulse 1s infinite;
}

.timer-display.timer-critical #timer-value {
    color: #ef4444;
}

.timer-display.timer-expired {
    color: #dc2626;
}

.timer-display.timer-expired #timer-value {
    color: #dc2626;
}

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

.time-summary {
    margin-top: 10px;
    font-weight: 500;
    color: #333;
}

.nav-button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 30px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-button:hover {
    background: #f8f9ff;
}

.nav-button.primary {
    background: #667eea;
    color: white;
}

.nav-button.primary:hover {
    background: #5568d3;
}

.nav-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f0f0f0 !important;
    color: #999 !important;
    border-color: #ddd !important;
}

/* Debug Panel */
.debug-panel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 200px;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
    padding: 20px;
    overflow-y: auto;
    z-index: 1000;
    transition: width 0.3s ease, padding 0.3s ease;
}

.debug-panel.collapsed {
    width: 40px;
    padding: 10px 5px;
}

.debug-panel-toggle {
    position: absolute;
    top: 10px;
    right: 5px;
    width: 30px;
    height: 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s ease;
}

.debug-panel-toggle:hover {
    background: #5568d3;
}

.debug-panel.collapsed .debug-panel-toggle {
    right: 50%;
    transform: translateX(50%);
}

.debug-panel.collapsed h3,
.debug-panel.collapsed .debug-question-list {
    display: none;
}

.debug-panel h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 10px;
}

.debug-question-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.debug-question-list li {
    padding: 10px;
    margin-bottom: 5px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-question-list li:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.debug-question-list li.current {
    background: #4CAF50;
    color: white;
    font-weight: bold;
    border-color: #4CAF50;
}

.debug-question-list .q-num {
    font-weight: 600;
}

#test-screen.debug-mode {
    padding-left: 220px;
    transition: padding-left 0.3s ease;
}

#test-screen.debug-mode.collapsed {
    padding-left: 60px;
}

.results-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin: 40px 0;
}

.score-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

#score-percentage {
    font-size: 3em;
    font-weight: 700;
}

.score-label {
    font-size: 1.2em;
    opacity: 0.9;
}

.score-details {
    text-align: center;
    font-size: 1.2em;
    color: #333;
}

.score-details p {
    margin: 10px 0;
}

.results-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* Time Summary Enhancements */
.time-summary-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.time-summary-main {
    font-size: 1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.time-summary-efficiency {
    font-size: 0.9em;
    color: #666;
}

.time-early {
    color: #10b981;
}

.time-ontime {
    color: #3b82f6;
}

.time-late {
    color: #f59e0b;
}

.time-expired {
    color: #ef4444;
}

/* Time Insights and Performance Comparison */
.time-insights,
.performance-comparison {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
    margin: 25px 0;
}

.time-insights h3,
.performance-comparison h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #667eea;
}

.insight-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 6px;
    font-weight: 500;
}

.insight-section {
    margin: 15px 0;
}

.insight-section ul {
    list-style: none;
    padding-left: 0;
    margin-top: 8px;
}

.insight-section li {
    padding: 6px 0;
    border-bottom: 1px solid #e5e7eb;
}

.insight-section li:last-child {
    border-bottom: none;
}

.comparison-grid {
    display: grid;
    gap: 15px;
    margin-top: 15px;
}

.comparison-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

.comparison-item.improvement {
    border-color: #10b981;
    background: #f0fdf4;
}

.comparison-item.decline {
    border-color: #ef4444;
    background: #fef2f2;
}

.comparison-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.comparison-value {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.comparison-value .delta {
    font-size: 0.9em;
    font-weight: 500;
    color: #666;
    margin-left: 8px;
}

/* Resume Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-in;
}

/* Question Detail Modal - Higher z-index to appear above other modals */
#question-detail-modal {
    z-index: 1100;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.modal-content h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.modal-content p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Category Breakdown Modal */
.breakdown-modal {
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    text-align: left;
}

.modal-close {
    position: sticky;
    top: 10px;
    margin-left: auto;
    right: 20px;
    background: none;
    border: none;
    font-size: 2em;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 5;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.breakdown-content {
    margin-top: 20px;
}

.category-item {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
    transition: all 0.3s ease;
}

.category-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.category-name {
    font-weight: 600;
    color: #333;
    font-size: 1.05em;
}

.category-score {
    font-weight: 700;
    font-size: 1.1em;
}

.category-score.excellent {
    color: #4CAF50;
}

.category-score.good {
    color: #8BC34A;
}

.category-score.average {
    color: #FFC107;
}

.category-score.poor {
    color: #FF5722;
}

.category-details {
    font-size: 0.9em;
    color: #666;
}

.category-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.category-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    border-radius: 4px;
}

.category-bar-fill.excellent {
    background: linear-gradient(90deg, #4CAF50 0%, #66BB6A 100%);
}

.category-bar-fill.good {
    background: linear-gradient(90deg, #8BC34A 0%, #9CCC65 100%);
}

.category-bar-fill.average {
    background: linear-gradient(90deg, #FFC107 0%, #FFD54F 100%);
}

.category-bar-fill.poor {
    background: linear-gradient(90deg, #FF5722 0%, #FF7043 100%);
}

/* Question Detail Modal */
.question-detail-modal {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.question-detail-header {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.question-detail-instruction {
    background: #fff3e0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-style: italic;
    color: #e65100;
    border-left: 4px solid #ff9800;
}

.question-detail-image {
    margin: 20px 0;
    text-align: center;
}

.question-detail-image img {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.question-detail-text {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.question-detail-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-detail-option {
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    background: white;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.question-detail-option.user-incorrect {
    background: #ffebee;
    border-color: #f44336;
}

.question-detail-option.correct {
    background: #e8f5e9;
    border-color: #4CAF50;
}

.question-detail-option-letter {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1em;
    flex-shrink: 0;
}

.question-detail-option.user-incorrect .question-detail-option-letter {
    background: #f44336;
    color: white;
}

.question-detail-option.correct .question-detail-option-letter {
    background: #4CAF50;
    color: white;
}

.question-detail-option-text {
    flex: 1;
    font-size: 1em;
    color: #333;
}

.question-detail-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    font-weight: 600;
    margin-top: 10px;
}

.question-detail-label.incorrect {
    color: #f44336;
}

.question-detail-label.correct {
    color: #4CAF50;
}

/* Mistakes Review Modal */
.mistakes-modal {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

.mistakes-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.mistakes-stats {
    flex: 1;
    min-width: 200px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
    text-align: center;
}

.mistakes-stats-value {
    font-size: 2em;
    font-weight: 700;
    display: block;
}

.mistakes-stats-label {
    font-size: 0.9em;
    opacity: 0.9;
}

.mistakes-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mistakes-group,
.mistakes-category {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 0;
    background: #fff;
    overflow: hidden;
}

.mistakes-category {
    border-color: #e6e0f0;
}

.mistakes-group-summary,
.mistakes-category-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
}

.mistakes-group-summary::-webkit-details-marker,
.mistakes-category-summary::-webkit-details-marker {
    display: none;
}

.mistakes-group-summary {
    background: #f5f7ff;
}

.mistakes-category-summary {
    background: #faf7ff;
}

.mistakes-group-title {
    font-weight: 700;
    color: #2d3a8c;
    font-size: 1.05em;
}

.mistakes-category-title {
    font-weight: 600;
    color: #4a2c7c;
}

.mistakes-group-count,
.mistakes-category-count {
    background: #667eea;
    color: #fff;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.85em;
    font-weight: 700;
}

.mistakes-category-count {
    background: #8c6fff;
}

.mistakes-group-content,
.mistakes-category-content {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mistake-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.mistake-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.mistake-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
}

.mistake-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mistake-badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
}

.mistake-badge.subject {
    background: #e3f2fd;
    color: #1976d2;
}

.mistake-badge.category {
    background: #f3e5f5;
    color: #7b1fa2;
}

.mistake-badge.date {
    background: #fff3e0;
    color: #e65100;
}

.mistake-question {
    font-size: 1.05em;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.5;
}

.mistake-answers {
    display: grid;
    gap: 10px;
}

.mistake-answer-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.95em;
}

.mistake-answer-row.correct {
    background: #e8f5e9;
    border-left: 4px solid #4CAF50;
}

.mistake-answer-row.incorrect {
    background: #ffebee;
    border-left: 4px solid #f44336;
}

.mistake-answer-label {
    font-weight: 600;
    min-width: 120px;
}

.mistake-answer-value {
    flex: 1;
}

.no-mistakes-message {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-mistakes-message h4 {
    color: #4CAF50;
    font-size: 1.5em;
    margin-bottom: 10px;
}

.no-mistakes-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

/* Performance Trends Modal */
.trends-modal {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

.performance-container {
    max-width: 1100px;
}

.performance-body {
    padding: 30px;
}

.trends-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
}

.exam-filter {
    flex: 1;
    min-width: 200px;
}

.exam-filter label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.exam-filter select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.exam-filter select:focus {
    outline: none;
    border-color: #667eea;
}

.time-range-control {
    flex: 2;
    min-width: 300px;
}

.time-range-control label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

#time-range-label {
    color: #667eea;
    font-weight: 700;
}

#time-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, #e0e0e0, #667eea);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

#time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

#time-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.time-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
}

.trends-summary {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
    margin-bottom: 20px;
    text-align: center;
}

.trends-summary h4 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
}

.trends-summary-stats {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    flex-wrap: wrap;
}

.trend-stat {
    flex: 1;
    min-width: 120px;
}

.trend-stat-value {
    font-size: 2em;
    font-weight: 700;
    display: block;
}

.trend-stat-label {
    font-size: 0.9em;
    opacity: 0.9;
}

.trend-stat.improving {
    background: #f0fdf4;
    border-radius: 8px;
    padding: 10px;
}

.trend-stat.improving .trend-stat-value {
    color: #10b981;
}

.trend-stat.declining {
    background: #fef2f2;
    border-radius: 8px;
    padding: 10px;
}

.trend-stat.declining .trend-stat-value {
    color: #ef4444;
}

.trends-heatmap {
    margin-bottom: 25px;
}

.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.heatmap-header h4 {
    margin: 0;
    color: #333;
}

.heatmap-legend {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.85em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.heatmap-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.heatmap-row {
    display: grid;
    gap: 5px;
    grid-template-columns: 200px repeat(auto-fit, minmax(60px, 1fr));
    align-items: center;
}

.heatmap-category-label {
    font-weight: 600;
    font-size: 0.9em;
    color: #333;
    padding: 8px 10px;
    background: #f5f5f5;
    border-radius: 5px;
}

.heatmap-cell {
    height: 50px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9em;
    color: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    position: relative;
}

.heatmap-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.heatmap-cell.empty {
    background: #f0f0f0;
    color: #999;
    cursor: default;
}

.heatmap-cell.empty:hover {
    transform: none;
    box-shadow: none;
}

.heatmap-date-label {
    font-size: 0.75em;
    text-align: center;
    color: #666;
    margin-bottom: 5px;
}

.trends-insights {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.trends-insights h4 {
    margin-top: 0;
    color: #333;
}

.insight-item {
    padding: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    background: white;
    border-radius: 5px;
}

.insight-item.improving {
    border-left-color: #4CAF50;
}

.insight-item.declining {
    border-left-color: #FF5722;
}

.insight-item.stable {
    border-left-color: #FFC107;
}

.insight-icon {
    font-size: 1.2em;
    margin-right: 8px;
}

.trends-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.heatmap-cell.actionable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.heatmap-cell.actionable:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.heatmap-hint {
    margin-top: 10px;
    text-align: center;
    color: #667eea;
    font-weight: 600;
    font-size: 0.95em;
}

.mistakes-container {
    max-width: 1100px;
}

.mistakes-body {
    padding: 30px;
}

.mistakes-actions {
    display: flex;
    justify-content: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.no-data-message {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-data-message h4 {
    color: #999;
    margin-bottom: 10px;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 15px;
    }

    header h1 {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.4em;
    }

    .exam-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .exam-button {
        padding: 20px 10px;
    }

    .exam-button .icon {
        font-size: 2.5em;
    }

    .exam-button .label {
        font-size: 0.9em;
    }

    .passage-container {
        max-height: 300px;
    }

    .passage-container h3 {
        padding: 15px 20px;
        font-size: 1.1em;
    }

    .passage-text {
        padding: 20px;
        font-size: 0.95em;
    }

    .question-container {
        padding: 20px;
    }

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

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

    #score-percentage {
        font-size: 2.5em;
    }

    .navigation {
        flex-direction: column;
    }

    .results-actions {
        flex-direction: column;
    }

    .time-insights,
    .performance-comparison {
        padding: 15px;
        margin: 20px 0;
    }

    .comparison-grid {
        gap: 10px;
    }

    .comparison-value {
        font-size: 1em;
    }

    .question-time-indicator {
        font-size: 0.9em;
        padding: 8px 12px;
    }
}
