/* ==========================================================================
   🎯 NEXTEDU NEXUS — SCHOLAR EXAM ARENA STYLESHEET (v7.0.0)
   Obsidian Dark + Frosted Light • 60FPS Hardware Accelerated
   Tactile Answer Cards • AI Chamber • Bento Analytics
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

/* ==========================================================================
   1. DESIGN TOKENS (UNIFIED THEME SYSTEM)
   ========================================================================== */
:root, [data-theme="dark"] {
    --nexus-bg: #050807;
    --nexus-bg-alt: #0c1210;
    --nexus-bg-gradient: #050807;
    --nexus-surface: #0c1210;
    --nexus-surface-card: #111a16;
    --nexus-surface-hover: #162019;
    --nexus-surface-solid: #0c1210;
    --nexus-glass: #0c1210;
    --nexus-glass-border: #192a20;
    --nexus-glass-border-hover: rgba(34, 197, 94, 0.45);
    --nexus-text: #edfdf4;
    --nexus-text-muted: #9ab0a4;
    --nexus-text-dim: #647a6f;
    --nexus-primary: #22c55e;
    --nexus-primary-hover: #16a34a;
    --nexus-primary-light: rgba(34, 197, 94, 0.12);
    --nexus-cyan: #22c55e;
    --nexus-blue: #3b82f6;
    --nexus-purple: #22c55e;
    --nexus-amber: #f59e0b;
    --nexus-emerald: #22c55e;
    --nexus-rose: #ef4444;
    --nexus-gold: #eab308;
    --nexus-gold-glow: rgba(234, 179, 8, 0.28);
    
    --card-border: #192a20;
    --card-bg: #0c1210;
    --input-bg: #111a16;
    
    --nexus-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.55);
    --nexus-glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --nexus-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --nexus-font-heading: 'Plus Jakarta Sans', 'Inter', sans-serif;
    --nexus-font-mono: 'Inter', monospace;
    --nexus-max-width: 880px;
    --nexus-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
    --nexus-bg: #f8f5ff;
    --nexus-bg-alt: #fbf9ff;
    --nexus-bg-gradient: #f8f5ff;
    --nexus-surface: #ffffff;
    --nexus-surface-card: #ffffff;
    --nexus-surface-hover: #f3eeff;
    --nexus-surface-solid: #ffffff;
    --nexus-glass: #ffffff;
    --nexus-glass-border: #e7ddff;
    --nexus-glass-border-hover: rgba(109, 40, 217, 0.4);
    --nexus-text: #171321;
    --nexus-text-muted: #625b71;
    --nexus-text-dim: #9d8fb0;
    --nexus-primary: #6d28d9;
    --nexus-primary-hover: #5b21b6;
    --nexus-primary-light: #ede9fe;
    --nexus-cyan: #6d28d9;
    --nexus-blue: #4f46e5;
    --nexus-purple: #6d28d9;
    --nexus-amber: #d97706;
    --nexus-emerald: #16a34a;
    --nexus-rose: #dc2626;
    --nexus-gold: #d97706;
    --nexus-gold-glow: rgba(217, 119, 6, 0.18);
    
    --card-border: #e7ddff;
    --card-bg: #ffffff;
    --input-bg: #fbf9ff;
    
    --nexus-shadow: 0 4px 12px rgba(47, 24, 90, 0.08);
    --nexus-glass-shadow: 0 8px 24px 0 rgba(47, 24, 90, 0.06);
}

/* ==========================================================================
   2. BODY & AMBIENT CANVAS
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body.quiz-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--nexus-bg);
    background-image: var(--nexus-bg-gradient);
    background-attachment: fixed;
    color: var(--nexus-text);
    font-family: var(--nexus-font);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
}

/* Ambient Canvas */
.ambient-bg-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.28;
    transform: translate3d(0, 0, 0);
    will-change: transform;
    animation: ambientPulse 22s ease-in-out infinite alternate;
}

.orb-1 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, var(--nexus-primary) 0%, transparent 70%);
    top: -120px;
    left: -100px;
}

