/* ============================================================
   OmNote — Premium Dark Theme with Glassmorphism & Animations
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-deep: #06080f;
    --bg-base: #0a0e1a;
    --bg-surface: #111827;
    --bg-elevated: #1a2035;
    --bg-glass: rgba(17, 24, 55, 0.6);
    --bg-glass-strong: rgba(17, 24, 55, 0.85);

    --border-subtle: rgba(99, 130, 200, 0.12);
    --border-medium: rgba(99, 130, 200, 0.2);
    --border-glow: rgba(6, 182, 212, 0.3);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dim: #475569;

    --accent-cyan: #06b6d4;
    --accent-violet: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-amber: #f59e0b;

    --gradient-brand: linear-gradient(135deg, #06b6d4, #8b5cf6);
    --gradient-brand-h: linear-gradient(90deg, #06b6d4, #8b5cf6);
    --gradient-warm: linear-gradient(135deg, #f43f5e, #f59e0b);
    --gradient-cool: linear-gradient(135deg, #3b82f6, #06b6d4);
    --gradient-glass: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(139,92,246,0.08));

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
    --shadow-glow-cyan: 0 0 20px rgba(6,182,212,0.15);
    --shadow-glow-violet: 0 0 20px rgba(139,92,246,0.15);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Legacy compat aliases */
    --bg-color: var(--bg-base);
    --panel-bg: var(--bg-surface);
    --header-bg: var(--bg-elevated);
    --border-color: var(--border-medium);
    --text-main: var(--text-primary);
    --accent-active: var(--accent-violet);
    --bg-purple: var(--accent-violet);
    --bg-purple-light: #7c3aed;
    --bg-green: #064e3b;
    --bg-blue: var(--bg-deep);
    --bg-main: var(--bg-base);
    --border-blue: var(--accent-cyan);
    --blue-badge: #1e3a8a;
    --flashcard-bg: rgba(245, 158, 11, 0.12);
    --flashcard-text: #fcd34d;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animated gradient background mesh */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 20%, rgba(6,182,212,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(139,92,246,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 50% 60% at 50% 50%, rgba(59,130,246,0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: meshFloat 20s ease-in-out infinite;
}

@keyframes meshFloat {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* --- Scrollbars --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(99, 130, 200, 0.2);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(99, 130, 200, 0.35); }

/* --- Keyframe Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes ringPulse {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(6,182,212,0.3)); }
    50% { filter: drop-shadow(0 0 12px rgba(6,182,212,0.6)); }
}
@keyframes breathe {
    0%, 100% { box-shadow: 0 0 8px rgba(6,182,212,0.15); }
    50% { box-shadow: 0 0 20px rgba(6,182,212,0.3); }
}
@keyframes floatBadge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    background: var(--bg-deep);
    z-index: 10000;
    position: fixed;
    inset: 0;
    overflow: hidden;
}

/* Animated mesh behind login */
#login-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 30% 30%, rgba(6,182,212,0.1) 0%, transparent 60%),
        radial-gradient(ellipse 50% 50% at 70% 70%, rgba(139,92,246,0.1) 0%, transparent 60%);
    animation: meshFloat 15s ease-in-out infinite;
}

.login-card {
    position: relative;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    width: 420px;
    max-width: 92vw;
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    text-align: center;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg), var(--shadow-glow-cyan);
    animation: scaleIn 0.5s var(--transition-smooth);
}

.login-logo {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--gradient-brand-h);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 0.95rem;
}

.login-input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 14px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.login-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6,182,212,0.1);
}
.login-input::placeholder { color: var(--text-dim); }

#auth-error {
    color: var(--accent-rose);
    font-size: 0.85rem;
    margin-bottom: 12px;
    display: none;
}

.login-btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--gradient-brand);
    color: #fff;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: transform var(--transition-fast), box-shadow var(--transition-base);
}
.login-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(6,182,212,0.25);
}
.login-btn-primary:active { transform: translateY(0); }

.login-btn-secondary {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--accent-cyan);
    font-weight: 700;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    transition: background var(--transition-base), border-color var(--transition-base);
}
.login-btn-secondary:hover {
    background: rgba(6,182,212,0.06);
    border-color: var(--accent-cyan);
}

/* ============================================================
   APP WRAPPER
   ============================================================ */
#app-wrapper {
    display: none;
    height: 100vh;
    flex-direction: column;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
#sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}
#sidebar-overlay.active { opacity: 1; pointer-events: auto; }

#sidebar-menu {
    position: fixed;
    top: 0;
    left: -360px;
    width: 328px;
    height: 100vh;
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(6,182,212,0.10), transparent 60%),
        radial-gradient(100% 50% at 100% 100%, rgba(139,92,246,0.10), transparent 60%),
        var(--bg-glass-strong);
    backdrop-filter: blur(28px) saturate(140%);
    -webkit-backdrop-filter: blur(28px) saturate(140%);
    border-right: 1px solid var(--border-subtle);
    z-index: 1001;
    transition: left var(--transition-smooth);
    display: flex;
    flex-direction: column;
    box-shadow: 24px 0 80px rgba(0,0,0,0.55), inset -1px 0 0 rgba(255,255,255,0.03);
}
#sidebar-menu.active { left: 0; }

.sidebar-header {
    height: 68px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    position: relative;
}
.sidebar-header::after {
    content: '';
    position: absolute;
    left: 22px; right: 22px; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(6,182,212,0.35), rgba(139,92,246,0.35), transparent);
}
.sidebar-header h2 {
    font-size: 1.35rem;
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.01em;
    background: var(--gradient-brand-h);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-content {
    padding: 18px 16px 24px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.sidebar-content::-webkit-scrollbar { width: 6px; }
.sidebar-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(6,182,212,0.35), rgba(139,92,246,0.35));
    border-radius: 999px;
}

.btn-new-doc {
    width: 100%;
    padding: 11px 14px;
    background: linear-gradient(135deg, rgba(6,182,212,0.10), rgba(139,92,246,0.08));
    border: 1px solid rgba(6,182,212,0.22);
    color: #ffffff;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-base);
    box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.btn-new-doc i, .btn-new-doc svg { color: #ffffff; stroke: #ffffff; }
.btn-new-doc:hover {
    background: linear-gradient(135deg, rgba(6,182,212,0.18), rgba(139,92,246,0.14));
    border-color: rgba(6,182,212,0.55);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(6,182,212,0.18);
}

.sidebar-section-label {
    margin-top: 24px;
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1.8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-section-label::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), #8b5cf6);
    box-shadow: 0 0 8px rgba(6,182,212,0.55);
}
.sidebar-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.08), transparent);
}

.doc-list-item {
    position: relative;
    padding: 10px 12px 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    color: #cdd6f4;
    margin-bottom: 4px;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
}
.doc-list-item::before {
    content: '';
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: transparent;
    transition: background var(--transition-base);
}
.doc-list-item:hover {
    background: rgba(139,92,246,0.07);
    color: #f4f5ff;
    border-color: rgba(139,92,246,0.22);
    transform: translateX(2px);
}
.doc-list-item:hover::before {
    background: linear-gradient(180deg, var(--accent-cyan), #8b5cf6);
}
.doc-list-item.active {
    background: linear-gradient(90deg, rgba(6,182,212,0.16), rgba(139,92,246,0.14));
    color: #ffffff;
    font-weight: 600;
    border-color: rgba(6,182,212,0.35);
    box-shadow: 0 4px 18px rgba(6,182,212,0.15);
}
.doc-list-item.active::before {
    background: linear-gradient(180deg, var(--accent-cyan), #8b5cf6);
    box-shadow: 0 0 10px rgba(6,182,212,0.6);
}

.stat-card {
    background: linear-gradient(135deg, rgba(6,182,212,0.06), rgba(139,92,246,0.05));
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: all var(--transition-base);
}
.stat-card:hover {
    border-color: rgba(6,182,212,0.35);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(6,182,212,0.12);
}


/* ============================================================
   TOP NAVIGATION BAR
   ============================================================ */
#topbar {
    min-height: 64px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), transparent 60%),
        var(--bg-glass-strong);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 18px;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 24px rgba(0,0,0,0.25);
}
#topbar::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(6,182,212,0.35), rgba(139,92,246,0.35), transparent);
    pointer-events: none;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-title-group {
    display: flex;
    flex-direction: column;
    padding: 4px 12px;
    border-left: 1px solid var(--border-subtle);
    margin-left: 4px;
    line-height: 1.2;
}
.doc-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.doc-subtitle {
    font-size: 0.68rem;
    color: var(--text-dim);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    font-weight: 600;
}

.topbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tablet responsive layout for topbar */
@media (max-width: 1280px) {
    #topbar {
        flex-wrap: wrap;
        padding: 10px 18px;
        gap: 10px;
    }
    .topbar-left, .topbar-right {
        flex: 1;
    }
    .topbar-center {
        position: static;
        transform: none;
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 4px;
    }
}

/* --- Main Navigation Tabs (Center) --- */
.main-nav-tabs {
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.2));
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-full);
    padding: 4px;
    gap: 2px;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 4px 14px rgba(0,0,0,0.25);
}

.main-nav-tab {
    padding: 8px 18px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    transition: color var(--transition-base), background var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
    white-space: nowrap;
    position: relative;
    z-index: 1;
    user-select: none;
    border: none;
    background: none;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}
.main-nav-tab:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.03);
}
.main-nav-tab.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(6,182,212,0.9), rgba(139,92,246,0.9));
    box-shadow: 0 4px 16px rgba(6,182,212,0.28), inset 0 1px 0 rgba(255,255,255,0.15);
}
.main-nav-tab .tab-emoji {
    font-size: 0.9rem;
}

/* --- Left Pane Tabs (under topbar, inside left pane) --- */
.left-pane-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background:
        linear-gradient(180deg, rgba(6,182,212,0.04), rgba(0,0,0,0) 60%),
        rgba(10,12,18,0.55);
    backdrop-filter: blur(14px);
    position: relative;
}
.left-pane-tabs::after {
    content: "";
    position: absolute;
    left: 20px; right: 20px; bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(6,182,212,0.35), rgba(139,92,246,0.35), transparent);
    opacity: 0.7;
}

.left-tab-item {
    position: relative;
    padding: 8px 16px 10px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    border-radius: 12px;
    transition: all var(--transition-base);
    border: 1px solid transparent;
    background: transparent;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 7px;
}
.left-tab-item::after {
    content: "";
    position: absolute;
    left: 22%; right: 22%; bottom: 2px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, #06b6d4, #8b5cf6);
    opacity: 0;
    transform: scaleX(0.4);
    transition: all var(--transition-base);
}
.left-tab-item:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}
.left-tab-item.active {
    color: #ecfeff;
    background: linear-gradient(135deg, rgba(6,182,212,0.16), rgba(139,92,246,0.14));
    border-color: rgba(6,182,212,0.35);
    box-shadow: 0 6px 18px -10px rgba(6,182,212,0.55), inset 0 1px 0 rgba(255,255,255,0.08);
}
.left-tab-item.active::after {
    opacity: 1;
    transform: scaleX(1);
}

/* Light mode: readable tab labels on the pale pane background */
body.app-light-mode .left-pane-tabs {
    background:
        linear-gradient(180deg, rgba(6,182,212,0.06), rgba(255,255,255,0) 60%),
        rgba(255,255,255,0.85);
    border-bottom-color: rgba(15,23,42,0.1);
}
body.app-light-mode .left-tab-item {
    color: #475569;
}
body.app-light-mode .left-tab-item:hover {
    color: #0f172a;
    background: rgba(15,23,42,0.05);
}
body.app-light-mode .left-tab-item.active {
    color: #0e7490;
    background: linear-gradient(135deg, rgba(6,182,212,0.14), rgba(139,92,246,0.12));
    border-color: rgba(6,182,212,0.45);
    box-shadow: 0 6px 18px -12px rgba(6,182,212,0.5), inset 0 1px 0 rgba(255,255,255,0.6);
}

/* --- Buttons --- */
.btn-icon {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition-base);
    padding: 7px 10px;
    border-radius: 10px;
    min-width: 34px;
    min-height: 34px;
}
.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(6,182,212,0.08);
    border-color: rgba(6,182,212,0.25);
    transform: translateY(-1px);
}

.btn-upload-top {
    background: linear-gradient(135deg, rgba(6,182,212,0.18), rgba(139,92,246,0.14));
    border: 1px solid rgba(6,182,212,0.35);
    color: #e6fbff;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 0.82rem;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(6,182,212,0.18), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-upload-top:hover {
    background: linear-gradient(135deg, rgba(6,182,212,0.3), rgba(139,92,246,0.22));
    border-color: var(--accent-cyan);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(6,182,212,0.28);
}

.btn-logout {
    background: rgba(244,63,94,0.04);
    border: 1px solid rgba(244,63,94,0.22);
    color: var(--accent-rose);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 0.82rem;
    font-family: inherit;
}
.btn-logout:hover {
    background: rgba(244,63,94,0.12);
    border-color: var(--accent-rose);
    box-shadow: 0 4px 14px rgba(244,63,94,0.2);
    transform: translateY(-1px);
}


/* --- Pomodoro Timer Widget --- */
.pomo-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    position: relative;
}

.pomo-ring-wrap {
    width: 36px;
    height: 36px;
    position: relative;
    cursor: pointer;
}
.pomo-ring-wrap svg {
    width: 36px;
    height: 36px;
    transform: rotate(-90deg);
}
.pomo-ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 3;
}
.pomo-ring-progress {
    fill: none;
    stroke: url(#pomoGradient);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}
.pomo-ring-wrap.work .pomo-ring-progress {
    stroke: var(--accent-rose);
    filter: drop-shadow(0 0 6px rgba(244,63,94,0.4));
}
.pomo-ring-wrap.break .pomo-ring-progress {
    stroke: var(--accent-emerald);
    filter: drop-shadow(0 0 6px rgba(16,185,129,0.4));
}

.pomo-time {
    font-size: 0.82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 42px;
    text-align: center;
}
.pomo-time.work { color: var(--accent-rose); }
.pomo-time.break { color: var(--accent-emerald); }

.pomo-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pomo-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}

/* ============================================================
   HOME VIEW
   ============================================================ */
#home-view {
    display: none;
    padding: 48px 40px;
    overflow-y: auto;
    flex: 1;
    width: 100%;
    background: var(--bg-base);
    animation: fadeInUp 0.4s var(--transition-smooth);
}

.home-header {
    position: relative;
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 34px 36px;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background:
        linear-gradient(135deg, rgba(6,182,212,0.06), rgba(139,92,246,0.06)),
        var(--bg-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 20px 50px -30px rgba(0,0,0,0.6);
}
.home-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(6,182,212,0.35), rgba(139,92,246,0.3) 60%, transparent);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}
.home-hero-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.hero-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
}
.hero-blob-a {
    width: 320px; height: 320px;
    background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
    top: -120px; left: -60px;
    animation: heroFloat 12s ease-in-out infinite;
}
.hero-blob-b {
    width: 280px; height: 280px;
    background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
    bottom: -140px; right: -40px;
    animation: heroFloat 14s ease-in-out infinite reverse;
}
.hero-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
@keyframes heroFloat {
    0%, 100% { transform: translate(0,0); }
    50% { transform: translate(24px, -18px); }
}

.home-header-inner {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
}
.home-header-text { min-width: 0; }

.home-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(6,182,212,0.28), rgba(6,182,212,0.18));
    border: 1px solid rgba(6,182,212,0.55);
    color: #ecfeff;
    text-shadow: 0 1px 6px rgba(6,182,212,0.55);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 14px;
}
.home-kicker-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #06b6d4;
    box-shadow: 0 0 10px #06b6d4;
    animation: pulseDot 1.8s ease-in-out infinite;
}
@keyframes pulseDot {
    0%,100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.75); }
}

.home-title {
    font-size: 2.9rem;
    margin-bottom: 8px;
    font-weight: 800;
    background: var(--gradient-brand-h);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1.2px;
    line-height: 1.05;
}
.home-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin: 0;
}

.home-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 12px;
    border: 1px solid var(--border-medium);
    font-weight: 600;
    cursor: pointer;
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
    transition: all var(--transition-base);
    font-size: 0.88rem;
    font-family: inherit;
    backdrop-filter: blur(8px);
}
.btn-action .btn-ico { font-size: 1rem; line-height: 1; }
.btn-action:hover {
    background: rgba(255,255,255,0.09);
    border-color: var(--border-glow);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -8px rgba(6,182,212,0.35);
}
.btn-action.primary {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 20px -10px rgba(6,182,212,0.55), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-action.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px -10px rgba(6,182,212,0.6), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-action.violet {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border: 1px solid rgba(167,139,250,0.6);
    color: #ffffff;
    box-shadow: 0 8px 20px -10px rgba(139,92,246,0.55), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-action.violet:hover {
    background: linear-gradient(135deg, #9f75f8 0%, #8b5cf6 100%);
    box-shadow: 0 12px 26px -10px rgba(139,92,246,0.7), inset 0 1px 0 rgba(255,255,255,0.25);
}


#home-subjects-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 22px;
    padding: 8px 4px 48px;
}

/* ---- Subject label ---- */
.home-subject-label {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 2px 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-dim);
}
.home-subject-label .subj-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
    box-shadow: 0 0 12px rgba(6,182,212,0.55);
}
.home-subject-label .subj-name {
    color: var(--text-primary);
    letter-spacing: 2px;
}

/* ---- Home document cards — modern glass tiles ---- */
.home-doc-card {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(6,182,212,0.08), transparent 55%),
        radial-gradient(circle at bottom right, rgba(139,92,246,0.08), transparent 55%),
        var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 20px 20px 18px;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    animation: fadeInUp 0.4s var(--transition-smooth) both;
    min-height: 148px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.home-doc-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(6,182,212,0.35), rgba(139,92,246,0.25) 60%, transparent);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.home-doc-card:hover {
    transform: translateY(-4px);
    border-color: transparent;
    box-shadow: 0 18px 40px -18px rgba(6,182,212,0.35), 0 8px 20px -12px rgba(139,92,246,0.28);
}
.home-doc-card:hover::before { opacity: 1; }

.home-doc-card .doc-card-accent {
    position: absolute;
    left: 0; top: 20px; bottom: 20px;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, #06b6d4, #8b5cf6);
    opacity: 0.55;
}

.home-doc-card .doc-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
}
.home-doc-card .doc-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.05rem;
    color: #e0f7ff;
    background: linear-gradient(135deg, rgba(6,182,212,0.22), rgba(139,92,246,0.22));
    border: 1px solid rgba(6,182,212,0.28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.home-doc-card .doc-card-delete {
    margin-left: auto;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}
.home-doc-card .doc-card-delete:hover {
    background: rgba(244,63,94,0.14);
    color: var(--accent-rose);
    border-color: rgba(244,63,94,0.35);
}
.home-doc-card .doc-card-title {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.35;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.home-doc-card .doc-card-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.home-doc-card .doc-card-meta .meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-dim);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    padding: 4px 10px;
    border-radius: 999px;
}
.home-doc-card .due-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #f43f5e 0%, #fb923c 100%);
    color: #1a0508;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 800;
    border: 1px solid rgba(255,255,255,0.25);
    box-shadow: 0 4px 12px rgba(244,63,94,0.35);
    text-shadow: 0 1px 0 rgba(255,255,255,0.15);
}

