:root {
    --primary: #003366;
    --secondary: #f0f4f8;
    --accent: #dca01e;
    --text: #333;
    --light-text: #666;
    --border: #ddd;
    --success: #28a745;
    --error: #dc3545;
    
    /* ETS Exam Specific Colors */
    --mft-blue: #003366; /* Match primary website blue */
    --mft-border: #002244; 
    --mft-timer-red: #ff6666; 
    --mft-bg: #fdfdfd;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    /* Soft gradient background to make the glass pop */
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Base UI Elements */
.main-header {
    background-color: var(--primary);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.main-header h1 { margin: 0; font-size: 1.5rem; }
.main-header p { margin: 0; font-size: 0.9rem; opacity: 0.8; }

#main-nav {
    background-color: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

#main-nav button {
    font-family: 'Poppins', sans-serif;
    background: none;
    border: none;
    padding: 1rem 2rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--light-text);
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

#main-nav button:hover { background-color: var(--secondary); color: var(--primary); }
#main-nav button.active { color: var(--primary); border-bottom-color: var(--primary); }
#main-nav .mock-exam-btn { color: var(--accent); }
#main-nav .mock-exam-btn:hover { border-bottom-color: var(--accent); }

main {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
    min-height: 80vh;
}

.view { display: none; }
.view.active { display: block; }

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    transition: transform 0.2s;
    cursor: pointer;
}
.card:hover { transform: translateY(-3px); }

.profile-section {
    margin-bottom: 2rem;
    background: linear-gradient(to right, #ffffff, #f0f4f8);
    border-left: 5px solid var(--primary);
    cursor: default;
}
.profile-section:hover { transform: none; }

.auth-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.info-box {
    margin-bottom: 2rem; 
    background: white; 
    padding: 1.5rem; 
    border-radius: 8px; 
    border: 1px solid var(--border);
}

/* Buttons */
.btn-primary, .btn-secondary {
    font-family: 'Poppins', sans-serif;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
}
.btn-primary:hover { background-color: #002244; }

.btn-secondary {
    background-color: white;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background-color: var(--secondary); }

input[type="text"] {
    font-family: 'Poppins', sans-serif;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 250px;
    max-width: 100%;
}

/* Study Accordions */
.subject-accordion {
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.accordion-header {
    background: var(--secondary);
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
}

.accordion-content {
    padding: 0 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: white;
}
.accordion-content.open { padding: 1rem; max-height: 15000px; }

.flashcard {
    border: 1px solid var(--border);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    background: #fff;
}

/* Standard Quiz UI */
.question-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.option-btn {
    font-family: 'Poppins', sans-serif;
    background: white;
    border: 1px solid var(--border);
    padding: 1rem;
    text-align: left;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 0.8rem;
    transition: background-color 0.2s;
}
.option-btn:hover { background-color: var(--secondary); }
.option-btn.selected { background-color: #e3f2fd; border-color: var(--primary); color: var(--primary); font-weight: 600; }
.option-btn.correct { background-color: #d4edda; border-color: var(--success); color: #155724; cursor: default;}
.option-btn.incorrect { background-color: #f8d7da; border-color: var(--error); color: #721c24; cursor: default;}
.option-btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* =========================================
   ETS MFT MOCK EXAM UI REPLICATION
   ========================================= */
#exam-ui {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--mft-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.mft-header {
    background-color: var(--mft-blue);
    color: white;
    border-bottom: 2px solid var(--mft-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    font-size: 1.2rem;
}

.mft-header-left { flex: 1; text-align: left; }
.mft-header-center { flex: 1; text-align: center; font-size: 1.4rem; }
.mft-header-right { flex: 1; text-align: right; }

.mft-time { color: var(--mft-timer-red); font-weight: 600; }

.mft-content {
    flex: 1;
    overflow-y: auto;
    padding: 4rem 15% 2rem 15%;
    font-size: 1.2rem;
}

.mft-question-text {
    margin-bottom: 2rem;
}

.mft-options {
    list-style: none;
    padding: 0;
}

.mft-options li {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mft-options li:hover {
    background-color: #f0f0f0;
}

.mft-bullet {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #333;
    margin-right: 15px;
    opacity: 0.2; 
}

.mft-options li.selected .mft-bullet {
    opacity: 1;
}

.mft-footer {
    background-color: var(--mft-blue);
    color: white; 
    border-top: 2px solid var(--mft-border);
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 2rem;
}

.mft-footer-left, .mft-footer-right {
    display: flex;
    gap: 1.5rem;
}

.mft-tool-btn, .mft-nav-btn {
    background: transparent;
    border: none;
    font-family: 'Poppins', sans-serif;
    color: white; 
    cursor: pointer;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.2;
}

.mft-icon {
    font-size: 1.4rem;
    font-weight: bold;
}

/* =========================================
   DRAGGABLE CALCULATOR UI
   ========================================= */
#calculator-modal {
    position: absolute;
    top: 100px; 
    right: 50px;
    width: 260px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 3000;
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
    cursor: move;
    user-select: none;
    transition: none;
}

.calc-header {
    background: #333;
    color: white;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    cursor: move; 
}

.calc-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
}

.calc-display {
    background: #eaedeb;
    color: #333;
    text-align: right;
    padding: 1rem;
    font-size: 1.5rem;
    min-height: 35px;
    word-break: break-all;
    border-bottom: 1px solid var(--border);
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
}

.calc-grid button {
    background: white;
    border: none;
    padding: 1rem 0;
    cursor: pointer;
    font-size: 1.1rem;
    font-family: inherit;
    transition: background 0.1s;
}

.calc-grid button:hover {
    background: var(--secondary);
}

.calc-clear {
    grid-column: span 4;
    background: var(--error) !important;
    color: white;
    font-weight: bold;
}

.calc-clear:hover {
    background: #c82333 !important;
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 4000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* Custom Dialog Glass Effect */
.modal-content.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 40px rgba(0, 51, 102, 0.15);
    transform: translateY(20px);
    opacity: 0;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    to { transform: translateY(0); opacity: 1; }
}

/* Results Formatting */
.score-circle {
    width: 150px; height: 150px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    font-weight: bold;
    border: 5px solid #fff;
    box-shadow: 0 0 0 5px var(--primary);
}
.stat-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 2rem 0;
}
.stat-box {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    min-width: 100px;
}

/* Compact Mastery Display */
.compact-mastery-container {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.mastery-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mastery-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mastery-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.mastery-bar-bg {
    height: 8px;
    background-color: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.mastery-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Progress Review Table for Check Button */
.progress-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-family: 'Poppins', sans-serif;
}

.progress-table th {
    background-color: var(--secondary);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--border);
}

.progress-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
}

.progress-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

.progress-table tbody tr:hover {
    background-color: #f0f4f8;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    #main-nav button { padding: 1rem 0.5rem; font-size: 0.9rem; }
    
    .mft-header { flex-direction: column; text-align: center; padding: 0.5rem; gap: 0.5rem; }
    .mft-header-left, .mft-header-center, .mft-header-right { text-align: center; }
    
    .mft-content { padding: 2rem 1rem; }
    
    .mft-footer { flex-wrap: wrap; justify-content: center; gap: 1rem; padding: 1rem; }
    .mft-footer-left { flex-wrap: wrap; justify-content: center; }
    
    #calculator-modal { 
        top: auto; bottom: 120px; right: auto; left: 50%; 
        transform: translateX(-50%) !important;
        width: 90%; max-width: 280px;
    }
}

/* Base Accessibility & Utilities */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.text-muted { color: var(--light-text); font-style: italic; }
.text-error { color: var(--error) !important; }
.highlight-text { color: var(--accent); font-weight: 700; }

/* Navigation Improvements */
#main-nav {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 51, 102, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

#main-nav button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* --- GLASSMORPHISM CORE --- */
.glass-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 51, 102, 0.08);
    padding: 2rem;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- DASHBOARD LAYOUT --- */
.welcome-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 3rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.5) 100%);
    border-left: 6px solid var(--primary);
}