.orb-2 {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, var(--nexus-gold) 0%, transparent 70%);
    bottom: -150px;
    right: -120px;
    animation-delay: -8s;
}

@keyframes ambientPulse {
    0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.22; }
    50% { transform: translate3d(20px, 30px, 0) scale(1.08); opacity: 0.32; }
    100% { transform: translate3d(-20px, -15px, 0) scale(0.96); opacity: 0.24; }
}

/* ==========================================================================
   3. APP BAR & QUIZ CONTAINER
   ========================================================================== */
.quiz-app-bar {
    width: 100%;
    max-width: var(--nexus-max-width);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 8px;
    z-index: 10;
    position: relative;
}

.header-brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-top-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 9999px;
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-glass-border);
    color: var(--nexus-text);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: 0.2s var(--nexus-ease);
}
.btn-top-back:hover {
    border-color: var(--nexus-primary);
    color: var(--nexus-primary);
    transform: translateY(-1px);
}

.brand-text-block {
    display: flex;
    flex-direction: column;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--nexus-text);
    font-family: var(--nexus-font-heading);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.3px;
    transition: opacity 0.2s;
}
.brand-pill:hover { opacity: 0.9; }

.brand-pill-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--nexus-primary), var(--nexus-primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1rem;
    box-shadow: 0 4px 14px var(--nexus-cyan-glow, rgba(16, 185, 129, 0.4));
}

.brand-pill b {
    color: var(--nexus-primary);
    font-weight: 900;
}

.app-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle-btn, .exit-shortcut-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--nexus-glass-border);
    background: var(--nexus-surface);
    color: var(--nexus-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    backdrop-filter: blur(10px);
    transition: all 0.25s var(--nexus-ease);
}

.theme-toggle-btn:hover {
    color: var(--nexus-primary);
    border-color: var(--nexus-primary);
    transform: translate3d(0, -2px, 0);
}

.exit-shortcut-btn:hover {
    color: var(--nexus-rose);
    border-color: var(--nexus-rose);
    background: rgba(239, 68, 68, 0.1);
    transform: translate3d(0, -2px, 0);
}

/* Master Quiz Container */
.quiz-container {
    width: 100%;
    max-width: var(--nexus-max-width);
    margin: 10px auto 40px;
    padding: 28px 32px;
    background: var(--nexus-surface-card);
    border: 1px solid var(--nexus-glass-border);
    border-radius: 28px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--nexus-shadow);
    position: relative;
    z-index: 5;
    animation: nexusFadeIn 0.4s var(--nexus-ease);
    will-change: transform, opacity;
}

@keyframes nexusFadeIn {
    from { opacity: 0; transform: translate3d(0, 16px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* ==========================================================================
   4. QUIZ HUD (Mode, Prime, Timer, XP, Translate)
   ========================================================================== */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--nexus-glass-border);
    gap: 14px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

/* Mode Indicator */
.mode-indicator {
    background: rgba(56, 189, 248, 0.1);
    color: var(--nexus-cyan);
    border: 1px solid rgba(56, 189, 248, 0.25);
    padding: 7px 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.84rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.2px;
    backdrop-filter: blur(8px);
}

/* Prime HUD Pill */
.prime-hud-pill {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 60%, #ec4899 100%);
    color: #000000;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
    letter-spacing: 0.6px;
    animation: primePulse 2.8s infinite ease-in-out;
}

@keyframes primePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 12px rgba(245, 158, 11, 0.35); }
    50% { transform: scale(1.03); box-shadow: 0 0 20px rgba(236, 72, 153, 0.6); }
}

/* Timer Box */
.timer-box {
    font-family: var(--nexus-font-mono);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--nexus-text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--nexus-glass-border);
    padding: 6px 14px;
    border-radius: 12px;
    letter-spacing: 1.2px;
}
[data-theme="light"] .timer-box {
    background: rgba(0, 0, 0, 0.04);
}

.timer-box i {
    color: var(--nexus-cyan);
    font-size: 0.95rem;
}

