/* Hide only the Eye Dropper tool from the bottom menu bar */
.bottom-controls .tooltip-wrapper[data-tooltip="Eye Dropper"] {
    display: none !important;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation;
    outline: none !important;
}

/* Remove any dotted outlines or debug borders */
*:focus,
*:focus-visible,
*:active {
    outline: none !important;
    border: none !important;
}

/* Remove browser debugging outlines */
div,
section,
article,
main,
body {
    outline: none !important;
}

/* Auth button styling within top controls */
#auth-toggle-btn {
    display: flex; /* Always show by default */
}

/* Hide auth button for logged-in users */
body.logged-in #auth-toggle-btn {
    display: none !important;
}

/* Disabled state for download buttons when not logged in */
.control-btn.disabled-guest {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(50%);
    pointer-events: auto; /* Allow clicks to show login message */
}

.control-btn.disabled-guest:hover svg {
    transform: none; /* Disable hover animation */
}

.mobile-menu-item.disabled-guest {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: auto; /* Allow clicks to show login message */
}

/* Additional styling for disabled download buttons */
.control-btn.disabled-guest::after {
    content: '🔒';
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 10px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Eye Control: lightweight UI */
#eye-cursor {
    position: fixed;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(59,130,246,0.95);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 120ms ease;
}

.eye-overlay {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: rgba(17,17,17,0.85);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 9999;
    backdrop-filter: saturate(140%) blur(6px);
}

/* Hide debug surface on mobile unless enabled */
#eye-debug {
    position: fixed;
    right: 12px;
    bottom: 12px;
    width: 160px;
    height: 120px;
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
    z-index: 9998;
}

/* Hand Control: cursor and preview */
#hand-cursor {
    position: fixed;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(34,197,94,0.95); /* green on idle */
    box-shadow: 0 0 0 3px rgba(34,197,94,0.25);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

#hand-debug {
    position: fixed;
    right: 12px;
    bottom: 144px; /* stack above eye preview */
    width: 200px;
    height: 150px;
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
    z-index: 9998;
}

:root {
    /* Color System */
    --primary-color: #000000;
    --text-color: #111111;
    --bg-color: #ffffff;
    --bg-color-alt: #111111;
    --secondary-color: #ffffff; /* Secondary color for brush empty spaces */
    
    /* Adaptive Grid Lines */
    --grid-line-color: rgba(0, 0, 0, 0.08);
    --grid-line-opacity: 0.08;
    
    /* Glassmorphism UI */
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --glass-blur: blur(16px);
    --glass-dark-bg: rgba(0, 0, 0, 0.2);
    --glass-dark-border: rgba(255, 255, 255, 0.1);
    
    /* UI Tokens */
    --ui-radius: 16px;
    --ui-radius-lg: 24px;
    --ui-radius-full: 50%;
    --ui-spacing-xs: 4px;
    --ui-spacing-sm: 8px;
    --ui-spacing-md: 16px;
    --ui-spacing-lg: 24px;
    --ui-spacing-xl: 32px;
    
    /* Button Sizing */
    --btn-size-sm: 44px;
    --btn-size-md: 56px;
    --btn-size-lg: 64px;
    
    /* Animations */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Panel Styling */
    --panel-bg: rgba(20, 20, 20, 0.95);
    --panel-text: #ffffff;
    --panel-radius: var(--ui-radius-lg);
    --panel-shadow: 0 20px 64px rgba(0, 0, 0, 0.5);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-color);
    background: #2f3032;
    overscroll-behavior: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* App Logo */
.app-logo {
    position: fixed;
    top: var(--ui-spacing-md);
    left: var(--ui-spacing-lg);
    z-index: 1000;
    color: #191919; /* Black color */
    transition: opacity 0.3s ease;
    pointer-events: none;
    width: 80px; /* Fixed 80px width */
}

.app-logo svg {
    width: 80px;
    height: auto;
}

.app-logo:hover {
    opacity: 0.7;
}

/* Logo display control */
.logo-mobile {
    display: none;
}

.logo-desktop {
    display: block;
}

/* Responsive logo sizing */
@media (max-width: 768px) {
    .app-logo {
        top: var(--ui-spacing-lg);
        left: var(--ui-spacing-md);
        width: 50px; /* Smaller on mobile */
    }
    
    .app-logo svg {
        width: 32px;
    }
    
    /* Switch to mobile logo */
    .logo-mobile {
        display: block;
    }
    
    .logo-desktop {
        display: none;
    }
}

/* Infinite Canvas Container - Full Viewport */
#canvasContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #eaeaea;

    transition: background-color var(--transition-fast) ease;
    cursor: crosshair;
}

/* Hand tool cursor when space is pressed */
body.space-pressed #canvasContainer {
    cursor: grab;
}

body.space-pressed #canvasContainer.dragging {
    cursor: grabbing;
}

/* Hand cursor on pixels when space is pressed */
body.space-pressed .pixel {
    cursor: grab;
}

body.space-pressed .pixel:hover {
    cursor: grab;
}

/* Canvas Wrapper for Infinite Space */
#canvasWrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    will-change: transform;
    pointer-events: none; /* Let events pass through to container */
}

/* Infinite Grid - Dynamic sizing to match pixels */
#pixel-grid {
    position: absolute;
    top: 0;
    left: 0;
    /* width and height set dynamically by JavaScript to match pixel layout */

    /* display: grid; - REMOVED: Conflicts with absolute positioning */
    /* gap: 0; - REMOVED: Not needed without grid */
    background-color: var(--bg-color);
    transition: background-color var(--transition-fast) ease;
    pointer-events: auto; /* Re-enable events for the grid */
    z-index: 2;
    /* Remove the dense background pattern - it was causing the issue */
    /* Performance optimizations - minimal for speed */
    will-change: auto;
}

/* Pixel styling for infinite canvas */
.pixel {
    background-color: transparent;
    border: 0.5px solid var(--grid-line-color);
    box-sizing: border-box;
    cursor: crosshair;
    transition: background-color 0.1s ease;
    /* Performance optimizations - minimal */
    will-change: auto;
}

.pixel:hover {
    border-color: rgba(0, 0, 0, 0.3);
}

/* Panning states for infinite canvas */
#canvasContainer.panning {
    cursor: grab !important;
}

#canvasContainer.panning.grabbing {
    cursor: grabbing !important;
    user-select: none;
}

/* Hide scrollbars for infinite canvas */
#canvasContainer::-webkit-scrollbar {
    display: none;
}

#canvasContainer {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Mobile responsive infinite canvas */
@media (max-width: 767px) {
    #canvasContainer {
        /* Infinite canvas works the same on mobile */
    }
}

@media (max-width: 480px) {
    #canvasContainer {
        /* Infinite canvas works the same on mobile */
    }
}

#pixel-grid.dark-bg {
    background-color: var(--bg-color-alt);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Grid Background Toggle Animation */
#pixel-grid.transitioning {
    animation: backgroundFlip var(--transition-slow) var(--bounce);
}

@keyframes backgroundFlip {
    0% { transform: rotateY(0deg); }
    50% { 
        transform: rotateY(90deg); 
        box-shadow: var(--glass-shadow), 0 0 50px rgba(0, 0, 0, 0.3);
    }
    100% { transform: rotateY(0deg); }
}

/* ===============================
   Grid Line Adaptive Styles
   =============================== */

.pixel {
    /* aspect-ratio: 1/1; - REMOVED: Conflicts with fixed dimensions */
    border: 0.5px solid var(--grid-line-color);
    transition: all var(--transition-fast), border-color 0.2s ease;
    cursor: crosshair;
    position: relative;
}

#pixel-grid.dark-bg .pixel {
    border-color: var(--grid-line-color);
}

.pixel:active {
    transform: scale(1.05);
    z-index: 10;
}

.pixel.highlight {
    animation: pixelPulse 0.6s ease-out;
    z-index: 5;
}

@keyframes pixelPulse {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    70% { 
        transform: scale(1.1); 
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* Shape styles */

/* FRESH CIRCLE BRUSH - Brand new implementation */
.pixel-circle-fresh {
    position: relative;
    overflow: hidden;
    border: none !important;
    /* Background color is set inline in JavaScript like other brushes */
}

.pixel-circle-fresh::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    background-color: var(--shape-color, var(--primary-color));
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* ROUNDED SQUARE BRUSH - Fixed implementation (same approach as circle brush) */
.pixel-rounded-square {
    position: relative;
    overflow: hidden;
    border: none !important;
    /* Background color is set inline in JavaScript like other brushes */
}

.pixel-rounded-square::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    background-color: var(--shape-color, var(--primary-color));
    border-radius: 6px;
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* DIAMOND BRUSH - Fixed implementation (same approach as circle brush) */
.pixel-diamond {
    position: relative;
    overflow: hidden;
    border: none !important;
    /* Background color is set inline in JavaScript like other brushes */
}

.pixel-diamond::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    background-color: var(--shape-color, var(--primary-color));
    transform: translate(-50%, -50%) rotate(45deg);
    z-index: 1;
}

.pixel-triangle {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth triangle shape */
}

.pixel-triangle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    z-index: 1;
}

.pixel-triangle-90 {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth triangle shape */
}

.pixel-triangle-90::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
    z-index: 1;
}

.pixel-triangle-180 {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth triangle shape */
}

.pixel-triangle-180::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
    z-index: 1;
}

.pixel-triangle-270 {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth triangle shape */
}

.pixel-triangle-270::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: polygon(100% 0%, 100% 100%, 0% 50%);
    z-index: 1;
}

/* Half-circle styles */
.pixel-half-circle {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
}

.pixel-half-circle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: ellipse(50% 50% at 50% 100%);
    z-index: 1;
}

.pixel-half-circle-90 {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
}

.pixel-half-circle-90::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: ellipse(50% 50% at 0% 50%);
    z-index: 1;
}

.pixel-half-circle-180 {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
}

.pixel-half-circle-180::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: ellipse(50% 50% at 50% 0%);
    z-index: 1;
}

.pixel-half-circle-270 {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
}

.pixel-half-circle-270::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: ellipse(50% 50% at 100% 50%);
    z-index: 1;
}