/* ============================================================
   WORKSPACE — Split Pane Layout
   ============================================================ */
#workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* --- LEFT PANE --- */
#left-pane {
    flex: 6;
    background: var(--bg-base);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.left-view-section {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    overflow-y: auto;
}
.left-view-section.active {
    display: flex;
    animation: fadeIn 0.3s var(--transition-smooth);
}

/* Notes editor */
.doc-title-editor {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 800;
    width: 100%;
    margin-bottom: 8px;
    outline: none;
    font-family: inherit;
    letter-spacing: -0.5px;
}
.doc-title-editor::placeholder { color: var(--text-dim); }

/* Summary view */
#summary-view {
    background: #1a1d24;
}
.summary-header {
    padding: 24px 40px 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.summary-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-toggles {
    display: flex;
    gap: 4px;
    background: rgba(10,12,18,0.65);
    border-radius: 999px;
    padding: 4px;
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 20px -14px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
}
.toggle-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 7px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}
.toggle-btn.active {
    background: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
    color: #ffffff;
    box-shadow: 0 6px 16px -8px rgba(139,92,246,0.6), inset 0 1px 0 rgba(255,255,255,0.22);
}

/* Smart Explain — premium variant of the pill toggle */
.toggle-btn.smart-explain-btn {
    position: relative;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(139,92,246,0.28), rgba(6,182,212,0.22));
    border: 1px solid rgba(167,139,250,0.55);
    padding: 7px 14px 7px 12px;
    box-shadow:
        0 6px 18px -10px rgba(139,92,246,0.55),
        inset 0 1px 0 rgba(255,255,255,0.14);
    overflow: hidden;
    isolation: isolate;
}
.toggle-btn.smart-explain-btn::before {
    content: "";
    position: absolute;
    inset: -1px;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(120deg, rgba(6,182,212,0.9), rgba(139,92,246,0.9), rgba(6,182,212,0.9));
    background-size: 200% 100%;
    -webkit-mask: linear-gradient(#000,#000) content-box, linear-gradient(#000,#000);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    animation: seBorder 4s linear infinite;
    opacity: 0.85;
    z-index: -1;
}
.toggle-btn.smart-explain-btn::after {
    content: "";
    position: absolute;
    top: 0; left: -60%;
    width: 45%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,0.22), transparent);
    transform: skewX(-18deg);
    animation: seShine 3.6s ease-in-out infinite;
    pointer-events: none;
}
.toggle-btn.smart-explain-btn .se-ico {
    font-size: 0.95rem;
    filter: drop-shadow(0 0 6px rgba(139,92,246,0.55));
}
.toggle-btn.smart-explain-btn .se-spark {
    font-size: 0.75rem;
    opacity: 0.9;
    animation: seSparkle 2.2s ease-in-out infinite;
}
.toggle-btn.smart-explain-btn:hover {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(139,92,246,0.42), rgba(6,182,212,0.34));
    transform: translateY(-1px);
    box-shadow:
        0 10px 26px -10px rgba(139,92,246,0.7),
        inset 0 1px 0 rgba(255,255,255,0.2);
}
@keyframes seBorder {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
@keyframes seShine {
    0%   { left: -60%; }
    55%  { left: 120%; }
    100% { left: 120%; }
}
@keyframes seSparkle {
    0%,100% { opacity: 0.55; transform: scale(0.9) rotate(0deg); }
    50%     { opacity: 1;    transform: scale(1.15) rotate(15deg); }
}

.markdown-body {
    padding: 40px 60px;
    line-height: 1.6;
    font-size: 1.05rem;
    max-width: 900px;
    margin: 0 auto;
    color: #e2e8f0;
    font-family: 'Inter', 'Roboto', 'Segoe UI', sans-serif;
    animation: fadeInUp 0.3s var(--transition-smooth);
    transition: max-width var(--transition-base), font-size var(--transition-base);
}

body.sidebar-closed .markdown-body {
    max-width: 1400px;
    font-size: 1.15rem;
}
.markdown-body h1 {
    font-size: 2.2rem;
    margin-bottom: 24px;
    font-weight: 800;
    color: #ffffff;
}
.markdown-body h2 {
    font-size: 1.6rem;
    margin-top: 36px;
    margin-bottom: 14px;
    font-weight: 700;
    color: #ffffff;
}
.markdown-body h3 {
    font-size: 1.2rem;
    margin-top: 24px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #cbd5e1;
}
.markdown-body p {
    margin-bottom: 18px;
    color: #e2e8f0;
}
.markdown-body ul, .markdown-body ol {
    color: #e2e8f0;
    padding-left: 24px;
}
.markdown-body li { margin-bottom: 8px; }
.markdown-body strong { color: #ffffff; }
.markdown-body ::selection { background: rgba(6,182,212,0.25); }
.markdown-body code {
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--accent-cyan);
}

/* PDF upload area */
.pdf-upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    z-index: 10;
}
.pdf-upload-overlay h2 {
    margin-bottom: 8px;
    font-weight: 700;
}
.btn-upload {
    background: var(--gradient-brand);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-base);
    box-shadow: 0 4px 16px rgba(6,182,212,0.2);
}
.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(6,182,212,0.3);
}

#pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.pdf-viewer {
    width: 100%;
    height: 100%;
    overflow: auto;
    background: #2a2a2a;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.pdf-viewer .pdf-page {
    position: relative;
    background: white;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.pdf-viewer .pdf-page canvas {
    display: block;
}
.pdf-viewer .textLayer {
    position: absolute;
    top: 0; left: 0;
    right: 0; bottom: 0;
    overflow: hidden;
    opacity: 0.2;
    line-height: 1;
    -webkit-user-select: text;
    user-select: text;
}
.pdf-viewer .textLayer > span,
.pdf-viewer .textLayer > br {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}
.pdf-viewer .textLayer ::selection {
    background: rgba(0, 100, 255, 0.35);
}

/* --- RIGHT PANE --- */
#right-pane {
    flex: 4;
    min-width: 380px;
    max-width: 560px;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-subtle);
    transition: min-width var(--transition-base), max-width var(--transition-base), flex var(--transition-base), border var(--transition-base);
}

#right-pane.collapsed {
    flex: 0;
    min-width: 0;
    max-width: 0;
    border-left: none;
    overflow: hidden;
}

.right-tabs {
    display: flex;
    gap: 6px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background:
        linear-gradient(180deg, rgba(139,92,246,0.05), rgba(0,0,0,0) 60%),
        rgba(10,12,18,0.55);
    backdrop-filter: blur(14px);
    position: relative;
}
.right-tabs::after {
    content: "";
    position: absolute;
    left: 16px; right: 16px; bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.4), rgba(6,182,212,0.4), transparent);
    opacity: 0.7;
}
.right-tab-item {
    flex: 1;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    padding: 9px 14px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all var(--transition-base);
    border: 1px solid transparent;
    background: rgba(255,255,255,0.02);
    font-family: inherit;
}
.right-tab-item:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.06);
}
.right-tab-item.active {
    background: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 8px 22px -10px rgba(139,92,246,0.65), inset 0 1px 0 rgba(255,255,255,0.22);
}

.right-view-section {
    display: none;
    padding: 20px;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
}
.right-view-section.active {
    display: flex;
    animation: fadeIn 0.25s ease;
}

/* ============================================================
   QUIZ CARDS
   ============================================================ */
.quiz-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 14px;
    background: rgba(255,255,255,0.02);
    transition: border-color var(--transition-base);
    animation: fadeInUp 0.3s var(--transition-smooth) both;
}
.quiz-card:hover { border-color: var(--border-medium); }

.quiz-q-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}
.quiz-num {
    background: var(--gradient-brand);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 0.85rem;
}
.quiz-question { font-size: 0.95rem; line-height: 1.5; font-weight: 500; }

.quiz-input {
    width: 100%;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border-subtle);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.quiz-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6,182,212,0.08);
}

/* ============================================================
   ACCORDION — Study Plan
   ============================================================ */
.accordion-item {
    position: relative;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    margin-bottom: 12px;
    background:
        linear-gradient(180deg, rgba(20,26,38,0.55) 0%, rgba(14,18,28,0.65) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
    transition: transform .25s ease, border-color .25s ease, box-shadow .3s ease, background .3s ease;
    animation: fadeInUp 0.3s var(--transition-smooth) both;
    --mastery: 0%;
    --mastery-color: rgba(148,163,184,0.55);
}

/* Left accent bar reflects progress */
.accordion-item::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--mastery-color);
    opacity: 0.7;
    transition: background .3s ease, opacity .3s ease;
}

/* Bottom thin progress fill */
.accordion-item::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    height: 2px;
    width: var(--mastery);
    background: linear-gradient(90deg, #06b6d4, #8b5cf6);
    border-radius: 0 2px 0 0;
    transition: width .5s cubic-bezier(0.22,1,0.36,1);
    opacity: 0.85;
}

.accordion-item:hover {
    border-color: rgba(6,182,212,0.22);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px -12px rgba(0,0,0,0.6);
}

.accordion-item.in-progress { --mastery-color: #06b6d4; }
.accordion-item.mastered {
    --mastery-color: linear-gradient(180deg, #fbbf24, #f59e0b);
    border-color: rgba(251,191,36,0.28);
    background:
        linear-gradient(180deg, rgba(251,191,36,0.06) 0%, rgba(14,18,28,0.65) 60%);
}
.accordion-item.mastered::before { background: linear-gradient(180deg, #fbbf24, #f59e0b); opacity: 1; }
.accordion-item.mastered::after  { background: linear-gradient(90deg, #fbbf24, #f59e0b); }

.accordion-header {
    padding: 14px 18px 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.94rem;
    color: var(--text-primary);
    transition: background var(--transition-base);
    user-select: none;
}
.accordion-header:hover { background: rgba(255,255,255,0.025); }

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.acc-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.35;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chunk-check {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--accent-cyan);
    flex-shrink: 0;
}

/* Number chip — circular gradient badge */
.acc-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(6,182,212,0.18), rgba(139,92,246,0.18));
    border: 1px solid rgba(6,182,212,0.25);
    color: #a5f3fc;
    font-weight: 800;
    font-size: 0.78rem;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    background-clip: initial;
    margin: 0;
    flex-shrink: 0;
    transition: transform .25s ease, box-shadow .3s ease;
}
.accordion-item.mastered .acc-num {
    background: linear-gradient(135deg, rgba(251,191,36,0.25), rgba(245,158,11,0.15));
    border-color: rgba(251,191,36,0.4);
    color: #fde68a;
    box-shadow: 0 0 12px rgba(251,191,36,0.25);
}
.accordion-item:hover .acc-num { transform: scale(1.06); }

.progress-badge {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    transition: all .25s ease;
}
.progress-badge.in-progress {
    background: rgba(6,182,212,0.12);
    border-color: rgba(6,182,212,0.3);
    color: #a5f3fc;
}
.progress-badge.mastered {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-color: #fbbf24;
    color: #1a1200;
    text-shadow: 0 1px 0 rgba(255,255,255,0.25);
    box-shadow: 0 0 12px rgba(251,191,36,0.35);
}

.acc-chevron {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: transform .3s ease, color .25s ease;
    display: inline-block;
}
.accordion-item.expanded .acc-chevron {
    transform: rotate(180deg);
    color: var(--accent-cyan);
}

.accordion-item.expanded {
    border-color: rgba(6,182,212,0.28);
    box-shadow:
        0 12px 30px -12px rgba(0,0,0,0.55),
        0 0 0 1px rgba(6,182,212,0.1),
        0 0 24px -8px rgba(6,182,212,0.25);
}
.accordion-item.mastered.expanded {
    box-shadow:
        0 12px 30px -12px rgba(0,0,0,0.55),
        0 0 0 1px rgba(251,191,36,0.18),
        0 0 24px -8px rgba(251,191,36,0.25);
}

.accordion-content {
    display: none;
    padding: 4px 20px 20px;
}
.accordion-item.expanded .accordion-content {
    display: block;
    animation: fadeInUp 0.28s ease;
}


/* Next Step Block */
.next-step-block {
    background: linear-gradient(135deg, rgba(6,182,212,0.12), rgba(59,130,246,0.12));
    border: 1px solid rgba(6,182,212,0.15);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 14px;
}
.next-step-header {
    background: rgba(6,182,212,0.15);
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.next-step-body { padding: 16px; }
.next-step-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.btn-dark-pill {
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 0.85rem;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-dark-pill:hover {
    background: rgba(6,182,212,0.1);
    border-color: var(--accent-cyan);
    box-shadow: var(--shadow-glow-cyan);
}

.action-cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.action-card {
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.action-card:hover {
    transform: translateY(-1px);
}

.card-purple {
    background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04));
    border: 1px solid rgba(139,92,246,0.2);
}
.card-green {
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(16,185,129,0.04));
    border: 1px solid rgba(16,185,129,0.2);
}

/* ============================================================
   AI CHAT
   ============================================================ */
#ai-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 12px;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(6,182,212,0.10), rgba(139,92,246,0.10));
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.chat-header-avatar {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--gradient-brand);
    font-size: 1.1rem;
    box-shadow: 0 6px 18px rgba(6,182,212,0.28);
}
.chat-header-meta { display: flex; flex-direction: column; gap: 2px; }
.chat-header-title { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); letter-spacing: 0.2px; }
.chat-header-sub { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.chat-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
    animation: chatPulse 2s ease-in-out infinite;
}
@keyframes chatPulse {
    0%,100% { box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }
    50% { box-shadow: 0 0 0 6px rgba(16,185,129,0.05); }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 4px 4px 10px 4px;
    scroll-behavior: smooth;
}

.chat-empty-state {
    margin: auto;
    text-align: center;
    padding: 30px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    max-width: 340px;
}
.chat-empty-icon {
    width: 58px; height: 58px;
    display: grid; place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(6,182,212,0.18), rgba(139,92,246,0.18));
    border: 1px solid var(--border-subtle);
    font-size: 1.6rem;
    margin-bottom: 4px;
    box-shadow: 0 10px 30px rgba(6,182,212,0.15);
}
.chat-empty-title { font-weight: 700; font-size: 1.05rem; color: var(--text-primary); }
.chat-empty-sub { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }
.chat-suggestions {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px;
}
.chat-suggestion {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
}
.chat-suggestion:hover {
    background: rgba(6,182,212,0.12);
    border-color: var(--accent-cyan);
    transform: translateY(-1px);
}

.message {
    padding: 12px 15px;
    border-radius: 16px;
    max-width: 88%;
    font-size: 0.9rem;
    line-height: 1.6;
    animation: fadeInUp 0.25s ease;
    position: relative;
    word-wrap: break-word;
}
.message.user {
    background: var(--gradient-brand);
    align-self: flex-end;
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: 0 6px 18px rgba(6,182,212,0.22);
}
.message.ai, .message.system {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    color: var(--text-primary);
}

.chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}
.chat-input-wrap {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 6px 6px 6px 12px;
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.chat-input-wrap:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 4px rgba(6,182,212,0.12);
}

.chat-input {
    flex: 1;
    background: transparent;
    color: var(--text-primary);
    border: none;
    padding: 10px 4px;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    max-height: 140px;
    min-height: 24px;
}
.chat-input::placeholder { color: var(--text-muted); }

.chat-send-btn {
    background: var(--gradient-brand);
    color: white;
    border: none;
    border-radius: 12px;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px rgba(6,182,212,0.28);
}
.chat-send-btn:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 8px 20px rgba(6,182,212,0.4);
}
.chat-send-btn:active { transform: scale(0.96); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.chat-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    opacity: 0.75;
}
.chat-hint kbd {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 0.68rem;
    font-family: inherit;
}

/* ============================================================
   POPOVER
   ============================================================ */
.custom-popover {
    position: absolute;
    display: none;
    width: 460px;
    max-height: min(70vh, 520px);
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), var(--shadow-glow-cyan);
    z-index: 10010;
    flex-direction: row;
    overflow: hidden;
}
.custom-popover.active {
    display: flex;
    animation: scaleIn 0.2s ease;
}

.popover-sidebar {
    width: 120px;
    background: rgba(0,0,0,0.2);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex-shrink: 0;
}
.popover-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 14px 12px;
    text-align: left;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
    border-left: 3px solid transparent;
    transition: all var(--transition-base);
    flex-shrink: 0;
}
.popover-btn:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}
.popover-btn.active {
    color: var(--accent-cyan);
    border-left-color: var(--accent-cyan);
    background: rgba(6,182,212,0.06);
}

.popover-main {
    flex: 1;
    min-width: 0;
    padding: 18px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.popover-main ul { margin: 0; padding-left: 18px; }
.popover-main li { margin-bottom: 8px; color: var(--text-secondary); }
.popover-main strong { color: var(--text-primary); }

.btn-copy {
    margin-top: auto;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all var(--transition-base);
}
.btn-copy:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

/* ============================================================
   MODALS — Review / Exam / Image Viewer
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(6,8,15,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}
.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s var(--transition-smooth);
}

/* Review Modal */
.review-modal-content {
    background: var(--bg-surface);
    width: 800px;
    max-width: 95vw;
    border-radius: var(--radius-xl);
    padding: 24px;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-lg), var(--shadow-glow-violet);
    animation: scaleIn 0.3s var(--transition-smooth);
}

.review-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.35);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border-subtle);
}

.review-close-btn {
    position: absolute;
    right: 0;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.review-close-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.btn-show-answer {
    width: 100%;
    margin-top: 20px;
    background: var(--gradient-brand);
    border: none;
    padding: 14px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-base);
}
.btn-show-answer:hover {
    box-shadow: 0 6px 20px rgba(6,182,212,0.25);
    transform: translateY(-1px);
}

.srs-buttons {
    display: none;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
}

.srs-action-btn {
    flex: 1;
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-base);
    font-size: 0.85rem;
}
.srs-action-btn:hover {
    background: rgba(255,255,255,0.06);
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.srs-action-btn .srs-emoji { font-size: 1.5rem; }

/* Sources block */
.sources-block {
    background: linear-gradient(135deg, rgba(6,182,212,0.06), rgba(59,130,246,0.06));
    border: 1px solid rgba(6,182,212,0.12);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 24px;
}
.sources-header {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(6,182,212,0.1);
    font-size: 0.82rem;
    color: var(--accent-cyan);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.sources-body {
    padding: 16px;
}
.sources-quote {
    border-left: 3px solid var(--accent-cyan);
    padding-left: 12px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    font-style: italic;
}

/* Exam Modal */
.exam-modal-content {
    background: var(--bg-surface);
    width: 900px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-xl);
    padding: 28px;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s var(--transition-smooth);
}

.exam-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 24px;
    text-align: center;
    background: var(--gradient-warm);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.exam-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.4rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.exam-close-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.exam-finish-btn {
    width: 100%;
    margin-top: 24px;
    background: var(--gradient-warm);
    border: none;
    padding: 14px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-base);
}
.exam-finish-btn:hover {
    box-shadow: 0 6px 20px rgba(244,63,94,0.25);
    transform: translateY(-1px);
}

/* Image Viewer Modal */
.image-modal-content {
    background: var(--bg-surface);
    width: 1000px;
    max-width: 95vw;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    padding: 24px;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s var(--transition-smooth);
}

