/* --- Custom Cursor Global Suppression --- */
@media (pointer: fine) {
    body.cursor-active, 
    body.cursor-active *, 
    body.cursor-active *::before, 
    body.cursor-active *::after {
        cursor: none !important;
    }

    /* Force hide on special elements and custom scrollbars */
    body.cursor-active iframe, 
    body.cursor-active video, 
    body.cursor-active canvas, 
    body.cursor-active input, 
    body.cursor-active select, 
    body.cursor-active textarea, 
    body.cursor-active button, 
    body.cursor-active .custom-scrollbar {
        cursor: none !important;
    }

    /* Hide on scrollbars for Webkit browsers */
    body.cursor-active ::-webkit-scrollbar,
    body.cursor-active ::-webkit-scrollbar-thumb,
    body.cursor-active ::-webkit-scrollbar-track,
    body.cursor-active ::-webkit-scrollbar-corner {
        cursor: none !important;
    }
}

/* --- Global Styles --- */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.info { border-left-color: var(--primary); }
.toast.warning { border-left-color: #f59e0b; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.hide {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(20%) scale(0.95); filter: blur(5px); }
}

.note-checkbox {
    width: 1.1rem;
    height: 1.1rem;
    margin-right: 0.5rem;
    vertical-align: middle;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Strike through and dim checked items in list */
.markdown-body li:has(input[type="checkbox"]:checked),
.prose li:has(input[type="checkbox"]:checked) {
    text-decoration: line-through;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.prose input[type="checkbox"]:checked + label, 
.prose input[type="checkbox"]:checked ~ span {
    text-decoration: line-through;
    opacity: 0.5;
}



/* Pin Animation */
@keyframes pinBounce {
    0%, 100% { transform: translateY(0) rotate(45deg); }
    50% { transform: translateY(-5px) rotate(45deg); }
}
.pinned-icon {
    animation: pinBounce 2s infinite ease-in-out;
}
:root[data-theme="midnight"] {
    --primary: #06b6d4;
    --secondary: #8b5cf6;
    --bg-dark: #0f172a;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

:root[data-theme="cyberpunk"] {
    --primary: #ff00ff;
    --secondary: #ffff00;
    --bg-dark: #000505;
    --glass: rgba(255, 0, 255, 0.05);
    --glass-border: rgba(255, 0, 255, 0.2);
}

:root[data-theme="minimalist"] {
    --primary: #2563eb;
    --secondary: #334155;
    --bg-dark: #ffffff;
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: #cbd5e1;
}

[data-theme="minimalist"] body {
    color: #0f172a;
    background-color: #f8fafc;
}

/* Immersive Editor Theme Overrides */
.immersive-modal { background-color: var(--bg-dark) !important; }
.theme-bg-primary { background-color: var(--bg-dark); }

[data-theme="minimalist"] .immersive-modal,
[data-theme="minimalist"] .theme-bg-primary {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

[data-theme="minimalist"] #editNoteText {
    color: #0f172a !important;
}

[data-theme="minimalist"] .immersive-modal .glass {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="minimalist"] .immersive-modal .bg-black\/20,
[data-theme="minimalist"] .immersive-modal .bg-black\/10 {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

[data-theme="minimalist"] .immersive-modal .border-white\/10,
[data-theme="minimalist"] .immersive-modal .border-white\/5,
[data-theme="minimalist"] .immersive-modal .border-r {
    border-color: #e2e8f0 !important;
}

[data-theme="minimalist"] .immersive-toolbar {
    background-color: #f1f5f9 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="minimalist"] .immersive-modal .text-gray-400,
[data-theme="minimalist"] .immersive-modal .text-gray-500 {
    color: #64748b !important;
}

[data-theme="minimalist"] .glass {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

[data-theme="minimalist"] .user-msg {
    background: #2563eb;
    color: #ffffff;
}

[data-theme="minimalist"] .ai-msg {
    background: #f1f5f9;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

[data-theme="minimalist"] .markdown-body,
[data-theme="minimalist"] .markdown-body p,
[data-theme="minimalist"] .markdown-body li {
    color: #0f172a !important;
}

[data-theme="minimalist"] .markdown-body code {
    background-color: rgba(0, 0, 0, 0.06) !important;
    color: #c026d3 !important; /* Visible purple for inline code in light mode */
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="minimalist"] .markdown-body pre {
    background-color: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
}

[data-theme="minimalist"] .markdown-body pre code {
    color: #0f172a !important;
    background-color: transparent !important;
    border: none !important;
}

[data-theme="minimalist"] #playPauseBtn,
[data-theme="minimalist"] .music-card button i,
[data-theme="minimalist"] .music-card i {
    color: #0f172a !important;
}

/* Fix visibility for Music Player overlay buttons (Video Mode/Full Screen) in Minimalist theme */
[data-theme="minimalist"] .music-card .absolute.top-4.right-4.z-30 button,
[data-theme="minimalist"] .music-card .absolute.top-4.right-4.z-30 button i {
    color: #ffffff !important;
}

[data-theme="minimalist"] #trackName {
    color: #0f172a;
}

/* Contrast overrides for Tailwind gray classes in light mode */
[data-theme="minimalist"] .text-gray-300 { color: #475569 !important; }
[data-theme="minimalist"] .text-gray-400 { color: #64748b !important; }
[data-theme="minimalist"] .text-gray-500 { color: #475569 !important; }
[data-theme="minimalist"] .text-gray-600 { color: #334155 !important; }
[data-theme="minimalist"] .bg-gray-800 { background-color: #f1f5f9 !important; color: #0f172a !important; }
[data-theme="minimalist"] .bg-gray-900 { background-color: #f8fafc !important; color: #0f172a !important; }
[data-theme="minimalist"] h3.text-sm.font-bold.truncate.pr-16 { color: #0f172a !important; }
/* Fix theme preview buttons in Dashboard for Minimalist mode */
[data-theme="minimalist"] .bg-slate-900 { background-color: #0f172a !important; color: #ffffff !important; }
[data-theme="minimalist"] .bg-black { background-color: #000000 !important; }
[data-theme="minimalist"] input, [data-theme="minimalist"] textarea, [data-theme="minimalist"] select {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

/* Header branding and visibility fixes */
[data-theme="minimalist"] .text-white { color: #0f172a !important; }
[data-theme="minimalist"] .bg-white\/5 { background-color: rgba(0, 0, 0, 0.05) !important; }
[data-theme="minimalist"] .border-white\/10 { border-color: rgba(0, 0, 0, 0.1) !important; }

/* Custom Cursor Minimalist visibility */
[data-theme="minimalist"] .custom-cursor {
    mix-blend-mode: normal;
    background: radial-gradient(circle, var(--primary) 0%, transparent 85%);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
}

:root {
    --primary: #06b6d4;
    --secondary: #8b5cf6;
    --bg-dark: #0f172a;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: #f8fafc;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Hide custom cursor on mobile/touch devices */
@media (pointer: coarse) {
    .custom-cursor {
        display: none !important;
    }
    *, *::before, *::after, html, body {
        cursor: auto !important;
    }
}

.custom-cursor {
    width: 18px;
    height: 18px;
    background: transparent;
    border: 1.5px solid var(--primary);
    border-radius: 50%;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 99999;
    /* transition: Position handled by JS, Scale/Colors handled here */
    transition: width 0.2s ease, 
                height 0.2s ease, 
                background 0.2s, 
                border-color 0.2s, 
                opacity 0.15s ease, 
                transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
    transform: translate(-50%, -50%) scale(1);
    mix-blend-mode: screen;
    will-change: transform, top, left;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

/* Precision Center Dot */
.custom-cursor::after {
    content: '';
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px #fff;
    transition: all 0.2s ease;
}

.custom-cursor.active {
    width: 40px;
    height: 40px;
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--secondary);
    box-shadow: 0 0 20px var(--secondary);
}

.custom-cursor.active::after {
    width: 5px;
    height: 5px;
    background: var(--secondary);
}

.custom-cursor.clicking {
    transform: translate(-50%, -50%) scale(0.7);
}

/* I-Beam Precision for text inputs */
.custom-cursor.text-mode {
    width: 8px;
    height: 22px;
    border-radius: 1px;
    background: transparent;
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    border-left: none;
    border-right: none;
    box-shadow: none;
}

.custom-cursor.text-mode::after {
    content: '';
    display: block;
    width: 2px;
    height: 100%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- Fix Scrollbar Visibility --- */
.custom-scrollbar {
    scrollbar-width: thin;
    /* Cyan for thumb, transparent for track */
    scrollbar-color: var(--primary) rgba(255, 255, 255, 0.05);
}

/* Chrome, Edge, Safari scrollbar visible adjustments */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px !important; /* Increased from 4px/5px for visibility */
    display: block !important;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Note Editor (Modal) Fixes --- */
#editNoteText, #notePreview {
    overflow-y: auto !important; /* Force scrollbar to appear */
    height: 100%;
    scrollbar-gutter: stable; /* Prevents layout shift when scrollbar appears */
}

/* --- Note Input (Main Page) Fixes --- */
#noteInput {
    min-height: 120px; /* Sensible starting height */
    max-height: 500px; /* Don't let it push the footer off screen */
    overflow-y: auto !important;
    line-height: 1.5;
    width: 100%;
    display: block;
    resize: none;
    transition: height 0.1s ease-out;
}

[data-theme="minimalist"] .custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="minimalist"] .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border: 1px solid #94a3b8;
}

/* --- Glassmorphism Effect --- */
.glass {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
}

/* --- Page Transitions --- */
.page {
    display: none;
    will-change: transform, opacity, filter;
}

.page.active {
    display: block;
    animation: cinematicIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes cinematicIn {
    0% { 
        opacity: 0; 
        transform: translateY(30px) scale(0.96);
        filter: blur(15px) brightness(0.5);
    }
    60% {
        opacity: 1;
        filter: blur(5px) brightness(1.2);
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1);
        filter: blur(0) brightness(1);
    }
}

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

.animate-fadeIn {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* --- Navigation --- */
nav {
    border-bottom: 1px solid var(--glass-border);
}

nav button, aside button {
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

nav button:hover {
    color: var(--primary);
    background: var(--glass);
}

/* --- sOuLAI Chat Bubbles --- */
#ai.active {
    height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
}

/* Ensure the main chat container doesn't overflow the viewport */
@media (max-width: 1024px) {
    #ai { height: 80vh; min-height: 500px; }
}

/* Force chatBox to handle scrolling and keep status/input pinned at bottom */
#chatBox, #miniChatBox {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

#chatBox {
    /* Handled via .custom-scrollbar class */
}

.message {
    max-width: 92%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    font-size: 0.85rem;
}

@media (min-width: 768px) {
    .message { 
        max-width: 80%; 
        padding: 1rem 1.25rem;
        border-radius: 1.25rem;
        font-size: 0.95rem;
    }
}

.user-msg {
    align-self: flex-end;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-msg {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255,255,255,0.08);
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
    transition: transform 0.2s ease;
}

.ai-msg:hover {
    transform: translateX(2px);
}

/* Markdown Styling */
.markdown-body {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e2e8f0;
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 640px) {
    .markdown-body {
        font-size: 0.8rem;
        line-height: 1.5;
    }
}

@media (min-width: 768px) {
    .markdown-body {
        font-size: 1rem;
        line-height: 1.7;
    }
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}
.markdown-body pre {
    background: #000 !important;
    padding: 1.5rem 1rem 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    overflow-x: auto;
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
}

.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255,255,255,0.05);
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.code-copy-btn:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* Typing indicator */
.typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin-top: 5px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #a855f7;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 3px;
}

.typing-indicator span {
    height: 4px;
    width: 4px;
    background: var(--secondary);
    border-radius: 50%;
    display: inline-block;
    animation: typing 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

.instant-loading-pulse {
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0% { filter: drop-shadow(0 0 2px var(--secondary)); opacity: 0.7; }
    50% { filter: drop-shadow(0 0 10px var(--secondary)); opacity: 1; }
    100% { filter: drop-shadow(0 0 2px var(--secondary)); opacity: 0.7; }
}

@keyframes typing {
    0%, 100% { transform: translateY(0); opacity: 0.3; }
    50% { transform: translateY(-4px); opacity: 1; }
}

.skeleton {
    background: linear-gradient(90deg, var(--glass) 25%, var(--glass-border) 50%, var(--glass) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.5rem;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes shimmer {
    0% { background-position: -450px 0; }
    100% { background-position: 450px 0; }
}

.skeleton-card {
    height: 180px;
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    background-image: linear-gradient(to right, rgba(15, 23, 42, 0.6) 0%, rgba(30, 41, 59, 0.8) 20%, rgba(15, 23, 42, 0.6) 40%, rgba(15, 23, 42, 0.6) 100%);
    background-repeat: no-repeat;
    background-size: 900px 180px;
    animation: shimmer 2s infinite linear;
    border-radius: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#aiStatus, #miniAiStatus {
    background: linear-gradient(to right, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.4);
    color: var(--secondary);
    position: relative;
    overflow: hidden;
    padding: 12px 20px;
    z-index: 50;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: slideDownFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownFade {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.neural-loader {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

.neural-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    width: 14px;
    height: 14px;
}

.grid-dot {
    width: 6px;
    height: 6px;
    background: var(--secondary);
    border-radius: 1px;
    animation: grid-pulse 1s infinite alternate;
}

.grid-dot:nth-child(2) { animation-delay: 0.2s; }
.grid-dot:nth-child(3) { animation-delay: 0.4s; }
.grid-dot:nth-child(4) { animation-delay: 0.6s; }

@keyframes grid-pulse {
    0% { transform: scale(0.6); opacity: 0.3; background: var(--secondary); }
    100% { transform: scale(1.1); opacity: 1; background: var(--primary); }
}

.status-dot {
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary);
}

.pulse-bar {
    width: 2px;
    height: 12px;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 1px;
    animation: bar-pulse 0.6s infinite alternate;
}

.pulse-bar:nth-child(1) { animation-delay: 0s; }
.pulse-bar:nth-child(2) { animation-delay: 0.2s; }
.pulse-bar:nth-child(3) { animation-delay: 0.4s; }

@keyframes bar-pulse {
    from { height: 4px; background: rgba(139, 92, 246, 0.2); }
    to { height: 16px; background: var(--primary); }
}

.animate-fadeOut {
    animation: fadeOut 1s forwards;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-5px); }
}

.neural-text {
    letter-spacing: 0.05em;
    animation: text-flicker 3s infinite;
}

@keyframes text-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
    55% { opacity: 0.9; }
    60% { opacity: 0.4; }
}
.markdown-body code {
    font-family: 'Fira Code', monospace;
    font-size: 0.85em;
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}
.markdown-body ul, .markdown-body ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}
.markdown-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    font-style: italic;
    color: #94a3b8;
}

/* --- sOuLPLAY (Music Player) --- */
.music-card {
    text-align: center;
    padding: 2rem;
    transition: all 0.5s ease;
}

.music-card.playing {
    background: rgba(6, 182, 212, 0.03);
    box-shadow: 0 0 50px -10px rgba(6, 182, 212, 0.15);
}

.vinyl-disk {
    width: clamp(140px, 60vw, 280px);
    height: clamp(140px, 60vw, 280px);
    border-radius: 50%;
    background: repeating-radial-gradient(
        circle at center,
        #111 0px,
        #111 2px,
        #181818 3px,
        #111 4px
    );
    margin: 0 auto 1.5rem;
    border: 12px solid #000;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 30px rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vinyl-disk::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.1) 50%, transparent 60%);
    pointer-events: none;
}

.vinyl-disk::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 40px; height: 40px;
    background: var(--bg-dark);
    border-radius: 50%;
    border: 4px solid var(--primary);
    box-shadow: 0 0 20px var(--primary);
}

#ytPlayerContainer iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.rotating {
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.eq-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.5rem;
    border-radius: 0.5rem;
    font-size: 10px;
    text-transform: uppercase;
    transition: all 0.3s;
}
.eq-btn:hover, .eq-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.control-active {
    color: var(--primary) !important;
    text-shadow: 0 0 10px var(--primary);
    transform: scale(1.2);
}

.collapsed-music-section {
    flex: 0 0 60px !important;
}

.collapsed-music-section > div:last-child {
    opacity: 0 !important;
    pointer-events: none !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
}

#ytResultsContent, #localPlaylistContent {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 1000px;
}

/* Playing Bars Animation */
.playing-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}
.playing-bars span {
    width: 2px;
    background: var(--primary);
    animation: barGrow 0.5s ease-in-out infinite alternate;
}
.playing-bars span:nth-child(1) { height: 60%; animation-delay: 0.1s; }
.playing-bars span:nth-child(2) { height: 100%; animation-delay: 0.2s; }
.playing-bars span:nth-child(3) { height: 40%; animation-delay: 0s; }

@keyframes barGrow {
    from { height: 20%; }
    to { height: 100%; }
}

/* --- Admin Visitor Map --- */
#visitorMap {
    z-index: 10;
    filter: grayscale(0.5) contrast(1.2);
}
.leaflet-container {
    background: #000 !important;
}
/* Leaflet Popup Styling */
.soul-map-popup .leaflet-popup-content-wrapper {
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fff !important;
    border-radius: 12px;
}
.soul-map-popup .leaflet-popup-tip {
    background: rgba(15, 23, 42, 0.95) !important;
}

@keyframes marker-pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 0px #ef4444); }
    50% { transform: scale(1.2); filter: drop-shadow(0 0 10px #ef4444); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0px #ef4444); }
}
.visitor-marker-pulse {
    animation: marker-pulse 2s infinite ease-in-out;
}

/* --- retro snake responsiveness --- */
#snakeGameContainer.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    z-index: 1000;
    border-radius: 0;
    background: #000;
}

#snakeGameContainer.fullscreen #snakeCanvas {
    object-fit: contain;
}

/* --- sOuLCRICKET Board --- */
.cricket-score {
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px var(--primary);
}

.hit-btn {
    transition: all 0.2s;
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.4);
}

.hit-btn:active {
    transform: scale(0.9);
}

/* Quiz Styling */
.quiz-cat-btn {
    @apply w-full text-left px-4 py-3 rounded-xl bg-white/5 border border-white/5 text-xs font-black uppercase tracking-widest hover:bg-indigo-600/20 hover:border-indigo-500/30 transition-all active:scale-95;
}
.quiz-opt-btn {
    @apply w-full flex items-center gap-4 p-4 rounded-2xl bg-white/5 border border-white/5 text-sm font-medium hover:bg-indigo-600/10 hover:border-indigo-500/30 transition-all active:scale-[0.98] shadow-lg shadow-black/20;
}
.quiz-correct {
    @apply bg-green-600/20 border-green-500 shadow-green-500/20 !important;
}
.quiz-correct div {
    @apply bg-green-600 border-green-400 text-white !important;
}
.quiz-wrong {
    @apply bg-red-600/20 border-red-500 shadow-red-500/20 !important;
}
.quiz-wrong div {
    @apply bg-red-600 border-red-400 text-white !important;
}

/* Cricket Animations */
@keyframes trophy-spin {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}
.trophy-spin {
    animation: trophy-spin 3s linear infinite;
}

/* Fun Page Games */
.preserve-3d { transform-style: preserve-3d; }
.backface-hidden { backface-visibility: hidden; }
.rotate-y-180 { transform: rotateY(180deg); }

@keyframes coin-flip-heads {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(1800deg); }
}
@keyframes coin-flip-tails {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(1980deg); }
}

.flipping-heads { animation: coin-flip-heads 2s ease-out forwards; }
.flipping-tails { animation: coin-flip-tails 2s ease-out forwards; }

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.celebrate-flash {
    animation: flash 0.5s infinite;
}

/* Welcome Tour Styles */
.ghost-float {
    animation: ghostFloat 3s ease-in-out infinite;
}

@keyframes ghostFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.ghost-eye {
    animation: ghostBlink 4s infinite;
}

@keyframes ghostBlink {
    0%, 95%, 100% { transform: scaleY(1); }
    97.5% { transform: scaleY(0.1); }
}

#ghostGuide {
    filter: drop-shadow(0 0 20px rgba(6, 182, 212, 0.3));
}

.tour-highlight {
    position: relative !important;
    z-index: 400 !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75), 0 0 0 4px var(--primary) !important;
    pointer-events: none;
    border-radius: 4px;
}

/* Better Errors Robot Styling */
.robot-container {
    position: relative;
    width: 100px;
    height: 120px;
}

.robot-head {
    width: 60px;
    height: 50px;
    background: #334155;
    border: 3px solid #64748b;
    border-radius: 12px;
    position: absolute;
    top: 0;
    left: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px;
    animation: robotHeadBob 2s infinite ease-in-out;
}

.robot-eye {
    width: 8px;
    height: 8px;
    background: #22d3ee;
    border-radius: 50%;
    box-shadow: 0 0 8px #22d3ee;
    animation: robotBlink 4s infinite;
}

.robot-mouth {
    width: 20px;
    height: 4px;
    background: #1e293b;
    position: absolute;
    bottom: 10px;
    border-radius: 2px;
}

.robot-body {
    width: 80px;
    height: 60px;
    background: #475569;
    border: 3px solid #64748b;
    border-radius: 8px;
    position: absolute;
    bottom: 10px;
    left: 10px;
}

.robot-arm {
    width: 20px;
    height: 8px;
    background: #64748b;
    position: absolute;
    top: 20px;
}

.robot-arm.left { left: -15px; transform: rotate(-20deg); animation: robotLeftArm 1s infinite alternate; }
.robot-arm.right { right: -15px; transform: rotate(20deg); animation: robotRightArm 1s infinite alternate; }

.wrench-icon {
    position: absolute;
    top: -10px;
    right: -20px;
    color: #94a3b8;
    font-size: 24px;
    animation: wrenchSpin 2s infinite linear;
}

@keyframes robotHeadBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes robotBlink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0); }
}

