        margin-bottom: 8px;
    }
    
    .control-panel {
        width: 100%;
        margin-bottom: 8px;
    }

    .uploader-tabs-container {
        flex: 1 1 60%;
        min-height: 0;
    }
    
    .audio-visualizer {
        /* Allow natural height to fit content */
        min-height: auto;
        max-height: none;
        height: auto;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    button:hover {
        transform: none !important;
        background-color: inherit !important;
    }
    
    /* Add active states for better touch feedback */
    button:active {
        transform: scale(0.98) !important;
    }
    
    /* Remove hover effects from range sliders on touch devices */
    input[type="range"]::-webkit-slider-thumb:hover {
        background: #3498db !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
        transform: none !important;
    }
    
    input[type="range"]::-moz-range-thumb:hover {
        background: #3498db !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
        transform: none !important;
    }
    
    /* Better active states for range sliders on touch */
    input[type="range"]::-webkit-slider-thumb:active {
        background: #2980b9 !important;
        transform: scale(1.05) !important;
    }
    
    input[type="range"]::-moz-range-thumb:active {
        background: #2980b9 !important;
        transform: scale(1.05) !important;
    }
    
    /* Ensure minimum touch target size */
    button,
    .tab-button,
    .uploader-tab-button,
    .mode-option {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Better spacing for touch */
    .control-panel {
        gap: 12px;
    }
    
    .preview-container {
        gap: 10px;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (max-width: 767px) {
    /* Focus indicators */
    button:focus-visible,
    .tab-button:focus-visible,
    .mode-option:focus-visible,
    input:focus-visible,
    select:focus-visible {
        outline: 3px solid #4CAF50;
        outline-offset: 2px;
    }
    
    /* Better contrast for small text */
    .setting-description,
    .mic-test p,
    .file-types {
        color: #b0b0b0;
        line-height: 1.5;
    }
    
    /* Larger touch targets for interactive elements */
    input[type="range"] {
        min-height: 44px;
        margin: 8px 0;
        padding: 0;
        background: transparent !important;
        outline: none;
        border: none;
    }

    /* WebKit slider track */
    input[type="range"]::-webkit-slider-track {
        width: 100%;
        height: 8px;
        background: #333;
        border-radius: 4px;
        border: none;
        outline: none;
    }

    /* WebKit slider thumb */
    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 24px;
        height: 24px;
        background: #3498db;
        border-radius: 50%;
        cursor: pointer;
        border: 2px solid #2980b9;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        transition: all 0.2s ease;
    }

    /* WebKit slider thumb hover/active */
    input[type="range"]::-webkit-slider-thumb:hover {
        background: #5dade2;
        box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
        transform: scale(1.1);
    }

    input[type="range"]::-webkit-slider-thumb:active {
        background: #2980b9;
        transform: scale(0.95);
    }

    /* Firefox slider track */
    input[type="range"]::-moz-range-track {
        width: 100%;
        height: 8px;
        background: #333;
        border-radius: 4px;
        border: none;
        outline: none;
    }

    /* Firefox slider thumb */
    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
        background: #3498db;
        border-radius: 50%;
        cursor: pointer;
        border: 2px solid #2980b9;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        transition: all 0.2s ease;
    }

    /* Firefox slider thumb hover/active */
    input[type="range"]::-moz-range-thumb:hover {
        background: #5dade2;
        box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
        transform: scale(1.1);
    }

    input[type="range"]::-moz-range-thumb:active {
        background: #2980b9;
        transform: scale(0.95);
    }

    /* Focus states for accessibility */
    input[type="range"]:focus {
        outline: none;
    }

    input[type="range"]:focus::-webkit-slider-thumb {
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3), 0 2px 6px rgba(0, 0, 0, 0.3);
    }

    input[type="range"]:focus::-moz-range-thumb {
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3), 0 2px 6px rgba(0, 0, 0, 0.3);
    }
    
    /* Better select styling */
    select {
        min-height: 44px;
        padding: 12px;
        font-size: 14px;
    }
    
    /* Toggle switches */
    .switch {
        width: 50px;
        height: 26px;
    }
    
    .switch .slider:before {
        width: 22px;
        height: 22px;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
@media (max-width: 767px) {
    /* Reduce animations on mobile */
    * {
        animation-duration: 0.2s !important;
    }
    
    /* Optimize scrolling */
    .uploader-tab-pane,
    .settings-panel,
    .app-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Hardware acceleration for transforms */
    .mode-slider,
    button,
    .control-panel {
        will-change: transform;
        transform: translateZ(0);
    }
}

/* ===== CANVAS RESPONSIVE ===== */
@media (max-width: 767px) {
    #animationCanvas,
    #backgroundCanvas {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 1 !important;
        pointer-events: none !important;
    }
}

/* ===== HIDDEN PANELS STATE - MOBILE ===== */
@media (max-width: 767px) {
    .app-container.hidden-panels .audio-visualizer,
    .app-container.hidden-panels .uploader-tabs-container,
    .app-container.hidden-panels .mobile-mode-toggle,
    .app-container.hidden-panels .language-switcher-dropdown {
        display: none !important;
    }
    
    /* Control panel styling is now handled in control-panel-simplified.css */
}

/* ===== UTILITY CLASSES ===== */
.mobile-only {
    display: none;
}

@media (max-width: 767px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .control-panel,
    .mobile-mode-toggle,
    .settings-panel,
    .uploader-tabs-container {
        display: none !important;
    }
}