/* SRS legacy compat */
.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
}
.modal-body {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}
.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    transition: color var(--transition-fast);
}
.close-btn:hover { color: var(--text-primary); }

.card-front, .card-back {
    font-size: 1.5rem;
    margin-bottom: 24px;
    padding: 28px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    text-align: center;
    border: 1px solid var(--border-subtle);
}
.card-back {
    background: rgba(139,92,246,0.06);
    border-color: rgba(139,92,246,0.2);
    display: none;
}

.srs-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
    color: white;
    font-family: inherit;
    transition: all var(--transition-base);
}
.srs-btn:hover { transform: translateY(-1px); }
.btn-forgot { background: var(--accent-rose); }
.btn-hard { background: var(--accent-amber); }
.btn-good { background: var(--accent-emerald); }
.btn-easy { background: var(--accent-blue); }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
}

.gradient-text {
    background: var(--gradient-brand-h);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shimmer-loading {
    background: linear-gradient(90deg, transparent 30%, rgba(255,255,255,0.05) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ============================================================
   LOADER
   ============================================================ */
.loader {
    color: var(--text-muted);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================================
   GLOBAL LOADING OVERLAY
   ============================================================ */
#global-loading-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(10,14,22,0.72) 0%, rgba(4,6,12,0.92) 70%);
    backdrop-filter: blur(28px) saturate(140%);
    -webkit-backdrop-filter: blur(28px) saturate(140%);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.35s ease;
    overflow: hidden;
}
#global-loading-overlay[style*="display: none"] { pointer-events: none !important; }

/* Soft animated aurora backdrop */
.loading-aurora {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.55;
}
.aurora-blob {
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    filter: blur(90px);
    mix-blend-mode: screen;
    animation: auroraFloat 14s ease-in-out infinite;
}
.aurora-blob.blob-1 { background: radial-gradient(circle, #06b6d4 0%, transparent 70%); top: -140px; left: -120px; }
.aurora-blob.blob-2 { background: radial-gradient(circle, #8b5cf6 0%, transparent 70%); bottom: -160px; right: -100px; animation-delay: -5s; }
.aurora-blob.blob-3 { background: radial-gradient(circle, #10b981 0%, transparent 70%); top: 40%; left: 55%; width: 360px; height: 360px; animation-delay: -9s; }

@keyframes auroraFloat {
    0%,100% { transform: translate(0,0) scale(1); }
    33%     { transform: translate(40px,-30px) scale(1.08); }
    66%     { transform: translate(-30px,20px) scale(0.96); }
}

.loading-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 440px;
    width: calc(100% - 40px);
    padding: 44px 40px 36px;
    background: linear-gradient(160deg, rgba(20,26,38,0.72) 0%, rgba(12,16,26,0.85) 100%);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        0 30px 80px -20px rgba(0,0,0,0.7),
        0 0 0 1px rgba(6,182,212,0.08),
        inset 0 1px 0 rgba(255,255,255,0.05);
    animation: loadingCardIn 0.5s cubic-bezier(0.22,1,0.36,1);
}

@keyframes loadingCardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Orbital ring loader */
.loading-orbit {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.orbit-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid transparent;
}
.orbit-ring.ring-1 {
    border-top-color: #06b6d4;
    border-right-color: rgba(6,182,212,0.35);
    animation: spin 2.2s linear infinite;
    box-shadow: 0 0 22px rgba(6,182,212,0.25);
}
.orbit-ring.ring-2 {
    inset: 14px;
    border-top-color: #8b5cf6;
    border-left-color: rgba(139,92,246,0.3);
    animation: spin 3s linear infinite reverse;
}
.orbit-ring.ring-3 {
    inset: 28px;
    border-bottom-color: #10b981;
    border-right-color: rgba(16,185,129,0.3);
    animation: spin 1.6s linear infinite;
}
.orbit-core {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(6,182,212,0.35), rgba(139,92,246,0.15) 60%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a5f3fc;
    box-shadow: 0 0 30px rgba(6,182,212,0.35), inset 0 0 12px rgba(255,255,255,0.06);
    animation: corePulse 2.4s ease-in-out infinite;
}
.orbit-core svg { width: 24px; height: 24px; }

@keyframes corePulse {
    0%,100% { transform: scale(1); box-shadow: 0 0 30px rgba(6,182,212,0.3), inset 0 0 12px rgba(255,255,255,0.06); }
    50%     { transform: scale(1.08); box-shadow: 0 0 42px rgba(6,182,212,0.55), inset 0 0 16px rgba(255,255,255,0.1); }
}

.loading-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(165,243,252,0.75);
    margin-bottom: 8px;
}

#loading-title {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0 0 20px 0;
    background: linear-gradient(90deg, #a5f3fc 0%, #c4b5fd 50%, #6ee7b7 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShift 6s ease infinite;
}
@keyframes titleShift {
    0%,100% { background-position: 0% 50%; }
    50%     { background-position: 100% 50%; }
}

.progress-bar-container {
    width: 100%;
    height: 5px;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 18px;
    position: relative;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #06b6d4, #8b5cf6, #10b981, #06b6d4);
    background-size: 300% 100%;
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
    animation: progressShimmer 3s linear infinite;
    box-shadow: 0 0 12px rgba(6,182,212,0.4);
}
@keyframes progressShimmer {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

.loading-message {
    color: rgba(226,232,240,0.78);
    font-size: 0.92rem;
    font-weight: 500;
    min-height: 22px;
    line-height: 1.4;
    transition: opacity 0.3s ease;
    max-width: 340px;
}

.loading-dots {
    display: flex;
    gap: 6px;
    margin-top: 18px;
}
.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(6,182,212,0.5);
    animation: dotBounce 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; background: rgba(139,92,246,0.5); }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; background: rgba(16,185,129,0.5); }

@keyframes dotBounce {
    0%,80%,100% { transform: translateY(0); opacity: 0.4; }
    40%         { transform: translateY(-6px); opacity: 1; }
}

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


/* ============================================================
   TABLET FLOATING TOOLBAR
   ============================================================ */
#tablet-toolbar {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: none;
    padding: 6px;
    gap: 6px;
    border-radius: 999px;
    background:
        linear-gradient(135deg, rgba(139,92,246,0.14), rgba(34,211,238,0.10)) padding-box,
        linear-gradient(135deg, rgba(167,139,250,0.55), rgba(103,232,249,0.45)) border-box;
    border: 1px solid transparent;
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    box-shadow:
        0 24px 60px -20px rgba(8,15,35,0.55),
        0 8px 24px -12px rgba(139,92,246,0.35),
        inset 0 1px 0 rgba(255,255,255,0.08);
    animation: fadeInUp 0.4s var(--transition-smooth);
}

/* Show only on tablet viewports AND only when the summary view is active */
@media (min-width: 641px) and (max-width: 1024px) {
    body.summary-active #tablet-toolbar {
        display: flex;
        align-items: center;
    }
}

.tablet-toolbar-group {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 2px;
    border-radius: 999px;
    background: rgba(15,23,42,0.35);
}
.tablet-toolbar-group:not(:last-child) {
    border-right: none;
    padding-right: 2px;
    margin-right: 2px;
    position: relative;
}
.tablet-toolbar-group:not(:last-child)::after {
    content: "";
    width: 1px;
    align-self: stretch;
    margin: 6px 4px 6px 6px;
    background: linear-gradient(to bottom, transparent, rgba(148,163,184,0.35), transparent);
}

.tablet-tool-btn {
    position: relative;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 9px 14px;
    min-height: 38px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}
.tablet-tool-btn:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(-1px);
}
.tablet-tool-btn:active { transform: translateY(0) scale(0.97); }

/* Icon-only tools (pen / highlight / eraser) get a square-ish tap target */
.tablet-toolbar-group:first-child .tablet-tool-btn {
    padding: 8px 10px;
    font-size: 1.1rem;
    min-width: 40px;
}

/* AI action buttons — subtle branded shimmer */
.tablet-toolbar-group:last-child .tablet-tool-btn {
    background: linear-gradient(135deg, rgba(139,92,246,0.18), rgba(34,211,238,0.14));
    border-color: rgba(148,163,184,0.18);
}
.tablet-toolbar-group:last-child .tablet-tool-btn:hover {
    background: linear-gradient(135deg, rgba(139,92,246,0.32), rgba(34,211,238,0.26));
    box-shadow: 0 8px 22px -8px rgba(139,92,246,0.55);
    border-color: rgba(167,139,250,0.55);
}

.tablet-tool-btn.active {
    background: linear-gradient(135deg, #8b5cf6, #22d3ee);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 26px -10px rgba(34,211,238,0.75), inset 0 1px 0 rgba(255,255,255,0.25);
}

/* Light-mode adjustments */
body.app-light-mode #tablet-toolbar {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.85), rgba(241,245,249,0.78)) padding-box,
        linear-gradient(135deg, rgba(139,92,246,0.45), rgba(14,116,144,0.35)) border-box;
    box-shadow:
        0 24px 60px -20px rgba(15,23,42,0.25),
        0 8px 24px -12px rgba(139,92,246,0.25),
        inset 0 1px 0 rgba(255,255,255,0.6);
}
body.app-light-mode .tablet-toolbar-group { background: rgba(255,255,255,0.55); }
body.app-light-mode .tablet-tool-btn { color: #1e293b; }
body.app-light-mode .tablet-tool-btn:hover { background: rgba(15,23,42,0.06); }
body.app-light-mode .tablet-toolbar-group:last-child .tablet-tool-btn {
    background: linear-gradient(135deg, rgba(139,92,246,0.14), rgba(14,116,144,0.12));
    border-color: rgba(148,163,184,0.35);
}


/* ============================================================
   DOC EXPLAIN MODAL - ENGAGING FORMATTING
   ============================================================ */
.engaging-reading {
    /* Base typography adjustments */
}

.engaging-reading strong {
    color: var(--accent-cyan);
    font-weight: 800;
    text-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.engaging-reading ul, .engaging-reading ol {
    list-style: none;
    padding: 0;
    margin: 20px 0 28px;
}

.engaging-reading li {
    position: relative;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 16px 20px;
    padding-inline-start: 44px; /* room for bullet at line start */
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    line-height: 1.8;
}

.engaging-reading li:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(139, 92, 246, 0.04));
    border-color: rgba(6, 182, 212, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.engaging-reading li::before {
    content: '';
    position: absolute;
    inset-inline-start: 18px;
    top: 22px;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #22d3ee, #8b5cf6);
    box-shadow: 0 0 8px rgba(6,182,212,0.55);
}

.engaging-reading p {
    margin-bottom: 18px;
}

/* ============================================================
   USMLE-STYLE FULL-SCREEN EXAM & FLASHCARD VIEWER (LIGHT MODE)
   ============================================================ */

/* Full-screen overlay — replaces entire viewport */
.usmle-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    flex-direction: column;
    background: #dce3f0;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: #1a2035;
    overflow: hidden;
}

/* ---- Top Navigation Bar ---- */
.usmle-topbar {
    height: 52px;
    background: #1a3a6c;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    border-bottom: 2px solid #132e58;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    gap: 16px;
}

.usmle-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 220px;
}

.usmle-topbar-center {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    justify-content: center;
}

.usmle-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    justify-content: flex-end;
}

.usmle-item-info {
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    background: rgba(255,255,255,0.08);
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.12);
    white-space: nowrap;
}

.usmle-block-info {
    color: rgba(255,255,255,0.7);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.usmle-nav-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ffffff;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.usmle-nav-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
}

.usmle-nav-counter {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.usmle-tool-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}
.usmle-tool-btn:hover {
    background: rgba(255,255,255,0.18);
    color: #ffffff;
}

/* ---- Body layout: sidebar + content ---- */
.usmle-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---- Left Sidebar (question/card number list) — refined pill numbers ---- */
.usmle-sidebar {
    width: 72px;
    background: linear-gradient(180deg, #1f4380 0%, #17325f 100%);
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    padding: 14px 0;
}

.usmle-sidebar::-webkit-scrollbar { width: 4px; }
.usmle-sidebar::-webkit-scrollbar-track { background: transparent; }
.usmle-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.usmle-sidebar-item {
    width: 44px;
    height: 34px;
    margin: 4px auto;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.04);
    border: 1px solid transparent;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}
.usmle-sidebar-item:hover {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    transform: translateY(-1px);
}
.usmle-sidebar-item.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border-color: rgba(255,255,255,0.25);
    box-shadow: 0 6px 16px rgba(37,99,235,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
}
.usmle-sidebar-item.flagged::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: #f59e0b;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(245,158,11,0.7);
}
.usmle-sidebar-item.answered {
    background: rgba(34,197,94,0.16);
    color: rgba(220,255,235,0.9);
    border-color: rgba(34,197,94,0.28);
}

/* ---- Main Content Area ---- */
.usmle-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.usmle-question-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px 48px;
    background: #f4f6fb;
}

.usmle-question-area::-webkit-scrollbar { width: 6px; }
.usmle-question-area::-webkit-scrollbar-track { background: #e8ecf5; }
.usmle-question-area::-webkit-scrollbar-thumb { background: #b0bbcc; border-radius: 4px; }
.usmle-question-area::-webkit-scrollbar-thumb:hover { background: #8a96ad; }

/* Question text */
.usmle-question-text {
    font-size: 1.02rem;
    line-height: 1.75;
    color: #1a2035;
    font-weight: 500;
    margin-bottom: 28px;
    max-width: 820px;
    white-space: pre-wrap;
}

/* MCQ Options inside the exam viewer */
.usmle-mcq-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    max-width: 620px;
}

.usmle-option {
    padding: 10px 16px;
    border: 1.5px solid #b0bbcc;
    border-radius: 4px;
    background: #ffffff;
    cursor: pointer;
    font-size: 0.95rem;
    color: #1a2035;
    font-family: inherit;
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
}
.usmle-option:hover {
    background: #e8f0fe;
    border-color: #2563eb;
    color: #1a3a6c;
}
.usmle-option .usmle-opt-letter {
    font-weight: 800;
    color: #1a3a6c;
    min-width: 18px;
    flex-shrink: 0;
}
.usmle-option.selected {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1a3a6c;
}
.usmle-option.correct {
    background: rgba(34,197,94,0.12);
    border-color: #16a34a;
    color: #14532d;
    pointer-events: none;
}
.usmle-option.incorrect {
    background: rgba(239,68,68,0.1);
    border-color: #dc2626;
    color: #7f1d1d;
    pointer-events: none;
}
.usmle-option.revealed-correct {
    background: rgba(34,197,94,0.12);
    border-color: #16a34a;
    color: #14532d;
    pointer-events: none;
}

/* Dark mode contrast fixes for MCQ answer states */
body.dark-exam .usmle-option.selected,
body:not(.app-light-mode) .usmle-option.selected {
    background: rgba(59,130,246,0.22);
    border-color: #60a5fa;
    color: #dbeafe;
}
body.dark-exam .usmle-option.correct,
body.dark-exam .usmle-option.revealed-correct,
body:not(.app-light-mode) .usmle-option.correct,
body:not(.app-light-mode) .usmle-option.revealed-correct {
    background: rgba(34,197,94,0.25);
    border-color: #4ade80;
    color: #bbf7d0;
}
body.dark-exam .usmle-option.incorrect,
body:not(.app-light-mode) .usmle-option.incorrect {
    background: rgba(239,68,68,0.22);
    border-color: #f87171;
    color: #fecaca;
}

/* Flashcard answer reveal area */
.usmle-answer-reveal {
    background: #ffffff;
    border: 2px solid #2563eb;
    border-radius: 8px;
    padding: 20px 24px;
    margin-top: 20px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #1a3a6c;
    max-width: 820px;
    animation: fadeInUp 0.3s ease;
    white-space: pre-wrap;
}
.usmle-answer-reveal::before {
    content: 'Answer';
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

/* Sources block */
.usmle-sources-block {
    margin-top: 24px;
    border: 1px solid #b0bbcc;
    border-radius: 6px;
    overflow: hidden;
    max-width: 820px;
}
.usmle-sources-header {
    background: #e8ecf5;
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #1a3a6c;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.usmle-sources-block .sources-quote {
    padding: 14px 16px;
    font-size: 0.88rem;
    color: #2d3a4a;
    line-height: 1.6;
    font-style: italic;
    border-left: 3px solid #2563eb;
    margin: 12px 16px;
    background: #f8f9fc;
}

/* Show answer button */
.usmle-show-answer-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 11px 32px;
    border-radius: 5px;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 24px;
    display: inline-block;
}
.usmle-show-answer-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
    transform: translateY(-1px);
}

/* Flag button */
.usmle-flag-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.8);
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}
.usmle-flag-btn:hover {
    background: rgba(245,158,11,0.2);
    border-color: #f59e0b;
    color: #fcd34d;
}
.usmle-flag-btn.flagged {
    background: rgba(245,158,11,0.2);
    border-color: #f59e0b;
    color: #fcd34d;
}

/* Inside usmle-question-area (not statusbar), flag btn has different colors */
.usmle-question-area .usmle-flag-btn {
    border-color: #b0bbcc;
    color: #4a5568;
    background: #ffffff;
}
.usmle-question-area .usmle-flag-btn:hover {
    background: #fff8e1;
    border-color: #f59e0b;
    color: #d97706;
}
.usmle-question-area .usmle-flag-btn.flagged {
    background: #fff8e1;
    border-color: #f59e0b;
    color: #d97706;
}

/* ---- Bottom Action Bar ---- */
.usmle-action-bar {
    background: #e8ecf5;
    border-top: 2px solid #c5cedc;
    padding: 12px 48px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.usmle-proceed-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 9px 22px;
    border-radius: 5px;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}
.usmle-proceed-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 3px 10px rgba(37,99,235,0.3);
    transform: translateY(-1px);
}

.usmle-btn-end {
    background: #dc2626;
}
.usmle-btn-end:hover {
    background: #b91c1c;
    box-shadow: 0 3px 10px rgba(220,38,38,0.3);
}

.usmle-btn-disable {
    background: #64748b;
}
.usmle-btn-disable:hover {
    background: #475569;
    box-shadow: 0 3px 10px rgba(100,116,139,0.3);
}

.usmle-btn-forgot {
    background: #dc2626;
}
.usmle-btn-forgot:hover {
    background: #b91c1c;
    box-shadow: 0 3px 10px rgba(220,38,38,0.3);
}

.usmle-btn-easy {
    background: #16a34a;
}
.usmle-btn-easy:hover {
    background: #15803d;
    box-shadow: 0 3px 10px rgba(22,163,74,0.3);
}