/* Timer Warning Animation for Live Exam */
.timer-warning {
    color: var(--nexus-rose) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    background: rgba(239, 68, 68, 0.15) !important;
    animation: timerUrgent 1s infinite alternate ease-in-out;
}

@keyframes timerUrgent {
    from { box-shadow: 0 0 8px rgba(239, 68, 68, 0.3); }
    to { box-shadow: 0 0 18px rgba(239, 68, 68, 0.7); }
}

/* Translate Button */
.translate-btn {
    background: var(--input-bg);
    border: 1px solid var(--nexus-glass-border);
    color: var(--nexus-text);
    padding: 7px 14px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.25s var(--nexus-ease);
}

.translate-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--nexus-cyan);
    color: var(--nexus-cyan);
    transform: translate3d(0, -1px, 0);
}

.translate-btn.active {
    background: rgba(16, 185, 129, 0.18);
    border-color: var(--nexus-emerald);
    color: var(--nexus-emerald);
}

/* XP Display */
.xp-display {
    color: var(--nexus-gold);
    font-family: var(--nexus-font-heading);
    font-weight: 900;
    font-size: 1.25rem;
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.22);
    padding: 6px 14px;
    border-radius: 12px;
    position: relative;
}

.xp-display i {
    font-size: 1rem;
    color: var(--nexus-gold);
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.xp-display small {
    font-size: 0.75rem;
    color: var(--nexus-text-muted);
    font-weight: 700;
}

/* Transient Floating XP Pop */
.xp-transient-boost {
    position: absolute;
    top: -24px;
    right: 0;
    background: linear-gradient(135deg, var(--nexus-gold), var(--nexus-amber));
    color: #000000;
    font-size: 0.76rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 99px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.5);
    animation: xpFloatUp 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes xpFloatUp {
    0% { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.8); }
    30% { opacity: 1; transform: translate3d(0, -6px, 0) scale(1.1); }
    100% { opacity: 0; transform: translate3d(0, -22px, 0) scale(0.95); }
}

/* ==========================================================================
   5. PROGRESS SECTION & DAILY LIMIT STRIPE
   ========================================================================== */
.progress-section {
    margin-bottom: 24px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.84rem;
    color: var(--nexus-text-muted);
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.progress-count b {
    color: var(--nexus-cyan);
    font-family: var(--nexus-font-heading);
    font-size: 1.05rem;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}
[data-theme="light"] .progress-bar-container {
    background: rgba(0, 0, 0, 0.08);
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--nexus-cyan) 0%, var(--nexus-purple) 50%, var(--nexus-emerald) 100%);
    border-radius: 99px;
    transition: width 0.4s var(--nexus-ease);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
}

/* Daily Limit Stripe */
.limit-stripe-container {
    background: rgba(56, 189, 248, 0.05);
    border: 1px solid var(--nexus-glass-border);
    border-radius: 14px;
    padding: 10px 16px;
    margin-bottom: 24px;
}

.limit-stripe-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--nexus-text-muted);
    margin-bottom: 6px;
}

.limit-stripe-info i {
    color: var(--nexus-cyan);
}

.limit-stripe-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}
[data-theme="light"] .limit-stripe-bar {
    background: rgba(0, 0, 0, 0.08);
}

.limit-stripe-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--nexus-cyan), var(--nexus-blue));
    border-radius: 99px;
    transition: width 0.45s ease;
}

/* ==========================================================================
   6. MAIN QUESTION ARENA & TACTILE OPTION CARDS
   ========================================================================== */
.question-card {
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-glass-border);
    padding: 30px 28px;
    border-radius: 20px;
    margin-bottom: 28px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.question-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--nexus-cyan), var(--nexus-purple));
}

