:root {
            --bg: #0c0f1a;
            --surface: #141826;
            --surface2: #1c2237;
            --surface3: #232b42;
            --border: rgba(255, 255, 255, 0.07);
            --accent: #f5a623;
            --accent2: #e84f4f;
            --accent3: #3ecf8e;
            --accent4: #5b8dee;
            --text: #e8ecf5;
            --text-secondary: #b0b8cc;
            --muted: #7a8299;
            --correct: #3ecf8e;
            --wrong: #e84f4f;
            --yellow: #f5a623;
            --purple: #a78bfa;
            --gold: #f5d060;
            --navbar-h: 72px;
            --radius-lg: 20px;
            --radius-md: 14px;
            --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.2);
            --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.25);
            --shadow-glow: 0 0 40px rgba(245, 166, 35, 0.15);
            --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
            --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        [data-theme="light"] {
            --bg: #f1f5f9;
            --surface: #ffffff;
            --surface2: #f8fafc;
            --surface3: #e2e8f0;
            --border: rgba(15, 23, 42, 0.1);
            --accent: #d97706;
            --accent2: #dc2626;
            --accent3: #059669;
            --accent4: #2563eb;
            --text: #0f172a;
            --text-secondary: #475569;
            --muted: #64748b;
            --correct: #059669;
            --wrong: #dc2626;
            --yellow: #d97706;
            --purple: #7c3aed;
            --gold: #ca8a04;
            --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.06);
            --shadow-md: 0 12px 40px rgba(15, 23, 42, 0.08);
            --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.1);
        }
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        body {
            font-family: 'Sora', sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            overflow-x: hidden;
            transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
        }
        body::before {
            content: '';
            position: fixed;
            inset: 0;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
            pointer-events: none;
            z-index: 0;
        }

        /* ─── Animated background mesh ─── */
        .bg-mesh {
            position: fixed;
            inset: 0;
            overflow: hidden;
            pointer-events: none;
            z-index: 0;
        }
        .bg-orb {
            position: absolute;
            border-radius: 50%;
            filter: blur(80px);
            opacity: 0.35;
            animation: orbFloat 18s ease-in-out infinite;
        }
        .bg-orb-1 {
            width: 500px;
            height: 500px;
            background: radial-gradient(circle, var(--accent4) 0%, transparent 70%);
            top: -10%;
            right: -5%;
            animation-delay: 0s;
        }
        .bg-orb-2 {
            width: 400px;
            height: 400px;
            background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
            bottom: 10%;
            left: -8%;
            animation-delay: -6s;
        }
        .bg-orb-3 {
            width: 350px;
            height: 350px;
            background: radial-gradient(circle, var(--accent3) 0%, transparent 70%);
            top: 40%;
            left: 50%;
            animation-delay: -12s;
        }
        [data-theme="light"] .bg-orb { opacity: 0.2; }

        @keyframes orbFloat {
            0%, 100% { transform: translate(0, 0) scale(1); }
            33% { transform: translate(30px, -20px) scale(1.05); }
            66% { transform: translate(-20px, 15px) scale(0.95); }
        }

        /* ─── Navbar ─── */
        .navbar {
            position: sticky;
            top: 0;
            z-index: 200;
            background: rgba(12, 15, 26, 0.75);
            backdrop-filter: blur(20px) saturate(1.4);
            -webkit-backdrop-filter: blur(20px) saturate(1.4);
            border-bottom: 1px solid var(--border);
            transition: background 0.4s var(--ease-out), box-shadow 0.3s var(--ease-out);
        }
        [data-theme="light"] .navbar {
            background: rgba(255, 255, 255, 0.82);
            box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06), var(--shadow-sm);
        }
        .navbar.scrolled {
            box-shadow: var(--shadow-md);
        }
        .navbar-inner {
            max-width: 1100px;
            margin: 0 auto;
            padding: 14px 28px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
        }
        .navbar-brand {
            display: flex;
            align-items: center;
            gap: 14px;
            text-decoration: none;
            color: inherit;
            transition: transform 0.25s var(--ease-spring);
        }
        .navbar-brand:hover {
            transform: translateX(2px);
        }
        .navbar-logo {
            width: 46px;
            height: 46px;
            background: linear-gradient(135deg, var(--accent), #e8760a);
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            box-shadow: 0 8px 24px rgba(245, 166, 35, 0.35);
            transition: transform 0.3s var(--ease-spring), box-shadow 0.3s;
        }
        .navbar-brand:hover .navbar-logo {
            transform: rotate(-4deg) scale(1.05);
            box-shadow: 0 12px 32px rgba(245, 166, 35, 0.45);
        }
        [data-theme="light"] .navbar-logo {
            background: linear-gradient(135deg, var(--accent4), #1d4ed8);
            box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
        }
        .navbar-brand-text {
            line-height: 1.25;
        }
        .navbar-brand-text strong {
            font-size: 15px;
            font-weight: 700;
            color: var(--text);
            display: block;
        }
        .brand-accent {
            background: linear-gradient(135deg, var(--accent), #e8760a);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        [data-theme="light"] .brand-accent {
            background: linear-gradient(135deg, var(--accent4), #1d4ed8);
            -webkit-background-clip: text;
            background-clip: text;
        }
        .navbar-brand-text span {
            font-size: 11px;
            color: var(--muted);
            display: block;
            margin-top: 2px;
        }
        .navbar-actions {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .navbar-progress {
            height: 3px;
            background: transparent;
            transition: width 0.5s var(--ease-out);
        }
        .navbar-progress.active {
            background: linear-gradient(90deg, var(--accent4), var(--accent));
            width: var(--progress, 0%);
        }

        /* Theme toggle */
        .theme-toggle {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 9px 18px;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: var(--surface2);
            color: var(--text);
            font-family: 'Sora', sans-serif;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s var(--ease-out);
            position: relative;
            overflow: hidden;
        }
        .theme-toggle::before {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, var(--accent4), var(--accent));
            opacity: 0;
            transition: opacity 0.3s;
        }
        .theme-toggle:hover {
            border-color: var(--accent4);
            transform: translateY(-2px);
            box-shadow: var(--shadow-sm);
        }
        .theme-toggle:hover::before { opacity: 0.08; }
        .theme-icon {
            font-size: 16px;
            line-height: 1;
            position: relative;
            z-index: 1;
            transition: transform 0.4s var(--ease-spring), opacity 0.3s;
        }
        .theme-icon-moon { display: none; }
        .theme-toggle.is-light .theme-icon-sun { display: none; }
        .theme-toggle.is-light .theme-icon-moon { display: inline; }
        .theme-label {
            position: relative;
            z-index: 1;
        }
        .theme-toggle.is-light {
            background: #1e293b;
            color: #f8fafc;
            border-color: #334155;
        }

        /* Legacy header aliases (keep compat) */
        .header { display: none; }
        .badge {
            padding: 7px 14px;
            border-radius: 999px;
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.6px;
            text-transform: uppercase;
            display: inline-flex;
            align-items: center;
            gap: 7px;
        }
        .badge-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--accent3);
            animation: badgePulse 2s ease-in-out infinite;
        }
        @keyframes badgePulse {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.6; transform: scale(0.85); }
        }
        .badge-cnsc {
            background: rgba(245, 166, 35, 0.12);
            color: var(--accent);
            border: 1px solid rgba(245, 166, 35, 0.28);
        }
        [data-theme="light"] .badge-cnsc {
            background: rgba(37, 99, 235, 0.08);
            color: var(--accent4);
            border-color: rgba(37, 99, 235, 0.2);
        }
        .main {
            max-width: 1000px;
            margin: 0 auto;
            padding: 40px 24px;
            position: relative;
            z-index: 1;
        }
        #welcomeScreen {
            animation: fadeInUp 0.7s var(--ease-out);
        }
        @keyframes fadeInUp {
            from { opacity: 0; transform: translateY(24px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .hero {
            text-align: center;
            padding: 48px 28px 40px;
            position: relative;
            border-radius: var(--radius-lg);
            background: linear-gradient(145deg, rgba(28, 34, 55, 0.6), rgba(20, 24, 38, 0.8));
            border: 1px solid var(--border);
            margin-bottom: 8px;
            overflow: hidden;
            backdrop-filter: blur(8px);
        }
        [data-theme="light"] .hero {
            background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(241, 245, 249, 0.9));
            border-color: rgba(15, 23, 42, 0.08);
            box-shadow: var(--shadow-md);
        }
        .hero::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -20%;
            width: 60%;
            height: 200%;
            background: radial-gradient(ellipse, rgba(91, 141, 238, 0.12) 0%, transparent 70%);
            pointer-events: none;
            animation: heroShine 8s ease-in-out infinite;
        }
        @keyframes heroShine {
            0%, 100% { transform: translateX(0) rotate(0deg); opacity: 0.6; }
            50% { transform: translateX(20px) rotate(2deg); opacity: 1; }
        }
        .hero-icon {
            width: 72px !important;
            height: 72px !important;
            background: linear-gradient(135deg, var(--accent), var(--accent3)) !important;
            border-radius: 20px !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            margin: 0 auto 24px auto !important;
            box-shadow: 0 16px 40px rgba(245, 166, 35, 0.3) !important;
            animation: float 4s ease-in-out infinite, iconGlow 3s ease-in-out infinite alternate !important;
            position: relative;
            z-index: 1;
        }
        @keyframes iconGlow {
            from { box-shadow: 0 16px 40px rgba(245, 166, 35, 0.25); }
            to { box-shadow: 0 20px 50px rgba(62, 207, 142, 0.35); }
        }
        .hero-flag {
            font-size: 56px;
            margin-bottom: 24px;
            filter: drop-shadow(0 0 30px rgba(245, 166, 35, 0.4));
            animation: float 3s ease-in-out infinite;
        }
        @keyframes float {
            0%,
            100% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-10px);
            }
        }
        .hero h1 {
            font-size: clamp(28px, 5vw, 48px);
            font-weight: 800;
            line-height: 1.15;
            margin-bottom: 16px;
            background: linear-gradient(135deg, #fff 0%, var(--accent) 50%, #e8760a 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            position: relative;
            z-index: 1;
            animation: fadeInUp 0.8s var(--ease-out) 0.1s both;
        }
        [data-theme="light"] .hero h1 {
            background: linear-gradient(135deg, #0f172a 0%, var(--accent4) 50%, #1d4ed8 100%);
            -webkit-background-clip: text;
            background-clip: text;
        }
        .hero p {
            font-size: 16px;
            color: var(--muted);
            max-width: 600px;
            margin: 0 auto 36px;
            line-height: 1.7;
            font-family: 'Lora', serif;
            position: relative;
            z-index: 1;
            animation: fadeInUp 0.8s var(--ease-out) 0.2s both;
        }
        .stats-row {
            display: flex;
            justify-content: center;
            gap: 20px;
            flex-wrap: wrap;
            margin-bottom: 48px;
        }
        .stat-card {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            padding: 20px 26px;
            text-align: center;
            min-width: 130px;
            transition: transform 0.35s var(--ease-spring), border-color 0.3s, box-shadow 0.3s;
            animation: fadeInUp 0.6s var(--ease-out) both;
        }
        .stat-card:nth-child(1) { animation-delay: 0.15s; }
        .stat-card:nth-child(2) { animation-delay: 0.25s; }
        .stat-card:nth-child(3) { animation-delay: 0.35s; }
        .stat-card:nth-child(4) { animation-delay: 0.45s; }
        .stat-card:hover {
            transform: translateY(-6px) scale(1.02);
            border-color: rgba(245, 166, 35, 0.35);
            box-shadow: var(--shadow-glow);
        }
        [data-theme="light"] .stat-card:hover {
            border-color: rgba(37, 99, 235, 0.3);
        }
        .stat-card .num {
            font-size: 28px;
            font-weight: 700;
            color: var(--accent);
        }
        .stat-card .lbl {
            font-size: 11px;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-top: 4px;
        }
        .mode-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 14px;
            margin-bottom: 36px;
        }
        .mode-card:nth-child(1) { animation: fadeInUp 0.5s var(--ease-out) 0.1s both; }
        .mode-card:nth-child(2) { animation: fadeInUp 0.5s var(--ease-out) 0.18s both; }
        .mode-card:nth-child(3) { animation: fadeInUp 0.5s var(--ease-out) 0.26s both; }
        .mode-card:nth-child(4) { animation: fadeInUp 0.5s var(--ease-out) 0.34s both; }
        .mode-card:nth-child(5) { animation: fadeInUp 0.5s var(--ease-out) 0.42s both; }
        .mode-card {
            background: var(--surface2);
            border: 2px solid var(--border);
            border-radius: var(--radius-md);
            padding: 22px;
            cursor: pointer;
            transition: all 0.35s var(--ease-spring);
            text-align: left;
            position: relative;
            overflow: hidden;
        }
        .mode-card::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, var(--accent4), var(--accent));
            opacity: 0;
            transition: opacity 0.35s;
            pointer-events: none;
        }
        .mode-card:hover {
            border-color: var(--accent4);
            transform: translateY(-5px) scale(1.01);
            box-shadow: var(--shadow-md);
        }
        .mode-card:hover::after { opacity: 0.04; }
        .mode-card.selected {
            border-color: var(--accent);
            background: rgba(245, 166, 35, 0.08);
            box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.2), var(--shadow-glow);
        }
        [data-theme="light"] .mode-card.selected {
            background: rgba(37, 99, 235, 0.06);
            border-color: var(--accent4);
            box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
        }
        .mode-card .mode-icon,
        .mode-card .mode-title,
        .mode-card .mode-desc,
        .mode-card .mode-meta {
            position: relative;
            z-index: 1;
        }
        .mode-card .mode-icon {
            font-size: 26px;
            margin-bottom: 10px;
        }
        .mode-card .mode-title {
            font-size: 14px;
            font-weight: 700;
            margin-bottom: 5px;
        }
        .mode-card .mode-desc {
            font-size: 11px;
            color: var(--muted);
            line-height: 1.5;
        }
        .mode-card .mode-meta {
            margin-top: 12px;
            font-size: 10px;
            color: var(--accent);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .cat-section {
            margin-bottom: 36px;
        }
        .cat-section h3 {
            font-size: 13px;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--muted);
            margin-bottom: 14px;
        }
        .cat-pills {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }
        .cat-pill {
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            border: 1.5px solid transparent;
            cursor: pointer;
            transition: all 0.2s;
            background: var(--surface3);
            color: var(--muted);
        }
        .cat-pill:hover {
            color: var(--text);
            border-color: var(--border);
        }
        .cat-pill.active {
            background: rgba(91, 141, 238, 0.15);
            color: var(--accent4);
            border-color: rgba(91, 141, 238, 0.4);
        }
        .btn {
            padding: 14px 32px;
            border-radius: 12px;
            border: none;
            cursor: pointer;
            font-family: 'Sora', sans-serif;
            font-size: 15px;
            font-weight: 600;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 10px;
        }
        .btn-primary {
            background: linear-gradient(135deg, var(--accent), #e8760a);
            color: #0c0f1a;
            box-shadow: 0 8px 24px rgba(245, 166, 35, 0.3);
            position: relative;
            overflow: hidden;
        }
        .btn-primary::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
            transform: translateX(-100%);
            transition: transform 0.5s;
        }
        .btn-primary:hover::after {
            transform: translateX(100%);
        }
        [data-theme="light"] .btn-primary {
            color: #fff;
            background: linear-gradient(135deg, var(--accent4), #1d4ed8);
            box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
        }
        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 12px 32px rgba(245, 166, 35, 0.4);
        }
        .btn-secondary {
            background: var(--surface3);
            color: var(--text);
            border: 1px solid var(--border);
        }
        .btn-secondary:hover {
            border-color: var(--muted);
        }
        .btn-sm {
            padding: 9px 20px;
            font-size: 13px;
            border-radius: 9px;
        }
        .btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none !important;
        }
        .btn-row {
            display: flex;
            gap: 12px;
            justify-content: center;
            flex-wrap: wrap;
        }
        #quizScreen {
            display: none;
            animation: fadeIn 0.4s ease;
        }
        #fullViewScreen {
            display: none;
            animation: fadeIn 0.4s ease;
        }
        .progress-bar-track {
            height: 4px;
            background: var(--surface2);
            border-radius: 2px;
            overflow: hidden;
            margin-bottom: 28px;
        }
        .progress-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent4), var(--accent));
            border-radius: 2px;
            transition: width 0.5s ease;
        }
        .quiz-meta {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 24px;
            flex-wrap: wrap;
            gap: 12px;
        }
        .quiz-counter {
            font-size: 13px;
            color: var(--muted);
        }
        .quiz-counter strong {
            color: var(--text);
        }
        .quiz-cat-badge {
            padding: 5px 12px;
            border-radius: 8px;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .timer-display {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 16px;
            font-weight: 700;
            font-variant-numeric: tabular-nums;
        }
        .timer-display.warning {
            color: var(--wrong);
            animation: pulse 1s ease-in-out infinite;
        }
        @keyframes pulse {
            0%,
            100% {
                opacity: 1;
            }
            50% {
                opacity: 0.5;
            }
        }
        .question-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 20px;
            padding: 36px;
            margin-bottom: 20px;
            position: relative;
            overflow: hidden;
            animation: slideIn 0.35s ease;
        }
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(16px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        .question-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, var(--accent4), var(--accent));
        }
        .context-block {
            background: var(--surface2);
            border-left: 3px solid var(--accent4);
            border-radius: 0 12px 12px 0;
            padding: 18px 20px;
            margin-bottom: 24px;
            font-family: 'Lora', serif;
            font-size: 14px;
            line-height: 1.8;
            color: var(--text-secondary);
            font-style: italic;
        }
        .context-label {
            font-family: 'Sora', sans-serif;
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--accent4);
            margin-bottom: 10px;
            font-style: normal;
        }
        .question-text {
            font-size: 16px;
            line-height: 1.75;
            color: var(--text);
            margin-bottom: 28px;
            font-family: 'Lora', serif;
        }
        .question-text strong {
            font-family: 'Sora', sans-serif;
            color: var(--gold);
            font-size: 14px;
        }
        .options {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .option {
            background: var(--surface2);
            border: 1.5px solid var(--border);
            border-radius: 14px;
            padding: 16px 20px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: flex-start;
            gap: 14px;
            font-size: 14px;
            line-height: 1.65;
            color: var(--text);
            position: relative;
            overflow: hidden;
        }
        .option:hover:not(.locked) {
            border-color: var(--accent4);
            background: rgba(91, 141, 238, 0.08);
            transform: translateX(4px);
        }
        .option.selected {
            border-color: var(--accent4);
            background: rgba(91, 141, 238, 0.12);
        }
        .option.correct {
            border-color: var(--correct) !important;
            background: rgba(62, 207, 142, 0.1) !important;
        }
        .option.wrong {
            border-color: var(--wrong) !important;
            background: rgba(232, 79, 79, 0.1) !important;
        }
        .option.locked {
            cursor: default;
        }
        .option-letter {
            width: 28px;
            height: 28px;
            min-width: 28px;
            border-radius: 8px;
            background: var(--surface3);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: 700;
            color: var(--muted);
            border: 1px solid var(--border);
            transition: all 0.2s;
            font-family: 'Sora', sans-serif;
        }
        .option.selected .option-letter {
            background: var(--accent4);
            color: white;
            border-color: var(--accent4);
        }
        .option.correct .option-letter {
            background: var(--correct);
            color: white;
            border-color: var(--correct);
        }
        .option.wrong .option-letter {
            background: var(--wrong);
            color: white;
            border-color: var(--wrong);
        }
        .explanation-box {
            margin-top: 20px;
            background: var(--surface2);
            border-radius: 14px;
            padding: 24px;
            border-left: 4px solid var(--correct);
            animation: fadeIn 0.4s ease;
        }
        .explanation-box.wrong-exp {
            border-left-color: var(--accent);
        }
        .explanation-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 14px;
        }
        .explanation-header span {
            font-size: 13px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .explanation-body {
            font-size: 14px;
            line-height: 1.8;
            color: var(--text-secondary);
            font-family: 'Lora', serif;
        }
        .law-ref {
            display: inline-block;
            background: rgba(245, 166, 35, 0.1);
            color: var(--accent);
            border: 1px solid rgba(245, 166, 35, 0.3);
            border-radius: 6px;
            padding: 2px 8px;
            font-size: 12px;
            font-family: 'Sora', sans-serif;
            font-weight: 600;
            margin: 2px;
            vertical-align: middle;
        }
        .quiz-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 24px;
            flex-wrap: wrap;
            gap: 12px;
        }
        #resultsScreen {
            display: none;
            animation: fadeIn 0.5s ease;
        }
        .results-hero {
            text-align: center;
            padding: 48px 20px 36px;
        }
        .score-circle {
            width: 160px;
            height: 160px;
            border-radius: 50%;
            margin: 0 auto 28px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-weight: 800;
            position: relative;
            background: conic-gradient(var(--accent) calc(var(--pct) * 3.6deg), var(--surface3) 0deg);
            box-shadow: 0 0 60px rgba(245, 166, 35, 0.25);
            animation: scoreReveal 1.2s var(--ease-out);
        }
        @keyframes scoreReveal {
            from { transform: scale(0.8); opacity: 0; }
            to { transform: scale(1); opacity: 1; }
        }
        .score-circle::before {
            content: '';
            position: absolute;
            inset: 10px;
            border-radius: 50%;
            background: var(--bg);
        }
        .score-inner {
            position: relative;
            z-index: 1;
            text-align: center;
        }
        .score-pct {
            font-size: 38px;
            color: var(--accent);
        }
        .score-lbl {
            font-size: 11px;
            color: var(--muted);
            margin-top: 2px;
        }
        .result-title {
            font-size: 26px;
            font-weight: 800;
            margin-bottom: 10px;
        }
        .result-sub {
            color: var(--muted);
            font-size: 15px;
            font-family: 'Lora', serif;
        }
        .metrics-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 14px;
            margin: 36px 0;
        }
        .metric-card {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 20px;
            text-align: center;
            transition: transform 0.2s;
        }
        .metric-card:hover {
            transform: translateY(-3px);
        }
        .metric-name {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--muted);
            margin-bottom: 10px;
        }
        .metric-score {
            font-size: 22px;
            font-weight: 700;
            margin-bottom: 8px;
        }
        .metric-bar {
            height: 6px;
            background: var(--surface3);
            border-radius: 3px;
            overflow: hidden;
        }
        .metric-bar-fill {
            height: 100%;
            border-radius: 3px;
            transition: width 1s ease 0.3s;
        }
        .review-section {
            margin-top: 40px;
        }
        .review-section h2 {
            font-size: 20px;
            font-weight: 700;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .review-item {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 24px;
            margin-bottom: 16px;
            border-left: 4px solid var(--surface3);
        }
        .review-item.correct-item {
            border-left-color: var(--correct);
        }
        .review-item.wrong-item {
            border-left-color: var(--wrong);
        }
        .review-q {
            font-size: 14px;
            font-family: 'Lora', serif;
            line-height: 1.7;
            color: var(--text);
            margin-bottom: 14px;
        }
        .review-answers {
            font-size: 13px;
            color: var(--muted);
        }
        .review-answers .r-correct {
            color: var(--correct);
            font-weight: 600;
        }
        .review-answers .r-wrong {
            color: var(--wrong);
        }
        .review-exp {
            font-size: 13px;
            color: var(--text-secondary);
            margin-top: 12px;
            line-height: 1.7;
            font-family: 'Lora', serif;
        }
        .modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.75);
            z-index: 200;
            backdrop-filter: blur(4px);
            align-items: center;
            justify-content: center;
        }
        .modal-overlay.open {
            display: flex;
        }
        .modal {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 20px;
            padding: 36px;
            max-width: 560px;
            width: 90%;
            max-height: 85vh;
            overflow-y: auto;
            animation: slideIn 0.3s ease;
            position: relative;
        }
        .modal h2 {
            font-size: 20px;
            font-weight: 700;
            margin-bottom: 8px;
        }
        .modal p {
            font-size: 14px;
            color: var(--muted);
            margin-bottom: 20px;
            font-family: 'Lora', serif;
            line-height: 1.7;
        }
        .modal-close {
            position: absolute;
            top: 16px;
            right: 16px;
            width: 32px;
            height: 32px;
            border-radius: 8px;
            background: var(--surface2);
            border: none;
            cursor: pointer;
            color: var(--muted);
            font-size: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .modal-close:hover {
            color: var(--text);
        }
        .form-group {
            margin-bottom: 16px;
        }
        .form-label {
            font-size: 12px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--muted);
            margin-bottom: 8px;
            display: block;
        }
        .form-select,
        .form-input {
            width: 100%;
            background: var(--surface2);
            border: 1.5px solid var(--border);
            border-radius: 10px;
            padding: 11px 14px;
            color: var(--text);
            font-family: 'Sora', sans-serif;
            font-size: 14px;
            outline: none;
            transition: border-color 0.2s;
        }
        .form-select:focus,
        .form-input:focus {
            border-color: var(--accent4);
        }
        .spinner {
            width: 44px;
            height: 44px;
            border: 3px solid var(--surface3);
            border-top-color: var(--accent4);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            margin: 0 auto 16px;
        }
        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }
        @keyframes fadeIn {
            from {
                opacity: 0;
            }
            to {
                opacity: 1;
            }
        }
        .cat-pedagogica {
            background: rgba(91, 141, 238, 0.12);
            color: var(--accent4);
        }
        .cat-normativa {
            background: rgba(245, 166, 35, 0.12);
            color: var(--accent);
        }
        .cat-inclusion {
            background: rgba(62, 207, 142, 0.12);
            color: var(--correct);
        }
        .cat-convivencia {
            background: rgba(167, 139, 250, 0.12);
            color: var(--purple);
        }
        .cat-disciplinar {
            background: rgba(232, 79, 79, 0.12);
            color: var(--accent2);
        }
        .cat-evaluacion {
            background: rgba(245, 208, 96, 0.12);
            color: var(--gold);
        }
        .cat-situacional {
            background: rgba(255, 100, 160, 0.12);
            color: #ff64a0;
        }
        .level-elite {
            color: var(--gold);
        }
        .level-alto {
            color: var(--correct);
        }
        .level-medio {
            color: var(--accent4);
        }
        .level-bajo {
            color: var(--wrong);
        }

        /* Full View Styles */
        .full-view-grid {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        .full-view-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 24px;
            transition: border-color 0.3s;
            scroll-margin-top: 100px;
        }
        .full-view-card.completed-correct {
            border-left: 4px solid var(--correct);
        }
        .full-view-card.completed-wrong {
            border-left: 4px solid var(--wrong);
        }
        .full-view-card .fv-qnum {
            font-size: 11px;
            color: var(--accent4);
            font-weight: 700;
            letter-spacing: 1px;
            margin-bottom: 8px;
        }
        .full-view-card .fv-question {
            font-family: 'Lora', serif;
            font-size: 14px;
            line-height: 1.7;
            margin-bottom: 16px;
        }
        .fv-context-block {
            background: var(--surface2);
            border-left: 3px solid var(--accent4);
            border-radius: 0 8px 8px 0;
            padding: 12px 14px;
            margin-bottom: 12px;
            font-family: 'Lora', serif;
            font-size: 13px;
            line-height: 1.7;
            color: var(--text-secondary);
            font-style: italic;
        }
        .fv-context-label {
            font-family: 'Sora', sans-serif;
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--accent4);
            font-style: normal;
            display: block;
            margin-bottom: 6px;
        }
        .full-view-card .fv-options {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .fv-opt {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 12px 16px;
            cursor: pointer;
            font-size: 13px;
            line-height: 1.5;
            transition: all 0.15s;
            display: flex;
            align-items: flex-start;
            gap: 10px;
        }
        .fv-opt:hover {
            border-color: var(--accent4);
            background: rgba(91, 141, 238, 0.06);
        }
        .fv-opt.fv-selected {
            border-color: var(--accent4);
            background: rgba(91, 141, 238, 0.12);
        }
        .fv-opt.fv-correct {
            border-color: var(--correct) !important;
            background: rgba(62, 207, 142, 0.1) !important;
        }
        .fv-opt.fv-wrong {
            border-color: var(--wrong) !important;
            background: rgba(232, 79, 79, 0.1) !important;
        }
        .fv-opt-letter {
            width: 24px;
            height: 24px;
            min-width: 24px;
            border-radius: 6px;
            background: var(--surface3);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            font-weight: 700;
            color: var(--muted);
            border: 1px solid var(--border);
        }
        .fv-opt.fv-selected .fv-opt-letter {
            background: var(--accent4);
            color: white;
            border-color: var(--accent4);
        }
        .fv-opt.fv-correct .fv-opt-letter {
            background: var(--correct);
            color: white;
            border-color: var(--correct);
        }
        .fv-opt.fv-wrong .fv-opt-letter {
            background: var(--wrong);
            color: white;
            border-color: var(--wrong);
        }
        .fv-explanation {
            margin-top: 12px;
            padding: 14px;
            background: var(--surface2);
            border-radius: 10px;
            font-size: 13px;
            line-height: 1.7;
            color: var(--text-secondary);
            display: none;
        }
        .fv-explanation.show {
            display: block;
        }
        .fv-nav {
            position: sticky;
            top: calc(var(--navbar-h) + 8px);
            z-index: 50;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            padding: 12px 16px;
            margin-bottom: 24px;
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            align-items: center;
            justify-content: space-between;
            backdrop-filter: blur(12px);
            box-shadow: var(--shadow-sm);
        }
        .fv-nav-dot {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            background: var(--surface3);
            border: 1px solid var(--border);
            font-size: 10px;
            cursor: pointer;
            color: var(--muted);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            transition: all 0.2s;
        }
        .fv-nav-dot.answered {
            background: var(--accent4);
            color: white;
            border-color: var(--accent4);
        }
        @media(max-width:600px) {
            .navbar-inner {
                padding: 12px 16px;
            }
            .navbar-brand-text span { display: none; }
            .theme-label { display: none; }
            .theme-toggle { padding: 9px 12px; }
            .badge-cnsc { display: none; }
            .main {
                padding: 24px 14px;
            }
            .question-card {
                padding: 22px 18px;
            }
            .stats-row {
                gap: 12px;
            }
            .fv-nav {
                gap: 4px;
                padding: 8px 10px;
            }
            .fv-nav-dot {
                width: 22px;
                height: 22px;
                font-size: 9px;
            }
            .hero { padding: 32px 18px 28px; }
        }
        ::-webkit-scrollbar {
            width: 6px;
        }
        ::-webkit-scrollbar-track {
            background: var(--bg);
        }
        ::-webkit-scrollbar-thumb {
            background: var(--surface3);
            border-radius: 3px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--muted);
        }