.welcome-text h2 { margin-top: 0; font-size: 2rem; color: var(--primary); }
.welcome-text p { font-size: 1.1rem; color: var(--light-text); margin-bottom: 0; }

.auth-container {
    flex: 0 0 350px;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.2s;
    box-sizing: border-box;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.auth-btn { width: 100%; padding: 0.9rem; font-weight: 600; }

.auth-divider {
    text-align: center;
    position: relative;
    margin: 1.5rem 0;
}
.auth-divider::before {
    content: "";
    position: absolute;
    top: 50%; left: 0; right: 0;
    border-top: 1px solid var(--border);
    z-index: 1;
}
.auth-divider span {
    background: white;
    padding: 0 10px;
    color: var(--light-text);
    font-size: 0.85rem;
    position: relative;
    z-index: 2;
}

/* Analytics Grid */
.dashboard-analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
}

.stat-icon {
    font-size: 2.5rem;
    background: rgba(0, 51, 102, 0.05);
    width: 60px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
}

.stat-details h3 { margin: 0; font-size: 0.9rem; color: var(--light-text); text-transform: uppercase; letter-spacing: 0.5px;}
.stat-number { font-size: 2.2rem; font-weight: 700; color: var(--primary); line-height: 1; display: block; margin: 0.5rem 0; }
.stat-details p { margin: 0; font-size: 0.85rem; color: var(--light-text); }