/* Diagonal split styles */
.pixel-split {
    position: relative;
    overflow: hidden;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.pixel-split::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 102%;
    background-color: var(--secondary-color, #ffffff);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    z-index: 1;
}

.pixel-split-2 {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.pixel-split-2::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 102%;
    background-color: var(--secondary-color, #ffffff);
    clip-path: polygon(100% 0%, 0% 100%, 0% 0%);
    z-index: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.pixel-split-3 {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.pixel-split-3::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 102%;
    background-color: var(--secondary-color, #ffffff);
    clip-path:  polygon(0 0, 100% 100%, 0 100%);
    z-index: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.pixel-split-4 {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.pixel-split-4::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 102%;
    background-color: var(--secondary-color, #ffffff);
    clip-path:polygon(0 0, 100% 0, 100% 100%);
    z-index: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.pixel-split-5 {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.pixel-split-5::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 102%;
    background-color: var(--secondary-color, #ffffff);
    clip-path: polygon(100% 0%, 100% 100%, 0% 100%);
    z-index: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Floating Controls */
.floating-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    outline: none !important;
    border: none !important;
}

.control-btn {
    width: var(--btn-size-md);
    height: var(--btn-size-md);
    border-radius: var(--ui-radius);
    background: rgba(255, 255, 255, 0); /* Hover detection background */
    /* backdrop-filter: var(--glass-blur); */
    color: #1b1b1b;
    border: 0px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* box-shadow: var(--glass-shadow); */
    transition: all var(--transition-fast);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

/* Removed button hover animations - moved to icons */

.control-btn:active {
    /* Minimal active state */
    transform: scale(0.98);
}

/* Removed buttonPulse animation - using icon animations instead */

.control-btn.active {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
    transform: scale(1.05);
}

.control-btn svg {
    width: 24px;
    height: 24px;
    /*stroke-width: 2px;*/
    transition: all var(--transition-fast);
    /*filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));*/
    transform: scale(1);
}

/* Icon hover animations instead of button animations */
.control-btn:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.3));
}

.control-btn:active svg {
    transform: scale(0.95);
}

/* Top controls */
.top-controls {
    position: fixed;
    top: var(--ui-spacing-lg);
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: normal;
    justify-content: flex-end;
    align-items: center;
    padding: 0 var(--ui-spacing-lg);
    pointer-events: none;
    z-index: 101;
    outline: none !important;
    border: none !important;
    gap: var(--ui-spacing-md); /* Add gap between controls */
}

.top-controls > * {
    pointer-events: auto;
}

/* History controls - grouped with glassmorphic container */
.history-controls {
    display: flex;
    gap: var(--ui-spacing-lg);
    background: rgb(255 255 255 / 0%);
    /* backdrop-filter: var(--glass-blur); */
    border: 0px solid var(--glass-border);
    border-radius: var(--ui-radius);
    padding: var(--ui-spacing-xs);
    padding-left: 7rem;
    /* box-shadow: var(--glass-shadow); */
}

.history-controls .control-btn {
    background: transparent;
    border: none;
    box-shadow: none;
    width: var(--btn-size-sm);
    height: var(--btn-size-sm);
}

/* Right controls */
.right-controls {
    display: flex;
    gap: var(--ui-spacing-sm);
}

/* Modern Minimal Bottom Controls */
.bottom-controls {
    position: fixed;
    bottom: var(--ui-spacing-xl);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    z-index: 101;
    cursor: grab;
    width: fit-content !important;
    height: fit-content !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    touch-action: none;
}

.bottom-controls:active {
    cursor: grabbing;
    transform: translateX(-50%) scale(1.02);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.bottom-controls.dragging {
    cursor: grabbing;
    transition: none !important;
    transform: scale(1.01);
    box-shadow: 
        0 16px 50px rgba(0, 0, 0, 0.2),
        0 6px 20px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: 102;
}

.bottom-controls.dragging * {
    transition: none !important;
}

/* Visual feedback when approaching edges during drag */
.bottom-controls.approaching-left {
    border-left: 3px solid rgba(102, 126, 234, 0.8);
}

.bottom-controls.approaching-right {
    border-right: 3px solid rgba(102, 126, 234, 0.8);
}

.bottom-controls.approaching-top {
    border-top: 3px solid rgba(239, 68, 68, 0.8);
}

.bottom-controls.approaching-bottom {
    border-bottom: 3px solid rgba(34, 197, 94, 0.8);
}

/* Position-based layouts */
.bottom-controls.position-left,
.bottom-controls.position-right {
    flex-direction: column;
    padding: 16px 12px;
    gap: var(--ui-spacing-sm);
    /* Prevent height expansion - keep compact even in vertical mode */
    height: auto !important;
    max-height: fit-content !important;
    width: auto !important;
    max-width: fit-content !important;
    /* Additional constraints to prevent expansion */
    flex: 0 0 auto;
    align-self: flex-start;
    /* Absolute failsafe against expansion */
    min-height: unset !important;
    box-sizing: border-box !important;
}

.bottom-controls.position-top {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

.bottom-controls.position-bottom {
    flex-direction: row;
    padding: 12px 20px;
    gap: var(--ui-spacing-md);
}

.bottom-controls.position-floating {
    flex-direction: row;
    padding: 12px 20px;
    gap: var(--ui-spacing-md);
    border-radius: 20px;
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Mobile-specific enhancements for modern controls */
@media (max-width: 768px) {
    .bottom-controls {
        padding: 10px;
        gap: 4px;
        backdrop-filter: blur(25px) saturate(200%);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.5),
            0 2px 16px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.08);
    }
    
    .bottom-controls .control-btn {
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }
    
    .bottom-controls .control-btn svg,
    .bottom-controls .control-btn .color-preview {
        width: 22px;
        height: 22px;
    }
    
    .bottom-controls.position-left,
    .bottom-controls.position-right {
        padding: 12px 10px;
        gap: 6px;
        height: auto !important;
        max-height: fit-content !important;
        width: auto !important;
        max-width: fit-content !important;
    }
    
    .bottom-controls.position-bottom {
        padding: 10px;
        gap: 4px;
    }
    
    /* Enhanced touch feedback */
    .bottom-controls .control-btn:active {
        transform: scale(0.92);
        background: rgba(255, 255, 255, 0.15);
        transition: all 0.1s ease;
    }
}

/* Extra small screens - more compact but still touch-friendly */
@media (max-width: 480px) {
    .bottom-controls {
        padding: 12px 20px;
        gap: 10px;
    }
    
    .bottom-controls .control-btn {
        width: 48px;
        height: 48px;
    }
    
    .bottom-controls.position-left,
    .bottom-controls.position-right {
        padding: 16px 12px;
        gap: 10px;
        /* Maintain compact size on small screens */
        height: auto !important;
        max-height: fit-content !important;
        width: auto !important;
        max-width: fit-content !important;
    }
}

@keyframes slideUp {
    0% { 
        transform: translateX(-50%) translateY(60px);
        opacity: 0;
        scale: 0.9;
        filter: blur(4px);
    }
    60% {
        transform: translateX(-50%) translateY(-2px);
        scale: 1.01;
        filter: blur(0px);
    }
    100% { 
        transform: translateX(-50%) translateY(0);
        opacity: 1;
        scale: 1;
        filter: blur(0px);
    }
}

/* Subtle stagger animation for control buttons */
.bottom-controls .control-btn {
    animation: fadeInScale 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) backwards;
}

.bottom-controls .control-btn:nth-child(1) { animation-delay: 0.1s; }
.bottom-controls .control-btn:nth-child(2) { animation-delay: 0.15s; }
.bottom-controls .control-btn:nth-child(3) { animation-delay: 0.2s; }
.bottom-controls .control-btn:nth-child(4) { animation-delay: 0.25s; }
.bottom-controls .control-btn:nth-child(5) { animation-delay: 0.3s; }
.bottom-controls .control-btn:nth-child(6) { animation-delay: 0.35s; }
.bottom-controls .control-btn:nth-child(7) { animation-delay: 0.4s; }

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.8);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0px);
    }
}

/* Modern focus states */
.bottom-controls .control-btn:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 0 0 2px rgba(255, 255, 255, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.2);
}

.bottom-controls .control-btn {
    background: transparent;
    border: none;
    box-shadow: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: auto;
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

  .bottom-controls .control-btn:hover {
     background: rgba(255, 255, 255, 0.08);
     transform: translateY(-1px) scale(1.02);
     box-shadow: 
         0 4px 12px rgba(0, 0, 0, 0.2),
         0 2px 6px rgba(0, 0, 0, 0.1);
  }

.bottom-controls .control-btn:active {
    transform: translateY(0) scale(0.96);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

/* Modern icon styling for bottom controls */
.bottom-controls .control-btn svg,
.bottom-controls .control-btn .color-preview {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.9);
    stroke-width: 1.5;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: none;
}

.bottom-controls .control-btn:hover svg,
.bottom-controls .control-btn:hover .color-preview {
    transform: scale(1.05);
    color: rgba(255, 255, 255, 1);
}

/* Modern active states for control buttons */
.bottom-controls .control-btn.active {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.bottom-controls .control-btn.active svg,
.bottom-controls .control-btn.active .color-preview {
    color: rgba(255, 255, 255, 1);
    transform: scale(1);
}

/* Toggle Indicator for buttons with hover menus */
.bottom-controls .control-btn {
    position: relative;
}

.bottom-controls .control-btn .toggle-indicator {
    position: absolute;
    top: 50%;
    right: 2px;
    transform: translateY(-50%);
    width: 8px !important;
    height: 8px !important;
    color: rgba(255, 255, 255, 0.6);
    stroke-width: 2;
    opacity: 0.8;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.bottom-controls .control-btn:hover .toggle-indicator {
    color: rgba(255, 255, 255, 0.9);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.bottom-controls .control-btn.active .toggle-indicator {
    color: rgba(255, 255, 255, 1);
    opacity: 1;
}

/* Eraser active state */
.bottom-controls .control-btn.eraser-active {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    transform: scale(1.02);
    box-shadow: 
        0 4px 16px rgba(239, 68, 68, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.bottom-controls .control-btn.eraser-active svg {
    color: #ef4444;
    filter: drop-shadow(0 2px 8px rgba(239, 68, 68, 0.4));
}

/* Hand tool active state */
.bottom-controls .control-btn.hand-tool-active {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    transform: scale(1.02);
    box-shadow: 
        0 4px 16px rgba(34, 197, 94, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.bottom-controls .control-btn.hand-tool-active svg {
    color: #22c55e;
    filter: drop-shadow(0 2px 8px rgba(34, 197, 94, 0.4));
}

/* Light shadow tool active states */
.bottom-controls .control-btn.highlight-active {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.4);
    transform: scale(1.02);
    box-shadow: 
        0 4px 16px rgba(255, 215, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.bottom-controls .control-btn.highlight-active svg {
    color: #e6ac00;
    filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.4));
}

.bottom-controls .control-btn.shadow-active {
    background: rgba(75, 85, 99, 0.2);
    border-color: rgba(75, 85, 99, 0.4);
    transform: scale(1.02);
    box-shadow: 
        0 4px 16px rgba(75, 85, 99, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.bottom-controls .control-btn.shadow-active svg {
    color: #6b7280;
    filter: drop-shadow(0 2px 8px rgba(75, 85, 99, 0.4));
}

/* Modal Panels */
.modal-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-panel.visible {
    opacity: 1;
    visibility: visible;
}

.panel-content {
    background: var(--panel-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-dark-border);
    border-radius: var(--panel-radius);
    padding: var(--ui-spacing-xl);
    box-shadow: var(--panel-shadow);
    color: var(--panel-text);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.7);
    transition: transform var(--transition-normal) var(--bounce);
}

.modal-panel.visible .panel-content {
    transform: scale(1);
}

.panel-content h3 {
    margin-bottom: var(--ui-spacing-lg);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: var(--panel-text);
}

/* Form Controls */
input[type="range"] {
    width: 100%;
    height: 8px;
    background: var(--glass-dark-bg);
    border-radius: var(--ui-spacing-xs);
    outline: none;
    margin: var(--ui-spacing-lg) 0;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: var(--ui-radius-full);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type="color"] {
    width: 50%;
    height: 60px;
    border: none;
    border-radius: var(--ui-radius);
    /*margin-bottom: var(--ui-spacing-lg);*/
    cursor: pointer;
    background: transparent;
}

input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--glass-border);
    border-radius: var(--ui-radius);
}

/* Color Presets */
.color-presets {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--ui-spacing-sm);
    margin-bottom: var(--ui-spacing-lg);
}

/* Canvas Settings Panel Styles */
.canvas-section {
    margin-bottom: var(--ui-spacing-xl);
    padding-bottom: var(--ui-spacing-lg);
    border-bottom: 1px solid var(--glass-dark-border);
}

.canvas-section:last-of-type {
    border-bottom: none;
    margin-bottom: var(--ui-spacing-lg);
    display: none;
}

.canvas-section h4 {
    margin-bottom: var(--ui-spacing-md);
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--panel-text);
}

.preset-section {
    margin-bottom: var(--ui-spacing-lg);
}

.preset-section label {
    display: block;
    margin-bottom: var(--ui-spacing-sm);
    font-weight: 500;
    color: var(--panel-text);
}

#presetSelect {
    width: 100%;
    padding: var(--ui-spacing-sm) var(--ui-spacing-md);
    background: var(--glass-dark-bg);
    border: 1px solid var(--glass-dark-border);
    border-radius: var(--ui-radius);
    color: var(--panel-text);
    font-size: 1rem;
    outline: none;
    cursor: pointer;
}

#presetSelect:focus {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.custom-size-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--ui-spacing-md);
    margin-bottom: var(--ui-spacing-lg);
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    margin-bottom: var(--ui-spacing-xs);
    font-weight: 500;
    color: var(--panel-text);
    font-size: 0.9rem;
}

.input-group input[type="number"] {
    padding: var(--ui-spacing-sm) var(--ui-spacing-md);
    background: var(--glass-dark-bg);
    border: 1px solid var(--glass-dark-border);
    border-radius: var(--ui-radius);
    color: var(--panel-text);
    font-size: 1rem;
    outline: none;
}

.input-group input[type="number"]:focus {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.apply-btn {
    width: 100%;
    padding: var(--ui-spacing-md);
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: var(--ui-radius);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.apply-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.apply-btn:active {
    transform: translateY(0);
}

/* Zoom Panel Styles */
.zoom-display {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--ui-radius);
    padding: var(--ui-spacing-sm);
    text-align: center;
    margin-bottom: var(--ui-spacing-md);
}

.zoom-display span {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
}

.zoom-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: var(--ui-spacing-xs);
}

.color-preset {
    width: 44px;
    height: 44px;
    border: 2px solid var(--glass-border);
    border-radius: var(--ui-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-preset:active {
    transform: scale(0.9);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Download Options */
.download-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--ui-spacing-sm);
    margin-bottom: var(--ui-spacing-lg);
}

.option-btn {
    padding: var(--ui-spacing-md);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    color: var(--panel-text);
    border: 1px solid var(--glass-border);
    border-radius: var(--ui-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left var(--transition-normal);
}

.option-btn:hover::before {
    left: 100%;
}

.option-btn:active {
    transform: scale(0.95);
    background: rgba(59, 130, 246, 0.3);
}

.close-btn {
    width: 100%;
    padding: var(--ui-spacing-md);
    background: rgba(239, 68, 68, 0.2);
    backdrop-filter: var(--glass-blur);
    color: var(--panel-text);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--ui-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.close-btn:active {
    transform: scale(0.95);
    background: rgba(239, 68, 68, 0.4);
}

/* Corner/Context Menus */
.corner-menu {
    position: absolute;
    background: transparent; /* Transparent background for contextual positioning */
    backdrop-filter: none;
    border: none;
    border-radius: var(--ui-radius-lg);
    padding: 0; /* Remove padding for individual button positioning */
    box-shadow: none; /* Individual buttons will have shadows */
    display: block; /* Change from flex to block for absolute positioning */
    gap: 0; /* Remove gap as buttons are positioned individually */
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: all var(--transition-fast);
    z-index: 200;
    pointer-events: auto;
    width: 100%; /* Take full width for absolute positioning */
    height: 100%; /* Take full height for absolute positioning */
    top: 0;
    left: 0;
}

.corner-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* Contextually positioned menus */
.corner-menu.positioned-contextual {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.corner-btn {
    width: 36px;
    height: 36px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--ui-spacing-sm);
    color: #000000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--glass-shadow);
    position: relative; /* Default positioning */
}

/* When in contextual positioning mode, buttons use absolute positioning */
.corner-menu.positioned-contextual .corner-btn {
    position: absolute;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.corner-btn:hover {
    background: var(--glass-dark-bg);
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.corner-menu.positioned-contextual .corner-btn:hover {
    background: rgba(50, 50, 50, 0.98);
    transform: scale(1.15);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.corner-btn:active {
    transform: scale(0.95);
    background: rgba(59, 130, 246, 0.3);
}

.corner-menu.positioned-contextual .corner-btn:active {
    transform: scale(1.05);
    background: rgba(59, 130, 246, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.6);
}

/* Mobile-friendly touch targets */
@media (max-width: 768px) {
    .corner-btn {
        width: 44px;
        height: 44px;
        border-radius: var(--ui-radius);
    }
    
    .corner-menu.positioned-contextual .corner-btn {
        width: 48px;
        height: 48px;
        box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
        background: rgba(30, 30, 30, 0.95);
        color: #ffffff;
    }
    
    .corner-btn:hover {
        transform: scale(1.05); /* Reduced hover scale for mobile */
    }
    
    .corner-menu.positioned-contextual .corner-btn:hover {
        transform: scale(1.1);
        background: rgba(50, 50, 50, 0.98);
    }
}

/* Responsive Design */
@media (min-width: 768px) {
    .control-btn {
        width: var(--btn-size-lg);
        height: var(--btn-size-sm);
    }
    
    .control-btn svg {
        width: 28px;
        height: 28px;
    }
    
    .top-controls, .bottom-controls {
        /*padding: 0 var(--ui-spacing-xl);*/
    }
    
    .top-controls {
       /* top: var(--ui-spacing-md);*/
    }
    
    .bottom-controls {
        bottom: var(--ui-spacing-xl);
    }
    
    .panel-content {
        padding: 2.5rem;
        min-width: 400px;
    }
}

@media (orientation: portrait) and (max-width: 768px) {
    /* Infinite canvas works the same in portrait */
    .top-controls {
       /* top: env(safe-area-inset-top, var(--ui-spacing-md));*/
    }
    
    .bottom-controls {
        bottom: calc(env(safe-area-inset-bottom, 10px) + var(--ui-spacing-xl));
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    /* Infinite canvas works the same in landscape */
    .control-btn {
        width: var(--btn-size-sm);
        height: var(--btn-size-sm);
    }
    
    .control-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* Quarter Circle Styles */
.pixel-quarter-top-left {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
    
}

.pixel-quarter-top-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: circle(100% at 0 0);
    z-index: 1;
}

.pixel-quarter-top-right {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
    
}

.pixel-quarter-top-right::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: circle(100% at 100% 0);
    z-index: 1;
}

.pixel-quarter-bottom-left {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
   
}

.pixel-quarter-bottom-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: circle(100% at 0 100%);
    z-index: 1;
}

.pixel-quarter-bottom-right {
    position: relative;
    overflow: hidden;
    border: none !important; /* Remove borders for smooth shape */
    
}

.pixel-quarter-bottom-right::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    clip-path: circle(100% at 100% 100%);
    z-index: 1;
}

/* Accessibility & Focus States */
.control-btn:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.8);
    outline-offset: 2px;
}

.corner-btn:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.8);
    outline-offset: 1px;
}

/* Loading Animation */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.loading {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* Size Display and Labels */
.size-display {
    text-align: center;
    margin-bottom: var(--ui-spacing-lg);
}

.size-display span {
    font-size: 2rem;
    font-weight: 700;
    color: var(--panel-text);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.size-labels {
    display: flex;
    justify-content: space-between;
    margin-top: var(--ui-spacing-sm);
    margin-bottom: var(--ui-spacing-lg);
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Download Options with Icons */
.option-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ui-spacing-sm);
    flex-direction: column;
    padding: var(--ui-spacing-lg) var(--ui-spacing-md);
    min-height: 80px;
    text-align: center;
}

.option-btn svg {
    transition: all var(--transition-fast);
}

.option-btn:hover svg {
    transform: scale(1.1);
}

/* Close button with icon */
.close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ui-spacing-sm);
}

.close-btn svg {
    transition: all var(--transition-fast);
}

.close-btn:hover svg {
    transform: rotate(90deg);
}

/* Gesture Feedback */
.gesture-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--ui-radius-lg);
    padding: var(--ui-spacing-lg) var(--ui-spacing-xl);
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    box-shadow: var(--glass-shadow);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.8);
    transition: all var(--transition-fast);
    pointer-events: none;
}

