/* General Body Styles */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
    color: #1f2937;
    margin: 0;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Prevent horizontal scroll */
html {
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

/* Main Layout */
.container {
    display: block;
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

#sidebar {
    background-color: #ffffff;
    width: 18rem; /* Increased from 16rem to 18rem (288px) for better grid layout */
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50; /* Increased for mobile compatibility */
    padding: 0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease-in-out;
    transform: translateX(-100%); /* Hidden by default */
}

#sidebar.sidebar-open {
    transform: translateX(0);
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: #f3f4f6;
}

.close-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #6b7280;
}

#main-content {
    padding: 0;
    width: 100%;
    min-height: 100vh;
    max-width: 100%;
    position: relative;
}

/* Content wrapper with max-width */
.content-wrapper {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1rem 2rem 1rem;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: visible;
}

/* Sidebar Navigation - Grid Layout */
#sidebar nav {
    padding: 1rem;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

/* Custom scrollbar for sidebar */
#sidebar nav::-webkit-scrollbar {
    width: 6px;
}

#sidebar nav::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#sidebar nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#sidebar nav::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

#sidebar nav a {
    display: block;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    text-decoration: none;
    color: #1f2937;
    font-weight: 500;
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.2;
    border: 1px solid #e5e7eb;
    background-color: #ffffff;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

#sidebar nav a:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#sidebar nav a.active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

/* Responsive grid for mobile */
@media (max-width: 768px) {
    #sidebar {
        width: 20rem; /* Slightly wider on mobile for better touch targets */
    }
    
    #sidebar nav {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 1.25rem;
    }
    
    #sidebar nav a {
        font-size: 0.8rem;
        padding: 0.75rem 0.5rem;
        min-height: 3rem;
    }
}

/* Single column for very small screens */
@media (max-width: 480px) {
    #sidebar {
        width: 16rem;
    }
    
    #sidebar nav {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    #sidebar nav a {
        font-size: 0.875rem;
        padding: 0.75rem;
        min-height: 2.75rem;
    }
}


/* Main Content Header */
.main-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background-color: #f3f4f6;
}

.menu-toggle svg {
    width: 1.5rem;
    height: 1.5rem;
    color: #374151;
}

.site-branding {
    flex: 1;
}

.site-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    line-height: 1.2;
}

.site-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-title a:hover {
    color: #3b82f6;
}

.site-tagline {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0.25rem 0 0 0;
    font-weight: 400;
}

/* Category Section Headers */
.category-section {
    margin: 2rem 0 1.5rem 0;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.3s ease-out forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2), 0 2px 4px -1px rgba(59, 130, 246, 0.1);
    position: relative;
    overflow: hidden;
}

.category-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.category-header:hover::before {
    left: 100%;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    position: relative;
    z-index: 1;
}

.category-count {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    position: relative;
    z-index: 1;
    font-weight: 500;
}

/* Different colors for different categories */
.category-header.happy {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.2), 0 4px 6px -2px rgba(245, 158, 11, 0.1);
}

.category-header.sad {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    box-shadow: 0 10px 15px -3px rgba(107, 114, 128, 0.2), 0 4px 6px -2px rgba(107, 114, 128, 0.1);
}

.category-header.shocked {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 10px 15px -3px rgba(139, 92, 246, 0.2), 0 4px 6px -2px rgba(139, 92, 246, 0.1);
}

.category-header.cry {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    box-shadow: 0 10px 15px -3px rgba(6, 182, 212, 0.2), 0 4px 6px -2px rgba(6, 182, 212, 0.1);
}

.category-header.angry {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.2), 0 4px 6px -2px rgba(239, 68, 68, 0.1);
}

.category-header.flower {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.2), 0 4px 6px -2px rgba(249, 115, 22, 0.1);
}

.category-header.glasses {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    box-shadow: 0 10px 15px -3px rgba(55, 65, 81, 0.2), 0 4px 6px -2px rgba(55, 65, 81, 0.1);
}

.category-header.cute {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    box-shadow: 0 10px 15px -3px rgba(236, 72, 153, 0.2), 0 4px 6px -2px rgba(236, 72, 153, 0.1);
}

