/* =========================================
   MEMOJI - Professional SaaS Theme
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Color Palette - Shadcn Monochrome (Zinc) - Dark Mode Default */
    --bg-app: #09090b;       /* Zinc 950 */
    --bg-surface: #09090b;   /* Zinc 950 (seamless) */
    --bg-card: #18181b;      /* Zinc 900 */
    
    --text-main: #fafafa;    /* Zinc 50 */
    --text-muted: #71717a;   /* Zinc 500 - Improved contrast */
    
    --primary: #ffffff;      
    --primary-hover: #e4e4e7;
    --primary-fg: #09090b;   /* Text color on primary button */
    
    --accent: #27272a;       /* Zinc 800 */
    
    --success: #10b981;
    --border: #27272a;       /* Zinc 800 */
    
    --radius-lg: 0.5rem;
    --radius-md: 0.5rem; /* calc(var(--radius) - 2px) */
    --radius-sm: 0.3rem; /* calc(var(--radius) - 4px) */
    
    --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.1);
    
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* Light Theme */
[data-theme="light"] {
    --bg-app: #fafafa;
    --bg-surface: #ffffff;
    --bg-card: #f4f4f5;
    
    --text-main: #18181b;
    --text-muted: #52525b;   /* Zinc 600 - Good contrast on light */
    
    --primary: #18181b;
    --primary-hover: #27272a;
    --primary-fg: #fafafa;
    
    --accent: #e4e4e7;
    --border: #d4d4d8;
    
    --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
}

/* Light theme specific overrides */
[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--border);
}

[data-theme="light"] .modal-body {
    background: var(--bg-surface);
}

[data-theme="light"] .modal-content {
    background: var(--bg-surface);
}

[data-theme="light"] .gallery-body {
    background: var(--bg-surface);
}

[data-theme="light"] .theme-toggle {
    color: var(--text-main);
    border-color: var(--border);
}

[data-theme="light"] .consent-banner {
    background: var(--bg-surface);
}

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* =========================================
   Loading Screen
   ========================================= */
#loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-app);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.6s ease-out;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.logo-3d-container {
    perspective: 800px;
    margin-bottom: 2rem;
}

.logo-3d-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto;
    transform-style: preserve-3d;
    animation: logo-float 3s ease-in-out infinite;
}

.loader-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-main);
    z-index: 2;
}

.orbital-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    transform-style: preserve-3d;
    border-style: solid;
    border-color: transparent;
}

.orbital-ring-1 {
    width: 85px;
    height: 85px;
    border-width: 3px;
    border-top-color: var(--text-main);
    animation: orbital-spin-1 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.orbital-ring-2 {
    width: 105px;
    height: 105px;
    border-width: 3px;
    border-bottom-color: var(--text-main);
    animation: orbital-spin-2 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes logo-float {
    0%, 100% { 
        transform: translateY(0) rotateX(5deg); 
    }
    50% { 
        transform: translateY(-5px) rotateX(-5deg); 
    }
}

@keyframes orbital-spin-1 {
    0% { 
        transform: translate(-50%, -50%) rotateX(65deg) rotateZ(0deg); 
    }
    100% { 
        transform: translate(-50%, -50%) rotateX(65deg) rotateZ(360deg); 
    }
}

@keyframes orbital-spin-2 {
    0% { 
        transform: translate(-50%, -50%) rotateX(65deg) rotateY(180deg) rotateZ(0deg); 
    }
    100% { 
        transform: translate(-50%, -50%) rotateX(65deg) rotateY(180deg) rotateZ(-360deg); 
    }
}

.logo-text {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    letter-spacing: -0.05em;
}

.loader-tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 400;
}

/* Light theme loading screen */
[data-theme="light"] .loader-logo {
    color: var(--text-main);
}

[data-theme="light"] .orbital-ring-1 {
    border-top-color: var(--text-main);
}

[data-theme="light"] .orbital-ring-2 {
    border-bottom-color: var(--text-main);
}

/* =========================================
   Navigation
   ========================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    background: rgba(9, 9, 11, 0.75);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border); /* Full border */
    border-radius: 9999px; /* Rounded pill shape */
    width: 90%;
    max-width: 800px;
    margin: 1.5rem auto 0; /* Float from top */
    position: sticky;
    top: 1.5rem;
    z-index: 50;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.nav-brand {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-main);
}