.gesture-feedback.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.gesture-feedback.success {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.1);
}

.gesture-feedback.error {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.1);
}

/* Legacy button states - moved to bottom controls section */

/* Color Display Button */
.control-btn.color-display {
    padding: var(--ui-spacing-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Old Pickr styles removed - now using JSColor */

.color-circle {
    width: 32px;
    height: 32px;
    border-radius: var(--ui-radius-full);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.control-btn.color-display:active .color-circle {
    transform: scale(0.9);
}

/* Background Color Preview Button */
.bg-color-preview {
    width: 32px;
    height: 32px;
    border-radius: var(--ui-radius);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.bg-color-preview::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: var(--ui-radius);
    border: 1px solid rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

#bg-color-btn {
    padding: var(--ui-spacing-sm);
}

#bg-color-btn:active .bg-color-preview {
    transform: scale(0.9);
}

#bg-color-btn.active {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
}

/* New Color Picker Button Styling */
.color-picker-btn {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 0 solid var(--glass-border);
    border-radius: var(--ui-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
}

.color-picker-btn svg {
    color: rgba(255, 255, 255, 0.9);
    z-index: 2;
    position: relative;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
    pointer-events: none;
    display: none;
  
}

.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition-fast);
    pointer-events: none;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Background color picker - circular */
#color-picker-button {
   /* border-radius: var(--ui-radius-full);*/
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border: 1px solid rgb(112, 112, 112);
}

#color-picker-button .color-preview {
    border-radius: var(--ui-radius-full);
}

/* Pixel color picker - rounded rectangle */
#pixel-color-picker-button {
    border-radius: 4px;
    border-radius:100% !important;
     background: radial-gradient(circle, rgba(143, 143, 143, 1) 18%, rgba(85, 105, 84, 0.5) 70%, rgba(54, 54, 54, 1) 58%);
}

.color-picker-btn:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.color-picker-btn:hover .color-preview {
    border-color: rgba(255, 255, 255, 0.4);
}

.color-picker-btn:active {
    transform: scale(0.95);
}

/* Hide the Pickr elements - we use custom buttons to trigger them */
#bg-color-picker,
#pixel-color-picker {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* Hide ALL Pickr buttons - we use our custom buttons instead */
.pcr-button,
.pickr .pcr-button,
#bg-color-picker .pcr-button,
#pixel-color-picker .pcr-button,
#bg-color-picker .pickr .pcr-button,
#pixel-color-picker .pickr .pcr-button,
.pickr-app .pcr-button {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ===== CUSTOM MODERN COLOR PICKER ===== */
.custom-color-picker {
    position: fixed;
    z-index: 10000;
    background: rgba(15, 15, 15, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(32px) saturate(180%);
    padding: 24px;
    width: 300px;
    max-width: 300px;
    max-height: 90vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    animation: fadeInScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: none;
    overflow: hidden;
    box-sizing: border-box;
}

.custom-color-picker.show {
    display: block;
}

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

/* Color Preview - Hidden since it shows in other tab */
.color-preview-section {
    display: none;
}

.current-color-preview {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.color-info {
    flex: 1;
}

.color-info h4 {
    margin: 0 0 4px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
}

.color-value {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(30, 30, 30, 0.8);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Quick Color Swatches */
.quick-colors {
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.quick-colors h5 {
    margin: 0 0 12px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-swatches {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.color-swatch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.0) 100%);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.color-swatch:hover::before {
    opacity: 1;
}

.color-swatch.active {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.color-swatch.selected {
    animation: colorSelected 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes colorSelected {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2); }
    100% { transform: scale(1); }
}

/* Current Color Input Section */
.custom-color-input {
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.custom-color-input h5 {
    margin: 0 0 12px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-input-group {
    display: flex;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.hex-input {
    flex: 1;
    background: rgba(25, 25, 25, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.95);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
    padding: 10px 12px;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    min-width: 0;
}

.hex-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(30, 30, 30, 0.9);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.native-color-input {
    width: 48px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
}

.native-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
}

.native-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Action Buttons - Hidden for auto-apply UX */
.picker-actions {
    display: none;
}

/* Ensure all picker children are properly contained */
.custom-color-picker * {
    box-sizing: border-box;
}

.custom-color-picker h4,
.custom-color-picker h5 {
    margin: 0 0 8px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hide old Pickr elements */
.pickr {
    display: none !important;
}

.pickr .pcr-palette,
.pickr .pcr-slider,
.pickr .pcr-interaction {
    background: transparent !important;
    border: none !important;
}

/* Force positioning for palette specifically */
.pickr .pcr-palette {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
}

.pickr .pcr-interaction input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
}

.pickr .pcr-interaction input:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    outline: none !important;
}

.pickr .pcr-save,
.pickr .pcr-cancel,
.pickr .pcr-clear {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

.pickr .pcr-save:hover,
.pickr .pcr-cancel:hover,
.pickr .pcr-clear:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-1px) !important;
}

.pickr-btn:active .bg-color-circle {
    transform: scale(0.9);
}

/* Grid Line Controls Styling */
.grid-line-controls {
    display: flex;
    flex-direction: column;
    gap: var(--ui-spacing-md);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--ui-spacing-sm);
    cursor: pointer;
    font-weight: 500;
    color: var(--panel-text);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--glass-dark-border);
    border-radius: var(--ui-spacing-xs);
    background: var(--glass-dark-bg);
    transition: all var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}

.checkbox-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 6px;
    height: 10px;
    border: 2px solid #ffffff;
    border-top: none;
    border-left: none;
    transform-origin: center;
    transition: all var(--transition-fast);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: rgba(59, 130, 246, 0.5);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    transform: translate(-50%, -60%) rotate(45deg) scale(1);
}

.custom-grid-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--ui-spacing-md);
    margin-top: var(--ui-spacing-sm);
    padding-top: var(--ui-spacing-md);
    border-top: 1px solid var(--glass-dark-border);
    transition: all var(--transition-normal);
}

.custom-grid-controls .input-group:first-child input[type="color"] {
    height: 40px;
    border-radius: var(--ui-spacing-sm);
}

#gridOpacityValue {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* Keyboard Shortcuts Help Styling */
.shortcuts-help {
    display: flex;
    flex-direction: column;
    gap: var(--ui-spacing-xs);
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--ui-spacing-xs) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-keys {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    background: var(--glass-dark-bg);
    border: 1px solid var(--glass-dark-border);
    border-radius: var(--ui-spacing-xs);
    padding: 2px 6px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.shortcut-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: right;
}

/* ===========================
   PEN TOOL MENU  
   ========================== */

.pen-menu {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 280px;
}

.pen-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pen-menu-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pen-menu-header h4 {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    font-family: var(--font-family);
}

.pen-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.pen-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family);
    font-size: 11px;
    font-weight: 500;
    text-align: center;
}

.pen-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-1px);
}

.pen-option.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
}