.category-header.blush {
    background: linear-gradient(135deg, #f472b6 0%, #ec4899 100%);
    box-shadow: 0 10px 15px -3px rgba(244, 114, 182, 0.2), 0 4px 6px -2px rgba(244, 114, 182, 0.1);
}

.category-header.confused {
    background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
    box-shadow: 0 10px 15px -3px rgba(132, 204, 22, 0.2), 0 4px 6px -2px rgba(132, 204, 22, 0.1);
}

.category-header.sleep {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    box-shadow: 0 10px 15px -3px rgba(100, 116, 139, 0.2), 0 4px 6px -2px rgba(100, 116, 139, 0.1);
}

.category-header.gun {
    background: linear-gradient(135deg, #52525b 0%, #3f3f46 100%);
    box-shadow: 0 10px 15px -3px rgba(82, 82, 91, 0.2), 0 4px 6px -2px rgba(82, 82, 91, 0.1);
}

.category-header.thinking {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
    box-shadow: 0 10px 15px -3px rgba(168, 85, 247, 0.2), 0 4px 6px -2px rgba(168, 85, 247, 0.1);
}

.category-header.vomit {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    box-shadow: 0 10px 15px -3px rgba(234, 179, 8, 0.2), 0 4px 6px -2px rgba(234, 179, 8, 0.1);
}

.category-header.laugh {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.2), 0 4px 6px -2px rgba(34, 197, 94, 0.1);
}

.category-header.devil {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    box-shadow: 0 10px 15px -3px rgba(127, 29, 29, 0.2), 0 4px 6px -2px rgba(127, 29, 29, 0.1);
}

.category-header.love {
    background: linear-gradient(135deg, #e11d48 0%, #be185d 100%);
    box-shadow: 0 10px 15px -3px rgba(225, 29, 72, 0.2), 0 4px 6px -2px rgba(225, 29, 72, 0.1);
}

.category-header.kiss {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    box-shadow: 0 10px 15px -3px rgba(244, 63, 94, 0.2), 0 4px 6px -2px rgba(244, 63, 94, 0.1);
}

.category-header.surprised {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.2), 0 4px 6px -2px rgba(14, 165, 233, 0.1);
}

.category-header.naughty {
    background: linear-gradient(135deg, #7c2d12 0%, #9a3412 100%);
    box-shadow: 0 10px 15px -3px rgba(124, 45, 18, 0.2), 0 4px 6px -2px rgba(124, 45, 18, 0.1);
}

.category-header.hug {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 10px 15px -3px rgba(5, 150, 105, 0.2), 0 4px 6px -2px rgba(5, 150, 105, 0.1);
}

.category-header.heart {
    background: linear-gradient(135deg, #be123c 0%, #9f1239 100%);
    box-shadow: 0 10px 15px -3px rgba(190, 18, 60, 0.2), 0 4px 6px -2px rgba(190, 18, 60, 0.1);
}

.category-header.cat {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    box-shadow: 0 10px 15px -3px rgba(251, 146, 60, 0.2), 0 4px 6px -2px rgba(251, 146, 60, 0.1);
}

.category-header.smile {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 10px 15px -3px rgba(251, 191, 36, 0.2), 0 4px 6px -2px rgba(251, 191, 36, 0.1);
}

.category-header.sparkle {
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    box-shadow: 0 10px 15px -3px rgba(192, 132, 252, 0.2), 0 4px 6px -2px rgba(192, 132, 252, 0.1);
}


.collection-area {
    background-color: #ffffff;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 0;
    border: 1px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}

/* Sticky Collection Area - Always sticky across all devices */
.sticky-collection {
    /* Fallback for older browsers */
    position: relative;
    /* Modern sticky positioning */
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 2rem;
    background-color: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    padding-top: 1rem;
    padding-bottom: 1rem;
    will-change: transform;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Feature detection support */
@supports (position: sticky) {
    .sticky-collection {
        position: sticky;
    }
}

@supports (position: -webkit-sticky) {
    .sticky-collection {
        position: -webkit-sticky;
    }
}

/* Enhanced sticky behavior for all screen sizes */
@media (max-width: 640px) {
    .sticky-collection {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 100;
        margin-bottom: 1.5rem;
        background-color: rgba(248, 250, 252, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid #e2e8f0;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        will-change: transform;
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Horizontal layout for textarea and buttons */
.collection-content {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#lenny-collection {
    flex: 1;
    height: 3rem;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-sizing: border-box;
    resize: none;
    font-size: 0.875rem;
    min-width: 0;
    width: 100%;
}

#lenny-collection:focus {
    outline: none;
    border-color: transparent;
    box-shadow: 0 0 0 2px #3b82f6;
}

/* Touch-friendly improvements for mobile */
@media (max-width: 640px) {
    /* Improve touch targets for mobile */
    .lenny-face-container {
        min-height: 60px;
        padding: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .lenny-face {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-user-select: all;
        -khtml-user-select: all;
        -moz-user-select: all;
        -ms-user-select: all;
        user-select: all;
    }
    
    .add-to-collection {
        min-width: 44px;
        min-height: 44px;
        font-size: 1.25rem;
        padding: 0.5rem;
        border-radius: 0.375rem;
        touch-action: manipulation;
    }
    
    .add-to-collection:active {
        background-color: rgba(59, 130, 246, 0.1);
        transform: scale(0.95);
    }
}

.collection-buttons {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.collection-buttons button {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 0.375rem;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.875rem;
    white-space: nowrap;
    height: 3rem;
}

#clear-btn {
    background-color: #ef4444;
}
#clear-btn:hover {
    background-color: #dc2626;
}

#copy-collection-btn {
    background-color: #3b82f6;
}
#copy-collection-btn:hover {
    background-color: #2563eb;
}

/* Lenny Faces Grid */
#lenny-grid, .category-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.lenny-face-container {
    background-color: #ffffff;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.lenny-face-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.lenny-face {
    font-size: 1.5rem;
    user-select: all;
    cursor: pointer;
    word-break: break-all;
    overflow-wrap: break-word;
    flex: 1;
    min-width: 0;
    text-align: center;
}

.add-to-collection {
    font-size: 1.5rem;
    color: #9ca3af;
    transition: color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
}

.add-to-collection:hover {
    color: #3b82f6;
}

/* Page Load Status for Infinite Scroll */
.page-load-status {
    margin: 2rem 0;
    text-align: center;
    font-size: 1.125rem;
}
.page-load-status .infinite-scroll-request { 
    display: none;
    color: #3b82f6;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.1s ease-in;
}
.page-load-status .infinite-scroll-request.show {
    opacity: 1;
}
.page-load-status .infinite-scroll-last { 
    display: none;
    color: #6b7280;
    font-style: italic;
    opacity: 0;
    transition: opacity 0.2s ease-in;
}
.page-load-status .infinite-scroll-last.show {
    opacity: 1;
}
.page-load-status .infinite-scroll-error { 
    display: none;
    color: #ef4444;
}


/* Action Buttons (Scroll Top) */
.action-btn {
    position: fixed;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}



#scroll-top-btn {
    width: 3rem;
    height: 3rem;
    background-color: #3b82f6;
    color: white;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

#scroll-top-btn:hover {
    background-color: #2563eb;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

#scroll-top-btn svg {
    height: 1.25rem;
    width: 1.25rem;
}



/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    background-color: #ffffff;
    margin-top: 3rem;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    width: 100%;
}

/* Toast Notification */
#toast {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    background-color: #22c55e;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0;
    transition: opacity 0.3s;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 45; /* Between header and sidebar */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Grid Styles */
@media (max-width: 640px) {
    /* Mobile Header Fixes */
    .main-header {
        padding: 0.75rem 0;
        margin-bottom: 1.5rem;
        position: relative;
        z-index: 40;
    }
    
    .header-content {
        padding: 0 0.75rem;
        gap: 0.75rem;
        align-items: center;
        justify-content: flex-start;
    }
    
    .menu-toggle {
        padding: 0.75rem;
        min-width: 44px;
        min-height: 44px;
        border-radius: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .menu-toggle:active {
        background-color: #e5e7eb;
        transform: scale(0.95);
    }
    
    .menu-toggle svg {
        width: 1.25rem;
        height: 1.25rem;
        color: #374151;
    }
    
    .site-branding {
        flex: 1;
        text-align: center;
    }
    
    .site-title {
        font-size: 1.5rem;
        font-weight: 700;
        margin: 0;
        line-height: 1.2;
    }
    
    .site-title a {
        color: #1f2937;
        text-decoration: none;
        display: block;
        padding: 0.5rem;
        border-radius: 0.375rem;
        transition: all 0.2s ease;
        touch-action: manipulation;
    }
    
    .site-title a:active {
        background-color: rgba(59, 130, 246, 0.1);
        transform: scale(0.98);
    }
    .content-wrapper {
        padding: 0 0.75rem 2rem 0.75rem;
    }
    
    .header-content {
        padding: 0 0.75rem;
    }
    
    /* Enhanced Collection Area Mobile Responsiveness */
    .collection-area {
        padding: 0.875rem;
        margin-bottom: 1.5rem;
    }
    
    .collection-content {
        flex-direction: column;
        gap: 0.875rem;
        align-items: stretch;
    }
    
    #lenny-collection {
        height: 4rem;
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 0.5rem;
        line-height: 1.4;
        resize: vertical;
        min-height: 4rem;
        max-height: 8rem;
    }
    
    #lenny-collection:focus {
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    }
    
    .collection-buttons {
        flex-direction: row;
        gap: 0.75rem;
        align-self: stretch;
        justify-content: space-between;
    }
    
    .collection-buttons button {
        flex: 1;
        padding: 0.875rem 1rem;
        font-size: 1rem;
        font-weight: 600;
        height: 3.5rem;
        border-radius: 0.5rem;
        min-height: 44px; /* iOS touch target minimum */
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        transition: all 0.2s ease;
    }
    
    .collection-buttons button:active {
        transform: scale(0.95);
    }
    
    #clear-btn:active {
        background-color: #b91c1c;
    }
    
    #copy-collection-btn:active {
        background-color: #1d4ed8;
    }
    
    .category-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    
    .category-title {
        font-size: 1.25rem;
        word-break: break-word;
    }
    
    .lenny-face {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .lenny-face-container {
        padding: 0.75rem;
    }
    
    /* Mobile action buttons */
    .action-btn {
        right: 0.75rem;
        top: 60%;
    }
    
    #scroll-top-btn {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    #scroll-top-btn svg {
        height: 1rem;
        width: 1rem;
    }
}