#question-text {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.65;
    color: var(--nexus-text);
    font-weight: 600;
    font-family: var(--nexus-font-heading);
    letter-spacing: -0.2px;
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.option-btn {
    background: var(--nexus-surface);
    border: 1.5px solid var(--nexus-glass-border);
    border-radius: 18px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    text-align: left;
    color: var(--nexus-text);
    min-height: 72px;
    transition: all 0.25s var(--nexus-ease);
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.opt-label {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--nexus-text-muted);
    font-family: var(--nexus-font-heading);
    font-weight: 800;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--nexus-glass-border);
    transition: all 0.25s var(--nexus-ease);
}
[data-theme="light"] .opt-label {
    background: rgba(0, 0, 0, 0.05);
}

.opt-txt {
    font-size: 1.02rem;
    font-weight: 500;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: break-word;
    flex: 1;
}

.option-btn:hover:not(.correct):not(.wrong) {
    border-color: var(--nexus-cyan);
    background: rgba(56, 189, 248, 0.08);
    transform: translate3d(0, -3px, 0);
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.16);
}

.option-btn:hover:not(.correct):not(.wrong) .opt-label {
    background: var(--nexus-cyan);
    color: #000000;
    border-color: var(--nexus-cyan);
}

.option-btn:focus-visible {
    outline: 2px solid var(--nexus-cyan);
    outline-offset: 2px;
}

/* Selected State */
.option-btn.selected {
    background: rgba(56, 189, 248, 0.12);
    border-color: var(--nexus-cyan);
}

/* ✅ Correct Option */
.option-btn.correct {
    background: rgba(16, 185, 129, 0.16) !important;
    border-color: var(--nexus-emerald) !important;
    box-shadow: 0 6px 26px rgba(16, 185, 129, 0.32), inset 0 0 16px rgba(16, 185, 129, 0.12) !important;
    animation: correctPulse 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(1.01);
}
.option-btn.correct .opt-label {
    background: var(--nexus-emerald) !important;
    color: #ffffff !important;
    border-color: var(--nexus-emerald) !important;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.6) !important;
    font-size: 1.1rem;
}

/* ❌ Wrong Option */
.option-btn.wrong {
    background: rgba(239, 68, 68, 0.16) !important;
    border-color: var(--nexus-rose) !important;
    box-shadow: 0 6px 26px rgba(239, 68, 68, 0.32), inset 0 0 16px rgba(239, 68, 68, 0.12) !important;
    animation: wrongShake 0.4s ease-in-out;
}
.option-btn.wrong .opt-label {
    background: var(--nexus-rose) !important;
    color: #ffffff !important;
    border-color: var(--nexus-rose) !important;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.6) !important;
    font-size: 1.1rem;
}

/* 🔒 Lock & Dim Other Options */
.options-grid.answered {
    pointer-events: none;
}
.options-grid.answered .option-btn:not(.correct):not(.wrong) {
    opacity: 0.42;
    filter: grayscale(0.2);
    cursor: default;
}

@keyframes correctPulse {
    0% { transform: scale(0.96); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1.01); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ==========================================================================
   7. FOOTER BUTTONS (Exit, Next, Skip)
   ========================================================================== */
.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--nexus-glass-border);
    padding-top: 22px;
    gap: 16px;
}

.btn-exit {
    background: transparent;
    color: var(--nexus-rose);
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    padding: 13px 26px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s var(--nexus-ease);
}
.btn-exit:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--nexus-rose);
    transform: translate3d(0, -2px, 0);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

.btn-next {
    background: linear-gradient(135deg, var(--nexus-cyan) 0%, var(--nexus-blue) 100%);
    color: #ffffff;
    border: none;
    padding: 14px 32px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1.05rem;
    font-family: var(--nexus-font-heading);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
    transition: all 0.25s var(--nexus-ease);
    will-change: transform;
}
.btn-next:hover:not(:disabled) {
    transform: translate3d(0, -2px, 0);
    box-shadow: 0 12px 30px rgba(56, 189, 248, 0.5);
}
.btn-next:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: var(--nexus-text-dim);
    box-shadow: none;
    cursor: not-allowed;
}
[data-theme="light"] .btn-next:disabled {
    background: rgba(0, 0, 0, 0.08);
}