.pen-option svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
}

.pen-option span {
    line-height: 1;
}

/* Pen tool active state */
#pen-tool-btn.active {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
}

#pen-tool-btn.active svg {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
}

/* Pen cursor overlay */
.pen-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.8;
    transition: width 0.2s ease, height 0.2s ease;
    box-shadow: 0 0 10px rgba(var(--primary-color-rgb), 0.3);
}

/* Pen drawing effects */
.pixel.pen-drawn {
    animation: penDraw 0.3s ease-out;
}

@keyframes penDraw {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Modern Brush Selection Menu */
.brush-menu {
    position: fixed;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 4px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 150;
    pointer-events: none;
    /* Dynamic positioning will be set by JavaScript */
}

/* Mobile enhancements for brush menu */
@media (max-width: 768px) {
    .brush-menu {
        padding: 10px;
        gap: 8px;
        backdrop-filter: blur(25px) saturate(200%);
        border: 1.5px solid rgba(255, 255, 255, 0.25);
    }
}

.brush-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    pointer-events: auto;
}

.brush-option {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    touch-action: manipulation;
}

.brush-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 1);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 2px 6px rgba(0, 0, 0, 0.1);
}

.brush-option:active {
    transform: translateY(0) scale(0.96);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.brush-option.active {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 1);
    transform: scale(1);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.brush-option svg {
    width: 20px;
    height: 20px;
    transition: all 0.2s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.brush-option:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

/* Mobile enhancements for brush options */
@media (max-width: 768px) {
    .brush-option {
        width: 48px;
        height: 48px;
        /* Enhanced touch feedback */
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
    
    .brush-option:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* Modern Shading Tool Menu */
.light-shadow-menu {
    position: fixed;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 150;
    pointer-events: none;
    min-width: 150px;
    /* Dynamic positioning will be set by JavaScript */
}

/* Mobile enhancements for shading tool menu */
@media (max-width: 768px) {
    .light-shadow-menu {
        padding: 10px;
        gap: 8px;
        backdrop-filter: blur(25px) saturate(200%);
        border: 1.5px solid rgba(255, 255, 255, 0.25);
        min-width: 160px;
    }
}

.light-shadow-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    pointer-events: auto;
}

.light-shadow-option {
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    touch-action: manipulation;
}

.light-shadow-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 2px 6px rgba(0, 0, 0, 0.1);
}

.light-shadow-option:active {
    transform: translateY(0) scale(0.98);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.light-shadow-option.active {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 1);
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.light-shadow-option[data-mode="highlight"]:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.3);
    color: #e6ac00;
}

.light-shadow-option[data-mode="highlight"].active {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.4);
    color: #e6ac00;
}

.light-shadow-option[data-mode="shadow"]:hover {
    background: rgba(75, 85, 99, 0.15);
    border-color: rgba(75, 85, 99, 0.3);
    color: #6b7280;
}

.light-shadow-option[data-mode="shadow"].active {
    background: rgba(75, 85, 99, 0.2);
    border-color: rgba(75, 85, 99, 0.4);
    color: #6b7280;
}

.light-shadow-option svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.light-shadow-option:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.light-shadow-option span {
    font-size: 13px;
    font-weight: 500;
}

/* Mobile enhancements for light-shadow options */
@media (max-width: 768px) {
    .light-shadow-option {
        padding: 12px 14px;
        /* Enhanced touch feedback */
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
        min-height: 48px;
    }
    
    .light-shadow-option:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .light-shadow-option svg {
        width: 18px;
        height: 18px;
    }
    
    .light-shadow-option span {
        font-size: 14px;
    }
}

/* Legacy shading tool states - now handled by bottom control button styles */

/* Disabled button styles */
.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.control-btn:disabled::before {
    display: none;
}

/* Dynamic shape icon updates */
#shape-icon {
    transition: all var(--transition-normal);
}

#shape-icon.shape-updating {
    animation: shapeChange 0.4s var(--bounce);
}

@keyframes shapeChange {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* Enhanced grid transitions */
#pixel-grid.grid-updating {
    animation: gridResize 0.6s var(--bounce);
}

@keyframes gridResize {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Mobile hover states - disabled for tooltips */
@media (hover: none) and (pointer: coarse) {
    /* Tooltips disabled on touch devices */
    
    .option-btn:hover::before {
        left: -100%;
    }
    
    .brush-option:hover::before {
        left: -100%;
    }
    
    .control-btn:hover svg {
        transform: none;
    }
    
    .option-btn:hover svg {
        transform: none;
    }
    
    .corner-btn:hover {
        background: transparent;
        transform: none;
    }
    
    .brush-option:hover {
        background: transparent;
        transform: none;
        border-color: var(--glass-border);
    }
}

/* ===== AUTHENTICATION SECTION ===== */
#auth-wrapper {
    display: none !important; /* Hide login popup */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    padding: var(--ui-spacing-lg);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.auth-container {
    max-width: 400px;
    width: 100%;
    padding: var(--ui-spacing-lg);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    box-shadow: var(--panel-shadow);
    position: relative;
}

.auth-container h2 {
    margin: 0 0 var(--ui-spacing-lg) 0;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-color);
}

.auth-btn {
    width: 100%;
    padding: var(--ui-spacing-md);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ui-spacing-sm);
    margin-bottom: var(--ui-spacing-sm);
}

.google-btn {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-color);
    border-color: rgba(0, 0, 0, 0.1);
}

.google-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.google-btn:active {
    transform: translateY(0);
}

.auth-divider {
    margin: var(--ui-spacing-lg) 0;
    text-align: center;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
}

.auth-divider span {
    background: rgba(255, 255, 255, 0.9);
    padding: 0 var(--ui-spacing-md);
    color: var(--text-color);
    font-size: 0.9rem;
    position: relative;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--ui-spacing-md);
}

.auth-input {
    width: 100%;
    padding: var(--ui-spacing-md);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-color);
    transition: all var(--transition-fast);
}

.auth-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    background: rgba(255, 255, 255, 0.95);
}

.auth-input::placeholder {
    color: rgba(17, 17, 17, 0.6);
}

.auth-buttons {
    display: flex;
    gap: var(--ui-spacing-sm);
    margin-top: var(--ui-spacing-sm);
    flex-direction: column-reverse;

}

.primary-btn {
    background: linear-gradient(135deg, #111111, #111111);
    color: white;
    border-color: transparent;
    flex: 1;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-color);
    border-color: rgba(0, 0, 0, 0.2);
    flex: 1;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.secondary-btn:active {
    transform: translateY(0);
}

/* Gallery button - initially hidden until login */
#gallery-btn {
    display: none !important;
}

/* Auth toggle button - visibility controlled by JavaScript */
#auth-toggle-btn {
    display: none !important;
    width: auto;
    height: 30%;
}

/* App positioning - no padding needed since auth is modal overlay */
#app {
    padding-top: 0;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    #auth-wrapper {
        padding: var(--ui-spacing-md);
    }
    
    .auth-container {
        padding: var(--ui-spacing-md);
    }
    
    .auth-buttons {
        flex-direction: column;
    }
    
    .auth-buttons .auth-btn {
        margin-bottom: var(--ui-spacing-xs);
    }
}

/* Auth close button */
.auth-close-btn {
    position: absolute;
    top: var(--ui-spacing-md);
    right: var(--ui-spacing-md);
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: var(--ui-radius-full);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-color);
}

.auth-close-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

/* Login Button - From Uiverse.io by McHaXYT */
.Login.button {
    padding: 15px 20px;
    border: none;
    outline: none;
    background-color: #151515 !important;
    color: #eee;
    border-radius: 7px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease-out;
    margin-left: var(--ui-spacing-md); /* Add left margin to separate from avatar */
}

.Login.button:hover {
    transform: translateY(-3px);
}

.Login.button .button-span {
    color: #aaa;
}

/* ===== NEW STYLISH USER AVATAR POPUP (from Uiverse.io) ===== */
.template {
    /* ------------------------------------------------------------ */
    /* fill */
    --fill: #0000;
    --fill-hover: hsla(0, 0%, 45%, 0.2);
    --fill-active: hsl(0, 0%, 10%);
    /* txt */
    --txt: #ccc;
    /*-------------------------*/
    --br: 0.625rem;
    --gap: 0.25rem;
    --popup-main-h: 20rem;
    /* ---------------------------------------------------------- */
    display: flex;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-size: 0.975rem;
    color: var(--txt);
}

.user-avatar-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* button */
.button {
    position: relative;
    display: inline-block;
    list-style-type: none;
    list-style: none;
    appearance: none;
    outline: 0;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    font-size: inherit;
    color: #737373;
    white-space: nowrap;
    padding: calc(var(--gap) * 2) calc(var(--gap) * 8) calc(var(--gap) * 2)
        calc(var(--gap) * 4);
    text-align: left;
    background-color: var(--fill);
    border-radius: 4px;
    transition: background-color 500ms;
}

.button:hover {
    background-color: var(--fill-hover);
}

.button.quit:hover {
    background-color: #962434;
}

.button:focus,
.button:active,
.button.active {
    background-color: var(--fill-active);
}

hr {
    margin: 0.8rem;
    border: 1px dashed #313131;
}

/* popup */
.popup {
    position: relative;
}

.popup-header {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: calc(var(--gap) * 3);
}

.popup-main {
    position: absolute;
    top: 100%;
    right: 0;
    opacity: 0;
    margin-top: var(--gap);
    border-radius: 4px;
    padding: 0 calc(var(--gap) * 1.5);
    background-color: hsl(0, 0%, 10%);
    box-shadow: hsl(0, 0%, 12%) 0px 0px 0px 1px;
    transition: 0.4s;
    overflow: hidden;
    height: var(--popup-main-h);
    z-index: 1000;
}

.popup:focus .popup-main {
    margin-top: 1rem;
    opacity: 1;
}

.list-box {
    scrollbar-width: none;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    overflow: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: calc(var(--gap) * 2) 0 calc(var(--gap) * 3) 0;
}

/* Custom styles for our app */
.popup-main.visible {
    margin-top: 1rem;
    opacity: 1;
}

/* Mobile responsiveness for avatar */
@media (max-width: 768px) {
    .popup-main {
        right: -8px;
        min-width: 160px;
    }
    
    .template {
        font-size: 0.85rem;
    }
}

/* ===== GALLERY STYLES ===== */
.gallery-content {
    max-width: 600px;
    max-height: 80vh;
}

.gallery-actions {
    margin-bottom: var(--ui-spacing-lg);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--ui-spacing-md);
    margin-bottom: var(--ui-spacing-lg);
    max-height: 400px;
    overflow-y: auto;
}

.gallery-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: var(--ui-radius);
    padding: var(--ui-spacing-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.gallery-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.gallery-item img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    background: white;
    border-radius: var(--ui-radius-xs);
}

.gallery-item-name {
    margin-top: var(--ui-spacing-xs);
    font-size: 0.8rem;
    color: var(--panel-text);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--ui-spacing-xl);
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.gallery-item-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

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

.gallery-action-btn {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 12px;
}

.gallery-action-btn:hover {
    background: rgba(0, 0, 0, 0.9);
} 

/* Gallery thumbnail styles */
.gallery-thumbnail {
    width: 100%;
    height: 100%;
    border-radius: var(--ui-radius);
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
    overflow: hidden;
}

.gallery-thumbnail:hover {
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

.gallery-thumbnail.selected {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== GALLERY SLIDE-DOWN OVERLAY ===== */
.gallery-slide-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20px;
}

.gallery-slide-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.gallery-slide-content {
    width: calc(100% - 40px);
    max-width: 800px;
    max-height: calc(100vh - 40px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 
        0 10px 25px -5px rgba(0, 0, 0, 0.1),
        0 8px 10px -6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-slide-overlay.visible .gallery-slide-content {
    transform: translateY(0) scale(1);
}

.gallery-slide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.gallery-slide-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #374151;
}

.gallery-slide-title svg {
    color: #6b7280;
    flex-shrink: 0;
}

.gallery-slide-title h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.gallery-slide-actions {
    display: flex;
    align-items: center;
    gap: var(--ui-spacing-md);
}

.gallery-slide-save-btn {
    display: flex;
    align-items: center;
    gap: var(--ui-spacing-sm);
    padding: var(--ui-spacing-md) var(--ui-spacing-lg);
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: var(--ui-radius);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.gallery-slide-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.gallery-slide-save-btn:active {
    transform: translateY(0);
}

.gallery-slide-close {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.gallery-slide-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #374151;
    transform: scale(1.05);
}

.gallery-slide-close:active {
    transform: scale(0.95);
}

.gallery-slide-grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.gallery-slide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.gallery-slide-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.gallery-slide-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.gallery-slide-item img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.gallery-slide-item:hover img {
    transform: scale(1.02);
}

.gallery-slide-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.gallery-slide-item-date {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
    margin-bottom: 12px;
}

.gallery-slide-item-actions {
    display: flex;
    gap: var(--ui-spacing-sm);
    justify-content: center;
    opacity: 0;
    transition: all var(--transition-fast);
}

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

.gallery-slide-action-btn {
    padding: var(--ui-spacing-xs) var(--ui-spacing-sm);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--ui-spacing-sm);
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 4px;
}

.gallery-slide-action-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
}

.gallery-slide-action-btn.load {
    background: rgba(102, 126, 234, 0.6);
}

.gallery-slide-action-btn.load:hover {
    background: rgba(102, 126, 234, 0.8);
}

.gallery-slide-action-btn.delete {
    background: rgba(239, 68, 68, 0.6);
}

.gallery-slide-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.8);
}