/* Extra small mobile devices (up to 480px) */
@media (max-width: 480px) {
    /* Extra Small Mobile Header Optimizations */
    .main-header {
        padding: 0.625rem 0;
        margin-bottom: 1.25rem;
    }
    
    .header-content {
        padding: 0 0.5rem;
        gap: 0.5rem;
    }
    
    .menu-toggle {
        padding: 0.625rem;
        min-width: 44px;
        min-height: 44px;
    }
    
    .menu-toggle svg {
        width: 1.125rem;
        height: 1.125rem;
    }
    
    .site-title {
        font-size: 1.25rem;
        font-weight: 700;
    }
    
    .site-title a {
        padding: 0.375rem 0.5rem;
        border-radius: 0.25rem;
    }
    .content-wrapper {
        padding: 0 0.5rem 2rem 0.5rem;
    }
    
    .header-content {
        padding: 0 0.5rem;
    }
    
    .collection-area {
        padding: 0.75rem;
        margin-bottom: 1.25rem;
    }
    
    .collection-content {
        gap: 0.75rem;
    }
    
    #lenny-collection {
        height: 3.5rem;
        padding: 0.625rem;
        font-size: 0.875rem;
        min-height: 3.5rem;
        max-height: 7rem;
    }
    
    .collection-buttons {
        gap: 0.5rem;
    }
    
    .collection-buttons button {
        padding: 0.75rem 0.875rem;
        font-size: 0.875rem;
        height: 3rem;
        min-height: 44px;
    }
    
    /* Toast notification positioning for small screens */
    #toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        text-align: center;
        border-radius: 0.375rem;
    }
}

/* Tablet responsive styles */
@media (min-width: 641px) and (max-width: 1023px) {
    /* Tablet Header Optimizations */
    .main-header {
        padding: 0.875rem 0;
        margin-bottom: 1.75rem;
    }
    
    .header-content {
        padding: 0 1rem;
        gap: 0.875rem;
    }
    
    .menu-toggle {
        padding: 0.625rem;
    }
    
    .menu-toggle svg {
        width: 1.375rem;
        height: 1.375rem;
    }
    
    .site-title {
        font-size: 1.75rem;
        font-weight: 700;
    }
    .collection-content {
        gap: 1rem;
    }
    
    #lenny-collection {
        height: 3.25rem;
        padding: 0.625rem;
        font-size: 0.9375rem;
    }
    
    .collection-buttons button {
        padding: 0.625rem 1rem;
        font-size: 0.9375rem;
        height: 3.25rem;
        min-width: 80px;
    }
}

@media (min-width: 640px) { /* sm */
    #lenny-grid, .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) { /* md */
    #lenny-grid, .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) { /* lg */
    #lenny-grid, .category-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