/* Skip Button State */
.btn-next.btn-skip {
    background: var(--nexus-surface);
    color: var(--nexus-text);
    border: 1.5px solid var(--nexus-glass-border);
    box-shadow: none;
}
.btn-next.btn-skip:hover:not(:disabled) {
    background: rgba(56, 189, 248, 0.12);
    border-color: var(--nexus-cyan);
    color: var(--nexus-cyan);
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.2);
}

/* ==========================================================================
   8. AI INITIALIZATION CHAMBER (#countdownOverlay)
   ========================================================================== */
.countdown-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 5, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: nexusFadeIn 0.3s ease;
}

.countdown-overlay.hidden {
    display: none !important;
}

[data-theme="light"] .chamber-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.1) !important;
    color: #0f172a !important;
}
[data-theme="light"] .chamber-card h2,
[data-theme="light"] .chamber-card p {
    color: #0f172a !important;
}

.chamber-card {
    background: #191210;
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 40px 36px;
    border-radius: 32px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.chamber-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.14);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.35);
    padding: 6px 16px;
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 24px;
}

.chamber-progress-ring {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
}

.progress-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 8;
}
[data-theme="light"] .ring-bg {
    stroke: rgba(0, 0, 0, 0.08);
}

.ring-fill {
    fill: none;
    stroke: url(#nexusGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 0.25s ease-out;
}

.ring-center-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.countdown-number {
    font-size: 2.4rem;
    font-weight: 900;
    font-family: var(--nexus-font-mono);
    color: var(--nexus-cyan);
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
    line-height: 1;
}

.ring-subtext {
    font-size: 0.65rem;
    color: var(--nexus-text-muted);
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 4px;
}

.chamber-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--nexus-text);
    margin-bottom: 8px;
    font-family: var(--nexus-font-heading);
}

.countdown-status {
    font-size: 0.88rem;
    color: var(--nexus-text-muted);
    min-height: 22px;
    margin-bottom: 20px;
}

/* Linear Progress bar in chamber */
.ai-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 24px;
}
[data-theme="light"] .ai-progress-bar {
    background: rgba(0, 0, 0, 0.08);
}

.ai-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--nexus-amber), var(--nexus-cyan), var(--nexus-emerald));
    border-radius: 99px;
    transition: width 0.2s ease-out;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.chamber-stages {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.stage-pill {
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--nexus-text-dim);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.stage-pill.active {
    background: rgba(56, 189, 248, 0.12);
    color: var(--nexus-cyan);
    border-color: rgba(56, 189, 248, 0.3);
}

/* ==========================================================================
   9. RESULT ANALYTICS & BENTO METRICS
   ========================================================================== */
.status-screen {
    text-align: center;
    padding: 10px 0;
    animation: nexusFadeIn 0.5s ease;
}

.success-icon-wrapper {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(251, 191, 36, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    position: relative;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.success-icon-wrapper::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px dashed rgba(251, 191, 36, 0.4);
    animation: rotateDashed 12s linear infinite;
}

@keyframes rotateDashed {
    100% { transform: rotate(360deg); }
}

.success-icon {
    font-size: 2.8rem;
    color: var(--nexus-gold);
    filter: drop-shadow(0 4px 12px rgba(251, 191, 36, 0.5));
}

.status-screen h1 {
    font-size: 2rem;
    color: var(--nexus-text);
    margin: 0 0 6px;
    font-family: var(--nexus-font-heading);
    font-weight: 800;
}

.result-msg {
    color: var(--nexus-text-muted);
    font-size: 1rem;
    margin-bottom: 28px;
}

/* Stats Bento Grid */
.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 30px;
}

.stat-box {
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-glass-border);
    padding: 18px 14px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.stat-box label {
    display: block;
    color: var(--nexus-text-muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    font-weight: 700;
}

.stat-box .val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--nexus-text);
    font-family: var(--nexus-font-mono);
}