/* Mobile Navigation Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 60;
}

.nav-toggle-bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

@media (max-width: 640px) {
    .navbar {
        padding: 0.75rem 1.25rem;
        width: 95%;
        z-index: 100;
    }
    
    .nav-toggle {
        display: flex;
        z-index: 110;
        position: relative;
    }
    
    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        background: #09090b;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2rem;
        z-index: 105;
    }
    
    .nav-links.open {
        display: flex;
    }
    
    .nav-links a {
        font-size: 1.5rem;
        font-weight: 600;
        color: #ffffff;
        text-decoration: none;
    }
    
    .nav-links a:hover, .nav-links a.active {
        color: #a855f7;
    }
    
    .theme-toggle {
        margin-top: 2rem;
    }
    
    /* Light theme mobile nav */
    [data-theme="light"] .nav-links {
        background: #f4f4f5;
        border: 1px solid #e4e4e7;
    }
    
    [data-theme="light"] .nav-links a {
        color: #09090b;
    }
    
    [data-theme="light"] .nav-links a:hover, 
    [data-theme="light"] .nav-links a.active {
        color: #7c3aed;
    }
}

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.theme-toggle:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

.theme-icon-light { display: none; }
.theme-icon-dark { display: block; }

[data-theme="light"] .theme-icon-light { display: block; }
[data-theme="light"] .theme-icon-dark { display: none; }

/* =========================================
   Main Layout
   ========================================= */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.header-section {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 2rem;
}

.header-section h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.text-gradient {
    color: var(--text-main);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Workspace Grid */
.workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (min-width: 900px) {
    .workspace {
        grid-template-columns: 1fr 1fr;
    }
}

/* Panels */
.camera-panel, .result-panel {
    background: var(--bg-app);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: none;
}

.panel-header {
    padding: 1rem;
    background: transparent;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    text-transform: none;
    letter-spacing: 0;
    flex-grow: 1;
}

/* Mac-style dots */
.dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.red { background: #27272a; }
.yellow { background: #27272a; }
.green { background: #27272a; }

.live-indicator {
    background: #000;
    border: 1px solid var(--border);
    color: #ffffff;  /* Always white text */
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

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

/* Video Area */
.video-wrapper {
    position: relative;
    aspect-ratio: 4/3;
    background: #000;
}

#video, #overlay-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

#overlay-canvas { position: absolute; inset: 0; }

.emotion-badge-container {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ffffff; /* Always white text on dark background */
}

#current-emoji { font-size: 1.2rem; }
#current-emotion { font-weight: 500; font-size: 0.85rem; text-transform: capitalize; color: #ffffff; }

/* Result Area */
.result-panel { padding: 0; }

.ai-caption-card {
    background: transparent;
    border-radius: 0;
    padding: 1.5rem;
    border: none;
    border-bottom: 1px solid var(--border);
}

.caption-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.bot-name {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

#caption-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-main);
}

.meme-display-container {
    flex-grow: 1;
    background: var(--bg-surface);
    border-radius: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    position: relative;
    padding: 1.5rem;
}

#meme-image { width: 100%; height: 100%; object-fit: contain; display: none; }
#meme-image.visible { display: block; }
#meme-placeholder.hidden { display: none; }

.meme-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}
.placeholder-icon { font-size: 3rem; opacity: 0.5; }

/* AI Loader inside meme display */
.ai-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    height: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--text-main);
    animation: spin 1s ease-in-out infinite;
}

.loader-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

/* =========================================
   Action Bar
   ========================================= */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
    max-width: 100%;
    margin: 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.action-group { display: flex; gap: 0.5rem; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    height: 2.25rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-lg { height: 2.5rem; padding: 0 1.25rem; font-size: 0.875rem; }

.btn-primary {
    background: var(--primary);
    color: var(--primary-fg);
    border: 1px solid var(--primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: none;
    box-shadow: none;
}

.pulse-hover:hover {
    animation: none;
}

.btn-secondary {
    background: var(--bg-surface); /* Was bg-surface-light */
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-card); /* Was bg-surface */
    border-color: var(--text-muted);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-card);
}

.instruction-text {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.instruction-text kbd {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 1px 0 var(--border);
}

/* Upload Preview */
.upload-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.upload-preview {
    position: absolute;
    left: calc(100% + 0.5rem);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: fadeIn 0.2s ease;
}

.upload-preview img {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
}

.upload-preview-clear {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.upload-preview-clear:hover {
    background: #ef4444;
    color: white;
}

/* =========================================
   Modal
   ========================================= */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal.hidden { opacity: 0; pointer-events: none; }
.modal:not(.hidden) { opacity: 1; pointer-events: auto; }

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    padding: 0;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s;
}

.modal:not(.hidden) .modal-content { transform: scale(1); }

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
    background: #0f1115;
    text-align: center;
}

#capture-canvas {
    max-width: 100%;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--bg-surface);
}