/* Correcciones tipográficas solicitadas */
.question-text, .fv-question {
    font-style: normal !important;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    color: var(--text) !important;
    margin-bottom: 24px !important;
    line-height: 1.6 !important;
    font-family: 'Sora', sans-serif !important;
}

/* Animaciones modernas — cards y opciones */
.mode-card, .option, .stat-card, .metric-card, .full-view-card {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.option:hover:not(.locked) {
    transform: translateX(6px) scale(1.005);
}

/* Modo claro — componentes adicionales */
[data-theme="light"] .question-card,
[data-theme="light"] .full-view-card,
[data-theme="light"] .review-item,
[data-theme="light"] .modal {
    box-shadow: var(--shadow-sm);
}
[data-theme="light"] .mode-card,
[data-theme="light"] .option,
[data-theme="light"] .fv-opt {
    background: var(--surface);
}
[data-theme="light"] .mode-card:hover,
[data-theme="light"] .option:hover:not(.locked),
[data-theme="light"] .fv-opt:hover {
    background: var(--surface2);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
}
[data-theme="light"] .cat-pill {
    background: var(--surface);
    border: 1px solid var(--border);
}
[data-theme="light"] .cat-pill.active {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.35);
}
[data-theme="light"] .btn-secondary {
    background: var(--surface);
}
[data-theme="light"] .progress-bar-track {
    background: var(--surface3);
}
[data-theme="light"] .score-circle::before {
    background: var(--bg);
}
[data-theme="light"] .modal-overlay {
    background: rgba(15, 23, 42, 0.5);
}

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