:root {
    /* --- Gamified Premium Core --- */
    --bg-main: #09090b;
    /* Quase preto */
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #020617;

    /* Acentos Gamificados & Vibrantes (Gen Z) */
    --brand-primary: #ec4899;
    /* Hot Pink */
    --brand-secondary: #8b5cf6;
    /* Electric Violet */
    --brand-accent: #06b6d4;
    /* Cyan */

    --text-primary: #f8fafc;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;

    /* --- Sistema Bento Box (Soft Glass) --- */
    --glass-surface: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    --backdrop-blur: 24px;

    /* --- Mindmap --- */
    --node-bg: rgba(24, 24, 27, 0.9);
    --node-border: rgba(236, 72, 153, 0.4);
    --node-active: var(--brand-primary);
    --node-text: #ffffff;
    --mindmap-bg: radial-gradient(circle at center, #18181b 0%, #09090b 100%);

    /* --- Status --- */
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Gradients globais */
    --bg-radial-center: #2e1065;
    --bg-glow-color: rgba(236, 72, 153, 0.25);
    --gradient-brand: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary), var(--brand-accent));
    --gradient-text: linear-gradient(135deg, #fff 0%, #d4d4d8 100%);

    /* Spacing & Layout */
    --container-max: 1280px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    /* Bento box cards */
}

/* --- Tema Claro Gamificado (Light Mode) --- */
.theme-light {
    --bg-main: #f8fafc;
    --bg-gradient-start: #f1f5f9;
    --bg-gradient-end: #e2e8f0;

    --brand-primary: #ec4899;
    --brand-secondary: #8b5cf6;
    --brand-accent: #06b6d4;

    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;

    --glass-surface: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.05);
    --glass-highlight: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);

    --node-bg: #ffffff;
    --node-border: rgba(236, 72, 153, 0.5);
    --node-text: #18181b;
    --mindmap-bg: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);

    --bg-radial-center: #fdf4ff;
    --bg-glow-color: rgba(236, 72, 153, 0.1);

    --gradient-brand: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary), var(--brand-accent));
    --gradient-text: linear-gradient(135deg, #18181b 0%, #3f3f46 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background: radial-gradient(circle at 50% 0%, var(--bg-radial-center) 0%, var(--bg-main) 60%);
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-primary);
}

/* --- Utilities --- */
.glass-panel {
    background: var(--glass-surface);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-xl);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy */
}

.glass-panel:hover {
    border-color: var(--glass-highlight);
    box-shadow: 0 15px 40px rgba(236, 72, 153, 0.15);
}

/* --- Navbar --- */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass-surface);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 0;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
    margin: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    width: auto;
    padding: 0.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fix Lucide icons color in light theme for navbar buttons */
.theme-light .main-nav .mm-btn {
    color: var(--text-primary);
}

.page-wrapper {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 10;
}

/* --- Header / Hero --- */
.hero-section {
    position: relative;
    text-align: center;
    padding: 3rem 0 4rem;
    margin-bottom: 2rem;
}

.hero-glow {
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--bg-glow-color) 0%, rgba(0, 0, 0, 0) 70%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
    animation: pulseGlow 8s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    0% {
        opacity: 0.5;
        transform: translateX(-50%) scale(0.9);
    }

    100% {
        opacity: 0.8;
        transform: translateX(-50%) scale(1.1);
    }
}

.brand-title {
    font-size: clamp(3rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    display: inline-block;
}

.brand-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* --- Features Grid --- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.feature-card {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-8px) scale(1.02);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.1);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- Input Section --- */
.input-section {
    padding: clamp(1.5rem, 3vw, 2.5rem);
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .input-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.glass-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    resize: none;
}

.glass-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: rgba(0, 0, 0, 0.3);
}