.stat-box.highlight {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.35);
}
.stat-box.highlight .val {
    color: var(--nexus-gold);
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

/* Mistakes Review & AI Section */
.mistakes-container {
    margin-top: 32px;
    text-align: left;
    background: var(--nexus-surface);
    border: 1px solid var(--nexus-glass-border);
    border-radius: 22px;
    padding: 24px;
}

.mistake-item {
    background: var(--nexus-surface-card);
    border: 1px solid var(--nexus-glass-border);
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 16px;
    transition: transform 0.2s ease;
}

.mistake-item:hover {
    transform: translate3d(0, -2px, 0);
}

.mistake-q {
    font-weight: 600;
    color: var(--nexus-text);
    margin-bottom: 12px;
    font-size: 1.05rem;
    font-family: var(--nexus-font-heading);
    line-height: 1.5;
}

.review-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.review-card-wrong {
    border-color: rgba(239, 68, 68, 0.3);
    border-left: 4px solid var(--nexus-rose);
    background: rgba(239, 68, 68, 0.04);
}

.review-card-correct {
    border-color: rgba(16, 185, 129, 0.3);
    border-left: 4px solid var(--nexus-emerald);
    background: rgba(16, 185, 129, 0.04);
}

.review-card-skipped {
    border-color: rgba(245, 158, 11, 0.3);
    border-left: 4px solid var(--nexus-amber);
    background: rgba(245, 158, 11, 0.04);
}

.review-line {
    font-size: 0.88rem;
    padding: 7px 12px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
}

.review-line-wrong {
    color: var(--nexus-rose);
    background: rgba(239, 68, 68, 0.12);
}

.review-line-correct {
    color: var(--nexus-emerald);
    background: rgba(16, 185, 129, 0.12);
}

.review-line-skipped {
    color: var(--nexus-amber);
    background: rgba(245, 158, 11, 0.12);
}

.mistake-ans {
    font-size: 0.9rem;
    color: var(--nexus-emerald);
    background: rgba(16, 185, 129, 0.1);
    padding: 8px 14px;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 8px;
    width: fit-content;
}

.ask-ai-btn {
    background: linear-gradient(135deg, var(--nexus-cyan), var(--nexus-purple));
    color: #ffffff;
    border: none;
    padding: 9px 18px;
    border-radius: 12px;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.25s var(--nexus-ease);
    width: fit-content;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.28);
}
.ask-ai-btn:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.45);
}

.btn-finish {
    background: var(--nexus-surface);
    color: var(--nexus-text);
    border: 1.5px solid var(--nexus-glass-border);
    padding: 15px 32px;
    border-radius: 16px;
    font-size: 1.02rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s var(--nexus-ease);
}
.btn-finish:hover {
    border-color: var(--nexus-cyan);
    color: var(--nexus-cyan);
    transform: translate3d(0, -2px, 0);
}

/* ==========================================================================
   10. MODALS (Exit Confirmation & AI Tutor)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 5, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

/* Exit Modal Card */
[data-theme="light"] .exit-modal-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12) !important;
    color: #0f172a !important;
}
[data-theme="light"] .exit-modal-card h3 {
    color: #0f172a !important;
}
[data-theme="light"] .exit-modal-card p {
    color: #64748b !important;
}

.exit-modal-card {
    background: #191210;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 36px 30px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    transform: scale(0.94);
    transition: transform 0.25s var(--nexus-ease);
}
.modal-overlay.active .exit-modal-card {
    transform: scale(1);
}

.exit-modal-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    color: var(--nexus-rose);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 18px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.exit-modal-card h3 {
    margin: 0 0 10px;
    font-size: 1.4rem;
    color: #f8fafc;
    font-family: var(--nexus-font-heading);
}

.exit-modal-card p {
    color: #cbd5e1;
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 26px;
}

.exit-modal-actions {
    display: flex;
    gap: 12px;
}

.btn-exit-cancel {
    flex: 1;
    background: #241a16;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    padding: 13px;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-exit-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-exit-confirm {
    flex: 1;
    background: var(--nexus-rose);
    border: none;
    color: #ffffff;
    padding: 13px;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}
.btn-exit-confirm:hover {
    opacity: 0.92;
}

