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

        /* Editorial headline font */
        .study-page h1, .study-page h2, .review-title, .detail-title, .module-title,
        .sets-header h2, .review-landing-section-title {
            font-family: 'Manrope', 'Inter', sans-serif;
            letter-spacing: -0.01em;
        }

        :root {
            --study-bg: #0a0a0a;
            --study-bg-secondary: #141414;
            --study-bg-tertiary: rgba(255,255,255,0.05);
            --study-bg-card: #1a1a1a;
            --study-text: #e5e5e5;
            --study-text-secondary: rgba(255,255,255,0.7);
            --study-text-tertiary: rgba(255,255,255,0.4);
            --study-accent: #3b82f6;
            --study-accent-hover: #2563eb;
            --study-accent-dim: rgba(59,130,246,0.15);
            --study-border: rgba(255,255,255,0.08);
            --study-border-light: rgba(255,255,255,0.15);
            --study-radius: 12px;
            --study-green: #22c55e;
            --study-red: #ef4444;
            --study-blue: #3b82f6;
            --safe-bottom: env(safe-area-inset-bottom, 0px);
            --sidebar-w: 260px;
            --sidebar-bg: #060606;
            --right-sidebar-w: 480px;
            --study-hero-start: #3d3d3d;
            --study-hero-mid: #5a4a3a;
            --study-hero-end: #c4703a;
        }

        /* Global color scheme → study variable bridge */
        body[data-scheme] {
            --study-bg: var(--bg-base) !important; --study-bg-secondary: var(--bg-card, var(--bg-raised)) !important;
            --study-bg-tertiary: var(--bg-elevated) !important; --study-bg-card: var(--bg-card, var(--bg-raised)) !important;
            --study-text: var(--text-primary) !important; --study-text-secondary: var(--text-secondary) !important;
            --study-text-tertiary: var(--text-tertiary) !important;
            --study-accent: var(--accent-amber) !important; --study-accent-hover: var(--accent-orange) !important;
            --study-accent-dim: var(--glow-amber) !important;
            --study-accent-text: var(--bg-base) !important;
            --study-border: var(--border-subtle) !important; --study-border-light: var(--border-default) !important;
        }
        /* Light mode white cards handled by --bg-card from shared-nav.js (applies to ALL light themes) */
        /* Fix accent-colored buttons: amber accent needs dark text, not white */
        body[data-scheme] .klm-send-btn,
        body[data-scheme] .klm-quiz-submit,
        body[data-scheme] .klm-research-import,
        body[data-scheme] .klm-prompt-ok,
        body[data-scheme] .over-limit-btn-primary,
        body[data-scheme] .suggest-cards-btn.suggest-yes,
        body[data-scheme] .exam-start-btn,
        body[data-scheme] .exam-submit-btn,
        body[data-scheme] .exam-results-btn.primary,
        body[data-scheme] .exam-areas-btn,
        body[data-scheme] .sg-task-submit,
        body[data-scheme] .sg-task-complete-btn,
        body[data-scheme] .sg2-lesson-action.is-primary,
        body[data-scheme] .sg2-module-recommended,
        body[data-scheme] .wt-submit,
        body[data-scheme] .fib-check,
        body[data-scheme] .hero-filter-btn.active,
        body[data-scheme] .btn-accent,
        body[data-scheme] .review-set-action.primary,
        body[data-scheme] #askAiFloat,
        body[data-scheme] #klmCreateDoneBtn,
        body[data-scheme] #klmCreateImportResearch { color: var(--bg-base) !important; }
        /* Noise texture overlay for all accent buttons */
        .sg-task-submit, .sg-task-complete-btn, .sg2-lesson-action.is-primary,
        .wt-submit, .fib-check, .hero-filter-btn.active, .exam-start-btn,
        .exam-submit-btn, .sg2-module-recommended, .review-set-action.primary { position: relative; overflow: hidden; isolation: isolate; }
        .sg-task-submit::after, .sg-task-complete-btn::after, .sg2-lesson-action.is-primary::after,
        .wt-submit::after, .fib-check::after, .hero-filter-btn.active::after, .exam-start-btn::after,
        .exam-submit-btn::after, .sg2-module-recommended::after, .review-set-action.primary::after {
            content: ''; position: absolute; inset: 0; background: url('/images/noise.png') repeat;
            background-size: 128px 128px; border-radius: inherit; pointer-events: none; z-index: 1;
            mix-blend-mode: overlay; opacity: 0.6;
        }
        body[data-scheme] .study-sidebar { --sidebar-bg: var(--bg-raised); background: var(--sidebar-bg) !important; border-right: none !important; }
        body[data-scheme="github"] .study-sidebar { background: linear-gradient(180deg, #ffffff 0%, #f0f4f8 40%, #dce6f0 100%) !important; }
        body[data-scheme] .study-main,
        body[data-scheme] .study-layout { background: var(--bg-base) !important; color: var(--text-primary) !important; }
        body[data-scheme] .mobile-nav-inner { background: var(--bg-base) !important; border-top-color: var(--border-subtle) !important; }
        body[data-scheme] .mobile-nav-btn { color: var(--text-muted) !important; }
        body[data-scheme] .mobile-nav-btn.active { color: var(--accent-amber) !important; background: var(--glow-amber) !important; }
        /* Override shared-nav.js global input/textarea/select glass backgrounds */
        body[data-scheme] .study-layout input,
        body[data-scheme] .study-layout textarea,
        body[data-scheme] .study-layout select,
        body[data-scheme] .study-sidebar input,
        body[data-scheme] .study-sidebar textarea,
        body[data-scheme] .study-sidebar select { background: transparent !important; }

        html, body { height: 100%; overflow: hidden; font-family: 'Inter', -apple-system, sans-serif; }

        /* Hide shared site sidebar/nav — study has its own */
        #khio-sidebar, .khio-sidebar, #khio-mobile-nav>.khio-hamburger, .khio-hamburger, #khio-pwa-tabbar { display: none !important; }
        .app-layout { display: block !important; }

        .study-layout { display: flex; height: 100vh; height: 100dvh; background: var(--study-bg); color: var(--study-text); }

        .study-main {
            flex: 1; display: flex; flex-direction: column; position: relative;
            height: 100vh; height: 100dvh; min-width: 0; background: var(--study-bg); color: var(--study-text);
        }
        /* Global background (reuses Focus bg) */
        .study-bg { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center; background-repeat: no-repeat; display: none; }
        .study-bg video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
        .study-bg-overlay { position: absolute; inset: 0; z-index: 1; background: rgba(0,0,0,0.45); pointer-events: none; display: none; }
        .study-bg-active .study-bg, .study-bg-active .study-bg-overlay { display: block; }
        .study-bg-active .study-main { background: transparent; }
        .study-bg-active .study-view { position: relative; z-index: 2; }
        .study-bg-active .study-sidebar { background: rgba(6,6,6,0.82) !important; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
        /* Glass cards when bg is active (dark) */
        .study-bg-active .set-card,
        .study-bg-active .grade-tab-content,
        .study-bg-active .detail-topbar,
        .study-bg-active .sb-widget,
        .study-bg-active .action-card,
        .study-bg-active .grade-tabs,
        .study-bg-active .grade-card { background: rgba(20,20,20,0.55) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-color: rgba(255,255,255,0.1) !important; }
        .study-bg-active .humanizer-split { background: rgba(20,20,20,0.55) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-color: rgba(255,255,255,0.1) !important; }
        .study-bg-active .humanizer-panel { background: transparent !important; border-color: rgba(255,255,255,0.08) !important; backdrop-filter: none; }
        .study-bg-active .hero-section { background: rgba(20,20,20,0.5) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.08) !important; border-radius: 20px; }
        .study-bg-active .dashboard-main,
        .study-bg-active .dashboard-layout { background: transparent !important; }
        .study-bg-active .sets-section { background: transparent !important; }
        .study-bg-active .humanizer-textarea,
        .study-bg-active .humanizer-output,
        .study-bg-active .humanizer-toolbar,
        .study-bg-active .humanizer-result-toolbar { background: rgba(10,10,10,0.45) !important; border-color: rgba(255,255,255,0.08) !important; }
        .study-bg-active .focus-timer-card { background: rgba(20,20,20,0.5) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-color: rgba(255,255,255,0.1) !important; }
        .study-bg-active .klm-topbar { background: rgba(10,10,10,0.6) !important; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-color: rgba(255,255,255,0.08) !important; }
        /* Glass — light theme overrides */
        [data-theme="light"].study-bg-active .study-sidebar { background: rgba(235,237,241,0.82) !important; }
        [data-theme="light"].study-bg-active .set-card,
        [data-theme="light"].study-bg-active .grade-tab-content,
        [data-theme="light"].study-bg-active .humanizer-split,
        [data-theme="light"].study-bg-active .sb-widget,
        [data-theme="light"].study-bg-active .action-card,
        [data-theme="light"].study-bg-active .grade-tabs,
        [data-theme="light"].study-bg-active .grade-card,
        [data-theme="light"].study-bg-active .hero-section { background: rgba(255,255,255,0.6) !important; }
        [data-theme="light"].study-bg-active .humanizer-panel { background: transparent !important; }

        /* ── Study Sidebar ── */
        .study-sidebar {
            width: var(--sidebar-w); background: var(--sidebar-bg, #060606); border-right: none;
            display: flex; flex-direction: column; flex-shrink: 0; z-index: 50;
            transition: width 0.2s ease;
        }
        .sidebar-brand-wrap { display: flex; flex-direction: row; align-items: center; justify-content: space-between; padding: 28px 20px 28px; border-bottom: 1px solid var(--study-border, rgba(255,255,255,0.06)); margin-bottom: 8px; }
        .sidebar-brand { padding: 0; display: flex; align-items: flex-start; gap: 10px; }
        .sidebar-back-link { display: flex; align-items: center; gap: 5px; padding: 0 16px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--study-text-tertiary); text-decoration: none; transition: color .15s; }
        .sidebar-back-link:hover { color: var(--study-text-secondary); }
        .sidebar-back-link i { width: 11px; height: 11px; }
        .sidebar-brand-text-wrap { display: flex; flex-direction: column; line-height: 1.15; }
        .sidebar-brand-text { font-size: 20px; font-weight: 800; color: var(--study-accent); font-family: 'Manrope', 'Inter', sans-serif; }
        .sidebar-brand-sub { font-size: 9px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--study-text-tertiary); margin-top: 4px; }
        .sidebar-nav { flex: 1; padding: 16px 14px 4px; }
        .sidebar-nav-group { display: flex; flex-direction: column; gap: 4px; }
        .nav-link {
            display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 10px;
            color: var(--study-text-secondary); font-size: 14px; font-weight: 600; cursor: pointer;
            transition: all 0.15s; text-decoration: none; border: none; border-left: 3px solid transparent; background: none; font-family: inherit; width: 100%; text-align: left;
        }
        .nav-link:hover { background: var(--study-bg-tertiary); color: var(--study-text); }
        .nav-link.active { background: var(--study-accent-dim, rgba(255,255,255,0.06)); color: var(--study-accent); border-left-color: var(--study-accent); font-weight: 700; }
        .nav-link i { width: 20px; height: 20px; flex-shrink: 0; }
        .material-symbols-outlined { font-family: 'Material Symbols Outlined' !important; font-weight: normal; font-style: normal; font-size: 24px; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; word-wrap: normal; direction: ltr; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-feature-settings: 'liga'; }
        .nav-mat-icon { font-size: 22px !important; flex-shrink: 0; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
        .nav-link.active .nav-mat-icon { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
        .nav-link-back { color: var(--study-text-tertiary); font-size: 13px; margin-bottom: 8px; padding: 8px 12px; }
        .nav-link-back:hover { color: var(--study-text); }
        .sidebar-divider { height: 1px; background: var(--study-border); margin: 8px 12px; }
        .sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--study-border); display: flex; flex-direction: column; gap: 8px; }
        .sidebar-footer .user-card { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 92%, #fff), var(--study-accent), color-mix(in srgb, var(--study-accent) 88%, #000)); border: none; text-decoration: none; color: var(--bg-base, #fff); cursor: pointer; transition: all 0.2s; box-shadow: 0 2px 8px rgba(0,0,0,0.12); position: relative; overflow: hidden; isolation: isolate; }
        .sidebar-footer .user-card::after { content: ''; position: absolute; inset: 0; background: url('/images/noise.png') repeat; background-size: 128px 128px; border-radius: inherit; pointer-events: none; z-index: 1; mix-blend-mode: overlay; opacity: 0.6; }
        .sidebar-footer .user-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.18); filter: brightness(1.04); }
        .sidebar-footer .user-name { flex: 1; font-size: 0.8125rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; }
        .sidebar-footer .sidebar-footer-back-card { justify-content: center; gap: 8px; font-weight: 700; }
        .sidebar-footer .sidebar-footer-back-card i { width: 15px; height: 15px; color: var(--study-text-secondary); }
        .sidebar-footer .user-badge { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: transparent; color: inherit; opacity: 0.85; }
        .sidebar-footer .user-badge i { width: 15px; height: 15px; }
        .study-layout:not(.detail-active) .sidebar-footer .user-card { justify-content: space-between; padding: 12px 16px; }
        .study-layout:not(.detail-active) .sidebar-footer .user-name { flex: 0 1 auto; }
        .sidebar-footer-row { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
        .sidebar-footer-row .study-token-track { flex: 1; height: 4px; border-radius: 2px; background: var(--study-border); overflow: hidden; }
        .sidebar-footer-row .study-token-fill { height: 100%; border-radius: 2px; background: var(--study-accent); transition: width 0.3s; }
        .sidebar-footer-row .study-token-label { font-size: 0.6875rem; font-weight: 600; color: var(--study-text-tertiary); white-space: nowrap; }
        .sidebar-footer-gear { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--study-text-tertiary); cursor: pointer; transition: all 0.15s; flex-shrink: 0; }
        .sidebar-footer-gear:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .sidebar-footer-gear i { width: 14px; height: 14px; }

        /* ── Sidebar Widgets (Streak + Exams) ── */
        .sidebar-widgets {
            padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 10px;
            border-top: 1px solid var(--study-border);
        }
        .sb-widget {
            background: var(--study-bg-tertiary);
            border: 1.5px solid var(--study-border); border-left: 4px solid var(--study-accent);
            border-radius: 10px; padding: 12px; position: relative; overflow: hidden;
            box-shadow: 3px 3px 0 var(--study-accent-dim, rgba(0,0,0,0.3));
            transition: all 0.15s;
        }
        .sb-widget:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(232,133,58,0.2); }
        .sb-widget::before {
            content: ''; position: absolute; top: 0; left: 0; width: 0; height: 0;
            display: none;
        }
        .sb-widget-title {
            font-size: 9px; font-weight: 800; text-transform: uppercase;
            letter-spacing: .08em; color: var(--study-text-tertiary); margin-bottom: 10px;
            display: flex; align-items: center; gap: 5px;
        }
        .sb-widget-title i { width: 12px; height: 12px; opacity: 0.7; }
        .sb-streak-row {
            display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
        }
        .sb-streak-fire { font-size: 24px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(232,133,58,0.4)); }
        .sb-streak-count {
            font-size: 22px; font-weight: 900; color: var(--study-accent); line-height: 1; cursor: pointer;
            text-shadow: 0 0 20px rgba(232,133,58,0.3);
        }
        .sb-streak-label { font-size: 10px; font-weight: 600; color: var(--study-text-tertiary); margin-top: 2px; }
        .sb-streak-days { display: flex; gap: 3px; justify-content: space-between; }
        .sb-streak-day {
            flex: 1; height: 24px; border-radius: 5px;
            display: flex; align-items: center; justify-content: center;
            font-size: 8px; font-weight: 700; color: var(--study-text-tertiary);
            background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
            transition: all .2s;
        }
        .sb-streak-day.active {
            background: linear-gradient(135deg, var(--study-accent), #d4752e);
            color: #000; border-color: var(--study-accent);
            box-shadow: 0 2px 8px rgba(232,133,58,0.3);
            font-weight: 800;
        }
        .sb-streak-day.today {
            border-color: var(--study-accent); color: var(--study-accent);
            background: var(--study-accent-dim, rgba(232,133,58,0.08));
        }
        .sb-exam-list { display: flex; flex-direction: column; gap: 6px; }
        .sb-exam-item {
            display: flex; align-items: center; gap: 8px; padding: 7px 8px;
            border-radius: 8px; background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.04);
            transition: all .15s;
        }
        .sb-exam-item:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.08); }
        .sb-exam-badge {
            width: 32px; height: 32px; border-radius: 7px;
            background: linear-gradient(135deg, var(--study-accent-dim), var(--study-accent-dim, rgba(232,133,58,0.08)));
            color: var(--study-accent);
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            font-weight: 800; flex-shrink: 0; font-size: 12px; line-height: 1;
            border: 1px solid var(--study-accent-dim, rgba(232,133,58,0.15));
        }
        .sb-exam-badge .month { font-size: 7px; text-transform: uppercase; letter-spacing: .04em; opacity: 0.8; }
        .sb-exam-info { flex: 1; min-width: 0; }
        .sb-exam-name { font-size: 11px; font-weight: 700; color: var(--study-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .sb-exam-meta { font-size: 9px; color: var(--study-text-tertiary); margin-top: 1px; }
        .sb-exam-countdown { font-size: 9px; font-weight: 800; color: var(--study-accent); white-space: nowrap; }
        .sb-exam-countdown.urgent { color: var(--study-red); animation: pulse-urgent 2s ease-in-out infinite; }
        @keyframes pulse-urgent { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
        .sb-exam-add {
            width: 100%; padding: 6px; border-radius: 7px; margin-top: 6px;
            border: 1px dashed rgba(255,255,255,0.1); background: transparent;
            color: var(--study-text-tertiary); font-size: 10px; font-weight: 600;
            cursor: pointer; font-family: inherit;
            display: flex; align-items: center; justify-content: center; gap: 4px;
            transition: all .2s;
        }
        .sb-exam-add:hover {
            border-color: var(--study-accent); color: var(--study-accent);
            background: rgba(232,133,58,0.05);
        }
        .sb-exam-add i { width: 12px; height: 12px; }
        .sb-exam-empty {
            text-align: center; padding: 8px 0; font-size: 10px;
            color: var(--study-text-tertiary); font-style: italic;
        }
        .sidebar-username { font-size: 13px; color: var(--study-text-secondary); }

        /* ── Detail Topbar (shown only in set detail) ── */
        .detail-topbar {
            display: none; align-items: center; justify-content: space-between;
            height: 48px; padding: 0 16px; background: var(--study-bg); border-bottom: 1px solid var(--study-border); flex-shrink: 0;
        }
        .detail-topbar.visible { display: flex; }
        .detail-topbar-left { display: flex; align-items: center; gap: 10px; }
        .detail-topbar-title-wrap { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
        .detail-topbar-title { font-size: 14px; font-weight: 600; }
        .detail-topbar-title-wrap .detail-topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .detail-title-rename {
            border: none;
            background: none;
            color: var(--study-text-tertiary);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            margin-left: 2px;
            cursor: pointer;
            transition: color .15s;
            flex-shrink: 0;
            line-height: 1;
            border-radius: 0;
        }
        .detail-title-rename:hover { color: var(--study-text-secondary); }
        .detail-title-rename i { width: 10px; height: 10px; }
        .detail-topbar-right { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--study-text-tertiary); }
        .detail-topbar-right button { background: none; border: none; color: var(--study-text-secondary); cursor: pointer; font-size: 12px; font-family: inherit; display: flex; align-items: center; gap: 4px; }
        .detail-topbar-right button:hover { color: var(--study-text); }
        .detail-topbar-right button i { width: 14px; height: 14px; }
        .detail-add-method-btn {
            height: 30px;
            border-radius: 999px;
            border: 1px solid var(--study-border) !important;
            background: var(--study-bg-secondary) !important;
            color: var(--study-text-secondary) !important;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            padding: 0 10px;
            font-size: 12px;
            font-weight: 700;
            font-family: inherit;
            cursor: pointer;
            transition: all .15s;
        }
        .detail-add-method-btn i { width: 12px; height: 12px; }
        .detail-add-method-btn:hover {
            background: var(--study-bg-tertiary) !important;
            color: var(--study-text) !important;
        }
        .detail-method-menu {
            position: fixed;
            z-index: 10020;
            min-width: 220px;
        }
        .detail-method-menu-heading {
            font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
            color: var(--study-text-tertiary); padding: 6px 14px 2px; pointer-events: none;
        }
        .detail-method-menu-remove { color: #ef4444 !important; }
        .detail-method-menu-remove:hover { background: rgba(239,68,68,0.08) !important; }
        .detail-ai-btn {
            height: 30px;
            border-radius: 999px;
            border: 1px solid var(--study-border);
            background: var(--study-bg-secondary);
            color: var(--study-text-secondary);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 0 11px;
            font-size: 12px;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            transition: all .15s;
        }
        .detail-ai-btn:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .detail-ai-btn i { width: 13px; height: 13px; }

        /* ── Views ── */
        .study-view { display: none; flex: 1; overflow-y: auto; overflow-x: hidden; }
        .study-view.active { display: flex; flex-direction: column; }
        #view-detail { overflow: hidden; }

        /* ── Hero Section ── */
        .hero-section {
            text-align: left;
            padding: 68px 40px 42px;
            max-width: 1200px;
            width: 100%;
            margin: 0 auto;
        }
        .hero-head {
            width: 100%;
            margin: 0 0 28px;
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 22px;
        }
        .hero-head-left { min-width: 0; }
        .hero-title { font-size: 64px; font-weight: 900; margin: 0 0 12px; line-height: 1.05; }
        .hero-sub { font-size: 22px; color: var(--study-text-secondary); margin: 0; }
        .hero-filter-btn {
            display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 28px;
            border-radius: 999px; border: 1px solid var(--study-border); background: var(--study-bg-card, var(--bg-card, #fff));
            color: var(--study-text-secondary); font-size: 16px; font-weight: 600; cursor: pointer;
            font-family: inherit; transition: all 0.2s; height: 51px; box-sizing: border-box;
        }
        .hero-filter-btn:hover { border-color: var(--study-accent); color: var(--study-text); }
        .hero-filter-btn.active {
            background: linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 92%, #fff), var(--study-accent), color-mix(in srgb, var(--study-accent) 88%, #000)); color: var(--study-accent-text, #fff);
            border-color: transparent; box-shadow: 0 2px 8px var(--study-accent-dim, rgba(120,58,34,0.2));
        }
        .hero-filter-dropdown {
            position: absolute; top: 100%; right: 0; margin-top: 8px; width: 220px;
            background: var(--study-bg-card, var(--bg-card, #fff)); border: 1px solid var(--study-border); border-radius: 14px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.1); padding: 8px; z-index: 100;
        }
        .hero-filter-dropdown-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--study-text-tertiary); padding: 6px 10px 4px; }
        .hero-filter-dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--study-text-secondary); cursor: pointer; font-family: inherit; }
        .hero-filter-dropdown button:hover { background: var(--study-bg-tertiary); color: var(--study-text); }
        .hero-filter-dropdown button i { width: 15px; height: 15px; }
        .hero-filter-search { width: 100%; padding: 8px 10px; border: 1px solid var(--study-border); border-radius: 8px; font-size: 13px; font-family: inherit; background: var(--study-bg-secondary); color: var(--study-text); outline: none; }
        .hero-filter-search:focus { border-color: var(--study-accent); }
        .hero-search-wrap {
            width: auto;
            min-width: auto;
            max-width: none;
            margin: 0;
            align-self: center;
        }
        .action-cards {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 24px;
            width: 100%;
            max-width: none;
            margin: 0;
        }
        .action-card {
            width: 100%;
            max-width: none;
            min-width: 0;
            aspect-ratio: 1 / 1;
            min-height: 260px;
            padding: 24px 20px;
            background: var(--study-bg-card, var(--bg-card, #fff));
            border: 1px solid var(--study-border); border-radius: 24px; cursor: pointer; text-align: center; transition: all 0.2s ease;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04);
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04);
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            overflow: hidden;
        }
        .action-card:hover { border-color: var(--study-accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); }
        .action-icon-circle { width: 70px; height: 70px; border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
        .action-icon-circle i { width: 32px; height: 32px; stroke-width: 1.8; }
        .action-card > i { width: 40px; height: 40px; color: var(--study-text-tertiary); stroke-width: 1.5; margin: 0 auto 24px; display: block; }
        .action-label { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
        .action-sub { font-size: 13px; color: var(--study-text-tertiary); line-height: 1.4; max-width: 90%; }

        /* ── Sets Section ── */
        .sets-section { max-width: 1200px; margin: 0 auto; padding: 0 44px 40px; width: 100%; }
        .sets-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: nowrap; margin-bottom: 8px; }
        .sets-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
        .view-toggle-group { display: flex; background: var(--study-bg-tertiary); border-radius: 8px; overflow: hidden; }
        .view-toggle { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--study-text-tertiary); cursor: pointer; transition: all 0.15s; }
        .view-toggle.active { background: var(--study-bg-secondary); color: var(--study-text); }
        .view-toggle i { width: 15px; height: 15px; }
        .sets-section-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
        .sets-heading { font-size: 28px; font-weight: 900; color: var(--study-text); margin: 0; letter-spacing: -0.01em; }
        .sets-header-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
        .sets-search-wrap { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--study-bg-card, var(--bg-card, #fff)); border: 1px solid var(--study-border); border-radius: 14px; margin-bottom: 14px; transition: border-color 0.2s; }
        .sets-search-wrap:focus-within { border-color: var(--study-accent); }
        .sets-search-wrap i { width: 16px; height: 16px; color: var(--study-text-tertiary); flex-shrink: 0; }
        .sets-search-wrap input { flex: 1; border: none; background: transparent; color: var(--study-text); font-size: 14px; font-family: inherit; outline: none; }
        .sets-search-wrap input::placeholder { color: var(--study-text-tertiary); }
        .sets-search-box{display:flex;align-items:center;gap:8px;padding:9px 14px;background:var(--study-bg-secondary);border:1px solid var(--study-border);border-radius:12px;flex:1 1 620px;min-width:320px;max-width:620px;transition:border-color .2s}
        .sets-search-box-compact{flex:0 0 250px;min-width:220px;max-width:280px;padding:7px 10px;border-radius:10px}
        .hero-search-wrap .sets-search-box {
            width: 100%;
            max-width: 100%;
            min-width: 0;
            flex: 0 0 auto;
            padding: 12px 16px;
            border-radius: 10px;
        }
        .sets-search-box:focus-within{border-color:var(--study-accent)}
        .sets-search-box i{width:15px;height:15px;color:var(--study-text-tertiary);flex-shrink:0}
        .sets-search-input{flex:1;border:none;background:transparent;color:var(--study-text);font-size:.875rem;font-family:inherit;outline:none;-webkit-appearance:none}
        .sets-search-input::placeholder{color:var(--study-text-tertiary)}
        .sets-search-input::selection{background:var(--study-accent);color:#fff;-webkit-text-fill-color:#fff}
        .sets-search-input::-webkit-search-decoration,.sets-search-input::-webkit-search-cancel-button{display:none}
        .sets-search-input:-webkit-autofill,.sets-search-input:-webkit-autofill:focus{-webkit-box-shadow:0 0 0 50px var(--study-bg-secondary) inset;-webkit-text-fill-color:var(--study-text)}
        /* ── Storage Usage Bar ── */
        .study-usage-bar { display: flex; align-items: center; gap: 14px; padding: 8px 0; margin-bottom: 6px; }
        .study-usage-info { display: flex; gap: 16px; font-size: 12px; color: var(--study-text-tertiary); white-space: nowrap; }
        .study-usage-track { flex: 1; height: 4px; background: var(--study-bg-tertiary); border-radius: 4px; overflow: hidden; max-width: 200px; }
        .study-usage-fill { height: 100%; background: var(--study-accent); border-radius: 4px; transition: width 0.4s ease; }
        .study-usage-fill.warn { background: #f59e0b; }
        .study-usage-fill.critical { background: #ef4444; }

        /* ── Over-Limit Modal ── */
        .over-limit-overlay { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
        .over-limit-card { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 16px; padding: 32px; max-width: 420px; width: 90%; text-align: center; }
        .over-limit-icon { margin-bottom: 16px; }
        .over-limit-icon i { width: 48px; height: 48px; color: #ef4444; }
        .over-limit-card h2 { font-size: 20px; font-weight: 700; color: var(--study-text); margin: 0 0 8px; }
        .over-limit-card p { font-size: 14px; color: var(--study-text-secondary); margin: 0 0 20px; line-height: 1.5; }
        .over-limit-stats { display: flex; justify-content: center; gap: 24px; margin-bottom: 24px; font-size: 13px; color: var(--study-text-tertiary); }
        .over-limit-stat-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
        .over-limit-stat-val { font-size: 22px; font-weight: 700; color: var(--study-text); }
        .over-limit-stat-val.over { color: #ef4444; }
        .over-limit-actions { display: flex; gap: 10px; justify-content: center; }
        .over-limit-btn-secondary { padding: 10px 24px; background: transparent; border: 1px solid var(--study-border); border-radius: 10px; color: var(--study-text); font-size: 14px; font-weight: 600; cursor: pointer; }
        .over-limit-btn-primary { padding: 10px 24px; background: var(--study-accent); border: none; border-radius: 10px; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }

        .sets-grid { display: flex; flex-direction: column; gap: 8px; }
        .sets-grid.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

        /* ── Set Card (List View) ── */
        .set-card {
            display: flex; align-items: center; gap: 24px; padding: 24px 32px;
            background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: var(--study-radius);
            cursor: pointer; transition: all 0.2s; position: relative;
        }
        .set-card:hover { border-color: var(--study-border-light); }
        .set-card-left { flex: 1; min-width: 0; }
        .set-card-title { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
        .set-card-progress { display: flex; align-items: center; gap: 12px; }
        .set-card-pct { font-size: 15px; color: var(--study-text-tertiary); min-width: 36px; }
        .mastery-bar { height: 4px; background: var(--study-bg-tertiary); border-radius: 2px; overflow: hidden; display: flex; flex: 1; max-width: 180px; }
        .mastery-bar .seg { height: 100%; transition: width 0.3s; }
        .mastery-bar .seg-mastered { background: var(--study-green); }
        .mastery-bar .seg-familiar { background: var(--study-blue); }
        .mastery-bar .seg-learning { background: var(--study-accent); }
        .set-card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-left: 16px; flex-shrink: 0; }
        .mastery-badge { padding: 5px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; white-space: nowrap; }
        .set-card-methods { display: flex; gap: 4px; flex-shrink: 0; width: 240px; justify-content: flex-end; }
        .method-icon-sm { width: 28px; height: 28px; border-radius: 50%; background: var(--study-bg-tertiary); display: flex; align-items: center; justify-content: center; }
        .method-icon-sm i { width: 13px; height: 13px; color: var(--study-text-secondary); }
        .set-card-more { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--study-text-tertiary); cursor: pointer; border-radius: 6px; flex-shrink: 0; position: relative; }
        .set-card-more:hover { background: var(--study-bg-tertiary); color: var(--study-text); }
        .set-card-dropdown { position: fixed; background: var(--study-bg-card); border: 1px solid var(--study-border-light); border-radius: 8px; min-width: 150px; z-index: 9999; box-shadow: 0 8px 24px rgba(0,0,0,0.4); overflow: hidden; }
        .set-card-dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 14px; background: none; border: none; color: var(--study-text); font-size: 13px; cursor: pointer; font-family: inherit; }
        .set-card-dropdown button:hover { background: var(--study-bg-tertiary); }
        .set-card-dropdown button.danger { color: var(--study-red); }
        .set-card-dropdown button i { width: 16px; height: 16px; }
        .set-rename-input { width: 100%; padding: 8px 12px; background: var(--study-bg-secondary); border: 1px solid var(--study-accent); border-radius: 6px; color: var(--study-text); font-size: 14px; font-family: inherit; outline: none; }

        /* ── Set Card (Grid View) ── */
        .sets-grid.grid-view .set-card { flex-direction: column; align-items: stretch; padding: 18px; }
        .sets-grid.grid-view .set-card-badges { margin-left: 0; margin-top: 8px; }
        .sets-grid.grid-view .set-card-methods { margin-left: 0; margin-top: 10px; }

        .sets-empty { text-align: center; padding: 60px 20px; }
        .sets-empty h3 { font-size: 18px; margin-bottom: 8px; }
        .sets-empty p { font-size: 14px; color: var(--study-text-secondary); max-width: 360px; margin: 0 auto 20px; line-height: 1.5; }
        .btn-create { display: inline-flex; align-items: center; gap: 6px; padding: 10px 22px; background: linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 85%, #fff) 0%, var(--study-accent) 50%, color-mix(in srgb, var(--study-accent) 85%, #000) 100%); color: #fff; font-weight: 700; font-size: 13px; border: none; border-radius: 10px; cursor: pointer; transition: all 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.18); text-shadow: 0 1px 1px rgba(0,0,0,0.1); position: relative; overflow: hidden; isolation: isolate; }
        .btn-create::after { content: ''; position: absolute; inset: 0; background: url('/images/noise.png') repeat; background-size: 128px 128px; border-radius: inherit; pointer-events: none; z-index: 1; mix-blend-mode: overlay; opacity: 0.6; }
        .btn-create:hover { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.15), 0 6px 16px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.22); }

        /* ── Confirm Dialog ── */
        .confirm-overlay{position:fixed;inset:0;background:rgba(0,0,0,.65);backdrop-filter:blur(6px);z-index:10000;display:none;align-items:center;justify-content:center;padding:20px}
        .confirm-overlay.visible{display:flex}
        .confirm-dialog{background:var(--study-bg-secondary);border:1px solid var(--study-border-light);border-radius:18px;width:100%;max-width:360px;padding:28px 24px 22px;display:flex;flex-direction:column;gap:14px;animation:confirmPop .18s cubic-bezier(.34,1.56,.64,1)}
        @keyframes confirmPop{from{opacity:0;transform:scale(.92)}to{opacity:1;transform:scale(1)}}
        .confirm-icon-wrap{width:48px;height:48px;border-radius:14px;background:rgba(239,68,68,.12);display:flex;align-items:center;justify-content:center;margin:0 auto 2px}
        .confirm-icon-wrap i{width:24px;height:24px;color:var(--study-red)}
        .confirm-title{font-size:16px;font-weight:700;text-align:center;color:var(--study-text)}
        .confirm-msg{font-size:13px;color:var(--study-text-secondary);text-align:center;line-height:1.55}
        .confirm-btns{display:flex;gap:10px;margin-top:6px}
        .confirm-cancel{flex:1;padding:10px;border-radius:10px;border:1px solid var(--study-border-light);background:transparent;color:var(--study-text);font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;transition:background .15s}
        .confirm-cancel:hover{background:var(--study-bg-tertiary)}
        .confirm-ok{flex:1;padding:10px;border-radius:10px;border:none;background:var(--study-red);color:#fff;font-size:13px;font-weight:700;cursor:pointer;font-family:inherit;transition:background .15s}
        .confirm-ok:hover{background:#dc2626}

        /* ── Input Modal ── */
        .input-modal-field {
            width: 100%; padding: 12px 14px; border-radius: 10px;
            border: 1px solid var(--study-border); background: var(--study-bg-secondary);
            color: var(--study-text); font-size: 15px; font-family: inherit;
            margin: 12px 0 16px; outline: none; box-sizing: border-box;
            transition: border-color 0.15s;
        }
        .input-modal-field:focus { border-color: var(--study-accent); }
        #inputOk { background: var(--study-accent) !important; }
        #inputOk:hover { filter: brightness(1.08); }

        /* ── Create Wizard Modal ── */
        .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; color: var(--study-text); }
        .modal-overlay.visible { display: flex; }
        .modal { background: var(--study-bg-secondary); border: none; border-radius: 16px; width: 100%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; color: var(--study-text); }
        .modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--study-border); flex-shrink: 0; }
        .modal-header h3 { font-size: 16px; font-weight: 600; }
        .modal-close { width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; color: var(--study-text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; }
        .modal-close:hover { background: var(--study-bg-tertiary); }
        .modal-body { padding: 24px; overflow-y: auto; scrollbar-width: none; }
        .modal-body::-webkit-scrollbar { display: none; }
        .wizard-step { display: none; flex-direction: column; gap: 16px; }
        .wizard-step.active { display: flex; }
        .wizard-step h4 { font-size: 18px; font-weight: 700; text-align: center; }
        .wizard-step .subtitle { font-size: 13px; color: var(--study-text-secondary); text-align: center; margin-top: -8px; }

        /* Dropzone */
        .dropzone {
            border: 2px dashed var(--study-border-light); border-radius: 14px; padding: 40px 20px;
            text-align: center; cursor: pointer; transition: all 0.2s; position: relative;
        }
        .dropzone:hover, .dropzone.dragover { border-color: var(--study-accent); background: var(--study-accent-dim); }
        .dropzone i { width: 40px; height: 40px; color: var(--study-text-tertiary); margin-bottom: 12px; }
        .dropzone-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
        .dropzone-sub { font-size: 12px; color: var(--study-text-tertiary); }
        .dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
        .file-list { display: flex; flex-direction: column; gap: 6px; }
        .file-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--study-bg-tertiary); border-radius: 8px; font-size: 13px; }
        .file-item i { width: 14px; height: 14px; flex-shrink: 0; }
        .file-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .file-item-size { color: var(--study-text-tertiary); font-size: 11px; }
        .file-item-remove { background: none; border: none; color: var(--study-text-tertiary); cursor: pointer; padding: 2px; }
        .file-item-remove:hover { color: var(--study-red); }
        .divider-or { display: flex; align-items: center; gap: 12px; color: var(--study-text-tertiary); font-size: 12px; }
        .divider-or::before, .divider-or::after { content: ''; flex: 1; height: 1px; background: var(--study-border); }
        .url-input-wrap { display: flex; align-items: center; gap: 8px; background: transparent; border: 1px solid var(--study-border); border-radius: 10px; padding: 0 12px; overflow: hidden; }
        .url-input-wrap i { width: 16px; height: 16px; color: var(--study-text-tertiary); flex-shrink: 0; }
        .url-input-wrap input { flex: 1; background: transparent; border: none; color: var(--study-text); font-size: 14px; padding: 10px 0; outline: none; font-family: inherit; }
        .paste-area { background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 10px; color: var(--study-text); font-family: inherit; font-size: 14px; padding: 12px 14px; outline: none; resize: vertical; min-height: 100px; width: 100%; transition: border-color 0.2s; }
        .paste-area:focus { border-color: var(--study-accent); }
        .char-counter { font-size: 11px; color: var(--study-text-tertiary); text-align: right; margin-top: -8px; }

        /* Method Cards */
        .methods-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
        .method-card {
            display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
            padding: 20px 12px; background: var(--study-bg); border: 2px solid var(--study-border);
            border-radius: 12px; cursor: pointer; transition: all 0.15s; position: relative; min-height: 100px;
        }
        .method-card:hover { border-color: var(--study-border-light); }
        .method-card.selected { border-color: var(--study-accent); background: var(--study-accent-dim); }
        .method-card i { width: 24px; height: 24px; color: var(--study-text-secondary); }
        .method-card.selected i { color: var(--study-accent); }
        .method-card-label { font-size: 13px; font-weight: 500; }
        .method-card .coming-soon { position: absolute; top: 6px; right: 6px; font-size: 9px; padding: 2px 6px; background: var(--study-bg-tertiary); border-radius: 4px; color: var(--study-text-tertiary); font-weight: 600; text-transform: uppercase; }

        .btn-wizard { width: 100%; padding: 14px; background: linear-gradient(180deg, #a0583c 0%, #7a3a22 100%); color: #fff; font-weight: 700; font-size: 14px; border: none; border-radius: 12px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 12px rgba(120,58,34,0.25), inset 0 1px 0 rgba(255,255,255,0.15); text-transform: uppercase; letter-spacing: 0.04em; }
        .btn-wizard:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(120,58,34,0.35), inset 0 1px 0 rgba(255,255,255,0.2); }
        .btn-wizard:disabled { opacity: 0.5; cursor: not-allowed; }
        .btn-wizard .spinner { width: 16px; height: 16px; border: 2px solid rgba(0,0,0,0.2); border-top-color: #000; border-radius: 50%; animation: spin 0.6s linear infinite; }
        @keyframes spin { to { transform: rotate(360deg); } }

        .wizard-loading { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 40px 20px; }
        .wizard-loading .big-spinner { width: 48px; height: 48px; border: 3px solid var(--study-border); border-top-color: var(--study-accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
        .gen-progress-wrap { width: 100%; max-width: 320px; display: flex; align-items: center; gap: 12px; }
        .gen-progress-bar { flex: 1; height: 8px; background: var(--study-bg-tertiary); border-radius: 4px; overflow: hidden; }
        .gen-progress-fill { height: 100%; width: 0%; background: var(--study-accent); border-radius: 4px; transition: width 0.5s ease; }
        .gen-progress-pct { font-size: 14px; font-weight: 600; color: var(--study-accent); min-width: 36px; }

        /* ── Set Detail Layout ── */
        .detail-layout { flex: 1; display: flex; overflow: hidden; align-items: stretch; min-height: 0; height: 100%; position: relative; padding: 8px 8px 8px 0; gap: 8px; background: var(--study-bg-tertiary, rgba(0,0,0,0.15)); }

        /* Method nav items (now rendered inside study-sidebar) */
        .method-nav {
            display: flex; align-items: center; gap: 9px; padding: 7px 10px; font-size: 12px; font-weight: 500;
            color: var(--study-text-secondary); cursor: pointer; transition: all 0.15s; border-radius: 8px;
            border: none; background: none; width: 100%; text-align: left; font-family: inherit; margin-bottom: 1px;
        }
        .method-nav:hover { background: var(--study-bg-tertiary); color: var(--study-text); }
        .method-nav.active { color: var(--study-text); background: rgba(255,255,255,0.08); }
        .method-nav i { width: 15px; height: 15px; flex-shrink: 0; }
        .method-nav-sep { display: flex; align-items: center; gap: 6px; padding: 8px 10px 3px; }
        .method-nav-sep::before, .method-nav-sep::after { content: ''; flex: 1; height: 1px; background: var(--study-border); opacity: .6; }
        .method-nav-sep span { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--study-text-muted); white-space: nowrap; }
        .method-nav-group-label { padding: 10px 12px 5px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--study-text-muted); }
        .method-nav-group-sep { margin-top: 6px; border-top: 1px solid var(--study-border); padding-top: 10px; }

        /* Main Content */
        .detail-main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--study-bg); border-radius: 14px; border: 1px solid var(--study-border); }
        .detail-main.mode-reading { overflow: hidden; }
        .detail-main-inner { max-width: none; margin: 0; padding: 22px 24px 28px; width: 100%; flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; }
        .detail-main-inner.mode-reading { padding: 10px 8px 18px 14px; display: flex; flex-direction: column; height: 100%; min-height: 0; }
        .detail-main-inner.mode-reading #quillEditorShell {
            height: 100%;
            min-height: 0;
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            gap: 10px;
            border: 1px solid var(--study-border);
            border-radius: 16px;
            overflow: hidden;
            background: var(--study-bg-secondary);
            padding: 10px;
        }
        .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow {
            margin: 0;
            border: 1px solid var(--study-border-light) !important;
            border-radius: 14px !important;
            background: var(--study-bg-tertiary) !important;
            padding: 10px 12px;
            box-shadow: none !important;
            position: static !important;
            top: auto !important;
        }
        .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow .ql-formats {
            margin-right: 12px;
            padding-right: 12px;
            border-right: 1px solid var(--study-border);
        }
        .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow .ql-formats:last-child {
            margin-right: 0;
            padding-right: 0;
            border-right: none;
        }
        .detail-main-inner.mode-reading #quillEditorShell > .ql-container.ql-snow {
            border: 1px solid var(--study-border) !important;
            border-radius: 14px;
            flex: 1;
            min-height: 0;
            font-size: 16px !important;
            background: var(--study-bg-secondary);
            margin-top: 0;
            overflow: hidden;
        }
        .detail-main-inner.mode-reading #quillEditorShell .ql-editor {
            padding: 26px 34px !important;
            color: var(--study-text) !important;
        }
        .detail-main-inner.mode-reading #quillEditorShell .ql-editor.ql-blank::before {
            color: var(--study-text-tertiary) !important;
        }

        /* Mastery Pills */
        .mastery-pills { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
        .mastery-pill {
            padding: 5px 12px; border-radius: 10px; font-size: 11px; font-weight: 800;
            cursor: pointer; transition: all 0.15s; border: 1.5px solid transparent;
            text-transform: uppercase; letter-spacing: 0.04em;
            box-shadow: 2px 2px 0 rgba(0,0,0,0.06);
        }
        .mastery-pill:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(0,0,0,0.1); }
        .mastery-pill-unfamiliar { background: rgba(239,68,68,0.1); color: var(--study-red); border-color: rgba(239,68,68,0.2); }
        .mastery-pill-learning { background: color-mix(in srgb, var(--study-accent) 10%, transparent); color: var(--study-accent); border-color: color-mix(in srgb, var(--study-accent) 25%, transparent); }
        .mastery-pill-familiar { background: rgba(59,130,246,0.1); color: var(--study-blue); border-color: rgba(59,130,246,0.2); }
        .mastery-pill-mastered { background: color-mix(in srgb, var(--study-green) 12%, transparent); color: color-mix(in srgb, var(--study-green) 72%, var(--study-text)); border-color: color-mix(in srgb, var(--study-green) 25%, transparent); }
        .mastery-pill.active { border-color: currentColor; box-shadow: 2px 2px 0 rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.2); }

        /* Bottom Nav (for card-based methods) */
        .card-nav { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 20px 0; margin-top: auto; }
        .card-nav button {
            width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--study-border);
            background: var(--study-bg-secondary); color: var(--study-text-secondary);
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            transition: all 0.15s; box-shadow: 3px 3px 0 rgba(0,0,0,0.1);
        }
        .card-nav button:hover { border-color: var(--study-accent); color: var(--study-accent); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--study-accent-dim, rgba(232,133,58,0.15)); }
        .card-nav button:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0,0,0,0.1); }
        .card-nav button:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; }
        .card-nav button i { width: 18px; height: 18px; }
        .card-nav-counter { font-size: 15px; font-weight: 800; color: var(--study-text-secondary); min-width: 60px; text-align: center; letter-spacing: 0.02em; }
        .skip-row { text-align: center; padding: 4px 0 8px; }
        .skip-link {
            background: none; border: 1.5px solid var(--study-border); color: var(--study-text-tertiary);
            font-size: 12px; cursor: pointer; font-family: inherit; font-weight: 600;
            padding: 6px 16px; border-radius: 10px; transition: all 0.15s;
            box-shadow: 2px 2px 0 rgba(0,0,0,0.06); text-decoration: none;
        }
        .skip-link:hover { border-color: var(--study-text-secondary); color: var(--study-text-muted); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(0,0,0,0.1); }
        .mastered-link {
            background: none; border: 1.5px solid color-mix(in srgb, var(--study-green) 35%, transparent);
            color: color-mix(in srgb, var(--study-green) 72%, var(--study-text));
            font-size: 12px; cursor: pointer; font-family: inherit; font-weight: 700;
            padding: 6px 16px; border-radius: 10px; transition: all 0.15s;
            display: inline-flex; align-items: center; gap: 5px;
            box-shadow: 2px 2px 0 rgba(34,197,94,0.1); text-transform: uppercase; letter-spacing: 0.03em;
        }
        .mastered-link:hover { background: color-mix(in srgb, var(--study-green) 8%, transparent); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(34,197,94,0.15); }

        /* Flashcard */
        .fc-container { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 0; max-width: 720px; margin: 0 auto; width: 100%; }
        .fc-header { display: flex; align-items: flex-end; justify-content: space-between; width: 100%; margin-bottom: 20px; padding: 0 4px; }
        .fc-header-left { display: flex; flex-direction: column; gap: 4px; }
        .fc-deck-label { font-size: 13px; font-weight: 700; color: var(--study-text); }
        .fc-header-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
        .fc-counter { font-size: 22px; font-weight: 800; color: var(--study-text-secondary); }
        .fc-counter-current { color: var(--study-text); }
        .fc-counter-sep { color: var(--study-text-tertiary); font-weight: 400; margin: 0 2px; font-size: 18px; }
        .fc-progress-bar { width: 120px; height: 4px; background: var(--study-border); border-radius: 4px; overflow: hidden; }
        .fc-progress-fill { height: 100%; background: var(--study-accent); border-radius: 4px; transition: width 0.3s ease; }
        .fc-card-wrap { perspective: 1200px; width: 100%; aspect-ratio: 16/10; max-height: 420px; min-height: 280px; cursor: pointer; margin-bottom: 24px; }
        .fc-card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.5s; border-radius: 20px; }
        .fc-card.flipped { transform: rotateY(180deg); }
        .fc-face {
            position: absolute; inset: 0; backface-visibility: hidden; border-radius: 20px;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            padding: 40px 48px; text-align: center; border: 1px solid var(--study-border);
            box-shadow: 0 20px 50px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
        }
        .fc-front { background: var(--study-bg-secondary); }
        .fc-back { background: var(--study-accent-dim); transform: rotateY(180deg); border-color: var(--study-accent-dim, rgba(232,133,58,0.15)); }
        .fc-card-tag {
            position: absolute; top: 20px; left: 24px;
            display: flex; align-items: center; gap: 5px;
            font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
            color: var(--study-text-tertiary);
        }
        .fc-label { display: none; }
        .fc-text { font-size: 18px; line-height: 1.5; font-weight: 500; }
        .fc-text.fc-rich { text-align: center; }
        .fc-text.fc-rich p { margin: 0 0 8px; }
        .fc-text.fc-rich p:last-child { margin-bottom: 0; }
        .fc-text.fc-rich .mermaid-diagram { margin: 8px 0; font-size: 14px; }
        .fc-text.fc-rich pre { font-size: 13px; text-align: left; margin: 8px 0; border-radius: 8px; padding: 12px; background: var(--study-bg-tertiary); overflow-x: auto; }
        .fc-text.fc-rich code { font-size: 13px; }
        .fc-text.fc-rich ul, .fc-text.fc-rich ol { text-align: left; margin: 4px 0; padding-left: 20px; }
        .fc-hint {
            position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
            font-size: 11px; color: var(--study-text-tertiary); display: flex; align-items: center; gap: 6px;
            font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
        }
        .fc-hint kbd { padding: 2px 6px; background: var(--study-bg-tertiary); border-radius: 4px; font-size: 11px; font-family: inherit; }
        .fc-bottom-bar {
            display: flex; align-items: center; justify-content: space-between; width: 100%;
            padding: 16px 4px 0; margin-top: 8px;
        }
        .fc-bottom-btn {
            display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px;
            border: 1px solid var(--study-border); background: var(--study-bg-secondary);
            color: var(--study-text-secondary); font-size: 13px; font-weight: 600;
            cursor: pointer; transition: all 0.15s; font-family: inherit;
        }
        .fc-bottom-btn:hover { border-color: var(--study-accent); color: var(--study-accent); }
        .fc-bottom-btn:disabled { opacity: 0.3; cursor: not-allowed; }
        .fc-bottom-hint {
            font-size: 11px; color: var(--study-text-tertiary); display: flex; align-items: center; gap: 4px;
            text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
        }
        .fc-bottom-hint kbd { padding: 2px 8px; background: var(--study-bg-tertiary); border-radius: 6px; font-family: inherit; }
        .fc-actions { display: flex; gap: 12px; }
        .fc-btn { padding: 12px 28px; border-radius: 10px; border: none; font-weight: 600; font-size: 14px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
        .fc-btn i { width: 16px; height: 16px; }
        .fc-btn-wrong { background: rgba(239,68,68,0.15); color: var(--study-red); }
        .fc-btn-wrong:hover { background: rgba(239,68,68,0.25); }
        .fc-btn-right { background: rgba(34,197,94,0.15); color: var(--study-green); }
        .fc-btn-right:hover { background: rgba(34,197,94,0.25); }
        .fc-btn-skip { background: transparent; color: var(--study-text-tertiary); border: 1px solid var(--study-border); font-size: 12px; padding: 8px 16px; }
        .fc-btn-skip:hover { background: rgba(150,150,150,0.12); color: var(--study-text-muted); }
        .srs-actions { display: flex; gap: 12px; justify-content: center; }
        .srs-btn {
            flex-direction: column; align-items: center; min-width: 82px; padding: 14px 16px; gap: 4px;
            border-radius: 14px; font-size: 13px; font-weight: 800; border: 2.5px solid rgba(0,0,0,0.08);
            background: rgba(0,0,0,0.02); transition: all 0.15s; cursor: pointer;
            text-transform: uppercase; letter-spacing: 0.04em; display: flex;
            box-shadow: 3px 3px 0 rgba(0,0,0,0.08);
        }
        .srs-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0,0,0,0.06); }
        .srs-btn i { width: 20px; height: 20px; margin-bottom: 1px; }
        .srs-interval { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.5; }
        .srs-again { color: #ef4444; border-color: rgba(239,68,68,0.3); }
        .srs-again:hover { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.5); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(239,68,68,0.12); }
        .srs-hard { color: #c47a3a; border-color: rgba(196,122,58,0.3); }
        .srs-hard:hover { background: rgba(196,122,58,0.08); border-color: rgba(196,122,58,0.5); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(196,122,58,0.12); }
        .srs-good { color: #537fcb; border-color: rgba(83,127,203,0.3); }
        .srs-good:hover { background: rgba(83,127,203,0.08); border-color: rgba(83,127,203,0.5); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(83,127,203,0.12); }
        .srs-easy { color: #3a9a5c; border-color: rgba(58,154,92,0.3); }
        .srs-easy:hover { background: rgba(58,154,92,0.08); border-color: rgba(58,154,92,0.5); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(58,154,92,0.12); }
        /* ═══ Review / Learn Tab ═══ */
        .review-container { max-width: 1400px; width: 100%; margin: 0; padding: 32px 60px 36px; display: flex; flex-direction: column; height: 100%; text-align: left; }
        .review-top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0; gap: 14px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--study-border, rgba(0,0,0,0.06)); }
        .review-mode-tabs { display: flex; background: var(--study-bg-tertiary, rgba(0,0,0,0.04)); border-radius: 10px; padding: 3px; gap: 2px; }
        .review-mode-tab { padding: 10px 24px; border-radius: 8px; border: none; background: transparent; color: var(--study-text-secondary); font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.15s; font-family: inherit; display: flex; align-items: center; gap: 7px; }
        .review-mode-tab.active { background: var(--study-accent); color: #fff; }
        .review-mode-tab:hover:not(.active) { color: var(--study-text); background: rgba(0,0,0,0.04); }
        .review-mode-tab .tab-badge { font-size: 10px; background: var(--study-accent); color: #fff; padding: 1px 6px; border-radius: 8px; font-weight: 700; }
        /* Landing screen */
        .review-landing { max-width: none; margin: 0; padding: 20px 28px 28px; }
        .review-landing-header { margin-bottom: 14px; text-align: left; }
        .review-search-shell { position: relative; display: flex; align-items: center; min-width: 280px; }
        .review-search-input { width: 100%; height: 46px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--study-border) 55%, transparent); background: color-mix(in srgb, var(--study-bg) 78%, var(--study-bg-secondary)); color: var(--study-text); padding: 0 44px 0 18px; font: inherit; font-size: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
        .review-search-input::placeholder { color: var(--study-text-tertiary); }
        .review-search-input:focus { outline: none; border-color: color-mix(in srgb, var(--study-accent) 35%, var(--study-border)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--study-accent) 10%, transparent); }
        .review-search-icon { position: absolute; right: 16px; width: 16px; height: 16px; color: var(--study-text-tertiary); pointer-events: none; }
        .review-landing-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
        .review-landing-inline-link { padding: 0; border: none; background: transparent; color: var(--study-accent); font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
        .review-landing-inline-link:hover { opacity: 0.72; }
        .review-landing-inline-link.muted { color: var(--study-text-tertiary); cursor: default; }
        .review-landing-section { margin-bottom: 24px; }
        .review-landing-section-title { font-size: 11px; font-weight: 800; color: var(--study-text-tertiary); text-transform: uppercase; letter-spacing: 0.14em; margin: 0; }
        .review-set-grid { display: flex; flex-direction: column; gap: 18px; }
        .review-set-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: color-mix(in srgb, var(--study-bg-secondary) 95%, #fff); border: 1px solid color-mix(in srgb, var(--study-border) 28%, transparent); border-radius: 16px; box-shadow: 0 4px 12px rgba(15,23,42,0.03); transition: all .2s ease; }
        .review-set-row:hover { box-shadow: 0 18px 36px rgba(15,23,42,0.055); transform: translateY(-1px); }
        .review-set-main { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1; }
        .review-set-methods { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
        .review-set-actions { display: flex; gap: 10px; flex-shrink: 0; }
        .review-set-badge { width: 58px; height: 58px; border-radius: 18px; background: color-mix(in srgb, var(--study-accent) 9%, var(--study-bg)); color: color-mix(in srgb, var(--study-accent) 78%, var(--study-text)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
        .review-set-badge i { width: 28px; height: 28px; }
        .review-set-info { flex: 1; min-width: 0; }
        .review-set-copy h4 { font-size: 20px; font-weight: 800; margin: 0 0 8px; line-height: 1.08; letter-spacing: -0.04em; color: var(--study-text); }
        .review-set-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--study-text-tertiary); }
        .review-set-meta span { display: inline-flex; align-items: center; gap: 6px; }
        .review-set-meta i { width: 13px; height: 13px; }
        .review-set-meta-dot { width: 4px; height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--study-text-tertiary) 55%, transparent); }
        .mastery-mini.mm-unfamiliar { background: rgba(239, 68, 68, 0.10); color: #c84c56; }
        .mastery-mini.mm-learning { background: rgba(232, 133, 58, 0.12); color: #b87431; }
        .mastery-mini.mm-familiar { background: rgba(59, 130, 246, 0.10); color: #557fc5; }
        .mastery-mini.mm-mastered { background: rgba(34, 197, 94, 0.10); color: #338a55; }
        .review-set-action { padding: 12px 20px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--study-border) 55%, transparent); background: color-mix(in srgb, var(--study-bg) 82%, var(--study-bg-secondary)); color: var(--study-text); font-size: 14px; font-weight: 800; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 8px; transition: all 0.15s; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.045); }
        .review-set-action:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--study-accent) 34%, var(--study-border)); }
        .review-set-action.primary { background: linear-gradient(135deg, color-mix(in srgb, var(--study-accent) 88%, #c56f46), color-mix(in srgb, var(--study-accent) 74%, #8f4123)); color: #fff; border-color: transparent; box-shadow: 0 14px 24px color-mix(in srgb, var(--study-accent) 20%, transparent); }
        .review-set-action.primary:hover { filter: brightness(0.99); opacity: 1; }
        .review-set-action i { width: 14px; height: 14px; }
        .review-set-delete { padding: 12px; color: var(--study-text-tertiary); border-color: transparent; background: transparent; box-shadow: none; }
        .review-set-delete:hover { color: #ef4444; background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.2); }
        .review-landing-empty { text-align: center; padding: 48px 20px; }
        .review-landing-empty i { width: 48px; height: 48px; color: var(--study-text-tertiary); margin-bottom: 12px; opacity: 0.4; }
        .review-landing-empty h3 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
        .review-landing-empty p { color: var(--study-text-secondary); font-size: 13px; }
        .review-empty-illustration { width: min(300px, 78vw); margin: 0 auto 18px; filter: drop-shadow(0 18px 30px rgba(15, 23, 42, 0.08)); }
        .review-search-empty { padding: 56px 16px; background: transparent; border: none; border-radius: 22px; }
        .review-back-btn { display: flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px; border: none; background: rgba(255,255,255,0.06); color: var(--study-text-secondary); font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.15s; }
        .review-back-btn:hover { background: rgba(255,255,255,0.1); color: var(--study-text); }
        .review-back-btn i { width: 16px; height: 16px; }
        .review-filter-compact { position: relative; }
        .review-filter-compact select { background: rgba(255,255,255,0.06); color: var(--study-text); border: 1px solid var(--study-border); border-radius: 10px; padding: 10px 36px 10px 14px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
        .review-filter-compact select:focus { outline: none; border-color: var(--study-accent); }
        .review-card-area { flex: 1; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 12px 0; width: 100%; }
        .review-card-area .fc-card-wrap { height: 420px; max-width: none !important; width: 100% !important; }
        .review-card-area .fc-face { padding: 48px 40px; background: var(--study-bg-card, var(--bg-card, #fff)); border: 1px solid var(--study-border); box-shadow: 0 2px 12px rgba(0,0,0,0.04); border-radius: 20px; }
        .review-card-area .fc-text { font-size: 20px; font-weight: 600; line-height: 1.5; color: var(--study-text); }
        .review-card-area .fc-container { max-width: none !important; width: 100% !important; align-items: stretch !important; }
        .review-card-area .fc-actions { justify-content: center; }
        .review-session-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding-bottom: 0; }
        .review-session-counter { font-size: 20px; font-weight: 800; color: var(--study-accent); }
        .fc-question-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.14em; color: var(--study-text-tertiary); margin-bottom: 16px; }
        .fc-hint { font-size: 13px; color: var(--study-text-tertiary); margin-top: auto; display: flex; align-items: center; gap: 6px; }
        .fc-hint i { width: 14px; height: 14px; }
        .fc-space-badge { display: inline-block; padding: 4px 12px; border-radius: 6px; background: var(--study-text, #1a1a1a); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; margin-top: 12px; }
        .review-progress { width: 100%; margin: 0 0 20px; }
        .review-progress-bar { height: 5px; background: rgba(0,0,0,0.1); border-radius: 4px; overflow: hidden; }
        .review-progress-fill { height: 100%; background: var(--study-accent); border-radius: 4px; transition: width 0.3s ease; }
        .review-setup-pill { padding: 16px 28px; border-radius: 16px; border: 2px solid var(--study-border); background: var(--study-bg-card, var(--bg-card, #fff)); color: var(--study-text); font-size: 17px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all .25s ease; flex: 1; text-align: center; }
        .review-setup-pill:hover { border-color: var(--study-accent); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(232,133,58,.1); }
        .review-setup-pill.active { border-color: var(--study-accent); background: var(--study-accent-dim); color: var(--study-accent); transform: scale(1.02); }
        .test-type-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 32px 20px; background: var(--study-bg-card, var(--bg-card, #fff)); border: 2px solid var(--study-border); border-radius: 20px; cursor: pointer; transition: all .25s ease; text-align: center; }
        .test-type-card:hover { border-color: var(--study-accent); transform: translateY(-4px); box-shadow: 0 12px 32px rgba(232,133,58,.12); }
        .test-type-card.selected { border-color: var(--study-accent); background: var(--study-accent-dim); transform: scale(1.02); box-shadow: 0 8px 24px rgba(232,133,58,.15); }
        .test-type-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--study-bg-tertiary); display: flex; align-items: center; justify-content: center; }
        .test-type-card.selected .test-type-icon { background: var(--study-accent); }
        .test-type-icon i { width: 24px; height: 24px; color: var(--study-text-secondary); }
        .test-type-card.selected .test-type-icon i { color: #fff; }
        .test-type-title { font-size: 15px; font-weight: 700; color: var(--study-text); }
        .test-type-desc { font-size: 12px; color: var(--study-text-tertiary); line-height: 1.4; }
        .review-progress-text { font-size: 13px; color: var(--study-text-tertiary); text-align: right; margin-top: 6px; opacity: 0.6; }
        .learn-fc-rating { display: flex; gap: 16px; justify-content: center; }
        .learn-fc-rate-btn { display: flex; align-items: center; gap: 8px; padding: 12px 28px; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; border: 2px solid; transition: all 0.2s; }
        .learn-fc-rate-btn i { width: 18px; height: 18px; }
        .learn-fc-wrong { background: rgba(239,68,68,0.08); color: #ef4444; border-color: #ef4444; }
        .learn-fc-wrong:hover { background: rgba(239,68,68,0.15); }
        .learn-fc-right { background: rgba(34,197,94,0.08); color: #22c55e; border-color: #22c55e; }
        .learn-fc-right:hover { background: rgba(34,197,94,0.15); }
        .review-empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; text-align: center; }
        .review-empty-icon { width: 64px; height: 64px; border-radius: 50%; background: rgba(34,197,94,0.1); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
        .review-empty-icon i { width: 32px; height: 32px; color: var(--study-green); }
        .review-empty-state h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
        .review-empty-state p { color: var(--study-text-secondary); font-size: 14px; margin-bottom: 20px; }
        /* ═══ Learn Mode ═══ */
        /* ── Learn Mode — Polished UI ── */
        @keyframes learnSlideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
        @keyframes learnPop { 0% { transform: scale(0.95); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
        @keyframes learnShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

        .learn-status-bar { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; animation: learnSlideIn 0.3s ease; }
        .learn-status-pill { font-size: 13px; font-weight: 700; padding: 6px 16px; border-radius: 20px; display: flex; align-items: center; gap: 5px; border: 1.5px solid transparent; transition: all 0.2s; }
        .learn-status-remaining { background: rgba(255,255,255,0.06); color: var(--study-text-secondary); border-color: var(--study-border); }
        .learn-status-familiar { background: rgba(59,130,246,0.1); color: #60a5fa; border-color: rgba(59,130,246,0.25); }
        .learn-status-mastered { background: color-mix(in srgb, var(--study-green) 12%, transparent); color: color-mix(in srgb, var(--study-green) 72%, var(--study-text)); border-color: color-mix(in srgb, var(--study-green) 26%, transparent); }

        .learn-question-text { font-size: clamp(22px, 3vw, 30px); font-weight: 700; line-height: 1.45; text-align: center; padding: 28px 24px 32px; margin: 0 auto 16px; max-width: 680px; width: 100%; background: var(--study-bg-secondary); border: 1.5px solid var(--study-border); border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); animation: learnPop 0.35s ease; }

        .learn-options { display: flex; flex-direction: column; gap: 12px; max-width: 620px; width: 100%; margin: 0 auto; animation: learnSlideIn 0.4s ease; }
        .learn-option { padding: 18px 22px; background: var(--study-bg-secondary); border: 2.5px solid var(--study-border); border-radius: 14px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 14px; font-size: 16px; font-weight: 500; color: var(--study-text); font-family: inherit; text-align: left; box-shadow: 3px 3px 0 rgba(0,0,0,0.15); }
        .learn-option:hover:not(.answered) { border-color: var(--study-accent); background: var(--study-accent-dim); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--study-accent-dim, rgba(232,133,58,0.15)); }
        .learn-option .opt-key { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; color: var(--study-text-secondary); }
        .learn-option.correct { border-color: var(--study-green); background: rgba(34,197,94,0.1); box-shadow: 3px 3px 0 rgba(34,197,94,0.2); animation: learnPop 0.25s ease; }
        .learn-option.correct .opt-key { background: var(--study-green); color: #000; }
        .learn-option.wrong { border-color: var(--study-red); background: rgba(239,68,68,0.08); box-shadow: 3px 3px 0 rgba(239,68,68,0.15); animation: learnShake 0.3s ease; }
        .learn-option.wrong .opt-key { background: var(--study-red); color: #fff; }
        .learn-option.answered { pointer-events: none; }

        .learn-typed-wrap { max-width: 620px; width: 100%; margin: 0 auto; animation: learnSlideIn 0.4s ease; }
        .learn-typed-input { width: 100%; padding: 18px 22px; background: var(--study-bg-secondary); border: 2.5px solid var(--study-border); border-radius: 14px; color: var(--study-text); font-size: 17px; font-family: inherit; outline: none; transition: all 0.15s; box-shadow: 3px 3px 0 rgba(0,0,0,0.15); }
        .learn-typed-input:focus { border-color: var(--study-accent); box-shadow: 3px 3px 0 rgba(232,133,58,0.2); }
        .learn-typed-input.correct { border-color: var(--study-green); background: rgba(34,197,94,0.06); box-shadow: 3px 3px 0 rgba(34,197,94,0.2); }
        .learn-typed-input.wrong { border-color: var(--study-red); background: rgba(239,68,68,0.06); box-shadow: 3px 3px 0 rgba(239,68,68,0.15); animation: learnShake 0.3s ease; }

        .learn-submit-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
        .learn-submit-btn { padding: 12px 32px; border-radius: 12px; border: none; background: var(--study-accent); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; font-family: inherit; transition: all 0.15s; box-shadow: 3px 3px 0 var(--study-accent-dim, rgba(0,0,0,0.3)); }
        .learn-submit-btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(232,133,58,0.25); }

        .learn-feedback { max-width: 620px; width: 100%; margin: 16px auto 0; padding: 16px 20px; border-radius: 14px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 10px; animation: learnPop 0.25s ease; }
        .learn-feedback.correct { background: rgba(34,197,94,0.12); color: var(--study-green); border: 1.5px solid rgba(34,197,94,0.25); }
        .learn-feedback.wrong { background: rgba(239,68,68,0.1); color: var(--study-red); border: 1.5px solid rgba(239,68,68,0.2); }
        .learn-feedback .override-btn { margin-left: auto; padding: 6px 14px; border-radius: 8px; border: 1.5px solid currentColor; background: transparent; color: inherit; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; opacity: 0.7; transition: all 0.15s; }
        .learn-feedback .override-btn:hover { opacity: 1; background: rgba(239,68,68,0.1); }

        .learn-explain-btn { display: inline-flex; align-items: center; gap: 6px; padding: 12px 24px; border-radius: 12px; border: 2px solid var(--study-accent); background: transparent; color: var(--study-accent); font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all 0.15s; box-shadow: 3px 3px 0 var(--study-accent-dim, rgba(0,0,0,0.2)); }
        .learn-explain-btn:hover { background: var(--study-accent); color: #fff; transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(232,133,58,0.25); }
        .learn-explain-card { max-width: 620px; width: 100%; margin: 16px auto 0; padding: 18px 20px; border-radius: 14px; border: 1.5px solid var(--study-border); border-left: 5px solid var(--study-accent); background: var(--study-bg-secondary); box-shadow: 4px 4px 0 var(--study-accent-dim, rgba(0,0,0,0.3)); animation: learnSlideIn 0.3s ease; }
        .learn-explain-header { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--study-accent); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
        .learn-explain-body { font-size: 14px; line-height: 1.65; color: var(--study-text); }

        .learn-continue-btn { display: inline-flex; align-items: center; padding: 12px 32px; border-radius: 12px; border: 2px solid var(--study-border); background: var(--study-bg-secondary); color: var(--study-text); font-weight: 700; font-size: 15px; cursor: pointer; font-family: inherit; transition: all 0.15s; box-shadow: 3px 3px 0 rgba(0,0,0,0.15); }
        .learn-continue-btn:hover { border-color: var(--study-accent); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--study-accent-dim, rgba(232,133,58,0.15)); }

        .learn-round-summary { text-align: center; padding: 56px 24px; animation: learnPop 0.4s ease; }
        .learn-round-summary h3 { font-size: 26px; font-weight: 800; margin-bottom: 24px; }
        .learn-round-stats { display: flex; gap: 24px; justify-content: center; margin-bottom: 32px; flex-wrap: wrap; }
        .learn-round-stat { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; padding: 8px 16px; border-radius: 10px; background: var(--study-bg-secondary); border: 1.5px solid var(--study-border); }
        .learn-round-stat i { width: 18px; height: 18px; }
        .learn-complete { text-align: center; padding: 56px 24px; animation: learnPop 0.4s ease; }
        .learn-complete h3 { font-size: 28px; font-weight: 800; margin-bottom: 10px; }
        .learn-complete p { color: var(--study-text-secondary); font-size: 15px; margin-bottom: 28px; }
        .learn-complete-actions { display: flex; gap: 14px; justify-content: center; }
        /* Learn config modal */
        .learn-config-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 999; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
        .learn-config-modal { background: var(--bg-raised, var(--study-bg-secondary)); color: var(--text-primary, var(--study-text)); border: 1px solid var(--border-default, var(--study-border)); border-radius: 24px; padding: 40px 44px; max-width: 560px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
        .learn-config-modal h3 { font-size: 24px; font-weight: 700; margin-bottom: 6px; text-align: center; color: var(--text-primary, var(--study-text)); }
        .learn-config-section { margin-bottom: 24px; }
        .learn-config-section label { font-size: 13px; font-weight: 700; color: var(--text-secondary, var(--study-text-secondary)); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; display: block; }
        .learn-config-options { display: flex; gap: 12px; }
        .learn-config-opt { flex: 1; padding: 20px 14px; border-radius: 14px; border: 1.5px solid var(--border-default, var(--study-border)); background: var(--bg-elevated, var(--study-bg-tertiary)); cursor: pointer; text-align: center; transition: all 0.15s; color: var(--text-primary, var(--study-text)); }
        .learn-config-opt:hover { border-color: color-mix(in srgb, var(--accent-orange, var(--study-accent)) 32%, var(--border-default, var(--study-border))); background: color-mix(in srgb, var(--accent-orange, var(--study-accent)) 6%, var(--bg-elevated, var(--study-bg-tertiary))); }
        .learn-config-opt.active { border-color: var(--accent-orange, var(--study-accent)); background: color-mix(in srgb, var(--accent-orange, var(--study-accent)) 10%, var(--bg-elevated, var(--study-bg-tertiary))); }
        .learn-config-start { width: 100%; padding: 16px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--accent-orange, var(--study-accent)) 35%, transparent); background: var(--accent-orange, var(--study-accent)); color: #fff; font-size: 17px; font-weight: 700; cursor: pointer; font-family: inherit; transition: opacity 0.15s, transform 0.15s; margin-top: 12px; }
        .learn-config-start:hover { opacity: 0.92; transform: translateY(-1px); }
        .review-create-overlay { position: fixed; inset: 0; z-index: 999; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(6px); }
        .review-create-modal { width: min(720px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--study-bg-secondary, #fff); color: var(--study-text); border: 1px solid color-mix(in srgb, var(--study-border) 85%, transparent); border-radius: 24px; box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25); }
        .review-create-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 24px 24px 18px; border-bottom: 1px solid color-mix(in srgb, var(--study-border) 75%, transparent); }
        .review-create-head h3 { margin: 0 0 6px; font-size: 24px; font-weight: 700; color: var(--study-text); }
        .review-create-head p { margin: 0; font-size: 14px; color: var(--study-text-secondary); }
        .review-create-close { width: 38px; height: 38px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--study-border) 80%, transparent); background: var(--study-bg); color: var(--study-text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; }
        .review-create-close:hover { color: var(--study-text); border-color: color-mix(in srgb, var(--study-accent) 35%, var(--study-border)); }
        .review-create-mode-row { display: flex; gap: 10px; padding: 18px 24px 0; }
        .review-create-mode-btn { border: 1px solid color-mix(in srgb, var(--study-border) 85%, transparent); background: var(--study-bg); color: var(--study-text-secondary); border-radius: 999px; padding: 10px 16px; font-family: inherit; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
        .review-create-mode-btn.active { color: var(--study-text); border-color: color-mix(in srgb, var(--study-accent) 35%, var(--study-border)); background: color-mix(in srgb, var(--study-accent) 10%, var(--study-bg)); }
        .review-create-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 18px; }
        .review-create-group { display: flex; flex-direction: column; gap: 8px; }
        .review-create-label { font-size: 12px; font-weight: 700; color: var(--study-text-secondary); text-transform: uppercase; letter-spacing: 0.08em; }
        .review-create-optional { font-size: 12px; font-weight: 500; color: var(--study-text-tertiary); text-transform: none; letter-spacing: 0; }
        .review-create-input,
        .review-create-textarea { width: 100%; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--study-border) 85%, transparent); background: var(--study-bg); color: var(--study-text); font-family: inherit; font-size: 14px; padding: 14px 16px; outline: none; resize: vertical; }
        .review-create-input:focus,
        .review-create-textarea:focus { border-color: color-mix(in srgb, var(--study-accent) 45%, var(--study-border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--study-accent) 12%, transparent); }
        .review-create-textarea { min-height: 150px; }
        .review-create-textarea-sm { min-height: 96px; }
        .review-create-mode-pane { display: none; }
        .review-create-mode-pane.active { display: block; }
        .review-create-dropzone { width: 100%; min-height: 160px; border-radius: 20px; border: 1.5px dashed color-mix(in srgb, var(--study-border) 85%, transparent); background: color-mix(in srgb, var(--study-bg) 75%, var(--study-bg-secondary)); color: var(--study-text-secondary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-family: inherit; padding: 20px; text-align: center; }
        .review-create-dropzone.dragover { border-color: color-mix(in srgb, var(--study-accent) 48%, var(--study-border)); background: color-mix(in srgb, var(--study-accent) 6%, var(--study-bg)); }
        .review-create-dropzone i { width: 22px; height: 22px; color: var(--study-accent); }
        .review-create-dropzone strong { font-size: 15px; color: var(--study-text); }
        .review-create-dropzone span { font-size: 12px; color: var(--study-text-secondary); }
        .review-create-file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
        .review-create-file-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--study-border) 80%, transparent); background: var(--study-bg); }
        .review-create-file-name { display: inline-flex; align-items: center; gap: 8px; color: var(--study-text); font-size: 13px; font-weight: 600; }
        .review-create-file-name i { width: 14px; height: 14px; color: var(--study-text-secondary); }
        .review-create-file-size { margin-left: auto; font-size: 12px; color: var(--study-text-tertiary); }
        .review-create-file-remove { width: 28px; height: 28px; border-radius: 999px; border: none; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; }
        .review-create-file-remove:hover { background: color-mix(in srgb, var(--study-accent) 10%, transparent); color: var(--study-accent); }
        .review-create-foot { padding: 18px 24px 24px; border-top: 1px solid color-mix(in srgb, var(--study-border) 75%, transparent); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
        .review-create-foot-note { font-size: 12px; color: var(--study-text-tertiary); }
        .review-create-actions { display: flex; gap: 10px; }
        .review-create-cancel,
        .review-create-generate { border-radius: 14px; padding: 12px 18px; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
        .review-create-cancel { background: var(--study-bg); color: var(--study-text-secondary); border: 1px solid color-mix(in srgb, var(--study-border) 85%, transparent); }
        .review-create-generate { background: var(--study-accent); color: #fff; border: 1px solid color-mix(in srgb, var(--study-accent) 45%, transparent); }
        .review-create-generate:hover { filter: brightness(0.98); }
        .review-create-generate:disabled { opacity: 0.75; cursor: progress; }
        .review-gen-progress-overlay { position: fixed; inset: 0; z-index: 1001; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(15, 23, 42, 0.48); backdrop-filter: blur(6px); }
        .review-gen-progress-card { width: min(520px, 100%); border-radius: 24px; background: var(--study-bg-secondary, #fff); border: 1px solid color-mix(in srgb, var(--study-border) 85%, transparent); box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28); padding: 32px 28px; text-align: center; }
        .review-gen-progress-spinner { width: 44px; height: 44px; margin: 0 auto 18px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--study-border) 90%, transparent); border-top-color: var(--study-accent); animation: spin .8s linear infinite; }
        .review-gen-progress-card h3 { margin: 0 0 10px; font-size: 22px; font-weight: 800; color: var(--study-text); }
        .review-gen-progress-card p { margin: 0 auto 18px; max-width: 420px; color: var(--study-text-secondary); font-size: 14px; line-height: 1.65; }
        .review-gen-progress-bar { width: 100%; height: 10px; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--study-border) 80%, transparent); margin-bottom: 14px; }
        .review-gen-progress-bar-fill { width: 40%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--study-accent) 70%, #fff), var(--study-accent)); animation: reviewGenSlide 1.15s ease-in-out infinite; }
        .review-gen-progress-note { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--study-text-tertiary); }
        @keyframes reviewGenSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }
        .nav-due-badge { background: var(--study-accent, #52b788); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; margin-left: 6px; min-width: 16px; text-align: center; }
        .fc-delete { position: absolute; bottom: 16px; left: 16px; background: none; border: none; color: var(--study-text-tertiary); cursor: pointer; }
        .fc-delete:hover { color: var(--study-red); }
        .fc-delete i { width: 16px; height: 16px; }

        /* ── Review/Learn Mobile Responsive ── */
        @media (max-width: 768px) and (pointer: coarse) , (max-width: 480px) {
            .review-landing { padding: 20px 12px; }
            .review-search-shell { min-width: 0; flex: 1; }
            .review-landing-section-head { flex-direction: column; align-items: flex-start; }
            .review-set-row { grid-template-columns: 1fr; gap: 16px; padding: 18px; border-radius: 18px; }
            .review-set-actions { justify-content: stretch; }
            .review-set-actions > * { width: 100%; justify-content: center; }
            .review-container { padding: 16px 14px 24px; }
            .review-top-bar { gap: 8px; padding-bottom: 12px; }
            .review-mode-tab { padding: 8px 16px; font-size: 13px; }
            .review-card-area .fc-card-wrap { height: 280px; }
            .review-card-area .fc-face { padding: 24px 20px; }
            .review-card-area .fc-text { font-size: 18px; }
            .srs-actions { gap: 8px; }
            .srs-btn { min-width: 65px; padding: 14px 12px; font-size: 12px; }
            .learn-question-text { font-size: 18px; padding: 16px 12px 20px; }
            .learn-config-modal { padding: 24px 20px; }
            .review-create-overlay { padding: 14px; }
            .review-create-head,
            .review-create-body,
            .review-create-foot { padding-left: 18px; padding-right: 18px; }
            .review-create-foot { flex-direction: column; align-items: stretch; }
            .review-create-actions { width: 100%; }
            .review-create-actions > button { flex: 1; justify-content: center; }
        }

        /* Multiple Choice 2x2 */
        .mc-question {
            font-size: clamp(20px, 2.4vw, 24px); font-weight: 700; line-height: 1.5;
            margin-bottom: 28px; text-align: left; padding: 0 0 16px;
            background: none; border: none; border-radius: 0;
            box-shadow: none; color: var(--study-text);
        }
        .mc-question-label {
            font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
            color: var(--study-text-tertiary); margin-bottom: 8px; display: block;
        }
        .mc-grid { display: flex; flex-direction: column; gap: 12px; max-width: 680px; margin: 0 auto; width: 100%; }
        .mc-option {
            padding: 18px 20px; background: var(--study-bg-secondary); border: 2px solid var(--study-border);
            border-radius: 14px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 16px;
            font-size: 15px; font-weight: 600; color: var(--study-text); font-family: inherit; text-align: left;
            position: relative;
        }
        .mc-option:hover:not(.answered) { border-color: var(--study-accent); background: color-mix(in srgb, var(--study-accent) 5%, transparent); }
        .mc-option:active:not(.answered) { transform: scale(0.99); }
        .mc-option .opt-text { flex: 1; }
        .mc-option .opt-radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--study-border); flex-shrink: 0; transition: all 0.2s; }
        .mc-option:hover:not(.answered) .opt-radio { border-color: var(--study-accent); }
        .mc-option.correct .opt-radio { border-color: var(--study-green); background: var(--study-green); box-shadow: inset 0 0 0 3px #fff; }
        .mc-option.wrong .opt-radio { border-color: var(--study-red); background: var(--study-red); box-shadow: inset 0 0 0 3px #fff; }
        .mc-option .opt-num {
            width: 32px; height: 32px; border-radius: 50%;
            background: var(--study-bg-tertiary); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
            font-weight: 800; font-size: 13px;
        }
        .mc-option.correct { border-color: var(--study-green); background: color-mix(in srgb, var(--study-green) 8%, transparent); }
        .mc-option.correct .opt-num { background: var(--study-green); color: #fff; }
        .mc-option.wrong { border-color: var(--study-red); background: color-mix(in srgb, var(--study-red) 6%, transparent); }
        .mc-option.wrong .opt-num { background: var(--study-red); color: #fff; }
        .mc-option.answered { pointer-events: none; }

        /* Fill-in-Blanks */
        .fib-container { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 32px 0; max-width: 720px; margin: 0 auto; width: 100%; }
        .fib-content-area { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; }
        .fib-sentence { font-size: clamp(20px, 2.4vw, 24px); font-weight: 600; line-height: 1.8; text-align: left; margin-bottom: 28px; padding: 0 0 16px; background: none; border: none; border-radius: 0; box-shadow: none; color: var(--study-text); }
        .fib-blank { display: inline-block; border-bottom: 3px solid var(--study-accent); min-width: 120px; padding: 2px 4px; }
        .fib-input-row { display: flex; gap: 12px; width: 100%; max-width: 560px; margin-bottom: 16px; }
        .fib-input { flex: 1; padding: 16px 20px; background: var(--study-bg-card, var(--bg-card, #fff)); border: 2px solid var(--study-border); border-radius: 14px; color: var(--study-text); font-size: 17px; font-family: inherit; outline: none; text-align: center; box-shadow: 3px 3px 0 rgba(0,0,0,0.08); transition: all 0.15s; }
        .fib-input:focus { border-color: var(--study-accent); box-shadow: 3px 3px 0 var(--study-accent-dim, rgba(232,133,58,0.15)); }
        .fib-check {
            padding: 12px 28px; background: linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 92%, #fff), var(--study-accent), color-mix(in srgb, var(--study-accent) 88%, #000)); color: #fff;
            border: none; border-radius: 12px;
            font-weight: 800; cursor: pointer; font-size: 14px; font-family: inherit;
            box-shadow: 3px 3px 0 rgba(0,0,0,0.15); transition: all 0.15s;
            text-transform: uppercase; letter-spacing: 0.03em;
        }
        .fib-check:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(0,0,0,0.2); }
        .fib-check:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0,0,0,0.1); }
        .fib-hint { color: var(--study-accent); font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 6px; margin-bottom: 16px; }
        .fib-hint i { width: 16px; height: 16px; }
        .fib-feedback { font-size: 16px; margin-bottom: 16px; font-weight: 600; }
        .fib-feedback.correct { color: var(--study-green); }
        .fib-feedback.wrong { color: var(--study-red); }

        /* Written Test */
        .wt-container { flex: 1; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; width: 100%; padding: 32px 0; }
        .wt-content-area { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; }
        .wt-question { font-size: clamp(20px, 2.4vw, 24px); font-weight: 700; line-height: 1.5; margin-bottom: 28px; padding: 0 0 16px; background: none; border: none; border-radius: 0; box-shadow: none; color: var(--study-text); }
        .wt-textarea { width: 100%; min-height: 160px; max-height: 340px; padding: 18px 20px; background: var(--study-bg-card, var(--bg-card, #fff)); border: 2px solid var(--study-border); border-radius: 14px; color: var(--study-text); font-family: inherit; font-size: 16px; resize: vertical; outline: none; margin-bottom: 16px; box-shadow: 3px 3px 0 rgba(0,0,0,0.08); transition: all 0.15s; }
        .wt-textarea:focus { border-color: var(--study-accent); box-shadow: 3px 3px 0 var(--study-accent-dim, rgba(232,133,58,0.15)); }
        .wt-submit {
            padding: 12px 28px; background: linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 92%, #fff), var(--study-accent), color-mix(in srgb, var(--study-accent) 88%, #000)); color: #fff;
            border: none; border-radius: 12px;
            font-weight: 800; font-size: 14px; cursor: pointer; align-self: flex-end;
            box-shadow: 3px 3px 0 rgba(0,0,0,0.15); transition: all 0.15s; font-family: inherit;
            text-transform: uppercase; letter-spacing: 0.03em;
        }
        .wt-submit:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(0,0,0,0.2); }
        .wt-submit:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0,0,0,0.1); }
        .wt-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: 2px 2px 0 rgba(0,0,0,0.08); }
        .wt-feedback { margin-top: 16px; padding: 18px 20px; border-radius: 14px; border: 1.5px solid var(--study-border); border-left: 5px solid var(--study-accent); background: var(--study-bg-secondary); box-shadow: 3px 3px 0 var(--study-accent-dim, rgba(0,0,0,0.2)); animation: learnSlideIn 0.3s ease; }
        .wt-grade-badge { display: inline-block; padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; border: 1.5px solid currentColor; }
        .wt-grade-correct { background: rgba(34,197,94,0.15); color: var(--study-green); }
        .wt-grade-partial { background: var(--study-accent-dim); color: var(--study-accent); }
        .wt-grade-incorrect { background: rgba(239,68,68,0.15); color: var(--study-red); }
        .wt-feedback-text { font-size: 14px; color: var(--study-text-secondary); line-height: 1.6; }

        /* Notes / Lesson view */
        .notes-view { padding: 26px 34px; max-width: 980px; margin: 0 auto; font-size: 16px; line-height: 1.78; color: var(--study-text); }
        .notes-view h1 { font-size: clamp(2rem, 1.35rem + 1.3vw, 2.65rem); font-weight: 800; margin: 14px 0 22px; letter-spacing: -0.02em; text-align: center; line-height: 1.16; }
        .notes-view h2 { font-size: 2rem; font-weight: 800; margin: 34px 0 16px; letter-spacing: -0.02em; line-height: 1.2; }
        .notes-view h3 { font-size: 1.45rem; font-weight: 700; margin: 24px 0 12px; letter-spacing: -0.01em; }
        .notes-view p { margin: 10px 0 14px; }
        .notes-view ul,.notes-view ol { margin: 10px 0 16px; padding-left: 26px; }
        .notes-view li { margin-bottom: 8px; line-height: 1.66; }
        .notes-view li > ul, .notes-view li > ol { margin-top: 6px; margin-bottom: 4px; }
        .notes-view strong { color: var(--study-accent); }
        .notes-view a { color: #6366f1; text-decoration: underline; text-underline-offset: 2px; }
        .notes-view hr { border: none; border-top: 1.5px solid var(--study-border); margin: 34px 0; }
        .notes-view blockquote { border-left: 4px solid #6366f1; padding: 10px 18px; margin: 18px 0; background: color-mix(in srgb, #6366f1 8%, transparent); border-radius: 0 8px 8px 0; font-style: italic; }
        .notes-view code { background: var(--study-bg-tertiary); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
        .notes-view pre { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 8px; padding: 14px; margin: 16px 0; overflow-x: auto; }
        .notes-view pre code { background: transparent; padding: 0; }

        /* ── Rich Notes — Numbered Sections ── */
        .notes-view h2 .section-num {
            display: inline-flex; align-items: center; justify-content: center;
            width: 32px; height: 32px; border-radius: 50%; background: var(--study-accent);
            color: #fff; font-size: 14px; font-weight: 800; margin-right: 10px; vertical-align: middle;
            flex-shrink: 0;
        }

        /* ── Rich Notes — Concept Cards Grid ── */
        .notes-concept-grid {
            display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 14px; margin: 20px 0 28px;
        }
        .notes-concept-card {
            padding: 20px; border-radius: 12px; border: 1.5px solid var(--study-border);
            background: var(--study-bg-secondary); transition: all 0.15s;
            box-shadow: 3px 3px 0 var(--study-accent-dim, rgba(0,0,0,0.15));
        }
        .notes-concept-card:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(232,133,58,0.2); border-color: var(--study-accent); }
        .notes-concept-card-icon { font-size: 28px; margin-bottom: 10px; }
        .notes-concept-card-title { font-size: 15px; font-weight: 700; color: var(--study-text); margin-bottom: 6px; }
        .notes-concept-card-desc { font-size: 13px; color: var(--study-text-tertiary); line-height: 1.5; }

        /* ── Rich Notes — Formula Block ── */
        .notes-formula-block {
            padding: 24px; border-radius: 14px; border: 1.5px solid var(--study-border);
            background: var(--study-bg-secondary); margin: 20px 0 28px; text-align: center;
        }
        .notes-formula-header {
            display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
            font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--study-text-tertiary);
        }
        .notes-formula-tag { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--study-accent); color: var(--study-accent); }
        .notes-formula-expr { font-size: 28px; font-weight: 800; font-family: 'Courier New', monospace; color: var(--study-text); margin: 16px 0; letter-spacing: 0.02em; }
        .notes-formula-desc { font-size: 13px; color: var(--study-text-tertiary); max-width: 500px; margin: 0 auto 16px; line-height: 1.5; }
        .notes-formula-vars { text-align: left; margin: 0 auto; max-width: 360px; }
        .notes-formula-vars-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--study-text-tertiary); margin-bottom: 8px; }
        .notes-formula-var { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
        .notes-formula-var-name { font-weight: 800; color: var(--study-accent); min-width: 30px; }
        .notes-formula-var-desc { color: var(--study-text-secondary); }

        /* ── Rich Notes — Summary / Key Takeaways ── */
        .notes-summary {
            padding: 24px; border-radius: 14px; border: 1.5px solid var(--study-border);
            background: var(--study-bg-secondary); margin: 28px 0;
        }
        .notes-summary-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
        .notes-summary-icon { font-size: 24px; }
        .notes-summary-title { font-size: 22px; font-weight: 800; color: var(--study-text); }
        .notes-summary-sub { font-size: 13px; color: var(--study-text-tertiary); margin-bottom: 16px; }
        .notes-summary-item {
            display: flex; align-items: flex-start; gap: 14px; padding: 14px 0;
            border-bottom: 1px solid rgba(255,255,255,0.04);
        }
        .notes-summary-item:last-child { border-bottom: none; }
        .notes-summary-num { font-size: 13px; font-weight: 700; color: var(--study-text-tertiary); min-width: 24px; padding-top: 2px; }
        .notes-summary-text { font-size: 15px; color: var(--study-text); line-height: 1.5; }

        /* ── Rich Notes — Tables ── */
        .notes-view table {
            width: 100%; border-collapse: collapse; margin: 20px 0 28px;
            border-radius: 10px; overflow: hidden; border: 1.5px solid var(--study-border);
        }
        .notes-view thead { background: var(--study-bg-secondary); }
        .notes-view th {
            font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
            color: var(--study-text-tertiary); padding: 12px 16px; text-align: left;
        }
        .notes-view td { padding: 12px 16px; border-top: 1px solid var(--study-border); font-size: 14px; color: var(--study-text-secondary); }
        .notes-view tbody tr:hover { background: rgba(255,255,255,0.02); }

        /* ── Rich Notes — Important callout ── */
        .notes-callout {
            padding: 16px 18px; border-radius: 10px; border-left: 4px solid var(--study-accent);
            background: rgba(232,133,58,0.06); margin: 18px 0;
        }
        .notes-callout-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--study-accent); margin-bottom: 4px; }
        .notes-callout-text { font-size: 14px; color: var(--study-text-secondary); line-height: 1.5; }

        .notes-empty { text-align: center; padding: 60px 20px; color: var(--study-text-tertiary); }
        .notes-empty i { width: 48px; height: 48px; margin-bottom: 12px; }
        .notes-empty h3 { font-size: 22px; font-weight: 800; margin: 0 0 10px; color: var(--study-text); letter-spacing: -0.03em; }
        .notes-empty p { color: var(--study-text-secondary); font-size: 14px; line-height: 1.65; max-width: 36rem; margin: 0 auto 18px; }
        .study-illustration { display: block; width: 100%; height: auto; user-select: none; pointer-events: none; }
        .notes-empty-visual { display: flex; justify-content: center; margin-bottom: 18px; }
        .notes-empty-illustration { width: min(280px, 72vw); filter: drop-shadow(0 18px 30px rgba(15, 23, 42, 0.08)); }

        /* ── Modular Course View ── */
        .module-nav-group { padding: 6px 10px; }
        .module-nav-label { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--study-text-muted); padding: 8px 12px 5px; }
        .module-nav-item {
            display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
            font-size: 12px; font-weight: 500; color: var(--study-text-secondary); cursor: pointer;
            transition: all 0.15s; width: 100%; border: none; background: transparent; text-align: left; font-family: inherit;
        }
        .module-nav-item:hover { background: rgba(255,255,255,0.06); color: var(--study-text); }
        .module-nav-item.active { background: rgba(255,255,255,0.08); color: var(--study-text); font-weight: 600; }
        .module-nav-item.completed { color: var(--study-text-tertiary); }
        .module-nav-num { font-size: 10px; font-weight: 700; color: var(--study-text-tertiary); min-width: 16px; }
        .module-nav-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
        .module-nav-kicker { font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--study-text-tertiary); }
        .module-nav-item.active .module-nav-num { color: var(--study-accent); }
        .module-nav-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .module-nav-check { width: 22px; height: 22px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--study-text-tertiary); }
        .module-nav-check i { width: 14px; height: 14px; }

        /* Course view — warm editorial style (Holospark-inspired) */
        /* Course view uses default study-bg — no custom background color */

        .module-hero {
            border-radius: 16px; padding: 40px 44px 36px; margin-bottom: 44px;
            background: linear-gradient(135deg, var(--study-hero-start, #3d3d3d) 0%, var(--study-hero-mid, #5a4a3a) 50%, var(--study-hero-end, #c4703a) 100%);
            color: #fff; position: relative; overflow: hidden; min-height: 240px;
            display: flex; flex-direction: column; justify-content: flex-end;
        }
        .module-hero-img {
            position: absolute; top: 20px; right: 20px; width: 240px; height: 190px;
            border-radius: 14px; object-fit: cover; box-shadow: 0 8px 30px rgba(0,0,0,0.3);
        }
        .module-hero-badges { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
        .module-hero-badge {
            display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px;
            border-radius: 20px; font-size: 10px; font-weight: 800; text-transform: uppercase;
            letter-spacing: 0.06em; width: fit-content;
        }
        .module-hero-badge-subject { background: rgba(232,133,58,0.25); color: #e8853a; }
        .module-hero-badge-source { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.6); }
        .module-hero-title { font-size: 36px; font-weight: 700; line-height: 1.15; margin-bottom: 16px; color: #fff; font-family: 'Georgia', 'Times New Roman', serif; max-width: 58%; }
        .module-hero-desc { font-size: 15px; color: rgba(255,255,255,0.75); line-height: 1.7; max-width: 58%; }

        /* Module title below hero — large serif like Holospark */
        .module-section-title {
            font-size: 2.4rem; font-weight: 700; color: var(--study-text); margin: 0 0 10px;
            font-family: 'Georgia', 'Times New Roman', serif; line-height: 1.2;
        }

        .module-content { max-width: 780px; margin: 0 auto; width: 100%; }
        .module-content .notes-view { padding: 0; font-size: 16px; line-height: 1.85; color: var(--study-text); }
        .module-content .notes-view h2 {
            font-size: 1.8rem; font-weight: 700; margin-top: 48px; margin-bottom: 16px;
            color: var(--study-text); font-family: 'Georgia', 'Times New Roman', serif; letter-spacing: -0.01em;
        }
        .module-content .notes-view h3 {
            font-size: 1.35rem; font-weight: 700; margin-top: 32px; margin-bottom: 12px;
            color: var(--study-text);
        }
        .module-content .notes-view strong { color: var(--study-text); font-weight: 700; }
        [data-theme="dark"] .module-content .notes-view strong { font-weight: 800; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; }
        .module-content .notes-view blockquote {
            border-left: 4px solid var(--study-accent); padding: 20px 28px; margin: 28px 0;
            background: var(--study-accent-dim); border-radius: 0 12px 12px 0; font-style: italic;
            color: var(--study-text-secondary);
        }
        .module-content .notes-view table { margin: 28px 0; border-radius: 12px; overflow: hidden; }
        .module-content .notes-view th { background: var(--study-accent-dim); color: var(--study-accent); }
        .module-content .notes-view ul, .module-content .notes-view ol { margin: 12px 0 20px; }
        .module-content .notes-view li { margin-bottom: 10px; }

        /* Module section numbers */
        .module-content .notes-view .section-num {
            background: var(--study-accent); width: 36px; height: 36px; font-size: 15px;
        }

        .module-nav-sep { border-top: 1px solid var(--study-border); margin: 6px 12px; }

        /* Study Guide checklist */
        .study-guide-list { display: flex; flex-direction: column; gap: 6px; }
        .study-guide-item { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--study-border); background: var(--study-bg-secondary); cursor: pointer; transition: all 0.15s; }
        .study-guide-item:hover { border-color: var(--study-accent); background: var(--study-accent-dim); }
        .study-guide-item.done { border-color: rgba(34,197,94,0.2); }
        .study-guide-item.done:hover { border-color: rgba(34,197,94,0.4); }
        .study-guide-check { flex-shrink: 0; padding-top: 1px; }
        .study-guide-text { flex: 1; min-width: 0; }
        .study-guide-step { font-size: 15px; font-weight: 600; color: var(--study-text); line-height: 1.4; }
        .study-guide-desc { font-size: 13px; color: var(--study-text-tertiary); margin-top: 4px; line-height: 1.4; }

        /* Study Guide — phased plan */
        .sg-phase { border-radius: 14px; border: 1.5px solid var(--study-border); background: var(--study-bg-secondary); overflow: hidden; transition: all 0.15s; }
        .sg-phase:hover { border-color: rgba(255,255,255,0.12); }
        .sg-phase-done { opacity: 0.6; }
        .sg-phase-header { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-left: 5px solid var(--study-accent); }
        .sg-phase-icon { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,0.06); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
        .sg-phase-meta { flex: 1; min-width: 0; }
        .sg-phase-title { font-size: 15px; font-weight: 700; color: var(--study-text); margin-bottom: 4px; }
        .sg-phase-tags { display: flex; align-items: center; gap: 8px; }
        .sg-tag { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 4px; border: 1px solid; text-transform: uppercase; letter-spacing: 0.04em; }
        .sg-tag-time { font-size: 11px; color: var(--study-text-tertiary); display: flex; align-items: center; gap: 3px; }
        .sg-phase-steps { padding: 4px 18px 12px; }
        .sg-phase-steps .study-guide-item { border: none; background: transparent; padding: 10px 0; border-radius: 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
        .sg-phase-steps .study-guide-item:last-child { border-bottom: none; }
        .sg-phase-steps .study-guide-item:hover { background: transparent; }
        .sg-phase-tip { padding: 10px 18px 14px; font-size: 12px; color: var(--study-accent); display: flex; align-items: flex-start; gap: 6px; line-height: 1.4; border-top: 1px solid rgba(255,255,255,0.04); }

        /* Study Guide v3 — Academic Sanctuary */
        .sg2-shell {
            overflow-y: auto;
            scrollbar-width: none;
            -ms-overflow-style: none;
            padding: 40px 48px 60px;
            display: flex;
            flex-direction: column;
            gap: 0;
            max-width: 1100px;
            margin: 0 auto;
            width: 100%;
        }
        .sg2-shell::-webkit-scrollbar { display: none; }
        .sg2-hero {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
            text-align: left;
            gap: 20px;
            padding: 0 0 24px;
            border-radius: 0;
            background: transparent;
            border: none;
            box-shadow: none;
        }
        .sg2-hero-text { flex: 1; min-width: 0; }
        .sg2-hero-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
        .sg2-hero-tag {
            display: inline-flex; align-items: center; gap: 5px;
            font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
            color: var(--study-accent); background: var(--study-accent-dim, rgba(232,133,58,0.08));
            padding: 4px 12px; border-radius: 999px;
        }
        .sg2-hero-exam {
            display: inline-flex; align-items: center; gap: 5px;
            font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
            color: #ef4444; background: rgba(239,68,68,0.08);
            padding: 4px 12px; border-radius: 999px;
        }
        .sg2-hero-ring {
            position: relative; flex-shrink: 0; width: 72px; height: 72px;
        }
        .sg2-ring-progress {
            transition: stroke-dashoffset 0.8s ease-out;
        }
        .sg2-ring-pct {
            position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
            font-size: 16px; font-weight: 900; color: var(--study-text);
        }
        .sg2-stats-row {
            display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
            margin-bottom: 28px;
        }
        .sg2-stat-card {
            display: flex; flex-direction: column; align-items: center; gap: 2px;
            padding: 14px 12px; border-radius: 12px;
            background: var(--study-bg-secondary, #fff);
            border: 1px solid var(--study-border);
        }
        .sg2-stat-card.has-alert .sg2-stat-value { color: #ef4444; }
        .sg2-stat-value {
            font-size: 20px; font-weight: 900; color: var(--study-text);
        }
        .sg2-stat-label {
            font-size: 11px; font-weight: 600; color: var(--study-text-tertiary);
            text-transform: uppercase; letter-spacing: 0.06em;
        }
        .sg2-breadcrumb {
            display: none;
        }
        .sg2-eyebrow, .sg2-side-kicker, .sg2-section-kicker, .sg2-next-kicker, .sg2-progress-label {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--accent-orange);
        }
        .sg2-eyebrow i, .sg2-stat i, .sg2-phase-time i, .sg2-btn i, .sg2-tool-icon i, .sg2-regenerate i {
            width: 14px;
            height: 14px;
            flex-shrink: 0;
        }
        .sg2-hero-top {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 18px;
            flex-wrap: wrap;
        }
        .sg2-title {
            margin: 0;
            font-size: clamp(2.2rem, 2rem + 1.2vw, 3rem);
            line-height: 1.08;
            letter-spacing: -0.03em;
            font-weight: 900;
            color: var(--text-primary);
        }
        .sg2-subtitle {
            margin: 6px 0 0;
            font-size: 14px;
            line-height: 1.5;
            color: var(--text-secondary);
        }
        @media (max-width: 580px) {
            .sg2-hero { flex-direction: column; text-align: center; align-items: center; }
            .sg2-stats-row { grid-template-columns: 1fr; }
        }
        /* Focus Banner */
        .sg2-focus-banner {
            position: relative;
            overflow: hidden;
            border-radius: 16px;
            min-height: 300px;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            padding: 40px;
            margin-bottom: 48px;
            background: linear-gradient(135deg, #3d3d3d 0%, #5a4a3a 35%, #8a6b4a 65%, #c4703a 100%);
        }
        .sg2-focus-bg {
            position: absolute;
            inset: 0;
            background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.15) 50%, transparent 100%);
            z-index: 1;
        }
        .sg2-focus-content {
            position: relative;
            z-index: 2;
        }
        .sg2-focus-pill {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 14px;
            border-radius: 999px;
            background: var(--study-accent-dim, rgba(232,133,58,0.15));
            color: #ffb596;
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            margin-bottom: 16px;
        }
        .sg2-focus-title {
            margin: 0 0 12px;
            font-size: clamp(1.6rem, 1.2rem + 1vw, 2.2rem);
            line-height: 1.15;
            letter-spacing: -0.02em;
            font-weight: 800;
            color: #fff;
            max-width: 600px;
        }
        .sg2-focus-desc {
            margin: 0 0 24px;
            font-size: 15px;
            line-height: 1.6;
            color: rgba(255,255,255,0.7);
            max-width: 520px;
        }
        .sg2-focus-meta {
            margin: -12px 0 20px;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.01em;
            color: rgba(255,255,255,0.82);
            max-width: 520px;
        }
        .sg2-focus-btns {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }
        .sg2-focus-btn-primary {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 12px 24px;
            border-radius: 8px;
            border: none;
            background: linear-gradient(135deg, var(--study-accent) 0%, #c4703a 100%);
            color: #fff;
            font-size: 14px;
            font-weight: 700;
            font-family: inherit;
            cursor: pointer;
            box-shadow: 0 4px 14px rgba(232,133,58,0.3);
            transition: all 0.15s;
        }
        .sg2-focus-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,133,58,0.4); }
        .sg2-focus-btn-secondary {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 12px 24px;
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.2);
            background: rgba(255,255,255,0.08);
            color: rgba(255,255,255,0.85);
            font-size: 14px;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            transition: all 0.15s;
        }
        .sg2-focus-btn-secondary:hover { background: rgba(255,255,255,0.15); }
        /* Study Path */
        .sg2-path-section { width: 100%; }
        .sg2-path-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            margin-bottom: 24px;
            flex-wrap: wrap;
        }
        .sg2-path-title {
            margin: 0;
            font-size: 1.6rem;
            font-weight: 800;
            letter-spacing: -0.02em;
            color: var(--text-primary);
        }
        .sg2-path-filters {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .sg2-filter-label {
            font-size: 12px;
            font-weight: 500;
            color: var(--text-tertiary);
        }
        .sg2-filter-tabs {
            display: flex;
            background: var(--study-bg-tertiary, #f0eeeb);
            border-radius: 999px;
            padding: 3px;
        }
        .sg2-filter-tab {
            padding: 5px 16px;
            border-radius: 999px;
            border: none;
            background: transparent;
            font-size: 12px;
            font-weight: 700;
            color: var(--text-secondary);
            cursor: pointer;
            font-family: inherit;
            transition: all 0.15s;
        }
        .sg2-filter-tab.active {
            background: var(--study-bg-secondary, #fff);
            color: var(--study-accent);
            box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        }
        .sg2-filter-tab:hover:not(.active) { color: var(--study-accent); }
        /* Module Cards */
        .sg2-module-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .sg2-module {
            background: var(--study-bg-secondary, #fff);
            border-radius: 16px;
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.03);
            transition: all 0.2s;
        }
        .sg2-module:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.05); }
        .sg2-module.is-open {
            box-shadow: 0 2px 8px rgba(0,0,0,0.05), 0 16px 40px rgba(0,0,0,0.06);
            outline: 2px solid var(--study-accent-dim, var(--study-accent-dim, rgba(232,133,58,0.08)));
        }
        .sg2-module-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            padding: 20px 24px;
            cursor: pointer;
        }
        .sg2-module-left {
            display: flex;
            align-items: center;
            gap: 18px;
            min-width: 0;
        }
        .sg2-module-icon {
            width: 48px;
            height: 48px;
            border-radius: 14px;
            background: var(--study-bg-tertiary, #f0eeeb);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--study-accent);
            flex-shrink: 0;
            transition: background 0.15s;
        }
        .sg2-module-icon.is-active {
            background: var(--study-accent-dim, var(--study-accent-dim, rgba(232,133,58,0.12)));
        }
        .sg2-module:hover .sg2-module-icon { background: var(--study-accent-dim, var(--study-accent-dim, rgba(232,133,58,0.12))); }
        .sg2-module-info { min-width: 0; }
        .sg2-module-label {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 4px;
        }
        .sg2-module-num {
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.15em;
            text-transform: uppercase;
            color: var(--text-tertiary);
        }
        .sg2-module-dot {
            width: 4px;
            height: 4px;
            border-radius: 50%;
            background: var(--study-border);
        }
        .sg2-module-status {
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
        }
        .sg2-module-title {
            margin: 0;
            font-size: 1.1rem;
            font-weight: 800;
            line-height: 1.3;
            color: var(--text-primary);
        }
        .sg2-module-right {
            display: flex;
            align-items: center;
            gap: 20px;
            flex-shrink: 0;
        }
        .sg2-module-stats {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 2px;
            font-size: 12px;
            font-weight: 500;
            color: var(--text-secondary);
        }
        .sg2-module-chevron {
            opacity: 0.4;
            transition: opacity 0.15s;
        }
        .sg2-module:hover .sg2-module-chevron { opacity: 1; }
        /* Module Body (expanded lessons) */
        .sg2-module-body {
            border-top: 1px solid var(--study-border);
            background: rgba(0,0,0,0.015);
            padding: 20px 24px 24px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .sg2-lesson {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 16px;
            padding: 20px 24px;
            border-radius: 14px;
            background: var(--study-bg-secondary, #fff);
            border: 1px solid var(--study-border);
            transition: all 0.15s;
        }
        .sg2-lesson.is-current {
            border: 2px solid var(--study-accent-dim, rgba(232,133,58,0.25));
        }
        .sg2-module.is-recommended {
            outline: 2px solid var(--study-accent-dim, rgba(232,133,58,0.18));
        }
        .sg2-module-recommended {
            font-size: 9px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
            color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 92%, #fff), var(--study-accent), color-mix(in srgb, var(--study-accent) 88%, #000)); padding: 2px 8px; border-radius: 999px;
            margin-left: 4px;
        }
        .sg2-lesson.is-done {
            opacity: 0.7;
        }
        .sg2-lesson-left {
            display: flex;
            align-items: flex-start;
            gap: 14px;
            min-width: 0;
            flex: 1;
        }
        .sg2-lesson-icon {
            border: none;
            background: var(--study-accent-dim, rgba(232,133,58,0.08));
            padding: 10px;
            border-radius: 10px;
            cursor: pointer;
            color: var(--study-accent);
            flex-shrink: 0;
            margin-top: 2px;
        }
        .sg2-lesson.is-done .sg2-lesson-icon { background: rgba(34,197,94,0.08); color: #22c55e; }
        .sg2-lesson.is-current .sg2-lesson-icon { background: var(--study-accent-dim, rgba(232,133,58,0.12)); color: var(--study-accent); }
        .sg2-lesson-title {
            font-size: 17px;
            font-weight: 700;
            color: var(--text-primary);
            line-height: 1.35;
        }
        .sg2-lesson.is-done .sg2-lesson-title { text-decoration: line-through; color: var(--text-secondary); }
        .sg2-lesson-action {
            border: none;
            background: transparent;
            padding: 8px 16px;
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-secondary);
            cursor: pointer;
            font-family: inherit;
            white-space: nowrap;
            transition: all 0.15s;
            border-radius: 8px;
        }
        .sg2-lesson-action:hover { color: var(--study-accent); background: rgba(232,133,58,0.06); }
        .sg2-lesson-action.is-primary {
            color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 92%, #fff), var(--study-accent), color-mix(in srgb, var(--study-accent) 88%, #000));
            padding: 8px 20px; border-radius: 8px;
        }
        .sg2-lesson-action.is-primary:hover { background: var(--study-accent-hover, var(--accent-orange)); }
        .sg2-lesson-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
        .sg2-lesson-detail { font-size: 14px; color: var(--study-text-secondary); line-height: 1.55; margin-top: 2px; }
        .sg2-lesson-donewhen { font-size: 12px; font-weight: 600; color: var(--study-accent); line-height: 1.4; margin-top: 4px; }
        /* Task Modal */
        .sg-task-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999;
            display: flex; align-items: center; justify-content: center;
            backdrop-filter: blur(4px); padding: 20px;
        }
        .sg-task-modal {
            background: var(--study-bg-secondary, #fff); border-radius: 20px;
            padding: 32px; max-width: 640px; width: 100%;
            max-height: 85vh; overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
        }
        .sg-task-header {
            display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
        }
        .sg-task-type {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 6px 14px; border-radius: 999px;
            background: var(--study-accent-dim, rgba(232,133,58,0.12)); color: var(--study-accent);
            font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
        }
        .sg-task-stages {
            display: flex; align-items: center; gap: 4px;
        }
        .sg-stage {
            font-size: 11px; font-weight: 700; color: var(--study-text-tertiary);
            padding: 4px 10px; border-radius: 999px; transition: all 0.15s;
        }
        .sg-stage.active {
            background: var(--study-accent-dim, rgba(232,133,58,0.12)); color: var(--study-accent);
        }
        .sg-task-lesson-content {
            max-height: 360px; overflow-y: auto; padding: 20px; border-radius: 12px;
            background: var(--study-bg-tertiary); border: 1px solid var(--study-border);
            font-size: 14px; line-height: 1.7; color: var(--study-text-secondary);
            margin-bottom: 16px;
        }
        .sg-task-lesson-content h1, .sg-task-lesson-content h2, .sg-task-lesson-content h3 {
            color: var(--study-text); margin: 16px 0 8px; font-size: 16px;
        }
        .sg-task-lesson-content strong { color: var(--study-accent); }
        .sg-task-lesson-content ul, .sg-task-lesson-content ol { padding-left: 20px; margin: 8px 0; }
        .sg-task-stage { }
        .sg-practice-options { display: flex; flex-direction: column; gap: 8px; }
        .sg-practice-option {
            width: 100%; text-align: left; padding: 14px 18px; border-radius: 12px;
            border: 2px solid var(--study-border); background: var(--study-bg-tertiary);
            color: var(--study-text); font-size: 14px; font-family: inherit; font-weight: 500;
            cursor: pointer; transition: all 0.15s; line-height: 1.4;
        }
        .sg-practice-option:hover:not(:disabled) { border-color: var(--study-accent); background: rgba(232,133,58,0.05); }
        .sg-practice-option:disabled { cursor: default; opacity: 0.7; }
        .sg-practice-option.is-correct { border-color: #22c55e; background: rgba(34,197,94,0.1); color: #22c55e; font-weight: 700; }
        .sg-practice-option.is-wrong { border-color: #ef4444; background: rgba(239,68,68,0.1); color: #ef4444; }
        .sg-task-close {
            border: none; background: transparent; color: var(--study-text-tertiary);
            cursor: pointer; padding: 4px; border-radius: 8px;
        }
        .sg-task-close:hover { background: var(--study-bg-tertiary); }
        .sg-task-title {
            font-size: 22px; font-weight: 800; color: var(--study-text);
            margin: 0 0 10px; line-height: 1.25;
        }
        .sg-task-instruction {
            font-size: 14px; color: var(--study-text-secondary); line-height: 1.6;
            margin: 0 0 16px; padding: 12px 16px; border-radius: 12px;
            background: rgba(232,133,58,0.06); border-left: 3px solid var(--study-accent);
        }
        .sg-task-compare-items {
            display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
            margin-bottom: 16px;
        }
        .sg-task-compare-chip {
            padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
            background: var(--study-bg-tertiary); color: var(--study-text);
        }
        .sg-task-textarea {
            width: 100%; border: 2px solid var(--study-border); border-radius: 14px;
            padding: 16px; font-size: 15px; font-family: inherit; line-height: 1.6;
            background: var(--study-bg-tertiary); color: var(--study-text);
            resize: vertical; min-height: 180px; outline: none; transition: border-color 0.15s;
        }
        .sg-task-textarea:focus { border-color: var(--study-accent); }
        .sg-task-textarea::placeholder { color: var(--study-text-tertiary); }
        .sg-task-footer {
            display: flex; align-items: center; justify-content: space-between;
            gap: 12px; margin-top: 16px; flex-wrap: wrap;
        }
        .sg-task-hint {
            display: flex; align-items: center; gap: 6px;
            font-size: 12px; color: var(--study-text-tertiary); font-style: italic;
        }
        .sg-task-submit {
            display: inline-flex; align-items: center; gap: 8px;
            padding: 12px 24px; border-radius: 12px; border: none;
            background: linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 92%, #fff), var(--study-accent), color-mix(in srgb, var(--study-accent) 88%, #000)); color: var(--study-accent-text, var(--bg-base, #fff));
            font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
            transition: all 0.15s;
        }
        .sg-task-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,133,58,0.3); }
        .sg-task-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
        /* Task Result */
        .sg-task-result {
            margin-top: 20px; padding: 24px; border-radius: 16px;
            background: var(--study-bg-tertiary); border: 1px solid var(--study-border);
            text-align: center;
        }
        .sg-task-grade {
            display: inline-flex; align-items: center; justify-content: center;
            width: 56px; height: 56px; border-radius: 50%;
            font-size: 28px; font-weight: 900; color: #fff; margin-bottom: 8px;
        }
        .sg-task-score { font-size: 20px; font-weight: 800; color: var(--study-text); margin-bottom: 8px; }
        .sg-task-feedback { font-size: 14px; color: var(--study-text-secondary); line-height: 1.6; margin-bottom: 16px; }
        .sg-task-matched, .sg-task-missed {
            text-align: left; margin-bottom: 12px; font-size: 13px;
        }
        .sg-task-matched strong, .sg-task-missed strong {
            display: block; margin-bottom: 6px; font-size: 11px; text-transform: uppercase;
            letter-spacing: 0.08em; color: var(--study-text-secondary);
        }
        .sg-task-fact-good, .sg-task-fact-bad {
            display: inline-block; padding: 4px 10px; border-radius: 6px; margin: 2px 4px 2px 0;
            font-size: 12px;
        }
        .sg-task-fact-good { background: rgba(34,197,94,0.12); color: #22c55e; }
        .sg-task-fact-bad { background: rgba(239,68,68,0.12); color: #ef4444; }
        .sg-task-result-btns { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
        .sg-task-complete-btn {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 10px 20px; border-radius: 10px; border: none;
            background: #22c55e; color: #fff; font-size: 13px; font-weight: 700;
            cursor: pointer; font-family: inherit; transition: all 0.15s ease;
        }
        .sg-task-complete-btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(34,197,94,0.3); }
        .sg-task-complete-btn:active { transform: translateY(0); filter: brightness(0.95); }
        .sg-task-retry-btn {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 10px 20px; border-radius: 10px;
            border: 1px solid var(--study-border); background: var(--study-bg-secondary);
            color: var(--study-text-secondary); font-size: 13px; font-weight: 600;
            cursor: pointer; font-family: inherit; transition: all 0.15s ease;
        }
        .sg-task-retry-btn:hover { border-color: var(--study-accent); color: var(--study-accent); background: rgba(232,133,58,0.06); transform: translateY(-1px); }
        .sg-task-retry-btn:active { transform: translateY(0); }

        /* Recall topic picker */
        .rc-topic-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
        .rc-topic-card {
            display: flex; align-items: center; gap: 16px;
            padding: 20px 24px; border-radius: 16px;
            border: none;
            background: var(--study-bg-secondary, #fff);
            cursor: pointer; font-family: inherit; text-align: left;
            width: 100%; box-sizing: border-box; transition: all 0.2s ease;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.03);
        }
        .rc-topic-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.05); }
        .rc-topic-card:active { transform: translateY(0); }
        .rc-topic-card.is-done { opacity: 0.55; }
        .rc-topic-card.is-done:hover { opacity: 0.8; }
        .rc-topic-icon {
            width: 46px; height: 46px; border-radius: 14px;
            background: var(--study-accent-dim, rgba(232,133,58,0.08)); display: flex; align-items: center; justify-content: center;
            color: var(--study-accent); flex-shrink: 0;
        }
        .rc-topic-card.is-done .rc-topic-icon { background: rgba(34,197,94,0.08); color: #22c55e; }
        .rc-topic-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
        .rc-topic-title { font-size: 16px; font-weight: 800; color: var(--study-text); }
        .rc-topic-detail { font-size: 13px; color: var(--study-text-secondary); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .rc-topic-badge {
            font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
            padding: 6px 14px; border-radius: 999px; flex-shrink: 0;
            background: linear-gradient(180deg, color-mix(in srgb, var(--study-accent) 92%, #fff), var(--study-accent), color-mix(in srgb, var(--study-accent) 88%, #000));
            color: var(--bg-base, #fff);
            position: relative; overflow: hidden; isolation: isolate;
        }
        .rc-topic-badge::after { content: ''; position: absolute; inset: 0; background: url('/images/noise.png') repeat; background-size: 128px; border-radius: inherit; pointer-events: none; z-index: 1; mix-blend-mode: overlay; opacity: 0.6; }
        .rc-topic-custom { border-style: dashed; }
        .rc-topic-custom:hover { border-style: solid; }
        .rc-back-btn {
            width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--study-border);
            background: var(--study-bg-secondary); color: var(--study-text-secondary);
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; transition: all 0.15s ease; flex-shrink: 0;
        }
        .rc-back-btn:hover { border-color: var(--study-accent); color: var(--study-accent); transform: translateX(-2px); }
        @media (max-width: 760px) {
            .sg2-shell { padding: 20px 16px 40px; }
            .sg2-focus-banner { min-height: 240px; padding: 24px; }
            .sg2-path-header { flex-direction: column; align-items: flex-start; }
            .sg2-module-header { padding: 16px; }
            .sg2-module-stats { display: none; }
            .sg2-module-body { padding: 12px 12px 16px; }
            .sg-task-modal { padding: 20px; }
        }
        .sg2-stat-row {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            justify-content: flex-start;
            gap: 14px;
        }
        .sg2-stat {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: flex-start;
            gap: 10px;
            min-height: 92px;
            padding: 18px 20px;
            border-radius: 16px;
            background: color-mix(in srgb, var(--bg-raised) 92%, var(--bg-base));
            border: none;
            color: var(--text-secondary);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
        }
        .sg2-stat i {
            display: none;
        }
        .sg2-stat span {
            display: block;
            font-size: clamp(1.8rem, 1.55rem + 0.55vw, 2.3rem);
            font-weight: 900;
            letter-spacing: -0.05em;
            color: var(--text-primary);
            line-height: 1;
        }
        .sg2-stat small {
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-secondary);
        }
        .sg2-progress {
            height: 10px;
            border-radius: 999px;
            overflow: hidden;
            background: var(--border-subtle);
        }
        .sg2-progress-fill {
            height: 100%;
            border-radius: 999px;
            background: linear-gradient(90deg, var(--accent-amber), var(--accent-orange));
        }
        .sg2-next-card,
        .sg2-priority-card,
        .sg2-current-card {
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 18px 20px;
            border-radius: 20px;
            background: color-mix(in srgb, var(--bg-raised) 96%, transparent);
            border: 1px solid var(--border-default);
        }
        .sg2-priority-card,
        .sg2-current-card {
            gap: 14px;
            padding: 24px 28px;
            border-radius: 20px;
        }
        .sg2-focus-card {
            background: color-mix(in srgb, var(--bg-raised) 95%, var(--bg-base));
            border: none;
            box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
        }
        .sg2-priority-copy {
            display: flex;
            flex-direction: column;
            gap: 10px;
            max-width: 920px;
        }
        .sg2-priority-pill {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            align-self: flex-start;
            min-height: 28px;
            padding: 0 12px;
            border-radius: 999px;
            background: color-mix(in srgb, var(--glow-amber) 92%, var(--bg-raised));
            color: var(--accent-orange);
            font-size: 11px;
            font-weight: 900;
            letter-spacing: 0.12em;
            text-transform: uppercase;
        }
        .sg2-priority-title {
            margin: 0;
            font-size: clamp(1.95rem, 1.55rem + 0.8vw, 2.65rem);
            line-height: 1.08;
            letter-spacing: -0.045em;
            color: var(--text-primary);
            max-width: 760px;
        }
        .sg2-priority-detail {
            font-size: 15px;
            line-height: 1.6;
            color: var(--text-secondary);
            max-width: 720px;
        }
        .sg2-priority-reason {
            font-size: 13px;
            line-height: 1.55;
            color: var(--text-tertiary);
            max-width: 760px;
        }
        .sg2-next-title, .sg2-section-title, .sg2-side-title {
            margin: 0;
            font-size: 1.6rem;
            line-height: 1.15;
            letter-spacing: -0.03em;
            color: var(--text-primary);
        }
        .sg2-next-detail, .sg2-next-reason, .sg2-ready-copy, .sg2-tool-detail, .sg2-side-item-detail, .sg2-side-empty {
            font-size: 14px;
            line-height: 1.55;
            color: var(--text-secondary);
        }
        .sg2-next-reason {
            color: var(--accent-orange);
            font-weight: 600;
        }
        .sg2-next-actions, .sg2-section-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
        }
        .sg2-layout {
            display: grid;
            grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
            gap: 22px;
            align-items: start;
        }
        .sg2-main, .sg2-side {
            min-width: 0;
        }
        .sg2-phase-list, .sg2-side {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        .sg2-phase-card, .sg2-side-card {
            background: color-mix(in srgb, var(--bg-raised) 95%, transparent);
            border: none;
            border-radius: 20px;
            box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
            overflow: hidden;
        }
        .sg2-phase-card.is-open {
            box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
        }
        .sg2-phase-summary-wrap {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 18px;
            padding: 20px 22px;
            align-items: center;
        }
        .sg2-phase-summary {
            width: 100%;
            border: none;
            background: transparent;
            color: inherit;
            text-align: left;
            padding: 0;
            cursor: pointer;
            font-family: inherit;
        }
        .sg2-phase-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 14px;
            padding: 0;
        }
        .sg2-phase-left {
            display: flex;
            align-items: flex-start;
            gap: 14px;
            min-width: 0;
        }
        .sg2-phase-number {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: var(--glow-amber);
            color: var(--accent-orange);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: 800;
            flex-shrink: 0;
        }
        .sg2-phase-copy h3 {
            margin: 0 0 8px;
            font-size: 1.15rem;
            line-height: 1.2;
            color: var(--text-primary);
        }
        .sg2-phase-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 8px 10px;
            align-items: center;
        }
        .sg2-phase-summary-actions {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            justify-content: center;
            gap: 10px;
            min-width: 172px;
        }
        .sg2-pill, .sg2-phase-time {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 11px;
            font-weight: 700;
            color: var(--text-secondary);
        }
        .sg2-pill {
            padding: 5px 9px;
            border-radius: 999px;
            background: color-mix(in srgb, var(--glow-amber) 88%, var(--bg-raised));
            color: var(--accent-orange);
        }
        .sg2-phase-chevron {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            border: none;
            background: color-mix(in srgb, var(--bg-elevated) 92%, var(--bg-base));
            color: var(--text-secondary);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .sg2-phase-progress-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 12px 0 0;
            color: var(--text-tertiary);
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }
        .sg2-phase-progress-value {
            color: var(--text-secondary);
            font-size: 12px;
            font-weight: 700;
            letter-spacing: normal;
            text-transform: none;
        }
        .sg2-phase-progress {
            height: 6px;
            margin: 10px 0 0;
            border-radius: 999px;
            overflow: hidden;
            background: var(--border-subtle);
        }
        .sg2-phase-progress-fill {
            height: 100%;
            border-radius: 999px;
            background: linear-gradient(90deg, var(--accent-amber), var(--accent-orange));
        }
        .sg2-phase-body {
            border-top: 1px solid var(--border-subtle);
            background: color-mix(in srgb, var(--bg-base) 92%, var(--bg-raised));
        }
        .sg2-phase-body-inner {
            padding: 16px 22px 18px;
        }
        .sg2-phase-description {
            margin: 0 0 14px;
            font-size: 14px;
            line-height: 1.6;
            color: var(--text-secondary);
        }
        .sg2-step-list {
            display: flex;
            flex-direction: column;
            gap: 0;
            padding: 0;
        }
        .sg2-step {
            display: grid;
            grid-template-columns: auto minmax(0, 1fr);
            gap: 12px;
            align-items: start;
            padding: 16px 0;
            border-bottom: 1px solid var(--border-subtle);
        }
        .sg2-step:last-child {
            border-bottom: none;
        }
        .sg2-step.is-done {
            opacity: 0.55;
        }
        .sg2-step-toggle {
            border: none;
            background: transparent;
            padding: 2px 0 0;
            cursor: pointer;
            color: var(--text-tertiary);
        }
        .sg2-step-title {
            font-size: 15px;
            font-weight: 800;
            line-height: 1.35;
            color: var(--text-primary);
        }
        .sg2-step-detail {
            margin-top: 4px;
            font-size: 13.5px;
            line-height: 1.55;
            color: var(--text-secondary);
        }
        .sg2-step-focus-block {
            margin-top: 12px;
            padding: 14px;
            border-radius: 16px;
            background: color-mix(in srgb, var(--bg-elevated) 84%, var(--bg-raised));
            border: 1px solid var(--border-subtle);
        }
        .sg2-step-focus-label {
            margin-bottom: 10px;
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--accent-orange);
        }
        .sg2-step-focus-list {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 10px;
        }
        .sg2-step-focus-item {
            display: grid;
            grid-template-columns: auto minmax(0, 1fr);
            gap: 10px;
            align-items: start;
            padding: 11px 12px;
            border-radius: 14px;
            background: color-mix(in srgb, var(--bg-base) 92%, var(--bg-raised));
        }
        .sg2-step-focus-num {
            width: 22px;
            height: 22px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: color-mix(in srgb, var(--glow-amber) 92%, var(--bg-raised));
            color: var(--accent-orange);
            font-size: 11px;
            font-weight: 800;
            flex-shrink: 0;
        }
        .sg2-step-focus-copy {
            min-width: 0;
        }
        .sg2-step-focus-title {
            font-size: 12.5px;
            font-weight: 700;
            line-height: 1.4;
            color: var(--text-primary);
        }
        .sg2-step-focus-detail {
            margin-top: 3px;
            font-size: 12px;
            line-height: 1.45;
            color: var(--text-secondary);
        }
        .sg2-step-instruction {
            margin-top: 10px;
            padding: 10px 12px;
            border-radius: 12px;
            background: color-mix(in srgb, var(--bg-elevated) 92%, var(--glow-amber));
            border-left: 3px solid var(--accent-amber);
            font-size: 13px;
            line-height: 1.5;
            color: var(--text-secondary);
        }
        .sg2-step-instruction span {
            display: block;
            margin-bottom: 4px;
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--accent-orange);
        }
        .sg2-btn, .sg2-step-action, .sg2-regenerate, .sg2-mini-link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            border-radius: 12px;
            font-family: inherit;
            font-weight: 700;
            cursor: pointer;
            transition: transform .15s, box-shadow .15s, background .15s;
        }
        .sg2-btn, .sg2-regenerate {
            padding: 11px 16px;
            border: 1px solid var(--border-default);
            background: var(--bg-raised);
            color: var(--text-primary);
        }
        .sg2-btn-primary {
            background: var(--accent-amber);
            color: var(--bg-base);
            border-color: var(--accent-amber);
        }
        .sg2-btn-secondary {
            background: var(--bg-raised);
        }
        .sg2-step-action {
            padding: 9px 12px;
            border: 1px solid color-mix(in srgb, var(--accent-amber) 38%, var(--border-default));
            background: color-mix(in srgb, var(--glow-amber) 86%, var(--bg-raised));
            color: var(--accent-orange);
            font-size: 12px;
            white-space: nowrap;
        }
        .sg2-side-card {
            padding: 18px 18px 16px;
        }
        .sg2-side-item {
            padding: 12px 0;
            border-bottom: 1px solid var(--border-subtle);
        }
        .sg2-side-item:last-child {
            border-bottom: none;
        }
        .sg2-side-item-title, .sg2-tool-title {
            font-size: 14px;
            font-weight: 800;
            color: var(--text-primary);
            line-height: 1.35;
        }
        .sg2-mini-link {
            margin-top: 8px;
            padding: 0;
            border: none;
            background: transparent;
            color: var(--accent-orange);
            font-size: 12px;
            justify-content: flex-start;
        }
        .sg2-tool-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 12px;
        }
        .sg2-tool-card {
            text-align: left;
            padding: 14px 14px 13px;
            border-radius: 16px;
            border: 1px solid var(--border-default);
            background: var(--bg-elevated);
            cursor: pointer;
        }
        .sg2-tool-icon {
            width: 36px;
            height: 36px;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: color-mix(in srgb, var(--glow-amber) 88%, var(--bg-raised));
            color: var(--accent-orange);
            margin-bottom: 10px;
        }
        .sg2-ready-score {
            font-size: 1.75rem;
            font-weight: 900;
            letter-spacing: -0.04em;
            color: var(--text-primary);
            margin: 6px 0 8px;
        }
        .sg2-ready-list {
            margin: 14px 0 0;
            padding-left: 18px;
            color: var(--text-secondary);
            font-size: 13px;
            line-height: 1.7;
        }
        @media (max-width: 1080px) {
            .sg2-layout {
                grid-template-columns: 1fr;
            }
        }
        @media (max-width: 760px) {
            .sg2-shell {
                padding: 18px 16px 28px;
            }
            .sg2-hero {
                padding: 4px 0 0;
            }
            .sg2-stat-row {
                grid-template-columns: 1fr;
                gap: 10px;
            }
            .sg2-stat {
                min-width: 0;
            }
            .sg2-current-card {
                padding: 20px 18px;
            }
            .sg2-phase-summary-wrap {
                grid-template-columns: 1fr;
                gap: 14px;
                padding: 18px 16px;
            }
            .sg2-phase-head {
                padding: 0;
            }
            .sg2-phase-left {
                width: 100%;
            }
            .sg2-phase-summary-actions {
                width: 100%;
                min-width: 0;
                justify-content: flex-start;
            }
            .sg2-phase-progress-row {
                padding: 12px 0 0;
            }
            .sg2-phase-progress {
                margin: 10px 0 0;
            }
            .sg2-phase-body-inner {
                padding: 14px 16px 16px;
            }
            .sg2-step-list {
                padding: 0;
            }
            .sg2-step {
                grid-template-columns: auto minmax(0, 1fr);
            }
            .sg2-step-focus-list {
                grid-template-columns: 1fr;
            }
            .sg2-step-action {
                grid-column: 2;
                justify-self: start;
            }
        }

        /* Content view */
        .content-view { padding: 20px; }
        .content-reader-shell {
            border: 1px solid var(--study-border);
            border-radius: 16px;
            background: var(--study-bg-secondary);
            overflow: hidden;
            margin-bottom: 12px;
        }
        .content-reader-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 12px 14px;
            border-bottom: 1px solid var(--study-border);
            background: var(--study-bg-tertiary);
        }
        .content-reader-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--study-text-secondary); }
        .content-reader-sub { font-size: 12px; color: var(--study-text-tertiary); }
        .raw-transcript-body { max-height: 2000px; }
        .raw-transcript-body.collapsed { max-height: 0; }
        .content-inline-btn {
            height: 30px;
            border-radius: 999px;
            border: 1px solid var(--study-border);
            background: var(--study-bg-secondary);
            color: var(--study-text-secondary);
            padding: 0 12px;
            font-size: 12px;
            font-weight: 600;
            font-family: inherit;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            cursor: pointer;
            transition: all .15s;
        }
        .content-inline-btn:hover { color: var(--study-text); background: var(--study-bg); }
        .content-inline-btn i { width: 13px; height: 13px; }
        .content-file-info { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 10px; margin-bottom: 16px; }
        .content-file-info i { width: 20px; height: 20px; color: var(--study-accent); }
        .content-file-name { font-size: 14px; font-weight: 500; }
        .content-file-type { font-size: 11px; color: var(--study-text-tertiary); }
        /* PDF Viewer — custom toolbar like Studley */
        .pdf-viewer-wrap { display: flex; flex-direction: column; height: 100%; }
        .pdf-toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--study-bg-secondary); border-bottom: 1px solid var(--study-border); flex-shrink: 0; }
        .pdf-toolbar button, .pdf-toolbar a { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--study-text-secondary); cursor: pointer; border-radius: 6px; text-decoration: none; }
        .pdf-toolbar button:hover, .pdf-toolbar a:hover { background: var(--study-bg-tertiary); color: var(--study-text); }
        .pdf-toolbar i { width: 16px; height: 16px; }
        .pdf-page-info { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--study-text-secondary); }
        #pdfPageInput { width: 38px; text-align: center; background: var(--study-bg-tertiary); border: 1px solid var(--study-border); border-radius: 4px; color: var(--study-text); font-size: 13px; padding: 2px 4px; -moz-appearance: textfield; }
        #pdfPageInput::-webkit-outer-spin-button, #pdfPageInput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
        .pdf-zoom-info { font-size: 13px; color: var(--study-text-secondary); min-width: 42px; text-align: center; }
        .pdf-canvas-area { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 16px; gap: 8px; background: var(--study-bg); }
        .pdf-canvas-area.dark-mode { background: #1a1a1a; }
        .pdf-canvas-area canvas { box-shadow: 0 2px 12px rgba(0,0,0,0.25); }
        #rPdfPageInput { width: 38px; text-align: center; background: var(--study-bg-tertiary); border: 1px solid var(--study-border); border-radius: 4px; color: var(--study-text); font-size: 13px; padding: 2px 4px; -moz-appearance: textfield; }
        #rPdfPageInput::-webkit-outer-spin-button, #rPdfPageInput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
        .pdf-loading { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--study-text-secondary); font-size: 14px; gap: 8px; }
        .pdf-loading .spinner { width: 20px; height: 20px; border: 2px solid var(--study-border); border-top-color: var(--study-accent); border-radius: 50%; animation: spin 1s linear infinite; }
        .pdf-switcher { display: flex; gap: 4px; padding: 6px 12px; background: var(--study-bg-secondary); border-bottom: 1px solid var(--study-border); flex-shrink: 0; overflow-x: auto; }
        .pdf-switcher-tab { padding: 5px 14px; border-radius: 8px; border: 1px solid var(--study-border); background: transparent; color: var(--study-text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; white-space: nowrap; transition: all .15s; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
        .pdf-switcher-tab:hover { background: var(--study-bg-tertiary); color: var(--study-text); }
        .pdf-switcher-tab.active { background: var(--study-accent-dim); color: var(--study-accent); border-color: var(--study-accent); }

        /* Notes Page Tabs */
        .notes-page-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 0 10px; flex-wrap: wrap; flex-shrink: 0; }
        .notes-page-tabs { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
        .notes-page-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
        .notes-page-tab { display: flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--study-border); background: transparent; color: var(--study-text-secondary); font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; }
        .notes-page-tab:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .notes-page-tab.active { background: var(--study-accent-dim); color: var(--study-accent); border-color: var(--study-accent); cursor: default; }
        .notes-page-tab-ghost { background: var(--study-bg-secondary); }
        .notes-page-tab-add { background: var(--study-bg-secondary); border-color: var(--study-border-light); }
        .test-settings-help { margin-top: 8px; font-size: 12px; line-height: 1.45; color: var(--study-text-tertiary); }

        /* Resize Handle */
        .sidebar-resize-handle {
            width: 6px; cursor: col-resize; background: transparent; flex-shrink: 0;
            position: relative; z-index: 10; margin: 0 0 8px;
            height: calc(100% - 8px);
            opacity: 1;
            transition: background 0.15s, width 0.32s cubic-bezier(.4,0,.2,1), margin 0.32s cubic-bezier(.4,0,.2,1), opacity 0.24s ease;
        }
        .sidebar-resize-handle:hover, .sidebar-resize-handle.dragging {
            background: var(--study-accent);
        }
        .sidebar-resize-handle::after {
            content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
            width: 2px; height: 32px; border-radius: 2px; background: var(--study-border);
        }
        .sidebar-resize-handle:hover::after, .sidebar-resize-handle.dragging::after {
            background: var(--study-accent);
        }

        /* Right Sidebar */
        .detail-right {
            width: var(--right-sidebar-w); min-width: 320px; max-width: 56vw;
            margin: 0;
            height: 100%;
            background: var(--study-bg-secondary); border: 1px solid var(--study-border);
            border-radius: 14px;
            display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden; min-height: 0;
            opacity: 1;
            transition: width 0.32s cubic-bezier(.4,0,.2,1), margin 0.32s cubic-bezier(.4,0,.2,1), opacity 0.24s ease, border-color 0.24s ease;
        }
        .detail-layout.sidebar-hidden .detail-right {
            width: 0 !important;
            min-width: 0;
            margin-right: 0;
            border-color: transparent;
            opacity: 0;
            pointer-events: none;
        }
        .detail-layout.sidebar-hidden .sidebar-resize-handle {
            width: 0;
            margin: 0 0 8px;
            opacity: 0;
            pointer-events: none;
        }
        .detail-layout.sidebar-hidden .sidebar-resize-handle::after { opacity: 0; }
        .right-sidebar-reopen {
            position: absolute;
            bottom: 20px;
            right: 18px;
            z-index: 25;
            height: 34px;
            padding: 0 12px;
            border-radius: 999px;
            border: 1px solid var(--study-border);
            background: color-mix(in srgb, var(--study-bg-secondary) 86%, #fff 14%);
            color: var(--study-text-secondary);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            font-size: 12px;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            opacity: 0;
            transform: translateX(20px);
            pointer-events: none;
            transition: opacity 0.22s ease, transform 0.32s cubic-bezier(.4,0,.2,1), color 0.15s, background 0.15s;
            box-shadow: 0 10px 28px rgba(0,0,0,0.14);
        }
        .right-sidebar-reopen i { width: 13px; height: 13px; }
        .right-sidebar-reopen:hover {
            color: var(--study-text);
            background: var(--study-bg-secondary);
        }
        .detail-layout.sidebar-hidden .right-sidebar-reopen {
            opacity: 1;
            transform: translateX(0);
            pointer-events: auto;
        }
        .right-tabs { display: none; border-bottom: 1px solid var(--study-border); background: color-mix(in srgb, var(--study-bg-secondary) 82%, transparent); position: relative; }
        .right-tab { flex: 1; padding: 10px; font-size: 11px; font-weight: 700; text-align: center; color: var(--study-text-tertiary); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s; text-transform: uppercase; letter-spacing: .04em; }
        .right-tab-close { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--study-text-tertiary); cursor: pointer; padding: 4px; border-radius: 6px; display: flex; align-items: center; transition: all .15s; }
        .right-tab-close:hover { color: var(--study-text); background: rgba(255,255,255,.06); }
        .right-tab:hover { color: var(--study-text-secondary); }
        .right-tab.active { color: var(--study-accent); border-bottom-color: var(--study-accent); }
        .right-panel { flex: 1; display: none; flex-direction: column; overflow: hidden; }
        .right-panel.active { display: flex; }

        /* Right Chat */
        .right-chat-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
        .right-chat-head {
            display: flex; align-items: center; justify-content: flex-start;
            padding: 10px 12px 4px; border-bottom: none;
        }
        .right-chat-head-btn {
            height: 30px; border-radius: 8px; border: 1px solid var(--study-border);
            background: transparent; color: var(--study-text-secondary); cursor: pointer;
            display: inline-flex; align-items: center; justify-content: center; gap: 5px;
            font-size: 12px; font-weight: 600; font-family: inherit; padding: 0 10px;
            transition: all .15s;
        }
        .right-chat-head-btn { width: 30px; padding: 0; }
        .right-chat-head-btn:hover {
            color: var(--study-text);
            background: var(--study-bg-tertiary);
        }
        .right-chat-head-btn i { width: 14px; height: 14px; }
        .right-chat-messages {
            flex: 1; overflow-y: auto; padding: 14px;
            display: flex; flex-direction: column; gap: 12px; align-items: center;
        }
        .right-chat-empty {
            margin: auto 0;
            text-align: center;
            padding: 34px 24px 10px;
        }
        .right-chat-empty-visual { display: flex; justify-content: center; margin: 0 auto 18px; }
        .right-chat-empty-illustration { width: min(240px, 92%); filter: drop-shadow(0 16px 28px rgba(15, 23, 42, 0.06)); }
        .right-chat-empty-title {
            font-size: clamp(30px, 2.3vw, 44px);
            font-weight: 800;
            letter-spacing: -0.02em;
            margin-bottom: 10px;
            line-height: 1.1;
        }
        .right-chat-empty-sub {
            font-size: 14px;
            color: var(--study-text-secondary);
            line-height: 1.55;
        }
        .right-chat-reset { text-align: center; padding: 2px 12px 6px; }
        .right-chat-reset a {
            font-size: 11px;
            color: var(--study-text-tertiary);
            cursor: pointer;
            text-decoration: underline;
        }
        .right-chat-input-wrap {
            padding: 12px 14px 14px;
            background: transparent;
        }
        .right-chat-input {
            border: 1px solid var(--study-border);
            border-radius: 16px;
            background: color-mix(in srgb, var(--study-bg-secondary) 86%, #fff 14%);
            display: flex;
            flex-direction: column;
            gap: 0;
            padding: 12px 14px;
        }
        .right-chat-input textarea {
            width: 100%;
            background: transparent;
            border: none;
            color: var(--study-text);
            font-family: inherit;
            font-size: 14px;
            padding: 2px 0;
            outline: none;
            resize: none;
            min-height: 52px;
            max-height: 150px;
            line-height: 1.5;
        }
        .right-chat-input-bottom { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
        .right-chat-mic {
            width: 26px; height: 26px; border-radius: 6px;
            border: none;
            background: transparent;
            color: var(--study-text-tertiary);
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; transition: all .15s; flex-shrink: 0;
        }
        .right-chat-mic:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .right-chat-mic.recording { color: var(--study-red); animation: pulse-mic 1.5s infinite; }
        @keyframes pulse-mic { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
        .right-chat-input-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }
        .right-chat-attach {
            width: 26px; height: 26px; border-radius: 6px;
            border: none;
            background: transparent;
            color: var(--study-text-tertiary);
            display: flex; align-items: center; justify-content: center;
            cursor: default;
        }
        .right-chat-send {
            width: 28px; height: 28px; border-radius: 8px;
            border: none; background: var(--study-accent); color: #000;
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            transition: transform .15s, filter .15s;
        }
        .right-chat-send:hover { transform: translateY(-1px); filter: brightness(1.05); }
        .right-chat-send i { width: 12px; height: 12px; }
        .right-chat-attach i, .right-chat-mic i { width: 16px; height: 16px; }
        .rchat-msg { font-size: 13px; line-height: 1.62; padding: 12px 14px; border-radius: 12px; max-width: 94%; word-break: break-word; }
        .rchat-msg.user { background: var(--study-accent-dim); align-self: flex-end; border-bottom-right-radius: 4px; max-width: min(82%, 520px); margin-left: auto; }
        .rchat-msg.ai { background: var(--study-bg); border: 1px solid var(--study-border); align-self: center; border-bottom-left-radius: 4px; width: min(94%, 640px); }
        .rchat-msg p { margin: 0 0 6px; } .rchat-msg p:last-child { margin: 0; }
        .rchat-msg.ai p { margin: 0 0 12px; }
        .rchat-suggest-cards { padding: 10px 14px; margin: 6px 0; border-radius: 12px; background: var(--study-bg); border: 1px solid var(--study-accent); border-style: dashed; width: min(94%, 640px); align-self: center; }
        .suggest-cards-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--study-border); background: var(--study-card); color: var(--study-text); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; }
        .suggest-cards-btn.suggest-yes { background: var(--study-accent); color: #fff; border-color: var(--study-accent); }
        .suggest-cards-btn.suggest-yes:hover { opacity: .85; }
        .suggest-cards-btn.suggest-no:hover { background: var(--study-hover); }
        /* Image lightbox */
        .img-lightbox { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 10000; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; cursor: zoom-out; backdrop-filter: blur(4px); }
        .img-lightbox img { max-width: 95vw; max-height: 92vh; object-fit: contain; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.5); touch-action: pinch-zoom; }
        .img-lightbox-close { position: fixed; top: 14px; right: 14px; z-index: 10001; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.15); border: none; color: #fff; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
        .img-lightbox-close:hover { background: rgba(255,255,255,.3); }
        .rchat-msg img, .notes-view img, .klm-msg-body img { cursor: zoom-in; border-radius: 8px; transition: opacity .15s; max-width: 100%; }
        .rchat-msg img:hover, .notes-view img:hover, .klm-msg-body img:hover { opacity: .85; }
        .rchat-msg.ai p:last-child { margin-bottom: 0; }
        .rchat-msg.ai h1, .rchat-msg.ai h2, .rchat-msg.ai h3, .rchat-msg.ai h4 { margin: 14px 0 8px; line-height: 1.3; }
        .rchat-msg.ai ul, .rchat-msg.ai ol { margin: 8px 0 12px 20px; padding: 0; }
        .rchat-msg.ai li { margin: 4px 0; }
        .rchat-msg.ai br { display: block; margin: 4px 0; content: ''; }
        .rchat-msg strong { font-weight: 600; }
        .rchat-msg code { background: var(--study-bg-tertiary); padding: 1px 4px; border-radius: 3px; font-size: 0.88em; }
        .right-chat-panel.is-empty .right-chat-messages {
            flex: 0 0 auto;
            overflow: visible;
            margin-top: auto;
            padding: 12px 18px 8px;
        }
        .right-chat-panel.is-empty .right-chat-reset { display: none; }
        .right-chat-panel.is-empty .right-chat-input-wrap {
            padding: 0 18px 0;
            margin-bottom: auto;
            border-top: none;
        }
        #btnToggleRight { display: none !important; }

        /* Right Notes (Quill) */
        .right-notes { flex: 1; overflow-y: auto; }
        .right-notes .ql-toolbar { border-color: var(--study-border) !important; background: var(--study-bg) !important; }
        .right-notes .ql-container { border-color: var(--study-border) !important; font-family: 'Inter', sans-serif !important; font-size: 14px !important; }
        .right-notes .ql-editor { color: var(--study-text) !important; min-height: 200px; }
        .right-notes .ql-editor.ql-blank::before { color: var(--study-text-tertiary) !important; }
        .right-notes .ql-snow .ql-stroke { stroke: var(--study-text-secondary) !important; }
        .right-notes .ql-snow .ql-fill { fill: var(--study-text-secondary) !important; }
        .right-notes .ql-snow .ql-picker-label { color: var(--study-text-secondary) !important; }

        /* Quill editor content — match notes-view spacing */
        .ql-editor { padding: 26px 34px !important; line-height: 1.78 !important; font-size: 16px !important; }
        .ql-editor h1 { font-size: clamp(2rem, 1.35rem + 1.3vw, 2.65rem) !important; font-weight: 800 !important; margin: 14px 0 22px !important; letter-spacing: -0.02em !important; text-align: center !important; line-height: 1.16 !important; }
        .ql-editor h2 { font-size: 2rem !important; font-weight: 800 !important; margin: 34px 0 16px !important; letter-spacing: -0.02em !important; line-height: 1.2 !important; }
        .ql-editor h3 { font-size: 1.45rem !important; font-weight: 700 !important; margin: 24px 0 12px !important; letter-spacing: -0.01em !important; }
        .ql-editor p { margin: 10px 0 14px !important; }
        .ql-editor ul,.ql-editor ol { margin: 10px 0 16px !important; padding-left: 26px !important; }
        .ql-editor li { margin-bottom: 8px !important; line-height: 1.66 !important; }
        .ql-editor strong { color: var(--study-accent) !important; }
        .ql-editor a { color: #6366f1 !important; text-decoration: underline !important; text-underline-offset: 2px !important; }
        .ql-editor hr { border: none !important; border-top: 1.5px solid var(--study-border) !important; margin: 34px 0 !important; }
        .ql-editor blockquote { border-left: 4px solid #6366f1 !important; padding: 10px 18px !important; margin: 18px 0 !important; background: color-mix(in srgb, #6366f1 8%, transparent) !important; border-radius: 0 8px 8px 0 !important; }

        /* Notes images */
        .notes-view img, .ql-editor img { max-width: 80%; height: auto; border-radius: 10px; margin: 16px auto; display: block; border: 1px solid var(--study-border); }
        .notes-view p > img:only-child, .ql-editor p > img:only-child { margin: 20px auto; }

        /* ── Chat View (standalone) ── */
        .chat-wrap { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
        .chat-wrap::-webkit-scrollbar { width: 6px; }
        .chat-wrap::-webkit-scrollbar-thumb { background: var(--study-border); border-radius: 3px; }
        .chat-messages { max-width: 800px; margin: 0 auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
        .chat-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 20px; gap: 16px; flex: 1; }
        .chat-welcome-icon { width: 64px; height: 64px; background: var(--study-accent); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 28px; color: #000; }
        .chat-welcome h2 { font-size: 24px; font-weight: 700; }
        .chat-welcome p { font-size: 15px; color: var(--study-text-secondary); max-width: 440px; line-height: 1.6; }
        .suggestion-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; max-width: 560px; }
        .suggestion-chip { padding: 8px 16px; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 20px; color: var(--study-text-secondary); font-size: 13px; cursor: pointer; transition: all 0.15s; }
        .suggestion-chip:hover { border-color: var(--study-accent); color: var(--study-text); }
        .msg-row { display: flex; gap: 12px; align-items: flex-start; animation: msgIn 0.25s ease; }
        @keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
        .msg-row.user { flex-direction: row-reverse; }
        .msg-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
        .msg-avatar.ai { background: var(--study-accent); color: #000; }
        .msg-avatar.user { background: var(--study-bg-tertiary); color: var(--study-text); }
        .msg-content { max-width: calc(100% - 60px); min-width: 0; }
        .msg-bubble { padding: 12px 16px; border-radius: var(--study-radius); font-size: 14.5px; line-height: 1.65; word-break: break-word; }
        .msg-row.ai .msg-bubble { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-top-left-radius: 4px; }
        .msg-row.user .msg-bubble { background: rgba(232,133,58,0.18); border-top-right-radius: 4px; }
        .msg-bubble p { margin: 0 0 10px; } .msg-bubble p:last-child { margin: 0; }
        .msg-bubble h1,.msg-bubble h2,.msg-bubble h3 { margin: 16px 0 8px; font-weight: 600; }
        .msg-bubble ul,.msg-bubble ol { margin: 8px 0; padding-left: 20px; }
        .msg-bubble li { margin-bottom: 4px; }
        .msg-bubble code { font-family: 'SF Mono','Fira Code', monospace; font-size: 0.88em; background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px; }
        .msg-bubble pre { margin: 10px 0; border-radius: 8px; overflow-x: auto; background: #0d1117 !important; border: 1px solid var(--study-border); }
        .msg-bubble pre code { display: block; padding: 14px 16px; background: transparent !important; font-size: 13px; line-height: 1.5; }
        .msg-bubble blockquote { border-left: 3px solid var(--study-accent); padding: 4px 12px; margin: 10px 0; color: var(--study-text-secondary); background: rgba(232,133,58,0.05); border-radius: 0 6px 6px 0; }
        .msg-bubble table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 13.5px; }
        .msg-bubble th,.msg-bubble td { border: 1px solid var(--study-border); padding: 8px 12px; text-align: left; }
        .msg-bubble th { background: var(--study-bg-tertiary); font-weight: 600; }
        .msg-bubble a { color: var(--study-accent); text-decoration: underline; }
        .msg-bubble strong { font-weight: 600; }
        .src-cite { cursor: pointer; color: var(--study-accent); font-size: 11px; font-weight: 700; padding: 0 2px; border-radius: 3px; transition: background 0.15s; position: relative; }
        .src-cite:hover { background: var(--study-accent); color: #fff; }
        .src-popover { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); width: 280px; padding: 12px 14px; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 100; margin-bottom: 6px; }
        .src-popover-label { font-size: 12px; font-weight: 700; color: var(--study-accent); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
        .src-popover-excerpt { font-size: 12px; line-height: 1.5; color: var(--study-text-secondary); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
        .typing-indicator { display: none; gap: 12px; align-items: center; }
        .typing-indicator.active { display: flex; }
        .typing-indicator-flame { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; image-rendering: crisp-edges; }
        .typing-indicator-text { font-size: 13px; color: var(--study-text-secondary); }

        .inputbar { flex-shrink: 0; background: var(--study-bg); border-top: 1px solid var(--study-border); padding: 12px 16px; padding-bottom: calc(12px + var(--safe-bottom)); display: none; }
        .inputbar.visible { display: block; }
        .inputbar-inner { max-width: 800px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 16px; padding: 8px 8px 8px 16px; transition: border-color 0.2s; }
        .inputbar-inner:focus-within { border-color: var(--study-accent); }
        .input-textarea { flex: 1; background: transparent; border: none; color: var(--study-text); font-family: inherit; font-size: 14.5px; line-height: 1.5; resize: none; outline: none; max-height: calc(1.5em * 4 + 8px); padding: 6px 0; overflow-y: auto; }
        .input-textarea::placeholder { color: var(--study-text-tertiary); }
        .send-btn { width: 36px; height: 36px; border-radius: 10px; border: none; background: var(--study-accent); color: #000; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: all 0.15s; opacity: 0.4; pointer-events: none; }
        .send-btn.active { opacity: 1; pointer-events: auto; }
        .send-btn.active:hover { background: var(--study-accent-hover); }
        .send-btn i { width: 18px; height: 18px; }
        .chat-pro-btn { height: 28px; padding: 0 10px; border-radius: 8px; border: 1.5px solid var(--study-border-light); background: transparent; color: var(--study-text-tertiary); font-size: 11px; font-weight: 700; letter-spacing: .03em; cursor: pointer; flex-shrink: 0; transition: all .2s; white-space: nowrap; font-family: inherit; margin-bottom: 4px; }
        .chat-pro-btn:hover { border-color: var(--study-accent); color: var(--study-accent); }
        .chat-pro-btn.active { border-color: var(--study-accent); background: var(--study-accent); color: #000; }

        /* ── Lecture Recorder Overlay ── */
        .lecture-recorder { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
        .lr-header { text-align: center; margin-bottom: 24px; }
        .lr-indicator { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 8px; }
        .lr-dot { width: 14px; height: 14px; border-radius: 50%; background: #ef4444; animation: lr-pulse 1.5s ease-in-out infinite; }
        .lr-dot.paused { background: #888; animation: none; }
        @keyframes lr-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.85); } }
        .lr-status { font-size: 16px; font-weight: 600; letter-spacing: 0.5px; }
        .lr-timer { font-size: 48px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }
        .lr-captions-wrap { width: min(90vw, 640px); height: 260px; overflow-y: auto; background: rgba(255,255,255,0.06); border-radius: 12px; padding: 20px; margin-bottom: 28px; scroll-behavior: smooth; }
        .lr-captions-wrap p { margin: 0 0 8px; font-size: 15px; line-height: 1.6; color: rgba(255,255,255,0.85); }
        .lr-captions-wrap .lr-interim { color: rgba(255,255,255,0.45); font-style: italic; }
        .lr-captions-wrap .lr-placeholder { color: rgba(255,255,255,0.3); font-style: italic; text-align: center; margin-top: 80px; }
        .lr-controls { display: flex; gap: 16px; }
        .lr-btn { padding: 12px 32px; border-radius: 10px; border: none; font-size: 15px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.15s; }
        .lr-btn-pause { background: rgba(255,255,255,0.12); color: #fff; }
        .lr-btn-pause:hover { background: rgba(255,255,255,0.2); }
        .lr-btn-stop { background: #ef4444; color: #fff; }
        .lr-btn-stop:hover { background: #dc2626; }
        .lr-btn-cancel { position: absolute; top: 20px; right: 24px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; color: #fff; cursor: pointer; font-size: 14px; font-weight: 500; padding: 8px 20px; font-family: inherit; transition: all .15s; }
        .lr-btn-cancel:hover { background: rgba(255,255,255,0.2); }
        .lr-processing { text-align: center; }
        .lr-processing .lr-spinner { width: 48px; height: 48px; border: 4px solid rgba(255,255,255,0.15); border-top-color: #3b82f6; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px; }
        @keyframes spin { to { transform: rotate(360deg); } }
        .lr-processing p { font-size: 16px; color: rgba(255,255,255,0.7); }

        /* ── Khio LM View ── */
        /* Keep sidebar visible in KLM picker mode, hide only when notebook is open */
        .study-layout.klm-active .study-sidebar { display: flex !important; }
        .study-layout.klm-active .study-main { width: calc(100% - var(--sidebar-w)); }
        .study-layout.klm-active.klm-notebook-open .study-sidebar { display: none !important; }
        .study-layout.klm-active.klm-notebook-open .study-main { width: 100%; }
        /* Focus mode: always hide sidebar */
        .study-layout.focus-active .study-sidebar { display: none !important; }
        .study-layout.focus-active .study-main { width: 100%; }

        #view-solve { overflow: hidden; }
        .klm-layout { display: flex; height: 100%; overflow: hidden; background: var(--study-bg-tertiary); gap: 8px; padding: 8px; }
        /* Resize handles between panels */
        .klm-resize-handle { width: 16px; cursor: col-resize; flex-shrink: 0; position: relative; margin: 0 -8px; z-index: 2; background: transparent; }
        .klm-resize-handle:hover, .klm-resize-handle.active { background: rgba(255,255,255,.06); }
        .klm-resize-handle::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 3px; height: 32px; border-radius: 2px; background: rgba(255,255,255,.15); opacity: 0; transition: opacity .2s; }
        .klm-resize-handle:hover::after, .klm-resize-handle.active::after { opacity: 1; }
        /* Width readout tooltip */
        .klm-resize-readout { display: none; }

        /* Left: Sources Panel */
        .klm-sources { width: 488px; flex-shrink: 0; display: flex; flex-direction: column; border-radius: 16px; background: var(--study-bg); overflow: hidden; scrollbar-width: none; }
        .klm-sources::-webkit-scrollbar { display: none; }
        .klm-sources.collapsed { width: 48px !important; min-width: 48px; overflow: hidden; }
        .klm-sources.collapsed .klm-panel-header,
        .klm-sources.collapsed .klm-add-source-btn,
        .klm-sources.collapsed .klm-src-search-wrap,
        .klm-sources.collapsed .klm-sources-select,
        .klm-sources.collapsed .klm-sources-list,
        .klm-sources.collapsed .klm-source-detail { display: none; }
        .klm-sources.collapsed .klm-collapsed-strip { display: flex; }
        .klm-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; flex-shrink: 0; }
        .klm-panel-title { font-size: 15px; font-weight: 600; color: var(--study-text); }
        .klm-collapse-btn { width: 28px; height: 28px; border: none; border-radius: 6px; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
        .klm-collapse-btn:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .klm-collapse-btn i { width: 16px; height: 16px; }
        .klm-add-source-btn { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 12px 10px; padding: 10px 14px; border-radius: 24px; border: 1px solid var(--study-border-light); background: transparent; color: var(--study-text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all .15s; }
        .klm-add-source-btn:hover { border-color: var(--study-accent); color: var(--study-accent); background: var(--study-accent-dim); }
        .klm-add-source-btn i { width: 14px; height: 14px; }
        /* Source inline AI search */
        .klm-src-search-wrap { padding: 0 12px 10px; }
        .klm-src-search-box { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 12px 12px 0 0; border: 1px solid var(--study-border); border-bottom: none; background: var(--study-bg-secondary); transition: border-color .2s; }
        .klm-src-search-wrap:focus-within .klm-src-search-box { border-color: var(--study-accent); }
        .klm-src-search-wrap:focus-within .klm-src-search-footer { border-color: var(--study-accent); }
        .klm-src-search-box i { margin-top: 2px; }
        .klm-src-search-box textarea { flex: 1; background: transparent; border: none; color: var(--study-text); font-family: inherit; font-size: 13px; outline: none; padding: 0; resize: none; line-height: 1.4; min-height: 18px; max-height: 80px; overflow-y: auto; }
        .klm-src-search-box textarea::placeholder { color: var(--study-text-tertiary); }
        .klm-src-search-footer { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 8px; border-radius: 0 0 12px 12px; border: 1px solid var(--study-border); border-top: none; background: var(--study-bg-secondary); }
        /* Research results inline */
        .klm-research-results { padding: 12px 0 0; }
        .klm-research-loading { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: rgba(100,130,255,.08); color: var(--study-text-secondary); font-size: 13px; }
        .klm-research-loading .klm-rl-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--study-accent); animation: klmPulse 1.2s ease-in-out infinite; }
        @keyframes klmPulse { 0%,100% { opacity:.3; } 50% { opacity:1; } }
        .klm-research-done { border-radius: 12px; background: rgba(100,130,255,.06); overflow: hidden; }
        .klm-research-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--study-text); }
        .klm-research-header-left { display: flex; align-items: center; gap: 8px; }
        .klm-research-header-left i { width: 16px; height: 16px; color: var(--study-accent); }
        .klm-research-header a { font-size: 12px; font-weight: 500; color: var(--study-accent); text-decoration: none; cursor: pointer; }
        .klm-research-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 14px; }
        .klm-research-item-icon { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; }
        .klm-research-item-icon img { width: 16px; height: 16px; border-radius: 3px; }
        .klm-research-item-text { flex: 1; min-width: 0; }
        .klm-research-item-title { font-size: 12px; font-weight: 600; color: var(--study-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .klm-research-item-snippet { font-size: 11px; color: var(--study-text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .klm-research-more { padding: 6px 14px 10px; font-size: 12px; color: var(--study-text-tertiary); display: flex; align-items: center; gap: 6px; }
        .klm-research-more i { width: 14px; height: 14px; }
        .klm-research-actions { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid rgba(255,255,255,.06); }
        .klm-research-actions-left { display: flex; gap: 8px; }
        .klm-research-actions-left button { background: none; border: none; color: var(--study-text-tertiary); cursor: pointer; padding: 4px; }
        .klm-research-actions-left button i { width: 16px; height: 16px; }
        .klm-research-actions-right { display: flex; gap: 10px; align-items: center; }
        .klm-research-delete { background: none; border: none; color: var(--study-text-tertiary); font-size: 12px; cursor: pointer; font-family: inherit; }
        .klm-research-delete:hover { color: var(--study-text); }
        .klm-research-import { display: inline-flex; align-items: center; gap: 6px; padding: 7px 18px; border-radius: 20px; border: none; background: var(--study-accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: filter .15s; }
        .klm-research-import:hover { filter: brightness(1.1); }
        .klm-research-import i { width: 14px; height: 14px; }

        /* ── KLM Light Mode ── */
        [data-theme="light"] .klm-layout { background: var(--bg-elevated); }
        [data-theme="light"] .klm-sources,
        [data-theme="light"] .klm-center,
        [data-theme="light"] .klm-studio { background: var(--bg-base); }
        [data-theme="light"] .klm-picker-card { border-color: var(--border-subtle); background: var(--bg-raised); }
        [data-theme="light"] .klm-picker-card:hover { border-color: var(--border-default); background: var(--bg-elevated); }
        [data-theme="light"] .klm-picker-card-menu:hover { background: var(--bg-elevated); }
        [data-theme="light"] .klm-picker-card-create .klm-picker-card-plus { background: transparent; }
        [data-theme="light"] .klm-search-tag { background: var(--bg-raised); }
        [data-theme="light"] .klm-collapsed-strip { background: var(--bg-raised); }
        [data-theme="light"] .klm-collapsed-strip-btn { color: var(--text-tertiary); }
        [data-theme="light"] .klm-collapsed-strip-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
        [data-theme="light"] .klm-studio-btn:hover { filter: brightness(0.95); }
        [data-theme="light"] .klm-studio-btn[data-key="mindmap"] { background: color-mix(in srgb, var(--accent-purple) 15%, var(--bg-raised)); }
        [data-theme="light"] .klm-studio-btn[data-key="report"] { background: color-mix(in srgb, var(--accent-amber) 12%, var(--bg-raised)); }
        [data-theme="light"] .klm-studio-btn[data-key="flashcards"] { background: color-mix(in srgb, var(--accent-orange) 12%, var(--bg-raised)); }
        [data-theme="light"] .klm-studio-btn[data-key="keyterms"] { background: color-mix(in srgb, var(--accent-green) 12%, var(--bg-raised)); }
        [data-theme="light"] .klm-studio-btn[data-key="infographic"] { background: color-mix(in srgb, var(--accent-pink) 12%, var(--bg-raised)); }
        [data-theme="light"] .klm-studio-btn[data-key="quiz"] { background: color-mix(in srgb, var(--accent-blue) 12%, var(--bg-raised)); }
        [data-theme="light"] .klm-studio-btn[data-key="datatable"] { background: color-mix(in srgb, var(--accent-blue) 10%, var(--bg-raised)); }
        [data-theme="light"] .klm-studio-btn[data-key="audio"] { background: color-mix(in srgb, var(--accent-cyan, #06b6d4) 12%, var(--bg-raised)); }
        [data-theme="light"] .klm-studio-btn[data-key="slides"] { background: color-mix(in srgb, var(--accent-amber) 10%, var(--bg-raised)); }
        [data-theme="light"] .klm-studio-btn-icon { color: var(--text-secondary); }
        [data-theme="light"] .klm-studio-btn-label { color: var(--text-primary); font-weight: 700; }
        [data-theme="light"] .klm-studio-btn-edit { color: var(--text-muted); }
        [data-theme="light"] .klm-research-item-icon { background: var(--bg-raised); }
        [data-theme="light"] .klm-research-actions { border-top-color: var(--border-subtle); }
        [data-theme="light"] .klm-research-loading { background: color-mix(in srgb, var(--accent-blue) 6%, var(--bg-base)); }
        [data-theme="light"] .klm-research-done { background: color-mix(in srgb, var(--accent-blue) 4%, var(--bg-base)); }
        [data-theme="light"] .klm-msg-user-bubble { background: var(--bg-raised); color: var(--text-primary); }
        [data-theme="light"] .klm-msg-ai-icon { background: var(--bg-raised); color: var(--text-secondary); }
        [data-theme="light"] .klm-add-modal { background: rgba(0,0,0,.4); }
        [data-theme="light"] .klm-add-modal-content { background: var(--bg-base); box-shadow: 0 16px 48px rgba(0,0,0,.15); }
        [data-theme="light"] .klm-picker-dropzone { border-color: var(--border-default); }
        [data-theme="light"] .klm-picker-dropzone.dragover { border-color: var(--study-accent); background: color-mix(in srgb, var(--accent-blue) 4%, var(--bg-base)); }
        [data-theme="light"] .klm-src-search-box,
        [data-theme="light"] .klm-src-search-footer { background: var(--bg-raised); border-color: var(--border-subtle); }
        [data-theme="light"] .klm-source-type-btn { background: var(--bg-raised); color: var(--text-secondary); border-color: var(--border-subtle); }
        [data-theme="light"] .klm-source-type-btn:hover { background: var(--bg-elevated); }
        [data-theme="light"] .klm-summary-card { border-color: var(--border-subtle); }
        [data-theme="light"] .klm-suggestion-chip { background: var(--bg-raised); border-color: var(--border-subtle); color: var(--text-secondary); }
        [data-theme="light"] .klm-suggestion-chip:hover { background: var(--bg-elevated); }

        /* ── Themed Prompt Modal ── */
        .klm-prompt-overlay { position: fixed; inset: 0; z-index: 99999; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
        .klm-prompt-box { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 16px; padding: 24px; width: 400px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
        .klm-prompt-title { font-size: 15px; font-weight: 600; color: var(--study-text); margin-bottom: 16px; }
        .klm-prompt-input { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--study-border-light); background: var(--study-bg); color: var(--study-text); font-size: 14px; font-family: inherit; outline: none; transition: border-color .15s; }
        .klm-prompt-input:focus { border-color: var(--study-accent); }
        .klm-prompt-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
        .klm-prompt-cancel { padding: 8px 20px; border-radius: 10px; border: 1px solid var(--study-border); background: transparent; color: var(--study-text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all .15s; }
        .klm-prompt-cancel:hover { background: var(--study-bg-tertiary); color: var(--study-text); }
        .klm-prompt-ok { padding: 8px 24px; border-radius: 10px; border: none; background: var(--study-accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: filter .15s; }
        .klm-prompt-ok:hover { filter: brightness(1.1); }
        [data-theme="light"] .klm-prompt-overlay { background: rgba(0,0,0,.3); }
        [data-theme="light"] .klm-prompt-box { background: var(--bg-base); border-color: var(--border-subtle); box-shadow: 0 20px 60px rgba(0,0,0,.15); }
        .klm-prompt-input { background: var(--study-bg) !important; }
        [data-theme="light"] .klm-prompt-input { background: #fff !important; border-color: var(--border-default); color: var(--text-primary); }
        [data-theme="light"] .klm-prompt-cancel { border-color: var(--border-default); color: var(--text-tertiary); }

        /* ── Theme Toggle Button ── */
        .klm-theme-toggle { width: 30px; height: 30px; border: none; border-radius: 8px; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
        .klm-theme-toggle:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .klm-theme-toggle i { width: 16px; height: 16px; }
        .klm-sources-select { display: flex; align-items: center; padding: 6px 16px 8px; border-bottom: 1px solid var(--study-border); }
        .klm-select-all { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--study-text-tertiary); cursor: pointer; }
        .klm-select-all input { accent-color: var(--study-accent); }
        .klm-sources-list { flex: 1; overflow-y: auto; padding: 6px 8px; scrollbar-width: none; }
        .klm-sources-list::-webkit-scrollbar { display: none; }
        .klm-source-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: background .12s; min-width: 0; }
        .klm-source-item:hover { background: var(--study-bg-tertiary); }
        .klm-source-item.hidden { display: none; }
        .klm-source-item input[type=checkbox] { accent-color: var(--study-accent); flex-shrink: 0; order: 3; margin-left: auto; }
        .klm-source-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 700; overflow: hidden; }
        .klm-source-icon.pdf { background: #dc2626; color: #fff; }
        .klm-source-icon.doc { background: #2563eb; color: #fff; }
        .klm-source-icon.url { background: #1a1a2e; }
        .klm-source-icon.txt { background: #7c3aed; color: #fff; }
        .klm-source-icon img { width: 20px; height: 20px; border-radius: 3px; }
        [data-theme="light"] .klm-source-icon.url { background: #f0f0f0; }
        .klm-source-name { flex: 1; font-size: 13px; color: var(--study-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; order: 2; cursor: pointer; }
        .klm-source-detail { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; scrollbar-width: none; }
        .klm-source-detail::-webkit-scrollbar { display: none; }
        /* When source detail is open, hide all other panel content */
        .klm-sources.detail-open .klm-panel-header,
        .klm-sources.detail-open { width: 688px; }
        .klm-sources.detail-open .klm-panel-header,
        .klm-sources.detail-open .klm-src-search-wrap,
        .klm-sources.detail-open .klm-add-source-btn,
        .klm-sources.detail-open .klm-sources-select,
        .klm-sources.detail-open .klm-sources-list { display: none !important; }
        .klm-source-detail-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--study-border); flex-shrink: 0; }
        .klm-source-detail-back { width: 28px; height: 28px; border: none; border-radius: 6px; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; flex-shrink: 0; }
        .klm-source-detail-back:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .klm-source-detail-back i { width: 16px; height: 16px; }
        .klm-source-detail-name { flex: 1; font-size: 14px; font-weight: 600; color: var(--study-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .klm-source-detail-check { display: flex; align-items: center; flex-shrink: 0; cursor: pointer; }
        .klm-source-detail-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--study-accent); }
        .klm-source-detail-body { flex: 1; overflow-y: auto; padding: 16px; scrollbar-width: none; display: flex; flex-direction: column; min-height: 0; }
        .klm-source-detail-body::-webkit-scrollbar { display: none; }
        .klm-source-detail-guide { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
        .klm-source-detail-guide-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--study-accent); }
        .klm-source-detail-guide-header i { width: 16px; height: 16px; }
        .klm-source-detail-guide p { font-size: 14px; line-height: 1.7; color: var(--study-text-secondary); margin: 0; }
        .klm-source-detail-guide strong { color: var(--study-text); }
        .klm-source-detail-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
        .klm-source-detail-topic { font-size: 12px; padding: 5px 10px; border-radius: 6px; background: var(--study-bg-tertiary); color: var(--study-text-secondary); border: 1px solid var(--study-border); }
        .klm-source-detail-content { font-size: 13px; line-height: 1.8; color: var(--study-text-secondary); white-space: pre-wrap; word-break: break-word; }
        .klm-source-detail-content img { max-width: 100%; border-radius: 8px; margin: 8px 0; }

        /* Center: Chat Area */
        .klm-center { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: var(--study-bg); }
        .klm-center-topbar { display: flex; align-items: center; padding: 12px 20px; flex-shrink: 0; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--study-border); }
        .klm-topbar-btn { width: 30px; height: 30px; border: none; border-radius: 8px; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
        .klm-topbar-btn:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .klm-topbar-btn i { width: 16px; height: 16px; }
        .klm-notebook-title { font-size: 16px; font-weight: 600; color: var(--study-text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; border-radius: 6px; padding: 2px 6px; margin: -2px -6px; transition: background .15s; }
        .klm-notebook-title:hover { background: var(--study-bg-tertiary); }
        .klm-notebook-title:focus { outline: 2px solid var(--study-accent); background: var(--study-bg-secondary); cursor: text; }
        .klm-topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

        /* Notebook Picker — full width when no notebook open */
        .klm-layout.picker-mode .klm-sources,
        .klm-layout.picker-mode .klm-studio,
        .klm-layout.picker-mode .klm-resize-handle { display: none !important; }
        .klm-layout.picker-mode { background: transparent !important; padding: 0 !important; gap: 0 !important; }
        .klm-layout.picker-mode .klm-center { border-radius: 0; background: transparent !important; border: none !important; box-shadow: none !important; }
        .klm-layout.picker-mode .klm-center-topbar { display: none !important; }
        .klm-picker { flex: 1; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 0; }
        .klm-picker-inner { text-align: left; max-width: 1200px; width: 100%; margin: 0 auto; padding: 68px 40px 42px; }
        .klm-picker-heading { font-size: 22px; font-weight: 600; color: var(--study-text); margin: 0 0 28px; }

        /* AI Search Bar */
        .klm-picker-search-wrap { margin-bottom: 24px; }
        .klm-picker-search { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 14px; border: 1.5px solid rgba(100,130,255,.35); background: var(--study-bg-secondary); transition: border-color .2s; }
        .klm-picker-search:focus-within { border-color: rgba(100,130,255,.7); }
        .klm-picker-search input { flex: 1; min-width: 180px; background: transparent; border: none; color: var(--study-text); font-family: inherit; font-size: 15px; outline: none; padding: 0; -webkit-appearance: none; }
        .klm-picker-search input::placeholder { color: var(--study-text-tertiary); }
        .klm-picker-search input:focus { outline: none; box-shadow: none; }
        .klm-picker-search input::selection { background: transparent; }
        .klm-picker-search-tags { display: flex; gap: 8px; }
        .klm-search-tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 16px; background: rgba(255,255,255,.08); color: var(--study-text-secondary); font-size: 12px; font-weight: 500; }
        .klm-picker-search-go { width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(100,130,255,.2); color: var(--study-text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; margin-left: auto; }
        .klm-picker-search-go:hover { background: var(--study-accent); color: #fff; }

        /* Drop Zone */
        .klm-picker-dropzone { padding: 32px 24px 24px; border-radius: 14px; border: 2px dashed var(--study-border); background: var(--study-bg-secondary); margin-bottom: 28px; transition: border-color .2s, background .2s; }
        .klm-picker-dropzone.dragover { border-color: var(--study-accent); background: var(--study-accent-dim); }
        .klm-dropzone-text { font-size: 16px; font-weight: 500; color: var(--study-text-secondary); margin-bottom: 4px; }
        .klm-dropzone-sub { font-size: 13px; color: var(--study-text-tertiary); margin-bottom: 20px; }
        .klm-dropzone-btns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
        .klm-source-type-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--study-border); background: var(--study-bg); color: var(--study-text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all .15s; }
        .klm-source-type-btn:hover { background: var(--study-accent-dim); border-color: var(--study-accent); color: var(--study-accent); }

        /* Divider */
        .klm-picker-divider { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
        .klm-picker-divider::before, .klm-picker-divider::after { content: ''; flex: 1; height: 1px; background: var(--study-border); }
        .klm-picker-divider span { font-size: 13px; color: var(--study-text-tertiary); white-space: nowrap; }

        /* Notebook Grid */
        .klm-picker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; text-align: left; }
        @media (max-width: 1100px) { .klm-picker-grid { grid-template-columns: repeat(3, 1fr); } }
        @media (max-width: 850px) { .klm-picker-grid { grid-template-columns: repeat(2, 1fr); } }
        @media (max-width: 600px) { .klm-picker-grid { grid-template-columns: 1fr; } }
        .klm-picker-card { position: relative; padding: 24px 20px; border-radius: 24px; border: 1px solid var(--study-border); background: var(--study-bg-card, #fff); cursor: pointer; transition: all .2s ease; aspect-ratio: 1 / 1; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.04); overflow: hidden; }
        .klm-picker-card:hover { border-color: var(--study-accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); }
        .klm-picker-card-emoji { font-size: 42px; margin-bottom: 16px; line-height: 1; }
        .klm-picker-card-menu { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border: none; border-radius: 6px; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 1; transition: opacity .15s; z-index: 2; }
        .klm-picker-card-menu:hover { background: rgba(255,255,255,.1); }
        .klm-picker-card-menu i { width: 16px; height: 16px; }
        .klm-picker-card-dropdown { position: absolute; top: 42px; right: 8px; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 10px; padding: 4px; min-width: 140px; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.4); display: none; }
        .klm-picker-card-dropdown.open { display: block; }
        .klm-picker-card-dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: none; background: transparent; color: var(--study-text); font-size: 13px; font-family: inherit; border-radius: 6px; cursor: pointer; }
        .klm-picker-card-dropdown button:hover { background: var(--study-bg-tertiary); }
        .klm-picker-card-dropdown button.danger { color: #ef4444; }
        .klm-picker-card-dropdown button.danger:hover { background: rgba(239,68,68,.1); }
        .klm-picker-card-dropdown button i { width: 14px; height: 14px; }
        .klm-card-blob { position: absolute; inset: 0; pointer-events: none; opacity: 0.7; z-index: 0; }
        .klm-picker-card > *:not(.klm-card-blob):not(.klm-picker-card-menu):not(.klm-picker-card-dropdown) { position: relative; z-index: 1; }
        .klm-picker-card-title { font-size: 20px; font-weight: 700; color: var(--study-text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
        .klm-picker-card-meta { font-size: 13px; color: var(--study-text-tertiary); margin-top: 8px; }
        .klm-card-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
        .klm-card-icon i { width: 26px; height: 26px; }
        .klm-card-subject { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
        .klm-card-footer { display: flex; align-items: center; justify-content: center; margin-top: 12px; padding-top: 8px; }
        .klm-card-time { font-size: 10px; color: var(--study-text-tertiary); }
        .klm-picker-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 20px; }
        .klm-picker-filters { display: flex; gap: 8px; flex-shrink: 0; margin-top: 30px; }
        .klm-filter-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--study-border); background: transparent; color: var(--study-text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all .15s; }
        .klm-filter-btn i { width: 14px; height: 14px; }
        .klm-filter-btn:hover { border-color: var(--study-accent); color: var(--study-accent); }
        .klm-filter-btn.active { background: var(--study-accent); color: #fff; border-color: var(--study-accent); }
        .klm-picker-card-create { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--study-border); background: var(--study-bg-card, #fff); min-height: 260px; }
        .klm-picker-card-create .klm-picker-card-plus { width: 70px; height: 70px; border-radius: 50%; background: rgba(0,0,0,0.03); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
        .klm-picker-card-create .klm-picker-card-plus i { width: 32px; height: 32px; color: var(--study-text-tertiary); stroke-width: 1.5; }
        .klm-picker-card-create:hover { border-color: var(--study-accent); }
        .klm-picker-card-create:hover .klm-picker-card-plus i { color: var(--study-accent); }

        /* Add Source Modal */
        .klm-add-modal { position: absolute; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
        .klm-add-modal-content { background: var(--study-bg); border-radius: 16px; padding: 24px; max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto; box-shadow: 0 16px 48px rgba(0,0,0,.4); }
        .klm-add-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }

        /* Chat Area */
        .klm-chat-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
        .klm-messages { flex: 1; overflow-y: auto; padding: 24px 32px 16px; scrollbar-width: none; display: flex; flex-direction: column; align-items: center; }
        .klm-messages::-webkit-scrollbar { display: none; }
        .klm-messages > * { width: 100%; max-width: 720px; }
        .klm-summary-wrap { margin-bottom: 20px; }
        .klm-summary-header-icon { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
        .klm-summary-header-icon i { width: 20px; height: 20px; color: #fff; }
        .klm-summary-header-title { font-size: 24px; font-weight: 700; color: var(--study-text); margin-bottom: 4px; line-height: 1.3; }
        .klm-summary-source-count { font-size: 13px; color: var(--study-text-tertiary); margin-bottom: 12px; }
        .klm-summary-card { font-size: 15px; line-height: 1.85; color: var(--study-text); }
        .klm-summary-card p { margin-bottom: 16px; }
        .klm-summary-card p:last-child { margin-bottom: 0; }
        .klm-summary-card strong { color: var(--study-text); font-weight: 700; }
        .klm-summary-loading { display: flex; gap: 5px; padding: 12px 0; }
        .klm-summary-loading span { width: 7px; height: 7px; border-radius: 50%; background: var(--study-accent); animation: klmDot 1.2s ease-in-out infinite; }
        .klm-summary-loading span:nth-child(2) { animation-delay: .2s; }
        .klm-summary-loading span:nth-child(3) { animation-delay: .4s; }
        @keyframes klmDot { 0%,80%,100%{opacity:.3;transform:scale(.8)} 40%{opacity:1;transform:scale(1)} }
        .klm-summary-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
        .klm-save-note-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--study-border-light); background: var(--study-bg-secondary); color: var(--study-text); font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; transition: all .15s; }
        .klm-save-note-btn:hover { border-color: var(--study-accent); }
        .klm-save-note-btn i { width: 14px; height: 14px; }
        .klm-action-sep { width: 1px; height: 20px; background: var(--study-border); margin: 0 4px; }
        .klm-suggestions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
        .klm-suggestion-chip { text-align: left; padding: 12px 18px; border-radius: 14px; border: 1px solid var(--study-border); background: var(--study-bg-secondary); color: var(--study-text-secondary); font-size: 14px; cursor: pointer; font-family: inherit; transition: all .15s; line-height: 1.4; }
        .klm-suggestion-chip:hover { border-color: var(--study-accent); color: var(--study-text); background: var(--study-bg-tertiary); }
        .klm-msg-action { width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
        .klm-msg-action:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .klm-msg-action i { width: 15px; height: 15px; }

        /* Chat messages */
        #klmChatMessages { display: flex; flex-direction: column; gap: 20px; }
        .klm-msg-user { display: flex; justify-content: flex-end; margin-bottom: 4px; }
        .klm-msg-user-bubble { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 18px 18px 4px 18px; padding: 12px 16px; font-size: 14px; line-height: 1.6; color: var(--study-text); max-width: 70%; white-space: pre-wrap; word-break: break-word; }
        .klm-msg-ai { display: flex; gap: 12px; align-items: flex-start; }
        .klm-msg-ai-icon { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: -3px; }
        .klm-msg-ai-icon img { width: 50px; height: 50px; object-fit: contain; image-rendering: pixelated; image-rendering: crisp-edges; }
        .klm-msg-ai-icon lottie-player { width: 52px; height: 52px; display: block; }
        .klm-thinking-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--study-text-secondary); padding: 4px 0; }
        .klm-thinking-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--study-accent); animation: thinkingPulse 1.4s ease-in-out infinite; }
        .klm-thinking-text { transition: opacity 0.3s; }
        @keyframes thinkingPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }
        .klm-msg-ai-body { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.8; color: var(--study-text); }
        .klm-msg-ai-body p { margin-bottom: 14px; }
        .klm-msg-ai-body p:last-child { margin-bottom: 0; }
        .klm-msg-ai-body h1,.klm-msg-ai-body h2,.klm-msg-ai-body h3 { color: var(--study-text); margin: 16px 0 6px; font-weight: 700; }
        .klm-msg-ai-body h1 { font-size: 1.3em; } .klm-msg-ai-body h2 { font-size: 1.15em; } .klm-msg-ai-body h3 { font-size: 1.05em; }
        .klm-msg-ai-body ul,.klm-msg-ai-body ol { padding-left: 22px; margin: 8px 0; }
        .klm-msg-ai-body li { margin: 4px 0; }
        .klm-msg-ai-body p { margin: 8px 0; }
        .klm-msg-ai-body p:first-child { margin-top: 0; }
        .klm-msg-ai-body strong { color: var(--study-text); font-weight: 700; }
        .klm-msg-ai-body table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 13px; }
        .klm-msg-ai-body th { background: var(--study-bg-secondary); color: var(--study-text); font-weight: 700; padding: 8px 12px; text-align: left; border: 1px solid var(--study-border); }
        .klm-msg-ai-body td { padding: 8px 12px; border: 1px solid var(--study-border); color: var(--study-text-secondary); }
        .klm-msg-ai-body blockquote { border-left: 3px solid var(--study-accent); margin: 10px 0; padding: 8px 14px; background: var(--study-bg-tertiary); border-radius: 0 8px 8px 0; color: var(--study-text-secondary); }
        .klm-msg-ai-body code:not(pre code) { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 4px; padding: 2px 5px; font-size: .87em; color: var(--study-accent); }
        .klm-msg-ai-body pre { margin: 12px 0; border-radius: 10px; overflow: auto; }
        .klm-msg-ai-actions { display: flex; gap: 4px; margin-top: 10px; }

        /* Input bar */
        .klm-input-wrap { padding: 12px 24px 8px; flex-shrink: 0; max-width: 768px; width: 100%; margin: 0 auto; }
        .klm-input-card { display: flex; align-items: center; gap: 8px; background: var(--study-bg-secondary); border: 1px solid var(--study-border-light); border-radius: 24px; padding: 10px 16px; transition: border-color .2s; }
        .klm-input-card:focus-within { border-color: var(--study-accent); }
        .klm-input-card textarea { flex: 1; background: transparent; border: none; color: var(--study-text); font-family: inherit; font-size: 14px; resize: none; outline: none; min-height: 20px; max-height: 120px; line-height: 1.5; padding: 0; }
        .klm-input-card textarea::placeholder { color: var(--study-text-tertiary); }
        .klm-input-footer { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
        .klm-input-badge { font-size: 11px; color: var(--study-text-tertiary); background: var(--study-bg-tertiary); padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
        .klm-send-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--study-accent); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
        .klm-send-btn:hover { background: var(--study-accent); filter: brightness(1.1); }
        .klm-send-btn:disabled { opacity: .3; cursor: not-allowed; }
        .klm-send-btn i { width: 14px; height: 14px; }
        .klm-input-disclaimer { font-size: 11px; color: var(--study-text-tertiary); text-align: center; padding: 6px 0; max-width: 768px; width: 100%; margin: 0 auto; }

        /* Right: Studio Panel */
        .klm-studio { width: 463px; flex-shrink: 0; display: flex; flex-direction: column; border-radius: 16px; background: var(--study-bg); overflow: hidden; }
        .klm-studio.collapsed { width: 48px !important; min-width: 48px; overflow: hidden; }
        .klm-studio.collapsed .klm-panel-header,
        .klm-studio.collapsed .klm-studio-grid,
        .klm-studio.collapsed .klm-studio-outputs { display: none; }
        .klm-studio.collapsed .klm-collapsed-strip { display: flex; }
        /* Collapsed icon strips */
        .klm-collapsed-strip { display: none; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; height: 100%; }
        .klm-collapsed-strip-btn { width: 34px; height: 34px; border: none; border-radius: 8px; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
        .klm-collapsed-strip-btn:hover { background: var(--study-bg-secondary); color: var(--study-text); }
        .klm-collapsed-strip-btn i { width: 18px; height: 18px; }
        .klm-collapsed-strip-divider { width: 24px; height: 1px; background: var(--study-border); margin: 2px 0; }

        .klm-studio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 14px; }
        .klm-studio-btn { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 0; padding: 8px 10px; border-radius: 12px; border: none; cursor: pointer; transition: all .15s; height: 56px; overflow: hidden; }
        .klm-studio-btn:hover { filter: brightness(1.15); }
        .klm-studio-btn.disabled { opacity: .4; cursor: not-allowed; }
        .klm-studio-btn.generating { pointer-events: none; }
        .klm-studio-btn.generating .klm-studio-btn-icon { animation: klmSpin 1s linear infinite; }
        @keyframes klmSpin { to { transform: rotate(360deg); } }
        .klm-studio-btn-icon { width: 18px; height: 18px; color: rgba(255,255,255,.85); margin-bottom: 4px; }
        .klm-studio-btn-label { font-size: 10px; font-weight: 600; color: rgba(255,255,255,.9); text-align: left; line-height: 1.2; }
        .klm-studio-btn-edit { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 20px; height: 20px; color: #fff; cursor: pointer; z-index: 2; opacity: .7; transition: opacity .15s; }
        .klm-studio-btn-edit:hover { opacity: 1; }
        /* Studio button colors — exact NotebookLM RGB values */
        .klm-studio-btn[data-key="mindmap"] { background: rgb(58, 49, 57); }
        .klm-studio-btn[data-key="report"] { background: rgb(58, 58, 47); }
        .klm-studio-btn[data-key="flashcards"] { background: rgb(58, 50, 48); }
        .klm-studio-btn[data-key="keyterms"] { background: rgb(48, 54, 50); }
        .klm-studio-btn[data-key="infographic"] { background: rgb(58, 49, 57); }
        .klm-studio-btn[data-key="quiz"] { background: rgb(50, 56, 62); }
        .klm-studio-btn[data-key="datatable"] { background: rgb(50, 52, 62); }
        .klm-studio-btn[data-key="audio"] { background: rgb(50, 52, 62); }
        .klm-studio-btn[data-key="slides"] { background: rgb(58, 58, 47); }
        .klm-studio-outputs { flex: 1; overflow-y: auto; padding: 8px 14px; scrollbar-width: none; }
        .klm-studio-outputs::-webkit-scrollbar { display: none; }
        .klm-studio-output-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--study-border); background: var(--study-bg-secondary); cursor: pointer; transition: all .15s; margin-bottom: 6px; }
        .klm-studio-output-item:hover { border-color: var(--study-accent); background: var(--study-accent-dim); }
        .klm-studio-output-delete { display: flex; align-items: center; justify-content: center; padding: 4px; border: none; background: transparent; color: var(--study-text-muted); cursor: pointer; border-radius: 6px; margin-left: auto; flex-shrink: 0; opacity: 0.5; transition: all 0.15s; }
        .klm-studio-output-delete:hover { color: #ef4444; background: rgba(239,68,68,.12); opacity: 1; }
        .klm-studio-output-icon { width: 18px; height: 18px; color: var(--study-accent); flex-shrink: 0; }
        .klm-studio-output-info { flex: 1; min-width: 0; }
        .klm-studio-output-title { font-size: 13px; font-weight: 600; color: var(--study-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .klm-studio-output-meta { font-size: 11px; color: var(--study-text-tertiary); }

        /* Studio Inline View */
        .klm-studio-view { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
        .klm-studio-view-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--study-border); flex-shrink: 0; }
        .klm-studio-view-back, .klm-studio-view-fullscreen { width: 32px; height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--study-text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; flex-shrink: 0; }
        .klm-studio-view-back:hover, .klm-studio-view-fullscreen:hover { background: var(--study-bg-secondary); color: var(--study-text); }
        .klm-studio-view-back i, .klm-studio-view-fullscreen i { width: 18px; height: 18px; }
        .klm-studio-view-title { flex: 1; font-size: 14px; font-weight: 700; color: var(--study-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .klm-studio-view-body { flex: 1; overflow-y: auto; padding: 16px; font-size: 14px; line-height: 1.7; color: var(--study-text); scrollbar-width: none; }
        .klm-studio-view-body::-webkit-scrollbar { display: none; }
        .klm-studio-view-body h1, .klm-studio-view-body h2, .klm-studio-view-body h3 { color: var(--study-text); margin: 14px 0 6px; font-weight: 700; }
        .klm-studio-view-body h2 { font-size: 16px; }
        .klm-studio-view-body ul, .klm-studio-view-body ol { padding-left: 20px; }
        .klm-studio-view-body li { margin: 3px 0; }
        .klm-studio-view-body table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
        .klm-studio-view-body th { background: var(--study-bg-secondary); padding: 8px 10px; text-align: left; border: 1px solid var(--study-border); font-weight: 700; }
        .klm-studio-view-body td { padding: 8px 10px; border: 1px solid var(--study-border); }

        /* Studio Output Modal (fullscreen) */
        .klm-output-modal { position: fixed; inset: 0; z-index: 9999; background: var(--study-bg, #0a0a0a); display: flex; flex-direction: column; }
        .klm-output-modal-inner { background: var(--study-bg, #0a0a0a); width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
        .klm-output-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--study-border); flex-shrink: 0; }
        .klm-output-modal-title { font-size: 16px; font-weight: 700; color: var(--study-text); }
        .klm-output-modal-close { width: 32px; height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; }
        .klm-output-modal-close:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .klm-output-modal-body { flex: 1; overflow-y: auto; padding: 32px; font-size: 14.5px; line-height: 1.7; color: var(--study-text); scrollbar-width: thin; max-width: 900px; margin: 0 auto; width: 100%; }
        .klm-output-modal-body h1,.klm-output-modal-body h2,.klm-output-modal-body h3 { color: var(--study-text); margin: 16px 0 8px; font-weight: 700; }
        .klm-output-modal-body ul,.klm-output-modal-body ol { padding-left: 22px; }
        .klm-output-modal-body li { margin: 4px 0; }
        .klm-output-modal-body table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; }
        .klm-output-modal-body th { background: var(--study-bg-secondary); padding: 8px 12px; text-align: left; border: 1px solid var(--study-border); font-weight: 700; }
        .klm-output-modal-body td { padding: 8px 12px; border: 1px solid var(--study-border); }

        /* Audio Overview Customize Modal */
        .audio-customize-modal { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 24px; }
        .audio-customize-inner { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 16px; max-width: 680px; width: 100%; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; }
        .audio-customize-header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--study-border); }
        .audio-customize-header i { width: 20px; height: 20px; color: var(--study-accent); }
        .audio-customize-title { font-size: 16px; font-weight: 700; color: var(--study-text); flex: 1; }
        .audio-customize-close { width: 28px; height: 28px; border: none; border-radius: 8px; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; }
        .audio-customize-close:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .audio-customize-body { flex: 1; overflow-y: auto; padding: 20px; }
        .audio-customize-section { margin-bottom: 20px; }
        .audio-customize-label { font-size: 13px; font-weight: 700; color: var(--study-text); margin-bottom: 10px; }
        .audio-format-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
        .audio-format-card { padding: 12px; border: 1.5px solid var(--study-border, #2a2a3a); border-radius: 10px; background: var(--study-bg-secondary); cursor: pointer; transition: all .15s; position: relative; }
        .audio-format-card:hover { border-color: var(--study-accent); }
        .audio-format-card.active { border-color: var(--study-accent); background: var(--study-accent-dim); }
        .audio-format-card.active::after { content: ''; position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; background: var(--study-accent); border-radius: 50%; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); background-size: 12px; background-repeat: no-repeat; background-position: center; }
        .audio-format-name { font-size: 13px; font-weight: 700; color: var(--study-text); margin-bottom: 4px; }
        .audio-format-desc { font-size: 11px; line-height: 1.4; color: var(--study-text-tertiary); }
        .audio-length-btns { display: inline-flex; border: 1px solid var(--study-border); border-radius: 8px; overflow: hidden; }
        .audio-length-btn { padding: 8px 16px; border: none; background: transparent; color: var(--study-text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; display: flex; align-items: center; gap: 4px; }
        .audio-length-btn:not(:last-child) { border-right: 1px solid var(--study-border); }
        .audio-length-btn.active { background: var(--study-bg-secondary); color: var(--study-text); }
        .audio-length-btn.active::before { content: ''; display: inline-block; width: 14px; height: 14px; background: var(--study-accent); border-radius: 50%; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); background-size: 10px; background-repeat: no-repeat; background-position: center; }
        .audio-focus-input { width: 100%; min-height: 80px; padding: 12px; border: 1px solid var(--study-border); border-radius: 10px; background: var(--study-bg-secondary); color: var(--study-text); font-size: 13px; font-family: inherit; resize: vertical; outline: none; }
        .audio-focus-input::placeholder { color: var(--study-text-tertiary); }
        .audio-focus-input:focus { border-color: var(--study-accent); }
        .audio-quick-tags { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
        .audio-quick-tag { padding: 6px 12px; border: 1px solid var(--study-accent); border-radius: 20px; background: transparent; color: var(--study-accent); font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; }
        .audio-quick-tag:hover { background: var(--study-accent-dim); }
        .audio-customize-footer { padding: 14px 20px; border-top: 1px solid var(--study-border); display: flex; justify-content: space-between; align-items: center; }
        .audio-preview-btn { padding: 8px 16px; border: 1px solid var(--study-border); border-radius: 8px; background: transparent; color: var(--study-text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; display: flex; align-items: center; gap: 6px; }
        .audio-preview-btn:hover { border-color: var(--study-accent); color: var(--study-text); }
        .audio-preview-btn:disabled { opacity: .5; cursor: not-allowed; }
        .audio-preview-btn i { width: 14px; height: 14px; }
        .audio-generate-btn { padding: 10px 24px; border: none; border-radius: 10px; background: var(--study-accent); color: #000; font-size: 14px; font-weight: 700; cursor: pointer; transition: all .15s; }
        .audio-generate-btn:hover { filter: brightness(1.1); }
        .audio-generate-btn:disabled { opacity: .5; cursor: not-allowed; }
        .audio-voice-row { display: flex; gap: 24px; flex-wrap: wrap; }
        .audio-voice-group { flex: 1; min-width: 180px; }
        .audio-voice-sublabel { font-size: 11px; font-weight: 600; color: var(--study-text-tertiary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
        .audio-voice-btns { display: inline-flex; border: 1px solid var(--study-border); border-radius: 8px; overflow: hidden; }
        .audio-voice-btn { padding: 8px 14px; border: none; background: transparent; color: var(--study-text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
        .audio-voice-btn:not(:last-child) { border-right: 1px solid var(--study-border); }
        .audio-voice-btn.active { background: var(--study-bg-secondary); color: var(--study-text); }
        .audio-voice-btn.active::before { content: ''; display: inline-block; width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; background: var(--study-accent); border-radius: 50%; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); background-size: 10px; background-repeat: no-repeat; background-position: center; }
        @media (max-width: 600px) { .audio-format-grid { grid-template-columns: repeat(2, 1fr); } }

        /* Studio Tool Customize Modal */
        .studio-customize-modal { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 24px; }
        .studio-customize-inner { background: var(--study-bg, #0f0f14); border: 1px solid var(--study-border); border-radius: 16px; max-width: 680px; width: 100%; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; }
        .studio-customize-header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--study-border); }
        .studio-customize-header i { width: 20px; height: 20px; color: var(--study-accent); }
        .studio-customize-title { font-size: 18px; font-weight: 700; color: var(--study-text); flex: 1; }
        .studio-customize-close { width: 28px; height: 28px; border: none; border-radius: 8px; background: transparent; color: var(--study-text-tertiary); cursor: pointer; display: flex; align-items: center; justify-content: center; }
        .studio-customize-close:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .studio-customize-body { flex: 1; overflow-y: auto; padding: 24px; }
        .studio-customize-section { margin-bottom: 22px; }
        .studio-customize-label { font-size: 13px; font-weight: 700; color: var(--study-text-secondary); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .5px; }
        .studio-customize-row { display: flex; gap: 24px; flex-wrap: wrap; }
        .studio-customize-col { flex: 1; min-width: 180px; }
        .studio-customize-pills { display: inline-flex; gap: 0; border: 1px solid var(--study-border); border-radius: 8px; overflow: hidden; }
        .studio-customize-pill { padding: 9px 12px; border: none; border-right: 1px solid var(--study-border); background: transparent; color: var(--study-text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
        .studio-customize-pill:last-child { border-right: none; }
        .studio-customize-pill:hover { background: var(--study-bg-tertiary); color: var(--study-text); }
        .studio-customize-pill.active { background: var(--study-bg-secondary); color: var(--study-text); }
        .studio-customize-pill.active svg { color: var(--study-accent); }
        .studio-customize-textarea { width: 100%; min-height: 140px; padding: 16px; border: 1px solid var(--study-border); border-radius: 10px; background: var(--study-bg-secondary); color: var(--study-text); font-size: 14px; font-family: inherit; resize: vertical; outline: none; line-height: 1.6; }
        .studio-customize-textarea::placeholder { color: var(--study-text-tertiary); }
        .studio-customize-textarea:focus { border-color: var(--study-accent); }
        .studio-customize-footer { padding: 14px 20px; border-top: 1px solid var(--study-border); display: flex; justify-content: flex-end; }
        .studio-customize-generate { padding: 10px 24px; border: none; border-radius: 20px; background: #5b5fc7; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; transition: all .15s; }
        .studio-customize-generate:hover { filter: brightness(1.15); }

        /* Quiz interactive */
        .klm-quiz-q { margin-bottom: 20px; padding: 16px; border-radius: 12px; border: 1px solid var(--study-border); background: var(--study-bg-secondary); }
        .klm-quiz-q-text { margin: 0 0 12px; font-size: 14px; }
        .klm-quiz-opt { display: block; width: 100%; text-align: left; padding: 10px 14px; margin: 6px 0; border-radius: 8px; border: 1px solid var(--study-border); background: var(--study-bg); color: var(--study-text); font-size: 13px; cursor: pointer; transition: all .15s; }
        .klm-quiz-opt:hover { border-color: var(--study-accent); background: var(--study-accent-dim); }
        .klm-quiz-opt.selected { border-color: var(--study-accent); background: var(--study-accent-dim); font-weight: 600; }
        .klm-quiz-opt.correct { border-color: #22c55e; background: rgba(34,197,94,.15); color: #22c55e; }
        .klm-quiz-opt.wrong { border-color: #ef4444; background: rgba(239,68,68,.15); color: #ef4444; }
        .klm-quiz-textarea { width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--study-border); background: var(--study-bg); color: var(--study-text); font-size: 13px; resize: vertical; font-family: inherit; }
        .klm-quiz-feedback { margin-top: 8px; padding: 10px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5; }
        .klm-quiz-feedback.correct { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: #22c55e; }
        .klm-quiz-feedback.wrong { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #ef4444; }
        .klm-quiz-footer { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
        .klm-quiz-submit { padding: 10px 24px; border-radius: 10px; background: var(--study-accent); color: #fff; border: none; font-size: 14px; font-weight: 600; cursor: pointer; }
        .klm-quiz-submit:hover { background: var(--study-accent-hover); }
        .klm-quiz-score { font-size: 16px; font-weight: 700; }
        .klm-quiz-q.graded .klm-quiz-opt { pointer-events: none; }
        .klm-quiz-q.graded .klm-quiz-textarea { pointer-events: none; opacity: .7; }

        /* Flashcards interactive */
        .klm-fc-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
        .klm-fc-card { perspective: 800px; height: 200px; cursor: pointer; }
        .klm-fc-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
        .klm-fc-card.flipped .klm-fc-inner { transform: rotateY(180deg); }
        .klm-fc-front, .klm-fc-back { position: absolute; inset: 0; border-radius: 14px; padding: 20px; display: flex; align-items: center; justify-content: center; text-align: center; backface-visibility: hidden; border: 1px solid var(--study-border); font-size: 14px; line-height: 1.5; overflow-y: auto; }
        .klm-fc-front { background: var(--study-bg-secondary); color: var(--study-text); font-weight: 600; }
        .klm-fc-back { background: var(--study-accent-dim); color: var(--study-text); transform: rotateY(180deg); }
        .klm-fc-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
        .klm-fc-nav button { padding: 8px 16px; border-radius: 8px; border: 1px solid var(--study-border); background: var(--study-bg-secondary); color: var(--study-text); cursor: pointer; font-size: 13px; }
        .klm-fc-nav button:hover { border-color: var(--study-accent); }
        .klm-fc-counter { font-size: 14px; color: var(--study-text-secondary); font-weight: 600; }

        /* Mind Map visual */
        .klm-mm-container { padding: 16px; }
        .klm-mm-center { text-align: center; font-size: 20px; font-weight: 700; color: var(--study-accent); margin-bottom: 24px; padding: 16px; border-radius: 14px; background: var(--study-accent-dim); border: 2px solid var(--study-accent); }
        .klm-mm-branch { margin-bottom: 16px; padding: 14px; border-radius: 12px; border: 1px solid var(--study-border); background: var(--study-bg-secondary); }
        .klm-mm-branch-label { font-size: 15px; font-weight: 700; color: var(--study-text); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
        .klm-mm-branch-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
        .klm-mm-children { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 18px; }
        .klm-mm-child { padding: 6px 12px; border-radius: 8px; background: var(--study-bg); border: 1px solid var(--study-border); font-size: 13px; color: var(--study-text-secondary); }

        /* Note icon */
        .klm-source-icon.note { background: var(--study-accent-dim); display: flex; align-items: center; justify-content: center; }

        @media (max-width: 1100px) {
            .klm-studio { width: 260px; }
            .klm-sources { width: 260px; }
        }
        @media (max-width: 900px) {
            .klm-sources, .klm-studio { display: none; }
        }

        /* ── Grade View (Redesigned) ── */
        .grade-container { max-width: 1200px; margin: 0 auto; padding: 68px 40px 42px; width: 100%; flex: 1; display: flex; flex-direction: column; }
        .grade-heading { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 4px; }
        .grade-sub { font-size: 14px; color: var(--study-text-secondary); text-align: center; margin-bottom: 28px; }
        .grade-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
        .grade-cards-v2 { grid-template-columns: 1fr 1.2fr; align-items: stretch; }
        .grade-card {
            display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
            padding: 36px 28px; background: var(--study-bg-card, #fff); border: 1px solid var(--study-border);
            border-radius: 20px; cursor: pointer; transition: all 0.2s ease; position: relative; min-height: 200px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        }
        .grade-card:hover { border-color: var(--study-accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); }
        .grade-card.active { border-color: var(--study-accent); }
        .grade-card i { width: 32px; height: 32px; color: var(--study-text-tertiary); stroke-width: 1.5; }
        .grade-card-label { font-size: 18px; font-weight: 800; }
        .grade-card-sub { font-size: 13px; color: var(--study-text-tertiary); line-height: 1.5; }
        .grade-card input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
        /* V2 Paper Checker cards */
        .grade-card-upload { align-items: flex-start; cursor: default; }
        .grade-card-icon-wrap { width: 52px; height: 52px; border-radius: 14px; background: rgba(144,71,44,.08); display: flex; align-items: center; justify-content: center; }
        .grade-choose-file-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 10px; border: 1px solid var(--study-border); background: linear-gradient(180deg, var(--study-bg-card, #fff) 0%, color-mix(in srgb, var(--study-bg-card, #fff) 95%, #000) 100%); color: var(--study-text); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; margin-top: auto; box-shadow: 0 1px 2px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.5); }
        .grade-choose-file-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.6); border-color: var(--study-accent); }
        .grade-card-paste { cursor: default; }
        .grade-card-paste-header { display: flex; align-items: center; justify-content: space-between; width: 100%; }
        .grade-paste-inline { width: 100%; flex: 1; min-height: 100px; border: 1px solid var(--study-border); border-radius: 12px; padding: 14px; font-size: 14px; font-family: inherit; background: var(--study-bg); color: var(--study-text); resize: none; outline: none; transition: border-color .2s; }
        .grade-paste-inline:focus { border-color: var(--study-accent); }
        .grade-paste-inline::placeholder { color: var(--study-text-tertiary); }
        .grade-paste-stats { display: flex; gap: 12px; font-size: 11px; color: var(--study-text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; }
        .grade-analyze-btn { display: inline-flex !important; align-items: center; gap: 8px; }
        .grade-input-area { display: none; margin-bottom: 16px; }
        .grade-input-area.visible { display: block; }
        .grade-rubric { margin-bottom: 16px; }
        .grade-rubric-row { display: flex; gap: 12px; align-items: flex-start; }
        .grade-rubric-left { flex: 1; }
        .grade-rubric-left textarea { width: 100%; min-height: 80px; padding: 12px; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 10px; color: var(--study-text); font-family: inherit; font-size: 14px; resize: vertical; outline: none; }
        .grade-rubric-upload { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; background: var(--study-bg-secondary); border: 2px dashed var(--study-border-light); border-radius: 10px; cursor: pointer; position: relative; min-width: 120px; transition: all 0.2s; }
        .grade-rubric-upload:hover { border-color: var(--study-accent); }
        .grade-rubric-upload.has-file { border-color: var(--study-accent); border-style: solid; }
        .grade-rubric-upload i { width: 20px; height: 20px; color: var(--study-text-secondary); margin-bottom: 4px; }
        .grade-rubric-upload span { font-size: 11px; color: var(--study-text-tertiary); text-align: center; }
        .grade-rubric-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
        .grade-submit { padding: 14px 32px; background: linear-gradient(135deg, var(--study-accent), var(--study-accent-hover, #c4703a)); color: #fff; border: none; border-radius: 14px; font-weight: 700; font-size: 15px; cursor: pointer; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.15); transition: all 0.2s; }
        .grade-submit:disabled { opacity: 0.5; cursor: not-allowed; }
        /* Upload buttons row */
        .grade-upload-btns { display: flex; gap: 10px; margin-top: auto; }
        .grade-rubric-btn { border-style: dashed !important; }
        /* Recent History Section */
        .grade-recent-section { margin-top: 32px; }
        .grade-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--study-accent); margin-bottom: 4px; }
        .grade-recent-title { font-size: 22px; font-weight: 800; margin: 0; color: var(--study-text); }
        .grade-recent-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
        .grade-recent-list { display: flex; flex-direction: column; gap: 10px; }
        .grade-recent-item { border-bottom: none; }
        .grade-recent-item:hover { transform: translateY(-1px); }
        .grade-recent-item:last-child { border-bottom: none; }
        .grade-recent-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(144,71,44,.08); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
        .grade-recent-icon i { width: 20px; height: 20px; color: #90472c; }
        .grade-recent-info { flex: 1; min-width: 0; }
        .grade-recent-info-title { font-size: 14px; font-weight: 600; color: var(--study-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .grade-recent-info-meta { font-size: 12px; color: var(--study-text-tertiary); margin-top: 2px; display: flex; gap: 12px; }
        .grade-recent-score { width: 52px; height: 52px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex-shrink: 0; }
        .grade-recent-score.high { background: rgba(88,129,87,.1); color: #588157; }
        .grade-recent-score.mid { background: rgba(221,161,94,.1); color: #dda15e; }
        .grade-recent-score.low { background: rgba(188,71,73,.1); color: #bc4749; }
        .grade-recent-score-label { font-size: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; }
        /* Grade result detail view */
        .grade-result { margin-top: 20px; }
        .grade-result-back { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--study-text-secondary); cursor: pointer; background: none; border: none; padding: 8px 0; margin-bottom: 16px; }
        .grade-result-back:hover { color: var(--study-text); }
        .grade-result-back i { width: 16px; height: 16px; }
        .grade-result-layout { display: flex; gap: 24px; }
        .grade-result-left { width: 280px; flex-shrink: 0; }
        .grade-result-right { flex: 1; min-width: 0; }
        .grade-score-card { background: #f5e6d3; border-radius: 16px; padding: 28px; text-align: center; margin-bottom: 20px; }
        .grade-score-num { font-size: 56px; font-weight: 800; color: #1a1a1a; line-height: 1; }
        .grade-score-label { font-size: 14px; color: #6b5b4f; margin-top: 4px; font-weight: 500; }
        .grade-breakdown { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 14px; padding: 20px; }
        .grade-breakdown-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
        .grade-criteria { margin-bottom: 14px; }
        .grade-criteria:last-child { margin-bottom: 0; }
        .grade-criteria-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
        .grade-criteria-name { font-size: 12.5px; color: var(--study-text-secondary); max-width: 170px; }
        .grade-criteria-score { font-size: 12px; color: var(--study-text-secondary); }
        .grade-criteria-pct { font-size: 13px; font-weight: 700; }
        .grade-criteria-bar { height: 6px; background: var(--study-bg-tertiary); border-radius: 3px; overflow: hidden; }
        .grade-criteria-fill { height: 100%; border-radius: 3px; background: #3b5bdb; transition: width 0.5s ease; }
        .grade-feedback-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
        .grade-feedback-pill { display: inline-block; padding: 4px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; margin-bottom: 12px; }
        .grade-pill-strengths { background: rgba(34,197,94,0.15); color: #22c55e; }
        .grade-pill-improve { background: rgba(45,138,78,0.15); color: #2d8a4e; }
        .grade-pill-analysis { background: rgba(139,92,246,0.15); color: #8b5cf6; }
        .grade-feedback-list { list-style: none; padding: 0; margin: 0 0 24px 0; }
        .grade-feedback-list li { padding: 6px 0; font-size: 14px; line-height: 1.6; color: var(--study-text-secondary); }
        .grade-feedback-list li strong { color: var(--study-text); margin-right: 4px; }
        .grade-analysis-text { font-size: 14px; line-height: 1.7; color: var(--study-text-secondary); margin-bottom: 24px; }
        /* Grade history cards */
        .grade-history { margin-top: 32px; }
        .grade-history h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
        .grade-history-card { padding: 16px; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 12px; margin-bottom: 10px; cursor: pointer; transition: all 0.15s; }
        .grade-history-card:hover { border-color: var(--study-accent); }
        .grade-history-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
        .grade-history-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--study-accent-dim); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
        .grade-history-icon i { width: 20px; height: 20px; color: var(--study-accent); }
        .grade-history-title { font-size: 14px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .grade-history-more { background: none; border: none; color: var(--study-text-tertiary); cursor: pointer; padding: 4px; }
        .grade-history-more i { width: 18px; height: 18px; }
        .grade-history-preview { font-size: 13px; color: var(--study-text-tertiary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px; }
        .grade-history-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--study-border); }
        .grade-history-view { font-size: 13px; font-weight: 600; color: var(--study-text); display: flex; align-items: center; gap: 4px; }
        .grade-history-view i { width: 14px; height: 14px; }
        .grade-history-pct { font-size: 15px; font-weight: 700; }
        /* Grade tabs — exact copy of .hero-filter-btn */
        .grade-tabs { display: inline-flex; gap: 8px; margin-bottom: 28px; background: none; border: none; padding: 0; max-width: none; margin-left: 0; margin-right: 0; box-shadow: none; }
        .grade-tab { display: inline-flex; align-items: center; gap: 8px; padding: 14px 22px; border-radius: 999px; border: 1px solid var(--study-border); background: var(--study-bg-card, var(--bg-card, #fff)); color: var(--study-text-secondary); font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.2s; }
        .grade-tab i { width: 14px; height: 14px; }
        .grade-tab:hover { border-color: var(--study-accent); color: var(--study-text); }
        .grade-tab.active { background: linear-gradient(180deg, #a0583c 0%, #7a3a22 100%); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(120,58,34,0.2); }
        .grade-tab-content { display: none; }
        .grade-tab-content.active { display: block; }
        /* AI Detection section in grade results */
        .grade-ai-detection { background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 14px; padding: 20px; margin-top: 20px; }
        .grade-ai-detection-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
        .grade-ai-detection-header i { width: 20px; height: 20px; color: var(--study-accent); }
        .grade-ai-detection-title { font-size: 15px; font-weight: 700; }
        .grade-ai-meter { height: 10px; background: var(--study-bg-tertiary); border-radius: 5px; overflow: hidden; margin-bottom: 10px; }
        .grade-ai-meter-fill { height: 100%; border-radius: 5px; transition: width 0.8s ease; }
        .grade-ai-pct { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
        .grade-ai-label { font-size: 12px; color: var(--study-text-tertiary); margin-bottom: 12px; }
        .grade-ai-patterns { list-style: none; padding: 0; margin: 0; }
        .grade-ai-patterns li { padding: 5px 0; font-size: 13px; color: var(--study-text-secondary); display: flex; align-items: flex-start; gap: 8px; }
        .grade-ai-patterns li::before { content: '•'; color: var(--study-accent); font-weight: 700; flex-shrink: 0; }
        /* Hallucinations & fake sources */
        .grade-issues { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); border-radius: 14px; padding: 20px; margin-top: 16px; }
        .grade-issues-title { font-size: 15px; font-weight: 700; color: #ef4444; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
        .grade-issues-title i { width: 18px; height: 18px; }
        .grade-issues-list { list-style: none; padding: 0; margin: 0; }
        .grade-issues-list li { padding: 6px 0; font-size: 13px; color: var(--study-text-secondary); line-height: 1.5; border-bottom: 1px solid var(--study-border); }
        .grade-issues-list li:last-child { border-bottom: none; }
        /* Humanizer — container stays same width, no layout shift */
        .humanizer-wrapper { margin: 0; height: calc(100vh - 180px); display: flex; flex-direction: column; min-height: 0; }
        .humanizer-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0; flex: 1; min-height: 0; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 20px; overflow: hidden; }
        @media (max-width: 768px) { .humanizer-split { grid-template-columns: 1fr; } }
        .humanizer-panel { display: flex; flex-direction: column; padding: 28px 28px 20px; min-height: 0; overflow: hidden; }
        .humanizer-panel + .humanizer-panel { border-left: 1px solid var(--study-border); }
        @media (max-width: 768px) { .humanizer-panel + .humanizer-panel { border-left: none; border-top: 1px solid var(--study-border); } }
        .humanizer-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
        .humanizer-panel-title { font-size: 18px; font-weight: 800; color: var(--study-accent); margin: 0; letter-spacing: -0.01em; }
        .humanizer-panel-sub { font-size: 12.5px; color: var(--study-text-tertiary); margin: 2px 0 16px 0; }
        .humanizer-textarea { flex: 1; min-height: 0; padding: 18px 20px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 14px; color: var(--study-text); font-size: 15px; line-height: 1.8; resize: none; outline: none; font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s; overflow-y: auto; }
        .humanizer-textarea::placeholder { color: var(--study-text-tertiary); }
        .humanizer-textarea:focus { border-color: var(--study-accent); box-shadow: 0 0 0 3px rgba(var(--study-accent-rgb, 255,159,28), 0.12); }
        .humanizer-toolbar { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding: 12px 16px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 14px; }
        .humanizer-toolbar-left { display: flex; align-items: center; gap: 12px; }
        .humanizer-word-count { font-size: 13px; font-weight: 700; color: var(--study-text-secondary); }
        .humanizer-clear-btn { background: none; border: none; color: var(--study-text-tertiary); cursor: pointer; padding: 6px; border-radius: 8px; display: flex; align-items: center; transition: all 0.15s; }
        .humanizer-clear-btn:hover { color: var(--study-red, #ef4444); background: rgba(239,68,68,0.1); }
        .humanizer-clear-btn i { width: 16px; height: 16px; }
        .humanizer-toolbar-right { display: flex; align-items: center; gap: 12px; }
        .humanizer-submit { padding: 14px 32px; background: linear-gradient(180deg, #a0583c 0%, #7a3a22 100%); color: #fff; border: none; border-radius: 14px; font-size: 15px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.15); }
        .humanizer-submit:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.15); }
        .humanizer-submit:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
        .humanizer-submit i { width: 15px; height: 15px; }
        .humanizer-output { flex: 1; min-height: 0; padding: 18px 20px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 14px; font-size: 15px; line-height: 1.8; color: var(--study-text); white-space: pre-wrap; overflow-y: auto; }
        .humanizer-placeholder { color: var(--study-text-tertiary); font-style: italic; text-align: center; display: block; padding-top: 30%; font-size: 14px; }
        .humanizer-result-toolbar { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding: 12px 16px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 14px; }
        .humanizer-status-badge { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
        .humanizer-status-badge.success { color: #22c55e; }
        .humanizer-status-badge i { width: 16px; height: 16px; }
        .humanizer-result-actions { display: flex; align-items: center; gap: 8px; }
        .humanizer-rehumanize-btn { padding: 9px 18px; background: var(--study-text); color: var(--study-bg); border: none; border-radius: 10px; font-size: 12.5px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; }
        .humanizer-rehumanize-btn:hover { opacity: 0.85; }
        .humanizer-rehumanize-btn i { width: 14px; height: 14px; }
        .humanizer-copy-btn { padding: 9px 18px; background: transparent; color: var(--study-text); border: 1px solid var(--study-border); border-radius: 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; }
        .humanizer-copy-btn:hover { background: var(--study-bg-secondary); }
        .humanizer-copy-btn i { width: 14px; height: 14px; }
        .humanizer-tip { text-align: center; margin-top: 16px; font-size: 12px; color: var(--study-text-tertiary); flex-shrink: 0; }
        .humanizer-tip strong { color: var(--study-text-secondary); font-weight: 700; }
        .humanizer-limit-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding: 10px 16px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 12px; font-size: 12px; color: var(--study-text-tertiary); flex-shrink: 0; }
        .humanizer-limit-bar .limit-count { font-weight: 700; color: var(--study-text-secondary); }
        .humanizer-limit-bar .limit-upgrade { color: var(--study-accent); font-weight: 700; text-decoration: none; cursor: pointer; }
        .humanizer-limit-bar .limit-upgrade:hover { text-decoration: underline; }
        .humanizer-streaming-cursor { display: inline-block; width: 2px; height: 1em; background: var(--study-accent); animation: blink 0.8s infinite; vertical-align: text-bottom; margin-left: 2px; }
        @keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

        /* Profile enhanced styles */
        .profile-section { width: min(1200px, 100%); }
        .profile-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
        .profile-cal-cell { aspect-ratio: 1; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; cursor: default; transition: all 0.15s; }
        .profile-cal-cell.empty { visibility: hidden; }
        .profile-cal-cell.today { outline: 2px solid #f97316; outline-offset: -1px; }
        .profile-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
        .profile-stat-card { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 12px; backdrop-filter: blur(4px); }
        .profile-stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
        .profile-stat-icon i { width: 18px; height: 18px; }
        .profile-monthly-bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; }
        .profile-monthly-bar { flex: 1; border-radius: 4px 4px 0 0; background: var(--study-accent); opacity: 0.8; transition: height 0.4s ease, opacity 0.15s; cursor: pointer; position: relative; }
        .profile-monthly-bar.empty { background: var(--study-border); opacity: 0.4; }
        .profile-monthly-bar:hover { opacity: 1; }
        .profile-monthly-bar:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 6px; padding: 4px 8px; font-size: 11px; color: var(--study-text); pointer-events: none; z-index: 10; }
        .profile-lifetime-card { border-radius: 14px; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
        .profile-lifetime-card .lt-val { font-size: 24px; font-weight: 800; color: #fff; margin-top: 8px; }
        .profile-lifetime-card .lt-label { font-size: 12px; color: rgba(255,255,255,0.7); font-weight: 600; margin-top: 4px; }
        .profile-lifetime-card .lt-icon { width: 28px; height: 28px; color: rgba(255,255,255,0.9); }
        @media (max-width: 768px) {
            .profile-stats-grid { grid-template-columns: 1fr 1fr; }
            .profile-calendar-grid { gap: 2px; }
        }

        /* ── Focus Tag System ── */
        .focus-tag-label { display:flex;align-items:center;gap:6px;justify-content:center;margin-bottom:12px;cursor:pointer;font-size:13px;font-weight:600;color:rgba(255,255,255,0.6);padding:6px 14px;border-radius:20px;background:rgba(255,255,255,0.06);border:1px solid rgba(255,255,255,0.08);transition:all 0.2s;user-select:none; }
        .focus-tag-label:hover { background:rgba(255,255,255,0.1);color:rgba(255,255,255,0.9); }
        .focus-tag-label .tag-dot { width:8px;height:8px;border-radius:50%;flex-shrink:0; }
        .focus-dashboard.zen .focus-tag-label { display:none; }
        .focus-tag-picker { position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:280px;background:var(--study-bg,#1a1a2e);border:1px solid rgba(255,255,255,0.12);border-radius:16px;padding:0;z-index:50;box-shadow:0 20px 60px rgba(0,0,0,0.5);overflow:hidden;animation:tagPickerIn 0.2s ease; }
        @keyframes tagPickerIn { from { opacity:0;transform:translate(-50%,-50%) scale(0.95); } to { opacity:1;transform:translate(-50%,-50%) scale(1); } }
        .focus-tag-picker-header { display:flex;align-items:center;justify-content:space-between;padding:14px 16px 10px;border-bottom:1px solid rgba(255,255,255,0.08); }
        .focus-tag-picker-header span { font-size:14px;font-weight:700;color:#fff; }
        .focus-tag-picker-close { background:none;border:none;color:rgba(255,255,255,0.5);cursor:pointer;padding:4px; }
        .focus-tag-picker-close:hover { color:#fff; }
        .focus-tag-picker-list { max-height:220px;overflow-y:auto;padding:8px; }
        .focus-tag-picker-item { display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;cursor:pointer;transition:background 0.15s;font-size:13px;color:rgba(255,255,255,0.8); }
        .focus-tag-picker-item:hover { background:rgba(255,255,255,0.08); }
        .focus-tag-picker-item.active { background:rgba(255,255,255,0.1);color:#fff;font-weight:600; }
        .focus-tag-picker-item .tag-dot { width:10px;height:10px;border-radius:50%;flex-shrink:0; }
        .focus-tag-picker-item .tag-check { margin-left:auto;width:16px;height:16px;color:var(--study-accent,#52b788); }
        .focus-tag-picker-item .tag-delete { margin-left:auto;opacity:0;padding:4px;background:none;border:none;color:rgba(255,255,255,0.3);cursor:pointer;transition:opacity 0.15s; }
        .focus-tag-picker-item:hover .tag-delete { opacity:1; }
        .focus-tag-picker-item .tag-delete:hover { color:#ef4444; }
        .focus-tag-create-btn { display:flex;align-items:center;gap:8px;width:calc(100% - 16px);margin:4px 8px 8px;padding:10px 12px;border-radius:10px;background:rgba(255,255,255,0.05);border:1px dashed rgba(255,255,255,0.15);color:rgba(255,255,255,0.6);font-size:13px;font-weight:600;cursor:pointer;transition:all 0.15s;font-family:inherit; }
        .focus-tag-create-btn:hover { background:rgba(255,255,255,0.1);color:#fff; }
        .focus-tag-create-form { padding:12px;border-top:1px solid rgba(255,255,255,0.08); }
        .focus-tag-create-form input { width:100%;padding:10px 12px;background:rgba(255,255,255,0.06);border:1px solid rgba(255,255,255,0.12);border-radius:10px;color:#fff;font-size:13px;font-family:inherit;outline:none;box-sizing:border-box;margin-bottom:10px; }
        .focus-tag-create-form input:focus { border-color:rgba(255,255,255,0.25); }
        .focus-tag-create-form input::placeholder { color:rgba(255,255,255,0.3); }
        .focus-tag-colors { display:flex;gap:6px;margin-bottom:12px;justify-content:center; }
        .focus-tag-color-swatch { width:28px;height:28px;border-radius:50%;cursor:pointer;border:2px solid transparent;transition:all 0.15s; }
        .focus-tag-color-swatch:hover { transform:scale(1.15); }
        .focus-tag-color-swatch.selected { border-color:#fff;transform:scale(1.15); }
        .focus-tag-create-actions { display:flex;gap:8px; }
        .focus-tag-create-actions button { flex:1;padding:8px;border-radius:8px;font-size:12px;font-weight:600;cursor:pointer;font-family:inherit;border:none;transition:all 0.15s; }
        .focus-tag-create-actions .tag-save { background:var(--study-accent,#52b788);color:#fff; }
        .focus-tag-create-actions .tag-save:hover { filter:brightness(1.1); }
        .focus-tag-create-actions .tag-cancel { background:rgba(255,255,255,0.08);color:rgba(255,255,255,0.7); }
        .focus-tag-create-actions .tag-cancel:hover { background:rgba(255,255,255,0.12); }

        /* ── Focus Profile Donut ── */
        .profile-yearly-row { display:grid;grid-template-columns:1fr 1fr;gap:20px;align-items:start; }
        .profile-donut-wrap { display:flex;flex-direction:column;align-items:center;gap:12px; }
        .profile-donut-row { display:flex;align-items:center;gap:24px;width:100%; }
        .profile-donut-container { position:relative;width:160px;height:160px;flex-shrink:0; }
        .profile-donut-svg { width:160px;height:160px;transform:rotate(-90deg); }
        .profile-donut-center { position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center; }
        .profile-donut-center .donut-total { font-size:22px;font-weight:800;color:#fff; }
        .profile-donut-center .donut-label { font-size:11px;color:rgba(255,255,255,0.5);font-weight:600; }
        .profile-donut-legend { display:flex;flex-direction:column;gap:8px;flex:1;min-width:0; }
        .profile-donut-legend-item { display:flex;align-items:center;gap:8px;font-size:13px;color:rgba(255,255,255,0.8); }
        .profile-donut-legend-item .legend-dot { width:10px;height:10px;border-radius:50%;flex-shrink:0; }
        .profile-donut-legend-item .legend-hours { margin-left:auto;color:rgba(255,255,255,0.5);font-size:12px;white-space:nowrap; }
        .profile-donut-legend-item .legend-pct { font-weight:700;color:rgba(255,255,255,0.8);font-size:13px;min-width:36px;text-align:right; }
        @media (max-width: 768px) {
            .profile-yearly-row { grid-template-columns:1fr; }
            .profile-donut-row { flex-direction:column; }
        }

        /* ── Profile View Tabs ── */
        .profile-sidebar { position:absolute;left:12px;top:50%;transform:translateY(-50%);z-index:25;display:flex;flex-direction:column;gap:6px;padding:8px;border-radius:14px;background:rgba(20,20,20,0.5);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,0.06);align-items:center; }
        .profile-sidebar-back { width:36px;height:36px;border-radius:8px;border:none;background:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all 0.15s;color:rgba(255,255,255,0.5); }
        .profile-sidebar-back:hover { background:rgba(255,255,255,0.1);color:#fff; }
        .profile-sidebar-title { display:none; }
        .profile-sidebar-divider { width:20px;height:1px;background:rgba(255,255,255,0.1);margin:2px 0; }
        .profile-view-tab { width:36px;height:36px;border-radius:8px;border:none;background:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all 0.15s;color:rgba(255,255,255,0.5);padding:0; }
        .profile-view-tab span { display:none; }
        .profile-view-tab:hover { background:rgba(255,255,255,0.1);color:rgba(255,255,255,0.8); }
        .profile-view-tab.active { background:rgba(255,255,255,0.12);color:#fff; }
        .profile-view-tab i { width:18px;height:18px; }
        .profile-view-content { display:none; }
        .profile-view-content.active { display:flex;flex-direction:column;gap:16px;align-items:center; }

        /* ── Profile View 2: Analytics (Kairu) ── */
        .profile-analytics-stats { display:grid;grid-template-columns:1fr 1fr;gap:12px; }
        .profile-dot-grid-wrap { display:grid;grid-template-columns:repeat(6,1fr);gap:16px 12px; }
        .profile-dot-month { display:flex;flex-direction:column;align-items:center;gap:4px; }
        .profile-dot-month-label { font-size:11px;font-weight:700;color:rgba(255,255,255,0.5); }
        .profile-dot-month-hours { font-size:10px;color:rgba(255,255,255,0.35);margin-top:2px; }
        .profile-dot-cells { display:grid;grid-template-columns:repeat(7,12px);gap:4px;justify-content:center; }
        .profile-dot-cell { width:12px;height:12px;border-radius:50%; }
        @media (max-width: 768px) {
            .profile-dot-grid-wrap { grid-template-columns:repeat(3,1fr); }
            .profile-analytics-stats { grid-template-columns:1fr; }
        }

        /* ── Profile View 3: Activity (Heatmap) ── */
        .profile-banner { display:grid;grid-template-columns:repeat(4,1fr);gap:16px;width:100%; }
        .profile-banner-item { text-align:center; }
        .profile-banner-item .banner-label { font-size:11px;color:rgba(255,255,255,0.5);font-weight:600;text-transform:uppercase;margin-bottom:4px; }
        .profile-banner-item .banner-value { font-size:22px;font-weight:800;color:#fff; }
        .profile-banner-item .banner-value.accent { color:var(--study-accent,#52b788); }
        .profile-heatmap-outer { overflow-x:auto;width:100%;-webkit-overflow-scrolling:touch; }
        .profile-heatmap-grid { display:flex;gap:3px;width:100%; }
        .profile-heatmap-col { display:flex;flex-direction:column;gap:3px;flex:1;min-width:0; }
        .profile-heatmap-cell { width:100%;aspect-ratio:1;border-radius:4px;cursor:pointer;position:relative;min-height:0; }
        .profile-heatmap-cell:hover { outline:2px solid rgba(255,255,255,0.6);outline-offset:1px;z-index:5; }
        .profile-heatmap-day-labels { display:flex;flex-direction:column;gap:4px;margin-right:8px;flex-shrink:0; }
        .profile-heatmap-day-labels span { height:16px;font-size:10px;color:rgba(255,255,255,0.5);font-weight:600;display:flex;align-items:center; }
        .profile-heatmap-months { display:flex;gap:4px;margin-left:20px;margin-bottom:4px; }
        .profile-heatmap-months span { font-size:10px;color:rgba(255,255,255,0.5);font-weight:600; }
        .profile-heatmap-legend { display:flex;align-items:center;gap:5px;justify-content:flex-end;margin-top:10px;font-size:11px;color:rgba(255,255,255,0.4); }
        .profile-heatmap-legend-cell { width:16px;height:16px;border-radius:4px; }
        .profile-bottom-cards { display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px;width:100%; }
        .profile-bottom-cards .focus-card { padding: 16px !important; min-height: 0; }
        .profile-avg-bars { display:flex;align-items:flex-end;gap:10px;flex:1;min-height:100px;padding:0 8px; }
        .profile-avg-bar-wrap { flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:0; }
        .profile-avg-bar { width:100%;border-radius:4px 4px 0 0;transition:height 0.3s;cursor:pointer;position:relative; }
        .profile-avg-bar:hover::after { content:attr(data-tip);position:absolute;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%);white-space:nowrap;background:rgba(0,0,0,0.8);border-radius:6px;padding:3px 8px;font-size:10px;color:#fff;pointer-events:none; }
        .profile-avg-bar-label { font-size:10px;color:rgba(255,255,255,0.4);font-weight:600; }
        .profile-recent-list { display:flex;flex-direction:column;gap:0; }
        .profile-recent-item { display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px solid rgba(255,255,255,0.06);font-size:12px; }
        .profile-recent-item:last-child { border-bottom:none; }
        .profile-recent-item .recent-date { color:rgba(255,255,255,0.6); }
        .profile-recent-item .recent-info { color:var(--study-accent,#52b788);font-weight:600; }
        @media (max-width: 768px) {
            .profile-bottom-cards { grid-template-columns:1fr; }
            .profile-banner { grid-template-columns:1fr 1fr; }
        }

        /* Force theme color on elements outside .study-main */
        [data-theme="light"] .modal-overlay,
        [data-theme="light"] .toast { color: #111111; }
        /* Login card theme-aware */

        /* ── Login Gate (blurred popup) ── */
        .login-gate { display: none; align-items: center; justify-content: center; position: fixed; inset: 0; z-index: 700; background: rgba(0,0,0,0.55); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); padding: 20px; }
        .login-card { background: #111114; border: 2px solid rgba(232,133,58,0.3); border-top: 4px solid #e8853a; border-radius: 24px; padding: 52px 44px; max-width: 480px; width: 100%; box-shadow: 6px 6px 0 var(--study-accent-dim, rgba(232,133,58,0.15)), 0 24px 64px rgba(0,0,0,0.4); text-align: center; }
        .login-card-logo { font-size: 34px; font-weight: 900; margin-bottom: 8px; color: #fff; letter-spacing: -0.02em; }
        .login-card-logo span { color: #e8853a; }
        .login-card-sub { color: rgba(255,255,255,0.5); font-size: 15px; margin-bottom: 32px; }
        .login-card-sub a { color: #e8853a; text-decoration: underline; font-weight: 600; }
        .login-btn-google { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 16px; background: #fff; color: #1a1a1a; font-weight: 700; font-size: 16px; border: 2px solid rgba(255,255,255,0.1); border-radius: 14px; cursor: pointer; font-family: inherit; transition: all 0.15s; text-decoration: none; box-shadow: 3px 3px 0 rgba(0,0,0,0.3); }
        .login-btn-google:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(0,0,0,0.2); }
        .login-btn-google svg { width: 22px; height: 22px; }
        .login-divider { display: flex; align-items: center; gap: 14px; margin: 24px 0; color: rgba(255,255,255,0.3); font-size: 14px; font-weight: 500; }
        .login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.1); }
        .login-input-label { display: block; text-align: left; font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.6); margin-bottom: 8px; }
        .login-input { width: 100%; padding: 16px 18px; background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.1); border-radius: 14px; color: #fff; font-size: 16px; font-family: inherit; outline: none; transition: border-color 0.15s; box-sizing: border-box; }
        .login-input:focus { border-color: #e8853a; }
        .login-input::placeholder { color: rgba(255,255,255,0.25); }
        .login-btn-submit { width: 100%; padding: 16px; background: #e8853a; color: #fff; font-weight: 700; font-size: 16px; border: 2px solid rgba(232,133,58,0.3); border-radius: 14px; cursor: pointer; font-family: inherit; margin-top: 16px; transition: all 0.15s; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 3px 3px 0 rgba(232,133,58,0.25); }
        .login-btn-submit:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 rgba(232,133,58,0.2); }
        .login-btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
        .login-step { display: none; }
        .login-step.active { display: block; }
        .login-back { background: none; border: none; color: rgba(255,255,255,0.5); cursor: pointer; font-size: 14px; margin-bottom: 18px; display: flex; align-items: center; gap: 6px; font-weight: 500; }
        .login-back:hover { color: #e8853a; }
        .login-error { color: #ef4444; font-size: 14px; margin-top: 10px; display: none; font-weight: 500; }

        /* Light theme login card */
        [data-theme="light"] .login-gate { background: rgba(0,0,0,0.25); }
        [data-theme="light"] .login-card { background: #fff; border-color: rgba(232,133,58,0.25); box-shadow: 6px 6px 0 var(--study-accent-dim, rgba(232,133,58,0.12)), 0 24px 64px rgba(0,0,0,0.1); }
        [data-theme="light"] .login-card-logo { color: #1a2b3c; }
        [data-theme="light"] .login-card-sub { color: rgba(26,43,60,0.5); }
        [data-theme="light"] .login-card-sub a { color: #e8853a; }
        [data-theme="light"] .login-divider { color: rgba(26,43,60,0.3); }
        [data-theme="light"] .login-divider::before, [data-theme="light"] .login-divider::after { background: rgba(26,43,60,0.1); }
        [data-theme="light"] .login-input-label { color: rgba(26,43,60,0.6); }
        [data-theme="light"] .login-input { background: #f5f7fa; border-color: rgba(26,43,60,0.12); color: #1a2b3c; }
        [data-theme="light"] .login-input:focus { border-color: #e8853a; }
        [data-theme="light"] .login-input::placeholder { color: rgba(26,43,60,0.35); }
        [data-theme="light"] .login-btn-google { background: #fff; color: #1a2b3c; border-color: rgba(26,43,60,0.12); box-shadow: 3px 3px 0 rgba(26,43,60,0.08); }
        [data-theme="light"] .login-btn-google:hover { box-shadow: 5px 5px 0 rgba(26,43,60,0.06); }
        [data-theme="light"] .login-back { color: rgba(26,43,60,0.5); }
        [data-theme="light"] .login-back:hover { color: #e8853a; }

        /* Toast */
        .toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1f2937; color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 13px; font-weight: 500; opacity: 0; pointer-events: none; transition: all 0.3s; z-index: 300; max-width: 90%; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
        .toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
        .toast.toast-error { background: #dc2626; color: #fff; }
        .toast.toast-success { background: #16a34a; color: #fff; }
        .toast.toast-info { background: #2563eb; color: #fff; }
        [data-theme="light"] .toast { background: #374151; }

        /* ══ Onboarding v2 (split-panel GPTZero-style) ══ */
        .ob2-overlay { position:fixed;inset:0;z-index:500;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.4);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);overflow:hidden; }
        .ob2-panel { display:flex;width:90%;max-width:960px;height:85vh;max-height:640px;background:#fff;border-radius:24px;box-shadow:0 32px 80px rgba(0,0,0,0.2);overflow:hidden; }
        .ob2-sidebar { width:30%;min-width:260px;background:linear-gradient(160deg,#3d3d3d 0%,#5a4a3a 35%,#8a6b4a 65%,#c4703a 100%);display:flex;flex-direction:column;justify-content:flex-start;padding:48px 36px;position:relative;overflow:hidden;border-radius:24px 0 0 24px;transition:width 0.4s ease,min-width 0.4s ease,padding 0.4s ease,opacity 0.4s ease; }
        .ob2-sidebar::before { content:'';position:absolute;inset:0;background:radial-gradient(circle at 20% 80%,rgba(193,114,78,0.2) 0%,transparent 60%),radial-gradient(circle at 80% 20%,var(--study-accent-dim, rgba(232,133,58,0.12)) 0%,transparent 50%);pointer-events:none; }
        .ob2-sidebar-logo { display:none; }
        .ob2-sidebar-logo-icon { display:none; }
        .ob2-sidebar-logo-text { display:none; }
        .ob2-sidebar-heading { font-size:32px;font-weight:800;color:#fff;line-height:1.2;margin-bottom:16px;position:relative;z-index:1;transition:opacity 0.3s ease;margin-top:60px; }
        .ob2-sidebar-desc { font-size:16px;color:rgba(255,255,255,0.7);line-height:1.6;position:relative;z-index:1;transition:opacity 0.3s ease;max-width:280px; }
        .ob2-sidebar-quote { margin-top:auto;padding-top:40px;position:relative;z-index:1;display:none; }
        .ob2-sidebar-quote-text { font-size:14px;color:rgba(255,255,255,0.4);font-style:italic;line-height:1.5; }
        .ob2-sidebar-quote-author { font-size:12px;color:rgba(255,255,255,0.3);margin-top:8px; }
        .ob2-main { flex:1;display:flex;flex-direction:column;background:#fff;position:relative;min-height:0;overflow:hidden; }
        .ob2-content { flex:1 1 0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px 60px;overflow-y:auto;min-height:0; }
        .ob2-step { display:none;flex-direction:column;align-items:center;width:100%;max-width:640px;transition:opacity 0.4s ease,transform 0.4s ease; }
        .ob2-step.active { display:flex; }
        .ob2-step-title { font-size:26px;font-weight:700;color:#1a2b3c;margin-bottom:8px;text-align:center; }
        .ob2-step-desc { font-size:15px;color:rgba(26,43,60,0.5);margin-bottom:36px;text-align:center;line-height:1.5; }
        /* Role cards (Step 1) */
        .ob2-roles { display:flex;gap:20px;margin-bottom:28px;justify-content:center; }
        .ob2-role-card { width:150px;padding:20px 16px 16px;border:2px solid #e8ecf0;border-radius:16px;cursor:pointer;transition:all 0.2s;display:flex;flex-direction:column;align-items:center;gap:8px;background:#fff; }
        .ob2-role-card:hover { border-color:#bcc5cf;transform:translateY(-4px);box-shadow:0 8px 24px rgba(0,0,0,0.08); }
        .ob2-role-card.selected { border-color:#333;background:#fff;box-shadow:0 0 0 1px #333;transform:translateY(-2px); }
        .ob2-role-card-icon { width:80px;height:80px;border-radius:14px;background:#f5f7fa;display:flex;align-items:center;justify-content:center;font-size:32px;overflow:hidden; }
        .ob2-role-card-icon img { width:100%;height:100%;object-fit:cover;border-radius:10px; }
        .ob2-role-card-label { font-size:14px;font-weight:600;color:#1a2b3c; }
        /* Sub-options pills (Step 1) */
        .ob2-sub-options { display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-bottom:20px; }
        .ob2-sub-opt { padding:10px 20px;border:1.5px solid #dde1e6;border-radius:100px;cursor:pointer;font-size:14px;font-weight:500;color:#3a4a5c;background:transparent;transition:all 0.2s;font-family:inherit; }
        .ob2-sub-opt:hover { border-color:#8a9aac;background:rgba(0,0,0,0.02); }
        .ob2-sub-opt.selected { border-color:#333;background:rgba(0,0,0,0.04);color:#1a2b3c; }
        .ob2-sub-opt.hidden { display:none; }
        /* Google login button */
        .ob2-google-btn { display:flex;align-items:center;gap:10px;padding:12px 28px;border:1.5px solid #dde1e6;border-radius:12px;background:#fff;font-size:14px;font-weight:600;color:#3a4a5c;cursor:pointer;transition:all 0.2s;font-family:inherit; }
        .ob2-google-btn:hover { border-color:#8a9aac;background:#f8fafb;transform:translateY(-1px);box-shadow:0 4px 12px rgba(0,0,0,0.06); }
        .ob2-google-btn-lg { padding:14px 0;font-size:15px;border-radius:12px;gap:10px;width:100%;justify-content:center; }
        /* Sign-in card */
        .ob2-signin-card { display:flex;flex-direction:column;align-items:center;width:100%;max-width:380px;padding:40px 36px;background:#fff;border:1.5px solid #e8ecf0;border-radius:20px;box-shadow:0 12px 40px rgba(0,0,0,0.06); }
        .ob2-signin-header { text-align:center;width:100%; }
        /* iMessage button card */
        .ob2-imsg-btn-card { display:flex;align-items:center;justify-content:space-between;width:100%;padding:14px 18px;background:#f8fafb;border:1.5px solid #e8ecf0;border-radius:14px;cursor:pointer;transition:all 0.2s;font-family:inherit;text-align:left; }
        .ob2-imsg-btn-card:hover { border-color:#bcc5cf;background:#f0f4f7;transform:translateY(-1px); }
        .ob2-imsg-btn-left { display:flex;align-items:center;gap:12px; }
        /* Continue button */
        .ob2-btn { display:flex;align-items:center;gap:8px;padding:14px 32px;background:#2a2a3a;color:#fff;border:none;border-radius:12px;font-size:15px;font-weight:600;cursor:pointer;transition:all 0.2s;font-family:inherit;margin-left:auto; }
        .ob2-btn:hover { background:#3a3a4a;transform:translateY(-1px); }
        .ob2-btn.disabled { opacity:0.3;pointer-events:none; }
        .ob2-btn i { width:16px;height:16px; }
        .ob2-skip { background:none;border:none;color:rgba(26,43,60,0.4);font-size:13px;font-weight:500;cursor:pointer;font-family:inherit;padding:8px 16px; }
        .ob2-skip:hover { color:#1a2b3c; }
        /* Bottom bar */
        .ob2-bottom { display:flex;align-items:center;padding:20px 40px;border-top:1px solid #eef1f4;gap:16px;flex-shrink:0; }
        .ob2-bottom-left { font-size:13px;color:rgba(26,43,60,0.35);font-weight:500;white-space:nowrap; }
        .ob2-dots { display:flex;gap:6px;align-items:center; }
        .ob2-dot { width:8px;height:8px;border-radius:50%;background:#d4d9e0;transition:all 0.3s; }
        .ob2-dot.active { background:#6b7b8d; }
        .ob2-dot.done { background:#6b7b8d; }
        .ob2-bottom-right { display:flex;gap:12px;align-items:center;margin-left:auto; }
        /* Classes input (Step 2) */
        .ob2-classes-input { width:100%;max-width:500px;padding:16px 20px;background:#f8fafb;border:1.5px solid #dde1e6;border-radius:14px;color:#1a2b3c;font-size:16px;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color 0.2s; }
        .ob2-classes-input:focus { border-color:#8a9aac; }
        .ob2-classes-input::placeholder { color:rgba(26,43,60,0.35); }
        .ob2-chips { display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:16px; }
        .ob2-chip { padding:8px 16px;border:1px solid #dde1e6;border-radius:100px;font-size:13px;color:#5a6a7c;cursor:pointer;transition:all 0.2s;font-family:inherit;background:transparent; }
        .ob2-chip:hover { border-color:#8a9aac;color:#1a2b3c; }
        /* Feature cards (Step 3 & 5) */
        .ob2-features { display:grid;grid-template-columns:1fr 1fr;gap:16px;width:100%;max-width:540px; }
        .ob2-feature-card { padding:24px;border:1.5px solid #e8ecf0;border-radius:16px;text-align:left;background:#f8fafb;transition:all 0.2s; }
        .ob2-feature-card:hover { border-color:#bcc5cf;transform:translateY(-1px); }
        .ob2-feature-card-icon { width:40px;height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center;margin-bottom:12px; }
        .ob2-feature-card-icon i { width:20px;height:20px; }
        .ob2-feature-card-title { font-size:14px;font-weight:700;color:#1a2b3c;margin-bottom:4px; }
        .ob2-feature-card-desc { font-size:12px;color:rgba(26,43,60,0.55);line-height:1.5; }
        /* Phone connect (Step 4) */
        .ob2-phone-card { background:#f8fafb;border:1.5px solid #dde1e6;border-radius:16px;padding:32px;text-align:center;width:100%;max-width:380px; }
        .ob2-phone-code { font-size:48px;font-weight:800;letter-spacing:12px;color:#e8853a;margin:16px 0;font-variant-numeric:tabular-nums; }
        .ob2-phone-number { font-size:17px;font-weight:600;color:#1a2b3c;margin-bottom:4px; }
        .ob2-phone-waiting { display:flex;align-items:center;justify-content:center;gap:8px;color:rgba(26,43,60,0.5);font-size:13px;margin-top:14px; }
        .ob2-phone-waiting .spinner { width:14px;height:14px;border:2px solid rgba(0,0,0,0.1);border-top-color:#e8853a;border-radius:50%;animation:spin 0.8s linear infinite; }
        .ob2-phone-divider { display:flex;align-items:center;gap:12px;margin:24px 0 16px;width:100%;max-width:380px;color:rgba(26,43,60,0.35);font-size:13px; }
        .ob2-phone-divider::before,.ob2-phone-divider::after { content:'';flex:1;height:1px;background:#dde1e6; }
        .ob2-phone-connected { color:#22c55e;font-weight:600;font-size:16px;display:flex;align-items:center;gap:8px;justify-content:center;margin-top:12px; }
        /* Completion (Step 5) */
        .ob2-check { width:72px;height:72px;border-radius:50%;background:linear-gradient(135deg,#22c55e,#16a34a);display:flex;align-items:center;justify-content:center;margin-bottom:24px; }
        .ob2-check i { width:36px;height:36px;color:#fff;stroke-width:3; }
        /* Browser mockup */
        .ob2-mockup-wrapper { position:relative;width:100%;max-width:620px;margin:0 auto;padding:40px 20px; }
        .ob2-mockup { background:#fff;border-radius:12px;border:1.5px solid #dde1e6;overflow:hidden;box-shadow:0 20px 60px rgba(0,0,0,0.08),0 0 0 1px rgba(0,0,0,0.04); }
        .ob2-mockup-bar { display:flex;align-items:center;gap:6px;padding:10px 14px;background:#f5f7fa;border-bottom:1px solid #eef1f4; }
        .ob2-mockup-dot { width:10px;height:10px;border-radius:50%; }
        .ob2-mockup-url { flex:1;margin-left:14px;padding:5px 14px;background:#eef1f4;border-radius:6px;font-size:11px;color:#8a9aac;display:flex;align-items:center;gap:6px; }
        .ob2-mockup-url i { width:10px;height:10px;opacity:0.5; }
        .ob2-mockup-body { padding:16px;min-height:240px;display:flex;gap:12px; }
        /* Mini sidebar inside mockup */
        .ob2-mock-sidebar { width:120px;flex-shrink:0;display:flex;flex-direction:column;gap:6px;padding:8px;background:#f8fafb;border-radius:8px; }
        .ob2-mock-nav { padding:8px 10px;border-radius:6px;font-size:10px;color:#8a9aac;display:flex;align-items:center;gap:6px; }
        .ob2-mock-nav.active { background:rgba(232,133,58,0.1);color:#e8853a; }
        .ob2-mock-nav i { width:12px;height:12px; }
        /* Mini content inside mockup */
        .ob2-mock-content { flex:1;display:flex;flex-direction:column;gap:8px; }
        .ob2-mock-header { font-size:14px;font-weight:700;color:#1a2b3c;margin-bottom:4px; }
        .ob2-mock-row { display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:8px;border:1px solid #eef1f4;background:#fff; }
        .ob2-mock-row-accent { width:3px;height:28px;border-radius:2px;flex-shrink:0; }
        .ob2-mock-row-text { flex:1; }
        .ob2-mock-row-title { font-size:10px;font-weight:600;color:#1a2b3c;line-height:1.3; }
        .ob2-mock-row-sub { font-size:8px;color:#8a9aac;margin-top:2px; }
        .ob2-mock-pills { display:flex;gap:4px;margin-left:auto; }
        .ob2-mock-pill { padding:2px 6px;border-radius:4px;font-size:7px;font-weight:600; }
        /* Floating feature labels */
        .ob2-float-label { position:absolute;display:flex;align-items:center;gap:10px;padding:10px 18px;background:#fff;border:1.5px solid #e8ecf0;border-radius:14px;box-shadow:0 8px 24px rgba(0,0,0,0.06);white-space:nowrap;z-index:2;transition:transform 0.3s ease,box-shadow 0.3s ease;animation:ob2FloatIn 0.6s ease both; }
        .ob2-float-label:hover { transform:translateY(-3px);box-shadow:0 12px 32px rgba(0,0,0,0.1); }
        .ob2-float-label:nth-child(2) { animation-delay:0.1s; }
        .ob2-float-label:nth-child(3) { animation-delay:0.2s; }
        .ob2-float-label:nth-child(4) { animation-delay:0.3s; }
        .ob2-float-label:nth-child(5) { animation-delay:0.4s; }
        .ob2-float-label:nth-child(6) { animation-delay:0.5s; }
        .ob2-float-label-icon { width:34px;height:34px;border-radius:9px;display:flex;align-items:center;justify-content:center;flex-shrink:0; }
        .ob2-float-label-icon i { width:17px;height:17px; }
        .ob2-float-label-text { font-size:13px;font-weight:600;color:#1a2b3c; }
        @keyframes ob2FloatIn { from { opacity:0;transform:translateY(12px); } to { opacity:1;transform:translateY(0); } }
        /* Mobile */
        @media (max-width:768px) {
            .ob2-panel { flex-direction:column;width:95%;height:90vh;max-height:none;border-radius:20px; }
            .ob2-sidebar { width:100%;min-width:unset;padding:28px 24px 20px;flex:0;border-radius:20px 20px 0 0; }
            .ob2-sidebar-heading { font-size:24px; }
            .ob2-sidebar-desc { font-size:14px; }
            .ob2-sidebar-quote { display:none; }
            .ob2-sidebar-logo { margin-bottom:20px; }
            .ob2-content { padding:24px 20px; }
            .ob2-roles { flex-wrap:wrap; }
            .ob2-role-card { width:120px; }
            .ob2-features { grid-template-columns:1fr; }
            .ob2-bottom { padding:16px 20px; }
            .ob2-mockup-wrapper { padding:20px 0; }
            .ob2-float-label { padding:8px 12px;font-size:11px; }
            .ob2-float-label-icon { width:28px;height:28px; }
            .ob2-float-label-icon i { width:14px;height:14px; }
            .ob2-mock-sidebar { display:none; }
            .ob2-mockup-body { min-height:180px; }
        }

        /* Custom notes textarea in wizard step 2 */
        .wiz-custom-notes { width: 100%; padding: 10px 14px; background: var(--study-bg); border: 1px solid var(--study-border); border-radius: 10px; color: var(--study-text); font-family: inherit; font-size: 13px; resize: vertical; min-height: 60px; outline: none; transition: border-color 0.2s; margin-top: 4px; }
        .wiz-custom-notes:focus { border-color: var(--study-accent); }
        .wiz-custom-notes::placeholder { color: var(--study-text-tertiary); }
        .wiz-custom-label { font-size: 12px; color: var(--study-text-secondary); margin-top: 12px; }

        /* Background gen banner */
        .gen-banner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--study-accent-dim); border: 1px solid rgba(232,133,58,0.2); border-radius: 10px; margin-bottom: 16px; font-size: 13px; color: var(--study-accent); }
        .gen-banner .spinner { width: 16px; height: 16px; border: 2px solid rgba(232,133,58,0.3); border-top-color: var(--study-accent); border-radius: 50%; animation: spin 0.6s linear infinite; flex-shrink: 0; }
        .gen-banner-text { flex: 1; }
        .gen-banner-done { color: var(--study-green); }

        /* ── Light Mode ── */
        [data-theme="light"] {
            --study-bg: #f3f4f6; --study-bg-secondary: #ffffff; --study-bg-tertiary: rgba(15,23,42,0.04);
            --study-bg-card: #ffffff;
            --study-text: #111827; --study-text-secondary: #4b5563; --study-text-tertiary: #9ca3af;
            --study-accent: #738396; --study-accent-hover: #5f6f83; --study-accent-dim: rgba(115,131,150,0.14);
            --study-border: rgba(15,23,42,0.12); --study-border-light: rgba(15,23,42,0.2);
        }
        [data-theme="light"] .study-sidebar { --sidebar-bg: var(--bg-raised, #f5f5f4); background: var(--sidebar-bg) !important; }
        [data-theme="light"] .khio-sidebar { background: var(--bg-raised, #f5f5f4) !important; border-right: 1px solid var(--border-subtle) !important; }
        [data-theme="light"] .sidebar-logo { border-bottom-color: rgba(0,0,0,0.08); }
        [data-theme="light"] .logo-sub { color: rgba(0,0,0,0.45); }
        [data-theme="light"] .logo-title { color: #111; }
        [data-theme="light"] .nav-item { color: #444; }
        [data-theme="light"] .nav-item:hover { background: rgba(0,0,0,0.04); color: #111; }
        [data-theme="light"] .nav-item.active { background: rgba(115,131,150,0.12); border-color: rgba(115,131,150,0.28); color: #1f2937; }
        [data-theme="light"] .nav-separator { background: rgba(0,0,0,0.06); }
        [data-theme="light"] .sidebar-footer { border-top-color: rgba(0,0,0,0.08); }
        [data-theme="light"] .khio-hamburger { background: rgba(255,255,255,0.85); border-color: rgba(0,0,0,0.1); color: #333; }
        [data-theme="light"] .khio-overlay-panel { background: rgba(255,255,255,0.95); border-left-color: rgba(0,0,0,0.08); }
        [data-theme="light"] .khio-overlay-link { color: #555; }
        [data-theme="light"] .khio-overlay-link:hover { background: rgba(0,0,0,0.04); color: #111; }
        [data-theme="light"] .khio-overlay-link.active { background: rgba(115,131,150,0.14); color: #334155; }
        [data-theme="light"] .msg-row.user .msg-bubble { color: #111; }
        [data-theme="light"] .msg-row.ai .msg-bubble { border-color: rgba(0,0,0,0.08); }
        [data-theme="light"] .msg-bubble pre { background: #f6f8fa !important; border-color: rgba(0,0,0,0.1); }
        [data-theme="light"] .msg-bubble code { background: rgba(0,0,0,0.06); }
        [data-theme="light"] .study-sidebar { background: var(--bg-raised, #f5f5f4) !important; border-right: none; }
        [data-theme="light"] .nav-link { color: var(--text-tertiary); }
        [data-theme="light"] .nav-link:hover { background: var(--bg-elevated); color: var(--text-primary); }
        [data-theme="light"] .nav-link.active { background: #eef2f7; color: #111827; }
        [data-theme="light"] .method-nav { color: #6b7280; }
        [data-theme="light"] .method-nav:hover { background: #f3f4f6; color: #111827; }
        [data-theme="light"] .method-nav.active { background: #eef2f7; color: #111827; }
        [data-theme="light"] .detail-right { background: #ffffff; border-color: #e5e7eb; }
        [data-theme="light"] .right-tabs { background: #ffffff; border-bottom-color: #e5e7eb; }
        [data-theme="light"] .right-tab { color: #9ca3af; }
        [data-theme="light"] .right-tab.active { color: #111827; border-bottom-color: #111827; }
        [data-theme="light"] .right-chat-head { border-bottom-color: #f1f5f9; }
        [data-theme="light"] .right-chat-head-btn {
            background: #ffffff;
            border-color: #e5e7eb;
            color: #6b7280;
        }
        [data-theme="light"] .right-chat-head-btn:hover {
            color: #111827;
            background: #f9fafb;
        }
        [data-theme="light"] .right-chat-empty-title { color: #111827; }
        [data-theme="light"] .right-chat-empty-sub { color: #6b7280; }
        [data-theme="light"] .right-chat-input {
            background: #f3f4f6;
            border-color: #e5e7eb;
        }
        [data-theme="light"] .right-chat-input textarea { color: #1f2937; }
        [data-theme="light"] .right-chat-input textarea::placeholder { color: #6b7280; }
        [data-theme="light"] .right-chat-attach { border-color: transparent; color: #6b7280; }
        [data-theme="light"] .right-chat-send {
            background: #ffffff;
            color: #374151;
            border: 1px solid #d1d5db;
        }
        [data-theme="light"] .right-chat-send:hover { filter: none; background: #f9fafb; }
        [data-theme="light"] .detail-add-method-btn {
            background: #ffffff !important;
            border-color: #e2e8f0 !important;
            color: #475569 !important;
        }
        [data-theme="light"] .detail-add-method-btn:hover {
            background: #f8fafc !important;
            color: #1f2937 !important;
        }
        [data-theme="light"] .btn-create {
            background: #e7ebf0 !important;
            border: 1px solid #cbd5e1 !important;
            color: #334155 !important;
            box-shadow: 0 1px 2px rgba(100,116,139,.2) !important;
        }
        [data-theme="light"] .btn-create:hover {
            background: #f1f5f9 !important;
            box-shadow: 0 2px 6px rgba(100,116,139,.22) !important;
            transform: translateY(-1px);
        }
        [data-theme="light"] .detail-main-inner.mode-reading #quillEditorShell {
            border-color: #e5e7eb;
            background: #ffffff;
        }
        /* light toolbar/container overrides removed — uses CSS variables now */
        /* Removed [data-theme="light"] overrides — now uses CSS variables */

        /* ── Mobile back button (hidden on desktop) ── */
        .btn-mobile-back {
            display: none; align-items: center; gap: 3px;
            background: none; border: none; color: var(--study-text-secondary); cursor: pointer;
            font-size: 13px; font-weight: 700; font-family: inherit; padding: 4px 6px;
            border-radius: 6px; transition: color .15s; flex-shrink: 0;
        }
        .btn-mobile-back:hover { color: var(--study-text); }
        .btn-mobile-back i { width: 16px; height: 16px; }

        /* ── Mobile Method Nav (hidden on desktop) ── */
        .mobile-method-nav {
            display: none; overflow-x: auto; white-space: nowrap;
            border-bottom: 1px solid var(--study-border); background: var(--study-bg);
            padding: 0 8px; flex-shrink: 0; scrollbar-width: none; -ms-overflow-style: none;
        }
        .mobile-method-nav::-webkit-scrollbar { display: none; }
        .mobile-method-tab {
            display: inline-flex; align-items: center; gap: 5px; padding: 10px 14px;
            font-size: 12px; font-weight: 700; color: var(--study-text-tertiary); cursor: pointer;
            border-bottom: 2px solid transparent; background: none;
            border-left: none; border-right: none; border-top: none;
            font-family: inherit; white-space: nowrap; transition: all .15s;
            text-transform: uppercase; letter-spacing: .04em;
        }
        .mobile-method-tab.active { color: var(--study-accent); border-bottom-color: var(--study-accent); }
        .mobile-method-tab i { width: 13px; height: 13px; }

        /* ── Laptop (small screens / low height) ── */
        @media (max-height: 820px) {
            .hero-section { padding: 32px 32px 24px; }
            .hero-title { font-size: 28px !important; }
            .hero-sub { font-size: 11px !important; }
            .hero-head { margin-bottom: 18px; }
            .action-card { padding: 18px 20px; }
            .action-card i { margin-bottom: 10px; width: 22px; height: 22px; }
            .action-label { font-size: 13px !important; }
            .action-sub { font-size: 11px !important; }
            .sets-section { padding: 0 32px 20px; }
            .set-card { padding: 14px 16px; }
            .sb-widget { padding: 10px; }
            .sb-widget-title { font-size: 8px; margin-bottom: 6px; }
            .sidebar-brand { padding: 14px 16px 6px; }
            .sidebar-widgets { gap: 8px; }
        }
        @media (max-width: 1400px) {
            .hero-section { padding-left: 32px; padding-right: 32px; }
            .sets-section { padding-left: 32px; padding-right: 32px; }
            .action-cards { gap: 12px; }
        }

        /* ── Tablet / Split-Screen (601–1023px) — auto-collapse sidebar, keep desktop layout ── */
        @media (max-width: 1023px) {
            .detail-right { display: none; }
            .sidebar-resize-handle { display: none; }
            .right-sidebar-reopen { display: none !important; }
            /* Auto-collapse the study sidebar to icon-only mode */
            .study-sidebar { width: var(--sidebar-w-collapsed, 72px); }
            .study-sidebar .sidebar-brand-text-wrap,
            .study-sidebar .sidebar-brand-text,
            .study-sidebar .sidebar-brand-sub,
            .study-sidebar .nav-link-label,
            .study-sidebar .method-nav-label,
            .study-sidebar .method-nav-group-label,
            .study-sidebar .sidebar-username,
            .study-sidebar .token-badge,
            .study-sidebar .sidebar-footer .user-name,
            .study-sidebar .sidebar-footer-row { display: none !important; }
            .study-sidebar .sidebar-brand-wrap { flex-direction: column; justify-content: center; align-items: center; padding: 10px 8px 8px; min-height: 78px; }
            .study-sidebar .sidebar-collapse-btn { display: none !important; }
            .study-sidebar .sidebar-nav { padding: 8px 10px; }
            .study-sidebar .nav-link,
            .study-sidebar .method-nav { justify-content: center; padding: 10px 8px; gap: 0; }
            .study-sidebar .method-nav-group-label { margin: 0; padding: 0; }
            .study-sidebar .sidebar-widgets { display: none; }
            .study-sidebar .sidebar-footer { align-items: center; padding: 10px 8px; }
            .study-sidebar .sidebar-user { justify-content: center; width: 100%; padding: 6px; }
            .study-sidebar .sidebar-avatar { margin: 0; }
            /* Compact action cards to 2-col */
            .action-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
            .action-card { padding: 16px 12px; }
            .action-label { font-size: 13px; }
            .action-desc { font-size: 11px; }
            .hero-title { font-size: 28px; }
            /* Compact sets grid */
            .hero-section { padding: 28px 20px 20px; }
            .sets-section { padding-left: 20px; padding-right: 20px; }
        }

        /* ── Mobile — full mobile layout with bottom nav ── */
        /* Only triggers on actual touch devices (pointer:coarse), OR very narrow screens (≤480px) as fallback */
        @media (max-width: 768px) and (pointer: coarse) , (max-width: 480px) {
            .study-sidebar { display: none; }
            .study-layout { display: block; }
            .study-main { height: 100dvh; padding-bottom: 64px; }
            .mobile-nav { display: flex !important; }
            .study-view { padding-bottom: 20px; }
            .mc-grid { grid-template-columns: 1fr; }
            .grade-cards { grid-template-columns: 1fr; }
            .sets-grid.grid-view { grid-template-columns: 1fr; }
            .methods-grid { grid-template-columns: 1fr; }
            .hero-title { font-size: 24px; }
            .hero-section { padding: 28px 16px 20px; }
            .action-cards { grid-template-columns: 1fr; gap: 12px; }
            .action-card { max-width: 100%; }
            .set-card-badges { display: none; }
            .set-card-methods { display: none; }
            .grade-result-layout { flex-direction: column; }
            .grade-result-left { width: 100%; }
            .grade-score-card { padding: 20px; }
            .grade-score-num { font-size: 42px; }
            .grade-rubric-row { flex-direction: column; }
            /* Show mobile-only elements in detail view */
            .btn-mobile-back { display: flex !important; }
            .mobile-method-nav.detail-active { display: flex !important; }
            /* Hide desktop-only detail controls */
            #btnToggleRight { display: none !important; }
            .detail-meta-desktop { display: none !important; }
            /* Truncate long set titles */
            .detail-topbar-title { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
            /* KhioAI — hide sidebar + topbar on mobile */
            .khioai-chats-sidebar { display: none !important; }
            .khioai-topbar { display: none !important; }
            /* Tighter detail main padding */
            .detail-main-inner { padding: 16px 12px; }
            .detail-main-inner.mode-reading { padding: 8px 8px 14px; }
            .detail-main-inner.mode-reading #quillEditorShell {
                height: calc(100dvh - 170px);
                min-height: calc(100dvh - 170px);
                border-radius: 10px;
            }
        }
        @media (max-width: 640px) {
            .solve-heading, .grade-heading { font-size: 22px; }
        }
        .mobile-nav {
            display: none; position: fixed; bottom: 0; left: 0; right: 0;
            z-index: 9999; pointer-events: none;
        }
        .mobile-nav-inner {
            display: flex; align-items: center; gap: 0; width: 100%;
            padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
            border-radius: 0;
            background: rgba(8,6,20,.55);
            backdrop-filter: blur(50px) saturate(200%);
            -webkit-backdrop-filter: blur(50px) saturate(200%);
            border: none; border-top: 1px solid rgba(255,255,255,.06);
            pointer-events: all;
        }
        [data-theme="light"] .mobile-nav-inner {
            background: rgba(255,255,255,.92);
            border-top-color: rgba(15,23,42,.12);
            box-shadow: 0 -1px 12px rgba(15,23,42,.08);
        }
        .mobile-nav-btn {
            flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
            padding: 10px 8px 8px; border-radius: 12px; border: none; background: none;
            color: rgba(255,255,255,.45); font-size: .625rem; font-weight: 600;
            letter-spacing: .02em; cursor: pointer; transition: all .2s; font-family: inherit;
        }
        .mobile-nav-btn i { width: 20px; height: 20px; }
        .mobile-nav-btn.active { color: #E8853A; background: rgba(232,133,58,.08); box-shadow: 0 1px 3px rgba(232,133,58,.1); }
        [data-theme="light"] .mobile-nav-btn { color: rgba(80,65,50,.45); }
        [data-theme="light"] .mobile-nav-btn.active { color: #111827; background: rgba(15,23,42,.07); box-shadow: 0 2px 8px rgba(15,23,42,.1), inset 0 1px 0 rgba(255,255,255,.7); }

        /* ══════ EDITORIAL REDESIGN — CookQuest Style ══════ */

        /* Override base vars for editorial feel */
        :root {
            --study-radius: 12px;
            --study-border: rgba(255,255,255,0.15);
            --study-border-light: rgba(255,255,255,0.3);
        }
        [data-theme="light"] {
            --study-border: rgba(15,23,42,0.12);
            --study-border-light: rgba(15,23,42,0.2);
        }

        /* ── Sidebar — editorial refinement ── */
        .study-sidebar {
            background: #0a0a0a; border-right: none;
        }
        .sidebar-brand-text { font-weight: 900; text-transform: none; letter-spacing: normal; font-size: 17px; }
        .nav-link {
            border-radius: var(--study-radius); font-weight: 700; font-size: 13px;
            text-transform: uppercase; letter-spacing: .03em;
        }
        .nav-link.active {
            background: var(--study-accent-dim); border-left: 3px solid var(--study-accent);
        }
        .method-nav {
            border-radius: var(--study-radius); font-weight: 700; font-size: 12px;
            text-transform: uppercase; letter-spacing: .03em;
        }
        .method-nav.active {
            background: var(--study-accent-dim); border-left: 3px solid var(--study-accent);
        }

        /* ── Hero — editorial typography ── */
        .hero-title {
            font-weight: 900; text-transform: none; letter-spacing: -.02em;
            font-size: 64px; line-height: 1.05;
        }
        .hero-sub {
            font-weight: 500; text-transform: none; letter-spacing: normal; font-size: 22px;
        }

        /* ── Action Cards — clean card style ── */
        .action-card {
            border: 1px solid var(--study-border); border-radius: var(--card-radius, 1.5rem);
            box-shadow: var(--shadow-card, 0 1px 3px rgba(0,0,0,0.06));
            transition: all .2s ease;
        }
        .action-card:hover {
            transform: translateY(-2px); box-shadow: var(--shadow-card-hover, 0 8px 24px rgba(0,0,0,0.08));
            border-color: var(--study-accent);
        }
        .action-label {
            font-weight: 700; letter-spacing: .01em; font-size: 14px;
        }
        .action-sub {
            font-weight: 500; letter-spacing: .01em;
        }

        /* ── Sets Header — editorial accent bar ── */
        .sets-title-accent { width: 4px; height: 22px; border-radius: 0; }
        .sets-header h2 {
            font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; color: var(--study-text-tertiary);
        }
        .view-toggle-group {
            border-radius: var(--study-radius); border: 2px solid var(--study-border); background: transparent;
        }
        .view-toggle {
            border-radius: 2px;
        }
        .view-toggle.active {
            background: var(--study-accent); color: #000;
        }

        /* ── Set Cards — editorial card redesign ── */
        .set-card {
            border: 1px solid var(--study-border); border-radius: var(--card-radius, 1.5rem);
            box-shadow: var(--shadow-card, 0 1px 3px rgba(0,0,0,0.06));
            transition: all .2s ease;
        }
        .set-card:hover {
            transform: translateY(-2px); box-shadow: var(--shadow-card-hover, 0 8px 24px rgba(0,0,0,0.08));
            border-color: var(--study-accent);
        }
        .set-card-title {
            font-weight: 700; letter-spacing: .01em; font-size: 14px;
        }
        .mastery-bar { border-radius: 4px; height: 5px; }
        .mastery-bar .seg { border-radius: 4px; }
        .mastery-badge {
            border-radius: 2px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
            border: 1.5px solid currentColor; font-size: 10px;
        }
        .set-card-more {
            border: 2px solid var(--study-border); border-radius: var(--study-radius);
        }
        .set-card-dropdown {
            border: 2.5px solid var(--study-border); border-radius: var(--study-radius);
            box-shadow: 4px 4px 0 rgba(0,0,0,.3);
        }
        .set-card-dropdown button {
            font-weight: 700; text-transform: uppercase; letter-spacing: .03em; font-size: 12px;
        }

        /* ── Grid View Cards ── */
        .sets-grid.grid-view .set-card {
            border-left: 2.5px solid var(--study-border); border-top: 5px solid var(--study-accent);
            box-shadow: 4px 4px 0 var(--study-accent-dim, rgba(0,0,0,0.3));
            transition: all 0.15s;
        }
        .sets-grid.grid-view .set-card:hover { border-color: var(--study-accent); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 rgba(232,133,58,0.25); }

        /* Hide icons inside action buttons for clean text-only look */
        .btn-create i, .btn-create svg,
        .btn-accent i, .btn-accent svg,
        .grade-analyze-btn i, .grade-analyze-btn svg { display: none !important; }

        /* ── Create Button — gradient style ── */
        .btn-create {
            border-radius: 10px; font-weight: 700;
            text-transform: uppercase; letter-spacing: .04em; font-size: 12px;
            border: none;
        }

        /* ── Modal — editorial style ── */
        .modal {
            border: none; border-radius: 6px;
            box-shadow: 8px 8px 0 rgba(0,0,0,.3);
        }
        .modal-header h3 {
            font-weight: 900; text-transform: uppercase; letter-spacing: .03em;
        }

        /* ── Method Cards — editorial style ── */
        .method-card {
            border: 2.5px solid var(--study-border); border-radius: var(--study-radius);
            box-shadow: 3px 3px 0 var(--study-accent-dim);
        }
        .method-card:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--study-accent-dim); }
        .method-card.selected {
            border-color: var(--study-accent); box-shadow: 4px 4px 0 rgba(232,133,58,.3);
        }
        .method-card-label { font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }

        /* ── Wizard Button ── */
        .btn-wizard {
            border-radius: 12px; font-weight: 700;
            text-transform: uppercase; letter-spacing: .04em;
            border: none;
        }

        /* ── Dropzone — editorial ── */
        .dropzone {
            border: 2.5px dashed var(--study-border); border-radius: var(--study-radius);
        }
        .dropzone:hover, .dropzone.dragover {
            border-color: var(--study-accent);
        }
        .dropzone-title { font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }

        /* ── Flashcard — editorial ── */
        .fc-card { border-radius: 6px; }
        .fc-face {
            border-radius: 6px; border: 2.5px solid var(--study-border);
            box-shadow: 6px 6px 0 var(--study-accent-dim);
        }
        .fc-back { border-color: rgba(232,133,58,.35); }
        .fc-label { font-weight: 800; letter-spacing: .08em; }
        .fc-text { font-weight: 600; }
        .fc-btn {
            border-radius: var(--study-radius); font-weight: 800;
            letter-spacing: .04em;
            border: 2px solid currentColor;
        }

        /* ── Multiple Choice — editorial ── */
        .mc-option {
            border-radius: var(--study-radius) !important; font-weight: 700 !important;
            border-width: 2px !important;
            transition: all .2s;
        }

        /* ── Written Test — editorial ── */
        .wt-textarea {
            border-radius: var(--study-radius) !important;
            border: 2.5px solid var(--study-border) !important;
        }
        .wt-textarea:focus { border-color: var(--study-accent) !important; }

        /* ── Fill in Blanks ── */
        .fib-input {
            border-radius: var(--study-radius) !important;
            border-width: 2.5px !important;
            font-weight: 700 !important;
        }

        /* ── Mastery Pills — editorial badges ── */
        .mastery-pill {
            border-radius: 2px; font-weight: 800; text-transform: uppercase;
            letter-spacing: .04em; border-width: 1.5px; font-size: 11px;
        }

        /* ── Card Nav buttons ── */
        .card-nav button {
            border-radius: var(--study-radius); border-width: 2px;
        }
        .card-nav-counter { font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }

        /* ── Detail Topbar — editorial ── */
        .detail-topbar {
            border-bottom: 1px solid var(--study-border);
        }
        .detail-topbar-title { font-weight: 900; text-transform: uppercase; letter-spacing: .03em; }
        .detail-topbar-right button {
            font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
        }

        /* ── Right Sidebar — editorial ── */
        .right-sidebar {
            border-left: 2.5px solid var(--study-border) !important;
        }
        .right-tab { font-weight: 800 !important; text-transform: uppercase !important; letter-spacing: .04em !important; font-size: 11px !important; }
        .right-tab.active {
            border-bottom: 3px solid var(--study-accent) !important;
        }

        /* ── Token Badge — editorial ── */
        .token-badge {
            border-radius: 2px; font-weight: 800; text-transform: uppercase;
            letter-spacing: .04em; border-width: 1.5px;
        }

        /* ── Mobile Nav — editorial ── */
        .mobile-nav-btn {
            font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
        }

        /* ── Notes View — editorial headings ── */
        .notes-view h1, .notes-view h2, .notes-view h3 {
            letter-spacing: .01em;
        }

        /* ── Onboarding — editorial ── */
        .onboard-logo { border-radius: 6px; }
        .onboard-title {
            font-weight: 900; text-transform: uppercase; letter-spacing: -.01em;
        }
        .onboard-sub { font-weight: 600; letter-spacing: .02em; }
        .onboard-opt {
            border-radius: var(--study-radius); border-width: 2.5px;
            font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
            box-shadow: 3px 3px 0 var(--study-accent-dim);
        }
        .onboard-opt:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--study-accent-dim); }
        .onboard-opt.selected {
            border-color: var(--study-accent);
            box-shadow: 4px 4px 0 rgba(232,133,58,.3);
        }
        .onboard-continue {
            border-radius: var(--study-radius); font-weight: 800;
            text-transform: uppercase; letter-spacing: .04em;
            border: 2.5px solid #000;
        }

        /* ── Solve/Grade views — editorial ── */
        .solve-heading, .grade-heading {
            font-weight: 900 !important; text-transform: uppercase; letter-spacing: .02em;
        }

        /* ═══ Light Mode editorial overrides ═══ */
        [data-theme="light"] .set-card {
            background: var(--bg-base); box-shadow: var(--shadow-card);
        }
        [data-theme="light"] .set-card:hover { box-shadow: var(--shadow-card-hover); }
        [data-theme="light"] .action-card {
            background: var(--bg-base); box-shadow: var(--shadow-card); color: var(--text-primary);
        }
        [data-theme="light"] .action-card:hover { box-shadow: var(--shadow-card-hover); }
        [data-theme="light"] .action-card i { color: var(--accent-amber); }
        [data-theme="light"] .action-label { color: var(--text-primary); }
        [data-theme="light"] .action-sub { color: var(--text-tertiary); }
        [data-theme="light"] .fc-face { background: #fff; box-shadow: 6px 6px 0 rgba(15,23,42,.08); }
        [data-theme="light"] .modal { background: #fff; box-shadow: 8px 8px 0 rgba(0,0,0,.1); }
        [data-theme="light"] .method-card { background: #fff; box-shadow: 3px 3px 0 rgba(15,23,42,.08); }
        [data-theme="light"] .year-option { box-shadow: 3px 3px 0 rgba(15,23,42,.08); }

        /* ===== UX polish: sentence case + collapsible sidebar + folders ===== */
        :root { --sidebar-w-collapsed: 72px; }
        .study-sidebar .sidebar-brand-text,
        .study-sidebar .nav-link,
        .study-sidebar .method-nav,
        .study-sidebar .method-nav-group-label,
        .hero-title,
        .hero-sub,
        .action-label,
        .sets-header h2,
        .set-card-title,
        .token-badge,
        .mobile-nav-btn {
            text-transform: none !important;
            letter-spacing: normal !important;
        }
        .sidebar-brand-wrap {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
            gap: 6px;
            padding: 20px 16px 16px;
            min-height: 46px;
        }
        .sidebar-brand {
            padding: 0;
            min-width: 0;
            flex: 0 1 auto;
        }
        .sidebar-collapse-btn {
            width: 28px !important;
            height: 28px !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            border-radius: 7px !important;
            border: none !important;
            background: transparent !important;
            color: var(--study-text-tertiary) !important;
            cursor: pointer;
            transition: all .15s !important;
            flex-shrink: 0;
            position: static !important;
            margin-left: 0;
            transform: none !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            left: auto !important;
            top: auto !important;
            border-left: none !important;
        }
        .sidebar-collapse-btn:hover {
            color: var(--study-text) !important;
            background: var(--study-bg-tertiary) !important;
        }
        .sidebar-collapse-btn i { width: 14px; height: 14px; }
        .nav-link-label, .method-nav-label { min-width: 0; }
        .study-layout.sidebar-collapsed .study-sidebar { width: var(--sidebar-w-collapsed); }
        .study-layout.sidebar-collapsed .sidebar-brand { justify-content: center; flex: 0 0 auto; }
        .study-layout.sidebar-collapsed .sidebar-brand-text-wrap,
        .study-layout.sidebar-collapsed .sidebar-brand-text,
        .study-layout.sidebar-collapsed .sidebar-brand-sub,
        .study-layout.sidebar-collapsed .nav-link-label,
        .study-layout.sidebar-collapsed .method-nav-label,
        .study-layout.sidebar-collapsed .method-nav-group-label,
        .study-layout.sidebar-collapsed .sidebar-username,
        .study-layout.sidebar-collapsed .token-badge,
        .study-layout.sidebar-collapsed .sidebar-footer .user-name,
        .study-layout.sidebar-collapsed .sidebar-footer-row {
            display: none !important;
        }
        .study-layout.sidebar-collapsed .sidebar-brand-wrap { flex-direction: column; justify-content: center; align-items: center; padding: 10px 8px 8px; min-height: 78px; }
        .study-layout.sidebar-collapsed .sidebar-collapse-btn { margin-left: 0; margin-top: 6px; }
        .study-layout.sidebar-collapsed .sidebar-nav {
            padding: 8px 10px;
        }
        .study-layout.sidebar-collapsed .nav-link,
        .study-layout.sidebar-collapsed .method-nav {
            justify-content: center;
            padding: 10px 8px;
            gap: 0;
        }
        .study-layout.sidebar-collapsed .method-nav-group-label { margin: 0; padding: 0; }
        .study-layout.sidebar-collapsed .sidebar-widgets { display: none; }
        .study-layout.sidebar-collapsed .sidebar-footer {
            align-items: center;
            padding: 10px 8px;
        }
        .study-layout.sidebar-collapsed .sidebar-footer-row {
            justify-content: center;
            width: 100%;
        }
        .study-layout.sidebar-collapsed .sidebar-user {
            justify-content: center;
            width: 100%;
            padding: 6px;
        }
        .study-layout.sidebar-collapsed .sidebar-avatar { margin: 0; }
        .folders-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            margin: 4px 0 14px;
            flex-wrap: nowrap;
        }
        .folders-toggle-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            border: 1px solid var(--study-border);
            border-radius: 8px;
            background: var(--study-bg-secondary);
            color: var(--study-text-secondary);
            cursor: pointer;
            transition: all .15s;
            flex-shrink: 0;
        }
        .folders-toggle-btn:hover { color: var(--study-text); border-color: var(--study-border-light); background: var(--study-bg-tertiary); }
        .folders-toggle-btn i { width: 14px; height: 14px; }
        .folders-toggle-btn .toggle-arrow { transition: transform .2s ease; }
        .folders-toolbar.collapsed .folders-toggle-btn .toggle-arrow { transform: rotate(-90deg); }
        .folder-chips {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            min-height: 34px;
            flex: 1;
            overflow: hidden;
            transition: max-height .25s ease, opacity .2s ease, min-height .25s ease;
        }
        .folders-toolbar.collapsed .folder-chips {
            max-height: 0;
            min-height: 0;
            opacity: 0;
            pointer-events: none;
            margin: 0;
        }
        .folders-toolbar.collapsed .folder-create-btn {
            max-height: 0;
            opacity: 0;
            pointer-events: none;
            overflow: hidden;
        }
        .folders-toolbar .folder-create-btn { margin-left: auto; transition: max-height .25s ease, opacity .2s ease; }
        .folder-chip {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            border: none;
            border-radius: 999px;
            background: var(--study-bg-tertiary);
            color: var(--study-text-secondary);
            padding: 6px 14px;
            font-size: 12px;
            font-weight: 700;
            font-family: inherit;
            cursor: pointer;
            transition: all .15s;
        }
        .folder-chip i { width: 12px; height: 12px; }
        .folder-chip:hover {
            color: var(--study-text);
            background: var(--study-bg-secondary);
        }
        .folder-chip.active {
            color: var(--study-accent);
            background: var(--study-accent-dim);
            font-weight: 800;
        }
        .folder-chip-delete {
            display: none; margin-left: 2px; font-size: 14px; line-height: 1; opacity: 0.4;
            cursor: pointer; font-weight: 400;
        }
        .folder-chip.extra:hover .folder-chip-delete { display: inline; }
        .folder-chip-delete:hover { opacity: 1; color: var(--study-red, #ef4444); }
        .folder-chip.extra { padding-right: 12px; }
        .folder-chip-count {
            font-size: 11px;
            color: var(--study-text-tertiary);
            margin-left: 2px;
        }
        .folder-create-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            border: none;
            border-radius: 999px;
            background: var(--study-bg-tertiary);
            color: var(--study-text);
            padding: 8px 18px;
            font-size: 13px;
            font-weight: 700;
            font-family: inherit;
            cursor: pointer;
            transition: all .15s;
            white-space: nowrap;
        }
        .folder-create-btn i { width: 14px; height: 14px; }
        .folder-create-btn:hover {
            color: var(--study-text);
            border-color: var(--study-border-light);
            background: var(--study-bg-tertiary);
        }
        .set-card-folder {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            font-size: 11px;
            color: var(--study-text-tertiary);
            margin: -1px 0 6px;
            max-width: 220px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .set-card-folder i { width: 12px; height: 12px; flex-shrink: 0; }
        [data-theme="light"] .folders-toggle-btn,
        [data-theme="light"] .folder-chip,
        [data-theme="light"] .folder-create-btn {
            background: #ffffff;
            color: #475569;
        }
        [data-theme="light"] .folder-chip.extra { border-color: #d9e1ea; background: #ffffff; }
        [data-theme="light"] .folder-chip.active {
            background: rgba(115,131,150,0.16);
            color: #334155;
        }
        [data-theme="light"] .folder-chip.extra.active { border-color: #94a3b8; }
        [data-theme="light"] .folder-create-btn:hover,
        [data-theme="light"] .folder-chip:hover {
            border-color: #b9c4d1;
            color: #1f2937;
        }
        @media (max-width: 768px) {
            .sets-header { flex-wrap: wrap; align-items: flex-start; gap: 10px; }
            .sets-header-left { width: 100%; }
            .sets-search-wrap { gap: 8px; }
            .sets-search-box { flex: 1; max-width: 100%; min-width: 0; }
            .sets-search-box-compact { max-width: 100%; }
            .hero-head { flex-wrap: wrap; margin-bottom: 16px; }
            .hero-sub { font-size: 14px; }
            .hero-search-wrap { width: 100%; max-width: 100%; min-width: 0; }
            .folders-toolbar { margin-bottom: 10px; flex-wrap: wrap; }
            .folder-chip { font-size: 11px; padding: 6px 9px; }
            .folder-create-btn { width: auto; min-width: 96px; justify-content: center; }
        }

        /* ===== MIND MAP ===== */
        /* Mind map toolbar */
        .mindmap-toolbar{display:flex;align-items:center;gap:8px;margin-bottom:4px;padding:0 8px}
        .mindmap-btn{display:flex;align-items:center;gap:6px;padding:6px 14px;border-radius:8px;border:1px solid var(--study-border);background:var(--study-card);color:var(--study-text);font-size:.8rem;font-weight:600;cursor:pointer;font-family:inherit;transition:all .2s}
        .mindmap-btn:hover{background:var(--study-hover)}
        .mindmap-generating{display:flex;flex-direction:column;align-items:center;gap:12px;padding:60px 20px;color:var(--study-text-muted)}
        /* Interactive Markmap container */
        .markmap-wrap { position: relative; width: 100%; height: calc(100vh - 180px); min-height: 400px; border-radius: 12px; overflow: hidden; background: var(--study-bg-secondary); border: 1px solid var(--study-border); }
        .markmap-wrap svg { width: 100%; height: 100%; }
        .markmap-wrap text { fill: #fff !important; font-family: 'Inter', sans-serif !important; font-size: 15px !important; font-weight: 500 !important; }
        .markmap-wrap .markmap-node { color: #fff !important; }
        .markmap-wrap .markmap-foreign { color: #fff !important; }
        [data-theme="light"] .markmap-wrap text, [data-theme="light"] .markmap-wrap .markmap-node, [data-theme="light"] .markmap-wrap .markmap-foreign { fill: #1c1917 !important; color: #1c1917 !important; }
        [data-theme="light"] .klm-mm-markmap text, [data-theme="light"] .klm-mm-markmap .markmap-node, [data-theme="light"] .klm-mm-markmap .markmap-foreign { fill: #1c1917 !important; color: #1c1917 !important; }
        .markmap-wrap .markmap-node rect, .markmap-wrap .markmap-node foreignObject { rx: 8; ry: 8; }
        .markmap-wrap .markmap-node circle { r: 5; stroke-width: 2.5px; cursor: pointer; }
        .markmap-wrap .markmap-link { stroke-opacity: 0.5; stroke-width: 2px !important; }
        [data-theme="light"] .markmap-wrap { background: #fafafa; }
        /* Fullscreen mind map */
        .markmap-fullscreen { position: fixed !important; top: 0; left: 0; width: 100vw !important; height: 100vh !important; z-index: 9999; border-radius: 0 !important; border: none !important; min-height: unset !important; }
        .markmap-fullscreen-close { position: fixed; top: 16px; right: 16px; z-index: 10000; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--study-border); background: var(--study-card); color: var(--study-text); font-size: .85rem; font-weight: 600; cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 6px; box-shadow: 0 4px 20px rgba(0,0,0,.3); }
        .markmap-fullscreen-close:hover { background: var(--study-hover); }
        .markmap-center-btn { margin-left: auto; }
        /* Khio LM modal markmap */
        .klm-mm-markmap { width: 100%; height: 100%; min-height: 100%; position: relative; background: var(--study-bg-secondary, #0f1221); border-radius: 12px; overflow: hidden; flex: 1; }
        .klm-mm-markmap svg { width: 100%; height: 100%; }
        .klm-mm-markmap text { fill: #fff !important; font-family: 'Inter', sans-serif !important; font-size: 15px !important; font-weight: 500 !important; }
        .klm-mm-markmap .markmap-node { color: #fff !important; }
        .klm-mm-markmap .markmap-node text { fill: #fff !important; }
        .klm-mm-markmap .markmap-foreign { color: #fff !important; }
        .klm-mm-markmap .markmap-node circle { r: 5; stroke-width: 2.5px; cursor: pointer; }
        .klm-mm-markmap .markmap-link { stroke-opacity: 0.5; stroke-width: 2px !important; }

        /* ===== KEY TERMS ===== */
        .kt-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;padding:4px 0;align-items:start}
        .kt-card{background:var(--study-bg-card, var(--bg-card, #fff));border:1px solid var(--study-border);border-left:4px solid var(--study-accent);border-radius:14px;padding:18px 20px;cursor:pointer;transition:all .2s;box-shadow:0 2px 8px rgba(0,0,0,.03)}
        .kt-card:hover{border-color:var(--study-accent);box-shadow:0 6px 20px rgba(0,0,0,.08);transform:translateY(-2px)}
        .kt-card.expanded{border-color:var(--study-accent);background:var(--study-accent-dim)}
        .kt-term{font-weight:800;font-size:1rem;color:var(--study-text);margin-bottom:0;letter-spacing:-0.01em}
        .kt-def{font-size:.85rem;color:var(--study-text-secondary);margin-top:10px;line-height:1.6;display:none}
        .kt-card.expanded .kt-def{display:block}
        .kt-card.expanded .kt-expand-hint{display:none}
        .kt-expand-hint{font-size:.72rem;color:var(--study-accent);margin-top:6px;opacity:.6}
        .kt-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:20px;flex-wrap:wrap}
        .kt-count{font-size:13px;font-weight:700;color:var(--study-accent)}
        .kt-count{font-size:.8rem;color:var(--study-text-muted);margin-left:auto}

        /* ===== INFOGRAPHIC ===== */
        .infographic-wrap{display:flex;flex-direction:column;gap:16px;padding:4px 0}
        .infographic-header{background:linear-gradient(135deg,var(--study-accent),color-mix(in srgb, var(--study-accent) 70%, #000));border-radius:16px;padding:24px;color:#fff}
        .infographic-title{font-size:1.4rem;font-weight:800;margin:0 0 4px}
        .infographic-tagline{font-size:.88rem;opacity:.85;margin:0}
        .infographic-stats{display:flex;gap:12px;flex-wrap:wrap}
        .infographic-stat{background:var(--study-card);border:1px solid var(--study-border);border-radius:12px;padding:14px 18px;flex:1;min-width:120px;text-align:center}
        .infographic-stat-val{font-size:1.5rem;font-weight:800;color:var(--study-accent)}
        .infographic-stat-lbl{font-size:.75rem;color:var(--study-text-muted);margin-top:2px}
        .infographic-sections{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:12px}
        .infographic-section{background:var(--study-card);border:1px solid var(--study-border);border-radius:14px;padding:16px}
        .infographic-section-heading{font-weight:700;font-size:.9rem;color:var(--study-accent);margin:0 0 10px;display:flex;align-items:center;gap:6px}
        .infographic-section ul{margin:0;padding:0 0 0 16px;color:var(--study-text);font-size:.83rem;line-height:1.6}
        .infographic-toolbar{display:flex;gap:8px;margin-bottom:4px}
        .infographic-btn{display:flex;align-items:center;gap:6px;padding:6px 14px;border-radius:8px;border:1px solid var(--study-border);background:var(--study-card);color:var(--study-text);font-size:.8rem;font-weight:600;cursor:pointer;font-family:inherit;transition:all .2s}
        .infographic-btn:hover{background:var(--study-hover)}

        /* ===== FINAL EXAM ===== */
        .qs-wrap{display:flex;flex-direction:column;gap:0;max-width:720px;margin:0 auto;width:100%;padding:8px 0}
        .qs-progress-bar{height:8px;background:var(--study-border);border-radius:4px;overflow:hidden;margin-bottom:20px;box-shadow:inset 0 1px 3px rgba(0,0,0,0.15)}
        .qs-progress-fill{height:100%;background:linear-gradient(90deg,var(--study-accent),#f0a060);border-radius:4px;transition:width .4s ease}
        .qs-question{font-size:1.25rem;font-weight:700;color:var(--study-text);margin-bottom:24px;line-height:1.6;text-align:center;padding:0 12px}
        .qs-options{display:flex;flex-direction:column;gap:12px;margin-bottom:24px}
        .qs-option{padding:16px 20px;border-radius:14px;border:2px solid var(--study-border);background:var(--study-card);color:var(--study-text);font-size:.95rem;cursor:pointer;text-align:left;font-family:inherit;transition:all .15s;width:100%;box-shadow:3px 3px 0 var(--study-accent-dim,rgba(0,0,0,0.15))}
        .qs-option:hover:not(:disabled){border-color:var(--study-accent);background:color-mix(in srgb,var(--study-accent) 8%,transparent);transform:translate(-2px,-2px);box-shadow:5px 5px 0 rgba(232,133,58,0.2)}
        .qs-option.selected-exam-opt{border-color:var(--study-accent);background:color-mix(in srgb,var(--study-accent) 12%,transparent);border-left:5px solid var(--study-accent);box-shadow:3px 3px 0 rgba(232,133,58,0.25)}
        .qs-option.correct{border-color:#22c55e;background:color-mix(in srgb,#22c55e 12%,transparent);border-left:5px solid #22c55e;box-shadow:3px 3px 0 rgba(34,197,94,0.2)}
        .qs-option.wrong{border-color:#ef4444;background:color-mix(in srgb,#ef4444 12%,transparent);border-left:5px solid #ef4444;box-shadow:3px 3px 0 rgba(239,68,68,0.2)}
        /* Exam intro */
        .exam-intro{display:flex;flex-direction:column;align-items:center;gap:28px;padding:48px 32px;text-align:center;max-width:100%;margin:0 auto}
        .exam-intro-icon{width:64px;height:64px;border-radius:18px;background:color-mix(in srgb,var(--study-accent) 15%,transparent);border:2px solid color-mix(in srgb,var(--study-accent) 30%,transparent);display:flex;align-items:center;justify-content:center;box-shadow:3px 3px 0 var(--study-accent-dim,rgba(0,0,0,0.15))}
        .exam-intro-icon i{width:32px;height:32px;color:var(--study-accent)}
        .exam-intro-title{font-size:2.4rem;font-weight:900;color:var(--study-text);margin:0}
        .exam-intro-desc{font-size:1.05rem;color:var(--study-text-muted);line-height:1.7;margin:0;max-width:560px}
        .exam-intro-retake{font-size:.8rem;color:var(--study-text-muted);display:flex;flex-wrap:wrap;align-items:center;gap:5px;justify-content:center}
        .exam-intro-retake strong{color:var(--study-accent)}
        .exam-intro-retake-chip{padding:3px 12px;border-radius:10px;background:color-mix(in srgb,var(--study-accent) 10%,transparent);color:var(--study-accent);font-size:.72rem;font-weight:700;border:1.5px solid color-mix(in srgb,var(--study-accent) 25%,transparent);box-shadow:2px 2px 0 var(--study-accent-dim,rgba(0,0,0,0.1))}
        .exam-start-btn{padding:18px 48px;border-radius:14px;background:linear-gradient(180deg,color-mix(in srgb,var(--study-accent) 92%,#fff),var(--study-accent),color-mix(in srgb,var(--study-accent) 88%,#000));color:#fff;border:2px solid rgba(255,255,255,0.15);font-size:1.15rem;font-weight:800;cursor:pointer;font-family:inherit;transition:all .15s;width:100%;max-width:420px;box-shadow:4px 4px 0 rgba(0,0,0,0.25);text-transform:uppercase;letter-spacing:.03em}
        .exam-start-btn:hover{transform:translate(-2px,-2px);box-shadow:6px 6px 0 rgba(0,0,0,0.3)}
        .exam-config{margin:20px 0;padding:28px 32px;border:2px solid var(--study-border);border-top:4px solid var(--study-accent);border-radius:16px;background:var(--study-card-bg);text-align:left;max-width:420px;margin-left:auto;margin-right:auto;box-shadow:4px 4px 0 var(--study-accent-dim,rgba(0,0,0,0.15))}
        .exam-config-title{font-size:16px;font-weight:800;color:var(--study-text);margin-bottom:20px;text-align:center;text-transform:uppercase;letter-spacing:.04em}
        .exam-config-row{display:flex;align-items:center;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--study-border)}
        .exam-config-row:last-of-type{border-bottom:none}
        .exam-config-row label{font-size:15px;color:var(--study-text-secondary);font-weight:700}
        .exam-config-stepper{display:flex;align-items:center;gap:0}
        .exam-config-stepper button{width:38px;height:38px;border:1.5px solid var(--study-border);background:var(--study-bg-secondary);color:var(--study-text);font-size:18px;font-weight:700;cursor:pointer;font-family:inherit;transition:all .15s}
        .exam-config-stepper button:first-child{border-radius:10px 0 0 10px}
        .exam-config-stepper button:last-child{border-radius:0 10px 10px 0}
        .exam-config-stepper button:hover{background:var(--study-accent);color:#fff;border-color:var(--study-accent)}
        .exam-config-stepper span{min-width:48px;text-align:center;font-size:18px;font-weight:800;padding:0 4px;border-top:1.5px solid var(--study-border);border-bottom:1.5px solid var(--study-border);height:38px;line-height:38px}
        .exam-config-total{font-size:14px;color:var(--study-text-tertiary);text-align:center;margin-top:16px;font-weight:600}
        /* Exam dot nav */
        .exam-dot-nav{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:16px;justify-content:center}
        .exam-dot{width:34px;height:34px;border-radius:10px;border:2px solid var(--study-border-light);background:var(--study-bg-secondary);color:var(--study-text-secondary);font-size:.78rem;font-weight:700;cursor:pointer;font-family:inherit;display:flex;align-items:center;justify-content:center;transition:all .15s;box-shadow:2px 2px 0 var(--study-accent-dim,rgba(0,0,0,0.1))}
        .exam-dot:hover{transform:translate(-1px,-1px);box-shadow:3px 3px 0 var(--study-accent-dim, rgba(232,133,58,0.15));border-color:var(--study-text-tertiary)}
        .exam-dot.answered{background:var(--study-accent);border-color:var(--study-accent);color:#fff;font-weight:800;box-shadow:2px 2px 0 rgba(232,133,58,0.3)}
        .exam-dot.current{background:var(--study-text);color:var(--study-bg);border-color:var(--study-text);box-shadow:2px 2px 0 rgba(232,133,58,0.2);font-weight:800}
        /* Exam type badge */
        .exam-type-badge{display:inline-flex;align-items:center;gap:6px;padding:5px 14px;border-radius:10px;background:color-mix(in srgb,var(--study-accent) 12%,transparent);color:var(--study-accent);font-size:.75rem;font-weight:800;margin-bottom:14px;border:1.5px solid color-mix(in srgb,var(--study-accent) 25%,transparent);text-transform:uppercase;letter-spacing:.04em;box-shadow:2px 2px 0 var(--study-accent-dim,rgba(0,0,0,0.1))}
        /* Exam textarea */
        .exam-textarea{width:100%;padding:16px 18px;border-radius:14px;border:2px solid var(--study-border);background:var(--study-card);color:var(--study-text);font-size:.95rem;font-family:inherit;resize:vertical;outline:none;transition:all .2s;box-sizing:border-box;min-height:100px;margin-bottom:18px;box-shadow:3px 3px 0 var(--study-accent-dim,rgba(0,0,0,0.1))}
        .exam-textarea:focus{border-color:var(--study-accent);box-shadow:3px 3px 0 rgba(232,133,58,0.2)}
        .exam-textarea-long{min-height:200px}
        /* Exam navigation */
        .exam-nav{display:flex;align-items:center;gap:10px;margin-top:8px;flex-wrap:wrap}
        .exam-nav-btn{padding:12px 24px;border-radius:12px;border:2px solid var(--study-border);background:var(--study-card);color:var(--study-text);font-size:.88rem;font-weight:700;cursor:pointer;font-family:inherit;transition:all .15s;box-shadow:3px 3px 0 var(--study-accent-dim,rgba(0,0,0,0.15))}
        .exam-nav-btn:hover{border-color:var(--study-accent);color:var(--study-accent);transform:translate(-2px,-2px);box-shadow:5px 5px 0 rgba(232,133,58,0.2)}
        .exam-answered-count{font-size:.8rem;color:var(--study-text-muted);margin-left:auto;font-weight:600}
        .exam-submit-btn{padding:14px 32px;border-radius:12px;background:linear-gradient(180deg,color-mix(in srgb,var(--study-accent) 92%,#fff),var(--study-accent),color-mix(in srgb,var(--study-accent) 88%,#000));color:#fff;border:2px solid rgba(255,255,255,0.15);font-size:.95rem;font-weight:800;cursor:pointer;font-family:inherit;transition:all .15s;box-shadow:4px 4px 0 rgba(0,0,0,0.25);text-transform:uppercase;letter-spacing:.03em}
        .exam-submit-btn:hover{transform:translate(-2px,-2px);box-shadow:6px 6px 0 rgba(0,0,0,0.3)}
        /* Exam results */
        .exam-results{display:flex;flex-direction:column;gap:20px;padding:8px 0}
        .exam-score-hero{text-align:center;padding:36px 24px;background:var(--study-card);border:2px solid var(--study-border);border-top:5px solid var(--study-accent);border-radius:18px;display:flex;flex-direction:column;align-items:center;gap:10px;box-shadow:4px 4px 0 var(--study-accent-dim,rgba(0,0,0,0.15))}
        .exam-score-pct{font-size:4rem;font-weight:900;color:var(--study-accent)}
        .exam-score-label{font-size:1.05rem;color:var(--study-text-muted);font-weight:600}
        .exam-score-icon{width:56px;height:56px;border-radius:50%;display:flex;align-items:center;justify-content:center;margin-bottom:4px}
        .exam-score-icon.gold{background:rgba(234,179,8,0.15);border:2px solid rgba(234,179,8,0.3)}
        .exam-score-icon.gold i{color:#eab308}
        .exam-score-icon.green{background:rgba(34,197,94,0.15);border:2px solid rgba(34,197,94,0.3)}
        .exam-score-icon.green i{color:#22c55e}
        .exam-score-icon.blue{background:rgba(59,130,246,0.15);border:2px solid rgba(59,130,246,0.3)}
        .exam-score-icon.blue i{color:#3b82f6}
        .exam-score-icon.red{background:rgba(239,68,68,0.15);border:2px solid rgba(239,68,68,0.3)}
        .exam-score-icon.red i{color:#ef4444}
        .exam-score-emoji{display:none}
        .exam-areas{background:color-mix(in srgb,#ef4444 8%,transparent);border:2px solid color-mix(in srgb,#ef4444 25%,transparent);border-left:5px solid #ef4444;border-radius:14px;padding:18px 22px;box-shadow:3px 3px 0 rgba(239,68,68,0.12)}
        .exam-areas-title{font-size:.9rem;font-weight:800;color:#ef4444;margin:0 0 12px;display:flex;align-items:center;gap:6px;text-transform:uppercase;letter-spacing:.03em}
        .exam-areas ul{margin:0;padding:0 0 0 18px;color:var(--study-text);font-size:.88rem;line-height:1.8;font-weight:500}
        .exam-areas-btn{padding:10px 20px;border-radius:10px;background:#ef4444;color:#fff;border:none;font-size:.82rem;font-weight:700;cursor:pointer;font-family:inherit;display:flex;align-items:center;gap:6px;box-shadow:3px 3px 0 rgba(239,68,68,0.25);transition:all .15s}
        .exam-areas-btn:hover{transform:translate(-2px,-2px);box-shadow:5px 5px 0 rgba(239,68,68,0.3)}
        .exam-breakdown{display:flex;flex-direction:column;gap:12px}
        .exam-breakdown-title{font-size:.9rem;font-weight:800;color:var(--study-text-muted);text-transform:uppercase;letter-spacing:.05em;margin-bottom:6px}
        .exam-q-result{background:var(--study-card);border:2px solid var(--study-border);border-radius:14px;padding:16px 20px;display:flex;flex-direction:column;gap:6px;box-shadow:3px 3px 0 var(--study-accent-dim,rgba(0,0,0,0.1));transition:all .15s}
        .exam-q-result:hover{transform:translate(-1px,-1px);box-shadow:4px 4px 0 var(--study-accent-dim, rgba(232,133,58,0.15))}
        .exam-q-result.correct{border-color:color-mix(in srgb,#22c55e 40%,transparent);border-left:5px solid #22c55e}
        .exam-q-result.partial{border-color:color-mix(in srgb,#f59e0b 40%,transparent);border-left:5px solid #f59e0b}
        .exam-q-result.wrong{border-color:color-mix(in srgb,#ef4444 30%,transparent);border-left:5px solid #ef4444}
        .exam-q-num{font-size:.75rem;font-weight:800;color:var(--study-text-muted);text-transform:uppercase}
        .exam-q-text{font-size:.92rem;font-weight:600;color:var(--study-text);line-height:1.5}
        .exam-q-your{font-size:.82rem;color:var(--study-text-muted);font-style:italic}
        .exam-q-feedback{font-size:.84rem;line-height:1.6}
        .exam-q-result.correct .exam-q-feedback{color:#16a34a}
        .exam-q-result.partial .exam-q-feedback{color:#d97706}
        .exam-q-result.wrong .exam-q-feedback{color:#dc2626}
        .exam-results-btns{display:flex;gap:12px;flex-wrap:wrap;justify-content:center;padding:12px 0 20px}
        .exam-results-btn{padding:14px 28px;border-radius:12px;border:2px solid var(--study-border);background:var(--study-card);color:var(--study-text);font-size:.9rem;font-weight:700;cursor:pointer;font-family:inherit;transition:all .15s;box-shadow:3px 3px 0 var(--study-accent-dim,rgba(0,0,0,0.15))}
        .exam-results-btn:hover{transform:translate(-2px,-2px);box-shadow:5px 5px 0 rgba(232,133,58,0.2);border-color:var(--study-accent)}
        .exam-results-btn.primary{background:var(--study-accent);color:#fff;border-color:var(--study-accent);box-shadow:4px 4px 0 rgba(0,0,0,0.25)}
        .exam-results-btn.primary:hover{transform:translate(-2px,-2px);box-shadow:6px 6px 0 rgba(0,0,0,0.3)}


        /* ===== STUDY TIMER ===== */
        .study-timer{display:flex;align-items:center;gap:4px;margin-right:4px}
        .timer-btn{display:flex;align-items:center;gap:6px;padding:6px 12px;border-radius:8px;border:1px solid var(--study-border);background:var(--study-card);color:var(--study-text);font-size:.8rem;font-weight:600;font-family:inherit;cursor:pointer;transition:all .2s;min-width:82px}
        .timer-btn.running{border-color:var(--study-accent);color:var(--study-accent)}
        .timer-btn.break{border-color:#22c55e;color:#22c55e}
        .timer-reset{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:8px;border:1px solid var(--study-border);background:var(--study-card);color:var(--study-text-muted);cursor:pointer;transition:all .2s}
        .timer-reset:hover{color:var(--study-text)}

        /* ===== HIGHLIGHT ASK AI ===== */
        #askAiFloat{position:fixed;z-index:9999;background:var(--study-accent);color:#fff;border:none;border-radius:8px;padding:6px 12px;font-size:.75rem;font-weight:700;cursor:pointer;box-shadow:0 4px 16px rgba(0,0,0,.25);display:none;align-items:center;gap:5px;font-family:inherit;white-space:nowrap}

        /* ===== FLASHCARD MODES ===== */
        .fc-mode-btns{display:flex;gap:8px;margin-bottom:12px;justify-content:flex-start;flex-wrap:wrap}
        .fc-mode-btn{display:flex;align-items:center;gap:6px;padding:8px 14px;border-radius:10px;border:1.5px solid var(--study-border);background:var(--study-bg-secondary);color:var(--study-text-secondary);font-size:.76rem;font-weight:700;cursor:pointer;font-family:inherit;transition:all .15s;box-shadow:2px 2px 0 rgba(0,0,0,.08)}
        .fc-mode-btn.active{border-color:var(--study-accent);color:var(--study-accent);background:color-mix(in srgb, var(--study-accent) 8%, transparent);box-shadow:2px 2px 0 rgba(232,133,58,.15),inset 0 1px 0 rgba(255,255,255,.3);font-weight:800}
        .fc-mode-btn:hover{color:var(--study-accent);border-color:var(--study-accent);transform:translate(-1px,-1px);box-shadow:3px 3px 0 rgba(232,133,58,.12)}
        .fc-mode-btn:active{transform:translate(1px,1px);box-shadow:1px 1px 0 rgba(0,0,0,.06)}

        /* Test Settings Modal */
        .test-settings-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; animation: fadeIn .15s ease; }
        .test-settings-modal { width: min(440px, 92vw); background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.4); animation: slideUp .2s ease; }
        @keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
        .test-settings-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--study-border); }
        .test-settings-header h3 { font-size: 16px; font-weight: 700; color: var(--study-text); margin: 0; }
        .test-settings-close { background: none; border: none; color: var(--study-text-tertiary); cursor: pointer; padding: 4px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
        .test-settings-close:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .test-settings-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
        .test-settings-group { display: flex; flex-direction: column; gap: 8px; }
        .test-settings-label { font-size: 13px; font-weight: 600; color: var(--study-text); }
        .test-settings-options { display: flex; gap: 6px; flex-wrap: wrap; }
        .ts-opt { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--study-border); background: transparent; color: var(--study-text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; }
        .ts-opt:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .ts-opt.active { background: var(--study-accent-dim); color: var(--study-accent); border-color: var(--study-accent); }
        .test-settings-textarea { width: 100%; min-height: 60px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--study-border); background: var(--study-bg); color: var(--study-text); font-size: 13px; font-family: inherit; resize: vertical; outline: none; line-height: 1.5; }
        .test-settings-textarea:focus { border-color: var(--study-accent); }
        .test-settings-textarea::placeholder { color: var(--study-text-tertiary); }
        .test-settings-input { width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--study-border); background: var(--study-bg); color: var(--study-text); font-size: 13px; font-family: inherit; outline: none; }
        .test-settings-input:focus { border-color: var(--study-accent); }
        .test-settings-input::placeholder { color: var(--study-text-tertiary); }
        .test-settings-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--study-border); }
        .test-settings-cancel { padding: 8px 18px; border-radius: 8px; border: 1px solid var(--study-border); background: transparent; color: var(--study-text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
        .test-settings-cancel:hover { color: var(--study-text); background: var(--study-bg-tertiary); }
        .test-settings-generate { padding: 10px 20px; border-radius: 12px; border: 2px solid #111827; background: color-mix(in srgb, var(--accent-amber) 76%, #cb8c52); color: #111827; font-size: 13px; font-weight: 800; cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 6px; transition: all .15s; box-shadow: 3px 3px 0 rgba(17,24,39,.24); }
        .test-settings-generate:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 rgba(17,24,39,.28); }
        .test-settings-generate:disabled { opacity: 0.5; cursor: not-allowed; }

        /* ===== SUGGESTED CHAT QUESTIONS ===== */
        .rchat-suggestions{display:flex;flex-direction:column;gap:5px;margin:6px 0 10px}
        .rchat-suggestion-chip{text-align:left;padding:7px 12px;border-radius:10px;border:1px solid var(--study-border);background:var(--study-card);color:var(--study-text);font-size:.75rem;cursor:pointer;font-family:inherit;transition:all .2s;line-height:1.4}
        .rchat-suggestion-chip:hover{border-color:var(--study-accent);color:var(--study-accent);background:color-mix(in srgb,var(--study-accent) 6%,transparent)}

        /* ===== QUIZ TOPIC FILTER ===== */
        .qs-topic-filter{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:14px}
        .qs-topic-chip{padding:4px 12px;border-radius:20px;border:1px solid var(--study-border);background:var(--study-card);color:var(--study-text-muted);font-size:.72rem;font-weight:600;cursor:pointer;font-family:inherit;transition:all .2s}
        .qs-topic-chip.active{border-color:var(--study-accent);color:var(--study-accent);background:color-mix(in srgb,var(--study-accent) 12%,transparent)}
        .qs-topic-badge{display:inline-block;padding:2px 10px;border-radius:20px;background:color-mix(in srgb,var(--study-accent) 12%,transparent);color:var(--study-accent);font-size:.7rem;font-weight:700;margin-bottom:10px}

        /* ===== FLASHCARD COUNT PICKER ===== */
        .fc-count-dropdown .fc-count-menu{display:none;position:absolute;right:0;top:calc(100% + 4px);background:var(--study-card);border:1px solid var(--study-border);border-radius:10px;padding:4px;min-width:140px;z-index:100;box-shadow:0 8px 24px rgba(0,0,0,.3)}
        .fc-count-dropdown.open .fc-count-menu{display:flex;flex-direction:column}
        .fc-count-menu-item{padding:8px 12px;border:none;background:none;color:var(--study-text);font-size:.82rem;font-weight:500;cursor:pointer;font-family:inherit;border-radius:6px;text-align:left;transition:background .15s}
        .fc-count-menu-item:hover{background:var(--study-accent-dim,rgba(139,92,246,.08))}
        .fc-count-menu-item.active{color:var(--study-accent);font-weight:700}
        .fc-count-sub{font-size:.65rem;font-weight:500;color:var(--study-text-muted);display:block;margin-top:3px}

        /* ===== REMEDIAL NOTES BUTTON ===== */
        .exam-areas-btn{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border-radius:8px;background:var(--study-accent);color:#fff;border:none;font-size:.78rem;font-weight:700;cursor:pointer;font-family:inherit;transition:opacity .2s}
        .exam-areas-btn:hover{opacity:.88}
        .exam-areas-btn:disabled{opacity:.45;cursor:default}

        /* ═══════════════════════════════════════════════════════════
           NEW FEATURES: Dashboard Sidebar, Study Modes, Audio Recap, Exam Dates
           ═══════════════════════════════════════════════════════════ */

        /* ── Dashboard Layout (2-column with right sidebar) ── */
        .dashboard-layout {
            display: flex; gap: 0; max-width: 1400px; margin: 0 auto; width: 100%;
        }
        .dashboard-main { flex: 1; min-width: 0; }
        /* dashboard-sidebar removed — widgets moved to left sidebar */
        .dash-widget {
            background: var(--study-bg-secondary); border: 2px solid var(--study-border);
            border-radius: var(--study-radius); padding: 14px;
            box-shadow: 2px 2px 0 var(--study-accent-dim);
        }
        .dash-widget-title {
            font-size: 10px; font-weight: 800; text-transform: uppercase;
            letter-spacing: .06em; color: var(--study-text-tertiary); margin-bottom: 10px;
            display: flex; align-items: center; gap: 5px;
        }
        .dash-widget-title i { width: 12px; height: 12px; }

        /* Streak Widget */
        .streak-display {
            display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
        }
        .streak-fire {
            font-size: 28px; line-height: 1;
        }
        .streak-info { flex: 1; }
        .streak-count {
            font-size: 22px; font-weight: 900; color: var(--study-text); line-height: 1;
        }
        .streak-label {
            font-size: 11px; font-weight: 600; color: var(--study-text-tertiary); margin-top: 2px;
        }
        .streak-days {
            display: flex; gap: 3px; margin-top: 8px;
        }
        .streak-day {
            width: 26px; height: 26px; border-radius: 5px;
            display: flex; align-items: center; justify-content: center;
            font-size: 8px; font-weight: 700; color: var(--study-text-tertiary);
            background: var(--study-bg-tertiary); border: 1px solid var(--study-border);
        }
        .streak-day.active {
            background: var(--study-accent); color: #000; border-color: var(--study-accent);
        }
        .streak-day.today {
            border-color: var(--study-accent); color: var(--study-accent);
        }

        /* Exam Dates Widget */
        .exam-list { display: flex; flex-direction: column; gap: 8px; }
        .exam-item {
            display: flex; align-items: center; gap: 8px; padding: 8px 10px;
            border-radius: 7px; background: var(--study-bg-tertiary); cursor: default;
        }
        .exam-date-badge {
            width: 36px; height: 36px; border-radius: 7px;
            background: var(--study-accent-dim); color: var(--study-accent);
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            font-weight: 800; flex-shrink: 0; border: 1px solid rgba(232,133,58,0.2);
        }
        .exam-date-month { font-size: 8px; text-transform: uppercase; letter-spacing: .05em; line-height: 1; }
        .exam-date-day { font-size: 14px; line-height: 1; margin-top: 1px; }
        .exam-item-info { flex: 1; min-width: 0; }
        .exam-item-name {
            font-size: 12px; font-weight: 700; color: var(--study-text);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .exam-item-course {
            font-size: 10px; color: var(--study-text-tertiary); margin-top: 1px;
        }
        .exam-item-countdown {
            font-size: 10px; font-weight: 700; color: var(--study-accent);
            white-space: nowrap;
        }
        .exam-item-countdown.urgent { color: var(--study-red); }
        .exam-empty {
            text-align: center; padding: 10px 0; font-size: 12px;
            color: var(--study-text-tertiary);
        }
        .exam-add-btn {
            width: 100%; padding: 8px; border-radius: 8px;
            border: 1.5px dashed var(--study-border); background: transparent;
            color: var(--study-text-tertiary); font-size: 12px; font-weight: 600;
            cursor: pointer; font-family: inherit; transition: all .15s;
            display: flex; align-items: center; justify-content: center; gap: 4px;
        }
        .exam-add-btn:hover { border-color: var(--study-accent); color: var(--study-accent); }
        .exam-add-btn i { width: 14px; height: 14px; }

        /* Quick Stats Widget */
        .quick-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
        .quick-stat {
            padding: 12px; border-radius: 8px; background: var(--study-bg-tertiary);
            text-align: center;
        }
        .quick-stat-val {
            font-size: 22px; font-weight: 900; color: var(--study-text); line-height: 1;
        }
        .quick-stat-label {
            font-size: 10px; font-weight: 600; color: var(--study-text-tertiary);
            margin-top: 4px; text-transform: uppercase; letter-spacing: .04em;
        }

        /* ── Study Mode Toggle ── */


        /* ── Audio Recap ── */
        /* Mermaid diagrams in chat */
        .mermaid-diagram { background: var(--study-card-bg); border: 1px solid var(--study-border); border-radius: 12px; padding: 16px; margin: 12px 0; overflow-x: auto; text-align: center; cursor: pointer; position: relative; transition: border-color 0.2s, box-shadow 0.2s; }
        .mermaid-diagram:hover { border-color: var(--study-accent); box-shadow: 0 0 0 1px var(--study-accent); }
        .mermaid-diagram svg { max-width: 100%; height: auto; }
        .mermaid-diagram svg text, .mermaid-diagram svg .nodeLabel, .mermaid-diagram svg .edgeLabel, .mermaid-diagram svg .label { fill: #fff !important; color: #fff !important; }
        .mermaid-diagram svg .node rect, .mermaid-diagram svg .node polygon, .mermaid-diagram svg .node circle { stroke: rgba(255,255,255,0.3) !important; }
        .mermaid-modal svg text, .mermaid-modal svg .nodeLabel, .mermaid-modal svg .edgeLabel, .mermaid-modal svg .label { fill: #fff !important; color: #fff !important; }
        .light-mode .mermaid-diagram svg text, .light-mode .mermaid-diagram svg .nodeLabel, .light-mode .mermaid-diagram svg .edgeLabel, .light-mode .mermaid-diagram svg .label { fill: #000 !important; color: #000 !important; }
        .light-mode .mermaid-diagram svg .node rect, .light-mode .mermaid-diagram svg .node polygon, .light-mode .mermaid-diagram svg .node circle { stroke: rgba(0,0,0,0.2) !important; }
        .light-mode .mermaid-modal svg text, .light-mode .mermaid-modal svg .nodeLabel, .light-mode .mermaid-modal svg .edgeLabel, .light-mode .mermaid-modal svg .label { fill: #000 !important; color: #000 !important; }
        .mermaid-diagram-label { font-size: 11px; color: var(--study-text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; }
        .mermaid-diagram-label::after { content: 'Click to expand'; font-size: 10px; opacity: 0.6; }
        .light-mode .mermaid-diagram { background: #f8f9fa; border-color: #e0e0e0; }
        /* Mermaid fullscreen modal */
        .mermaid-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn 0.2s; }
        .mermaid-modal { background: var(--study-card-bg); border-radius: 16px; padding: 24px; max-width: 95vw; max-height: 90vh; overflow: auto; position: relative; min-width: 300px; }
        .mermaid-modal svg { max-width: 100%; height: auto; min-height: 300px; }
        .mermaid-modal-close { position: absolute; top: 12px; right: 12px; background: var(--study-bg-secondary); border: 1px solid var(--study-border); border-radius: 8px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--study-text); font-size: 18px; z-index: 1; }
        .mermaid-modal-close:hover { background: var(--study-accent); color: #fff; }
        .mermaid-modal-hint { text-align: center; font-size: 11px; color: var(--study-text-tertiary); margin-top: 12px; }
        .light-mode .mermaid-modal { background: #fff; }

        .audio-recap-wrap {
            display: flex; flex-direction: column; align-items: center;
            padding: 40px 24px; gap: 20px; text-align: center;
        }
        .audio-recap-player {
            width: 100%; max-width: 520px; padding: 28px;
            background: var(--study-bg-secondary); border: 2px solid var(--study-border);
            border-radius: 16px; box-shadow: 4px 4px 0 var(--study-accent-dim);
        }
        .audio-recap-cover {
            width: 120px; height: 120px; border-radius: 16px; margin: 0 auto 20px;
            background: linear-gradient(135deg, var(--study-accent), #a855f7);
            display: flex; align-items: center; justify-content: center;
        }
        .audio-recap-cover i { width: 48px; height: 48px; color: #fff; }
        .audio-recap-title {
            font-size: 18px; font-weight: 800; color: var(--study-text); margin-bottom: 4px;
        }
        .audio-recap-sub {
            font-size: 13px; color: var(--study-text-tertiary); margin-bottom: 20px;
        }
        .audio-recap-progress {
            width: 100%; height: 4px; background: var(--study-bg-tertiary);
            border-radius: 4px; margin-bottom: 8px; cursor: pointer; position: relative;
        }
        .audio-recap-progress-fill {
            height: 100%; background: var(--study-accent); border-radius: 4px; width: 0%;
            transition: width .1s linear;
        }
        .audio-recap-time {
            display: flex; justify-content: space-between;
            font-size: 11px; color: var(--study-text-tertiary); margin-bottom: 20px;
        }
        .audio-recap-controls {
            display: flex; align-items: center; justify-content: center; gap: 16px;
        }
        .audio-ctrl-btn {
            width: 44px; height: 44px; border-radius: 50%;
            border: 2px solid var(--study-border); background: var(--study-bg-tertiary);
            color: var(--study-text); cursor: pointer; transition: all .15s;
            display: flex; align-items: center; justify-content: center;
        }
        .audio-ctrl-btn:hover { border-color: var(--study-accent); color: var(--study-accent); }
        .audio-ctrl-btn.play-btn {
            width: 56px; height: 56px; background: var(--study-accent);
            border-color: var(--study-accent); color: #000;
        }
        .audio-ctrl-btn.play-btn:hover { opacity: .9; }
        .audio-ctrl-btn i { width: 20px; height: 20px; }
        .audio-recap-generate {
            padding: 14px 28px; border-radius: var(--study-radius);
            background: color-mix(in srgb, var(--accent-amber) 76%, #cb8c52); color: #111827; border: 2px solid #111827;
            font-size: 13px; font-weight: 800; text-transform: uppercase;
            letter-spacing: .04em; cursor: pointer; font-family: inherit;
            box-shadow: 3px 3px 0 rgba(17,24,39,.24); transition: all .15s;
            display: inline-flex; align-items: center; gap: 8px;
        }
        .audio-recap-generate:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 rgba(17,24,39,.3); }
        .audio-recap-generate:disabled { opacity: .5; cursor: default; transform: none; }
        .audio-recap-generate i { width: 18px; height: 18px; }

        /* ── Add Exam Modal ── */
        .exam-modal-overlay {
            position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,0.7);
            display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
        }
        .exam-modal {
            background: var(--study-bg-secondary); border: 2px solid var(--study-border);
            border-radius: 16px; padding: 28px; max-width: 420px; width: 90%;
            box-shadow: 6px 6px 0 rgba(0,0,0,.3);
        }
        .exam-modal h3 {
            font-size: 16px; font-weight: 800; text-transform: uppercase;
            letter-spacing: .03em; margin: 0 0 20px; color: var(--study-text);
        }
        .exam-modal-field {
            margin-bottom: 14px;
        }
        .exam-modal-field label {
            display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
            letter-spacing: .04em; color: var(--study-text-tertiary); margin-bottom: 6px;
        }
        .exam-modal-field input, .exam-modal-field select {
            width: 100%; padding: 10px 12px; border-radius: 8px;
            border: 2px solid var(--study-border); background: var(--study-bg-tertiary);
            color: var(--study-text); font-size: 14px; font-family: inherit;
        }
        .exam-modal-field input:focus, .exam-modal-field select:focus {
            outline: none; border-color: var(--study-accent);
        }
        .exam-modal-actions {
            display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;
        }
        .exam-modal-cancel {
            padding: 8px 20px; border-radius: 8px; border: 2px solid var(--study-border);
            background: transparent; color: var(--study-text); font-size: 13px;
            font-weight: 700; cursor: pointer; font-family: inherit;
        }
        .exam-modal-save {
            padding: 8px 20px; border-radius: 8px; border: none;
            background: var(--study-accent); color: #000; font-size: 13px;
            font-weight: 800; cursor: pointer; font-family: inherit;
        }
        /* Custom calendar */
        .exam-cal { user-select: none; }
        .exam-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
        .exam-cal-header span { font-size: 14px; font-weight: 700; color: var(--study-text); }
        .exam-cal-nav { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--study-border); background: transparent; color: var(--study-text); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: all .15s; }
        .exam-cal-nav:hover { border-color: var(--study-accent); color: var(--study-accent); }
        .exam-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
        .exam-cal-dow { font-size: 10px; font-weight: 700; color: var(--study-text-tertiary); text-transform: uppercase; padding: 4px 0; }
        .exam-cal-day { font-size: 13px; padding: 7px 0; border-radius: 8px; cursor: pointer; color: var(--study-text); transition: all .12s; border: 2px solid transparent; }
        .exam-cal-day:hover { background: var(--study-hover); }
        .exam-cal-day.other { color: var(--study-text-tertiary); opacity: .4; }
        .exam-cal-day.past { color: var(--study-text-tertiary); opacity: .3; cursor: default; }
        .exam-cal-day.today { border-color: var(--study-accent); font-weight: 700; }
        .exam-cal-day.selected { background: var(--study-accent) !important; color: #000 !important; font-weight: 700; border-color: var(--study-accent); }
        .exam-cal-selected-display { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--study-accent-dim); color: var(--study-accent); font-size: 13px; font-weight: 600; text-align: center; display: none; }

        /* ── Responsive: hide dashboard sidebar on small screens ── */
        @media (max-width: 1023px) {
        }
        /* ── Light mode overrides for sidebar widgets ── */
        [data-theme="light"] .sb-widget {
            background: var(--study-bg-tertiary);
            border-color: var(--study-border);
        }
        [data-theme="light"] .sb-widget::before { opacity: 0.3; }
        [data-theme="light"] .sb-exam-item { background: var(--study-bg-tertiary); border-color: var(--study-border); }
        [data-theme="light"] .sb-exam-item:hover { background: var(--study-accent-dim); }
        [data-theme="light"] .sb-streak-day { background: var(--study-bg-tertiary); border-color: var(--study-border); }
        [data-theme="light"] .sb-streak-day.active { background: linear-gradient(135deg, var(--study-accent), var(--study-accent-hover)); color: #fff; }
        [data-theme="light"] .sb-streak-day.today { background: var(--study-accent-dim); }
        [data-theme="light"] .sb-exam-add { border-color: var(--study-border); }
        [data-theme="light"] .audio-recap-player { background: #fff; box-shadow: 4px 4px 0 rgba(15,23,42,.08); }
        [data-theme="light"] .exam-modal { background: #fff; }

        /* ── Khio Focus Promo Banner ── */
        .kf-promo-bar {
            display: flex; align-items: center; gap: 12px;
            padding: 12px 16px; margin: 0;
            background: var(--study-accent-dim, rgba(232,133,58,0.08));
            border-bottom: 1px solid var(--study-accent-dim, rgba(232,133,58,0.15));
            font-size: 13px; color: var(--study-text-secondary);
            flex-shrink: 0;
        }
        .kf-promo-bar img { width: 36px; height: 36px; flex-shrink: 0; image-rendering: pixelated; image-rendering: crisp-edges; object-fit: contain; }
        .kf-promo-bar strong { color: var(--study-text); }
        .kf-promo-bar a {
            margin-left: auto; padding: 5px 16px; border-radius: 6px; font-size: 12px; font-weight: 700;
            background: rgba(232,133,58,0.9); color: #fff; text-decoration: none; white-space: nowrap;
            letter-spacing: 0.3px;
        }
        .kf-promo-bar a:hover { opacity: 0.9; }
        .kf-promo-bar .kf-promo-x {
            background: none; border: none; color: var(--study-text-tertiary); cursor: pointer;
            font-size: 16px; padding: 0 4px; line-height: 1;
        }
        .kf-promo-bar .kf-promo-x:hover { color: var(--study-text); }
        [data-theme="light"] .kf-promo-bar { background: rgba(232,133,58,0.06); border-bottom-color: var(--study-accent-dim, rgba(232,133,58,0.12)); }

        /* ── Editorial Course / Notes Refresh ── */
        .study-layout.notes-active .study-bg,
        .study-layout.notes-active .study-bg-overlay,
        .study-layout.course-active .study-bg,
        .study-layout.course-active .study-bg-overlay {
            display: none !important;
        }
        .study-layout.notes-active .study-main,
        .study-layout.course-active .study-main {
            background: var(--study-bg);
        }
        .study-layout.course-active {
            --sidebar-w: 320px;
        }
        .study-layout.notes-active .detail-main,
        .study-layout.course-active .detail-main {
            background: transparent;
            border: none;
            border-radius: 0;
            box-shadow: none;
        }
        .study-layout.notes-active .detail-main.mode-reading {
            overflow-y: auto;
            overflow-x: hidden;
            scrollbar-width: none;
        }
        .study-layout.notes-active .detail-main.mode-reading::-webkit-scrollbar {
            width: 0;
            height: 0;
        }
        .study-layout.course-active .detail-main.mode-reading {
            overflow-y: auto;
            overflow-x: hidden;
        }
        [data-theme="light"] .study-layout.notes-active .detail-main,
        [data-theme="light"] .study-layout.course-active .detail-main {
            background: #f6efe3;
        }
        [data-theme="dark"] .study-layout.notes-active .detail-main,
        [data-theme="dark"] .study-layout.course-active .detail-main {
            background: #11161a;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading,
        .study-layout.course-active .detail-main-inner.mode-reading {
            padding: 0 0 24px 18px;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading {
            padding: 0 18px 24px;
            height: auto;
            min-height: 100%;
        }
        .study-layout.course-active .detail-main-inner.mode-reading {
            height: auto;
            min-height: 100%;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell,
        .study-layout.course-active .detail-main-inner.mode-reading #quillEditorShell {
            gap: 18px;
            border: none;
            border-radius: 0;
            background: transparent;
            padding: 0;
            box-shadow: none;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell {
            height: auto;
            min-height: 100%;
            overflow: visible;
            align-items: center;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading .notes-page-bar {
            width: min(100%, 1120px);
            margin: 8px auto 0;
            padding-top: 8px;
            padding-bottom: 14px;
        }
        .study-layout.course-active .detail-main-inner.mode-reading #quillEditorShell {
            height: auto;
            min-height: 100%;
            overflow: visible;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow,
        .study-layout.course-active .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow {
            position: static !important;
            margin: 18px 0 0;
            padding: 14px 18px;
            border-radius: 24px !important;
            border: 1px solid var(--study-border) !important;
            background: var(--study-bg-secondary) !important;
            box-shadow: 0 14px 34px rgba(0, 0, 0, 0.1);
        }
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow {
            display: flex;
            width: fit-content;
            max-width: min(100%, 1060px);
            align-self: center;
            margin-left: auto;
            margin-right: auto;
            justify-content: flex-start;
            flex-wrap: wrap;
        }
        /* dark toolbar override removed — uses CSS variables now */
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow .ql-formats,
        .study-layout.course-active .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow .ql-formats {
            border-right-color: var(--study-border);
        }
        [data-theme="dark"] .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow .ql-formats,
        [data-theme="dark"] .study-layout.course-active .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow .ql-formats {
            border-right-color: rgba(255, 255, 255, 0.08);
        }
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell > .ql-container.ql-snow,
        .study-layout.course-active .detail-main-inner.mode-reading #quillEditorShell > .ql-container.ql-snow {
            border: none !important;
            border-radius: 0;
            background: transparent;
            overflow: visible;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell > .ql-container.ql-snow {
            width: min(100%, 1120px);
            margin: 0 auto;
            flex: 0 0 auto;
            height: auto !important;
            min-height: 0 !important;
            scrollbar-width: none;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell > .ql-container.ql-snow::-webkit-scrollbar {
            width: 0;
            height: 0;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell .ql-editor,
        .study-layout.course-active .detail-main-inner.mode-reading #quillEditorShell .ql-editor {
            padding: 22px 24px 48px !important;
            color: var(--study-text) !important;
            background: transparent;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell .ql-editor {
            height: auto !important;
            min-height: calc(100dvh - 280px);
            overflow-y: visible !important;
            overflow-x: hidden !important;
            scrollbar-width: none;
        }
        .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell .ql-editor::-webkit-scrollbar {
            width: 0;
            height: 0;
        }
        .study-layout.notes-active .notes-view,
        .study-layout.notes-active .ql-editor,
        .study-layout.course-active .notes-view {
            max-width: 1120px;
            margin: 0 auto;
            padding-left: 0;
            padding-right: 0;
            text-align: left;
        }
        .study-layout.notes-active .notes-view h1,
        .study-layout.notes-active .ql-editor h1,
        .study-layout.course-active .notes-view h1,
        .study-layout.course-active .notes-view h2,
        .study-layout.course-active .notes-view h3 {
            text-align: left !important;
        }
        .study-layout.notes-active .notes-view h1,
        .study-layout.notes-active .ql-editor h1,
        .study-layout.course-active .module-hero-title {
            text-wrap: balance;
        }
        .study-layout.notes-active .notes-view strong,
        .study-layout.notes-active .ql-editor strong,
        .study-layout.course-active .notes-view strong,
        .study-layout.course-active .module-content .notes-view strong {
            color: var(--study-text) !important;
            font-weight: 750;
        }
        .study-layout.notes-active .notes-view blockquote,
        .study-layout.notes-active .ql-editor blockquote,
        .study-layout.course-active .notes-view blockquote {
            border-left-color: var(--study-accent) !important;
            background: var(--study-accent-dim) !important;
        }
        .study-layout.notes-active .notes-view img,
        .study-layout.notes-active .ql-editor img,
        .study-layout.course-active .notes-view img {
            max-width: min(100%, 860px);
            margin: 22px 0;
            border-radius: 18px;
            box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
        }
        .study-layout.notes-active .notes-view h2 .section-num,
        .study-layout.course-active .notes-view h2 .section-num {
            background: var(--study-accent);
        }
        .study-layout.notes-active .notes-callout,
        .study-layout.course-active .notes-callout {
            border-left-color: #0f172a;
            background: rgba(15, 23, 42, 0.05);
        }
        .study-layout.notes-active .notes-callout-label,
        .study-layout.course-active .notes-callout-label {
            color: #0f172a;
        }
        [data-theme="dark"] .study-layout.notes-active .notes-callout,
        [data-theme="dark"] .study-layout.course-active .notes-callout {
            border-left-color: #e2e8f0;
            background: rgba(226, 232, 240, 0.08);
        }
        [data-theme="dark"] .study-layout.notes-active .notes-callout-label,
        [data-theme="dark"] .study-layout.course-active .notes-callout-label {
            color: #e2e8f0;
        }

        .study-layout.course-active .module-nav-group {
            padding: 12px 14px 18px;
        }
        .study-layout.course-active .module-nav-label {
            padding: 12px 14px 10px;
            font-size: 11px;
            letter-spacing: 0.12em;
        }
        .study-layout.course-active .module-nav-item {
            gap: 14px;
            padding: 14px 16px;
            border-radius: 18px;
            font-size: 14px;
            font-weight: 600;
        }
        .study-layout.course-active .module-nav-item:hover {
            background: rgba(255, 255, 255, 0.08);
        }
        .study-layout.course-active .module-nav-item.active {
            background: rgba(255, 255, 255, 0.12);
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
        }
        .study-layout.course-active .module-nav-num {
            min-width: 34px;
            font-size: 12px;
            letter-spacing: 0.08em;
        }
        .study-layout.course-active .module-nav-title {
            white-space: normal;
            line-height: 1.35;
        }

        .module-shell {
            flex: 1 1 auto;
            min-height: 0;
            height: 100%;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
        }
        .module-content.module-content-shell {
            width: 100%;
            max-width: 1100px;
            margin: 0 auto;
            padding: 34px 42px 54px;
        }
        .module-content {
            max-width: none;
            margin: 0;
        }
        .module-hero {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
            align-items: center;
            gap: 34px;
            min-height: 0;
            margin-bottom: 52px;
            padding: 34px 40px;
            border-radius: 28px;
            overflow: hidden;
            background: linear-gradient(135deg, #3d3d3d 0%, #5a4a3a 35%, #8a6b4a 65%, #c4703a 100%);
            box-shadow: 0 30px 70px rgba(60, 40, 20, 0.2);
        }
        [data-theme="light"] .module-hero {
            background: linear-gradient(135deg, #3d3d3d 0%, #5a4a3a 35%, #8a6b4a 65%, #c4703a 100%);
        }
        .module-hero-copy {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 14px;
            min-width: 0;
        }
        .module-hero-kicker {
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            color: rgba(255, 247, 231, 0.76);
        }
        .module-hero-badges {
            margin-bottom: 0;
        }
        .module-hero-badge {
            padding: 7px 14px;
            border-radius: 999px;
            font-size: 11px;
            letter-spacing: 0.08em;
        }
        .module-hero-badge-subject {
            background: rgba(214, 238, 214, 0.16);
            color: #d9f3d7;
        }
        .module-hero-badge-source-youtube {
            background: rgba(255, 206, 198, 0.14);
            color: #ffd1cb;
        }
        .module-hero-badge-source-file {
            background: rgba(255, 245, 223, 0.14);
            color: #f8e6ba;
        }
        .module-hero-title {
            max-width: 720px;
            margin-bottom: 0;
            font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.8rem);
            line-height: 1.12;
            letter-spacing: -0.03em;
        }
        .module-hero-desc {
            max-width: 760px;
            font-size: 0.95rem;
            line-height: 1.75;
            color: rgba(255, 247, 231, 0.85);
        }
        .module-hero-art {
            position: relative;
            width: min(100%, 380px);
            max-width: 380px;
            aspect-ratio: 1 / 1;
            min-height: 0;
            max-height: 380px;
            padding: 12px;
            border-radius: 24px;
            background: linear-gradient(135deg, rgba(245, 180, 95, 0.26), rgba(62, 145, 207, 0.22));
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
            overflow: hidden;
            justify-self: center;
        }
        .module-hero-img {
            position: relative;
            top: auto;
            right: auto;
            width: 100%;
            height: 100%;
            min-height: 0;
            border-radius: 20px;
            object-fit: cover;
            box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
        }
        .module-hero-art-placeholder::before {
            content: '';
            position: absolute;
            inset: 22px 28px auto auto;
            width: 110px;
            height: 110px;
            border-radius: 32px;
            background: radial-gradient(circle at 30% 30%, rgba(255, 236, 184, 0.95), rgba(255, 142, 73, 0.2));
            filter: blur(4px);
        }
        .module-hero-art-glow {
            position: absolute;
            inset: auto auto 26px 26px;
            width: 120px;
            height: 120px;
            border-radius: 50%;
            background: radial-gradient(circle, rgba(255, 247, 194, 0.95), rgba(255, 247, 194, 0.08));
            box-shadow: 0 0 0 8px rgba(255, 96, 133, 0.14);
        }
        .module-hero-art-bars {
            position: absolute;
            right: 34px;
            bottom: 34px;
            width: 130px;
            height: 84px;
            border-radius: 18px;
            background:
                linear-gradient(90deg, transparent 0 8%, rgba(255, 255, 255, 0.14) 8% 12%, transparent 12% 24%, rgba(128, 90, 213, 0.48) 24% 30%, transparent 30% 42%, rgba(255, 183, 77, 0.52) 42% 50%, transparent 50% 62%, rgba(59, 130, 246, 0.46) 62% 70%, transparent 70% 82%, rgba(34, 197, 94, 0.48) 82% 90%, transparent 90%);
            backdrop-filter: blur(4px);
        }
        .module-section-title {
            font-size: clamp(2.4rem, 2rem + 0.8vw, 3.15rem);
            color: #113728;
        }
        [data-theme="dark"] .module-section-title {
            color: #eef3ef;
        }
        .module-divider {
            height: 1px;
            margin: 16px 0 38px;
            background: rgba(15, 23, 42, 0.14);
        }
        [data-theme="dark"] .module-divider {
            background: rgba(255, 255, 255, 0.08);
        }
        .module-content .notes-view {
            max-width: none;
            padding: 0;
            font-size: 18px;
            line-height: 1.88;
            color: var(--study-text);
        }
        .module-content .notes-view h2 {
            margin-top: 54px;
            font-size: 2.15rem;
            color: var(--study-text);
        }
        .module-content .notes-view h3 {
            font-size: 1.38rem;
            color: var(--study-text);
        }
        .module-content .notes-view table,
        .study-layout.course-active .notes-view table {
            border-radius: 22px;
            overflow: hidden;
            border: 1px solid var(--study-border);
            background: var(--study-bg-secondary);
            box-shadow: 0 18px 38px rgba(15, 23, 42, 0.06);
        }
        .module-content .notes-view thead,
        .study-layout.course-active .notes-view thead {
            background: var(--study-accent-dim);
        }
        .module-content .notes-view th,
        .study-layout.course-active .notes-view th {
            padding: 14px 18px;
            font-size: 11px;
            color: var(--study-accent);
        }
        .module-content .notes-view td,
        .study-layout.course-active .notes-view td {
            padding: 16px 18px;
            color: var(--study-text);
            background: var(--study-bg-card, var(--bg-card, #fff));
        }

        .notes-concept-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
            gap: 18px;
            margin: 28px 0 36px;
        }
        .notes-concept-grid-triad {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }
        .notes-concept-grid-quartet {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        .notes-concept-card {
            position: relative;
            padding: 24px 22px 22px;
            border-radius: 24px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: rgba(255, 255, 255, 0.85);
            box-shadow: 0 18px 40px rgba(15, 23, 42, 0.07);
        }
        .notes-concept-card-icon {
            width: 44px;
            height: 44px;
            border-radius: 16px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: rgba(246, 239, 227, 0.95);
            box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
            font-size: 22px;
            margin-bottom: 14px;
        }
        [data-theme="dark"] .notes-concept-card {
            border-color: rgba(255, 255, 255, 0.08);
            background: rgba(19, 25, 30, 0.84);
            box-shadow: none;
        }
        [data-theme="dark"] .notes-concept-card-icon {
            background: rgba(255, 255, 255, 0.06);
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
        }
        .notes-concept-card-kicker {
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: #6a7d70;
            margin-bottom: 12px;
        }
        .notes-concept-card-title {
            font-size: 1.38rem;
            font-weight: 700;
            line-height: 1.24;
            margin-bottom: 12px;
            color: #0f2b20;
        }
        .notes-concept-card-body,
        .notes-concept-card-body p,
        .notes-concept-card-body li {
            font-size: 15px;
            line-height: 1.72;
            color: #45504a;
        }
        [data-theme="dark"] .notes-concept-card-kicker {
            color: #8ca598;
        }
        [data-theme="dark"] .notes-concept-card-title {
            color: #f1f5f2;
        }
        [data-theme="dark"] .notes-concept-card-body,
        [data-theme="dark"] .notes-concept-card-body p,
        [data-theme="dark"] .notes-concept-card-body li {
            color: #c3ccd2;
        }

        .notes-step-flow {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
            gap: 0;
            margin: 30px 0 40px;
            overflow: hidden;
            border-radius: 28px;
            box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
        }
        .notes-step-card {
            position: relative;
            min-height: 188px;
            padding: 26px 22px 24px;
            color: #fff;
            display: flex;
            flex-direction: column;
            gap: 14px;
        }
        .notes-step-card:nth-child(1) { background: #2f64ea; }
        .notes-step-card:nth-child(2) { background: #f5a116; }
        .notes-step-card:nth-child(3) { background: #18b37e; }
        .notes-step-card:nth-child(4) { background: #ef4f4f; }
        .notes-step-card:nth-child(5) { background: #6d5ef6; }
        .notes-step-flow-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        .notes-step-flow-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
        .notes-step-flow-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
        .notes-step-card:not(:last-child) {
            clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 50%, calc(100% - 26px) 100%, 0 100%, 18px 50%);
            padding-right: 36px;
        }
        .notes-step-kicker {
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: rgba(255, 255, 255, 0.78);
        }
        .notes-step-copy,
        .notes-step-copy p,
        .notes-step-copy li {
            color: #fff;
            font-size: 15px;
            line-height: 1.62;
        }
        .notes-step-copy strong {
            color: #fff !important;
        }

        .module-footer-nav {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
            margin-top: 42px;
            padding-top: 22px;
            border-top: 1px solid rgba(15, 23, 42, 0.12);
        }
        [data-theme="dark"] .module-footer-nav {
            border-top-color: rgba(255, 255, 255, 0.08);
        }
        .module-footer-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 13px 20px;
            border-radius: 999px;
            border: 1px solid rgba(15, 23, 42, 0.14);
            background: rgba(255, 255, 255, 0.75);
            color: var(--study-text-secondary);
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            font-family: inherit;
            transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
        }
        .module-footer-btn:hover {
            transform: translateY(-1px);
            border-color: rgba(16, 63, 43, 0.3);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
        }
        .module-footer-btn-primary {
            border: none;
            background: #103f2b;
            color: #fff;
            box-shadow: 0 14px 26px rgba(16, 63, 43, 0.22);
        }
        .module-footer-btn-primary.is-complete {
            background: #185238;
        }
        [data-theme="dark"] .module-footer-btn {
            border-color: rgba(255, 255, 255, 0.08);
            background: rgba(19, 25, 30, 0.84);
            color: #d7dde2;
            box-shadow: none;
        }
        [data-theme="dark"] .module-footer-btn-primary {
            background: #2f7a57;
            color: #fff;
        }
        .module-progress {
            margin-top: 16px;
            text-align: center;
            font-size: 12px;
            color: var(--study-text-tertiary);
        }
        .module-inline-heading {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 18px;
            margin: 10px 0 34px;
            text-align: center;
        }
        .module-inline-num {
            width: 42px;
            height: 42px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: #0e4b2f;
            color: #fff;
            font-size: 1.1rem;
            font-weight: 800;
            box-shadow: 0 10px 22px rgba(14, 75, 47, 0.18);
            flex-shrink: 0;
        }
        .module-inline-copy {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0;
        }
        .module-inline-title {
            font-family: 'Georgia', 'Times New Roman', serif;
            font-size: clamp(2rem, 1.6rem + 0.8vw, 2.75rem);
            font-weight: 500;
            line-height: 1.12;
            color: #123426;
            letter-spacing: -0.03em;
        }
        .module-inline-kicker {
            font-size: 11px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.16em;
            color: #6f7d76;
        }
        [data-theme="dark"] .module-inline-num {
            background: #2d8a5e;
            box-shadow: none;
        }
        [data-theme="dark"] .module-inline-title {
            color: #eef3ef;
        }
        [data-theme="dark"] .module-inline-kicker {
            color: #8ea197;
        }
        .notes-table-shell {
            overflow-x: auto;
            margin: 26px 0 34px;
            border-radius: 26px;
            border: 1px solid rgba(181, 160, 124, 0.34);
            background: rgba(255, 252, 247, 0.9);
            box-shadow: 0 18px 38px rgba(15, 23, 42, 0.05);
        }
        [data-theme="dark"] .notes-table-shell {
            border-color: rgba(255, 255, 255, 0.08);
            background: rgba(19, 25, 30, 0.84);
            box-shadow: none;
        }
        .notes-summary {
            position: relative;
            overflow: hidden;
        }
        .notes-summary-watermark {
            position: absolute;
            right: 28px;
            top: 34px;
            font-size: 7rem;
            line-height: 0.8;
            font-weight: 700;
            color: rgba(186, 165, 132, 0.12);
            pointer-events: none;
            user-select: none;
        }
        [data-theme="dark"] .notes-summary-watermark {
            color: rgba(255, 255, 255, 0.05);
        }

        @media (max-width: 1180px) {
            .study-layout.course-active {
                --sidebar-w: 292px;
            }
            .module-content.module-content-shell {
                padding: 28px 26px 48px;
            }
            .notes-concept-grid-triad,
            .notes-concept-grid-quartet,
            .notes-step-flow-3,
            .notes-step-flow-4,
            .notes-step-flow-5 {
                grid-template-columns: 1fr;
            }
            .module-hero {
                grid-template-columns: 1fr;
                min-height: 0;
            }
            .module-hero-art {
                width: min(100%, 320px);
                max-width: 320px;
                max-height: 320px;
                justify-self: start;
            }
            .notes-step-flow {
                grid-template-columns: 1fr;
            }
            .notes-step-card:not(:last-child) {
                clip-path: none;
                padding-right: 22px;
            }
        }
        @media (max-width: 768px) {
            .study-layout.notes-active .detail-main-inner.mode-reading,
            .study-layout.course-active .detail-main-inner.mode-reading {
                padding: 0 0 18px 8px;
            }
            .study-layout.notes-active .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow,
            .study-layout.course-active .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow {
                margin-right: 8px;
                border-radius: 18px !important;
                padding: 12px 14px;
            }
            .module-content.module-content-shell {
                padding: 22px 18px 36px;
            }
            .module-hero {
                padding: 26px 22px;
                border-radius: 22px;
                gap: 20px;
            }
            .module-inline-heading {
                gap: 14px;
                margin: 8px 0 26px;
            }
            .module-inline-num {
                width: 38px;
                height: 38px;
                font-size: 1rem;
            }
            .module-inline-title {
                font-size: 1.9rem;
            }
            .module-hero-title {
                font-size: clamp(2.15rem, 1.7rem + 2vw, 2.8rem);
            }
            .module-footer-nav {
                flex-direction: column;
                align-items: stretch;
            }
            .module-footer-nav > * {
                width: 100%;
                justify-content: center;
            }
            .notes-concept-grid {
                grid-template-columns: 1fr;
            }
        }

        /* ===== Detail Shell Refresh ===== */
        .study-layout.detail-active {
            background: #eef2f6;
        }
        .study-layout.detail-active .detail-topbar {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 60;
            background: #f2f4f6;
            border-bottom: 1px solid transparent;
            box-shadow: none;
            height: 60px;
            padding: 0 20px 0 24px;
        }
        .study-layout.detail-active .detail-topbar-title {
            font-family: 'Inika', 'Georgia', 'Times New Roman', serif;
            font-size: clamp(1.45rem, 1.1rem + 0.45vw, 1.95rem);
            font-weight: 700;
            letter-spacing: -0.02em;
            text-transform: none !important;
            color: #25303b;
        }
        .detail-topbar-title-button {
            border: none;
            background: transparent;
            padding: 0;
            margin: 0;
            cursor: pointer;
            text-align: left;
            font-family: inherit;
            color: inherit;
        }
        .study-layout.detail-active .detail-topbar-right {
            color: #5f6b78;
        }
        .study-layout.detail-active .study-sidebar {
            padding-top: 60px;
            height: 100vh;
            box-sizing: border-box;
            width: 286px;
            min-width: 286px;
            max-width: 286px;
            border-right: none !important;
        }
        .study-layout.detail-active .study-main {
            padding-top: 60px;
            min-height: 100vh;
            box-sizing: border-box;
        }
        .study-layout.detail-active .detail-layout {
            padding: 0;
            gap: 0;
            background: #eef2f6;
        }
        .study-layout.detail-active .study-sidebar {
            background: #e7ebef;
            border-right: none !important;
            box-shadow: none;
        }
        .study-layout.detail-active .sidebar-brand-wrap {
            display: none;
        }
        .study-layout.detail-active .sidebar-nav {
            padding-top: 10px;
        }
        .study-layout.detail-active #navDetail {
            display: flex;
            flex-direction: column;
            min-height: 0;
            height: 100%;
        }
        .study-layout.detail-active #detailMethods {
            flex: 1;
            min-height: 0;
            overflow-y: auto;
            padding: 6px 10px 12px;
            display: flex;
            flex-direction: column;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }
        .study-layout.detail-active #detailMethods::-webkit-scrollbar { width: 0; height: 0; }
        .study-layout.detail-active .detail-group-heading {
            padding: 12px 10px 8px;
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.16em;
            color: #8b6317;
            text-transform: uppercase;
        }
        .study-layout.detail-active .detail-group-heading-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }
        .study-layout.detail-active .detail-group-heading-text {
            min-width: 0;
        }
        .study-layout.detail-active .detail-section-collapse {
            width: 26px;
            height: 26px;
            border: none;
            border-radius: 8px;
            background: transparent;
            color: #707a86;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            flex-shrink: 0;
            transition: background 0.15s, color 0.15s;
        }
        .study-layout.detail-active .detail-section-collapse:hover {
            background: #dfe5eb;
            color: #37414c;
        }
        .study-layout.detail-active .module-nav-group-inline {
            padding: 0 2px 10px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
.study-layout.detail-active .module-nav-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    color: var(--study-text-secondary);
    background: transparent;
    text-align: left;
    border: 1px solid transparent;
    box-shadow: none;
}
        .study-layout.detail-active .module-nav-item:hover {
            background: var(--bg-elevated);
        }
        .study-layout.detail-active .module-nav-item.active {
            background: var(--bg-raised);
            box-shadow: 0 12px 22px rgba(99, 115, 129, 0.08);
            border: 1px solid var(--border-default);
}
.study-layout.detail-active .module-nav-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding-top: 0;
    font-size: 11px;
    color: var(--accent-amber);
    text-align: center;
    border-radius: 12px;
    background: color-mix(in srgb, var(--glow-amber) 88%, var(--bg-raised));
    font-weight: 800;
}
.study-layout.detail-active .module-nav-body {
    align-items: flex-start;
    gap: 3px;
}
.study-layout.detail-active .module-nav-kicker {
    color: var(--text-tertiary);
}
.study-layout.detail-active .module-nav-title {
    display: block;
    width: 100%;
    margin: 0;
    flex: 0 0 auto;
    white-space: normal;
    line-height: 1.24;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: left;
}
.study-layout.detail-active .module-nav-item.active .module-nav-title {
    color: var(--text-primary);
}
        .study-layout.detail-active .module-nav-check {
            display: inline-flex !important;
            color: var(--text-tertiary);
        }
        .study-layout.detail-active .module-nav-item[data-module-state="active"] .module-nav-kicker,
        .study-layout.detail-active .module-nav-item[data-module-state="active"] .module-nav-check {
            color: var(--accent-orange);
        }
        .study-layout.detail-active .module-nav-item[data-module-state="completed"] .module-nav-kicker,
        .study-layout.detail-active .module-nav-item.completed .module-nav-check {
            color: #059669;
        }
        .study-layout.detail-active #navDetail .method-nav {
            border-radius: 12px;
            padding: 9px 10px;
            margin-bottom: 3px;
            color: var(--text-secondary);
            border: none;
            box-shadow: none;
        }
        .study-layout.detail-active #navDetail .method-nav:hover {
            background: var(--bg-elevated);
        }
        .study-layout.detail-active #navDetail .method-nav.active {
            background: var(--bg-raised);
            color: var(--text-primary);
            box-shadow: 0 10px 22px rgba(99, 115, 129, 0.06);
        }
        .study-layout.detail-active .detail-main {
            position: relative;
            z-index: 1;
            background: var(--bg-base);
            border: none;
            border-radius: 0;
            box-shadow: none;
        }
        .study-layout.detail-active .detail-right {
            position: fixed;
            top: 78px;
            right: 18px;
            bottom: 18px;
            width: min(390px, 34vw);
            min-width: 340px;
            max-width: 420px;
            height: auto;
            z-index: 55;
            margin: 0;
            border-radius: 20px;
            box-shadow: 0 22px 50px rgba(61, 73, 89, 0.18);
            background: var(--bg-raised);
            border-color: var(--border-default);
        }
        .study-layout.detail-active .detail-layout.sidebar-hidden .detail-right {
            width: min(390px, 34vw) !important;
            min-width: 340px;
            transform: translateX(calc(100% + 24px));
            opacity: 0;
            pointer-events: none;
        }
        .study-layout.detail-active .sidebar-resize-handle,
        .study-layout.detail-active .right-sidebar-reopen {
            display: none !important;
        }
        .study-layout.detail-active #topbarChatToggle {
            display: inline-flex !important;
        }
        .detail-sidebar-bottom {
            padding: 14px 10px 10px;
            border-top: none;
        }
        .detail-sidebar-back {
            width: 100%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 12px 14px;
            border: 1px solid transparent;
            border-radius: 16px;
            background: var(--bg-elevated);
            color: var(--text-primary);
            font-size: 13px;
            font-weight: 700;
            font-family: inherit;
            cursor: pointer;
            transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
        }
        .detail-sidebar-back:hover {
            transform: translateY(-1px);
            box-shadow: 0 12px 26px rgba(99, 115, 129, 0.08);
            background: var(--bg-raised);
        }
        .detail-sidebar-back i {
            width: 14px;
            height: 14px;
        }
        [data-theme="light"] .study-layout.detail-active .detail-main-inner.mode-reading #quillEditorShell {
            background: #ffffff;
            border-color: #d7dee7;
        }
        [data-theme="light"] .study-layout.detail-active .detail-main-inner.mode-reading #quillEditorShell > .ql-toolbar.ql-snow {
            background: #f8fafc !important;
            border-color: #d7dee7 !important;
        }
        [data-theme="light"] .study-layout.detail-active .detail-main-inner.mode-reading #quillEditorShell > .ql-container.ql-snow {
            background: #ffffff;
            border-color: #d7dee7 !important;
        }
        /* strong color handled by var(--study-text) globally */
        .study-layout.detail-active.sidebar-collapsed .study-sidebar {
            width: var(--sidebar-w-collapsed);
            min-width: var(--sidebar-w-collapsed);
            max-width: var(--sidebar-w-collapsed);
        }
        .study-layout.detail-active.sidebar-collapsed .detail-group-heading-row {
            display: flex !important;
            justify-content: center;
            padding-left: 0;
            padding-right: 0;
        }
        .study-layout.detail-active.sidebar-collapsed .detail-group-heading-text {
            display: none;
        }
        .study-layout.detail-active.sidebar-collapsed .detail-section-collapse {
            background: var(--bg-elevated);
        }
        .study-layout.detail-active.sidebar-collapsed .module-nav-group-inline {
            padding: 2px 0 10px;
            align-items: center;
            gap: 10px;
        }
        .study-layout.detail-active.sidebar-collapsed #detailMethods {
            padding-left: 6px;
            padding-right: 6px;
            align-items: center;
        }
        .study-layout.detail-active.sidebar-collapsed .module-nav-item {
            width: 44px;
            min-height: 52px;
            padding: 8px 0;
            grid-template-columns: 1fr;
            justify-content: center;
            align-items: center;
            border-radius: 18px;
            border: 1px solid transparent;
            box-shadow: none;
        }
        .study-layout.detail-active.sidebar-collapsed .module-nav-item.active {
            background: var(--bg-raised);
            border-color: var(--border-default);
            box-shadow: 0 10px 22px rgba(99, 115, 129, 0.08);
        }
        .study-layout.detail-active.sidebar-collapsed .module-nav-body,
        .study-layout.detail-active.sidebar-collapsed .module-nav-check {
            display: none !important;
        }
        .study-layout.detail-active.sidebar-collapsed .module-nav-title {
            display: none;
        }
        .study-layout.detail-active.sidebar-collapsed .module-nav-num {
            min-width: 0;
            padding-top: 0;
            width: 30px;
            height: 30px;
            font-size: 13px;
            font-weight: 800;
            line-height: 1;
        }
        .study-layout.detail-active.sidebar-collapsed #navDetail .method-nav {
            width: 44px;
            min-height: 44px;
            padding: 10px 0;
            justify-content: center;
            border-radius: 14px;
        }
        .study-layout.detail-active.sidebar-collapsed .detail-sidebar-bottom {
            padding: 12px 6px 10px;
        }
        .study-layout.detail-active.sidebar-collapsed .detail-sidebar-back {
            width: 44px;
            min-width: 44px;
            height: 44px;
            padding: 0;
            border-radius: 14px;
            gap: 0;
            justify-content: center;
        }
        .study-layout.detail-active.sidebar-collapsed .detail-sidebar-back-label {
            display: none;
        }
        .study-layout.course-active .module-hero {
            grid-template-columns: minmax(0, 1fr) minmax(0, 470px);
        }
        .study-layout.course-active .module-hero-art {
            width: min(100%, 470px);
            max-width: 470px;
            aspect-ratio: 1.55 / 1;
            max-height: 304px;
        }
        .study-layout.course-active .module-hero-img {
            object-position: center;
        }
        @media (max-width: 1180px) {
            .study-layout.course-active .module-hero {
                grid-template-columns: 1fr;
            }
            .study-layout.course-active .module-hero-art {
                width: min(100%, 380px);
                max-width: 380px;
                aspect-ratio: 1.35 / 1;
                max-height: 282px;
                justify-self: start;
            }
        }
        @media (max-width: 768px) {
            .study-layout.detail-active .detail-topbar {
                height: 56px;
                padding: 0 14px;
            }
            .study-layout.detail-active .detail-topbar-title {
                font-size: 1.15rem;
            }
            .study-layout.detail-active .study-sidebar {
                background: var(--bg-raised);
            }
            .study-layout.detail-active .detail-right {
                display: none !important;
            }
            .study-layout.detail-active #topbarChatToggle {
                display: none !important;
            }
            .detail-sidebar-bottom {
                padding: 10px 8px 8px;
            }
        }

        /* === Study detail refresh: theme-driven palette aligned with Settings themes === */
        body[data-scheme] .study-layout.detail-active {
            --study-accent: var(--accent-amber);
            --study-accent-hover: var(--accent-orange);
            --study-accent-dim: var(--glow-amber);
            background: var(--bg-base);
        }
        body[data-scheme] .study-layout.detail-active .detail-topbar,
        body[data-scheme] .study-layout.detail-active .detail-main,
        body[data-scheme] .study-layout.detail-active .detail-right {
            background: var(--bg-raised);
            border-color: var(--border-default);
        }
        body[data-scheme] .study-layout.detail-active .detail-topbar {
            background: color-mix(in srgb, var(--bg-base) 84%, var(--bg-elevated) 16%);
            border-bottom-color: transparent;
            box-shadow: none;
        }
        body[data-scheme] .study-layout.detail-active .detail-layout,
        body[data-scheme] .study-layout.detail-active .study-main,
        body[data-scheme] .study-layout.notes-active .detail-main,
        body[data-scheme] .study-layout.course-active .detail-main {
            background: var(--bg-base);
        }
        body[data-scheme] .study-layout.detail-active .detail-layout {
            gap: 0;
        }
        body[data-scheme] .study-layout.detail-active .study-sidebar {
            background: color-mix(in srgb, var(--bg-base) 70%, var(--bg-elevated) 30%);
            border-right: none !important;
            box-shadow: none;
        }
        body[data-scheme] .study-layout.detail-active .detail-main {
            background: var(--bg-base);
            border: none;
            border-radius: 0;
            box-shadow: none;
        }
        body[data-scheme] .study-layout.detail-active .detail-topbar-title,
        body[data-scheme] .study-layout.detail-active .module-inline-title {
            color: var(--text-primary);
        }
        body[data-scheme] .study-layout.detail-active .detail-topbar-right,
        body[data-scheme] .study-layout.detail-active .module-inline-kicker,
        body[data-scheme] .study-layout.detail-active .module-progress,
        body[data-scheme] .study-layout.detail-active .module-nav-title,
        body[data-scheme] .study-layout.detail-active #navDetail .method-nav {
            color: var(--text-secondary);
        }
        body[data-scheme] .study-layout.detail-active .detail-group-heading,
        body[data-scheme] .study-layout.detail-active .method-nav-group-label {
            color: color-mix(in srgb, var(--text-secondary) 78%, var(--accent-amber) 22%);
        }
        body[data-scheme] .study-layout.detail-active .module-nav-num {
            color: color-mix(in srgb, var(--text-secondary) 62%, var(--accent-amber) 38%);
        }
        body[data-scheme] .study-layout.detail-active .module-nav-kicker,
        body[data-scheme] .study-layout.detail-active .module-nav-check {
            color: var(--text-tertiary);
        }
        body[data-scheme] .study-layout.detail-active .module-nav-item,
        body[data-scheme] .study-layout.detail-active #navDetail .method-nav {
            border: 1px solid transparent;
        }
        body[data-scheme] .study-layout.detail-active .module-nav-item {
            padding: 8px 10px;
            gap: 8px;
            border-radius: 14px;
        }
        body[data-scheme] .study-layout.detail-active .detail-group-heading,
        body[data-scheme] .study-layout.detail-active .method-nav-group-label {
            letter-spacing: 0.14em;
        }
        body[data-scheme] .study-layout.detail-active .method-nav-group-sep,
        body[data-scheme] .study-layout.detail-active .detail-sidebar-bottom {
            border-top: none;
        }
        body[data-scheme] .study-layout.detail-active .module-nav-item:hover,
        body[data-scheme] .study-layout.detail-active #navDetail .method-nav:hover {
            background: var(--bg-elevated);
        }
        body[data-scheme] .study-layout.detail-active .module-nav-item.active,
        body[data-scheme] .study-layout.detail-active #navDetail .method-nav.active,
        body[data-scheme] .study-layout.detail-active.sidebar-collapsed .module-nav-item.active {
            background: var(--bg-raised);
            border-color: transparent;
            box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
        }
        body[data-scheme] .study-layout.detail-active .detail-add-method-btn,
        body[data-scheme] .study-layout.detail-active #topbarChatToggle,
        body[data-scheme] .study-layout.detail-active .detail-sidebar-back {
            background: var(--bg-elevated) !important;
            border-color: transparent !important;
            box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
        }
        body[data-scheme] .study-layout.detail-active .detail-add-method-btn:hover,
        body[data-scheme] .study-layout.detail-active #topbarChatToggle:hover,
        body[data-scheme] .study-layout.detail-active .detail-sidebar-back:hover {
            background: var(--bg-raised) !important;
        }
        body[data-scheme] .study-layout.detail-active:not(.notes-active):not(.course-active) .detail-main {
            background: transparent;
            border: none;
            border-radius: 0;
            box-shadow: none;
        }
        body[data-scheme] .study-layout.detail-active:not(.notes-active):not(.course-active) .detail-main-inner {
            padding: 22px 26px 30px;
        }

        .sg2-hero-actions {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }
        .sg2-main-solo {
            width: 100%;
        }
        .sg2-next-card,
        .sg2-priority-card,
        .sg2-current-card {
            border-radius: 24px;
            background: var(--bg-raised);
            border: 1px solid var(--border-default);
            box-shadow: 0 16px 36px rgba(15, 23, 42, 0.05);
        }
        .sg2-phase-card,
        .sg2-side-card {
            border-color: var(--border-default);
            box-shadow: 0 16px 36px rgba(15, 23, 42, 0.05);
        }
        body[data-scheme] .study-layout.detail-active:not(.notes-active):not(.course-active) .sg2-next-card,
        body[data-scheme] .study-layout.detail-active:not(.notes-active):not(.course-active) .sg2-current-card,
        body[data-scheme] .study-layout.detail-active:not(.notes-active):not(.course-active) .sg2-phase-card,
        body[data-scheme] .study-layout.detail-active:not(.notes-active):not(.course-active) .sg2-side-card {
            background: var(--bg-base);
            box-shadow: none;
        }
        .sg2-step-instruction {
            background: color-mix(in srgb, var(--bg-elevated) 92%, var(--glow-amber));
            border-left: 3px solid var(--border-default);
            color: var(--text-secondary);
            font-style: italic;
        }
        .sg2-step-instruction span {
            display: none;
        }
        .sg2-btn-primary {
            color: #111827;
            background: color-mix(in srgb, var(--accent-amber) 76%, #cb8c52);
            border: 2px solid #111827;
            box-shadow: 3px 3px 0 rgba(17,24,39,.24);
        }
        .sg2-btn-primary:hover {
            transform: translate(-1px,-1px);
            box-shadow: 4px 4px 0 rgba(17,24,39,.28);
        }
        .sg2-btn-secondary {
            background: var(--bg-base);
            color: var(--text-primary);
            border: 1px solid var(--border-default);
            box-shadow: none;
        }
        .sg2-btn-secondary:hover {
            background: var(--bg-elevated);
        }
        .sg2-phase-summary-actions .sg2-phase-tool {
            white-space: nowrap;
        }
        .sg2-step-action {
            border-color: var(--border-default);
            background: var(--bg-elevated);
            color: var(--text-primary);
        }
        .sg2-phase-tools {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 10px;
            margin-top: 18px;
            padding-top: 18px;
            border-top: 1px solid var(--border-subtle);
        }
        .sg2-phase-tool {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 11px 16px;
            border-radius: 12px;
            border: none;
            background: color-mix(in srgb, var(--bg-elevated) 94%, var(--bg-raised));
            color: var(--text-primary);
            font-size: 12px;
            font-weight: 800;
            cursor: pointer;
            font-family: inherit;
            transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
            box-shadow: none;
            min-height: 46px;
        }
        .sg2-phase-tool:hover {
            background: color-mix(in srgb, var(--bg-raised) 96%, var(--bg-base));
        }
        .sg2-phase-tool.is-primary {
            background: color-mix(in srgb, var(--accent-amber) 78%, #a96038);
            color: #fff;
            box-shadow: 0 10px 22px rgba(163, 96, 56, 0.18);
        }
        .sg2-phase-tool.is-primary:hover {
            background: color-mix(in srgb, var(--accent-amber) 84%, #b16a43);
        }
        .sg2-phase-tool.is-secondary {
            background: color-mix(in srgb, var(--bg-elevated) 94%, var(--bg-raised));
            color: var(--text-primary);
            box-shadow: none;
        }
        .sg2-phase-tool.is-secondary:hover {
            background: color-mix(in srgb, var(--bg-raised) 96%, var(--bg-base));
        }
        .sg2-phase-tool i {
            width: 14px;
            height: 14px;
        }
        .sg2-phase-tool.is-generating {
            opacity: 0.9;
            cursor: wait;
        }
        .sg2-phase-tool-spinner {
            width: 14px;
            height: 14px;
            border: 2px solid rgba(148, 163, 184, 0.28);
            border-top-color: var(--study-accent);
            border-radius: 999px;
            animation: spin 0.8s linear infinite;
            flex-shrink: 0;
        }
        .sg-scope-bar {
            display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px;
            padding: 10px 14px; border: 1.5px solid var(--border-default); border-radius: 14px;
            background: var(--bg-raised);
            box-shadow: 0 2px 8px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.4);
        }
        .sg-scope-head {
            display: flex; align-items: center; justify-content: space-between; gap: 12px;
        }
        .sg-scope-title {
            font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
            color: var(--accent-amber); padding: 3px 10px; border-radius: 6px;
            background: color-mix(in srgb, var(--accent-amber) 10%, transparent);
            border: 1px solid color-mix(in srgb, var(--accent-amber) 20%, transparent);
        }
        .sg-scope-subtitle { display: none; }
        .sg-scope-count {
            font-size: 11px; font-weight: 800; color: var(--text-secondary);
            white-space: nowrap; letter-spacing: 0.02em;
        }
        .sg-scope-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
        .sg-scope-chip {
            display: inline-flex; align-items: center; justify-content: center;
            padding: 6px 12px; border-radius: 10px;
            border: 1.5px solid var(--border-default); background: var(--bg-elevated);
            color: var(--text-primary); font-size: 11px; font-weight: 700;
            cursor: pointer; font-family: inherit;
            transition: all 0.15s; box-shadow: 2px 2px 0 rgba(0,0,0,0.08);
        }
        .sg-scope-chip:hover {
            transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--study-accent-dim, rgba(232,133,58,0.15));
            border-color: color-mix(in srgb, var(--accent-amber) 40%, var(--border-default));
        }
        .sg-scope-chip.active {
            border-color: var(--accent-amber);
            background: color-mix(in srgb, var(--accent-amber) 12%, transparent);
            color: var(--accent-orange); font-weight: 800;
            box-shadow: 2px 2px 0 rgba(232,133,58,0.2), inset 0 1px 0 rgba(255,255,255,0.3);
        }
        .sg2-tool-card {
            background: var(--bg-raised);
            border-color: var(--border-default);
        }
        .sg2-tool-card:hover {
            border-color: color-mix(in srgb, var(--accent-amber) 44%, var(--border-default));
            box-shadow: 0 14px 28px rgba(15, 23, 42, 0.06);
        }
        .sg2-side-title,
        .sg2-section-title,
        .sg2-next-title,
        .sg2-ready-score {
            color: #111827;
        }
        .sg2-title {
            color: var(--text-primary);
        }
        .sg2-priority-title {
            color: var(--text-primary);
        }
        .sg2-subtitle,
        .sg2-next-detail,
        .sg2-next-reason,
        .sg2-priority-detail,
        .sg2-priority-reason,
        .sg2-side-item-detail,
        .sg2-ready-copy {
            color: var(--text-secondary);
        }
        .sg2-priority-reason {
            color: var(--text-tertiary);
        }

        .module-hero {
            background: linear-gradient(135deg, var(--study-hero-start) 0%, var(--study-hero-mid) 52%, var(--study-hero-end) 100%);
            box-shadow: 0 26px 60px rgba(15, 23, 42, 0.16);
        }
        .module-hero-kicker {
            color: rgba(226, 232, 240, 0.82);
        }
        .module-hero-badge-subject {
            background: rgba(255, 255, 255, 0.12);
            color: #f8fafc;
        }
        .module-hero-badge-source-youtube {
            background: rgba(254, 205, 211, 0.18);
            color: #ffe4e6;
        }
        .module-hero-badge-source-file {
            background: rgba(191, 219, 254, 0.2);
            color: #dbeafe;
        }
        .module-hero-title,
        .module-inline-title {
            font-family: 'Inika', 'Georgia', 'Times New Roman', serif;
        }
        .module-hero-title {
            color: #f8fafc;
        }
        .module-hero-art {
            width: min(100%, 470px);
            max-width: 470px;
            aspect-ratio: 1.7 / 1;
            max-height: 296px;
            padding: 10px;
            border-radius: 28px;
            background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(148,163,184,0.12));
        }
        .module-hero-art-fallback {
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14), 0 18px 36px rgba(15, 23, 42, 0.18);
        }
        .module-hero-fallback-img {
            width: min(100%, 430px);
            height: auto;
            max-height: 100%;
            object-fit: contain;
            filter: drop-shadow(0 18px 28px rgba(15, 23, 42, 0.2));
        }
        .module-hero-img {
            border-radius: 22px;
        }
        .module-hero-art-placeholder::before {
            inset: 20px 24px auto auto;
            width: 124px;
            height: 124px;
            background: radial-gradient(circle at 30% 30%, rgba(253, 224, 71, 0.92), rgba(251, 146, 60, 0.18));
        }
        .module-hero-art-glow {
            inset: auto auto 26px 26px;
            width: 122px;
            height: 122px;
            background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(96, 165, 250, 0.12));
            box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.14);
        }
        .module-hero-art-bars {
            right: 28px;
            bottom: 30px;
            width: 142px;
            height: 88px;
        }
        .module-inline-num {
            background: var(--study-hero-end);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
        }
        .module-inline-title {
            color: #0f172a;
        }
        .module-inline-kicker {
            color: #64748b;
        }
        .module-footer-nav {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
        }
        .module-footer-nav > :first-child {
            justify-self: start;
        }
        .module-footer-nav > :nth-child(2) {
            justify-self: center;
        }
        .module-footer-nav > :last-child {
            justify-self: end;
        }
        .module-footer-btn-primary {
            background: #0f172a;
            box-shadow: 0 14px 26px rgba(15, 23, 42, 0.18);
        }
        .module-footer-btn-primary.is-complete {
            background: #1d4ed8;
        }

        .notes-step-flow {
            box-shadow: 0 18px 38px rgba(15, 23, 42, 0.07);
        }
        .notes-step-card:nth-child(1) { background: linear-gradient(135deg, #2563eb, #3b82f6); }
        .notes-step-card:nth-child(2) { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
        .notes-step-card:nth-child(3) { background: linear-gradient(135deg, #10b981, #34d399); }
        .notes-step-card:nth-child(4) { background: linear-gradient(135deg, #ef4444, #f87171); }
        .notes-step-card:nth-child(5) { background: linear-gradient(135deg, #6366f1, #8b5cf6); }

        .notes-step-grid,
        .notes-step-stack {
            margin: 30px 0 40px;
        }
        .notes-step-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 16px;
        }
        .notes-step-grid-card {
            padding: 22px 20px;
            border-radius: 22px;
            background: #ffffff;
            border: 1px solid rgba(148, 163, 184, 0.18);
            box-shadow: 0 16px 34px rgba(15, 23, 42, 0.05);
        }
        .notes-step-grid-num {
            width: 38px;
            height: 38px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 14px;
            background: #eff6ff;
            color: #2563eb;
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.08em;
        }
        .notes-step-grid-copy,
        .notes-step-grid-copy p,
        .notes-step-grid-copy li {
            color: #334155;
            font-size: 15px;
            line-height: 1.72;
        }
        .notes-step-stack {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .notes-step-stack-item {
            display: grid;
            grid-template-columns: auto 1fr;
            gap: 16px;
            align-items: start;
            padding: 18px 20px;
            border-radius: 20px;
            background: #ffffff;
            border: 1px solid rgba(148, 163, 184, 0.18);
            box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
        }
        .notes-step-stack-num {
            width: 34px;
            height: 34px;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: #fff7ed;
            color: #c2410c;
            font-size: 14px;
            font-weight: 800;
        }
        .notes-step-stack-copy,
        .notes-step-stack-copy p,
        .notes-step-stack-copy li {
            color: #334155;
            font-size: 15px;
            line-height: 1.72;
        }

        @media (max-width: 768px) {
            .module-footer-nav {
                grid-template-columns: 1fr;
            }
            .module-footer-nav > * {
                width: 100%;
                justify-self: stretch;
                justify-content: center;
            }
            .sg2-hero-actions {
                flex-direction: column;
                align-items: stretch;
            }
            .notes-step-grid {
                grid-template-columns: 1fr;
            }
        }

        /* ── Focus task input placeholder ── */
        #focusTaskInput::placeholder { color:#fff !important; opacity:0.8 !important; text-shadow:0 1px 3px rgba(0,0,0,0.6) !important; }

        /* ── Onboarding method cards ── */
        .ob2-method-card:hover { border-color:#c4c9d0; transform:translateY(-1px); box-shadow:0 4px 12px rgba(0,0,0,0.06); }
        .ob2-method-card.selected { border-color:#a855f7 !important; background:rgba(168,85,247,0.04) !important; box-shadow:0 0 0 3px rgba(168,85,247,0.1); }

        /* ── Onboarding demo ── */
        @keyframes ob2DemoPulse { 0%,100%{transform:scale(1);opacity:1;} 50%{transform:scale(1.04);opacity:0.85;} }
        #ob2DemoResult::-webkit-scrollbar { width:4px; }
        #ob2DemoResult::-webkit-scrollbar-track { background:transparent; }
        #ob2DemoResult::-webkit-scrollbar-thumb { background:rgba(0,0,0,0.1);border-radius:99px; }
        .ob2-demo-pill { background:rgba(0,0,0,0.03);border:1px solid rgba(0,0,0,0.06); }
        .ob2-demo-pill div:first-child { color:rgba(33,28,24,0.35); }
        .ob2-demo-pill div:last-child { color:rgba(33,28,24,0.5); }
        .ob2-demo-pill.active { background:rgba(193,114,78,0.12);border-color:rgba(193,114,78,0.25); }
        .ob2-demo-pill.active div:first-child { color:rgba(193,114,78,0.7); }
        .ob2-demo-pill.active div:last-child { color:#211C18; }
        .ob2-demo-pill:hover:not(.active) { background:rgba(0,0,0,0.05);border-color:rgba(0,0,0,0.1); }

        /* ── Onboarding flashcard + quiz ── */
        .ob2-fc-card.flipped .ob2-fc-inner { transform: rotateY(180deg); }
        .ob2-fc-rate:hover { transform:translateY(-1px); box-shadow:0 4px 12px rgba(0,0,0,0.08); }
        .ob2-quiz-opt:hover:not(.ob2-quiz-answered) { border-color:#a855f7; background:#faf5ff; }
        .ob2-quiz-opt.ob2-quiz-correct { border-color:#16a34a !important; background:#f0fdf4 !important; color:#16a34a !important; }
        .ob2-quiz-opt.ob2-quiz-wrong { border-color:#dc2626 !important; background:#fef2f2 !important; color:#dc2626 !important; }
        .ob2-quiz-opt.ob2-quiz-answered { pointer-events:none; }

        /* ── Driver.js tour theme ── */
        .driver-popover { animation:none!important; -webkit-font-smoothing:auto!important; -moz-osx-font-smoothing:auto!important; }
        .khio-tour-popover.driver-popover { background:var(--study-card-bg,#fff); color:var(--study-text,#1a1a1a); border-radius:16px; padding:24px; box-shadow:0 4px 12px rgba(0,0,0,0.1); border:1px solid var(--study-border,#e5e5e5); font-family:'Inter',sans-serif; max-width:340px; }
        .khio-tour-popover .driver-popover-title { font-size:18px; font-weight:700; margin-bottom:8px; color:var(--study-text,#1a1a1a); text-shadow:0 0 0 var(--study-text,#1a1a1a); }
        .khio-tour-popover .driver-popover-description { font-size:14.5px; line-height:1.6; color:var(--study-text-secondary,#555); font-weight:450; }
        .khio-tour-popover .driver-popover-progress-text { font-size:12px; color:var(--study-text-tertiary,#888); font-weight:500; }
        .khio-tour-popover .driver-popover-navigation-btns button { border-radius:10px; padding:8px 18px; font-size:13.5px; font-weight:700; font-family:'Inter',sans-serif; border:none; cursor:pointer; letter-spacing:0.01em; }
        .khio-tour-popover .driver-popover-next-btn,
        .khio-tour-popover .driver-popover-done-btn { background:var(--study-accent,#8B6914)!important; color:#fff!important; text-shadow:0 1px 1px rgba(0,0,0,0.25); }
        .khio-tour-popover .driver-popover-next-btn:hover,
        .khio-tour-popover .driver-popover-done-btn:hover { background:var(--study-accent,#8B6914)!important; color:#fff!important; opacity:.85; }
        .khio-tour-popover .driver-popover-prev-btn { background:var(--study-bg-secondary,#f5f5f5)!important; color:var(--study-text,#1a1a1a)!important; }
        .khio-tour-popover .driver-popover-prev-btn:hover { background:var(--study-bg-secondary,#e8e8e8)!important; color:var(--study-text,#1a1a1a)!important; }
        .khio-tour-popover .driver-popover-close-btn { color:var(--study-text-tertiary,#999); }