.gallery-slide-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--ui-spacing-xl) 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    animation: fadeIn 0.8s ease-out 0.3s both;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.gallery-placeholder-icon {
    margin-bottom: var(--ui-spacing-lg);
    opacity: 0.7;
}

.gallery-placeholder-icon svg {
    color: rgba(255, 255, 255, 0.6);
}

.gallery-slide-placeholder h3 {
    margin: 0 0 var(--ui-spacing-md) 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.gallery-slide-placeholder p {
    margin: 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 400px;
}

/* Mobile responsive design */
@media (max-width: 768px) {
    .gallery-slide-content {
        padding: var(--ui-spacing-lg);
        gap: var(--ui-spacing-md);
    }
    
    .gallery-slide-header {
        flex-direction: column;
        gap: var(--ui-spacing-md);
        align-items: flex-start;
    }
    
    .gallery-slide-title h2 {
        font-size: 1.5rem;
    }
    
    .gallery-slide-actions {
        align-self: stretch;
        justify-content: space-between;
    }
    
    .gallery-slide-save-btn {
        flex: 1;
        justify-content: center;
        margin-right: var(--ui-spacing-md);
    }
    
    .gallery-slide-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: var(--ui-spacing-md);
    }
    
    .gallery-slide-item img {
        height: 100px;
    }
    
    .gallery-slide-placeholder {
        padding: var(--ui-spacing-lg) var(--ui-spacing-md);
    }
    
    .gallery-slide-placeholder h3 {
        font-size: 1.25rem;
    }
    
    .gallery-slide-placeholder p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .gallery-slide-content {
        padding: var(--ui-spacing-md);
    }
    
    .gallery-slide-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: var(--ui-spacing-sm);
    }
    
    .gallery-slide-item {
        padding: var(--ui-spacing-sm);
    }
    
    .gallery-slide-item img {
        height: 80px;
    }
    
    .gallery-slide-item-name {
        font-size: 0.8rem;
    }
    
    .gallery-slide-item-date {
        font-size: 0.7rem;
    }
}

/* Mobile Menu Styles */
.mobile-menu-container {
    position: relative;
    display: none; /* Hidden by default on desktop */
}

.mobile-menu-btn {
    /* Use existing control-btn styles */
}

.mobile-menu-dropdown {
    position: absolute;
    top: calc(100% + var(--ui-spacing-sm));
    right: 0;
    min-width: 200px;
    background: var(--panel-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--ui-radius);
    padding: var(--ui-spacing-sm);
    box-shadow: var(--panel-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all var(--transition-fast);
    z-index: 1000;
    pointer-events: auto;
}

.mobile-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.mobile-menu-item {
    width: 100%;
    padding: var(--ui-spacing-md);
    background: transparent;
    border: none;
    border-radius: var(--ui-spacing-sm);
    color: var(--panel-text);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--ui-spacing-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.mobile-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.mobile-menu-item:active {
    transform: translateX(4px) scale(0.98);
}

.mobile-menu-item svg {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Mobile-First Responsive Design */
@media (max-width: 767px) {
    /* Show mobile menu on small screens */
    .mobile-menu-container {
        display: none;
    }
    
    /* Completely hide canvas, grid, and gallery controls on mobile - now inside avatar dropdown */
    #canvas-settings-btn,
    #grid-settings-btn,
    #canvas-size-btn,
    #grid-size-btn,
    #gallery-btn,
    #gallery-btn-top,
    .grid-settings-wrapper,
    .canvas-size-wrapper,
    .gallery-wrapper {
        display: none !important;
    }
    
    /* Keep zoom and download buttons visible on mobile but optimize them */
    #zoom-btn,
    #download-btn {
        display: flex !important;
        width: var(--btn-size-sm);
        height: var(--btn-size-sm);
        min-width: var(--btn-size-sm);
        min-height: var(--btn-size-sm);
        flex-shrink: 0;
        touch-action: manipulation;
    }
    
    /* Ensure zoom and download button icons are properly sized for mobile */
    #zoom-btn svg,
    #download-btn svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    
    /* Ensure wrapper containers for zoom and download buttons work on mobile */
    .zoom-wrapper,
    .download-wrapper {
        display: flex !important;
        position: relative;
        flex-shrink: 0;
    }
    
    /* Optimize tooltip wrappers for mobile */
    .zoom-wrapper .tooltip-wrapper,
    .download-wrapper .tooltip-wrapper {
        display: flex;
        flex-shrink: 0;
    }
    
    /* Make sure tooltips don't interfere on mobile */
    .zoom-wrapper .tooltip,
    .download-wrapper .tooltip {
        display: none; /* Hide tooltips on mobile to save space */
    }
    
    /* Adjust top controls layout for mobile */
    .top-controls {
        padding: 0 var(--ui-spacing-md);
        gap: var(--ui-spacing-sm);
    }
    
    /* Ensure essential controls remain visible and usable */
    .pickr-btn,
    .history-controls,
    #auth-toggle-btn,
    #user-avatar-container {
        display: flex;
    }
    
    /* Optimize button sizes for mobile touch while maintaining aspect ratio */
    .control-btn {
        width: var(--btn-size-sm);
        height: var(--btn-size-sm);
        min-width: var(--btn-size-sm);
        min-height: var(--btn-size-sm);
        flex-shrink: 0; /* Prevent squishing */
    }
    
    /* Ensure SVG icons maintain proper aspect ratio */
    .control-btn svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    
    /* Pickr button mobile optimization */
    .pickr-btn {
        width: var(--btn-size-sm);
        height: var(--btn-size-sm);
        min-width: var(--btn-size-sm);
        min-height: var(--btn-size-sm);
        padding: 6px;
        flex-shrink: 0;
    }
    
    .pickr-btn .pcr-button {
        width: 100% !important;
        height: 100% !important;
        border-radius: 50% !important;
        display: none !important
        ;
    }
    
    /* History controls mobile optimization */
    .history-controls {
        gap: var(--ui-spacing-sm);
        padding: 2px;
        flex-shrink: 0;
    }
    
    .history-controls .control-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        flex-shrink: 0;
    }
    
    .history-controls .control-btn svg {
        width: 22px;
        height: 22px;
    }
    
    /* User avatar top right mobile optimization */
    .user-avatar-top-right {
        top: var(--ui-spacing-md);
        right: var(--ui-spacing-md);
    }
    
    /* Right controls mobile layout */
    .right-controls {
        gap: var(--ui-spacing-xs);
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }
    
    /* Avatar button proper sizing */
    .user-avatar-btn {
        width: var(--btn-size-sm);
        height: var(--btn-size-sm);
        min-width: var(--btn-size-sm);
        min-height: var(--btn-size-sm);
        flex-shrink: 0;
    }
    
    .avatar-circle {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        flex-shrink: 0;
    }
    
    /* Mobile menu button proper sizing */
    .mobile-menu-btn {
        width: var(--btn-size-sm);
        height: var(--btn-size-sm);
        min-width: var(--btn-size-sm);
        min-height: var(--btn-size-sm);
        flex-shrink: 0;
    }
    
    /* Adjust mobile menu dropdown for better positioning */
    .mobile-menu-dropdown {
        right: -8px;
        min-width: 180px;
    }
    
    /* Bottom controls - maintain aspect ratio */
    .bottom-controls .control-btn {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
        flex-shrink: 0;
    }
    
    .bottom-controls .control-btn svg {
        width: 24px;
        height: 24px;
    }
    
    /* Color circle in bottom controls */
    .color-circle {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        flex-shrink: 0;
    }
    
    /* Ensure touch targets are minimum 44px */
    .mobile-menu-item {
        min-height: 44px;
        padding: var(--ui-spacing-sm) var(--ui-spacing-md);
    }
    
    /* Auth button mobile optimization */
    .button {
        padding: 12px 16px;
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
        min-height: var(--btn-size-sm);
    }
    
    /* Avatar dropdown mobile positioning */
    .avatar-dropdown {
        right: -8px;
        min-width: 160px;
    }
    
    /* Prevent flex items from shrinking in top controls */
    .top-controls > * {
        flex-shrink: 0;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .top-controls {
        padding: 0 var(--ui-spacing-sm);
        gap: 4px;
    }
    
    /* Slightly smaller but still proportional */
    .control-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }
    
    .control-btn svg {
        width: 18px;
        height: 18px;
    }
    
    /* Pickr button for very small screens */
    .pickr-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        padding: 4px;
    }
    
    .history-controls .control-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }
    
    .history-controls .control-btn svg {
        width: 32px;
        height: 32px;
    }
    
    .mobile-menu-dropdown {
        right: -4px;
        min-width: 160px;
    }
    
    .button {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 40px;
    }
    
    /* Avatar popup sizing for small screens */
    .user-avatar-container .popup-header p {
        font-size: 0.8rem;
        padding: 0.5rem 0rem 0.5rem 0.6rem;
    }
    
    .user-avatar-container .popup-header svg {
        width: 28px;
        height: 28px;
    }
}

/* Desktop and larger screens */
@media (min-width: 768px) {
    /* Ensure mobile menu is hidden on desktop */
    .mobile-menu-container {
        display: none !important;
    }
    
    /* Hide mobile-only dropdown items on desktop */
    .dropdown-item.mobile-only,
    .dropdown-divider.mobile-only {
        display: none !important;
    }
    
    /* Hide mobile settings modals on desktop */
    .settings-modal-overlay {
        display: none !important;
    }
    
    /* EXCEPTION: Keep grid suggestions modal visible on desktop */
    #grid-suggestions-modal.settings-modal-overlay {
        display: flex !important;
        opacity: 0;
        visibility: hidden;
    }
    
    #grid-suggestions-modal.settings-modal-overlay.visible {
        opacity: 1;
        visibility: visible;
    }
    
    /* Ensure all desktop controls are visible */
    #canvas-settings-btn,
    #grid-settings-btn,
    #canvas-size-btn,
    #grid-size-btn,
    #zoom-btn,
    #download-btn,
    #gallery-btn,
    .grid-settings-wrapper,
    .canvas-size-wrapper {
        display: flex;
    }
} 

/* User Avatar - Top Right */
.user-avatar-top-right {
    position: fixed;
    top: var(--ui-spacing-lg);
    right: var(--ui-spacing-lg);
    z-index: 102;
    pointer-events: auto;
}

/* ===== MODERN HEROUI-STYLE AVATAR DROPDOWN ===== */
.modern-avatar-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: var(--ui-spacing-md); /* Add left margin to separate from other controls */
}

.avatar-dropdown-wrapper {
    position: relative;
}

.modern-avatar-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(215, 215, 215, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #3d3d3d;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    max-width: 200px;
}

.modern-avatar-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modern-avatar-trigger:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

.modern-avatar-trigger:focus {
    border-color: #474747;
    box-shadow: 10px 10px 10px 3px rgba(36, 36, 36, 4%);
}

.avatar-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-image svg {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.user-name {
    color: #3d3d3d;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.dropdown-arrow {
    color: #6b7280;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.modern-avatar-trigger[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

.modern-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 
        0 10px 25px -5px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    pointer-events: none;
}

.modern-dropdown-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
}

.dropdown-item:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #111827;
}

.dropdown-item:active {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(0.98);
}

.dropdown-item.danger {
    color: #dc2626;
}