/* AI Chat Modal */
.ai-chat-modal {
    width: min(96vw, 860px);
    max-width: 860px;
    height: 86vh;
    max-height: 840px;
    background: var(--ai-modal-bg, rgba(15, 23, 42, 0.95));
    border: 1px solid var(--ai-border, rgba(255, 255, 255, 0.12));
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px var(--ai-shadow, rgba(0, 0, 0, 0.4));
    padding: 0 !important;
}
@media (max-width: 600px) {
    .ai-chat-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 95dvh !important;
        max-height: 95dvh !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .ai-chat-modal .modal-header {
        padding: 12px 14px 10px 14px !important;
    }
    .ai-chat-modal .chat-container {
        padding: 8px 10px 12px 10px !important;
        gap: 10px !important;
    }
    .ai-chat-modal .input-bar {
        padding: 8px 10px 12px 10px !important;
    }
}

.ai-chat-modal .modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--ai-border, rgba(255, 255, 255, 0.08));
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ai-header-bg, #0f172a);
}

.ai-chat-modal .modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--ai-text, #ffffff);
    font-family: var(--nexus-font-heading);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-modal .chat-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--ai-chat-bg, #0b0f19);
}

.ai-chat-modal .input-bar {
    padding: 16px 20px;
    border-top: 1px solid var(--ai-border, rgba(255, 255, 255, 0.08));
    display: flex;
    gap: 12px;
    background: var(--ai-header-bg, #0f172a);
}

[data-theme="light"] .ai-chat-modal {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12) !important;
}
[data-theme="light"] .ai-chat-modal .modal-header {
    background: #f8fafc !important;
    border-bottom-color: #e2e8f0 !important;
}
[data-theme="light"] .ai-chat-modal .modal-header h2 {
    color: #0f172a !important;
}
[data-theme="light"] .ai-chat-modal .chat-container,
[data-theme="light"] .ai-chat-modal .ai-view,
[data-theme="light"] #ai-tutor-view,
[data-theme="light"] #tutor-chat-box {
    background: #f8fafc !important;
}
[data-theme="light"] .ai-chat-modal .input-bar textarea {
    color: #0f172a !important;
    background: transparent !important;
}
[data-theme="light"] .ai-chat-modal .input-bar {
    background: #ffffff !important;
    border-top-color: #e2e8f0 !important;
}

/* ==========================================================================
   11. MOBILE & RESPONSIVE DESIGN (First-Class)
   ========================================================================== */
@media screen and (max-width: 768px) {
    .quiz-app-bar {
        padding: 14px 16px 6px;
    }
    
    .quiz-container {
        padding: 22px 18px;
        margin: 6px 12px 30px;
        border-radius: 22px;
    }
    
    .quiz-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding-bottom: 16px;
        margin-bottom: 18px;
    }
    
    .header-left, .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .timer-box {
        font-size: 1.05rem;
        padding: 5px 12px;
    }
    
    .xp-display {
        font-size: 1.15rem;
        padding: 5px 12px;
    }
    
    .question-card {
        padding: 22px 18px;
        margin-bottom: 22px;
        border-radius: 16px;
    }
    
    #question-text {
        font-size: 1.15rem;
        line-height: 1.55;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 26px;
    }
    
    .option-btn {
        min-height: 60px;
        padding: 14px 16px;
        border-radius: 16px;
        gap: 14px;
    }
    
    .opt-label {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 0.95rem;
    }
    
    .opt-txt {
        font-size: 0.96rem;
    }
    
    .quiz-footer {
        flex-direction: column-reverse;
        gap: 12px;
        padding-top: 18px;
    }
    
    .btn-exit, .btn-next {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        border-radius: 14px;
    }
    
    .stats-container {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .mistakes-container {
        padding: 16px;
        border-radius: 18px;
    }
    
    .ask-ai-btn {
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }
    
    .chamber-card {
        padding: 30px 20px;
        border-radius: 26px;
    }
    
    .countdown-number {
        font-size: 2rem;
    }
}

@media screen and (max-width: 480px) {
    .btn-text-desktop {
        display: none;
    }
    .translate-btn {
        padding: 7px 10px;
    }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