.mastery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 0.5rem;
}
.mastery-header h3 { margin: 0; color: var(--primary); }
.btn-text { background: none; border: none; font-weight: 600; color: var(--light-text); cursor: pointer; transition: color 0.2s;}
.btn-text:hover { color: var(--primary); }

/* Action Cards */
.dashboard-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.action-card {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.action-card:hover, .action-card:focus-visible {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 51, 102, 0.15);
    outline: none;
    border-color: var(--primary);
}

.action-icon { font-size: 2rem; margin-bottom: 1rem; }
.action-card h3 { margin-top: 0; color: var(--primary); }
.action-arrow {
    position: absolute;
    bottom: 2rem; right: 2rem;
    font-size: 1.5rem;
    color: var(--accent);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}
.action-card:hover .action-arrow, .action-card:focus-visible .action-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Info Grid */
/* Info Grid & Flexbox Alignment */
.bottom-info-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: stretch; /* Ensures both cards match in height */
}

/* Make the info boxes flex containers so their internal content can stretch */
.info-box {
    display: flex;
    flex-direction: column;
    margin-bottom: 0; /* Removing old margin to let the grid handle spacing */
}

.feedback-form {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Pushes the button to the bottom */
}

.feedback-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(250, 250, 250, 0.5); /* Slightly transparent to match glass */
    margin-bottom: 1rem;
    font-family: inherit;
    resize: none; /* Disable manual resizing since it auto-fills the space */
    box-sizing: border-box;
    transition: all 0.2s;
    flex-grow: 1; /* Automatically expands to eat up the awkward white space! */
}

.feedback-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
    background: white;
}

/* Improved Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #001f3f 100%);
    box-shadow: 0 4px 15px rgba(0, 51, 102, 0.2);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 51, 102, 0.3);
}

/* Responsive Design */
@media (max-width: 992px) {
    .welcome-section { flex-direction: column; text-align: center; gap: 2rem;}
    .auth-container { width: 100%; max-width: 400px; }
    .dashboard-analytics-grid { grid-template-columns: 1fr 1fr; }
    .mastery-card { grid-column: 1 / -1; }
    .bottom-info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .dashboard-analytics-grid { grid-template-columns: 1fr; }
    .dashboard-action-grid { grid-template-columns: 1fr; }
}

/* =========================================
   STUDY MODULES (LIQUID GLASS ACCORDION)
   ========================================= */
#study-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.subject-accordion {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 51, 102, 0.05);
    transition: all 0.3s ease;
}

.accordion-header {
    width: 100%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary);
    font-size: 1.1rem;
    transition: background 0.2s;
}

.accordion-header:hover, .accordion-header:focus-visible {
    background: rgba(255, 255, 255, 0.8);
    outline: none;
}

.accordion-header:focus-visible {
    box-shadow: inset 0 0 0 2px var(--primary);
}

.accordion-toggle {
    font-size: 1.5rem;
    line-height: 1;
    transition: transform 0.3s ease;
}

.accordion-content {
    padding: 0 1.5rem;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-content.open {
    padding: 1.5rem;
    max-height: 10000px;
    opacity: 1;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
}

.flashcard {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.9);
    padding: 1.2rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: transform 0.2s;
}

.flashcard:hover {
    transform: translateX(5px);
    border-left: 4px solid var(--accent);
}