/* Loading state for AI Card */
.ai-caption-card.loading {
    border-color: var(--border);
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.ai-caption-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Typewriter effect - cursor blinks during typing, then stops */
.typewriter {
    border-right: 2px solid var(--text-main);
    display: inline-block;
    animation: blink 0.75s step-end infinite;
}

.typewriter.done {
    border-right: none;
    animation: none;
}

@keyframes blink {
    50% { border-color: transparent; }
}

.new-caption {
    animation: captionFade 0.5s ease;
}

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

/* About Full Page Layout */
.about-content {
    width: 95vw;
    height: 90vh;
    max-width: 1400px;
    border: 1px solid var(--border);
    border-radius: 2rem;
    background: var(--bg-app);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.close-btn-floating {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.close-btn-floating:hover {
    background: white;
    color: black;
    transform: rotate(90deg);
}

.about-body {
    flex-grow: 1;
    display: flex;
    height: 100%;
    padding: 0;
    overflow: hidden;
}

/* Left Side: Photo */
.about-left {
    flex: 1;
    height: 100%;
    background: #000;
    position: relative;
    overflow: hidden;
}

.large-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 37%; /* Shifted up slightly */
    transform: scale(0.8); /* Reduce size slightly so full photo is visible */
    transform-origin: center bottom;
    /* Soft fade to the right */
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
}

/* Right Side: Content */
.about-right {
    flex: 1;
    padding: 4rem 6rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
    background: var(--bg-app);
}

.about-section {
    margin-bottom: 4rem;
}

.deconstruct-text {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    letter-spacing: -0.05em;
    animation: deconstruct 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.about-desc {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-muted);
    max-width: 600px;
    animation: fadeInBlur 1s ease 0.2s both;
}

/* Profile Info Styles */
.profile-info-large {
    animation: fadeInBlur 1s ease 0.4s both;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.profile-name-large {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.pronouns-badge {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.profile-role {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary); /* Highlight role */
    margin-bottom: 0.5rem;
}

.profile-edu {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.profile-bio-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-main);
    opacity: 0.9;
    margin-bottom: 2.5rem;
    max-width: 500px;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
}

.profile-links-large {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.social-link-large {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.social-link-large:hover {
    background: var(--text-main);
    color: var(--bg-app);
    border-color: var(--text-main);
    transform: translateY(-2px);
}

/* Deconstruct Animation */
@keyframes deconstruct {
    0% {
        opacity: 0;
        filter: blur(20px);
        transform: translateY(20px);
        letter-spacing: 0.5em;
    }
    100% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
        letter-spacing: -0.05em;
    }
}

@keyframes fadeInBlur {
    0% { opacity: 0; filter: blur(10px); }
    100% { opacity: 1; filter: blur(0); }
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .about-body {
        flex-direction: column;
        overflow-y: auto;
    }
    
    .about-left {
        flex: none;
        height: 40vh;
        width: 100%;
    }
    
    .large-profile-img {
        mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
        -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
        object-position: center 20%;
    }
    
    .about-right {
        flex: none;
        padding: 2rem;
        min-height: 60vh;
    }
    
    .deconstruct-text { font-size: 2.5rem; }
    .profile-name-large { font-size: 1.5rem; }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2); }
    70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.pulse {
    animation: pulse 1s ease infinite;
}

/* Icon styles */
.bot-avatar {
    color: var(--text-main);
    display: flex;
    align-items: center;
}

.bot-avatar svg, .btn svg {
    display: block;
}

/* Gallery */
.gallery-content {
    max-width: 800px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
    overflow-y: auto;
    max-height: 100%;
}

.gallery-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-4px);
    border-color: var(--text-muted);
}

.gallery-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #000;
}

.gallery-caption {
    padding: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-main);
    border-top: 1px solid var(--border);
    line-height: 1.4;
    max-height: 3.6em; /* 2-3 lines max */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Gallery Image Pairs */