.dropdown-item.danger:hover {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

.dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.dropdown-item:hover svg {
    opacity: 1;
}

.dropdown-item.danger svg {
    opacity: 0.8;
}

.dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 8px 0;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .modern-avatar-trigger {
        padding: 6px 10px;
        gap: 6px;
        max-width: 160px;
    }
    
    .user-name {
        font-size: 13px;
        max-width: 80px;
    }
    
    .avatar-image {
        width: 28px;
        height: 28px;
    }
    
    .avatar-image svg {
        width: 28px;
        height: 28px;
    }
    
    .modern-dropdown-menu {
        right: 0;
        min-width: 200px;
    }
    
    .dropdown-item {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .modern-avatar-trigger {
        padding: 4px 8px;
        gap: 4px;
        max-width: 140px;
    }
    
    .user-name {
        font-size: 12px;
        max-width: 60px;
    }
    
    .avatar-image {
        width: 24px;
        height: 24px;
    }
    
    .avatar-image svg {
        width: 24px;
        height: 24px;
    }
    
    .modern-dropdown-menu {
        right: 0;
        min-width: 180px;
    }
}

/* Hide old avatar styles (keeping them for reference but unused) */ 

/* ===== BOTTOM GRID SETTINGS DROPDOWN STYLES ===== */
.grid-settings-dropdown {
    position: fixed; /* Changed from absolute to fixed for better positioning */
    bottom: 100px; /* Position above the bottom controls */
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.95);
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 1001;
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.grid-settings-dropdown.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

.dropdown-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-header h4 {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    font-weight: 600;
}

.dropdown-section {
    margin-bottom: 20px;
}

.dropdown-section:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    cursor: pointer;
}

.setting-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
}

.setting-toggle {
    width: 20px;
    height: 20px;
    accent-color: #3b82f6;
}

.setting-input {
    width: 40px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
}

.setting-group {
    margin-bottom: 16px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-slider {
    width: 120px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.1);
    outline: none;
    accent-color: #3b82f6;
}

.setting-value {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.grid-controls {
    margin-top: 12px;
    padding-left: 16px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.bg-color-presets {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.bg-color-preset {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bg-color-preset:hover {
    border-color: #3b82f6;
    transform: scale(1.1);
}

.bg-color-preset:active {
    transform: scale(0.95);
}

.pixel-grid-color-presets {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.pixel-grid-color-preset {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.pixel-grid-color-preset:hover {
    border-color: #3b82f6;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pixel-grid-color-preset:active {
    transform: scale(1.05);
}

.pixel-grid-color-preset.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Dark theme styling for all text elements in grid settings dropdown */
.grid-settings-dropdown label,
.grid-settings-dropdown .label,
.grid-settings-dropdown span:not(.bg-color-preset):not(.pixel-grid-color-preset) {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Hide the Background Color section in bottom grid settings */
#bottom-bg-color-input,
#bottom-bg-color-input ~ * {
    display: none !important;
}
.grid-settings-dropdown .bg-color-presets {
    display: none !important;
}
/* Hide the Background Color label/title */
.grid-settings-dropdown .setting-label:has(#bottom-bg-color-input) {
    display: none !important;
}

/* ===== ZOOM DROPDOWN STYLES ===== */
.zoom-wrapper {
    position: relative;
    display: inline-block;
}

.zoom-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: -40%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 
        0 10px 25px -5px rgba(0, 0, 0, 0.1),
        0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-dropdown.visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(-50%) translateY(0) scale(1);
}

.zoom-dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.zoom-current {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

#zoom-value-input {
    background: transparent;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    text-align: center;
    width: 60px;
    outline: none;
    appearance: none;
}

#zoom-value-input::-webkit-outer-spin-button,
#zoom-value-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#zoom-value-input[type=number] {
    -moz-appearance: textfield;
}

#zoom-value-input:focus {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 2px 4px;
}

.zoom-percent {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.zoom-presets {
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.zoom-preset-btn {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 50px;
}

.zoom-preset-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
    color: #667eea;
    transform: translateY(-1px);
}

.zoom-preset-btn:active {
    transform: translateY(0);
}

.zoom-preset-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    color: white;
    transform: scale(1.02);
}

.zoom-slider-wrapper {
    padding: 0 4px;
}

.zoom-slider {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    appearance: none;
    cursor: pointer;
    position: relative;
}

.zoom-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    border: 2px solid white;
}

.zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.zoom-slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

.zoom-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Position dropdown appropriately on mobile */
@media (max-width: 768px) {
    .zoom-dropdown {
        min-width: 260px;
        left: auto;
        right: 0;
        transform: translateX(0) translateY(-10px) scale(0.95);
    }
    
    .zoom-dropdown.visible {
        transform: translateX(0) translateY(0) scale(1);
    }
    
    .zoom-presets {
        gap: 4px;
    }
    
    .zoom-preset-btn {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 45px;
    }
    
    #zoom-value-input {
        width: 55px;
        font-size: 1.25rem;
    }
    
    .zoom-percent {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .zoom-dropdown {
        min-width: 240px;
        padding: 14px;
    }
    
    .zoom-dropdown-content {
        gap: 14px;
    }
    
    .zoom-current {
        padding: 10px;
    }
    
    #zoom-value-input {
        width: 50px;
        font-size: 1.1rem;
    }
    
    .zoom-percent {
        font-size: 1.1rem;
    }
    
    .zoom-preset-btn {
        padding: 6px 6px;
        font-size: 11px;
        min-width: 40px;
    }
}

/* ===== CANVAS SETTINGS DROPDOWN STYLES ===== */
.grid-settings-wrapper,
.canvas-size-wrapper {
    position: relative;
    display: none;
} 

.canvas-settings-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: -240%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 1000;
    min-width: 320px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.canvas-settings-dropdown.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.canvas-settings-dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Dark theme text styling for canvas settings dropdown */
.canvas-settings-dropdown h3,
.canvas-settings-dropdown label,
.canvas-settings-dropdown .settings-label,
.canvas-settings-dropdown .section-title {
    color: rgba(255, 255, 255, 0.9);
}

.canvas-settings-dropdown p,
.canvas-settings-dropdown .description,
.canvas-settings-dropdown .help-text {
    color: rgba(255, 255, 255, 0.7);
}

/* Dark theme input and button styling */
.canvas-settings-dropdown input,
.canvas-settings-dropdown select,
.canvas-settings-dropdown button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.canvas-settings-dropdown input:focus,
.canvas-settings-dropdown select:focus,
.canvas-settings-dropdown button:focus {
    border-color: rgba(0, 123, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.canvas-settings-dropdown button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.settings-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-section h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.grid-size-display {
    text-align: center;
    padding: 10px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.grid-size-display span {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.grid-size-slider-wrapper {
    padding: 0 8px;
}

.settings-slider {
    width: 100%;
    height: 5px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    appearance: none;
    cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    border: 2px solid white;
}

.settings-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
}

.settings-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: #6b7280;
}

.canvas-size-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.size-input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.size-input {
    width: 70px;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
}

.size-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.size-input-group span {
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
}

.apply-size-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.apply-size-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.apply-size-btn:active {
    transform: translateY(0);
}

.grid-toggle-wrapper {
    display: flex;
    align-items: center;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 40px;
    height: 20px;
    background: #e5e7eb;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.grid-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.grid-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.grid-control-row label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    min-width: fit-content;
}

.color-input {
    width: 40px;
    height: 32px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    cursor: pointer;
    background: none;
    transition: all 0.2s ease;
}

.color-input:hover {
    transform: scale(1.05);
}

.preset-icons {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.preset-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 0;
}

.preset-icon-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.preset-icon-btn:active {
    transform: translateY(0);
}

.preset-icon-btn.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-color: #667eea;
}

.preset-icon {
    width: 24px;
    height: 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 2px;
    position: relative;
}

.preset-icon.square {
    width: 20px;
    height: 20px;
}

.preset-icon.portrait {
    width: 16px;
    height: 24px;
}

.preset-icon.landscape {
    width: 28px;
    height: 16px;
}

.preset-icon.banner {
    width: 32px;
    height: 8px;
}

.preset-icon-btn span {
    font-size: 10px;
    font-weight: 500;
    color: #374151;
    text-align: center;
    line-height: 1;
}

.bg-color-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bg-color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
}

.bg-color-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.bg-color-presets {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.bg-color-preset {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: none;
    padding: 0;
}

.bg-color-preset:hover {
    transform: scale(1.1);
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.bg-color-preset:active {
    transform: scale(0.95);
}

.bg-color-preset.active {
    border-color: #667eea;
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .canvas-settings-dropdown {
        min-width: 300px;
        left: auto;
        right: 0;
        transform: translateX(0) translateY(-10px) scale(0.95);
    }
    
    .canvas-settings-dropdown.visible {
        transform: translateX(0) translateY(0) scale(1);
    }
    
    .size-input {
        width: 60px;
    }
    
    .preset-icons {
        gap: 8px;
    }
    
    .preset-icon-btn {
        padding: 10px 6px;
        gap: 4px;
    }
    
    .preset-icon-btn span {
        font-size: 9px;
    }
    
    .bg-color-presets {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    
    .bg-color-preset {
        width: 28px;
        height: 28px;
    }
}

/* ===== IMAGE GUIDE & PIXELATION STYLES ===== */
.image-guide-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-guide-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-guide-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.image-guide-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #7c8bf0, #8a5cb8);
}

.image-guide-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.image-guide-btn svg {
    flex-shrink: 0;
}

.image-guide-uploaded-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 8px;
}

.image-guide-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.image-guide-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.image-guide-remove-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    transform: scale(1.05);
}

.image-guide-remove-btn:active {
    transform: scale(0.95);
}

/* Toggle switch styles for image guide */
.toggle-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

/* Opacity controls for image guide */
.image-guide-opacity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--ui-spacing-sm);
    padding: var(--ui-spacing-xs);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.opacity-label {
    font-size: 0.85rem;
    color: var(--text-color);
    font-weight: 500;
}

.opacity-slider-wrapper {
    display: flex;
    align-items: center;
    gap: var(--ui-spacing-xs);
}

.opacity-slider {
    width: 80px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.opacity-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.opacity-value {
    font-size: 0.8rem;
    color: var(--text-color-secondary);
    min-width: 30px;
    text-align: right;
}

/* ===== NEW: GRID SUGGESTIONS MODAL STYLES ===== */

/* Ensure modal overlay is visible and properly positioned */
#grid-suggestions-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#grid-suggestions-modal.visible {
    opacity: 1;
    visibility: visible;
}

/* Modal content styling */
.grid-suggestions-content {
    max-width: 600px;
    width: 90vw;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: 20px;
}

.image-analysis-info {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 8px;
}

.image-preview-container {
    flex-shrink: 0;
}

.suggestion-image-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    background: #f8f9fa;
}

.image-details h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.image-details p {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: #6b7280;
}

.suggestion-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.grid-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.grid-suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.grid-suggestion-item:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.02);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.grid-suggestion-item.recommended {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.02);
}

.grid-suggestion-item.recommended::before {
    content: "⭐ RECOMMENDED";
    position: absolute;
    top: -8px;
    left: 12px;
    background: #10b981;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.grid-suggestion-item.recommended:hover {
    border-color: #059669;
    background: rgba(16, 185, 129, 0.05);
}

.grid-suggestion-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grid-size-display {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    min-width: 80px;
}

.grid-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-level {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-level.simple {
    background: #fef3c7;
    color: #92400e;
}

.detail-level.detailed {
    background: #dbeafe;
    color: #1e40af;
}

.detail-level.high-detail {
    background: #f3e8ff;
    color: #7c3aed;
}

.pixel-count {
    font-size: 11px;
    color: #6b7280;
}

.grid-suggestion-action {
    flex-shrink: 0;
}

.create-grid-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.create-grid-btn:hover {
    background: linear-gradient(135deg, #7c8bf0, #8a5cb8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.create-grid-btn:active {
    transform: translateY(0);
}

.suggestion-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
}

.suggestion-action-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid;
}

.suggestion-action-btn.secondary {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-color: transparent;
}

.suggestion-action-btn.secondary:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.suggestion-action-btn.primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
}

.suggestion-action-btn.primary:hover {
    background: linear-gradient(135deg, #7c8bf0, #8a5cb8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.category-label {
    font-size: 11px;
    color: #667eea;
    font-weight: 500;
    margin-bottom: 2px;
}

.transfer-type.aspect-match {
    background: #10b981;
    color: white;
}

.transfer-type.upscale {
    background: #3b82f6;
    color: white;
}

.transfer-type.downscale {
    background: #f59e0b;
    color: white;
}

.transfer-type.reshape {
    background: #8b5cf6;
    color: white;
}

.transfer-item {
    border-left: 4px solid #667eea;
}

.transfer-item.recommended {
    border-left-color: #10b981;
}

.transfer-standalone {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    font-size: 12px !important;
    padding: 10px 14px !important;
 
}

.transfer-standalone:hover {
    background: linear-gradient(135deg, #34d399, #10b981) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.suggestion-description {
    line-height: 1.6 !important;
    padding: 12px 16px !important;
    background: rgba(59, 130, 246, 0.05) !important;
    border-left: 4px solid #3b82f6 !important;
    border-radius: 0 8px 8px 0 !important;
    margin-bottom: 16px !important;
}

/* ===== UNIFIED IMAGE OPTIONS STYLING ===== */

.unified-option-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s ease;
    margin-bottom: 16px;
}

.unified-option-item:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.02);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.unified-option-item.recommended {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.03);
    position: relative;
}