.flashcard strong {
    color: var(--primary);
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* =========================================
   QUIZ TOPIC SELECTION
   ========================================= */
.quiz-topic-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.quiz-topic-card h3 {
    margin-top: 0;
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.topic-accuracy {
    font-size: 0.9rem;
    color: var(--light-text);
    margin-bottom: 1.5rem;
}

.accuracy-bar-bg {
    height: 6px;
    background: rgba(0,0,0,0.08);
    border-radius: 3px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.accuracy-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* =========================================
   ACTIVE QUIZ INTERFACE
   ========================================= */
.quiz-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    position: sticky;
    top: 75px; 
    z-index: 90;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.question-meta {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 2rem;
}

.options-grid {
    display: grid;
    gap: 1rem;
}

.option-btn {
    font-family: 'Poppins', sans-serif;
    color: var(--text);
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid transparent;
    padding: 1.2rem 1.5rem;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
}

.option-btn::before {
    content: "";
    display: inline-block;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    margin-right: 15px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.option-btn:hover:not([disabled]) {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 51, 102, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.option-btn:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.option-btn.selected {
    background: #eaf3fa;
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.option-btn.selected::before {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 4px #eaf3fa;
}

.option-btn.correct { background: #d4edda; border-color: var(--success); color: #155724; cursor: default; }
.option-btn.correct::before { border-color: var(--success); background: var(--success); box-shadow: inset 0 0 0 4px #d4edda; }

.option-btn.incorrect { background: #f8d7da; border-color: var(--error); color: #721c24; cursor: default; }
.option-btn.incorrect::before { border-color: var(--error); background: var(--error); box-shadow: inset 0 0 0 4px #f8d7da; }

/* Mobile Optimizations */
@media (max-width: 768px) {
    .quiz-nav-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .quiz-nav-bar > div {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
}

/* =========================================
   RESULTS SCREEN
   ========================================= */
.text-center { text-align: center; }
.text-success { color: var(--success) !important; }

.results-dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin: 2.5rem 0;
}

/* Score Circle */
.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-circle {
    width: 160px; height: 160px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    position: relative;
    transition: color 0.5s ease;
}

/* Outer glowing ring driven by a CSS variable set in JS */
.score-circle::after {
    content: '';
    position: absolute;
    top: -8px; left: -8px; right: -8px; bottom: -8px;
    border-radius: 50%;
    border: 4px solid var(--score-color, var(--primary));
    opacity: 0.5;
    z-index: -1;
    transition: border-color 0.5s ease;
}

.score-label {
    margin-top: 1.2rem;
    font-weight: 700;
    color: var(--light-text);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Stat Boxes */
.stat-grid {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
}

.stat-box {
    flex: 1;
    padding: 1.5rem;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-box-title {
    margin: 0 0 0.5rem 0;
    color: var(--light-text);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.stat-box-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

/* Warning Card (Weakest Topics) */
.warning-card {
    background: rgba(255, 243, 205, 0.7);
    border-color: rgba(255, 238, 186, 0.9);
    text-align: left;
    margin-top: 2rem;
}

.warning-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.warning-header h3 {
    margin: 0;
    color: #856404;
}

#weakest-topics-text {
    color: #856404;
    margin-bottom: 0;
    font-size: 1.05rem;
}

/* Review Flashcards */
.review-flashcard {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-left: 5px solid var(--error);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
}

.review-flashcard-title {
    color: var(--primary);
    font-size: 1.15rem;
    font-weight: 600;
    display: block;
    margin-bottom: 1rem;
}

.review-answer-box {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.8rem;
    font-size: 1.05rem;
}

.review-answer-box.user-ans {
    background: rgba(248, 215, 218, 0.5);
    border-left: 3px solid var(--error);
}

.review-answer-box.correct-ans {
    background: rgba(212, 237, 218, 0.5);
    border-left: 3px solid var(--success);
}

.review-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--light-text);
}

.review-explanation {
    background: rgba(255,255,255,0.6);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 8px;
    font-style: italic;
    color: #444;
}

/* Mobile Adjustments */
@media (min-width: 600px) {
    .results-dashboard {
        flex-direction: row;
        justify-content: center;
        gap: 4rem;
    }
    .stat-grid {
        flex-direction: column;
        width: auto;
    }
}

/* =========================================
   MFT VISUAL BREAKDOWN GRID
   ========================================= */
.mft-visual-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.bd-item {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.2s;
}

.bd-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.bd-name { 
    font-weight: 500; 
    color: var(--text); 
}

/* Turn the percentage into a clean, modern badge */
.bd-pct { 
    font-weight: 600; 
    color: var(--primary); 
    background: rgba(0, 51, 102, 0.08); /* Very subtle blue background */
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 51, 102, 0.15);
    font-size: 0.85rem;
}

/* Stack them into a single column on mobile */
@media (max-width: 600px) {
    .mft-visual-breakdown { 
        grid-template-columns: 1fr; 
    }
}

/* =========================================
   GLOBAL FOOTER
   ========================================= */
.main-footer {
    margin-top: 3rem;
    padding: 2rem 1rem;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    text-align: center;
    color: var(--light-text);
    font-size: 0.85rem;
    border-radius: 16px 16px 0 0; /* Soft rounded top corners */
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.footer-content p {
    margin: 0;
    color: var(--light-text);
}

.footer-content strong {
    color: var(--primary);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.5rem;
}

.footer-divider {
    color: rgba(0, 51, 102, 0.2);
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s, transform 0.2s;
}

.footer-links a:hover, .footer-links a:focus-visible {
    color: var(--accent);
    outline: none;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    .footer-divider {
        display: none;
    }
}

/* Inline Footer Link Styling */
.portfolio-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.portfolio-link:hover, .portfolio-link:focus-visible {
    color: var(--accent);
    text-decoration: none; 
    outline: none;
}

/* Mobile-only left alignment for Study Modules */
@media (max-width: 768px) {
    /* Aligns the main "Study Modules" title and description */
    #study-container > div:first-child {
        text-align: left !important;
    }

    /* Aligns the text inside the subject accordion buttons */
    .accordion-header {
        text-align: left !important;
    }
    
    .accordion-header span:first-child {
        text-align: left;
        /* Ensures long titles don't push the + icon off screen */
        max-width: 85%; 
        line-height: 1.3;
    }
}