.gallery-images-pair {
    display: flex;
    height: 120px;
    background: #000;
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-thumb.user-thumb {
    width: 50%;
    border-right: 1px solid var(--border);
}

.gallery-thumb.meme-thumb {
    width: 50%; /* If paired */
}

/* If only one image exists, it should be 100% width. This is handled by default if .user-thumb is missing */
.gallery-thumb.meme-thumb:only-child {
    width: 100%;
}

.empty-gallery {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* =========================================
   Consent Banner
   ========================================= */
.consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    z-index: 1000;
    animation: slideUp 0.3s ease;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.consent-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.consent-icon {
    flex-shrink: 0;
    color: var(--text-main);
}

.consent-text {
    flex: 1;
}

.consent-text h4 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--text-main);
}

.consent-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.consent-text a {
    color: var(--text-main);
    text-decoration: underline;
}

.consent-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
    align-items: center;
}

@media (max-width: 768px) {
    .consent-content {
        flex-direction: column;
        text-align: center;
    }
    .consent-actions {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================
   Privacy Modal
   ========================================= */
.privacy-content {
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.privacy-body {
    overflow-y: auto;
    padding: 2rem !important;
    max-height: 70vh;
    text-align: left;
    background: var(--bg-surface) !important;
}

.privacy-body h4 {
    color: var(--text-main);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.privacy-body p, .privacy-body li {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.privacy-body ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.privacy-body a {
    color: var(--text-main);
    text-decoration: underline;
}

.privacy-updated {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    font-style: italic;
    margin-bottom: 1rem !important;
}

.privacy-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.85rem;
}

.privacy-table th, .privacy-table td {
    border: 1px solid var(--border);
    padding: 0.75rem;
    text-align: left;
}

.privacy-table th {
    background: var(--bg-card);
    color: var(--text-main);
}

.privacy-table td {
    color: var(--text-muted);
}

/* =========================================
   Gallery Improvements
   ========================================= */
.gallery-content {
    max-width: 900px;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.gallery-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem !important;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    padding-bottom: 1rem;
}

.gallery-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-4px);
    border-color: var(--text-muted);
}

.gallery-item:hover .gallery-item-actions {
    opacity: 1;
}

.gallery-item-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.gallery-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.7);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.gallery-action-btn:hover {
    background: var(--text-main);
    color: var(--bg-app);
    transform: scale(1.1);
}

.gallery-action-btn.delete:hover {
    background: #ef4444;
    color: white;
}

.gallery-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
}

.storage-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
}

.gallery-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-sm {
    height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
}

.gallery-item-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    opacity: 0.7;
}

/* Mobile: Always show gallery action buttons (no hover on touch) */
@media (max-width: 768px) {
    .gallery-item-actions {
        opacity: 1;
    }
    
    .gallery-action-btn {
        width: 32px;
        height: 32px;
    }
}

/* Declined State */
.declined-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
    padding: 2rem;
}

.declined-state h2 {
    margin-bottom: 1rem;
}

.declined-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 400px;
}

/* =========================================
   Error Display
   ========================================= */
.error-display {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s ease;
}

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

.error-content {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.error-content h3 {
    color: #ef4444;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.error-content p {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.error-content ol {
    text-align: left;
    color: var(--text-muted);
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.error-content li {
    margin-bottom: 0.5rem;
}

.error-hint {
    font-size: 0.85rem !important;
    opacity: 0.8;
    font-style: italic;
}

.error-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* =========================================
   Toast Notifications
   ========================================= */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-info {
    border-color: #3b82f6;
    color: #60a5fa;
}

.toast-success {
    border-color: #10b981;
    color: #34d399;
}

.toast-error {
    border-color: #ef4444;
    color: #f87171;
}

.toast-warning {
    border-color: #f59e0b;
    color: #fbbf24;
}

/* Success button state */
.btn-success {
    background: #10b981 !important;
    border-color: #10b981 !important;
    color: white !important;
}

/* =========================================
   Skeleton Loading
   ========================================= */
.skeleton-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.skeleton {
    background: linear-gradient(90deg, 
        var(--bg-card) 25%, 
        rgba(255,255,255,0.05) 50%, 
        var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 60%;
}

.caption-skeleton {
    margin-top: 0.75rem;
}

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

/* =========================================
   Meme Error State
   ========================================= */
.meme-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.meme-error-state svg {
    opacity: 0.5;
    color: #ef4444;
}

.meme-error-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.meme-error-desc {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* =========================================
   Lightbox (Gallery Zoom)
   ========================================= */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 210;
}

.lightbox-close:hover {
    background: white;
    color: black;
    transform: scale(1.05);
}

.lightbox-content {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox-caption {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    max-width: 600px;
    padding: 0 1rem;
}