.unified-option-item.recommended::before {
    content: "⭐ RECOMMENDED";
    position: absolute;
    top: -10px;
    right: 16px;
    background: #10b981;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.unified-option-item.recommended:hover {
    border-color: #059669;
    background: rgba(16, 185, 129, 0.05);
}

.option-main {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.option-icon {
    font-size: 32px;
    flex-shrink: 0;
    line-height: 1;
}

.option-details {
    flex: 1;
}

.option-details h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
}

.option-details p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

.option-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid;
    align-self: flex-start;
}

.option-btn.primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: transparent;
}

.option-btn.primary:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.option-btn.secondary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
}

.option-btn.secondary:hover {
    background: linear-gradient(135deg, #7c8bf0, #8a5cb8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.option-btn.tertiary {
    background: #ffffff;
    color: #6b7280;
    border-color: #d1d5db;
}

.option-btn.tertiary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.option-btn:active {
    transform: translateY(0);
}

/* Responsive design for grid suggestions */
@media (max-width: 480px) {
    .grid-suggestions-content {
        width: 95vw;
    }
    
    .image-analysis-info {
        flex-direction: column;
        text-align: center;
    }
    
    .grid-suggestion-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        text-align: left;
    }
    
    .grid-suggestion-main {
        width: 100%;
        justify-content: space-between;
    }
    
    .grid-suggestion-action {
        width: 100%;
    }
    
    .create-grid-btn {
        width: 100%;
        padding: 10px;
    }
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

/* Mobile responsive adjustments for image guide */
@media (max-width: 768px) {
    .image-guide-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .image-guide-uploaded-controls {
        padding: 14px;
    }
    
    .image-guide-toggle-row {
        gap: 10px;
    }
    
    .toggle-label {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .image-guide-btn {
        padding: 10px 14px;
        font-size: 13px;
        gap: 6px;
    }
    
    .image-guide-uploaded-controls {
        padding: 12px;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .canvas-settings-dropdown {
        min-width: 280px;
        padding: 16px;
    }
    
    .canvas-settings-dropdown-content {
        gap: 16px;
    }
    
    .settings-section {
        gap: 10px;
        padding-bottom: 12px;
    }
    
    .size-input {
        width: 55px;
        padding: 6px 8px;
    }
    
    .grid-size-display span {
        font-size: 14px;
    }
    
    .bg-color-presets {
        gap: 4px;
    }
    
    .bg-color-preset {
        width: 24px;
        height: 24px;
    }
}

/* Hide old avatar styles (keeping them for reference but unused) */ 

/* ===== DOWNLOAD DROPDOWN STYLES ===== */
.download-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Gallery Save Button */
.gallery-save-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.gallery-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.gallery-save-btn:active {
    transform: translateY(0);
}

.gallery-save-btn svg {
    flex-shrink: 0;
}

/* Export Resolution Controls */
.export-resolution-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.export-resolution-group label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.resolution-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.8);
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
    z-index: 1001;
    position: relative;
}

.resolution-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Export Options Grid */
.export-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.export-option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.export-option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.3s ease;
}

.export-option-btn:hover::before {
    left: 100%;
}

.export-option-btn:hover {
    background: rgba(102, 126, 234, 0.05);
    border-color: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.export-option-btn:active {
    transform: translateY(0);
    background: rgba(102, 126, 234, 0.1);
}

.export-option-btn svg {
    flex-shrink: 0;
    color: #667eea;
    transition: all 0.2s ease;
}

.export-option-btn:hover svg {
    transform: scale(1.1);
}

.export-option-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.export-format {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    line-height: 1;
}

.export-description {
    font-size: 11px;
    color: #6b7280;
    line-height: 1;
}

/* Mobile responsive adjustments for download dropdown */
@media (max-width: 768px) {
    .download-wrapper .canvas-settings-dropdown {
        min-width: 300px;
        left: auto;
        right: 0;
        transform: translateX(0) translateY(-10px) scale(0.95);
    }
    
    .download-wrapper .canvas-settings-dropdown.visible {
        transform: translateX(0) translateY(0) scale(1);
    }
    
    .export-options-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .export-option-btn {
        padding: 10px;
        gap: 10px;
    }
    
    .export-format {
        font-size: 12px;
    }
    
    .export-description {
        font-size: 10px;
    }
    
    .gallery-save-btn {
        padding: 10px 14px;
        font-size: 13px;
        gap: 8px;
    }
    
    .resolution-select {
        font-size: 12px;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .download-wrapper .canvas-settings-dropdown {
        min-width: 280px;
        padding: 16px;
    }
    
    .export-resolution-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .export-resolution-group label {
        font-size: 12px;
    }
    
    .resolution-select {
        width: 100%;
    }
    
    .export-option-btn {
        padding: 8px;
        gap: 8px;
    }
}

/* Loading states for export buttons */
.export-option-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.export-option-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translateY(-50%);
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* ===== CLEAN UP OLD TOOLTIP CONFLICTS ===== */
/* .tooltip, .tooltip-bottom {
    display: none !important; 
} */

/* ===== MOBILE DROPDOWN ITEMS STYLES ===== */
.dropdown-item.mobile-only,
.dropdown-divider.mobile-only {
    display: none; /* Hidden by default on desktop */
}

/* Show mobile-only dropdown items on mobile screens */
@media (max-width: 767px) {
    .dropdown-item.mobile-only,
    .dropdown-divider.mobile-only {
        display: flex;
    }
    
    .dropdown-divider.mobile-only {
        display: block;
    }
}

/* ===== MOBILE SETTINGS MODAL OVERLAY STYLES ===== */
.settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.settings-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.settings-modal-content {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px) scale(0.95);
    width: calc(100% - 40px);
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 
        0 10px 25px -5px rgba(0, 0, 0, 0.1),
        0 8px 10px -6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.settings-modal-overlay.visible .settings-modal-content {
    transform: translateX(-50%) translateY(0) scale(1);
}

.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.settings-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #374151;
}

.settings-modal-title svg {
    color: #6b7280;
    flex-shrink: 0;
}

.settings-modal-title h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.settings-modal-close {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.settings-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #374151;
    transform: scale(1.05);
}

.settings-modal-close:active {
    transform: scale(0.95);
}

.settings-modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Apply existing canvas settings dropdown styles to modal sections */
.settings-modal-body .settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.settings-modal-body .settings-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* ===== MODERN TOOLTIP STYLING ===== */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
}

.tooltip-wrapper::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.95);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    z-index: 10000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip-wrapper:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-3px);
}

/* Modern tooltip arrow */
.tooltip-wrapper::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    z-index: 10001;
}

.tooltip-wrapper:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-3px);
}

/* Hide tooltips on touch devices for cleaner mobile experience */
@media (hover: none) and (pointer: coarse) {
    .tooltip-wrapper::after,
    .tooltip-wrapper::before {
        display: none;
    }
}

/* ===== MINIMAL MODERN EYE DROPPER CURSOR ===== */
.eye-dropper-cursor {
    position: fixed;
    width: 40px;
    height: 40px;
    pointer-events: none;
    z-index: 10000;
    user-select: none;
    transform: translate(-50%, -50%);
    transition: none;
}

.eye-dropper-preview {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.2);
    background: #ffffff;
    transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(2px);
}

.eye-dropper-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    pointer-events: none;
    opacity: 0.6;
}

.crosshair-horizontal,
.crosshair-vertical {
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.4);
}

.crosshair-horizontal {
    top: 50%;
    left: 8px;
    right: 8px;
    height: 1px;
    transform: translateY(-0.5px);
}

.crosshair-vertical {
    left: 50%;
    top: 8px;
    bottom: 8px;
    width: 1px;
    transform: translateX(-0.5px);
}

/* Eye dropper active state styling */
body.eye-dropper-active {
    cursor: none !important;
}

.control-btn.active {
    background: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.control-btn.active svg {
    color: rgba(255, 255, 255, 1) !important;
}

/* Smooth cursor animation */
.eye-dropper-preview:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* ===== MODERN ACTIVE STATES FOR SPECIFIC TOOLS ===== */
.bottom-controls .control-btn.eraser-active {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.bottom-controls .control-btn.hand-tool-active {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.bottom-controls .control-btn.highlight-active,
.bottom-controls .control-btn.shadow-active {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.settings-modal-body .settings-section h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

/* Mobile responsive adjustments for modal */
@media (max-width: 480px) {
    .settings-modal-content {
        width: calc(100% - 20px);
        top: 10px;
        padding: 16px;
    }
    
    .settings-modal-title h2 {
        font-size: 1.1rem;
    }
    
    .settings-modal-body {
        gap: 16px;
    }
    
    .settings-modal-body .settings-section {
        gap: 10px;
        padding-bottom: 12px;
    }
}

/* === SELECTION TOOL STYLING === */

/* Select Tool Button State */
#select-tool-btn.active {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    transform: scale(1.05);
}

#select-tool-btn.active svg {
    stroke: #667eea;
}

/* Selection Overlay */
.selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    display: none;
}

.selection-overlay.active {
    display: block;
    pointer-events: none;
}

/* Selection drag preview box */
.selection-drag-preview {
    position: absolute;
    border: 2px dashed rgba(102, 126, 234, 0.8);
    background: rgba(102, 126, 234, 0.1);
    backdrop-filter: blur(2px);
    border-radius: 4px;
    pointer-events: none;
    z-index: 101;
    opacity: 0;
    transition: opacity 0.1s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.selection-overlay.active .selection-box {
    pointer-events: auto;
}

/* Selection Box */
.selection-box {
    position: absolute;
    border: 2px dashed rgba(102, 126, 234, 0.8);
    background: rgba(102, 126, 234, 0.1);
    border-radius: 4px;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.5),
        0 4px 12px rgba(102, 126, 234, 0.3);
    animation: selectionPulse 2s ease-in-out infinite;
    transition: all 0.15s ease-out;
    transform: scale(1);
    opacity: 1;
}

@keyframes selectionPulse {
    0%, 100% { 
        border-color: rgba(102, 126, 234, 0.7);
        background: rgba(102, 126, 234, 0.08);
        box-shadow: 
            0 0 0 1px rgba(255, 255, 255, 0.4),
            0 2px 8px rgba(102, 126, 234, 0.2);
    }
    50% { 
        border-color: rgba(102, 126, 234, 0.9);
        background: rgba(102, 126, 234, 0.12);
        box-shadow: 
            0 0 0 2px rgba(255, 255, 255, 0.6),
            0 4px 16px rgba(102, 126, 234, 0.4);
    }
}

/* Selection Handles */
.selection-handles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: move;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.selection-overlay.active .handle {
    opacity: 1;
}

.handle-nw { top: 0; left: 0; cursor: nw-resize; }
.handle-ne { top: 0; right: 0; transform: translate(50%, -50%); cursor: ne-resize; }
.handle-sw { bottom: 0; left: 0; transform: translate(-50%, 50%); cursor: sw-resize; }
.handle-se { bottom: 0; right: 0; transform: translate(50%, 50%); cursor: se-resize; }

/* Selected Pixels Highlighting - More Subtle */
.pixel.selected {
    position: relative;
    z-index: 5;
}

.pixel.selected::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border: 1px solid rgba(102, 126, 234, 0.6);
    border-radius: 2px;
    pointer-events: none;
    background: rgba(102, 126, 234, 0.08);
    animation: selectedPixelGlow 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes selectedPixelGlow {
    0%, 100% { 
        border-color: rgba(102, 126, 234, 0.6);
        box-shadow: 0 0 2px rgba(102, 126, 234, 0.3);
    }
    50% { 
        border-color: rgba(102, 126, 234, 0.8);
        box-shadow: 0 0 4px rgba(102, 126, 234, 0.4);
    }
}

/* Selection Context Menu */
.selection-context-menu {
    position: absolute;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
    min-width: 120px;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.selection-context-menu.visible {
    display: flex;
    transform: scale(1);
    opacity: 1;
}

.context-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.context-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
}

.context-menu-btn:active {
    transform: translateX(2px) scale(0.98);
}

.context-menu-btn.danger {
    color: #ef4444;
}

.context-menu-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.context-menu-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.context-menu-btn svg {
    flex-shrink: 0;
}

/* Drag Preview */
.drag-preview {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.8;
    transform: scale(1.05);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
    transition: transform 0.1s ease;
}

/* Selection Area Dragging */
.pixel-grid.selecting {
    cursor: crosshair;
}

.pixel-grid.selecting::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(102, 126, 234, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 100;
    animation: selectCursorPulse 1.5s ease-in-out infinite;
}

@keyframes selectCursorPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.9;
    }
}