/* ===== HIGH DPI SCREENS ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .control-panel,
    .upload-area,
    .image-preview {
        border-width: 0.5px;
    }
    
    .control-panel button {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }
}

/* ===== MOBILE LAYOUT FIXES ===== */
@media (max-width: 767px) {
    /* Ensure body allows scrolling and prevents horizontal overflow */
    body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        width: 100vw;
        max-width: 100vw;
    }
    
    /* App container mobile layout */
    .app-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-height: 100vh !important;
        height: auto !important;
        padding: 12px !important;
        gap: 12px !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        position: relative !important;
    }
    
    /* Ensure all main elements are centered and properly sized */
    .control-panel,
    .mode-toggle-dropdown,
    .uploader-tabs-container {
        width: 100% !important;
        max-width: 400px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }
    
    /* Audio visualizer mobile sizing - preserve natural content fitting */
    .audio-visualizer {
        width: auto !important;
        min-width: 240px !important;
        max-width: 400px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        /* Allow content to dictate height naturally */
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        /* Enhanced overflow handling for mobile */
        overflow-x: hidden !important;
        overflow-y: visible !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        padding: 16px !important;
        /* Improved gap for mobile */
        gap: 8px !important;
    }
    
    /* Enhanced mobile text wrapping */
    .audio-visualizer .mic-test {
        overflow: visible !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        gap: 6px !important;
        height: auto !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        padding: 2px 0 !important;
    }
    
    .audio-visualizer .mic-test p {
        word-break: keep-all !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        font-size: 12px !important;
        line-height: 1.3 !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        hyphens: none !important;
        letter-spacing: 0.2px !important;
    }
    
    .audio-visualizer #audioStatusDetection {
        word-break: keep-all !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        font-size: 11px !important;
        line-height: 1.2 !important;
        padding: 8px !important;
        margin: 4px 0 0 0 !important;
        min-height: 38px !important;
        height: auto !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        hyphens: none !important;
    }
    
    .audio-visualizer .volume-meter {
        margin: 0 0 6px 0 !important;
        height: 6px !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
    }
    
    .app-container.hidden-panels .audio-visualizer,
    .app-container.hidden-panels .uploader-tabs-container,
    .app-container.hidden-panels .mobile-mode-toggle,
    .app-container.hidden-panels .language-switcher-dropdown {
        display: none !important;
    }
    
    /* Control panel styling is now handled in control-panel-simplified.css */
    
    /* Language Switcher Mobile Optimizations */
    .language-switcher-dropdown {
        /* Override desktop positioning - center on mobile */
        position: relative !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
        display: flex;
        justify-content: center;
        align-self: center;
        z-index: 200;
    }
    
    .language-switcher-button {
        min-width: 70px; /* Smaller on mobile */
        font-size: 11px;
        padding: 6px 10px;
        gap: 4px;
    }
    
    .language-switcher-button .current-language-text {
        font-size: 9px;
    }
    
    .language-switcher-button .language-icon {
        font-size: 14px;
    }
    
    .language-dropdown-menu {
        min-width: 130px; /* Ensure adequate width for text */
        margin-top: 4px;
    }
    
    .language-dropdown-menu .language-option {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .language-dropdown-menu .language-option .language-flag {
        font-size: 14px;
    }
    
    .language-dropdown-menu .language-option .language-text {
        font-size: 12px;
    }
}

/* ===== TOUCH DEVICE LANGUAGE SWITCHER ===== */
@media (hover: none) and (pointer: coarse) {
    .language-switcher-button,
    .language-option {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Remove hover effects on touch devices for language switcher */
    .language-switcher-button:hover {
        transform: none !important;
        background-color: #2c2c2c !important;
    }
    
    .language-dropdown-menu .language-option:hover {
        background-color: transparent !important;
    }
    
    /* Add active states for better touch feedback */
    .language-switcher-button:active {
        transform: scale(0.98) !important;
        background-color: #3c3c3c !important;
    }
    
    .language-dropdown-menu .language-option:active {
        background-color: #3c3c3c !important;
    }
}

/* ===== HORIZONTAL LAYOUT FOR TABLETS ===== */
@media (min-width: 768px) and (max-width: 1024px) {
    .control-panel {
        width: 100%;
        margin-bottom: 8px;
    }

    .uploader-tabs-container {
        flex: 1 1 60%;
        min-height: 0;
    }
    
    /* Remove conflicting audio-visualizer flex that overrides natural sizing */
    .audio-visualizer {
        /* Allow natural height to fit content */
        min-height: auto;
        max-height: none;
        height: auto;
    }
}

/* Mobile-specific setting styles */
.setting {
    margin-bottom: 20px;
    padding: 0 8px;
}

.setting label {
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
    line-height: 1.4;
}

.setting-description {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 12px;
    color: #b0b0b0;
}

/* Range labels mobile styling */
.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
    padding: 0 4px;
    line-height: 1.2;
}

.range-labels span {
    flex: 0 0 auto;
    max-width: 45%;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.range-labels span:first-child {
    text-align: left;
}

.range-labels span:last-child {
    text-align: right;
}

/* Override any background colors from other CSS files */
.setting input[type="range"] {
    background-color: transparent !important;
    background: transparent !important;
}

/* ===== TOUCH DEVICE DROPDOWNS ===== */
@media (hover: none) and (pointer: coarse) {
    .language-switcher-button,
    .language-option {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Remove hover effects on touch devices for language switcher */
    .language-switcher-button:hover {
        transform: none !important;
        background-color: #2c2c2c !important;
    }
    
    .language-dropdown-menu .language-option:hover {
        background-color: transparent !important;
    }
    
    /* Add active states for better touch feedback */
    .language-switcher-button:active {
        transform: scale(0.98) !important;
        background-color: #3c3c3c !important;
    }
    
    .language-dropdown-menu .language-option:active {
        background-color: #3c3c3c !important;
    }
} 