@keyframes robotLeftArm {
    from { transform: rotate(-20deg); }
    to { transform: rotate(-50deg); }
}

@keyframes robotRightArm {
    from { transform: rotate(20deg); }
    to { transform: rotate(50deg); }
}

@keyframes wrenchSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.diff-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Floating AI Widget --- */
#aiWidget {
    z-index: 999;
    background: linear-gradient(135deg, var(--secondary), #7c3aed);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
}

.mini-chat {
    position: fixed;
    bottom: 80px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: 350px;
    height: 60vh;
    max-height: 500px;
    display: none;
    flex-direction: column;
    z-index: 1000;
    margin-left: auto;
}

@media (max-width: 640px) {
    .mini-chat {
        bottom: 70px;
        right: 5px;
        left: 5px;
        height: 75vh;
        padding: 0.75rem !important;
    }
    #miniChatBox {
        padding: 0.5rem !important;
    }
}

.mini-chat.show {
    display: flex;
}

/* --- Support/Donation Progress --- */
.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--glass);
    border-radius: 5px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 45%; /* Example width */
    box-shadow: 0 0 10px var(--primary);
}

/* --- Admin Panel Inputs --- */
textarea, input[type="text"], input[type="number"], select {
    border: 1px solid var(--glass-border);
    outline: none;
    transition: border 0.3s, height 0.1s ease-out;
}

#chatInput, #noteInput, #editNoteText, #miniChatInput {
    resize: none !important;
    min-height: 44px;
    height: auto;
    transition: none; /* Removed transition to allow instant height calculation */
}

#noteInput, #editNoteText {
    min-height: 120px;
}

textarea:focus, input:focus {
    border-color: var(--primary);
}

/* --- Grid Layouts --- */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Tool card hover effects */
.home-grid .glass:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
}

#aiSidebar {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.3);
}

#chatHistoryList .group:hover .flex-grow {
    background: rgba(139, 92, 246, 0.1);
}

#chatHistoryList .flex-grow {
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* sOuLCODE Specific */
#codeEditor {
    tab-size: 4;
}

#diffOriginal, #diffProposed {
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Fira Code', monospace;
}

.streaming-msg .markdown-body::after {
    content: "▋";
    display: inline-block;
    vertical-align: middle;
    margin-left: 2px;
    color: var(--secondary);
    animation: blink 0.8s infinite;
}

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