.pixel-grid.dragging-selection {
    cursor: grabbing;
}

/* Mobile-specific selection styles */
@media (max-width: 768px) {
    .selection-box {
        border-width: 3px;
        border-radius: 6px;
    }
    
    .handle {
        width: 12px;
        height: 12px;
        border-width: 3px;
    }
    
    .selection-context-menu {
        min-width: 140px;
        padding: 12px;
        gap: 8px;
    }
    
    .context-menu-btn {
        padding: 12px 16px;
        font-size: 16px;
        gap: 12px;
        border-radius: 10px;
    }
    
    .context-menu-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .pixel.selected::after {
        top: -3px;
        left: -3px;
        right: -3px;
        bottom: -3px;
        border-width: 3px;
        border-radius: 3px;
    }
}

/* Selection feedback animations */
@keyframes selectionCreated {
    0% { 
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

.selection-overlay.just-created {
    animation: selectionCreated 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Copy/Paste visual feedback */
@keyframes copyFeedback {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); filter: brightness(1.2); }
    100% { transform: scale(1); }
}

.pixel.copying {
    animation: copyFeedback 0.4s ease;
}

/* Cutting Animation */
@keyframes cutFeedback {
    0% { 
        transform: scale(1);
        opacity: 1;
        filter: brightness(1) hue-rotate(0deg);
    }
    25% { 
        transform: scale(1.05);
        opacity: 0.8;
        filter: brightness(1.2) hue-rotate(0deg);
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    }
    75% { 
        transform: scale(0.95);
        opacity: 0.3;
        filter: brightness(0.7) hue-rotate(0deg);
        box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
    }
    100% { 
        transform: scale(1);
        opacity: 1;
        filter: brightness(1) hue-rotate(0deg);
        box-shadow: none;
    }
}

.pixel.cutting {
    animation: cutFeedback 0.4s ease-out;
}

/* Paste Preview Styles */
.paste-preview-container {
    transition: opacity 0.2s ease;
}

.paste-preview-pixel {
    transition: all 0.1s ease;
    backdrop-filter: blur(1px);
}

.paste-preview-pixel:hover {
    opacity: 0.8;
}

/* Enhanced paste preview for different shapes */
.paste-preview-pixel.pixel-circle-fresh {
    border-radius: 50% !important;
}

.paste-preview-pixel.pixel-triangle,
.paste-preview-pixel.pixel-triangle-90,
.paste-preview-pixel.pixel-triangle-180,
.paste-preview-pixel.pixel-triangle-270 {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.paste-preview-pixel.pixel-triangle-90 {
    clip-path: polygon(0% 0%, 0% 100%, 100% 50%);
}

.paste-preview-pixel.pixel-triangle-180 {
    clip-path: polygon(0% 0%, 50% 100%, 100% 0%);
}

.paste-preview-pixel.pixel-triangle-270 {
    clip-path: polygon(100% 0%, 100% 100%, 0% 50%);
}

.paste-preview-pixel.pixel-half-circle {
    clip-path: circle(50% at 50% 100%);
}

.paste-preview-pixel.pixel-half-circle-90 {
    clip-path: circle(50% at 0% 50%);
}

.paste-preview-pixel.pixel-half-circle-180 {
    clip-path: circle(50% at 50% 0%);
}

.paste-preview-pixel.pixel-half-circle-270 {
    clip-path: circle(50% at 100% 50%);
}

/* Modern paste silhouette styles */
.paste-silhouette {
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
}

.paste-silhouette:hover {
    opacity: 0.9 !important;
}

@keyframes pasteFeedback {
    0% { 
        transform: scale(0.8);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

.pixel.pasting {
    animation: pasteFeedback 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Keyboard shortcut hints */
.selection-context-menu .context-menu-btn::after {
    content: attr(data-shortcut);
    margin-left: auto;
    font-size: 12px;
    opacity: 0.6;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .selection-box {
        border-width: 3px;
        border-color: #000;
        background: rgba(255, 255, 0, 0.3);
    }
    
    .pixel.selected::after {
        border-color: #000;
        border-width: 3px;
    }
    
    .handle {
        background: #000;
        border-color: #fff;
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .selection-box,
    .pixel.selected::before,
    .selection-overlay,
    .context-menu-btn,
    .handle {
        animation: none;
        transition: none;
    }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .selection-box {
        border-color: #60a5fa;
        background: rgba(96, 165, 250, 0.1);
    }
    
    .pixel.selected::after {
        border-color: #60a5fa;
    }
    
    .handle {
        background: #60a5fa;
        border-color: #1f2937;
    }
}

/* ===============================
   SHAPE MENU STYLES
   =============================== */

.shape-menu {
    position: fixed;
    left: 0;
    top: 20%; /* Start below logo */
    width: 4.5rem;
    max-height: 80vh;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: none;
    border-radius: 0 16px 16px 0;
    z-index: 1000;
    overflow-y: auto;
    padding: 8px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.shape-menu-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shape-category {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shape-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.shape-option {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.shape-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.shape-option.active {
    background: rgba(0, 123, 255, 0.2);
    color: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 1px rgba(0, 123, 255, 0.5);
}

.shape-option svg {
    transition: transform 0.2s ease;
    width: 30px;
    height: 30px;
}

.shape-option:hover svg {
    transform: scale(1.05);
}

/* Shape Submenus */
.shape-submenu {
    position: fixed;
    left: 4.5rem;
    top: 20%;
    background: #374151;
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Position each submenu relative to its button */
#triangle-submenu {
    top: calc(20% + 52px); /* Adjust for triangle button position */
}

#half-circle-submenu {
    top: calc(20% + 104px); /* Adjust for half-circle button position */
}

#split-submenu {
    top: calc(20% + 156px); /* Adjust for split button position */
}

#corner-submenu {
    top: calc(20% + 208px); /* Adjust for corner button position */
}

.shape-submenu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.submenu-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
}

.submenu-option {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.submenu-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.submenu-option.active {
    background: rgba(0, 123, 255, 0.2);
    color: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 1px rgba(0, 123, 255, 0.5);
}

.submenu-option svg {
    transition: transform 0.2s ease;
    width: 25px;
    height: 25px;
}

.submenu-option:hover svg {
    transform: scale(1.05);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .shape-menu {
        width: 100px;
        top: 70px;
        padding: 6px;
    }
    
    .shape-option {
        width: 40px;
        height: 40px;
    }
    
    .shape-option svg {
        width: 18px;
        height: 18px;
    }
    
    .shape-grid {
        gap: 3px;
    }
    
    .shape-submenu {
        left: 100px;
        top: 70px;
    }
    
    .submenu-option {
        width: 36px;
        height: 36px;
    }
    
    .submenu-option svg {
        width: 14px;
        height: 14px;
    }
}

/* Hide background color wrapper */
.background-color-wrapper {
    display: none !important;
}

/* Hide brush shape button */
#brush-shape {
    display: none !important;
}

/* Hide light shadow tool button */
#light-shadow-tool-btn {
    display: none !important;
}

/* Eye dropper cursor styles */
.eye-dropper-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

.eye-dropper-preview {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.1s ease;
}

.eye-dropper-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
}

.crosshair-horizontal,
.crosshair-vertical {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.crosshair-horizontal {
    width: 20px;
    height: 1px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.crosshair-vertical {
    width: 1px;
    height: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Global cursor override when eye dropper is active */
body.eye-dropper-active {
    cursor: none !important;
}

body.eye-dropper-active * {
    cursor: none !important;
}

/* ===============================
   PIXEL ROTATION SYSTEM
   =============================== */

.pixel-rotating {
    outline: 4px solid rgba(0, 123, 255, 1) !important;
    outline-offset: 4px !important;
    z-index: 10 !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 1) !important;
    animation: pixelRotatingPulse 1s ease-in-out infinite alternate !important;
    border: 2px solid rgba(0, 123, 255, 1) !important;
}

@keyframes pixelRotatingPulse {
    0% {
        outline-color: rgba(0, 123, 255, 0.9) !important;
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8) !important;
        border-color: rgba(0, 123, 255, 0.9) !important;
    }
    100% {
        outline-color: rgba(0, 123, 255, 1) !important;
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 1) !important;
        border-color: rgba(0, 123, 255, 1) !important;
    }
}

/* Enhanced color preview animations */
.color-preview {
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: center;
}

.color-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Eye dropper button active state enhancement */
#eye-dropper-btn.active {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    transform: scale(1.02);
    box-shadow: 
        0 4px 16px rgba(34, 197, 94, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#eye-dropper-btn.active svg {
    color: #22c55e;
    filter: drop-shadow(0 2px 8px rgba(34, 197, 94, 0.4));
}

/* ===============================
   Corner Brush Styles
   =============================== */

.pixel-corner {
    position: relative;
    overflow: hidden;
    border: none !important;
}

.pixel-corner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    border-radius: 0 0 100% 0; /* Bottom-left quarter-circle (0°) */
    z-index: 1;
}

.pixel-corner-90 {
    position: relative;
    overflow: hidden;
    border: none !important;
}

.pixel-corner-90::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    border-radius: 0 100% 0 0; /* Top-right quarter-circle (90°) */
    z-index: 1;
}

.pixel-corner-180 {
    position: relative;
    overflow: hidden;
    border: none !important;
}

.pixel-corner-180::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    border-radius: 0 0 0 100%; /* Bottom-right quarter-circle (180°) */
    z-index: 1;
}

.pixel-corner-270 {
    position: relative;
    overflow: hidden;
    border: none !important;
}

.pixel-corner-270::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--shape-color, var(--primary-color));
    border-radius: 100% 0 0 0; /* Top-left quarter-circle (270°) */
    z-index: 1;
}

/* Hide only the Select Tool from the bottom menu bar */
.bottom-controls .tooltip-wrapper[data-tooltip="Select Tool"] {
    display: none !important;
}

/* Hide the download button from top right menu - using bottom menu export instead */
.download-wrapper {
    display: none !important;
}

/* Hide the original undo/redo buttons from top menu - moved to bottom menu */
.history-controls {
    display: none !important;
}

/* Hide the original zoom button from top menu - moved to bottom menu */
.zoom-wrapper {
    display: none !important;
}

/* Ensure undo/redo/zoom buttons work properly and aren't affected by drag */
.bottom-controls .control-btn {
    pointer-events: auto !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

.bottom-controls .control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bottom-controls .control-btn:not(:disabled) {
    cursor: pointer;
}

/* Export Text Button */
.export-text-btn {
    min-width: 80px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-text {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.export-text-btn:hover .export-text {
    color: rgba(255, 255, 255, 1);
}

/* Export Artwork Dropdown */
.export-dropdown {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 16px;
    width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.export-dropdown.visible {
    opacity: 1 !important;
    visibility: visible !important;
}

.export-dropdown .dropdown-header h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.export-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 1);
}

.export-option:active {
    transform: translateY(1px);
}

.export-option svg {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

.export-option:hover svg {
    color: rgba(255, 255, 255, 1);
}

.export-option span {
    flex: 1;
}

/* Hide Tuner button */
#tuner-btn {
    display: none !important;
}

/* Right-side Calibration Tuner */
#control-tuner {
    position: fixed;
    top: 64px;
    right: 16px;
    width: 260px;
    max-height: calc(100vh - 96px);
    overflow: auto;
    background: rgba(17,17,17,0.92);
    color: #f5f5f5;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    z-index: 9999;
    backdrop-filter: saturate(1.2) blur(8px);
}
#control-tuner .tuner-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-weight: 600;
}
#control-tuner .tuner-header button{
    background: transparent;
    color: #ddd;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
#control-tuner .tuner-body{
    padding: 10px 12px 12px;
}
#control-tuner .tuner-group{
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed rgba(255,255,255,0.08);
}
#control-tuner .tuner-group h4{
    margin: 6px 0 8px;
    font-size: 13px;
    color: #9fafff;
}
#control-tuner label{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    margin: 6px 0;
}
#control-tuner label.row{ justify-content: flex-start; gap: 8px; }
#control-tuner input[type="range"]{
    flex: 1;
    accent-color: #3b82f6;
}
#control-tuner .val{
    min-width: 44px;
    text-align: right;
    color: #cfd8ff;
}
#control-tuner .tuner-actions{
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
#control-tuner .tuner-actions button{
    flex: 1;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #eee;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
}