* { box-sizing: border-box; }

html {
    min-height: 100%;
    background: #0d0a1a;
    overscroll-behavior-y: none;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #333;
    overflow-x: hidden;
    background: transparent;
    overscroll-behavior-y: none;
}

body.startup-active {
    overflow: hidden !important;
    height: 100vh !important;
}

.app-background { display: none; } /* No longer needed if html background works */

/* ── Floating Controls ─────────────────────────────────────────────────────── */
.floating-btn {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(102, 126, 234, 0.3);
    padding: 0.6rem 0.9rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4f46e5;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Old Floating Controls Removed */


@media (hover: hover) {
    .floating-btn:hover {
        transform: translateY(-3px) scale(1.05);
        background: #fff;
        border-color: #667eea;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    }
}

.floating-btn:active {
    transform: translateY(-1px) scale(0.95);
}

/* Fix sticky hover on mobile for all buttons */
@media (hover: none) {
    .primary-btn:hover, .secondary-btn:hover, .source-btn:hover, .floating-btn:hover {
        transform: none !important;
        box-shadow: inherit !important;
    }
}

.primary-btn, .secondary-btn, .source-btn, .floating-btn {
    outline: none !important;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.4); z-index: 10000; opacity: 0; pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
}
.sidebar-overlay.open {
    opacity: 1; pointer-events: auto;
}
.sidebar {
    position: fixed; left: -100%; top: 0; width: 85vw; max-width: 320px;
    height: 100vh; background: #fff; z-index: 10001;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
}
.sidebar.open { left: 0; }

body.no-scroll { overflow: hidden !important; height: 100vh !important; }
.sidebar-header { padding: 1.5rem; padding-bottom: 0.75rem; border-bottom: 2px solid #f0f0f0; }
.sidebar-header h3 { color: #667eea; font-size: 1.1rem; }
.sidebar-content { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.5rem; }

.sidebar-memory-btn {
    width: 100%; background: linear-gradient(135deg, #ff6eb4, #ff8fab);
    color: #fff; border: none; border-radius: 12px; padding: 0.9rem 1rem;
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 0.6rem;
    transition: all 0.25s; box-shadow: 0 4px 14px rgba(255,110,180,0.3);
}
.sidebar-memory-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255,110,180,0.4); }

.sidebar-new-btn {
    width: 100%; background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; border: none; border-radius: 10px; padding: 0.75rem 1rem;
    font-size: 0.9rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 0.5rem;
    transition: all 0.25s; margin-bottom: 0.5rem;
}
.sidebar-new-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(102,126,234,0.3); }

.sidebar-empty { color: #999; text-align: center; padding: 1.5rem; font-size: 0.9rem; }

.history-item {
    background: #fff; border: 1.5px solid #e8e8f0; border-radius: 10px;
    padding: 0.75rem 0.9rem; cursor: pointer;
    display: flex; align-items: center; gap: 0.5rem;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.history-item:hover { border-color: #667eea; background: #f8f9ff; transform: translateX(3px); }
.history-item-body { flex: 1; min-width: 0; }
.history-item-body h4 { color: #333; font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.history-item-body .date { color: #999; font-size: 0.75rem; margin-top: 2px; }
.history-item-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.history-item-actions button {
    background: none; border: none; color: #bbb; cursor: pointer;
    padding: 0.3rem; border-radius: 6px; font-size: 0.8rem; transition: color 0.2s;
}
.history-item-actions button:hover { color: #667eea; }

/* Custom Checkbox for Multi-select */
.custom-checkbox {
    width: 20px; height: 20px;
    border: 2px solid #c7d2fe; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; background: #fff;
}
.history-item.selected { border-color: #667eea; background: #f0f4ff; }
.history-item.selected .custom-checkbox { background: #667eea; border-color: #667eea; }
.history-item.selected .custom-checkbox::after {
    content: '\\f00c'; font-family: 'Font Awesome 5 Free', 'Font Awesome 6 Free';
    font-weight: 900; color: #fff; font-size: 0.7rem;
}

/* ── Main content ────────────────────────────────────────────────────────────── */
.main-content { 
    margin-left: 0; margin-top: 0; 
    padding: 1.25rem; 
    padding-top: max(2rem, env(safe-area-inset-top, 0px)); 
    min-height: 100vh; 
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
}

/* ── Pages ───────────────────────────────────────────────────────────────────── */
.page { 
    display: none; 
    padding-top: 100px; 
    padding-bottom: 120px; 
    min-height: 100vh; 
    box-sizing: border-box; 
    max-width: 1600px;
    margin: 0 auto;
    width: 95%;
}
.page.active { display: block; }
@keyframes pageEnter { from { opacity: 0; transform: translateY(24px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ── Scroll Reveal ─────────────────────────────────────────────────────────── */
/* Elements are visible by default. body.js-ready (added by JS) enables the effect. */
body.js-ready .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
body.js-ready .reveal.revealed { opacity: 1; transform: translateY(0); }

body.js-ready [data-reveal-child] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
body.js-ready [data-reveal-child].revealed { opacity: 1; transform: translateY(0); }

/* ── Ripple Effect ─────────────────────────────────────────────────────────── */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: rippleAnim 0.85s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
    z-index: 0;
}
@keyframes rippleAnim {
    to { transform: scale(1); opacity: 0; }
}


/* ── Home Hub (Bento Style) ────────────────────────────────────────────────── */
.hub-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
}
.hub-hero {
    text-align: left;
    margin-bottom: 1.5rem;
    padding-left: 0.25rem;
    position: relative;
}
.hub-hero::before {
    content: '';
    position: absolute;
    top: -30px;
    left: -20px;
    width: 280px;
    height: 180px;
    background: radial-gradient(circle, rgba(192, 132, 252, 0.25) 0%, rgba(244, 114, 182, 0.08) 50%, rgba(0, 0, 0, 0) 70%) !important;
    filter: blur(25px) !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    z-index: -1 !important;
    display: none !important;
}
.hub-hero h1 {
    font-size: 4rem;
    font-weight: 800;
    color: #1e1b4b;
    margin-bottom: 0.5rem;
    letter-spacing: -0.04em;
    line-height: 1.1;
}
.hub-hero h1 span {
    color: #0ea5e9;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    font-weight: 900;
}
.hub-hero p {
    font-size: 1.25rem;
    color: #334155; /* Much darker for better contrast */
    max-width: 500px;
    line-height: 1.5;
    font-weight: 500;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, minmax(220px, auto));
    gap: 1.5rem;
}

.hub-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 28px;
    padding: 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.hub-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--card-accent, #00f2ff), transparent, var(--card-accent, #00f2ff));
    opacity: 0;
    border-radius: 26px;
    z-index: -1;
    transition: opacity 0.4s ease;
    filter: blur(12px);
    pointer-events: none;
}
.feature-card { --card-accent: #00f2ff; }
.study-card { --card-accent: #f472b6; }
.quiz-card { --card-accent: #34d399; }
.guide-card { --card-accent: #e11d48; }

@media (hover: hover) {
    .hub-card:hover::before {
        opacity: 0.35;
    }
}

/* Ensure the selected highlight works on mobile (triggers on click) */
.hub-card.is-active-transition::before {
    opacity: 0.75 !important;
    filter: blur(18px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Disable hold/hover shift animations for a solid feel */
.hub-card:hover {
    border-color: rgba(255, 255, 255, 0.9);
}

.hub-card-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hub-icon {
    width: 64px; height: 64px; border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: #fff;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-card .hub-icon { 
    background: rgba(0, 242, 255, 0.12); 
    color: #00f2ff; 
    border-color: rgba(0, 242, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
}
.feature-card .hub-footer { color: #00f2ff; }

.study-card .hub-icon { 
    background: rgba(244, 114, 182, 0.12); 
    color: #f472b6; 
    border-color: rgba(244, 114, 182, 0.2);
    box-shadow: 0 0 20px rgba(244, 114, 182, 0.2);
}
.study-card .hub-footer { color: #f472b6; }

.quiz-card .hub-icon { 
    background: rgba(52, 211, 153, 0.12); 
    color: #34d399; 
    border-color: rgba(52, 211, 153, 0.2);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.2);
}
.quiz-card .hub-footer { color: #34d399; }

.guide-card .hub-icon { 
    background: rgba(225, 29, 72, 0.12); 
    color: #e11d48; 
    border-color: rgba(225, 29, 72, 0.2);
    box-shadow: 0 0 20px rgba(225, 29, 72, 0.2);
}
.guide-card .hub-footer { color: #e11d48; }

.hub-text h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}
.hub-text p {
    font-size: 1.05rem;
    color: #475569;
    line-height: 1.4;
    font-weight: 500;
}

.hub-footer {
    margin-top: 2rem;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s;
}

@media (hover: hover) {
    .hub-card:hover .hub-footer {
        transform: translateX(8px);
    }
}

/* ── Hub Card Decorations — removed decorative ::after overlays ──────────── */

/* Processing Pulse for Input Section */
.audio-section.is-processing {
    animation: processingPulse 2s infinite ease-in-out;
    pointer-events: none; /* Disable interaction during processing */
}
@keyframes processingPulse {
    0%, 100% { opacity: 1; transform: scale(1); filter: brightness(1); }
    50% { opacity: 0.85; transform: scale(0.99); filter: brightness(1.1); }
}

/* Old hero styles cleanup */
.hero-section, .feature-grid { display: none; }

/* ── Page header ─────────────────────────────────────────────────────────────── */
.page-header {
    background: rgba(255, 255, 255, 0.04); 
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px; 
    padding: 2.5rem;
    margin-bottom: 2.5rem; 
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.page-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform-style: preserve-3d;
    will-change: transform;
    backface-visibility: hidden;
}

.page-header p {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.55);
    max-width: 600px;
    transform-style: preserve-3d;
    will-change: transform;
    backface-visibility: hidden;
}

#notesPage .page-header h2 { color: #00f2ff; text-shadow: 0 0 30px rgba(0, 242, 255, 0.3); }
#flashcardsPage .page-header h2 { color: #f472b6; text-shadow: 0 0 30px rgba(244, 114, 182, 0.3); }
#quizPage .page-header h2 { color: #34d399; text-shadow: 0 0 30px rgba(52, 211, 153, 0.3); }
#cheatSheetPage .page-header h2 { color: #e11d48; text-shadow: 0 0 30px rgba(225, 29, 72, 0.3); }

.audio-section {
    background: rgba(255, 255, 255, 0.03); 
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 32px; 
    padding: 2.5rem;
    margin-bottom: 2.5rem; 
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

/* Three source buttons */
.source-buttons {
    display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.source-btn {
    flex: 1;
    min-width: 120px;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    color: rgba(255, 255, 255, 0.95);
    /* Faint theme glow will be applied via JS inline style */
}
.source-btn i {
    font-size: 1.7rem;
    transition: transform 0.3s ease;
}
.source-btn span {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
@media (hover: hover) {
    .source-btn:hover {
        background: rgba(255, 255, 255, 0.06);
        transform: translateY(-4px);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    }
}

/* Recording active status */
.recording-active {
    display: flex; align-items: center; gap: 1rem;
    background: #fff5f5; border: 2px solid #fecaca;
    border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 1.5rem;
    color: #dc2626; font-weight: 600;
}
.recording-indicator {
    width: 12px; height: 12px; background: #ef4444; border-radius: 50%;
    animation: blink 1s infinite;
}
@keyframes blink { 0%,50%{opacity:1} 51%,100%{opacity:0.3} }
.stop-btn {
    margin-left: auto; background: #ef4444; color: #fff; border: none;
    border-radius: 8px; padding: 0.5rem 1rem; cursor: pointer; font-weight: 600;
    display: flex; align-items: center; gap: 0.4rem; transition: background 0.2s;
}
.stop-btn:hover { background: #dc2626; }

/* Text input panel */
.text-input-panel { margin-bottom: 1.5rem; }
.text-input-panel textarea {
    width: 100%; min-height: 140px; border: 2px solid #e0e7ff;
    border-radius: 12px; padding: 1rem; font-family: inherit;
    font-size: 0.95rem; resize: vertical; transition: border-color 0.2s;
    color: #333; line-height: 1.6;
}
.text-panel-footer { margin-top: 0.25rem; font-size: 0.8rem; color: #999; text-align: right; }
.text-panel-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; }

/* Source display (after selection) */
.source-display { margin-bottom: 1.5rem; }
.source-item {
    display: flex; align-items: flex-start; gap: 1rem;
    background: #f8f9ff; border: 2px solid #e0e7ff; border-radius: 14px; padding: 1.25rem;
}
.source-item-icon {
    width: 44px; height: 44px; background: linear-gradient(135deg,#667eea,#764ba2);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem; flex-shrink: 0;
}
.source-item-info { flex: 1; min-width: 0; }
.source-item-info h4 { font-size: 0.95rem; color: #333; margin-bottom: 0.5rem; font-weight: 600; }
.text-preview { color: #666; font-size: 0.88rem; line-height: 1.5; }

/* Inline audio player */
.audio-player-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.play-pause-btn {
    width: 34px; height: 34px; border-radius: 50%; border: 2px solid #667eea;
    background: none; color: #667eea; cursor: pointer; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: all 0.2s;
}
.play-pause-btn:hover { background: #667eea; color: #fff; }
.audio-time { font-size: 0.78rem; color: #888; white-space: nowrap; min-width: 80px; }
.audio-scrubber {
    flex: 1; min-width: 60px; height: 4px; border-radius: 4px;
    accent-color: #667eea; cursor: pointer;
}
.edit-audio-btn {
    background: none; border: 1.5px solid #c7d2fe; color: #667eea;
    border-radius: 8px; padding: 0.3rem 0.6rem; cursor: pointer; font-size: 0.8rem;
    display: flex; align-items: center; gap: 0.3rem; white-space: nowrap;
    transition: all 0.2s;
}
.edit-audio-btn:hover { background: #667eea; color: #fff; border-color: #667eea; }

/* Action buttons */
.action-buttons { display: flex; justify-content: center; }
.primary-btn, .secondary-btn {
    padding: 0.85rem 1.75rem; border-radius: 25px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.5rem; transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    font-size: 0.95rem; box-sizing: border-box;
}
.primary-btn { 
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}
.primary-btn:hover:not(:disabled), 
#newNoteBtn:hover, #newFlashcardsBtn:hover, #newQuizBtn:hover, #newCheatSheetBtn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.25),
                0 0 15px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.15) !important;
}
.primary-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98) !important;
}
.primary-btn:disabled { 
    background: rgba(255, 255, 255, 0.02) !important; 
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: rgba(255, 255, 255, 0.25) !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}
.secondary-btn { 
    background: rgba(255, 255, 255, 0.03) !important; 
    color: rgba(255, 255, 255, 0.7) !important; 
    border: 1px solid rgba(255, 255, 255, 0.12) !important; 
}
.secondary-btn:hover { 
    background: rgba(255, 255, 255, 0.08) !important; 
    color: #fff !important; 
    border-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-2px) !important; 
}

/* ── Flippable Card Button ───────────────────────────────────────── */
.flip-btn-container {
    perspective: 1000px;
    width: 140px;
    height: 42px;
    position: relative;
    display: inline-block;
}
.flip-btn-card {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.flip-btn-card.flipped {
    transform: rotateY(180deg);
}

/* iOS WebKit 3D touch hit-testing bug bypass for module action flip cards */
.flip-btn-card:not(.flipped) .flip-btn-front {
    pointer-events: auto !important;
    visibility: visible !important;
}
.flip-btn-card:not(.flipped) .flip-btn-back {
    pointer-events: none !important;
    visibility: hidden !important;
}
.flip-btn-card.flipped .flip-btn-front {
    pointer-events: none !important;
    visibility: hidden !important;
}
.flip-btn-card.flipped .flip-btn-back {
    pointer-events: auto !important;
    visibility: visible !important;
}
.flip-btn-front, .flip-btn-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 21px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-sizing: border-box;
    gap: 0.5rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.flip-btn-front {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
}
.flip-btn-front:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 8px 24px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.25),
                0 0 15px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.15) !important;
}
.flip-btn-back {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #f87171 !important;
    transform: rotateY(180deg);
}
.flip-btn-back:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.25) !important;
}

/* Total Cost Preview */
.generate-wrapper { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 1rem; }
.total-cost-preview { 
    font-size: 0.85rem; font-weight: 600; color: #667eea; 
    background: rgba(102,126,234,0.08); padding: 0.5rem 1.25rem; 
    border-radius: 30px; border: 1px solid rgba(102,126,234,0.2);
    transition: all 0.3s ease;
}

/* Daily Usage Tracker Styling */
.daily-usage-container {
    margin-top: 2.5rem; padding: 1.5rem; 
    background: #fff; border: 1px solid #eef1ff; border-radius: 16px;
    box-shadow: 0 4px 12px rgba(102,126,234,0.05);
}
.usage-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1.25rem; }
.usage-header h3 { font-size: 1rem; color: #1e1b4b; font-weight: 800; border: none; }
.usage-reset-text { font-size: 0.72rem; color: #94a3b8; font-weight: 500; }
.usage-item { margin-bottom: 1rem; }
.usage-item:last-child { margin-bottom: 0; }
.usage-info { display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: 700; color: #475569; margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; }
.usage-bar-wrap { height: 8px; background: #f1f5f9; border-radius: 10px; overflow: hidden; position: relative; }
.usage-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #667eea, #c84b9e); transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.usage-warning { color: #ef4444 !important; }
.usage-bar-warning { background: #ef4444 !important; }

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed; bottom: 20px; left: 20px; right: 20px;
    background: #1e1b4b; color: #fff; padding: 1.25rem 1.5rem;
    border-radius: 20px; z-index: 9999; display: none;
    align-items: center; justify-content: space-between;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.pwa-banner-content { display: flex; align-items: center; gap: 1rem; flex: 1; margin-right: 1rem; }
.pwa-banner-icon { font-size: 1.5rem; color: #667eea; }
.pwa-banner-text { font-size: 0.9rem; line-height: 1.4; font-weight: 500; }
.pwa-banner-close { 
    background: rgba(255,255,255,0.1); border: none; color: #fff;
    min-width: 30px; height: 30px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; cursor: pointer;
    transition: background 0.2s;
}
.pwa-banner-close:hover { background: rgba(255,255,255,0.3); }

@keyframes slideUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media all and (display-mode: standalone) {
    .pwa-install-banner { display: none !important; }
}

/* Source Item Cost Badge */
.source-cost-badge { 
    font-size: 0.7rem; font-weight: 700; color: #667eea; 
    background: rgba(102, 126, 234, 0.1); 
    padding: 0.2rem 0.5rem; border-radius: 6px;
    margin-top: 0.25rem; display: inline-block;
}

/* Play/delete buttons used generically */
.play-btn, .delete-btn {
    background: transparent; border: 2px solid; padding: 0.4rem;
    border-radius: 50%; cursor: pointer; width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.play-btn   { border-color: #667eea; color: #667eea; }
.play-btn:hover { background: #667eea; color: #fff; }
.delete-btn { border-color: #ef4444; color: #ef4444; }
.delete-btn:hover { background: #ef4444; color: #fff; }

/* ── Progress Overlay ────────────────────────────────────────────────────────── */
.progress.modal-overlay, .modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px); z-index: 10002;
    display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.active {
    display: flex; opacity: 1;
}
.progress-card {
    background: #fff; border-radius: 20px; padding: 2.5rem 3rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15); min-width: 340px; text-align: center;
}
.progress-phase-label {
    font-size: 1rem; font-weight: 600; color: #667eea; margin-bottom: 1.25rem;
    letter-spacing: 0.01em;
}
.progress-bar-wrap {
    height: 10px; background: #e8eaf6; border-radius: 10px;
    overflow: hidden; margin-bottom: 0.75rem;
}
.progress-bar-fill {
    height: 100%; width: 0%; border-radius: 10px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.25s ease;
}
.progress-pct { font-size: 1.5rem; font-weight: 700; color: #667eea; }

/* ── Notes Output ────────────────────────────────────────────────────────────── */
.notes-output {
    background: rgba(255,255,255,0.95); border-radius: 14px; padding: 2rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.07);
}
.notes-output h3 { color: #9ca3af; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0; }
.notes-output-header {
    display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1.5rem;
    padding-bottom: 1rem; border-bottom: 2px solid #f0f0f8;
}
.current-note-title {
    font-size: 1.35rem; font-weight: 700; color: #1e1b4b;
    line-height: 1.3;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
}
.notes-content { display: flex; flex-direction: column; gap: 1.1rem; }

.notes-overview {
    background: linear-gradient(135deg,#f0f4ff,#e8ecff);
    border-left: 4px solid #667eea; border-radius: 0 12px 12px 0;
    padding: 1.2rem 1.5rem;
}
.notes-overview-label {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: #667eea; margin-bottom: 0.5rem;
    display: flex; align-items: center; gap: 0.4rem;
}
.notes-overview p { color: #374151; line-height: 1.75; font-size: 0.95rem; }

.notes-sections { display: flex; flex-direction: column; gap: 0.65rem; }
.notes-section-card {
    background: #fff; border: 1.5px solid #e0e7ff; border-radius: 12px;
    overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s;
}
.notes-section-card:hover { border-color: #667eea; box-shadow: 0 4px 14px rgba(102,126,234,0.1); }
.notes-section-header {
    width: 100%; background: none; border: none;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.9rem 1.1rem; cursor: pointer; text-align: left; gap: 1rem;
}
.notes-section-title { font-weight: 700; font-size: 0.93rem; color: #1e1b4b; flex: 1; }
.notes-chevron { color: #667eea; font-size: 0.8rem; transition: transform 0.25s; flex-shrink: 0; }
.notes-section-bullets { padding: 0 1.1rem 0.85rem; }
.notes-section-bullets ul { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; padding: 0; margin: 0; }
.notes-section-bullets li { display: flex; gap: 0.5rem; color: #374151; font-size: 0.9rem; line-height: 1.5; }
.notes-section-bullets li::before { content: '•'; color: #667eea; font-weight: 900; flex-shrink: 0; }
.notes-section-body { border-top: 1px solid #e0e7ff; padding: 0.9rem 1.1rem 1.1rem; background: #fafbff; }
.notes-detail { color: #4b5563; font-size: 0.9rem; line-height: 1.75; margin-bottom: 0.75rem; }
.notes-source {
    margin: 0; border-left: 3px solid #a5b4fc; padding: 0.5rem 0.9rem;
    color: #6366f1; font-style: italic; font-size: 0.85rem;
    background: #eff0ff; border-radius: 0 8px 8px 0; line-height: 1.6;
}

.notes-transcript-wrap { border-top: 1.5px dashed #c7d2fe; padding-top: 0.65rem; }
.notes-transcript-toggle {
    background: none; border: none; cursor: pointer;
    display: flex; align-items: center; gap: 0.5rem;
    color: #667eea; font-size: 0.88rem; font-weight: 600; padding: 0.4rem 0;
}
.notes-transcript-toggle:hover { color: #4f46e5; }
.notes-transcript-body {
    margin-top: 0.65rem; background: #f3f4f6; border-radius: 10px;
    padding: 1.1rem; color: #4b5563; font-size: 0.88rem;
    line-height: 1.8; white-space: pre-wrap; max-height: 400px; overflow-y: auto;
}

/* Button spinner */
.btn-spinner {
    display: inline-block; width: 15px; height: 15px;
    border: 2.5px solid rgba(255,255,255,0.35); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Brain-mode (full-screen canvas, hide sidebar) ──────────────────────────── */
.brain-mode .sidebar       { display: none; }
.brain-mode .main-content  { margin-left: 0; padding: 0; }
.brain-mode #memoryBrainPage { border-radius: 0; height: calc(100vh - 80px); }

/* ── Memory page ─────────────────────────────────────────────────────────────── */
#memoryBrainPage {
    position: relative; height: calc(100vh - 80px);
    background: #faf8f5; border-radius: 16px; overflow: hidden;
    box-shadow: 0 4px 28px rgba(0,0,0,0.15);
}

/* Search bar — light frosted glass */
.brain-search-wrap {
    position: absolute; top: 1.25rem; left: 50%; transform: translateX(-50%);
    z-index: 20; display: flex; align-items: center;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(100, 120, 230, 0.28);
    backdrop-filter: blur(14px);
    border-radius: 30px; padding: 0.55rem 1.1rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 0 16px rgba(100, 120, 230, 0.05);
    width: min(380px, 80vw);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.brain-search-wrap:focus-within {
    border-color: rgba(100, 120, 230, 0.65);
    box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 24px rgba(100, 120, 230, 0.15);
}
.brain-search-icon { color: rgba(100, 120, 230, 0.9); margin-right: 0.55rem; font-size: 0.88rem; }
.brain-search-input {
    border: none; outline: none; background: transparent;
    font-size: 0.92rem; color: #333; width: 100%;
    font-family: 'Segoe UI', system-ui, sans-serif;
}
.brain-search-input::placeholder { color: rgba(120, 130, 150, 0.7); }

/* Hint label */
.brain-hint {
    position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
    z-index: 20;
    color: rgba(100, 120, 230, 0.65);
    font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
    font-family: 'Segoe UI', system-ui, sans-serif;
    pointer-events: none;
    transition: opacity 0.5s;
}

#brainCanvas {
    position: relative; z-index: 5;
    width: 100%; height: 100%; display: block;
    cursor: grab; touch-action: none; overscroll-behavior: none;
    transition: opacity 0.5s ease-in-out;
}

/* ── Memory page ─────────────────────────────────────────────────────────────── */
.memory-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 1.5rem; }
.memory-card {
    background: rgba(255,255,255,0.95); border-radius: 18px; padding: 2rem;
    text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transition: all 0.3s; cursor: pointer;
}
.memory-card:hover { transform: translateY(-8px); box-shadow: 0 18px 36px rgba(0,0,0,0.13); }
.memory-icon {
    width: 72px; height: 72px; background: linear-gradient(135deg,#667eea,#764ba2);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.25rem; color: #fff; font-size: 1.8rem;
}
.memory-card h3 { font-size: 1.3rem; color: #333; margin-bottom: 0.75rem; }
.memory-card p  { color: #666; margin-bottom: 1.25rem; line-height: 1.6; font-size: 0.95rem; }
.memory-btn {
    background: linear-gradient(135deg,#667eea,#764ba2); color: #fff; border: none;
    padding: 0.65rem 1.75rem; border-radius: 25px; font-weight: 600; cursor: pointer; transition: all 0.25s;
}
.memory-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(102,126,234,0.3); }

/* ── Flashcards ──────────────────────────────────────────────────────────────── */
.flashcard-controls {
    background: rgba(255,255,255,0.95); border-radius: 14px; padding: 2rem;
    margin-bottom: 1.75rem; box-shadow: 0 4px 16px rgba(0,0,0,0.07);
    display: flex; flex-direction: column; gap: 1.5rem;
}
.audio-controls { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.record-btn, .upload-btn {
    background: linear-gradient(135deg,#667eea,#764ba2); color: #fff; border: none;
    padding: 0.75rem 1.5rem; border-radius: 40px; font-size: 0.95rem; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; gap: 0.5rem; transition: all 0.25s;
}
.record-btn:hover, .upload-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(102,126,234,0.3); }
.record-btn:active, .upload-btn:active { transform: translateY(0) scale(1) !important; }
.record-btn:focus-visible, .upload-btn:focus-visible { outline: 2px solid #667eea !important; outline-offset: 3px; }
.flashcard-container {
    background: rgba(255,255,255,0.95); border-radius: 14px; padding: 2rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.07);
    perspective: 1000px;
    position: relative;
    overflow: hidden;
}
.flashcards-header {
    display: flex; justify-content: flex-end; margin-bottom: 1rem;
}
.flashcard {
    width: 100%; min-height: 280px;
    cursor: pointer; position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    margin-bottom: 1.5rem;
}
.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #fff; border-radius: 14px; padding: 2.5rem 2rem;
    text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    display: flex; flex-direction: column; justify-content: center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-sizing: border-box;
}
.flashcard-back {
    background: linear-gradient(135deg,#667eea,#764ba2); color: #fff;
    transform: rotateY(180deg);
}
.flashcard h3 { font-size: 1.3rem; margin-bottom: 0.75rem; color: #667eea; }
.flashcard-back h3 { color: #fff; }
.flashcard p  { font-size: 1.1rem; line-height: 1.6; }

/* Sliding animations */
.flashcard-slide-out-left { animation: slideOutLeft 0.3s forwards; }
.flashcard-slide-out-right { animation: slideOutRight 0.3s forwards; }
.flashcard-slide-in-left { animation: slideInLeft 0.3s forwards; }
.flashcard-slide-in-right { animation: slideInRight 0.3s forwards; }

@keyframes slideOutLeft { to { transform: translateX(-150%) rotateY(0); opacity: 0; } }
@keyframes slideOutRight { to { transform: translateX(150%) rotateY(0); opacity: 0; } }
@keyframes slideInRight { from { transform: translateX(150%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideInLeft { from { transform: translateX(-150%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Hint Button */
.hint-btn {
    position: absolute; bottom: 1.5rem; right: 1.5rem;
    width: 38px; height: 38px; border-radius: 50%;
    background: #f0f4ff; border: 2px solid #667eea; color: #667eea;
    font-weight: 800; font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; z-index: 10;
}
.hint-btn:hover { background: #667eea; color: #fff; transform: scale(1.1); }
.flashcard-back .hint-btn { display: none; } /* Hide on back */

.hint-text-bubble {
    position: absolute; bottom: 4.5rem; right: 1.5rem;
    background: rgba(30, 27, 75, 0.9); color: #fff;
    padding: 0.8rem 1.2rem; border-radius: 12px; font-size: 0.9rem;
    max-width: 220px; text-align: left;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 11;
    animation: bubblePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
}
.hint-text-bubble::after {
    content: ''; position: absolute; bottom: -6px; right: 15px;
    width: 0; height: 0; border-left: 8px solid transparent;
    border-right: 8px solid transparent; border-top: 8px solid rgba(30, 27, 75, 0.9);
}
@keyframes bubblePop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }


.flashcard-nav { display: flex; justify-content: center; align-items: center; gap: 1.5rem; margin-top: 1rem; }
.nav-flashcard-btn {
    background: #667eea; color: #fff; border: none;
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; cursor: pointer; transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}
.nav-flashcard-btn:hover { background: #5a67d8; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(102,126,234,0.4); }
.nav-flashcard-btn:disabled { background: #cbd5e1; cursor: not-allowed; transform: none; box-shadow: none; }
.flashcard-counter { font-weight: 700; color: #64748b; font-size: 1.1rem; }

/* ── Matching Game ───────────────────────────────────────────────────────────── */
.game-controls {
    background: rgba(255,255,255,0.95); border-radius: 14px; padding: 1.75rem;
    margin-bottom: 1.75rem; box-shadow: 0 4px 16px rgba(0,0,0,0.07);
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1.5rem;
}
.game-stats { display: flex; gap: 2rem; }
.stat { text-align: center; }
.stat-label { display: block; color: #666; font-size: 0.85rem; margin-bottom: 0.3rem; }
.stat-value { display: block; color: #667eea; font-size: 1.4rem; font-weight: 700; }
.matching-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem; background: rgba(255,255,255,0.95); border-radius: 14px;
    padding: 1.75rem; box-shadow: 0 4px 16px rgba(0,0,0,0.07);
}
.matching-card {
    background: #fff; border: 2px solid #e0e7ff; border-radius: 10px;
    padding: 1.25rem; text-align: center; cursor: pointer;
    min-height: 110px; display: flex; align-items: center; justify-content: center;
    transition: all 0.25s;
}
.matching-card:hover  { border-color: #667eea; background: #f0f4ff; transform: translateY(-3px); }
.matching-card.selected { border-color: #667eea; background: #667eea; color: #fff; transform: scale(1.04); }
.matching-card.matched  { background: #10b981; border-color: #10b981; color: #fff; cursor: default; animation: matchPop 0.4s ease; }
.matching-card.wrong    { background: #ef4444; border-color: #ef4444; color: #fff; animation: shake 0.4s ease; }
@keyframes matchPop { 0%{transform:scale(1)} 50%{transform:scale(1.08)} 100%{transform:scale(1)} }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

/* ── Practice ────────────────────────────────────────────────────────────────── */
.practice-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 1.5rem; }
.practice-card {
    background: rgba(255,255,255,0.95); border-radius: 18px; padding: 2rem;
    text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transition: all 0.3s; cursor: pointer;
}
.practice-card:hover { transform: translateY(-8px); box-shadow: 0 18px 36px rgba(0,0,0,0.13); }
.practice-icon {
    width: 72px; height: 72px; background: linear-gradient(135deg,#667eea,#764ba2);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.25rem; color: #fff; font-size: 1.8rem;
}
.practice-card h3 { font-size: 1.3rem; color: #333; margin-bottom: 0.75rem; }
.practice-card p  { color: #666; margin-bottom: 1.25rem; line-height: 1.6; font-size: 0.95rem; }
.practice-btn {
    background: linear-gradient(135deg,#667eea,#764ba2); color: #fff; border: none;
    padding: 0.65rem 1.75rem; border-radius: 25px; font-weight: 600; cursor: pointer; transition: all 0.25s;
}
.practice-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(102,126,234,0.3); }

/* ── Quiz ────────────────────────────────────────────────────────────────────── */
.quiz-setup {
    background: rgba(255,255,255,0.95); border-radius: 14px; padding: 2rem;
    margin-bottom: 1.75rem; box-shadow: 0 4px 16px rgba(0,0,0,0.07);
    display: flex; flex-direction: column; gap: 1.5rem;
}
.quiz-setup .audio-controls { justify-content: center; }
.quiz-container { background: rgba(255,255,255,0.95); border-radius: 14px; padding: 2rem; box-shadow: 0 4px 16px rgba(0,0,0,0.07); }
.quiz-question { margin-bottom: 1.5rem; }
.quiz-question h3 { color: #667eea; margin-bottom: 0.75rem; font-size: 1.2rem; }
.quiz-question p  { font-size: 1.05rem; line-height: 1.6; }
.quiz-options { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.quiz-option { background: #f8f9ff; border: 2px solid #e0e7ff; border-radius: 10px; padding: 0.9rem; cursor: pointer; transition: all 0.2s; }
.quiz-option:hover    { border-color: #667eea; background: #f0f4ff; }
.quiz-option.selected { border-color: #667eea; background: #667eea; color: #fff; }
.quiz-textarea { width:100%; min-height:110px; padding:0.9rem; border:2px solid #e0e7ff; border-radius:10px; font-family:inherit; font-size:0.95rem; resize:vertical; }
.quiz-textarea:focus { outline:none; border-color:#667eea; }
.quiz-nav { display:flex; justify-content:flex-end; margin-top:1.5rem; }
.quiz-nav-btn { background:#667eea; color:#fff; border:none; padding:0.65rem 1.5rem; border-radius:25px; cursor:pointer; transition:all 0.2s; }
.quiz-nav-btn:hover { background:#5a67d8; transform:translateY(-1px); }

/* ── Modals ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center; z-index: 9000;
}
.modal-card {
    background: #fff; border-radius: 20px; width: 90%; max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    display: flex; flex-direction: column; max-height: 90vh;
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem; border-bottom: 1.5px solid #f0f0f0;
}
.modal-header h3 { font-size: 1.05rem; color: #333; display: flex; align-items: center; gap: 0.5rem; }
.modal-close { background:none; border:none; color:#999; font-size:1.1rem; cursor:pointer; transition:color 0.2s; }
.modal-close:hover { color:#333; }
.modal-body { padding: 1.5rem; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 0.75rem;
    padding: 1rem 1.5rem; border-top: 1.5px solid #f0f0f0; background: #fafafa;
}

/* Trim controls */
.trim-controls { display: flex; flex-direction: column; gap: 1rem; }
.trim-row { display: flex; flex-direction: column; gap: 0.4rem; }
.trim-row label { font-size: 0.88rem; font-weight: 600; color: #555; display: flex; justify-content: space-between; }
.trim-time-label { color: #667eea; }
.trim-slider { width: 100%; accent-color: #667eea; }
.trim-duration { font-size: 0.88rem; color: #666; text-align: center; }

/* Rename input */
.rename-input {
    width: 100%; border: 2px solid #e0e7ff; border-radius: 10px;
    padding: 0.75rem 1rem; font-size: 0.95rem; font-family: inherit;
    transition: border-color 0.2s;
}
.rename-input:focus { outline: none; border-color: #667eea; }

/* ── Toast messages ──────────────────────────────────────────────────────────── */
.message {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 20000;
    padding: 0.9rem 1.2rem; border-radius: 16px;
    display: flex; align-items: center; gap: 0.65rem;
    font-weight: 500; font-size: 0.92rem; max-width: 340px;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
    opacity: 0; transform: translateY(16px) scale(0.96);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none; cursor: grab;
}
.message.success { background: rgba(209,250,229,0.95); color: #065f46; border: 1px solid rgba(167,243,208,0.8); }
.message.error   { background: rgba(254,226,226,0.95); color: #991b1b; border: 1px solid rgba(254,202,202,0.8); }
.message.info    { background: rgba(219,234,254,0.95); color: #1e40af; border: 1px solid rgba(147,197,253,0.8); }


/* ── Mobile ──────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Navbar */
    .navbar { 
        padding: 0.6rem 1rem; 
        padding-top: calc(0.6rem + env(safe-area-inset-top, 0px));
        height: auto;
    }

    /* Sidebar — on the right */
    .sidebar {
        left: -100%; top: 0; width: 85vw; max-width: 320px;
        height: 100vh; padding: 0;
        flex-direction: column; justify-content: flex-start;
        box-shadow: 10px 0 24px rgba(0,0,0,0.15);
        right: auto;
    }
    .sidebar.open { left: 0; right: auto; }
    .sidebar-header { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 1rem; }
    .sidebar-content { flex-direction: column; overflow-y: auto; align-items: stretch; gap: 1rem; }
    
    .main-content { 
        margin-left: 0; 
        margin-top: 0; 
        padding: 1.25rem; 
        padding-top: max(5.5rem, calc(2rem + env(safe-area-inset-top))); 
        min-height: 100vh; 
        padding-bottom: 3rem; 
    }

    /* Brain mode — sidebar hidden, no bottom padding needed */
    .brain-mode .sidebar { display: none; }
    .brain-mode .main-content { margin-top: 65px; padding-bottom: 0; }

    /* Hub Mobile */
    .hub-hero { margin-bottom: 2rem; }
    .hub-hero h1 { font-size: 2.8rem; }
    .hub-hero p { font-size: 1.05rem; }
    .hub-grid { grid-template-columns: 1fr; gap: 1rem; }
    .hub-card { padding: 1.75rem; border-radius: 24px; }
    .hub-text h3 { font-size: 1.4rem; }
    .hub-text p { font-size: 0.95rem; }
    .hub-icon { width: 48px; height: 48px; font-size: 1.4rem; border-radius: 14px; }
    .hub-footer { margin-top: 1.5rem; }

    /* Old styles cleanup */
    .hero-section, .feature-grid { display: none; }
    .source-buttons { flex-direction: column; }
    .source-item { flex-direction: column; text-align: center; align-items: center; gap: 0.75rem; }
    .audio-player-row { justify-content: center; }
    .audio-controls { flex-direction: column; align-items: center; }
    .game-controls { flex-direction: column; text-align: center; }
    .notes-output-header { flex-direction: column; align-items: flex-start; }
    .progress-card { padding: 1.5rem; width: 90%; }
    .modal-card { width: 95%; }

    /* Toast messages — above bottom sidebar */
    .message { bottom: 120px; }
}

/* ── Sources UI ────────────────────────────────────────────────────────────── */
.sources-output {
    background: rgba(255,255,255,0.95); border-radius: 14px; padding: 2rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.07);
}
.sources-output h3 {
    color: #9ca3af; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; 
    text-transform: uppercase; margin-bottom: 1rem; border: none;
}
.sources-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem;
}
.source-gallery-item {
    background: #f8f9ff; border: 1.5px solid #e0e7ff; border-radius: 12px; padding: 1rem;
    display: flex; flex-direction: column; gap: 0.5rem;
}
.source-gallery-item h4 {
    margin: 0; font-size: 0.9rem; color: #1e1b4b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.source-gallery-item audio, .source-gallery-item video {
    width: 100%; border-radius: 8px; outline: none;
}
.source-gallery-item .source-text-preview {
    font-size: 0.85rem; color: #4b5563; background: #fff; border: 1px solid #e0e7ff;
    padding: 0.5rem; border-radius: 8px; max-height: 100px; overflow-y: auto; white-space: pre-wrap;
}

/* Limit reached text input */
.text-input-limit-reached {
    color: #ef4444 !important;
    font-weight: 600;
}
.text-input-limit-border {
    border-color: #ef4444 !important;
}/* ── Premium Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ── Lenis Smooth Scroll Support ──────────────────────────────────── */
html.lenis, html.lenis body { 
    height: auto; 
    overscroll-behavior: none !important; 
}
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-scrolling iframe { pointer-events: none; }

/* ── Word Counter ─────────────────────────────────────────────────── */
.modal-body { padding-bottom: 1.5rem !important; }
#noteTextInput { 
    margin-bottom: 0.5rem;
    border: 2px solid rgba(102, 126, 234, 0.3) !important;
    background: rgba(0,0,0,0.2) !important;
    color: #fff !important;
}
.word-count-chip {
    display: inline-flex;
    align-self: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(102, 126, 234, 0.9);
    background: rgba(102, 126, 234, 0.1);
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.word-count-chip.text-input-limit-reached {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}
.text-input-limit-border { border-color: #ef4444 !important; }

/* ── iPhone Smooth Scroll Fix ────────────────────────────────────── */
@media (max-width: 1024px) {
    html.lenis-active body {
        /* Prevent Safari native momentum from fighting Lenis */
        -webkit-overflow-scrolling: auto !important;
        overscroll-behavior-y: none !important;
        touch-action: pan-y;
    }
}

/* ══════════════════════════════════════════════════════════════════
   Notely AI — Premium Overlay CSS  v3
   Loaded after styles.css. Scoped carefully to avoid breaking UI.
   ══════════════════════════════════════════════════════════════════ */

/* ── Fonts ──────────────────────────────────────────────────────── */
body { font-family: 'Inter', 'SF Pro Display', system-ui, sans-serif !important; }

/* ── Animated background canvas ─────────────────────────────────── */
#bgCanvas, #startupCanvas { 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    z-index: -2 !important; /* Layers in front of html background, behind pages */
    pointer-events: none; 
    transition: filter 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Beautiful background particle blur during active navigation/card transitions */
body.is-navigating #bgCanvas,
body.is-navigating #startupCanvas {
    filter: blur(5px) !important;
}

/* ── Top nav bar — Completely Removed visually in favor of standalone floating buttons ─────────────────── */
#topNav, .top-nav {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 0 !important;
    min-height: 0 !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 6000 !important;
    pointer-events: none !important;
}

.top-nav-inner {
    display: contents !important;
}

.top-nav .nav-btn,
.top-nav .home-btn-container {
    pointer-events: auto !important;
}

/* ── Nav buttons ─────────────────────────────────────────────────── */
.nav-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.4rem; padding: 0.5rem 1.1rem;
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 50px; color: #ffffff !important;
    font-size: 0.88rem; font-weight: 700; font-family: inherit;
    cursor: pointer; white-space: nowrap; line-height: 1;
    height: 44px !important; box-sizing: border-box;
    outline: none !important; -webkit-tap-highlight-color: transparent !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    position: relative; overflow: hidden;
    backdrop-filter: blur(12px) !important; -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 
                inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
    transform: translateY(-1px) !important;
}
.nav-btn:active {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    transform: scale(0.96) !important;
}
.nav-btn i { font-size: 0.88rem; line-height: 1; }

/* Standing alone — perfectly fixed away from the edges at all screen sizes */
.history-btn { 
    position: fixed !important;
    top: max(1.2rem, env(safe-area-inset-top) + 0.4rem) !important;
    left: 1.5rem !important;
    z-index: 6000 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease !important;
}
.history-btn.visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ── Floating Nav Flip Container ───────────────────────────────────────── */
.nav-flip-container {
    perspective: 1000px;
    position: relative;
    display: inline-block;
}
.nav-flip-card {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-flip-card.flipped {
    transform: rotateY(180deg);
}
.nav-flip-front, .nav-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.nav-flip-back {
    transform: rotateY(180deg);
}
.nav-flip-front:hover {
    transform: rotateY(0deg) translateY(-1px) !important;
}
.nav-flip-front:active {
    transform: rotateY(0deg) scale(0.96) !important;
}
.nav-flip-back:hover {
    transform: rotateY(180deg) translateY(-1px) !important;
}
.nav-flip-back:active {
    transform: rotateY(180deg) scale(0.96) !important;
}

/* iOS WebKit 3D touch hit-testing bug bypass */
.nav-flip-card:not(.flipped) .nav-flip-front {
    pointer-events: auto !important;
    visibility: visible !important;
}
.nav-flip-card:not(.flipped) .nav-flip-back {
    pointer-events: none !important;
    visibility: hidden !important;
}
.nav-flip-card.flipped .nav-flip-front {
    pointer-events: none !important;
    visibility: hidden !important;
}
.nav-flip-card.flipped .nav-flip-back {
    pointer-events: auto !important;
    visibility: visible !important;
}
.home-btn-container {
    position: fixed !important;
    top: max(1.2rem, env(safe-area-inset-top) + 0.4rem) !important;
    right: 1.5rem !important;
    z-index: 6000 !important;
    opacity: 0; pointer-events: none; transform: scale(0.82) translateY(4px);
    transition: opacity 0.3s cubic-bezier(0.34,1.56,0.64,1), transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    width: 44px !important; height: 44px !important; padding: 0 !important;
    border-radius: 50% !important; /* Perfect bubble shape */
}
.home-btn-container i { font-size: 1.35rem !important; }
.home-btn-container.visible { opacity: 1; pointer-events: auto; transform: scale(1) translateY(0); }



/* Kill old floating btns */
.floating-btn { display: none !important; }

/* ── Main content top padding ────────────────────────────────────── */
.main-content {
    position: relative;
    z-index: auto !important;
    padding-top: max(3.5rem, calc(2.8rem + env(safe-area-inset-top))) !important;
}

/* Removed global main-content blur to let translucent elements blur particles behind them on all viewports */

/* ══════════════════════════════════════════════════════════════════
   HOME PAGE
   ══════════════════════════════════════════════════════════════════ */

#homePage .hub-hero { margin-bottom: 1.25rem !important; padding: 0 0.25rem !important; }
#homePage .hub-hero h1 {
    display: inline-block !important; /* Ensure width matches text content for animation scaling */
    font-size: clamp(2.6rem, 9vw, 4.8rem) !important;
    font-weight: 800 !important; color: #fff !important;
    letter-spacing: -0.04em !important; line-height: 1.05 !important;
    margin: 0 0 0.5rem !important;
    opacity: 0; /* Hidden initially for cinematic hand-off */
}
/* "AI" — purple→pink gradient */
#homePage .hub-hero h1 span {
    background: linear-gradient(135deg, #c084fc 0%, #f472b6 100%) !important;
    -webkit-background-clip: text !important; background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    font-weight: 900 !important;
    margin-left: 0.4rem !important;
    filter: drop-shadow(0 0 15px rgba(244, 114, 182, 0.6)) !important;
}
#homePage .hub-hero p { 
    color: rgba(255,255,255,0.65) !important; 
    font-size: 1.05rem !important; 
    font-weight: 400 !important; 
    margin: 0 !important;
    opacity: 0; /* Hidden for build-up animation */
}

/* Hub cards — dark frosted glass */
#homePage .hub-card {
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.14) !important;
    backdrop-filter: blur(8px) !important; -webkit-backdrop-filter: blur(8px) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.09) !important;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
    -webkit-tap-highlight-color: transparent;
    opacity: 0; 
}

@media (hover: hover) {
    #homePage .hub-card:hover { 
        transform: translateY(-8px) !important; 
        box-shadow: 0 28px 56px rgba(0,0,0,0.3) !important; 
        border-color: rgba(255,255,255,0.26) !important; 
    }
}

/* Mobile hub cards are translucent, matching desktop styling */
#homePage .hub-text h3 { color: #fff !important; }
#homePage .hub-text p  { color: rgba(255,255,255,0.62) !important; }
#homePage .hub-footer         { color: #00f2ff !important; font-weight: 800 !important; }
#homePage .study-card .hub-footer { color: #f472b6 !important; font-weight: 800 !important; }
#homePage .quiz-card  .hub-footer { color: #34d399 !important; font-weight: 800 !important; }
#homePage .guide-card .hub-footer { color: #e11d48 !important; font-weight: 800 !important; text-transform: none !important; letter-spacing: 0.2px; }

#homePage .hub-text h3 { color: #fff !important; font-weight: 800 !important; font-size: 1.8rem !important; letter-spacing: -0.02em; }
#homePage .guide-card h3 { color: #ffffff !important; font-weight: 800 !important; font-size: 1.8rem !important; opacity: 1 !important; visibility: visible !important; }


/* Transition State for Hub Cards */
body.is-navigating .top-nav,
body.is-navigating .hub-hero,
body.is-navigating .hub-card:not(.is-active-transition),
body.is-navigating .page:not(#homePage) {
    filter: blur(5px);
    opacity: 0.35;
    transform: scale(0.96);
    pointer-events: none;
    transition: filter 0.7s ease, opacity 0.7s ease, transform 0.7s ease !important;
}

#homePage .hub-card.is-active-transition,
#homePage .hub-card.is-active-transition:hover {
    z-index: 9999 !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35) !important;
    transform: scale(1.02) !important;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Color Overrides for Header Entrance */
#notesPage.active .page-header      { --header-glow: rgba(0, 242, 255, 0.4); }
#flashcardsPage.active .page-header { --header-glow: rgba(244, 114, 182, 0.4); }
#quizPage.active .page-header       { --header-glow: rgba(52, 211, 153, 0.4); }
#cheatSheetPage.active .page-header { --header-glow: rgba(225, 29, 72, 0.4); }

.page.active .page-header {
    animation: headerGlowEntrance 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
}

@keyframes headerGlowEntrance {
    0% { 
        box-shadow: 0 4px 24px rgba(0,0,0,0.2);
        border-color: rgba(255,255,255,0.14);
        transform: translateY(10px) scale(0.99);
    }
    30% {
        box-shadow: 0 0 50px var(--header-glow, rgba(102, 126, 234, 0.3)), 0 10px 30px rgba(0,0,0,0.3);
        border-color: var(--header-glow, rgba(102, 126, 234, 0.4));
    }
    100% { 
        box-shadow: 0 4px 24px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.09);
        border-color: rgba(255,255,255,0.14);
        transform: translateY(0) scale(1);
    }
}

/* Icon pulse disabled for cleaner feel */
.hub-card.is-active-transition .hub-icon {
    transform: scale(1.1);
}

/* ── INNER PAGES — dark glass theme ───────────────────────────────── */

.page-header, .audio-section, .notes-output, .daily-usage-container,
.flashcard-controls, .flashcard-container, .quiz-setup, .quiz-container,
.sources-output, .text-panel, .progress-card, .top-nav, .glass-icon-wrapper {
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.14) !important;
    backdrop-filter: blur(8px) !important; -webkit-backdrop-filter: blur(8px) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.09) !important;
    color: #f0f0ff !important;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
}

/* Text visibility inside cards */
.page-header p, .notes-overview p, .notes-section-body p, .notes-transcript-body p, .usage-info span, .source-item-info h4 {
    color: rgba(255,255,255,0.7) !important;
}
.notes-overview, .notes-section-card, .notes-transcript-wrap, .flashcard, .quiz-question, .quiz-option, .source-gallery-item, .history-item {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.notes-section-body {
    background: rgba(255, 255, 255, 0.02) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #f0f0ff !important;
}
.notes-source {
    background: rgba(255, 255, 255, 0.06) !important;
    border-left: 3.5px solid var(--theme-accent, #00f2ff) !important;
    color: #fff !important;
}
.notes-section-header, .notes-transcript-toggle, .notes-overview-label, .notes-section-title {
    color: #fff !important;
    background: transparent !important;
}

.page-header h2, .notes-output-header h3, .sources-output h3 { 
    -webkit-text-fill-color: initial !important;
    background: transparent !important;
}

.source-btn { 
    background: transparent !important; 
    border: none !important;
    box-shadow: none !important;
    flex: 1 1 120px !important;
    min-height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0.5rem !important;
    cursor: pointer !important;
    position: relative !important;
    overflow: visible !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
@media (hover: hover) {
    .source-btn:hover { 
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        transform: translateY(-2px) !important;
    }
    .source-btn:active {
        transform: translateY(0) scale(1) !important;
    }
}
.source-btn:focus-visible {
    outline: none !important;
}
.source-btn:focus-visible .glass-icon-wrapper {
    box-shadow: 0 0 0 3px var(--theme-accent, #00f2ff),
                0 12px 28px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.25) !important;
}
.source-btn.is-pressed {
    background: rgba(255, 255, 255, 0.04) !important;
}
.source-btn.is-pressed .glass-icon-wrapper {
    transform: none !important;
    filter: brightness(1.2);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
}
/* .is-pressed shrink removed — no scale/clip on tap */
.source-btn span { 
    color: rgba(255,255,255,0.85) !important; 
    margin-top: 0.75rem !important; 
    font-size: 0.85rem !important; 
    font-weight: 700 !important;
    text-align: center !important;
}
.source-btn i { font-size: 1.8rem !important; margin-bottom: 0 !important; }

/* ── Premium Glass Icons ────────────────────────────────────────── */
.glass-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px !important;
    height: 72px !important;
    flex-shrink: 0 !important;
    aspect-ratio: 1 / 1 !important;
    margin-bottom: 0.2rem;
    border-radius: 14px !important; /* Exquisite, square-like glass tiles */
    /* Frosted glass base with a subtle tint of the theme accent */
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02)),
                rgba(var(--theme-accent-rgb, 255, 255, 255), 0.03) !important;
    /* Glass borders - double border effect using box-shadow for depth */
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.2),
                inset 0 -1px 0 rgba(0, 0, 0, 0.2),
                inset 0 0 12px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.1) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow: visible !important;
}

/* Glass shine overlay reflection */
.glass-icon-wrapper::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%) !important;
    pointer-events: none;
    border-radius: 14px 14px 0 0 !important;
}

.premium-glass-icon {
    font-size: 1.85rem !important;
    color: var(--theme-accent, #00f2ff) !important;
    /* Rich, glowing drop shadows to simulate liquid glow glass refraction */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25))
            drop-shadow(0 0 10px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.75)) !important;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: block !important;
    line-height: 1 !important;
    margin: 0 !important;
}

@media (hover: hover) {
    .source-btn:hover .glass-icon-wrapper {
        background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05)),
                    rgba(var(--theme-accent-rgb, 255, 255, 255), 0.08) !important;
        border-color: var(--theme-accent, #00f2ff) !important;
        transform: scale(1.08) !important;
        box-shadow: 0 12px 28px rgba(0, 242, 255, 0.2),
                    0 0 20px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.25),
                    inset 0 1px 0 rgba(255, 255, 255, 0.3),
                    inset 0 0 15px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.2) !important;
    }

    .source-btn:hover .premium-glass-icon {
        color: #ffffff !important;
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35))
                drop-shadow(0 0 18px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.95)) !important;
        transform: scale(1.05) !important;
        display: block !important;
        line-height: 1 !important;
        margin: 0 !important;
    }
}


/* Force hide buttons even with !important from other rules */
.hidden-btn { display: none !important; }

/* ── Notes section spacing ───────────────────────────────────────── */
.notes-content { display: flex; flex-direction: column; gap: 0.75rem !important; }
.notes-sections { display: flex; flex-direction: column; gap: 0.65rem !important; }
.notes-section-card {
    border-radius: 14px !important;
    transition: box-shadow 0.25s, border-color 0.25s !important;
}
.notes-section-card + .notes-section-card { margin-top: 0 !important; }

/* ── TOAST MESSAGES — stackable ───────────────────────────────────── */
#messageStack {
    position: fixed !important;
    bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90%;
    max-width: 400px;
    z-index: 9999999 !important;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.message {
    position: relative !important;
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    border-radius: 14px; 
    width: 100%;
    font-family: 'Inter', system-ui, sans-serif !important;
    font-weight: 500; font-size: 0.85rem;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.1);
    /* Animation state */
    opacity: 0; transform: translateY(10px) scale(0.98);
    transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    max-height: 120px;
    margin: 0;
    cursor: grab; user-select: none;
    pointer-events: auto;
    overflow: hidden;
}

.message.dismissing {
    opacity: 0 !important;
    transform: scale(0.94) !important;
    max-height: 0 !important;
    margin-top: -0.2rem !important;
    margin-bottom: -0.2rem !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    pointer-events: none !important;
}
.message.success { background: rgba(209,250,229,0.97); color: #065f46; border: 1px solid rgba(167,243,208,0.7); }
.message.error   { background: rgba(254,226,226,0.97); color: #991b1b; border: 1px solid rgba(254,202,202,0.7); }
.message.info    { background: rgba(237,233,254,0.97); color: #4c1d95; border: 1px solid rgba(196,181,253,0.7); }
.message.warning { background: rgba(255,251,235,0.97); color: #78350f; border: 1px solid rgba(253,230,138,0.7); }

.msg-icon { font-size: 1rem; flex-shrink: 0; }
.msg-text { flex: 1; line-height: 1.4; }
.msg-close {
    background: none; border: none; padding: 0.25rem;
    cursor: pointer; color: inherit; opacity: 0.5;
    font-size: 0.85rem; border-radius: 6px;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0; line-height: 1;
}
.msg-close:hover { opacity: 1; background: rgba(0,0,0,0.08); }

@media (max-width: 768px) {
    #messageStack { 
        bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important; 
        left: 50% !important;
        width: 94% !important; 
        max-width: 440px !important; 
    }
}

/* ══════════════════════════════════════════════════════════════════
   RIPPLE
   ══════════════════════════════════════════════════════════════════ */
.ripple {
    position: absolute; border-radius: 50%; pointer-events: none; z-index: 0;
    background: rgba(255,255,255,0.28);
    animation: rippleAnim 0.62s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes rippleAnim { from { transform: scale(0); opacity: 1; } to { transform: scale(1); opacity: 0; } }

/* ══════════════════════════════════════════════════════════════════
   SIDEBAR — dark glass
   ══════════════════════════════════════════════════════════════════ */
.sidebar { 
    background: rgba(12, 8, 28, 0.78) !important; 
    backdrop-filter: blur(16px) !important; 
    -webkit-backdrop-filter: blur(16px) !important; 
    border-right: 1px solid rgba(255, 255, 255, 0.09) !important; 
    display: flex; 
    flex-direction: column; 
}
.sidebar-header { 
    display: flex; flex-direction: column; gap: 1rem; 
    padding: 1.5rem; 
    padding-top: max(1.2rem, env(safe-area-inset-top));
    border-bottom: 1px solid rgba(255,255,255,0.07) !important; 
}
.sidebar-header-top { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.sidebar-header-top h3 { color: #fff; font-size: 1.2rem; font-weight: 700; margin: 0; }
#closeSidebarBtn { background: none; border: none; font-size: 1.5rem; color: rgba(255,255,255,0.5) !important; cursor: pointer; padding: 5px; line-height: 1; transition: color 0.2s; }
#closeSidebarBtn:hover { color: #fff !important; }

#historySearch { 
    width: 100%; padding: 0.65rem 0.8rem; 
    border: 1px solid rgba(255,255,255,0.13) !important; 
    border-radius: 12px; font-size: 0.95rem; 
    background: rgba(255,255,255,0.07) !important; color: #fff !important; 
    outline: none; transition: border-color 0.2s, background 0.2s;
}
#historySearch:focus { border-color: rgba(255,255,255,0.3) !important; background: rgba(255,255,255,0.1) !important; }
#historySearch::placeholder { color: rgba(255,255,255,0.3) !important; }

.sidebar-content { padding: 1rem; flex: 1; overflow-y: auto; }

.history-item { 
    background: rgba(255, 255, 255, 0.06) !important; 
    border: 1px solid rgba(255, 255, 255, 0.15) !important; 
    border-radius: 16px !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.15),
                inset 0 0 8px rgba(255, 255, 255, 0.05) !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    margin-bottom: 0.75rem !important;
    padding: 1.1rem !important;
}
.history-item:hover { 
    background: rgba(255, 255, 255, 0.12) !important; 
    border-color: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3),
                0 0 12px rgba(255, 255, 255, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}
.history-item-body h4 { color: #f0f0ff !important; }
.history-item-meta, .history-item-body .date { color: rgba(255, 255, 255, 0.38) !important; }



/* ── MOBILE ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    #homePage .hub-hero h1 { font-size: 2.4rem !important; }
    #homePage .hub-grid { grid-template-columns: 1fr !important; gap: 0.85rem !important; }
    .notes-section-card { border-radius: 12px !important; }
}

/* ── PLAYFUL ANIMATIONS ───────────────────────────────────────────── */

.progress-overlay .progress-card {
    animation: pulsePlayful 2s infinite cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@keyframes pulsePlayful {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.primary-btn, .secondary-btn {
    transition: transform 0.3s cubic-bezier(0.16,1,0.3,1), background 0.3s, box-shadow 0.3s !important;
}

.primary-btn:hover, .secondary-btn:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15) !important;
}

.primary-btn:active, .secondary-btn:active {
    transform: translateY(0) scale(1) !important; /* Disabled shrinking for small buttons to avoid scroll confusion */
    transition-duration: 0.1s !important;
}

/* ── MODALS AND TEXT INPUTS — dark glass ──────────────────────────── */
#textInputPanel {
    align-items: center !important;
    justify-content: center !important;
    padding: 1.5rem !important;
}

.modal-card, .text-panel, .trim-panel, .progress-card {
    background: rgba(15, 12, 35, 0.92) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    backdrop-filter: blur(20px) !important; -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.12) !important;
    color: #f0f0ff !important;
    animation: modal-float 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-float {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-footer {
    background: rgba(255, 255, 255, 0.03) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.modal-header h3 {
    color: #fff !important;
}
.trim-row label {
    color: rgba(255, 255, 255, 0.85) !important;
}
.trim-duration {
    color: rgba(255, 255, 255, 0.6) !important;
}
.rename-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    border-radius: 12px !important;
}
.rename-input::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}
.rename-input:focus {
    border-color: rgba(255, 255, 255, 0.3) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.source-item, .source-gallery-item {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

.source-text-preview {
    background: rgba(0, 0, 0, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.8) !important;
}

@media (hover: hover) {
    .hub-card.magnetic-active { 
        transform: translateY(-2px) scale(1.02) !important; 
        border-color: rgba(251, 191, 36, 0.4) !important;
        box-shadow: 0 0 30px rgba(251, 191, 36, 0.15) !important;
    }
}

.modal-header { border-bottom-color: rgba(255, 255, 255, 0.08) !important; }
.modal-close { color: rgba(255, 255, 255, 0.4) !important; }
.modal-close:hover { color: #fff !important; }

.modal-header h3, .text-panel h3 { color: #f0f0ff !important; }

.modal-body input[type="text"], textarea {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

.modal-body input[type="text"]::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

.word-count-chip {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #f0f0ff !important;
}

.history-item:hover {
    transform: scale(1.02);
}

/* ── Interactive Aurora & Cinematic Effects ────────────────────── */
#auroraCursor {
    position: fixed;
    top: 0; left: 0;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    /* Spectacular prominent golden glassmorphic ambient glow */
    background: radial-gradient(circle, 
        rgba(255, 215, 0, 0.35) 0%, 
        rgba(243, 156, 18, 0.20) 30%, 
        rgba(212, 175, 55, 0.08) 60%, 
        rgba(0, 0, 0, 0) 80%) !important;
    pointer-events: none;
    z-index: -1 !important; /* Layers behind main content (auto) and in front of canvases */
    opacity: 0;
    mix-blend-mode: screen;
    filter: blur(80px) !important; /* Soft, edge-free liquid glow */
    will-change: transform, opacity;
}

/* Hide interactive aurora spotlight on phone & adjust mobile styling */
@media (max-width: 768px) {
    #auroraCursor {
        display: none !important;
    }

    /* Consistent high-quality backdrop blur on ALL mobile translucent elements */
    .page-header, .audio-section, .notes-output, .daily-usage-container,
    .flashcard-controls, .flashcard-container, .quiz-setup, .quiz-container,
    .sources-output, #homePage .hub-card, .history-item, .trim-panel, 
    .modal-card, .text-panel, .progress-card, .top-nav, .glass-icon-wrapper, .sidebar {
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        backface-visibility: hidden; -webkit-backface-visibility: hidden;
    }

    /* Apply slight blur to background particles when navigating on mobile */
    body.is-navigating #bgCanvas,
    body.is-navigating #startupCanvas {
        filter: blur(5px) !important;
    }

    /* Floating navigation buttons positioning away from mobile borders */
    .history-btn {
        left: 1.25rem !important;
        top: max(1.2rem, env(safe-area-inset-top) + 0.3rem) !important;
    }
    .home-btn-container {
        right: 1.25rem !important;
        top: max(1.2rem, env(safe-area-inset-top) + 0.3rem) !important;
    }

    /* Expand & perfectly center glass source icons on mobile screens */
    .glass-icon-wrapper {
        width: 80px !important;
        height: 80px !important;
        flex-shrink: 0 !important;
        aspect-ratio: 1 / 1 !important;
        border-radius: 14px !important; /* Exquisite, square-like glass tiles on mobile too! */
        margin-bottom: 0.5rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: visible !important;
    }
    .glass-icon-wrapper::after {
        border-radius: 14px 14px 0 0 !important;
    }
    .source-btn i, .premium-glass-icon {
        font-size: 1.75rem !important;
        line-height: 1 !important;
        margin: 0 !important;
        display: block !important;
    }
}

/* Cinematic Startup Overlay - The 3D Wave */
#startupOverlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: transparent; /* Show the background orbs from bgCanvas immediately */
    z-index: 20000;
    display: flex; align-items: center; justify-content: center;
}
#startupCanvas {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    transition: filter 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ==========================================================================
   PREMIUM GLASSMORPHISM & DARK THEME UX POLISH OVERRIDES
   ========================================================================== */

/* 1. Global Translucent Blur & Transparency Recalibration (5% / 5px blur, 0.04 background transparency) */
.modal-card, .text-panel, .trim-panel, .progress-card, .sidebar, .glass-icon-wrapper,
.page-header, .audio-section, .notes-output, .daily-usage-container,
.flashcard-controls, .flashcard-container, .quiz-setup, .quiz-container,
.sources-output, #homePage .hub-card, .notes-overview, .notes-section-card, 
.notes-transcript-wrap, .flashcard, .quiz-question, .quiz-option, .source-gallery-item, 
.history-item, .nav-btn, .primary-btn {
    background: rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
}

/* 2. Text Input Panel Textarea (High-End Dark Frosted Glass) */
#noteTextInput {
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    border-radius: 14px !important;
    padding: 1.25rem !important;
    font-family: inherit !important;
    font-size: 0.95rem !important;
    line-height: 1.75 !important;
    outline: none !important;
    box-sizing: border-box !important;
    transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease !important;
}
#noteTextInput:focus {
    border-color: var(--theme-accent, #00f2ff) !important;
    background: rgba(0, 0, 0, 0.55) !important;
    box-shadow: 0 0 15px rgba(var(--theme-accent-rgb, 0, 242, 255), 0.15) !important;
}
#noteTextInput::placeholder {
    color: rgba(255, 255, 255, 0.35) !important;
}

/* 3. Glowing Translucent Dark Theme Recording Status Bar */
.recording-active {
    display: flex;
    align-items: center !important;
    gap: 1rem !important;
    background: rgba(239, 68, 68, 0.08) !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    border-radius: 16px !important;
    padding: 1.1rem 1.4rem !important;
    margin-bottom: 2rem !important;
    color: #f87171 !important;
    font-weight: 700 !important;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.12), inset 0 0 12px rgba(239, 68, 68, 0.05) !important;
}
.recording-indicator {
    width: 12px !important;
    height: 12px !important;
    background: #ef4444 !important;
    border-radius: 50% !important;
    box-shadow: 0 0 12px #ef4444, 0 0 20px #ef4444 !important;
    animation: blink 1s infinite !important;
}
.stop-btn {
    margin-left: auto !important;
    background: #ef4444 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 0.6rem 1.2rem !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    transition: background-color 0.25s, transform 0.2s, box-shadow 0.25s !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3) !important;
}
.stop-btn:hover {
    background: #dc2626 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4) !important;
}
.stop-btn:active {
    transform: translateY(0) !important;
}

/* 4. Notes Output Frosted-Glass Redesign (Dark Theme) */
.notes-output {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 20px !important;
    padding: 2.2rem !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35) !important;
    color: #f3f4f6 !important;
    margin-bottom: 2.5rem !important;
}
.notes-output-header {
    display: flex; 
    flex-direction: column; 
    gap: 0.5rem; 
    margin-bottom: 2rem;
    padding-bottom: 1.5rem; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.notes-output-header h3 {
    font-size: 0.9rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    color: rgba(255, 255, 255, 0.4) !important;
    margin: 0 !important;
}
.current-note-title {
    font-size: 1.6rem !important; 
    font-weight: 800 !important; 
    color: #ffffff !important;
    line-height: 1.35 !important;
}
.notes-overview {
    background: rgba(255, 255, 255, 0.015) !important;
    border-left: 4px solid var(--theme-accent, #00f2ff) !important;
    border-radius: 0 16px 16px 0 !important;
    padding: 1.5rem 1.75rem !important;
    margin-bottom: 2rem !important;
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.01) !important;
}
.notes-overview-label {
    font-size: 0.82rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: var(--theme-accent, #00f2ff) !important;
    margin-bottom: 0.5rem !important;
    font-weight: 700 !important;
}
.notes-overview p {
    color: rgba(255, 255, 255, 0.75) !important;
    line-height: 1.8 !important;
    font-size: 1rem !important;
    margin: 0 !important;
}
.notes-section-card {
    background: rgba(255, 255, 255, 0.015) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 16px !important;
    overflow: hidden;
    margin-bottom: 1.25rem !important;
    transition: border-color 0.25s, box-shadow 0.25s !important;
}
.notes-section-card:hover {
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
}
.notes-section-header {
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    padding: 1.25rem 1.5rem !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    cursor: pointer !important;
    outline: none !important;
    text-align: left !important;
}
.notes-section-title {
    font-weight: 800 !important; 
    font-size: 1.15rem !important; 
    color: #ffffff !important;
}
.notes-section-bullets {
    padding: 0 1.5rem 1.25rem !important;
}
.notes-section-bullets ul {
    margin: 0 !important;
    padding-left: 1.2rem !important;
}
.notes-section-bullets li {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.95rem !important;
    line-height: 1.7 !important;
    margin-bottom: 0.5rem !important;
}
.notes-section-bullets li::marker {
    color: var(--theme-accent, #00f2ff) !important;
}
.notes-section-body {
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 1.25rem 1.5rem !important;
    background: rgba(0, 0, 0, 0.15) !important;
}
.notes-detail {
    color: rgba(255, 255, 255, 0.72) !important;
    font-size: 0.95rem !important;
    line-height: 1.8 !important;
    margin-bottom: 1.25rem !important;
}
.notes-source {
    margin: 0 !important;
    border-left: 3px solid var(--theme-accent, #00f2ff) !important;
    padding: 0.75rem 1.25rem !important;
    color: var(--theme-accent, #00f2ff) !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-radius: 0 10px 10px 0 !important;
    line-height: 1.7 !important;
    font-size: 0.88rem !important;
    font-style: italic !important;
}
.notes-transcript-wrap {
    margin-top: 2rem !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 16px !important;
    overflow: hidden;
}
.notes-transcript-toggle {
    width: 100% !important;
    background: rgba(255, 255, 255, 0.015) !important;
    border: none !important;
    padding: 1.25rem 1.5rem !important;
    color: rgba(255, 255, 255, 0.6) !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    cursor: pointer !important;
    outline: none !important;
}
.notes-transcript-body {
    background: rgba(0, 0, 0, 0.25) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: rgba(255, 255, 255, 0.65) !important;
    line-height: 1.85 !important;
    font-size: 0.92rem !important;
    border-radius: 0 !important;
    padding: 1.5rem !important;
}

/* 5. Shrink Interactive Aurora Glow by 50% */
#auroraCursor {
    width: 250px !important;  /* Shrunk from 500px to 250px */
    height: 250px !important;
    filter: blur(80px) !important;
    mix-blend-mode: screen !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

/* ── PROFILE SCREEN & PLAN BOXES ───────────────────────────────── */
.profile-reveal {
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem 1.5rem !important;
}

.plan-box {
    flex: 1;
    padding: 1.5rem;
    border-radius: 16px !important;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 2px solid transparent !important;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.plan-box:hover {
    transform: translateY(-2px) scale(1.02);
    background: rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
}

.plan-box.active {
    background: rgba(var(--theme-accent-rgb, 102, 126, 234), 0.1) !important;
    border-color: var(--theme-accent, #667eea) !important;
    box-shadow: 0 8px 30px rgba(var(--theme-accent-rgb, 102, 126, 234), 0.25) !important;
}

.plan-box h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    transition: color 0.3s;
}

.plan-box.active h4 {
    color: #fff !important;
}

.toggle-switch {
    width: 52px;
    height: 28px;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toggle-knob {
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Plan Button Customizations */
#planBasic {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px dashed rgba(255, 255, 255, 0.2) !important;
    box-shadow: none !important;
    border-radius: 12px !important;
    color: rgba(255, 255, 255, 0.5) !important;
}
#planBasic.active {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    color: #fff !important;
}
#planBasic h4 {
    color: inherit !important;
    font-weight: 500 !important;
}

#planPremium {
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.08) 0%, rgba(244, 114, 182, 0.08) 50%, rgba(0, 242, 255, 0.04) 100%) !important;
    border: 1.5px solid rgba(192, 132, 252, 0.25) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
#planPremium::before {
    content: '★ RECOMMENDED';
    position: absolute;
    top: 0; right: 0;
    background: linear-gradient(90deg, #c084fc, #f472b6);
    color: #ffffff;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 0.25rem 0.6rem;
    border-bottom-left-radius: 10px;
    letter-spacing: 0.08em;
    box-shadow: 0 2px 8px rgba(244, 114, 182, 0.3);
}
#planPremium.active {
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.18) 0%, rgba(244, 114, 182, 0.18) 50%, rgba(0, 242, 255, 0.1) 100%) !important;
    border-color: #f472b6 !important;
    box-shadow: 0 0 35px rgba(192, 132, 252, 0.4), 0 0 15px rgba(244, 114, 182, 0.3) !important;
    transform: scale(1.03) translateY(-2px);
}
#planPremium.active h4 {
    color: #fff !important;
    text-shadow: 0 0 12px rgba(244, 114, 182, 0.8), 0 0 4px rgba(192, 132, 252, 0.5) !important;
    font-weight: 800 !important;
}