/* ---- Bottom Status Bar ---- */
.usmle-statusbar {
    height: 42px;
    background: #1a3a6c;
    border-top: 2px solid #132e58;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    color: #a0b4cc;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Exam question card inside the USMLE viewer */
.usmle-question-card {
    max-width: 820px;
}

.usmle-question-num {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1a3a6c;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #c5cedc;
}

.usmle-question-body {
    font-size: 1.0rem;
    line-height: 1.75;
    color: #1a2035;
    margin-bottom: 24px;
    white-space: pre-wrap;
}

/* AI explanation box inside USMLE viewer */
.usmle-explain-box {
    margin-top: 16px;
    padding: 16px 20px;
    background: #f0f4ff;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    font-size: 0.92rem;
    line-height: 1.6;
    color: #1e3a5f;
}

/* Theme toggle: Dark mode override for USMLE screens */
body.dark-exam .usmle-fullscreen {
    background: #0f1117;
    color: #e2e8f0;
}
body.dark-exam .usmle-question-area {
    background: #111827;
}
body.dark-exam .usmle-question-text,
body.dark-exam .usmle-question-body {
    color: #e2e8f0;
}
body.dark-exam .usmle-option {
    background: #1a2035;
    border-color: rgba(99,130,200,0.25);
    color: #e2e8f0;
}
body.dark-exam .usmle-option .usmle-opt-letter { color: #60a5fa; }
body.dark-exam .usmle-option:hover {
    background: rgba(37,99,235,0.15);
    border-color: #2563eb;
}
body.dark-exam .usmle-option.selected { background: rgba(37,99,235,0.2); }
body.dark-exam .usmle-answer-reveal {
    background: rgba(37,99,235,0.08);
    border-color: #2563eb;
    color: #93c5fd;
}
body.dark-exam .usmle-action-bar {
    background: #1a2035;
    border-top-color: rgba(99,130,200,0.2);
}
body.dark-exam .usmle-sources-block {
    border-color: rgba(99,130,200,0.2);
}
body.dark-exam .usmle-sources-header {
    background: rgba(99,130,200,0.1);
    color: #93c5fd;
}
body.dark-exam .usmle-sources-block .sources-quote {
    color: #94a3b8;
    background: rgba(0,0,0,0.2);
}

/* ============================================================
   GLOBAL LIGHT MODE TOGGLE (Workspace & UI)
   ============================================================ */
body.app-light-mode {
    --bg-deep: #f0f4f8;
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-elevated: #e2e8f0;
    --bg-glass: rgba(255, 255, 255, 0.75);
    --bg-glass-strong: rgba(255, 255, 255, 0.95);

    --border-subtle: rgba(15, 23, 42, 0.08);
    --border-medium: rgba(15, 23, 42, 0.15);
    --border-glow: rgba(37, 99, 235, 0.25);

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #475569;
    --text-dim: #64748b;

    /* Maintain gradients but adjust shadow intensities for light mode */
    --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);
    --shadow-glow-cyan: 0 0 15px rgba(6,182,212,0.3);
    --shadow-glow-violet: 0 0 15px rgba(139,92,246,0.3);

    --flashcard-bg: rgba(245, 158, 11, 0.15);
    --flashcard-text: #b45309;
}

body.app-light-mode::before {
    /* Mesh background for light mode */
    background:
        radial-gradient(ellipse 80% 50% at 20% 20%, rgba(6,182,212,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(139,92,246,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 50% 60% at 50% 50%, rgba(59,130,246,0.06) 0%, transparent 70%);
}

/* Modal Content in light mode needs background/text overrides specifically if they hardcode colors */
body.app-light-mode .modal {
    background: rgba(240, 244, 248, 0.85); /* lighter overlay */
}

body.app-light-mode .exam-modal-content {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-lg);
}

body.app-light-mode .btn-dark-pill {
    background: #e2e8f0;
    color: #0f172a;
    border: 1px solid #cbd5e1;
}

body.app-light-mode .btn-dark-pill:hover {
    background: #cbd5e1;
}

/* Topbar override for light mode to match USMLE feel */
body.app-light-mode #topbar {
    background: #1a3a6c; /* USMLE Navy */
    border-bottom: 1px solid #132e58;
    box-shadow: 0 4px 12px rgba(26, 58, 108, 0.2);
    color: #ffffff;
}
body.app-light-mode #topbar .doc-title,
body.app-light-mode #topbar .btn-icon,
body.app-light-mode #topbar .main-nav-tab {
    color: #ffffff;
}
body.app-light-mode #topbar .doc-subtitle {
    color: #93c5fd;
}
body.app-light-mode #topbar .main-nav-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}
body.app-light-mode #topbar .main-nav-tab.active {
    background: #2563eb; /* USMLE Bright Blue */
    color: #ffffff;
    border: 1px solid #3b82f6;
}

/* Sidebar override for light mode to match USMLE feel */
body.app-light-mode #sidebar-menu {
    background: #1a3a6c; /* USMLE Navy */
    border-right: 1px solid #132e58;
    color: #ffffff;
}
body.app-light-mode #sidebar-menu .sidebar-header h2,
body.app-light-mode #sidebar-menu .sidebar-section-label,
body.app-light-mode #sidebar-menu .btn-icon,
body.app-light-mode #sidebar-menu .stat-card {
    color: #ffffff;
}
body.app-light-mode #sidebar-menu .stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
body.app-light-mode .doc-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
body.app-light-mode .doc-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Summary View & Markdown overrides for Light Mode (Eye-Comfort Reading Mode) */
body.app-light-mode #summary-view {
    /* Matching the clean gray-blue background of the flashcard viewer */
    background: #f4f6fb; 
}

body.app-light-mode .markdown-body {
    /* Soft charcoal text, never pure black for long reading */
    color: #2c3338;
    line-height: 1.7; /* Slightly increased for readability */
}
body.app-light-mode .markdown-body h1 {
    /* Deep slate blue for primary headings to anchor the eye */
    color: #1a3a6c; /* Match USMLE Navy */
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}
body.app-light-mode .markdown-body h2 {
    color: #1e3a8a; /* Dark blue */
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
}
body.app-light-mode .markdown-body h3,
body.app-light-mode .markdown-body h4 {
    /* Muted slate for subheadings */
    color: #2563eb; /* Bright blue */
}
body.app-light-mode .markdown-body p,
body.app-light-mode .markdown-body ul,
body.app-light-mode .markdown-body ol {
    color: #1a2035;
    font-weight: 500;
}
body.app-light-mode .markdown-body strong {
    /* Bolder but not completely black */
    color: #0f172a;
    background: rgba(37, 99, 235, 0.08); /* Subtle blue highlight behind bold terms */
    padding: 0 2px;
    border-radius: 2px;
}
body.app-light-mode .markdown-body code {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}
body.app-light-mode .markdown-body blockquote {
    border-left: 4px solid #2563eb; /* Blue accent */
    background: #ffffff;
    color: #334155;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    box-shadow: var(--shadow-sm);
}

/* Study Plan Section overrrides (Summary Chunks) */
body.app-light-mode .accordion-item {
    background: #ffffff;
    border: 1px solid #bfdbfe; /* Light blue border */
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.05);
}
body.app-light-mode .accordion-header {
    background: #f4f6fb;
    color: #1a3a6c; /* USMLE Navy text */
    border-bottom: 1px solid #e2e8f0;
}
body.app-light-mode .accordion-header:hover {
    background: #eff6ff;
}
body.app-light-mode .accordion-content {
    color: #334155;
}
body.app-light-mode .acc-num {
    background: none;
    -webkit-text-fill-color: #2563eb; /* USMLE bright blue */
    color: #2563eb;
}

/* Doc Explain overrides */
body.app-light-mode .engaging-reading,
.usmle-fullscreen .engaging-reading {
    font-family: 'Tajawal', 'Inter', sans-serif !important;
    color: #1a2035 !important;
    font-weight: 500;
}
.usmle-fullscreen .engaging-reading ul,
.usmle-fullscreen .engaging-reading ol {
    padding-right: 24px !important;
    padding-left: 0 !important;
}
.usmle-fullscreen .engaging-reading h1 {
    color: #1a3a6c !important;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}
.usmle-fullscreen .engaging-reading h2 {
    color: #1e3a8a !important;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
}
.usmle-fullscreen .engaging-reading h3,
.usmle-fullscreen .engaging-reading h4 {
    color: #2563eb !important;
}
.usmle-fullscreen .engaging-reading p,
.usmle-fullscreen .engaging-reading li {
    color: #1a2035 !important;
    font-weight: 500;
}
.usmle-fullscreen .engaging-reading strong {
    color: #0f172a !important;
    background: rgba(37, 99, 235, 0.08);
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 700;
}

/* Dark-mode override for Smart Explain (doc-explain) modal — the usmle-fullscreen
   base above forces near-black text which is unreadable on the dark surface. */
body:not(.app-light-mode) #doc-explain-modal.usmle-fullscreen .engaging-reading,
body:not(.app-light-mode) #doc-explain-modal.usmle-fullscreen .engaging-reading p,
body:not(.app-light-mode) #doc-explain-modal.usmle-fullscreen .engaging-reading li {
    color: #e2e8f0 !important;
}
body:not(.app-light-mode) #doc-explain-modal.usmle-fullscreen .engaging-reading h1 {
    color: #a5f3fc !important;
    border-bottom-color: rgba(148,163,184,0.25) !important;
}
body:not(.app-light-mode) #doc-explain-modal.usmle-fullscreen .engaging-reading h2 {
    color: #c4b5fd !important;
    border-bottom-color: rgba(148,163,184,0.18) !important;
}
body:not(.app-light-mode) #doc-explain-modal.usmle-fullscreen .engaging-reading h3,
body:not(.app-light-mode) #doc-explain-modal.usmle-fullscreen .engaging-reading h4 {
    color: #67e8f9 !important;
}
body:not(.app-light-mode) #doc-explain-modal.usmle-fullscreen .engaging-reading strong {
    color: #a5f3fc !important;
    background: rgba(34,211,238,0.12) !important;
    padding: 0 4px;
    border-radius: 4px;
}
body:not(.app-light-mode) #doc-explain-modal.usmle-fullscreen .engaging-reading li {
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)) !important;
    border: 1px solid rgba(148,163,184,0.14) !important;
}

/* Quiz Cards Light Mode overrides */
body.app-light-mode .quiz-card {
    background: #ffffff;
    border: 1px solid var(--border-medium);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    color: #1a2035;
    font-weight: 500;
}
body.app-light-mode .quiz-input {
    background: #f8fafc;
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
}
body.app-light-mode .mcq-options-wrapper > div {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #1a2035 !important;
    font-weight: 500;
}
body.app-light-mode .mcq-options-wrapper > div:hover {
    background: #f1f5f9 !important;
}

/* Exam Simulation overrides */
body.app-light-mode .usmle-question-body {
    color: #1a2035;
    font-weight: 500;
}
body.app-light-mode .usmle-option {
    font-weight: 500;
}

/* ============================================================
   i18n — Language modals
   ============================================================ */
.omn-lang-modal {
    position: fixed; inset: 0; z-index: 20000;
    background: rgba(6, 8, 18, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; animation: fadeInUp 0.25s ease;
}
.omn-lang-card {
    width: 100%; max-width: 520px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: linear-gradient(160deg, rgba(30,32,54,0.98), rgba(18,20,36,0.98));
    border: 1px solid rgba(139,92,246,0.28);
    border-radius: 20px; padding: 32px 28px;
    box-shadow: 0 30px 90px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03) inset;
}
.omn-lang-card::-webkit-scrollbar { width: 8px; }
.omn-lang-card::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.4); border-radius: 8px; }
.omn-lang-card::-webkit-scrollbar-track { background: transparent; }

.omn-lang-title { font-size: 1.6rem; font-weight: 800; color: #f4f5ff; margin-bottom: 8px;
    background: linear-gradient(90deg, #06b6d4, #8b5cf6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.omn-lang-sub { font-size: 0.9rem; color: #aab0c6; margin-bottom: 22px; line-height: 1.55; }
.omn-lang-section-title { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #c9cee5; margin-bottom: 8px; }
html[dir="rtl"] body { direction: rtl; text-align: right; }
html[dir="rtl"] .markdown-body, html[dir="rtl"] #editor-container, html[dir="rtl"] #summary-content, html[dir="rtl"] #chat-messages, html[dir="rtl"] #doc-explain-modal-content { direction: ltr; text-align: left; }
.omn-lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.omn-lang-opt {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    padding: 14px 16px; border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1.5px solid rgba(255,255,255,0.08);
    color: #e8ebff; cursor: pointer; text-align: left;
    transition: all 0.18s ease; font-family: inherit;
}
.omn-lang-opt:hover { border-color: rgba(139,92,246,0.5); background: rgba(139,92,246,0.08); transform: translateY(-1px); }
.omn-lang-opt.selected {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, rgba(6,182,212,0.14), rgba(139,92,246,0.16));
    box-shadow: 0 0 0 3px rgba(139,92,246,0.18);
}
.omn-lang-flag { font-size: 1.6rem; }
.omn-lang-name { font-size: 1rem; font-weight: 700; }
.omn-lang-en { font-size: 0.75rem; color: #8b93b0; }
.omn-lang-continue {
    margin-top: 22px; width: 100%; padding: 13px;
    border: none; border-radius: 11px;
    background: linear-gradient(90deg, #06b6d4, #8b5cf6);
    color: #fff; font-weight: 800; font-size: 0.95rem;
    cursor: pointer; transition: all 0.18s ease; font-family: inherit;
}
.omn-lang-continue:disabled { opacity: 0.45; cursor: not-allowed; }
.omn-lang-continue:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(139,92,246,0.35); }
.omn-lang-cancel {
    padding: 13px; border: 1px solid rgba(255,255,255,0.14);
    border-radius: 11px; background: transparent; color: #cfd3e6;
    font-weight: 700; cursor: pointer; font-family: inherit;
}
.omn-lang-cancel:hover { background: rgba(255,255,255,0.04); }

/* RTL support when Arabic selected */
html[data-user-lang="ar"] .usmle-answer-reveal,
html[data-user-lang="ar"] #doc-explain-modal-content,
html[data-user-lang="ar"] #popover-content {
    direction: rtl; text-align: right;
}

/* ============================================================
   Enhanced MCQ visuals (Topic Mini-Quiz)
   ============================================================ */
.quiz-card {
    background: linear-gradient(155deg, rgba(30,32,54,0.7), rgba(18,20,36,0.7));
    border: 1px solid rgba(139,92,246,0.18) !important;
    border-radius: 16px !important;
    padding: 20px 22px !important;
    margin: 18px 0 !important;
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.mcq-options-wrapper { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.mcq-options-wrapper > div {
    background: rgba(255,255,255,0.03) !important;
    border: 1.5px solid rgba(255,255,255,0.08) !important;
    border-radius: 12px !important;
    padding: 13px 16px !important;
    font-size: 0.95rem;
    color: #e8ebff;
    transition: all 0.2s ease !important;
    position: relative;
}
.mcq-options-wrapper > div:hover {
    transform: translateY(-1px);
    border-color: rgba(139,92,246,0.55) !important;
    background: rgba(139,92,246,0.09) !important;
    box-shadow: 0 6px 16px rgba(139,92,246,0.18);
}
.mcq-options-wrapper > div.mcq-picked-correct {
    background: rgba(16,185,129,0.14) !important;
    border-color: #10b981 !important;
    color: #d1fae5 !important;
    animation: mcqPulseOk 0.5s ease;
}
.mcq-options-wrapper > div.mcq-picked-wrong {
    background: rgba(239,68,68,0.14) !important;
    border-color: #ef4444 !important;
    color: #fecaca !important;
    animation: mcqShake 0.45s ease;
}
.mcq-options-wrapper > div.mcq-reveal-correct {
    background: rgba(16,185,129,0.08) !important;
    border-color: #10b981 !important;
    color: #a7f3d0 !important;
}
@keyframes mcqPulseOk { 0% { transform: scale(1); } 50% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes mcqShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ============================================================
   Enhanced Flashcard Review (USMLE-review reuse)
   ============================================================ */
#review-modal .usmle-question-area {
    padding-top: 8px;
}
#review-modal .usmle-question-text#card-front {
    background: linear-gradient(155deg, #ffffff, #f5f7ff);
    border: 1px solid #dbe1f5;
    border-radius: 16px;
    padding: 32px 30px;
    font-size: 1.35rem;
    font-weight: 600;
    color: #1a2035;
    max-width: 820px;
    box-shadow: 0 20px 40px rgba(37,99,235,0.09), 0 0 0 1px rgba(255,255,255,0.6) inset;
    position: relative;
    animation: fcFlipIn 0.42s cubic-bezier(.2,.9,.3,1.2);
    line-height: 1.55;
}
#review-modal .usmle-question-text#card-front::before {
    content: 'Question';
    position: absolute; top: 14px; left: 22px;
    font-size: 0.68rem; font-weight: 800;
    letter-spacing: 1.4px; text-transform: uppercase;
    color: #2563eb; opacity: 0.75;
}
#review-modal .usmle-answer-reveal#card-back {
    background: linear-gradient(155deg, #ecfdf5, #e0f2fe);
    border: 2px solid #10b981;
    border-radius: 16px;
    padding: 28px 26px 24px;
    margin-top: 18px;
    color: #064e3b;
    font-size: 1.08rem;
    max-width: 820px;
    box-shadow: 0 18px 36px rgba(16,185,129,0.15);
    animation: fcFlipIn 0.42s cubic-bezier(.2,.9,.3,1.2);
}
#review-modal .usmle-answer-reveal#card-back::before {
    content: 'Answer';
    color: #059669;
}
#review-modal .usmle-show-answer-btn {
    background: linear-gradient(90deg, #2563eb, #7c3aed);
    padding: 13px 40px;
    border-radius: 12px;
    font-size: 0.98rem;
    box-shadow: 0 10px 24px rgba(124,58,237,0.28);
}
#review-modal .usmle-show-answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(124,58,237,0.4);
}
#review-modal .usmle-btn-easy { background: linear-gradient(90deg, #10b981, #059669) !important; }
#review-modal .usmle-btn-forgot { background: linear-gradient(90deg, #ef4444, #dc2626) !important; }
#review-modal .usmle-btn-disable { background: linear-gradient(90deg, #6b7280, #4b5563) !important; }

@keyframes fcFlipIn {
    0%   { opacity: 0; transform: perspective(800px) rotateX(-14deg) translateY(10px); }
    100% { opacity: 1; transform: perspective(800px) rotateX(0) translateY(0); }
}

html[data-user-lang="ar"] #review-modal .usmle-question-text#card-front,
html[data-user-lang="ar"] #review-modal .usmle-answer-reveal#card-back {
    direction: rtl; text-align: right;
}
html[data-user-lang="ar"] #review-modal .usmle-question-text#card-front::before,
html[data-user-lang="ar"] #review-modal .usmle-answer-reveal#card-back::before {
    left: auto; right: 22px;
}

/* ============================================================
   Modern Review / Flashcard Redesign — same palette, softer & modern
   Overrides USMLE-style modal to feel more contemporary and
   eye-comfortable. Colors keep the navy/blue/emerald family.
   ============================================================ */

#review-modal.usmle-fullscreen {
    background: radial-gradient(1200px 800px at 20% 0%, #e8edf7 0%, #dce3f0 55%, #d3dbec 100%);
    color: #1a2035;
}

/* Softer, glassier topbar with subtle gradient */
#review-modal .usmle-topbar {
    height: 60px;
    background: linear-gradient(180deg, #1f4380 0%, #17325f 100%);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 4px 20px rgba(15, 30, 60, 0.25);
    padding: 0 24px;
    backdrop-filter: blur(8px);
}

#review-modal .usmle-item-info {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

#review-modal .usmle-block-info {
    color: rgba(255,255,255,0.62);
    font-size: 0.78rem;
    letter-spacing: 0.01em;
}

#review-modal .usmle-nav-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    padding: 7px 18px;
    font-size: 0.8rem;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
#review-modal .usmle-nav-btn:hover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.32);
    transform: translateY(-1px);
}