.file-dropzone {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.file-dropzone:hover,
.file-dropzone.drag-active {
    border-color: var(--brand-primary);
    background: rgba(99, 102, 241, 0.05);
}

.file-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.dropzone-content {
    pointer-events: none;
}

.drop-icon {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.file-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.file-status-text {
    color: var(--brand-accent);
    font-weight: 600;
}

.check-group {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    cursor: pointer;
}

.custom-check {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.check-input:checked+.custom-check {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.check-input:checked+.custom-check svg {
    opacity: 1;
    transform: scale(1);
}

.check-input {
    display: none;
}

.custom-check svg {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
    color: #fff;
}

.checkbox-label {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.btn-generate {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 999px;
    /* Pill shape */
    border: none;
    background: var(--gradient-brand);
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy hover */
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-generate:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 35px rgba(236, 72, 153, 0.6);
    filter: brightness(1.1);
}

.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.options-container {
    margin-top: 1.5rem;
}

/* --- Loading --- */
.loading-overlay {
    text-align: center;
    padding: 4rem 0;
    display: none;
    animation: fadeIn 0.5s ease;
}

.loading-overlay.active {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spin-icon {
    animation: spin 2s linear infinite;
}

/* --- Results --- */
.results-container {
    display: none;
    animation: fadeIn 0.6s ease;
}

.results-container.active {
    display: block;
}

.tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 999px;
    /* Huge pill for the container */
    border: 1px solid var(--glass-border);
}

/* Light mode adjustment */
.theme-light .tabs-nav {
    background: rgba(0, 0, 0, 0.03);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem 1.4rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 999px;
    /* Pill items */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #fff;
    background: var(--brand-primary);
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
    transform: scale(1.05);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.tab-inner-padding {
    padding: clamp(1.5rem, 3vw, 2.5rem);
}

.tab-title {
    color: var(--brand-secondary);
    margin-bottom: 1.5rem;
}

/* Prose Styles (Resumo) */
.prose {
    line-height: 1.7;
    color: #e2e8f0;
}

.prose h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--brand-accent);
}

.prose h4 {
    color: var(--brand-primary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.prose ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose strong {
    color: #fff;
    font-weight: 700;
}

.prose .mb-4 {
    margin-bottom: 1.5rem;
}

/* Flashcards */
.flashcards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.flashcard {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    min-height: 180px;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s;
}

.flashcard:hover {
    transform: translateY(-3px);
    border-color: var(--brand-accent);
}

.fc-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flashcard.flipped .fc-inner {
    transform: rotateY(180deg);
}

.fc-front,
.fc-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.fc-front {
    font-weight: 600;
    color: var(--text-primary);
}

.fc-back {
    transform: rotateY(180deg);
    color: var(--brand-accent);
    font-size: 0.95rem;
}

.fc-hint {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-top: 1rem;
}

/* --- Mindmap Specifics --- */
.mindmap-tab {
    padding: 0;
    overflow: hidden;
}

.mindmap-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.margin-0 {
    margin: 0;
}

.mindmap-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mindmap-wrapper {
    position: relative;
    height: 650px;
    background: var(--mindmap-bg);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.mindmap-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0 !important;
}

.mindmap-canvas {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.mindmap-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible !important;
    pointer-events: none;
    z-index: 1;
}

.mindmap-nodes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    transform-origin: 0 0;
}

.mm-node {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transform: translateY(-50%);
    transition: left 0.5s cubic-bezier(0.19, 1, 0.22, 1),
        top 0.5s cubic-bezier(0.19, 1, 0.22, 1),
        opacity 0.3s ease,
        transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.mm-node.entering {
    opacity: 0;
    transform: translateY(-50%) scale(0.8);
}

.mindmap-toolbar-modern {
    display: flex;
    gap: 0.5rem;
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    z-index: 10;
}

.mm-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--glass-border);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mm-btn:hover {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
    align-self: center;
}

.mindmap-panel {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 300px;
    padding: 1.5rem;
    z-index: 10;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-title {
    color: var(--brand-accent);
}

.close-panel-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
}

.panel-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- Firebase Auth & History UI --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.auth-box {
    width: 400px;
    max-width: 90%;
    padding: 2.5rem;
    position: relative;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.auth-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    position: relative;
}

.full-width {
    width: 100%;
}

.btn-google {
    background: #fff;
    color: #333;
    font-weight: 500;
    border: none;
    transition: all 0.2s;
}

.btn-google:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

.auth-header-btn {
    position: relative;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.dropdown-anchor {
    width: auto;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    display: flex;
    color: var(--text-primary);
}

#historyDropdown {
    box-shadow: var(--glass-shadow);
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 350px;
    max-width: 90vw;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    z-index: 100;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.dropdown-header h3 {
    font-size: 1rem;
    margin: 0;
}

.close-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    grid-column: 1 / -1;
}

.empty-icon {
    opacity: 0.5;
    margin-bottom: 1rem;
}

.history-item {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    margin-bottom: 0.5rem;
    /* for dropdown list */
}

.history-grid .history-item {
    margin-bottom: 0;
}

.history-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--brand-primary);
}

.h-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.h-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.h-tags {
    display: flex;
    gap: 0.5rem;
}

.h-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.h-delete {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}

.history-item:hover .h-delete {
    opacity: 1;
}

.h-delete:hover {
    color: var(--error);
    transform: scale(1.1);
}

.app-footer {
    text-align: center;
    margin-top: 4rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-bottom: 2rem;
}

/* --- Toasts Notifications --- */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
    /* Let clicks pass through empty areas */
}

.toast {
    padding: 1rem 1.5rem;
    background: var(--glass-surface);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: var(--glass-shadow);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    /* Catch clicks on toast */
    animation: toastSlideIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    transform-origin: bottom right;
    max-width: 350px;
}

.toast.toast-hiding {
    animation: toastSlideOut 0.3s ease-in forwards;
}

.toast i {
    flex-shrink: 0;
}

.toast.toast-error {
    border-left: 4px solid var(--error);
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-info {
    border-left: 4px solid var(--brand-accent);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
}

/* Theme Icons Adjustment */
.theme-light .prose {
    color: var(--text-secondary);
}

/* --- Performance Mode Overrides --- */
body.perf-mode-active {
    --backdrop-blur: 0px;
}

body.perf-mode-active * {
    animation: none !important;
    transition: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
}

body.perf-mode-active .hero-glow {
    display: none !important;
}

body.perf-mode-active .glass-panel:not(.mm-node),
body.perf-mode-active .main-nav {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.theme-light.perf-mode-active .glass-panel:not(.mm-node),
body.theme-light.perf-mode-active .main-nav {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.theme-light .prose strong {
    color: var(--text-primary);
}