:root {
    --apple-blue: #0071e3;
    --apple-gray: #86868b;
    --apple-bg: #f5f5f7;
    --glass: rgba(255, 255, 255, 0.8);
    --success: #34c759;
    --error: #ff3b30;
    --dark-btn: #1d1d1f;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--apple-bg);
    color: #1d1d1f;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

nav {
    width: 100%; height: 52px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    position: sticky; top: 0; z-index: 100;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 40px; box-sizing: border-box;
    border-bottom: 0.5px solid rgba(0,0,0,0.1);
}

.logo { font-weight: 600; letter-spacing: -0.01em; font-size: 14px; }

/* --- MODAL STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    opacity: 0; transition: opacity 0.3s ease;
}

.modal-overlay.active { opacity: 1; }

.modal-card {
    background: white;
    padding: 32px;
    border-radius: 28px;
    width: 90%; max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card { transform: scale(1); }

.modal-icon {
    width: 44px; height: 44px;
    background: #fff0f0; color: var(--error);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; margin: 0 auto 16px; font-size: 20px;
}

/* --- EXAM UI COMPONENTS --- */
.logo-badge {
    display: inline-block;
    background: rgba(0, 113, 227, 0.1);
    color: var(--apple-blue);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: 0.02em;
}

.exam-container { 
    width: 98%; 
    max-width: 1400px; 
    margin: 40px 0; 
}

.card {
    background: white; border-radius: 28px; padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.04); display: none;
    overflow: hidden; 
}

.card.active { display: block; animation: slideIn 0.5s ease-out; }

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

/* --- QUIZ LAYOUT UPDATED --- */
#quiz-screen.card {
    min-height: 600px;
    height: 85vh;
    max-height: 900px;
    padding: 0; 
    display: none;
    flex-direction: row; 
}

#quiz-screen.card.active { display: flex; }

.quiz-grid { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
}

/* Split content area: Text Left, Image Right */
@media (min-width: 850px) { 
    .quiz-grid.has-image .quiz-main-content { 
        display: grid; 
        grid-template-columns: 1.2fr 0.8fr; 
        gap: 40px; 
    } 
}

/* --- SCROLLABLE QUESTION AREA --- */
.quiz-main-content { 
    flex: 1; 
    overflow-y: auto; 
    padding: 40px; 
    border-bottom: 1px solid #eef0f2;
    align-items: start;
}

/* --- UPDATED: UNIFORM GRID BUTTONS AREA --- */
#options-container { 
    flex-shrink: 0; 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); 
    gap: 16px; 
    padding: 24px 40px;
    background: #fafafa;
    justify-content: center;
    align-items: stretch; 
}

/* --- SIDEBAR & BUTTONS --- */
.footer-nav-sidebar {
    width: 180px;
    background-color: #fafafa;
    border-left: 1px solid #eef0f2;
    padding: 40px 20px;
    display: flex;
    flex-direction: column; 
    gap: 12px;
    flex-shrink: 0;
}

.btn { 
    font-size: 15px; 
    padding: 12px 20px; 
    border-radius: 980px; 
    border: none; 
    cursor: pointer; 
    font-weight: 500; 
    transition: all 0.2s ease; 
    text-align: center;
}

.btn-primary { background: var(--apple-blue); color: white; }
.btn-secondary { background: #e8e8ed; color: #1d1d1f; }
.btn-close { background: var(--dark-btn); color: white; }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }

#end-exam-btn {
    margin-top: 12px;
    background: transparent;
    color: var(--error);
    border: 1px solid rgba(255, 59, 48, 0.3);
}

#end-exam-btn:hover {
    background: #fff2f2;
    border-color: var(--error);
}

#exit-review-btn {
    margin-top: 12px;
    background: var(--dark-btn);
    color: white;
}

#exit-review-btn:hover {
    background: #323235;
    transform: translateY(-1px);
}

/* --- TYPOGRAPHY & INFO --- */
h1 { font-size: 42px; margin: 0; letter-spacing: -0.02em; }
.subtitle { font-size: 21px; color: var(--apple-gray); margin-bottom: 40px; }

h2 { 
    font-size: 16px; 
    font-weight: 400; 
    line-height: 1.6; 
    margin-top: 0; 
    color: #1d1d1f;
}

.info-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px;
    padding-top: 30px; border-top: 1px solid #eef0f2; margin-bottom: 40px;
}
.info-label { color: var(--apple-gray); font-size: 11px; text-transform: uppercase; font-weight: 700; }
.info-value { font-size: 16px; font-weight: 500; }

.q-progress { font-size: 12px; color: var(--apple-gray); font-weight: 700; margin-bottom: 10px; }

/* Sticky Image Styling */
.q-image-container { 
    border-radius: 16px; 
    overflow: hidden; 
    border: 1px solid #eef0f2; 
    align-self: start; 
    position: sticky;
    top: 0;
    background: white;
}
.q-image-container img { width: 100%; display: block; max-height: 500px; object-fit: contain; background: white; }

/* Option Items (Grid-aligned) */
.option-item {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white; 
    padding: 16px 20px; 
    border-radius: 16px; 
    cursor: pointer; 
    transition: 0.2s;
    border: 2px solid #e8e8ed; 
    font-size: 16px; 
    font-weight: 400; 
    line-height: 1.3;
    text-align: center;
    height: 100%;
    box-sizing: border-box;
}

.option-item:hover { background: #ffffff; border-color: #d2d2d7; transform: translateY(-2px); }
.option-item.selected { border-color: var(--apple-blue); background: white; font-weight: 500; box-shadow: 0 4px 12px rgba(0,113,227,0.1); }

/* NEW: Multi-select Highlight (Green) */
.option-item.selected-multiple { 
    border-color: var(--success); 
    background: #f2faf3; 
    font-weight: 500; 
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.1); 
}

/* UPDATED REVIEW COLORS: Solid fill with white text */
.option-item.correct { 
    background-color: var(--success) !important; 
    border-color: var(--success) !important; 
    color: white !important; 
}
.option-item.incorrect { 
    background-color: var(--error) !important; 
    border-color: var(--error) !important; 
    color: white !important; 
}

/* Ensure child spans also turn white */
.option-item.correct span, 
.option-item.incorrect span { 
    color: white !important; 
}

/* --- TIMER --- */
.timer-container { display: flex; align-items: center; gap: 12px; }
.timer-svg-wrapper { position: relative; width: 32px; height: 32px; transform: rotate(-90deg); }
.timer-bg-circle { fill: none; stroke: rgba(0, 0, 0, 0.05); stroke-width: 3; }
.timer-bar {
    fill: none; stroke: var(--apple-blue); stroke-width: 3;
    stroke-linecap: round; stroke-dasharray: 88; stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}
#timer-display { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--apple-blue); font-size: 16px; }

/* --- HOVER STATES --- */
.btn-primary:hover { background-color: #0077ed; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3); }
.btn-primary:active { transform: translateY(0); background-color: #0062c3; }
.btn-secondary:hover { background-color: #d2d2d7; }

.hidden { display: none !important; }

#q-text { flex-shrink: 0; min-height: fit-content; margin-bottom: 24px; transition: opacity 0.2s ease; }