#review-modal .usmle-nav-counter {
    background: rgba(0,0,0,0.18);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    padding: 4px 14px;
    min-width: 72px;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
}

#review-modal .usmle-tool-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.78rem;
    transition: transform 0.18s ease, background 0.18s ease;
}
#review-modal .usmle-tool-btn:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-1px);
}

/* Refined sidebar: pill numbers with generous spacing */
#review-modal .usmle-sidebar {
    width: 72px;
    background: linear-gradient(180deg, #1f4380 0%, #17325f 100%);
    border-right: 1px solid rgba(255,255,255,0.05);
    padding: 14px 0;
}
#review-modal .usmle-sidebar-item {
    width: 44px;
    height: 34px;
    margin: 4px auto;
    border-radius: 10px;
    font-size: 0.78rem;
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.55);
    border: 1px solid transparent;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
#review-modal .usmle-sidebar-item:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    transform: translateY(-1px);
}
#review-modal .usmle-sidebar-item.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
    box-shadow: 0 6px 16px rgba(37,99,235,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
}
#review-modal .usmle-sidebar-item.answered {
    background: rgba(34,197,94,0.16);
    color: rgba(220,255,235,0.9);
    border-color: rgba(34,197,94,0.28);
}
#review-modal .usmle-sidebar-item.flagged::after {
    top: 4px;
    right: 4px;
    box-shadow: 0 0 6px rgba(245,158,11,0.7);
}

/* Content: warmer off-white surface, roomier */
#review-modal .usmle-question-area {
    background: transparent;
    padding: 40px 56px;
    max-width: 980px;
    margin: 0 auto;
    width: 100%;
}

#review-modal .usmle-question-text#card-front,
#review-modal .usmle-answer-reveal#card-back {
    background: #ffffff;
    border: 1px solid #e2e8f2;
    border-radius: 18px;
    box-shadow: 0 10px 30px -18px rgba(20, 40, 90, 0.25), 0 1px 0 rgba(255,255,255,0.6) inset;
    padding: 32px 36px;
    line-height: 1.7;
}

#review-modal .usmle-show-answer-btn {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 28px;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 8px 20px -8px rgba(37,99,235,0.55);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#review-modal .usmle-show-answer-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px -8px rgba(37,99,235,0.7);
}

#review-modal .usmle-flag-btn {
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.78rem;
}

#review-modal .usmle-action-bar {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(20,40,90,0.08);
    padding: 14px 24px;
    gap: 12px;
}
#review-modal .usmle-proceed-btn {
    border-radius: 999px !important;
    padding: 10px 22px !important;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 16px -8px rgba(0,0,0,0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
#review-modal .usmle-proceed-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

/* Status bar: minimal + calmer */
#review-modal .usmle-statusbar {
    background: linear-gradient(180deg, #17325f 0%, #122747 100%);
    color: rgba(255,255,255,0.72);
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    padding: 10px 24px;
}
#review-modal .usmle-statusbar #review-status-text {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 4px 12px;
    border-radius: 999px;
}

/* Hide upload button when inside an open document */
body.doc-open .btn-upload-top { display: none !important; }


/* ==================================================================
   EMPTY HOME STATE — big centered upload CTA when user has no docs
   ================================================================== */
#home-empty-state { display: none; }
#home-view.home-empty .home-header { display: none; }
#home-view.home-empty #home-subjects-grid { display: none; }
#home-view.home-empty #home-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: calc(100vh - 140px);
    padding: 40px 20px;
    animation: emptyFadeIn 0.6s ease both;
}
@keyframes emptyFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#home-empty-state .empty-illustration {
    font-size: 4.5rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 12px 30px rgba(59,130,246,0.35));
    animation: emptyFloat 4s ease-in-out infinite;
}
@keyframes emptyFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
#home-empty-state .empty-title {
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 10px;
    letter-spacing: -0.02em;
}
#home-empty-state .empty-subtitle {
    color: var(--text-secondary);
    max-width: 520px;
    font-size: 1.02rem;
    line-height: 1.55;
    margin: 0 0 32px;
}
.btn-empty-upload {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 18px 34px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 60%, #8b5cf6 100%);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 18px 40px -12px rgba(59,130,246,0.55), 0 0 0 1px rgba(255,255,255,0.08) inset;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
}
.btn-empty-upload:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 24px 55px -14px rgba(99,102,241,0.7); }
.btn-empty-upload .upload-glow {
    position: absolute; inset: -30%;
    background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.3), transparent 40%);
    animation: uploadSpin 4s linear infinite;
    pointer-events: none;
}
@keyframes uploadSpin { to { transform: rotate(360deg); } }
.btn-empty-upload .upload-ico, .btn-empty-upload span:last-child { position: relative; z-index: 1; }
.empty-tour-link {
    margin-top: 18px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    opacity: 0.75;
    transition: opacity 0.2s;
}
.empty-tour-link:hover { opacity: 1; color: var(--text-primary); }

/* ==================================================================
   GUIDED TOUR — spotlight overlay
   ================================================================== */
#omn-tour-overlay {
    position: fixed; inset: 0;
    z-index: 99999;
    pointer-events: none;
    animation: tourFadeIn 0.25s ease both;
}
@keyframes tourFadeIn { from { opacity: 0; } to { opacity: 1; } }
#omn-tour-spotlight {
    position: fixed;
    top: 0; left: 0; width: 0; height: 0;
    border-radius: 14px;
    box-shadow:
        0 0 0 9999px rgba(5, 10, 25, 0.72),
        0 0 0 2px rgba(139, 92, 246, 0.9),
        0 0 40px 6px rgba(99, 102, 241, 0.55);
    transition: top 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                left 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                height 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}
#omn-tour-spotlight.pulse {
    animation: tourPulse 1.6s ease-in-out infinite;
}
@keyframes tourPulse {
    0%, 100% { box-shadow: 0 0 0 9999px rgba(5,10,25,0.72), 0 0 0 2px rgba(139,92,246,0.9), 0 0 40px 6px rgba(99,102,241,0.55); }
    50%      { box-shadow: 0 0 0 9999px rgba(5,10,25,0.72), 0 0 0 4px rgba(139,92,246,1),   0 0 70px 14px rgba(139,92,246,0.85); }
}
#omn-tour-tooltip {
    position: fixed;
    width: 340px;
    max-width: calc(100vw - 32px);
    padding: 20px 22px;
    background: linear-gradient(160deg, rgba(20,25,45,0.98), rgba(15,20,35,0.98));
    color: #f1f5f9;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 16px;
    box-shadow: 0 25px 60px -15px rgba(0,0,0,0.7);
    backdrop-filter: blur(14px);
    transition: top 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                left 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    font-family: inherit;
    pointer-events: auto;
}
body.light-mode #omn-tour-tooltip {
    background: linear-gradient(160deg, #ffffff, #f8fafc);
    color: #0f172a;
    border-color: rgba(99,102,241,0.35);
}
.tour-step-count {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a78bfa;
    margin-bottom: 6px;
}
.tour-step-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}
.tour-step-body {
    font-size: 0.92rem;
    line-height: 1.55;
    opacity: 0.85;
    margin-bottom: 18px;
}
.tour-step-actions { display: flex; align-items: center; gap: 8px; }
.tour-btn-skip, .tour-btn-back, .tour-btn-next {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: inherit;
}
.tour-btn-skip {
    background: transparent;
    color: #94a3b8;
    padding: 8px 4px;
}
.tour-btn-skip:hover { color: #f1f5f9; }
body.light-mode .tour-btn-skip { color: #64748b; }
body.light-mode .tour-btn-skip:hover { color: #0f172a; }
.tour-btn-back {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    border-color: rgba(255,255,255,0.12);
}
.tour-btn-back:hover { background: rgba(255,255,255,0.12); }
body.light-mode .tour-btn-back { background: rgba(15,23,42,0.05); color: #0f172a; border-color: rgba(15,23,42,0.12); }
.tour-btn-next {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 8px 20px -6px rgba(99,102,241,0.6);
}
.tour-btn-next:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -6px rgba(139,92,246,0.75); }
#omn-tour-close {
    position: fixed;
    top: 16px; right: 16px;
    width: 40px; height: 40px;
    border-radius: 999px;
    background: rgba(15,20,35,0.85);
    color: #f1f5f9;
    border: 1px solid rgba(255,255,255,0.15);
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: transform 0.2s, background 0.2s;
    pointer-events: auto;
}
#omn-tour-close:hover { transform: scale(1.08); background: rgba(30,41,59,0.95); }

/* ==================================================================
   BRAND LOGO — sidebar + login
   ================================================================== */
.brand-heading {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 0;
}
.brand-logo-img {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(99,102,241,0.35));
}
.login-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}
.login-logo-img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(99,102,241,0.4));
}

/* ============ Scheduler ============ */
#scheduler-view {
    flex: 1;
    min-height: 100vh;
    overflow-y: auto;
    padding: 32px 40px 60px;
    background:
        radial-gradient(ellipse at top left, rgba(59,130,246,0.08), transparent 50%),
        radial-gradient(ellipse at top right, rgba(139,92,246,0.06), transparent 50%);
}
.sched-shell { max-width: 1400px; margin: 0 auto; }
.sched-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 20px; margin-bottom: 24px; flex-wrap: wrap;
}
.sched-kicker {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text-secondary); margin-bottom: 8px;
}
.sched-kicker-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    box-shadow: 0 0 12px rgba(139,92,246,0.6);
}
.sched-title {
    font-size: 34px; font-weight: 700; margin: 0;
    background: linear-gradient(135deg, #fff, #c7d2fe);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sched-subtitle { color: var(--text-secondary); margin: 6px 0 0; max-width: 520px; }
.sched-actions { display: flex; gap: 10px; }
.sched-actions .btn-action { padding: 10px 16px; border-radius: 12px; }
.sched-actions .btn-action.primary { background: var(--gradient-brand); color: #fff; border: none; }
.btn-ico { margin-right: 4px; }

.sched-body {
    display: grid; grid-template-columns: minmax(0, 1fr) 340px;
    gap: 22px; align-items: start;
}
@media (max-width: 1100px) { .sched-body { grid-template-columns: 1fr; } }

.sched-calendar-wrap {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 20px; padding: 20px;
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.sched-cal-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.sched-cal-nav { display: flex; gap: 6px; }
.sched-nav-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 6px 14px; border-radius: 10px; cursor: pointer;
    font-size: 14px; transition: all 0.15s;
}
.sched-nav-btn:hover { background: rgba(139,92,246,0.15); border-color: rgba(139,92,246,0.4); }
.sched-cal-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.sched-legend { display: flex; gap: 10px; font-size: 12px; color: var(--text-secondary); }
.sched-chip { display: inline-flex; align-items: center; gap: 6px; }
.sched-chip .sched-dot { width: 8px; height: 8px; border-radius: 50%; }
.sched-chip.study .sched-dot { background: #3b82f6; box-shadow: 0 0 8px rgba(59,130,246,0.6); }
.sched-chip.exam .sched-dot { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.6); }

.sched-cal-dow {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 6px; margin-bottom: 6px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-secondary);
}
.sched-cal-dow > div { padding: 6px 8px; text-align: left; }
.sched-cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(96px, auto); gap: 6px;
}
.sched-cell {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 12px; padding: 8px; cursor: pointer;
    display: flex; flex-direction: column; gap: 6px;
    transition: all 0.15s; min-height: 96px;
}
.sched-cell:hover {
    background: rgba(139,92,246,0.06);
    border-color: rgba(139,92,246,0.35);
    transform: translateY(-1px);
}
.sched-cell.muted { opacity: 0.4; }
.sched-cell.today {
    border-color: rgba(59,130,246,0.55);
    box-shadow: inset 0 0 0 1px rgba(59,130,246,0.35);
}
.sched-cell.selected {
    background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15));
    border-color: rgba(139,92,246,0.6);
}
.sched-cell-day { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.sched-cell.today .sched-cell-day {
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}
.sched-cell-items { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.sched-cell-chip {
    font-size: 10.5px; padding: 3px 6px; border-radius: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border: 1px solid transparent;
}
.sched-cell-chip.study {
    background: rgba(59,130,246,0.18); color: #93c5fd;
    border-color: rgba(59,130,246,0.35);
}
.sched-cell-chip.exam {
    background: rgba(239,68,68,0.18); color: #fca5a5;
    border-color: rgba(239,68,68,0.35);
}
.sched-cell-chip.srs {
    background: rgba(168,85,247,0.20); color: #d8b4fe;
    border-color: rgba(168,85,247,0.40);
}
.sched-item.srs {
    border-left: 3px solid #a855f7;
    background: linear-gradient(90deg, rgba(168,85,247,0.10), transparent);
}
.sched-cell-more { font-size: 10px; color: var(--text-secondary); padding-left: 4px; }

/* Side panel */
.sched-side { display: flex; flex-direction: column; gap: 16px; }
.sched-side-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 18px; padding: 16px;
    backdrop-filter: blur(14px);
}
.sched-side-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.sched-side-title { font-weight: 600; color: var(--text-primary); font-size: 15px; }
.sched-add-mini {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff; border: none; width: 30px; height: 30px;
    border-radius: 50%; cursor: pointer; font-size: 16px;
}
.sched-day-list { display: flex; flex-direction: column; gap: 8px; }
.sched-empty { color: var(--text-secondary); font-size: 13px; padding: 12px 4px; text-align: center; }
.sched-item {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 12px; border-radius: 12px; cursor: pointer;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle);
    transition: all 0.15s;
}
.sched-item:hover { background: rgba(139,92,246,0.08); border-color: rgba(139,92,246,0.35); }
.sched-item.exam { border-left: 3px solid #ef4444; }
.sched-item.study { border-left: 3px solid #3b82f6; }
.sched-item-ico { font-size: 18px; line-height: 1.4; }
.sched-item-main { flex: 1; min-width: 0; }
.sched-item-title { font-weight: 600; color: var(--text-primary); font-size: 14px; margin-bottom: 4px; }
.sched-item-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.sched-tag {
    font-size: 11px; padding: 2px 8px; border-radius: 999px;
    background: rgba(255,255,255,0.05); color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}
.sched-item-notes { font-size: 12px; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }
.sched-item-del {
    background: transparent; border: none; color: var(--text-secondary);
    cursor: pointer; padding: 4px 6px; border-radius: 6px; font-size: 14px;
    opacity: 0.5; transition: all 0.15s;
}
.sched-item-del:hover { opacity: 1; background: rgba(239,68,68,0.15); color: #ef4444; }

/* Modal form fields */
.sched-lbl {
    display: block; font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-secondary);
    margin: 12px 0 6px;
}
.sched-input {
    width: 100%; padding: 10px 12px; border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary); font-size: 14px;
    font-family: inherit;
}
.sched-input:focus {
    outline: none; border-color: rgba(139,92,246,0.55);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}
.sched-type-btn {
    flex: 1; padding: 10px 14px; border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary); cursor: pointer;
    font-size: 14px; transition: all 0.15s;
}
.sched-type-btn:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }
.sched-type-btn.active {
    background: linear-gradient(135deg, rgba(59,130,246,0.25), rgba(139,92,246,0.25));
    border-color: rgba(139,92,246,0.55);
    color: #fff;
}

/* Scheduler modal layout overrides (base .modal-body is a centered flex row) */
#scheduler-modal .modal-content {
    width: 560px; max-width: 95vw; max-height: 90vh;
}
#scheduler-modal .modal-body {
    display: block; padding: 20px; overflow-y: auto;
}
#scheduler-modal .modal-header { align-items: center; }
#scheduler-modal select.sched-input {
    appearance: none; -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
                      linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 32px;
}
#scheduler-modal .sched-input { box-sizing: border-box; }
#scheduler-modal select.sched-input option,
#scheduler-modal select.sched-input optgroup {
    background-color: #1a1f2e;
    color: #f1f5f9;
}

@media (max-width: 700px) {
    #scheduler-view { padding: 20px 16px 60px; }
    .sched-title { font-size: 26px; }
    .sched-cal-grid { grid-auto-rows: minmax(72px, auto); }
    .sched-cell { min-height: 72px; padding: 6px; }
    .sched-cell-chip { display: none; }
}

/* Profile circle button in topbar */
.profile-circle-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--border-medium);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary, #6366f1));
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    overflow: visible;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    margin-left: 4px;
    flex-shrink: 0;
}
.profile-circle-btn:hover {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    border-color: var(--accent-primary);
}
.profile-circle-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.profile-circle-btn #profile-circle-initial {
    text-transform: uppercase;
    line-height: 1;
    letter-spacing: 0.02em;
}
.profile-plan-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    border: 1.5px solid var(--bg-primary, #0b1020);
    pointer-events: none;
    white-space: nowrap;
}
.profile-plan-badge.is-free {
    background: linear-gradient(135deg, #64748b, #475569);
}
.profile-plan-badge.is-pro {
    background: linear-gradient(90deg, #06b6d4, #8b5cf6);
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.55);
}
.profile-plan-badge.is-aplus {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.6);
}
body.app-light-mode .profile-plan-badge {
    border-color: #ffffff;
}

/* Compact credits chip next to the profile circle in the topbar. */
.topbar-credit-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    height: 34px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary, #e8ebff);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    line-height: 1;
    white-space: nowrap;
}
.topbar-credit-chip:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(6,182,212,0.4);
    transform: translateY(-1px);
}
.topbar-credit-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22d3ee;
    box-shadow: 0 0 6px #22d3ee55;
}

/* Small "Upgrade" CTA next to the profile circle. */
.topbar-upgrade-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(6, 182, 212, 0.45);
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 8px 22px -12px rgba(6, 182, 212, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.topbar-upgrade-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 12px 28px -12px rgba(139, 92, 246, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.topbar-upgrade-btn [data-lucide] {
    width: 14px;
    height: 14px;
    pointer-events: none;
}
@media (max-width: 720px) {
    .topbar-upgrade-btn .topbar-upgrade-label { display: none; }
    .topbar-upgrade-btn { padding: 0 10px; }
}
body.app-light-mode .topbar-upgrade-btn {
    border-color: rgba(6, 182, 212, 0.5);
    box-shadow: 0 6px 18px -10px rgba(6, 182, 212, 0.55);
}
.topbar-credit-num {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}
body.app-light-mode .topbar-credit-chip {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.18);
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
body.app-light-mode .topbar-credit-chip:hover {
    background: #f8fafc;
    border-color: rgba(8, 145, 178, 0.55);
    color: #0e7490;
}
body.app-light-mode .topbar-credit-num {
    color: #0f172a;
}


/* Light mode: progress badge contrast fix */
body.app-light-mode .progress-badge {
    background: rgba(15, 23, 42, 0.06);
    border-color: rgba(15, 23, 42, 0.12);
    color: #334155;
}
body.app-light-mode .progress-badge.in-progress {
    background: rgba(8, 145, 178, 0.14);
    border-color: rgba(8, 145, 178, 0.35);
    color: #0e7490;
}
body.app-light-mode .progress-badge.mastered {
    color: #1a1200;
}

/* ============================================================
   POMODORO — pill widget + full modal
   ============================================================ */
.pomo-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 12px;
    background: var(--bg-glass, rgba(255,255,255,0.06));
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    border-radius: 999px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: all .2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    touch-action: manipulation;
    user-select: none;
}
.pomo-pill:hover {
    border-color: var(--accent-cyan, #06b6d4);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(6,182,212,0.18);
}
.pomo-pill-icon { font-size: 1rem; line-height: 1; }
.pomo-pill-time { min-width: 58px; text-align: center; }
.pomo-pill-play {
    display: inline-grid; place-items: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    color: #fff;
    font-size: 0.65rem;
    box-shadow: 0 3px 10px rgba(6,182,212,0.35);
    transition: transform .15s ease;
}
.pomo-pill-play:hover { transform: scale(1.1); }
.pomo-pill.running { border-color: rgba(6,182,212,0.55); box-shadow: 0 0 0 3px rgba(6,182,212,0.12); }
.pomo-pill-floating { touch-action: none; }
.pomo-pill.phase-short { border-color: rgba(16,185,129,0.5); }
.pomo-pill.phase-short .pomo-pill-play { background: linear-gradient(135deg, #10b981, #14b8a6); box-shadow: 0 3px 10px rgba(16,185,129,0.35); }
.pomo-pill.phase-long { border-color: rgba(139,92,246,0.5); }
.pomo-pill.phase-long .pomo-pill-play { background: linear-gradient(135deg, #8b5cf6, #d946ef); box-shadow: 0 3px 10px rgba(139,92,246,0.35); }

/* Modal */
.pomo-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(5, 8, 18, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9500;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeInUp .2s ease;
}
.pomo-modal-overlay[style*="display:none"],
.pomo-modal-overlay[style*="display: none"] { pointer-events: none !important; }
.pomo-modal {
    width: min(560px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(20,25,42,0.95), rgba(15,18,32,0.95));
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 22px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(6,182,212,0.08);
    padding: 22px;
    color: var(--text-primary);
}
.pomo-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.pomo-modal-title { font-size: 1.15rem; font-weight: 700; }
.pomo-close-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    width: 32px; height: 32px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all .15s ease;
}
.pomo-close-btn:hover { background: rgba(244,63,94,0.15); border-color: rgba(244,63,94,0.4); }

.pomo-tabs {
    display: flex; gap: 6px;
    background: rgba(0,0,0,0.25);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 18px;
}
.pomo-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all .15s ease;
}
.pomo-tab:hover { color: var(--text-primary); }
.pomo-tab.active {
    background: linear-gradient(135deg, rgba(6,182,212,0.25), rgba(139,92,246,0.25));
    color: #fff;
    box-shadow: 0 3px 12px rgba(6,182,212,0.18);
}

.pomo-panel { display: none; }
.pomo-panel.active { display: block; animation: fadeInUp .2s ease; }

/* Timer panel */
.pomo-phase-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(6,182,212,0.15);
    color: #06b6d4;
    border: 1px solid rgba(6,182,212,0.3);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0 auto 14px;
    display: block;
    width: fit-content;
}
.pomo-phase-badge.phase-short { background: rgba(16,185,129,0.15); color: #10b981; border-color: rgba(16,185,129,0.3); }
.pomo-phase-badge.phase-long { background: rgba(139,92,246,0.15); color: #a78bfa; border-color: rgba(139,92,246,0.3); }

.pomo-ring-big-wrap {
    position: relative;
    width: 240px; height: 240px;
    margin: 4px auto 8px;
}
.pomo-ring-big { width: 100%; height: 100%; transform: rotate(-90deg); }
.pomo-ring-big-bg {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 10;
}
.pomo-ring-big-fg {
    fill: none;
    stroke: url(#pomoBigGradient);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset .6s ease;
    filter: drop-shadow(0 0 8px rgba(6,182,212,0.4));
}
.pomo-ring-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px;
}
.pomo-big-time {
    font-size: 3.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    letter-spacing: -1px;
}
.pomo-session-info { font-size: 0.8rem; color: var(--text-muted); }
.pomo-doc-info { text-align: center; color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; min-height: 1em; }
.pomo-controls {
    display: flex; gap: 10px; justify-content: center;
    margin-top: 18px;
}
.pomo-ctl-btn {
    padding: 11px 22px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all .15s ease;
}
.pomo-ctl-btn:hover { background: rgba(255,255,255,0.1); transform: translateY(-1px); }
.pomo-ctl-btn.primary {
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 18px rgba(6,182,212,0.3);
    min-width: 110px;
}
.pomo-ctl-btn.primary:hover { box-shadow: 0 10px 24px rgba(6,182,212,0.42); }

/* Settings panel */
.pomo-form { display: flex; flex-direction: column; gap: 14px; }
.pomo-field {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 12px 14px;
    border-radius: 12px;
}
.pomo-field span { font-size: 0.88rem; color: var(--text-primary); }
.pomo-field input[type="number"] {
    width: 90px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: 8px;
    font-family: inherit;
    text-align: center;
    font-weight: 600;
}
.pomo-field input[type="number"]:focus { outline: none; border-color: var(--accent-cyan, #06b6d4); }
.pomo-toggle {
    display: flex; align-items: center; gap: 10px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.88rem;
}
.pomo-toggle input { accent-color: #06b6d4; width: 18px; height: 18px; }
.pomo-form-actions {
    display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px;
}

/* Stats panel */
.pomo-stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px;
}
.pomo-stats-grid.two { grid-template-columns: repeat(2, 1fr); }
.pomo-stat-card {
    background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(139,92,246,0.08));
    border: 1px solid rgba(255,255,255,0.08);
    padding: 14px;
    border-radius: 14px;
    text-align: center;
}
.pomo-stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.pomo-stat-value { font-size: 1.4rem; font-weight: 800; margin-top: 4px; color: var(--text-primary); font-variant-numeric: tabular-nums; }

.pomo-chart-wrap, .pomo-per-doc-wrap { margin-top: 16px; }
.pomo-chart-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }

.pomo-chart {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 6px;
    height: 130px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 12px 10px 8px;
    border-radius: 12px;
}
.pomo-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.pomo-bar-val { font-size: 0.65rem; color: var(--text-muted); font-variant-numeric: tabular-nums; min-height: 12px; }
.pomo-bar {
    width: 100%;
    max-width: 30px;
    background: linear-gradient(180deg, #06b6d4, #8b5cf6);
    border-radius: 6px 6px 2px 2px;
    min-height: 4px;
    transition: height .3s ease;
    box-shadow: 0 0 10px rgba(6,182,212,0.25);
}
.pomo-bar-lbl { font-size: 0.7rem; color: var(--text-muted); }

.pomo-per-doc { display: flex; flex-direction: column; gap: 8px; }
.pomo-doc-row {
    display: grid; grid-template-columns: 1fr 100px 60px; align-items: center; gap: 10px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
}
.pomo-doc-title { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pomo-doc-bar-wrap { height: 6px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; }
.pomo-doc-bar { height: 100%; background: linear-gradient(90deg, #06b6d4, #8b5cf6); border-radius: 999px; }
.pomo-doc-mins { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pomo-empty { text-align: center; color: var(--text-muted); font-size: 0.85rem; padding: 20px; }

/* Light-mode tweaks */
body.app-light-mode .pomo-modal { background: linear-gradient(135deg, #ffffff, #f4f6fb); color: #0f172a; }
body.app-light-mode .pomo-tabs { background: rgba(0,0,0,0.05); }
body.app-light-mode .pomo-tab { color: #475569; }
body.app-light-mode .pomo-tab.active { color: #0f172a; }
body.app-light-mode .pomo-big-time,
body.app-light-mode .pomo-stat-value,
body.app-light-mode .pomo-modal-title,
body.app-light-mode .pomo-chart-title,
body.app-light-mode .pomo-doc-title,
body.app-light-mode .pomo-field span { color: #0f172a; }
body.app-light-mode .pomo-field,
body.app-light-mode .pomo-toggle,
body.app-light-mode .pomo-stat-card,
body.app-light-mode .pomo-chart,
body.app-light-mode .pomo-doc-row { background: #f8fafc; border-color: rgba(0,0,0,0.08); }
body.app-light-mode .pomo-field input[type="number"] { background: #fff; color: #0f172a; border-color: rgba(0,0,0,0.12); }
body.app-light-mode .pomo-ring-big-bg { stroke: rgba(0,0,0,0.08); }
body.app-light-mode .pomo-ctl-btn { background: #fff; color: #0f172a; border-color: rgba(0,0,0,0.1); }
body.app-light-mode .pomo-ctl-btn.primary { background: linear-gradient(135deg, #06b6d4, #8b5cf6); color: #fff; border-color: transparent; }
body.app-light-mode .pomo-pill { color: #0f172a; background: #ffffffcc; border-color: rgba(0,0,0,0.1); }

/* Mobile */
@media (max-width: 640px) {
    .pomo-pill-time { min-width: 44px; font-size: 0.75rem; }
    .pomo-ring-big-wrap { width: 200px; height: 200px; }
    .pomo-big-time { font-size: 2.6rem; }
    .pomo-stats-grid { grid-template-columns: repeat(3, 1fr); }
    .pomo-doc-row { grid-template-columns: 1fr 60px 50px; }
}

/* Full-page Stats view */
#stats-view { flex: 1; overflow-y: auto; padding: 28px 32px 40px; }
@media (max-width: 720px) { #stats-view { padding: 18px 16px 28px; } }
.stats-page-body { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }
.stats-page-body .pomo-stats-grid { margin-bottom: 0; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.stats-page-body .pomo-stats-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (max-width: 720px) {
    .stats-page-body .pomo-stats-grid,
    .stats-page-body .pomo-stats-grid.two { grid-template-columns: 1fr; }
}
.stats-page-body .pomo-stat-card { padding: 18px 16px; }
.stats-page-body .pomo-stat-value { font-size: 1.7rem; }
.stats-page-body .pomo-chart-wrap,
.stats-page-body .pomo-per-doc-wrap {
    background: linear-gradient(135deg, rgba(6,182,212,0.06), rgba(139,92,246,0.06));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 18px 20px;
    margin-top: 0;
}
.stats-page-body .pomo-chart { background: rgba(0,0,0,0.15); }
body.app-light-mode #stats-view .sched-title,
body.app-light-mode #scheduler-view .sched-title,
body.app-light-mode #radar-view .sched-title,
body.app-light-mode #recall-view .sched-title {
    background: linear-gradient(135deg, #0f172a, #4338ca);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
body.app-light-mode .stats-page-body .pomo-chart-wrap,
body.app-light-mode .stats-page-body .pomo-per-doc-wrap {
    background: #ffffff; border-color: rgba(0,0,0,0.08);
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
body.app-light-mode .stats-page-body .pomo-chart { background: #f8fafc; }

/* ===== What's New patch modal ===== */
#whatsnew-btn { position: relative; }
#whatsnew-btn.has-update::after {
    content: "";
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; border-radius: 50%;
    background: linear-gradient(135deg, #f472b6, #ef4444);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.35), 0 0 12px rgba(244,114,182,0.9);
    animation: whatsnew-pulse 1.6s ease-in-out infinite;
}
@keyframes whatsnew-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.75; }
}
.whatsnew-modal {
    max-width: 640px; width: 92vw;
    max-height: 86vh; display: flex; flex-direction: column;
    background: linear-gradient(160deg, rgba(30,41,59,0.92), rgba(15,23,42,0.96));
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03) inset;
    padding: 0; overflow: hidden;
    backdrop-filter: blur(24px);
}
.whatsnew-header {
    padding: 26px 28px 18px;
    background: radial-gradient(120% 100% at 0% 0%, rgba(139,92,246,0.22), transparent 60%),
                radial-gradient(120% 100% at 100% 0%, rgba(34,211,238,0.18), transparent 60%);
    border-bottom: 1px solid rgba(148,163,184,0.12);
}
.whatsnew-badge {
    display: inline-block;
    padding: 4px 12px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: #f0abfc;
    background: rgba(139,92,246,0.15);
    border: 1px solid rgba(217,70,239,0.35);
}
.whatsnew-title {
    margin: 10px 0 4px; font-size: 1.5rem; font-weight: 700;
    background: linear-gradient(135deg, #e2e8f0, #a5f3fc);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.whatsnew-sub { margin: 0; color: #94a3b8; font-size: 0.88rem; }
.whatsnew-list {
    padding: 14px 20px; overflow-y: auto; flex: 1;
    display: flex; flex-direction: column; gap: 10px;
}
.whatsnew-item {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 12px 14px; border-radius: 14px;
    background: rgba(30,41,59,0.55);
    border: 1px solid rgba(148,163,184,0.1);
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.whatsnew-item:hover { transform: translateX(2px); border-color: rgba(34,211,238,0.35); }
.whatsnew-ico {
    font-size: 1.6rem; width: 42px; height: 42px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(34,211,238,0.15));
    border: 1px solid rgba(148,163,184,0.15);
}
.whatsnew-item-title { font-weight: 600; color: #e2e8f0; margin-bottom: 2px; }
.whatsnew-item-desc { font-size: 0.85rem; color: #94a3b8; line-height: 1.45; }
.whatsnew-actions {
    padding: 16px 24px 22px; border-top: 1px solid rgba(148,163,184,0.12);
    display: flex; justify-content: flex-end;
    background: rgba(15,23,42,0.5);
}
.whatsnew-close {
    padding: 10px 22px; border-radius: 12px; font-weight: 600;
    background: linear-gradient(135deg, #8b5cf6, #22d3ee);
    color: #fff; border: none; cursor: pointer;
    box-shadow: 0 8px 24px rgba(139,92,246,0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.whatsnew-close:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(34,211,238,0.4); }

/* Light-mode overrides */
.app-light-mode .whatsnew-modal {
    background: linear-gradient(160deg, #ffffff, #f8fafc);
    border-color: rgba(148,163,184,0.35);
}
.app-light-mode .whatsnew-title { background: linear-gradient(135deg, #1e293b, #0e7490); -webkit-background-clip: text; background-clip: text; color: transparent; }
.app-light-mode .whatsnew-sub { color: #475569; }
.app-light-mode .whatsnew-item { background: #f1f5f9; border-color: rgba(148,163,184,0.3); }
.app-light-mode .whatsnew-item-title { color: #0f172a; }
.app-light-mode .whatsnew-item-desc { color: #475569; }
.app-light-mode .whatsnew-actions { background: #f8fafc; border-top-color: rgba(148,163,184,0.3); }

/* ===== Light mode: Scheduler calendar readability fixes ===== */
.app-light-mode .sched-cell-chip.study { background: rgba(59,130,246,0.14); color: #1d4ed8; border-color: rgba(59,130,246,0.35); }
.app-light-mode .sched-cell-chip.exam  { background: rgba(239,68,68,0.14);  color: #b91c1c; border-color: rgba(239,68,68,0.35); }
.app-light-mode .sched-cell-chip.srs   { background: rgba(168,85,247,0.16); color: #6b21a8; border-color: rgba(168,85,247,0.40); }
.app-light-mode .sched-cell { background: #ffffff; border-color: rgba(148,163,184,0.35); }
.app-light-mode .sched-cell:hover { background: #f5f3ff; border-color: rgba(139,92,246,0.45); }
.app-light-mode .sched-cell.muted { opacity: 0.55; background: #f8fafc; }
.app-light-mode .sched-cell-day { color: #0f172a; }
.app-light-mode .sched-cell-more { color: #475569; }
.app-light-mode .sched-calendar-wrap,
.app-light-mode .sched-side-card { background: #ffffff; border-color: rgba(148,163,184,0.35); box-shadow: 0 8px 24px rgba(15,23,42,0.06); }
.app-light-mode .sched-cal-title,
.app-light-mode .sched-side-title { color: #0f172a; }
.app-light-mode .sched-legend,
.app-light-mode .sched-cal-dow { color: #475569; }
.app-light-mode .sched-nav-btn { background: #f1f5f9; color: #0f172a; border-color: rgba(148,163,184,0.35); }
.app-light-mode .sched-nav-btn:hover { background: #ede9fe; border-color: rgba(139,92,246,0.45); }
.app-light-mode .sched-item { background: #f8fafc; border-color: rgba(148,163,184,0.35); }
.app-light-mode .sched-item:hover { background: #ede9fe; border-color: rgba(139,92,246,0.45); }
.app-light-mode .sched-item-title { color: #0f172a; }
.app-light-mode .sched-tag { background: #f1f5f9; color: #475569; border-color: rgba(148,163,184,0.35); }
.app-light-mode .sched-item-notes,
.app-light-mode .sched-empty,
.app-light-mode .sched-item-del { color: #64748b; }

/* ===== Import menu popover ===== */
.omn-import-menu {
  position: fixed;
  z-index: 9999;
  min-width: 240px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(20,20,30,0.92);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
  animation: omnImportMenuIn 0.14s ease-out;
}
@keyframes omnImportMenuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.omn-import-menu button {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-primary, #f1f5f9);
  font-size: 14px; text-align: left; cursor: pointer;
  transition: all 0.12s;
}
.omn-import-menu button:hover {
  background: rgba(139,92,246,0.14);
  border-color: rgba(139,92,246,0.35);
}
.omn-import-menu .imp-ico { font-size: 18px; width: 22px; text-align: center; }

.app-light-mode .omn-import-menu {
  background: #ffffff;
  border-color: rgba(148,163,184,0.35);
  box-shadow: 0 20px 40px rgba(15,23,42,0.15);
}
.app-light-mode .omn-import-menu button { color: #0f172a; }
.app-light-mode .omn-import-menu button:hover {
  background: #ede9fe; border-color: rgba(139,92,246,0.45);
}

/* ===== Import busy overlay ===== */
.omn-import-busy {
  position: fixed; inset: 0; z-index: 10000;
  display: none; align-items: center; justify-content: center;
  background: rgba(10,10,20,0.55); backdrop-filter: blur(6px);
}
.omn-import-busy[style*="display: none"] { pointer-events: none !important; }
.omn-import-busy-inner {
  background: rgba(20,20,30,0.92);
  border: 1px solid rgba(139,92,246,0.35);
  border-radius: 16px; padding: 22px 28px;
  display: flex; align-items: center; gap: 16px;
  color: var(--text-primary, #f1f5f9);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  min-width: 260px;
}
.omn-import-spin {
  width: 22px; height: 22px;
  border: 3px solid rgba(139,92,246,0.25);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: omnImportSpin 0.9s linear infinite;
}
@keyframes omnImportSpin { to { transform: rotate(360deg); } }
.app-light-mode .omn-import-busy-inner { background: #ffffff; color: #0f172a; }

/* ================= Focus Mode ================= */
body.focus-mode #topbar,
body.focus-mode #sidebar-menu,
body.focus-mode #sidebar-overlay,
body.focus-mode #whatsnew-btn,
body.focus-mode .tour-overlay,
body.focus-mode #whats-new-modal { display: none !important; }

body.focus-mode #main-content,
body.focus-mode .app-container { margin-left: 0 !important; padding-top: 0 !important; }

#pomo-pill.pomo-pill-floating {
  position: fixed !important;
  top: 14px;
  right: 14px;
  z-index: 10000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.06) inset;
}

#focus-exit-chip {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 10000;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary, #e5e7eb);
  background: var(--bg-glass-strong, rgba(15,23,42,0.75));
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
#focus-exit-chip:hover { transform: translateY(-1px); background: rgba(30,41,59,0.9); }
body.focus-mode #focus-exit-chip { display: inline-flex; }

#focus-mode-btn.active { color: #06b6d4; box-shadow: 0 0 0 1px rgba(6,182,212,0.4) inset; }

body.app-light-mode #focus-exit-chip {
  background: rgba(255,255,255,0.9);
  color: #0f172a;
  border-color: rgba(15,23,42,0.1);
}

#pomo-pill.pomo-pill-floating { cursor: grab; touch-action: none; user-select: none; }
#pomo-pill.pomo-pill-floating.pomo-dragging { cursor: grabbing; transition: none; }
#pomo-pill.pomo-pill-floating #pomo-pill-play { cursor: pointer; }

/* ==================== Whiteboard ==================== */
.wb-root { display:none; flex-direction:column; height:100%; background:linear-gradient(135deg, rgba(15,23,42,0.4), rgba(2,6,23,0.6)); overflow:hidden; }
.wb-root.active { display:flex !important; }
.wb-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:10px 14px; background:rgba(15,23,42,0.6); backdrop-filter: blur(14px); border-bottom:1px solid var(--border-subtle); }
.wb-tool-group { display:flex; align-items:center; gap:6px; padding:4px; background:rgba(255,255,255,0.03); border:1px solid var(--border-subtle); border-radius:12px; }
.wb-tool, .wb-btn { min-width:36px; height:34px; padding:0 10px; border:none; border-radius:8px; background:transparent; color:var(--text-primary); cursor:pointer; font-size:0.95rem; display:inline-flex; align-items:center; justify-content:center; gap:6px; transition:all .15s ease; }
.wb-tool:hover, .wb-btn:hover { background:rgba(255,255,255,0.08); }
.wb-tool.active { background:var(--gradient-brand, linear-gradient(135deg,#6366f1,#8b5cf6)); color:#fff; box-shadow:0 4px 14px rgba(99,102,241,0.35); }
.wb-swatch { width:22px; height:22px; border-radius:50%; border:2px solid rgba(255,255,255,0.15); cursor:pointer; padding:0; transition:transform .15s; }
.wb-swatch:hover { transform:scale(1.15); }
.wb-swatch.active { border-color:#fff; box-shadow:0 0 0 2px rgba(99,102,241,0.6); }
.wb-size { display:flex; align-items:center; gap:8px; font-size:0.78rem; color:var(--text-dim); padding:0 8px; }
.wb-size input { width:110px; accent-color:#8b5cf6; }
.wb-status { margin-left:auto; font-size:0.75rem; color:var(--text-dim); padding:0 8px; }
.wb-body { display:flex; flex:1; min-height:0; }
.wb-pages, .wb-layers { width:140px; background:rgba(15,23,42,0.5); border-right:1px solid var(--border-subtle); display:flex; flex-direction:column; padding:10px; gap:8px; overflow-y:auto; }
.wb-layers { border-right:none; border-left:1px solid var(--border-subtle); width:200px; }
.wb-pages-head { font-size:0.72rem; text-transform:uppercase; letter-spacing:0.08em; color:var(--text-dim); font-weight:700; }
.wb-pages-list, .wb-layers-list { display:flex; flex-direction:column; gap:6px; }
.wb-page-thumb { position:relative; padding:6px; background:rgba(255,255,255,0.04); border:1px solid var(--border-subtle); border-radius:8px; cursor:pointer; transition:all .15s; }
.wb-page-thumb.active { border-color:#8b5cf6; box-shadow:0 0 0 2px rgba(139,92,246,0.35); }
.wb-page-thumb canvas { width:100%; height:80px; background:#fff; border-radius:4px; display:block; }
.wb-page-thumb .wb-page-label { font-size:0.7rem; color:var(--text-dim); margin-top:4px; display:flex; justify-content:space-between; }
.wb-page-thumb .wb-page-del { background:transparent; border:none; color:var(--text-dim); cursor:pointer; padding:0; }
.wb-page-thumb .wb-page-del:hover { color:#ef4444; }
.wb-add-page { padding:8px; background:rgba(139,92,246,0.15); border:1px dashed rgba(139,92,246,0.4); border-radius:8px; color:#c4b5fd; cursor:pointer; font-size:0.8rem; }
.wb-add-page:hover { background:rgba(139,92,246,0.25); }
.wb-canvas-host { flex:1; position:relative; overflow:hidden; background:#f8fafc; }
.wb-canvas-host canvas { position:absolute; inset:0; width:100%; height:100%; touch-action:none; cursor:crosshair; }
.wb-canvas-host.tool-hand canvas { cursor:grab; }
.wb-canvas-host.tool-text canvas { cursor:text; }
.wb-canvas-host.tool-lasso canvas { cursor:cell; }
.wb-text-editor { position:absolute; min-width:80px; min-height:24px; padding:4px 8px; background:rgba(255,255,255,0.95); border:2px dashed #8b5cf6; border-radius:6px; outline:none; font-family:inherit; color:#111827; z-index:5; }
.wb-layer-item { display:flex; align-items:center; gap:6px; padding:6px 8px; background:rgba(255,255,255,0.04); border:1px solid var(--border-subtle); border-radius:8px; font-size:0.78rem; }
.wb-layer-item.active { border-color:#8b5cf6; background:rgba(139,92,246,0.12); }
.wb-layer-item .wb-layer-name { flex:1; cursor:pointer; color:var(--text-primary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wb-layer-item button { background:transparent; border:none; color:var(--text-dim); cursor:pointer; padding:2px 4px; font-size:0.9rem; }
.wb-layer-item button:hover { color:#fff; }
.app-light-mode .wb-root { background:linear-gradient(135deg, rgba(226,232,240,0.6), rgba(241,245,249,0.8)); }
.app-light-mode .wb-toolbar, .app-light-mode .wb-pages, .app-light-mode .wb-layers { background:rgba(255,255,255,0.85); }

/* =========================================================================
   Mind Map
   ========================================================================= */
.mm-root { position: relative; height: 100%; overflow: hidden; padding: 0; flex-direction: column; }
.mm-root.active { display: flex; }
.mm-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.mm-title { font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.mm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mm-actions .btn-action { padding: 6px 12px; font-size: 0.82rem; }
.mm-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px; }
#mindmap-network { flex: 1; background: radial-gradient(circle at 30% 20%, rgba(139, 92, 246, 0.06), transparent 60%), radial-gradient(circle at 70% 80%, rgba(6, 182, 212, 0.06), transparent 60%); }
.mm-note-panel { position: absolute; right: 16px; bottom: 16px; width: 320px; max-height: 60vh; overflow-y: auto; background: var(--bg-elevated, rgba(15, 23, 42, 0.95)); backdrop-filter: blur(20px); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 14px 16px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4); z-index: 20; }
.mm-note-head { display: flex; justify-content: space-between; align-items: center; }
.app-light-mode .mm-note-panel { background: rgba(255, 255, 255, 0.97); color: #0f172a; }

/* =========================================================================
   Active Recall Studio
   ========================================================================= */
.recall-body { padding: 20px 0; }
.recall-card { background: linear-gradient(160deg, rgba(34, 211, 238, 0.06), rgba(139, 92, 246, 0.06)); border: 1px solid var(--border-subtle); border-radius: 20px; padding: 28px; max-width: 780px; margin: 0 auto; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); }
.recall-progress { height: 6px; background: rgba(255, 255, 255, 0.06); border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.recall-progress-fill { height: 100%; background: linear-gradient(90deg, #22d3ee, #8b5cf6); transition: width 0.3s; }
.recall-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 12px; }
.recall-kind { padding: 3px 10px; border-radius: 999px; background: rgba(139, 92, 246, 0.15); border: 1px solid rgba(139, 92, 246, 0.3); color: #c4b5fd; font-weight: 600; }
.recall-prompt { font-size: 1.15rem; font-weight: 600; line-height: 1.5; margin-bottom: 18px; color: var(--text-primary); }
.recall-answer { width: 100%; padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-subtle); color: var(--text-primary); font-family: inherit; font-size: 0.95rem; line-height: 1.5; resize: vertical; }
.recall-answer:focus { outline: none; border-color: #22d3ee; box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15); }
.recall-feedback { margin-top: 8px; padding: 16px; border-radius: 14px; border: 1px solid var(--border-subtle); background: rgba(15, 23, 42, 0.4); }
.recall-fb-again { border-color: rgba(244, 63, 94, 0.4); background: rgba(244, 63, 94, 0.08); }
.recall-fb-hard { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); }
.recall-fb-good { border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.08); }
.recall-fb-easy { border-color: rgba(34, 211, 238, 0.4); background: rgba(34, 211, 238, 0.08); }
.recall-fb-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; background: rgba(0, 0, 0, 0.3); }
.recall-fb-body { margin-top: 10px; line-height: 1.5; color: var(--text-primary); }
.recall-fb-missing { margin-top: 8px; font-size: 0.85rem; color: var(--text-secondary); }
.recall-fb-ideal { margin-top: 12px; font-size: 0.88rem; }
.recall-fb-ideal summary { cursor: pointer; color: var(--text-secondary); font-weight: 600; }
.recall-fb-ideal > div { margin-top: 8px; padding: 10px; background: rgba(0, 0, 0, 0.2); border-radius: 8px; }
.recall-fb-source { margin-top: 6px; font-style: italic; color: var(--text-dim); font-size: 0.78rem; }
.recall-done { text-align: center; }
.recall-bank { display: flex; flex-direction: column; gap: 20px; max-width: 900px; margin: 0 auto; }
.recall-bank-sec { background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 16px; }
.recall-bank-head { font-weight: 700; margin-bottom: 10px; color: var(--text-primary); }
.recall-bank-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.04); font-size: 0.9rem; }
.recall-bank-item:first-of-type { border-top: none; }
.recall-bank-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(148, 163, 184, 0.4); flex-shrink: 0; }
.recall-bank-dot.due { background: #f43f5e; box-shadow: 0 0 8px rgba(244, 63, 94, 0.6); }
.recall-bank-prompt { flex: 1; color: var(--text-secondary); }
.recall-bank-when { font-size: 0.75rem; color: var(--text-dim); white-space: nowrap; }
.recall-doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding: 0 4px; }
.recall-doc-grid-lg { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.recall-doc-card { background: linear-gradient(160deg, rgba(34, 211, 238, 0.08), rgba(139, 92, 246, 0.08)); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 18px; cursor: pointer; transition: transform 0.15s, border-color 0.15s; }
.recall-doc-card:hover { transform: translateY(-2px); border-color: rgba(34, 211, 238, 0.5); }
.recall-doc-title { font-weight: 700; font-size: 1rem; margin-bottom: 8px; }
.recall-doc-meta { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-muted); }
.recall-due-chip { background: rgba(244, 63, 94, 0.15); border: 1px solid rgba(244, 63, 94, 0.35); color: #fda4af; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 0.75rem; }
body.recall-open #topbar .topbar-center { display: none; }
#recall-view {
    flex: 1;
    min-height: 0;
    max-height: 100vh;
    overflow-y: auto;
    padding: 32px 40px 60px;
    background:
        radial-gradient(ellipse at top left, rgba(59,130,246,0.08), transparent 50%),
        radial-gradient(ellipse at top right, rgba(139,92,246,0.06), transparent 50%);
}
@media (max-width: 720px) { #recall-view { padding: 20px 16px 60px; } }
.app-light-mode .recall-card { background: linear-gradient(160deg, rgba(34, 211, 238, 0.08), rgba(139, 92, 246, 0.08)); color: #0f172a; }
.app-light-mode .recall-answer { background: #fff; color: #0f172a; }
.app-light-mode .recall-fb-body, .app-light-mode .recall-bank-prompt, .app-light-mode .recall-prompt { color: #0f172a; }

/* ============ Recall Studio — Premium picker ============ */
.recall-studio { padding-top: 8px; }
.recall-hero {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    padding: 30px 32px;
    margin-bottom: 24px;
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(139, 92, 246, 0.22), transparent 55%),
        radial-gradient(120% 120% at 100% 100%, rgba(34, 211, 238, 0.18), transparent 55%),
        linear-gradient(160deg, rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.25));
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 24px 60px -30px rgba(139, 92, 246, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
}
.recall-hero-orb {
    position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(167, 139, 250, 0.55), rgba(34, 211, 238, 0.25) 45%, transparent 70%);
    filter: blur(20px); opacity: 0.75; pointer-events: none;
    animation: recall-orb-float 8s ease-in-out infinite;
}
@keyframes recall-orb-float { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-14px, 12px) scale(1.05); } }
.recall-hero-inner { position: relative; z-index: 1; }
.recall-hero-stats { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.recall-hero-stat {
    display: flex; flex-direction: column; align-items: flex-start;
    padding: 10px 18px 10px 0;
    border-right: 1px solid rgba(148, 163, 184, 0.2);
}
.recall-hero-stat:last-child { border-right: none; }
.recall-hero-stat .rhs-num {
    font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em;
    background: linear-gradient(90deg, #a78bfa, #22d3ee); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.recall-hero-stat.is-due .rhs-num { background: linear-gradient(90deg, #f43f5e, #f59e0b); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.recall-hero-stat .rhs-lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-muted); font-weight: 600; margin-top: 2px; }

.recall-doc-card.premium {
    position: relative; overflow: hidden;
    padding: 20px 20px 18px;
    border-radius: 18px;
    background: linear-gradient(160deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.4));
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 10px 30px -20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.recall-doc-card.premium:hover:not(.disabled) {
    transform: translateY(-3px);
    border-color: rgba(167, 139, 250, 0.55);
    box-shadow: 0 20px 44px -22px rgba(139, 92, 246, 0.55);
}
.recall-doc-glow {
    position: absolute; inset: -1px; border-radius: 18px; pointer-events: none; opacity: 0;
    background: radial-gradient(300px 120px at var(--mx, 50%) 0%, rgba(167, 139, 250, 0.25), transparent 70%);
    transition: opacity 0.25s ease;
}
.recall-doc-card.premium:hover .recall-doc-glow { opacity: 1; }
.recall-doc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.recall-doc-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(34, 211, 238, 0.2));
    border: 1px solid rgba(167, 139, 250, 0.35);
    color: #c4b5fd;
}
.recall-doc-icon [data-lucide] { width: 20px; height: 20px; }
.recall-doc-status {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.72rem; font-weight: 700; padding: 5px 10px; border-radius: 999px;
    background: rgba(148, 163, 184, 0.12); color: var(--text-muted); border: 1px solid rgba(148, 163, 184, 0.2);
}
.recall-doc-status [data-lucide] { width: 12px; height: 12px; }
.recall-doc-card.status-due .recall-doc-status { background: rgba(244, 63, 94, 0.14); color: #fda4af; border-color: rgba(244, 63, 94, 0.35); }
.recall-doc-card.status-mastered .recall-doc-status { background: rgba(16, 185, 129, 0.14); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.35); }
.recall-doc-card.status-needs .recall-doc-status { background: rgba(245, 158, 11, 0.14); color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); }
.recall-doc-card.premium .recall-doc-title { font-size: 1.05rem; letter-spacing: -0.01em; margin-bottom: 12px; }
.recall-doc-progress { height: 6px; background: rgba(148, 163, 184, 0.12); border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.recall-doc-progress-fill { height: 100%; background: linear-gradient(90deg, #a78bfa, #22d3ee); border-radius: 999px; transition: width 0.4s ease; }
.recall-doc-card.status-mastered .recall-doc-progress-fill { background: linear-gradient(90deg, #10b981, #22d3ee); }
.recall-doc-card.status-due .recall-doc-progress-fill { background: linear-gradient(90deg, #f59e0b, #f43f5e); }
.recall-doc-card.premium .recall-doc-meta { align-items: center; font-size: 0.78rem; }
.recall-doc-meta [data-lucide] { width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; }
.recall-doc-cta { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: #c4b5fd; letter-spacing: 0.02em; }
.recall-doc-card.premium:hover .recall-doc-cta [data-lucide] { transform: translateX(2px); }
.recall-doc-cta [data-lucide] { transition: transform 0.2s ease; }

/* Light mode */
.app-light-mode .recall-hero {
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(139, 92, 246, 0.18), transparent 55%),
        radial-gradient(120% 120% at 100% 100%, rgba(34, 211, 238, 0.16), transparent 55%),
        linear-gradient(160deg, #ffffff, #f1f5f9);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 20px 50px -30px rgba(99, 102, 241, 0.35);
}
.app-light-mode .recall-hero-stat { border-right-color: rgba(15, 23, 42, 0.1); }
.app-light-mode .recall-doc-card.premium {
    background: linear-gradient(160deg, #ffffff, #f8fafc);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.25);
}
.app-light-mode .recall-doc-card.premium:hover:not(.disabled) { border-color: rgba(139, 92, 246, 0.5); box-shadow: 0 16px 32px -18px rgba(139, 92, 246, 0.35); }
.app-light-mode .recall-doc-progress { background: rgba(15, 23, 42, 0.08); }
.app-light-mode .recall-doc-icon { color: #6d28d9; }


/* =========================================================================
   Goals & Streaks
   ========================================================================= */
.goals-card { background: linear-gradient(160deg, rgba(245, 158, 11, 0.08), rgba(244, 63, 94, 0.08)); border: 1px solid rgba(245, 158, 11, 0.25); border-radius: 18px; padding: 20px 22px; margin-bottom: 20px; }
.goals-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.goals-title { font-weight: 800; font-size: 1.1rem; }
.goals-sub { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }
.goals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.goal-tile { padding: 14px 16px; border-radius: 14px; background: rgba(15, 23, 42, 0.35); border: 1px solid var(--border-subtle); }
.goal-tile-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.goal-tile-value { font-size: 1.6rem; font-weight: 800; margin-top: 4px; background: linear-gradient(90deg, #f59e0b, #f43f5e); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.goal-tile-unit { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; -webkit-text-fill-color: var(--text-muted); }
.goal-tile-hint { font-size: 0.72rem; color: var(--text-dim); margin-top: 4px; }
.goal-bar { height: 6px; background: rgba(255, 255, 255, 0.06); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.goal-bar-fill { height: 100%; background: linear-gradient(90deg, #f59e0b, #f43f5e); transition: width 0.3s; }
.goal-bar-fill.done { background: linear-gradient(90deg, #10b981, #22d3ee); }
.app-light-mode .goal-tile { background: rgba(255, 255, 255, 0.7); }
.app-light-mode .goals-title { color: #0f172a; }

/* Lucide icon sizing + spin */
[data-lucide] { width: 16px; height: 16px; stroke-width: 2; vertical-align: -3px; display: inline-block; pointer-events: none; }
.left-tab-item [data-lucide], .right-tab-item [data-lucide] { width: 15px; height: 15px; margin-right: 4px; }
.btn-action [data-lucide] { width: 14px; height: 14px; margin-right: 2px; }
.lucide-spin { animation: lucide-spin 1s linear infinite; }
@keyframes lucide-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Recall cloze inline inputs */
.recall-cloze-input {
    display: inline-block;
    min-width: 90px;
    padding: 3px 10px;
    margin: 0 3px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-bottom: 2px solid rgba(139, 92, 246, 0.6);
    border-radius: 6px;
    color: var(--text-primary);
    font: inherit;
    text-align: center;
    transition: all 0.15s ease;
}
.recall-cloze-input:focus { outline: none; border-color: var(--accent-primary, #6366f1); background: rgba(139, 92, 246, 0.14); }
.recall-cloze-input.correct { border-color: #10b981; background: rgba(16, 185, 129, 0.15); color: #10b981; }
.recall-cloze-input.wrong { border-color: #f43f5e; background: rgba(244, 63, 94, 0.12); color: #f43f5e; }

.recall-doc-card.disabled { opacity: 0.5; cursor: not-allowed; }
.recall-doc-card.disabled:hover { transform: none; }

/* ============ Weak Spot Radar ============ */
#radar-view {
    flex: 1;
    min-height: 100vh;
    overflow-y: auto;
    padding: 32px 40px 60px;
    background:
        radial-gradient(ellipse at top left, rgba(244,63,94,0.08), transparent 50%),
        radial-gradient(ellipse at top right, rgba(139,92,246,0.06), transparent 50%);
}
@media (max-width: 640px){ #radar-view { padding: 20px 16px 60px; } }
.radar-shell { max-width: 1400px; margin: 0 auto; padding-bottom: 40px; }
.radar-top-grid { display:grid; grid-template-columns: 1.4fr 1fr; gap:18px; margin-top:22px; }
@media (max-width: 900px){ .radar-top-grid{ grid-template-columns:1fr; } }
.radar-hero-card {
    display:flex; align-items:center; gap:22px;
    padding:22px; border-radius:20px;
    background: linear-gradient(135deg, rgba(244,63,94,0.10), rgba(139,92,246,0.08));
    border:1px solid rgba(244,63,94,0.28);
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}
.radar-ring {
    --ring:0; --ring-color:#f43f5e;
    width:140px; height:140px; border-radius:50%;
    background: conic-gradient(var(--ring-color) calc(var(--ring) * 1%), rgba(255,255,255,0.08) 0);
    display:flex; align-items:center; justify-content:center;
    flex-shrink:0;
    position:relative;
}
.radar-ring::before { content:""; position:absolute; inset:8px; border-radius:50%; background: var(--bg-primary, #0b0f1a); }
.radar-ring-inner { position:relative; text-align:center; z-index:1; }
.radar-ring-value { font-size:2.4rem; font-weight:900; color:var(--text-primary); line-height:1; }
.radar-ring-label { font-size:0.7rem; text-transform:uppercase; letter-spacing:0.08em; color:var(--text-muted); margin-top:4px; }
.radar-hero-title { font-size:1.05rem; font-weight:800; color:var(--text-primary); letter-spacing:0.04em; }
.radar-hero-desc { font-size:0.9rem; color:var(--text-secondary); margin-top:6px; line-height:1.5; }

.radar-side-stats { display:flex; flex-direction:column; gap:12px; }
.radar-stat-card { padding:16px 18px; border-radius:14px; background: rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.08); }
.radar-stat-card.critical { background: linear-gradient(135deg, rgba(244,63,94,0.14), rgba(244,63,94,0.03)); border-color:rgba(244,63,94,0.35); }
.radar-stat-card.warn { background: linear-gradient(135deg, rgba(245,158,11,0.14), rgba(245,158,11,0.03)); border-color:rgba(245,158,11,0.35); }
.radar-stat-label { font-size:0.78rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--text-muted); }
.radar-stat-value { font-size:2rem; font-weight:900; color:var(--text-primary); margin-top:4px; }
.radar-stat-sub { font-size:0.78rem; color:var(--text-muted); margin-top:2px; }

.radar-section { margin-top:26px; padding:18px 20px; border-radius:16px; background:rgba(255,255,255,0.02); border:1px solid rgba(255,255,255,0.06); }
.radar-section-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
.radar-section-head h2 { margin:0; font-size:1.05rem; font-weight:800; color:var(--text-primary); }
.radar-legend { display:flex; gap:12px; flex-wrap:wrap; font-size:0.72rem; color:var(--text-muted); }
.radar-legend span { display:inline-flex; align-items:center; gap:5px; }
.radar-legend i { display:inline-block; width:10px; height:10px; border-radius:3px; }
.radar-empty { padding:18px; color:var(--text-muted); font-size:0.9rem; text-align:center; background:rgba(255,255,255,0.02); border:1px dashed rgba(255,255,255,0.1); border-radius:12px; }

.radar-drill-list { display:flex; flex-direction:column; gap:8px; }
.radar-drill-item { display:flex; align-items:center; gap:14px; padding:12px 14px; border-radius:12px; background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.07); }
.radar-drill-score { min-width:52px; text-align:center; font-weight:900; padding:8px 6px; border-radius:10px; border:1px solid; font-size:0.95rem; }
.radar-drill-front { font-size:0.92rem; color:var(--text-primary); font-weight:600; }
.radar-drill-doc { font-size:0.75rem; color:var(--text-muted); margin-top:2px; }

.radar-doc-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:12px; }
.radar-doc-tile { padding:14px; border-radius:14px; background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.08); cursor:pointer; transition:transform 0.15s, border-color 0.15s; }
.radar-doc-tile:hover { transform:translateY(-2px); border-color:rgba(139,92,246,0.4); }
.radar-doc-title { font-size:0.92rem; font-weight:700; color:var(--text-primary); margin-bottom:10px; }
.radar-doc-bar { height:8px; background:rgba(255,255,255,0.06); border-radius:999px; overflow:hidden; }
.radar-doc-fill { height:100%; border-radius:999px; transition:width 0.4s; }
.radar-doc-meta { display:flex; justify-content:space-between; margin-top:8px; font-size:0.75rem; color:var(--text-muted); }

.radar-weak-list { display:flex; flex-direction:column; gap:8px; }
.radar-weak-item { display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:12px; background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.07); cursor:pointer; }
.radar-weak-item:hover { border-color:rgba(139,92,246,0.4); }
.radar-weak-bar { width:4px; align-self:stretch; border-radius:4px; }
.radar-weak-body { flex:1; min-width:0; }
.radar-weak-sec { font-size:0.9rem; font-weight:700; color:var(--text-primary); }
.radar-weak-doc { font-size:0.75rem; color:var(--text-muted); margin-top:2px; }
.radar-weak-score { font-size:1.3rem; font-weight:900; }

.radar-insight-box { padding:18px; border-radius:12px; background:linear-gradient(135deg, rgba(59,130,246,0.06), rgba(139,92,246,0.06)); border:1px solid rgba(139,92,246,0.25); min-height:80px; }
.radar-insight-html { color:var(--text-primary); font-size:0.95rem; line-height:1.65; }
.radar-insight-html ul { padding-left:20px; margin:8px 0; }
.radar-insight-html li { margin:4px 0; }
.radar-insight-html strong { color:#a78bfa; }
.radar-insight-meta { margin-top:12px; font-size:0.72rem; color:var(--text-muted); text-align:right; }

/* Light mode overrides */
.app-light-mode .radar-hero-card,
.app-light-mode .radar-stat-card,
.app-light-mode .radar-section,
.app-light-mode .radar-drill-item,
.app-light-mode .radar-doc-tile,
.app-light-mode .radar-weak-item,
.app-light-mode .radar-insight-box { background: rgba(255,255,255,0.9); border-color: rgba(0,0,0,0.08); }
.app-light-mode .radar-ring::before { background:#fff; }
.app-light-mode .radar-empty { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color:#334155; }

/* ===== Active Recall Studio — Premium Hero ===== */
.recall-hero {
    position: relative;
    padding: 28px 30px 22px;
    border-radius: 24px;
    background:
        radial-gradient(1200px 300px at -10% -40%, rgba(139,92,246,0.28), transparent 60%),
        radial-gradient(900px 260px at 110% -20%, rgba(34,211,238,0.24), transparent 60%),
        linear-gradient(160deg, rgba(15,23,42,0.92), rgba(30,41,59,0.88));
    border: 1px solid rgba(148,163,184,0.18);
    box-shadow: 0 25px 60px -20px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.05);
    overflow: hidden;
    margin-bottom: 18px;
}
.recall-hero-glow {
    position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(600px 200px at 50% 120%, rgba(6,182,212,0.18), transparent 70%);
}
.recall-hero-top { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; flex-wrap:wrap; position:relative; z-index:1; }
.recall-hero-lede { min-width: 260px; }
.recall-hero-kicker { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:10px; }
.recall-hero-badge {
    display:inline-flex; align-items:center; gap:6px;
    padding: 4px 10px; border-radius: 999px;
    background: linear-gradient(90deg, rgba(139,92,246,0.25), rgba(6,182,212,0.25));
    border: 1px solid rgba(139,92,246,0.45);
    color: #e9d5ff; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.recall-hero-badge i { width:12px; height:12px; }
.recall-hero-doc {
    display:inline-flex; align-items:center; gap:6px;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.1);
    color:#cbd5e1; font-size: 0.75rem; font-weight: 600;
    max-width: 320px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.recall-hero-doc i { width:13px; height:13px; flex-shrink:0; }
.recall-hero-title {
    margin: 2px 0 6px;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #f0abfc 0%, #a5b4fc 45%, #67e8f9 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.recall-hero-sub { margin: 0; color:#94a3b8; font-size: 0.92rem; }
.recall-hero-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

.recall-btn {
    display:inline-flex; align-items:center; gap:8px;
    padding: 10px 16px; border-radius: 12px;
    font-weight: 700; font-size: 0.88rem; cursor:pointer;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05); color:#e2e8f0;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s;
}
.recall-btn:hover:not(:disabled) { transform: translateY(-1px); background: rgba(255,255,255,0.09); }
.recall-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.recall-btn i { width:15px; height:15px; }
.recall-btn.ghost { background: transparent; }
.recall-btn.soft {
    background: linear-gradient(135deg, rgba(139,92,246,0.18), rgba(6,182,212,0.18));
    border-color: rgba(139,92,246,0.4); color:#e9d5ff;
}
.recall-btn.primary {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color:#fff; border-color: transparent;
    box-shadow: 0 10px 25px -8px rgba(139,92,246,0.6), 0 6px 20px -8px rgba(6,182,212,0.5);
}
.recall-btn.primary:hover:not(:disabled) { box-shadow: 0 15px 35px -10px rgba(139,92,246,0.75), 0 10px 25px -10px rgba(6,182,212,0.6); }
.recall-btn-count {
    display:inline-flex; align-items:center; justify-content:center;
    min-width: 24px; height: 22px; padding: 0 8px;
    border-radius: 999px; background: rgba(255,255,255,0.22);
    font-size: 0.75rem; font-weight: 800;
}

.recall-hero-stats {
    position:relative; z-index:1;
    display:grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
    margin-top: 22px;
}
.recall-stat {
    display:flex; align-items:center; gap:12px;
    padding: 12px 14px; border-radius: 14px;
    background: rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
}
.recall-stat-icon {
    width:38px; height:38px; border-radius: 10px;
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.recall-stat-icon i { width:18px; height:18px; }
.recall-stat-icon.due { background: rgba(244,63,94,0.15); color:#fb7185; }
.recall-stat-icon.learn { background: rgba(139,92,246,0.15); color:#a78bfa; }
.recall-stat-icon.mastered { background: rgba(34,197,94,0.15); color:#4ade80; }
.recall-stat-icon.total { background: rgba(6,182,212,0.15); color:#22d3ee; }
.recall-stat-val { font-size: 1.25rem; font-weight: 800; color:#f1f5f9; line-height:1; }
.recall-stat-lbl { font-size: 0.72rem; color:#94a3b8; text-transform:uppercase; letter-spacing:0.06em; font-weight:700; margin-top:3px; }

.recall-hero-progress { position:relative; z-index:1; margin-top: 16px; }
.recall-hero-progress-head { display:flex; justify-content:space-between; font-size:0.75rem; color:#94a3b8; font-weight:700; text-transform:uppercase; letter-spacing:0.06em; margin-bottom:6px; }
.recall-hero-progress-bar { height: 8px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow:hidden; }
.recall-hero-progress-bar > div {
    height:100%;
    background: linear-gradient(90deg, #22d3ee, #8b5cf6, #f0abfc);
    border-radius: 999px;
    transition: width 0.5s ease;
    box-shadow: 0 0 12px rgba(139,92,246,0.5);
}

@media (max-width: 720px) {
    .recall-hero { padding: 22px 18px 18px; border-radius: 20px; }
    .recall-hero-stats { grid-template-columns: repeat(2, 1fr); }
    .recall-hero-actions { width: 100%; }
    .recall-btn { flex: 1; justify-content:center; }
}

/* Light mode overrides */
body.app-light-mode .recall-hero {
    background:
        radial-gradient(1200px 300px at -10% -40%, rgba(139,92,246,0.18), transparent 60%),
        radial-gradient(900px 260px at 110% -20%, rgba(6,182,212,0.18), transparent 60%),
        linear-gradient(160deg, #ffffff, #f8fafc);
    border-color: rgba(15,23,42,0.08);
    box-shadow: 0 20px 45px -20px rgba(15,23,42,0.18);
}
body.app-light-mode .recall-hero-title {
    background: linear-gradient(90deg, #7c3aed, #2563eb, #0891b2);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
body.app-light-mode .recall-hero-sub { color:#475569; }
body.app-light-mode .recall-hero-doc { background: rgba(15,23,42,0.05); border-color: rgba(15,23,42,0.08); color:#334155; }
body.app-light-mode .recall-stat { background: rgba(15,23,42,0.03); border-color: rgba(15,23,42,0.08); }
body.app-light-mode .recall-stat-val { color:#0f172a; }
body.app-light-mode .recall-stat-lbl { color:#64748b; }
body.app-light-mode .recall-btn { background: rgba(15,23,42,0.04); border-color: rgba(15,23,42,0.1); color:#1e293b; }
body.app-light-mode .recall-btn:hover:not(:disabled) { background: rgba(15,23,42,0.08); }
body.app-light-mode .recall-hero-progress-bar { background: rgba(15,23,42,0.08); }
body.app-light-mode .recall-hero-progress-head { color:#64748b; }

/* =====================================================
   Smart Explain modal — v2 redesign
   Glassmorphic card, gradient header, refined typography
   ===================================================== */
.explain-modal-v2 .usmle-content {
    display: flex !important;
    padding: 90px 24px 60px !important;
    justify-content: center;
    align-items: flex-start;
    min-height: 100%;
}
.explain-modal-v2 .usmle-body {
    background:
        radial-gradient(1000px 600px at 12% -10%, rgba(59,130,246,0.14), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(139,92,246,0.12), transparent 55%),
        radial-gradient(700px 500px at 50% 110%, rgba(34,211,238,0.10), transparent 60%);
}
.explain-card {
    max-width: 920px !important;
    width: 100% !important;
    margin: 0 auto !important;
    background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)) !important;
    border: 1px solid rgba(148,163,184,0.18) !important;
    border-radius: 22px !important;
    box-shadow: 0 30px 80px -30px rgba(0,0,0,0.55), 0 1px 0 rgba(255,255,255,0.05) inset !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 34px 40px 44px !important;
}
.explain-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-bottom: 22px;
    margin-bottom: 28px;
    border-bottom: 1px solid rgba(148,163,184,0.18);
    font-size: 1rem;
}
.explain-header.explain-header-centered { justify-content: center; }

.explain-header .explain-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    box-shadow: 0 12px 28px -10px rgba(59,130,246,0.6), inset 0 1px 0 rgba(255,255,255,0.35);
    flex-shrink: 0;
}
.explain-header .explain-icon svg { width: 28px; height: 28px; stroke-width: 2; }
.explain-header .explain-title-text {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    background: linear-gradient(90deg, #a5f3fc, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1.2;
}
.explain-header .explain-subtitle {
    margin-top: 4px;
    font-size: 0.88rem;
    color: rgba(148,163,184,0.9);
    font-weight: 400;
}
.explain-body { font-size: 1.08rem; line-height: 1.85; }
.explain-body h1, .explain-body h2, .explain-body h3, .explain-body h4 {
    margin-top: 1.6em;
    margin-bottom: 0.6em;
    letter-spacing: -0.01em;
}
.explain-body h1 { font-size: 1.35rem; }
.explain-body h2 { font-size: 1.2rem; }
.explain-body h3 { font-size: 1.05rem; }
.explain-body ul, .explain-body ol { padding-inline-start: 1.4em; }
.explain-body li {
    padding: 10px 14px;
    margin: 6px 0;
    border-radius: 10px;
    list-style-position: inside;
}
.explain-body p { margin: 0.8em 0; }
.explain-body strong { font-weight: 700; }

/* Keep Smart Explain custom bullets outside the text flow in both LTR and RTL. */
#doc-explain-modal-content.engaging-reading ul,
#doc-explain-modal-content.engaging-reading ol {
    list-style: none !important;
    padding: 0 !important;
    margin: 20px 0 28px !important;
}
#doc-explain-modal-content.engaging-reading li {
    list-style: none !important;
    list-style-position: outside !important;
    padding-block: 14px !important;
    padding-inline-start: 46px !important;
    padding-inline-end: 20px !important;
}
#doc-explain-modal-content.engaging-reading li::before {
    inset-inline-start: 20px !important;
    top: 26px !important;
}

/* RTL polish */
html[dir="rtl"] .explain-header,
[dir="rtl"] .explain-header { flex-direction: row-reverse; text-align: right; }

/* Light mode overrides */
body.app-light-mode .explain-modal-v2 .usmle-body {
    background:
        radial-gradient(1000px 600px at 12% -10%, rgba(59,130,246,0.10), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(139,92,246,0.08), transparent 55%),
        #f4f6fb;
}
body.app-light-mode .explain-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 20px 50px -20px rgba(15,23,42,0.15) !important;
}
body.app-light-mode .explain-header { border-bottom-color: #e2e8f0; }
body.app-light-mode .explain-header .explain-title-text {
    background: linear-gradient(90deg, #1d4ed8, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
body.app-light-mode .explain-header .explain-subtitle { color: #64748b; }

/* Mobile */
@media (max-width: 640px) {
    .explain-modal-v2 .usmle-content { padding: 80px 12px 40px !important; }
    .explain-card { padding: 22px 20px 28px !important; border-radius: 18px !important; }
    .explain-header { gap: 12px; margin-bottom: 20px; padding-bottom: 16px; }
    .explain-header .explain-icon { width: 44px; height: 44px; border-radius: 12px; }
    .explain-header .explain-icon svg { width: 22px; height: 22px; }
    .explain-header .explain-title-text { font-size: 1.25rem; }
    .explain-header .explain-subtitle { font-size: 0.8rem; }
    .explain-body { font-size: 1rem; line-height: 1.75; }
}

/* Google sign-in button */
.login-divider { display:flex; align-items:center; gap:10px; margin:14px 0 10px; color: rgba(148,163,184,0.7); font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; }
.login-divider::before, .login-divider::after { content:""; flex:1; height:1px; background: linear-gradient(90deg, transparent, rgba(148,163,184,0.3), transparent); }
.login-btn-google { width:100%; display:flex; align-items:center; justify-content:center; gap:10px; padding:12px 16px; border-radius:12px; background:#ffffff; color:#1f2937; border:1px solid rgba(15,23,42,0.12); font-weight:600; font-size:14px; cursor:pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.login-btn-google:hover { background:#f8fafc; box-shadow: 0 8px 24px -12px rgba(15,23,42,0.35); transform: translateY(-1px); }
.login-btn-google svg { flex-shrink:0; }
