/**
 * LUVLANG PROFESSIONAL CSS FIXES
 * Addresses all CSS structure improvements for pro-grade UI
 */

/* ============================================================================
   1. EQ FADER THUMB - FIXED HOVER/ACTIVE STATES WITH PROPER CENTERING
   ============================================================================ */

.eq-fader-thumb {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);  /* Always maintain horizontal center */
    width: 40px;
    height: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.15s ease;
    z-index: 10;
}

.eq-fader-thumb:hover {
    /* Keep translateX(-50%) for horizontal centering during hover */
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.eq-fader-thumb:active {
    cursor: grabbing;
    /* Maintain centering while actively dragging */
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.8);
}

/* During drag, JavaScript must update only the 'top' property, not transform */
.eq-fader-thumb.dragging {
    transition: none;  /* Disable transitions during drag for smooth movement */
    transform: translateX(-50%);  /* Lock horizontal centering */
}

/* ============================================================================
   2. ANALYSIS PANEL - ENHANCED DISPLAY STATES
   ============================================================================ */

.analysis-panel {
    display: none;  /* Hidden by default until AI analysis runs */
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    animation: slideIn 0.3s ease-out;
}

.analysis-panel.visible {
    display: block;
}

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

/* ============================================================================
   3. CANVAS ELEMENTS - PROPER SIZING AND RENDERING
   ============================================================================ */

.eq-graph-canvas,
.waveform-canvas,
.vectorscope-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #0a0a0f;
    border-radius: 8px;
    /* Ensure sharp rendering for audio visualizations */
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Container for canvas elements must have explicit dimensions */
.eq-graph-container,
.waveform-container,
.vectorscope-container {
    position: relative;
    width: 100%;
    height: 200px;
    min-height: 150px;
    border-radius: 8px;
    overflow: hidden;
}

/* ============================================================================
   4. PROFESSIONAL METER IMPROVEMENTS
   ============================================================================ */

.meter-bar {
    position: relative;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.meter-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.15s ease-out;
    /* Gradient will be set per meter type in JS */
}

/* Meter value with dynamic color coding */
.meter-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 8px;
    transition: color 0.2s ease;
}

.meter-value.critical {
    color: #ff4444;
}

.meter-value.warning {
    color: #ffaa00;
}

.meter-value.good {
    color: #00ff88;
}

/* ============================================================================
   5. ENHANCED SLIDER CONTROLS (For custom sliders/faders)
   ============================================================================ */

/* Remove default styling for better custom controls */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    transition: background 0.2s ease;
}

input[type="range"]:hover {
    background: rgba(255, 255, 255, 0.15);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transition: all 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transition: all 0.15s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.6);
}

/* ============================================================================
   6. BUTTON IMPROVEMENTS - PROFESSIONAL INTERACTIONS
   ============================================================================ */

.btn-primary,
.legendary-btn {
    position: relative;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    overflow: hidden;
}

.btn-primary:hover,
.legendary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.btn-primary:active,
.legendary-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Ripple effect on click */
.btn-primary::after,
.legendary-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-primary:active::after,
.legendary-btn:active::after {
    width: 200px;
    height: 200px;
}

/* ============================================================================
   7. EXPORT FORMAT GRID - ENHANCED SELECTION
   ============================================================================ */

.export-format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.export-format-btn {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-format-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.5);
    color: #ffffff;
}

.export-format-btn.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
    border-color: #667eea;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(102, 126, 234, 0.4);
}

/* ============================================================================
   8. RESPONSIVE IMPROVEMENTS
   ============================================================================ */

@media (max-width: 1024px) {
    .eq-fader-thumb {
        width: 35px;
        height: 14px;
    }
    
    .meter-value {
        font-size: 1rem;
    }
    
    .export-format-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .eq-fader-thumb {
        width: 30px;
        height: 12px;
    }
    
    .meter-value {
        font-size: 0.9rem;
    }
    
    .btn-primary,
    .legendary-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
}

/* ============================================================================
   9. ACCESSIBILITY IMPROVEMENTS
   ============================================================================ */

/* Focus states for keyboard navigation */
.eq-fader-thumb:focus,
input[type="range"]:focus,
.btn-primary:focus,
.legendary-btn:focus,
.export-format-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .meter-bar {
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .eq-fader-thumb {
        border: 2px solid #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    /* Disable decorative animations but keep structural transitions */
    .scorecard-container,
    #masteringReport,
    .analysis-panel,
    .loading-spinner,
    .btn-primary::after,
    .legendary-btn::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

    /* Shorten structural transitions instead of removing */
    .mobile-bottom-sheet,
    .mobile-menu-drawer,
    .mobile-accordion-body,
    .bottom-sheet-handle::before {
        transition-duration: 0.15s !important;
    }
}

/* WCAG AA contrast fix: bump 0.35 opacity labels to 0.55 minimum */
.bottom-sheet-lufs-label,
.bottom-sheet-expand-hint,
.accordion-label {
    color: rgba(255, 255, 255, 0.55) !important;
}

/* ============================================================================
   10. LOADING STATES
   ============================================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
}

.loading-detail {
    margin-top: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================================================
   11. DRAMATIC MOBILE RESPONSIVE OVERHAUL
   Collapsible sidebars, bottom-sheet metering, touch-friendly controls,
   single-column layout, hamburger menu, responsive typography, swipe nav
   ============================================================================ */

/* --------------------------------------------------------------------------
   11.1 HAMBURGER MENU - Mobile Navigation Drawer
   -------------------------------------------------------------------------- */
.mobile-hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 3000;
    width: 44px;
    height: 44px;
    background: linear-gradient(145deg, rgba(10, 10, 20, 0.95), rgba(20, 20, 40, 0.98));
    border: 1px solid rgba(212, 169, 78, 0.3);
    border-radius: 10px;
    cursor: pointer;
    padding: 10px;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    -webkit-tap-highlight-color: transparent;
}

.mobile-hamburger .hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: #d4a94e;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.mobile-hamburger .hamburger-line::before,
.mobile-hamburger .hamburger-line::after {
    content: '';
    position: absolute;
    left: 0;
    width: 24px;
    height: 2px;
    background: #d4a94e;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-hamburger .hamburger-line::before {
    top: -7px;
}

.mobile-hamburger .hamburger-line::after {
    top: 7px;
}

/* Hamburger open state - X animation */
.mobile-hamburger.open .hamburger-line {
    background: transparent;
}

.mobile-hamburger.open .hamburger-line::before {
    top: 0;
    transform: rotate(45deg);
    background: #ff6b6b;
}

.mobile-hamburger.open .hamburger-line::after {
    top: 0;
    transform: rotate(-45deg);
    background: #ff6b6b;
}

/* Hamburger Menu Drawer */
.mobile-menu-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg, #101018 0%, #0a0a10 100%);
    border-right: 1px solid rgba(212, 169, 78, 0.15);
    z-index: 2500;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 70px 16px 100px;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.6);
    -webkit-overflow-scrolling: touch;
}

.mobile-menu-drawer.open {
    transform: translateX(0);
}

.mobile-menu-drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 2499;
    transition: background 0.35s ease;
    pointer-events: none;
}

.mobile-menu-drawer-overlay.visible {
    background: rgba(0, 0, 0, 0.7);
    pointer-events: auto;
}

/* Menu Items */
.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-item:active {
    background: rgba(212, 169, 78, 0.15);
    border-color: rgba(212, 169, 78, 0.3);
    color: #d4a94e;
    transform: scale(0.98);
}

.mobile-menu-item .menu-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.mobile-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 8px 0;
}

.mobile-menu-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(212, 169, 78, 0.7);
    padding: 12px 16px 4px;
}

/* --------------------------------------------------------------------------
   11.2 COLLAPSIBLE ACCORDION SECTIONS - Mobile Sidebar
   -------------------------------------------------------------------------- */
.mobile-accordion-header {
    display: none; /* Hidden on desktop */
}

/* --------------------------------------------------------------------------
   11.3 BOTTOM SHEET METERING - Draggable Metering Panel
   -------------------------------------------------------------------------- */
.mobile-bottom-sheet {
    display: none;
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)); /* Above mobile nav */
    left: 0;
    right: 0;
    z-index: 1900;
    background: linear-gradient(180deg, #101018 0%, #0a0a10 100%);
    border-top: 1px solid rgba(212, 169, 78, 0.2);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100vh - 130px);
    max-height: calc(100dvh - 130px);
    overflow: hidden;
}

.mobile-bottom-sheet.collapsed {
    transform: translateY(calc(100% - 80px));
}

.mobile-bottom-sheet.expanded {
    transform: translateY(0);
}

.bottom-sheet-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0 14px; /* 44px total touch target (WCAG AA) */
    cursor: grab;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}

.bottom-sheet-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
}

.bottom-sheet-handle:active {
    cursor: grabbing;
}

.bottom-sheet-peek {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 20px 12px;
    gap: 12px;
}

.bottom-sheet-lufs {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.bottom-sheet-lufs-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    font-weight: 900;
    color: #00ff88;
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
    line-height: 1;
}

.bottom-sheet-lufs-label {
    font-size: 0.55rem;
    color: rgba(0, 255, 136, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.bottom-sheet-mini-meter {
    flex: 1;
    max-width: 120px;
    height: 6px;
    background: linear-gradient(90deg,
        rgba(212, 169, 78, 0.3) 0%,
        rgba(0, 255, 136, 0.3) 50%,
        rgba(255, 200, 0, 0.3) 80%,
        rgba(255, 0, 0, 0.3) 100%
    );
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.bottom-sheet-expand-hint {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    gap: 4px;
}

.bottom-sheet-expand-hint .chevron-up {
    display: inline-block;
    transition: transform 0.3s ease;
}

.mobile-bottom-sheet.expanded .bottom-sheet-expand-hint .chevron-up {
    transform: rotate(180deg);
}

.bottom-sheet-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100vh - 220px);
    max-height: calc(100dvh - 220px);
    padding: 0 16px 24px;
}

/* --------------------------------------------------------------------------
   11.4 SWIPE NAVIGATION - CSS Scroll Snap Sections
   -------------------------------------------------------------------------- */
.mobile-swipe-container {
    display: none;
}

/* ============================================================================
   MOBILE BREAKPOINT (< 768px) - Complete Mobile Overhaul
   ============================================================================ */
@media screen and (max-width: 767px) {

    /* --- Show mobile-specific elements --- */
    .mobile-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-drawer {
        display: block;
    }

    .mobile-menu-drawer-overlay {
        display: block;
    }

    .mobile-bottom-sheet {
        display: block;
    }

    /* --- Responsive Typography --- */
    body {
        font-size: 14px;
    }

    .section-title {
        font-size: 0.75rem !important;
        letter-spacing: 1.5px !important;
    }

    .panel-title {
        font-size: 0.7rem !important;
        padding: 10px 12px !important;
    }

    .logo-text {
        font-size: 1.4rem !important;
    }

    .logo-subtitle {
        font-size: 0.65rem !important;
    }

    h1, .checkout-title {
        font-size: 1.4rem !important;
    }

    h2 {
        font-size: 1.1rem !important;
    }

    h3 {
        font-size: 0.95rem !important;
    }

    /* Minimum body text readability — scoped to content elements only */
    .upload-text,
    .feature-description,
    .detail-text,
    .info-text {
        font-size: 0.85rem !important;
    }

    /* Meter values slightly smaller on mobile */
    #liveLufsValue, #measuredLufsValue {
        font-size: 1.8rem !important;
    }

    #shortLufsValue, #momentaryLufsValue, #lraValue, #crestValue,
    #truePeakValue, #psrValue, #plrValue, #correlationValue {
        font-size: 1.3rem !important;
    }

    /* --- Single Column Layout Override --- */
    .app-container {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        height: auto !important;
        min-height: 100vh;
        overflow: visible !important;
        padding-bottom: 150px; /* Space for bottom sheet + nav */
    }

    /* --- Left Sidebar: Inline Collapsible Accordion --- */
    .left-sidebar {
        position: relative !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        z-index: 1 !important;
        order: 1;
        padding: 12px 16px !important;
        padding-top: 60px !important; /* Space for hamburger */
        border-right: none !important;
        border-bottom: 1px solid rgba(212, 169, 78, 0.08);
        overflow: visible !important;
    }

    /* Hide header logo on mobile (shown in drawer instead) */
    .left-sidebar .header-logo {
        display: none !important;
    }

    /* Hide auth section on mobile (moved to menu) */
    .left-sidebar #authSection {
        display: none !important;
    }

    /* Upload area stays visible */
    .left-sidebar .upload-area {
        margin-bottom: 16px;
    }

    /* --- Collapsible Accordion for Sidebar Sections --- */
    .mobile-accordion-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 10px;
        cursor: pointer;
        margin-bottom: 4px;
        min-height: 48px;
        -webkit-tap-highlight-color: transparent;
        transition: all 0.2s ease;
    }

    .mobile-accordion-header:active {
        background: rgba(212, 169, 78, 0.08);
        border-color: rgba(212, 169, 78, 0.2);
    }

    .mobile-accordion-header .accordion-label {
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        color: rgba(255, 255, 255, 0.6);
    }

    .mobile-accordion-header .accordion-value {
        font-size: 0.7rem;
        font-weight: 600;
        color: #d4a94e;
        margin-left: auto;
        margin-right: 12px;
    }

    .mobile-accordion-header .accordion-chevron {
        font-size: 0.9rem;
        color: rgba(212, 169, 78, 0.5);
        transition: transform 0.3s ease;
        flex-shrink: 0;
    }

    .mobile-accordion-header::after {
        content: 'tap to change';
        font-size: 0.5rem;
        color: rgba(255, 255, 255, 0.2);
        margin-left: auto;
        margin-right: 8px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .mobile-accordion-header.expanded .accordion-chevron {
        transform: rotate(90deg);
        color: #d4a94e;
    }

    /* Accordion body collapsed by default */
    .mobile-accordion-body {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-accordion-body.expanded {
        max-height: 800px;
    }

    .mobile-accordion-body .selector-group {
        padding: 12px 0;
        margin-bottom: 0;
    }

    /* Hide original section titles inside accordion (replaced by header) */
    .mobile-accordion-body .section-title {
        display: none !important;
    }

    /* Swipe Container for Format/Platform/Genre */
    .mobile-swipe-container {
        display: flex !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 0;
        margin: 0 -16px;
        padding: 0 16px;
        scrollbar-width: none;
    }

    .mobile-swipe-container::-webkit-scrollbar {
        display: none;
    }

    .mobile-swipe-section {
        flex: 0 0 100%;
        scroll-snap-align: start;
        padding: 12px 8px;
    }

    /* Swipe indicator dots */
    .swipe-dots {
        display: flex;
        justify-content: center;
        gap: 6px;
        padding: 8px 0;
    }

    .swipe-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        transition: all 0.3s ease;
    }

    .swipe-dot.active {
        background: #d4a94e;
        width: 18px;
        border-radius: 3px;
    }

    /* --- Center Main: Full Width --- */
    .center-main {
        width: 100% !important;
        order: 2;
        padding: 12px !important;
        padding-top: 16px !important;
        min-height: auto !important;
        overflow: visible !important;
    }

    /* Compact viz panels on mobile */
    .viz-panel {
        margin-bottom: 10px !important;
        border-radius: 12px !important;
    }

    .spectrum-panel canvas#spectrumCanvas {
        height: 160px !important;
    }

    .spectrum-panel canvas#spectrumOverlayCanvas {
        height: 160px !important;
    }

    /* Simplify stereo field on mobile */
    .meters-panel-viz > div[style*="display: flex; gap: 15px"] {
        height: 140px !important;
    }

    /* --- Right Sidebar: Hidden on mobile (content in bottom sheet) --- */
    .right-sidebar {
        display: none !important;
    }

    /* --- Touch-Friendly Controls --- */

    /* All interactive elements: 44px minimum touch target */
    .selector-btn {
        min-height: 44px !important;
        padding: 10px 8px !important;
        font-size: 0.75rem !important;
    }

    .action-btn,
    .action-btn-primary,
    .action-btn-secondary {
        min-height: 48px !important;
        padding: 12px 16px !important;
        font-size: 0.75rem !important;
    }

    .transport-btn {
        min-height: 44px !important;
        padding: 10px 14px !important;
        font-size: 0.72rem !important;
    }

    .export-bar-btn {
        min-height: 44px !important;
        padding: 10px 14px !important;
    }

    button, [role="button"] {
        min-height: 44px;
    }

    /* Larger slider thumbs on touch */
    input[type="range"]::-webkit-slider-thumb {
        width: 28px !important;
        height: 28px !important;
    }

    input[type="range"]::-moz-range-thumb {
        width: 28px !important;
        height: 28px !important;
    }

    input[type="range"] {
        height: 8px !important;
    }

    /* Larger EQ fader thumbs on touch */
    .eq-fader-thumb {
        width: 48px !important;
        height: 22px !important;
        border-radius: 11px !important;
    }

    /* Larger EQ control points for touch */
    .eq-handle,
    .eq-control-point {
        width: 28px !important;
        height: 28px !important;
    }

    /* Increase spacing between interactive elements */
    .selector-grid {
        gap: 8px !important;
    }

    .transport-controls {
        gap: 8px !important;
        padding: 10px 12px !important;
    }

    .transport-extended {
        gap: 6px !important;
    }

    /* --- AI Command Bar: Compact Mobile --- */
    .ai-command-bar {
        top: auto !important;
        bottom: 72px !important;
        left: 12px !important;
        right: 12px !important;
        transform: none !important;
        padding: 6px 12px !important;
        border-radius: 14px !important;
        z-index: 1950 !important;
        transition: bottom 0.2s ease !important;
    }
    /* When export bar is visible, push command bar above it */
    .ai-command-bar.export-bar-active {
        bottom: 128px !important; /* 64px nav + 56px export bar + 8px gap */
    }

    .ai-master-btn-floating {
        padding: 10px 16px !important;
        font-size: 0.75rem !important;
        letter-spacing: 1px !important;
        flex: 1;
    }

    .ai-btn-icon {
        font-size: 1.1rem !important;
    }

    .ai-status-pill {
        padding: 4px 10px !important;
        font-size: 0.6rem !important;
    }

    /* --- Persistent Export Bar: Above mobile nav --- */
    .persistent-export-bar {
        bottom: 64px !important;
        padding: 8px 12px !important;
    }

    .export-bar-content {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .export-bar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .export-bar-actions .export-bar-btn {
        flex: 1;
    }

    /* --- Tier Selector: Compact on mobile --- */
    .tier-selector-container {
        top: 10px !important;
        padding: 10px 16px !important;
        gap: 12px !important;
        border-radius: 12px !important;
    }

    .tier-option {
        padding: 8px 14px !important;
        font-size: 0.75rem !important;
    }

    .tier-selector-label {
        display: none !important;
    }

    /* --- Spec Sheet: Full width bottom on mobile --- */
    .spec-sheet-container {
        bottom: 72px !important;
        right: 8px !important;
        left: 8px !important;
        padding: 14px !important;
        border-radius: 10px !important;
    }

    .spec-row {
        grid-template-columns: 60px 1fr 60px !important;
        gap: 8px !important;
        padding: 8px !important;
    }

    /* --- Checkout Tray: Full screen on mobile --- */
    .checkout-tray.open {
        height: 100vh !important;
        height: 100dvh !important;
    }

    .checkout-tray-content {
        padding: 20px 16px !important;
    }

    .checkout-title {
        font-size: 1.3rem !important;
    }

    .checkout-tier-price {
        font-size: 1.5rem !important;
    }

    /* --- EQ Faders: Horizontal scroll with snap --- */
    .eq-faders {
        scroll-snap-type: x mandatory !important;
        gap: 10px !important;
        padding: 12px 10px !important;
    }

    .eq-fader-container {
        min-width: 55px !important;
        scroll-snap-align: start !important;
    }

    /* --- Reference Track Section: Compact --- */
    #referenceTrackSection {
        padding: 12px !important;
    }

    #referenceDropZone {
        padding: 14px 12px !important;
    }

    /* Mode switcher removed — all users get full view */

    /* --- Album Mode Section --- */
    #albumBatchSection {
        margin-bottom: 12px !important;
    }

    /* --- Hide desktop-only decorative elements on mobile --- */
    .panel-card::before {
        display: none;
    }

    /* Fix goniometer canvas size on mobile */
    #goniometerCanvas {
        width: 120px !important;
        height: 120px !important;
    }

    /* Tonal balance: compact */
    #tonalBalanceBars {
        height: 40px !important;
    }

    /* Intensity buttons: ensure readable */
    #sidebarIntensityButtons {
        grid-template-columns: repeat(5, 1fr) !important;
    }

    .intensity-btn {
        padding: 8px 4px !important;
        min-height: 44px !important;
    }

    /* Progress overlay: full mobile */
    .progress-overlay {
        padding: 20px !important;
    }

    .progress-content {
        max-width: 100% !important;
        padding: 24px 16px !important;
    }

    /* --- Tour Language Modal: fit mobile viewport --- */
    #tourLanguageModal > div {
        padding: 24px 16px !important;
        max-width: 95vw !important;
        border-radius: 16px !important;
        margin: 0 auto;
    }

    #tourLanguageModal .lang-btn {
        padding: 12px 10px !important;
        min-height: 44px !important;
        font-size: 0.8rem !important;
    }

    #tourLanguageModal h2 {
        font-size: 1.2rem !important;
    }

    #tourLanguageModal p {
        font-size: 0.8rem !important;
        margin-bottom: 16px !important;
    }

    /* --- Mobile Grid Overflows --- */

    /* Console platform grid: 5 cols → 3 cols on mobile */
    #consolePlatformGrid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    /* Console format grid: 4 cols → 2 cols on mobile */
    #consoleFormatGrid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* A/B metrics grid: 4 cols → 2 cols on mobile */
    .ab-metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    /* Tour format grid: 4 cols → 2 cols on all mobile */
    #tourFormatZone div[style*="repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Feature lock tooltip: allow wrapping on mobile */
    .feature-lock-tooltip {
        white-space: normal !important;
        max-width: 90vw !important;
        text-align: center;
    }

    /* Smart hints container: constrain width */
    #smartHintsContainer {
        max-width: calc(100vw - 24px) !important;
    }

    /* Boost low-contrast text for WCAG AA (4.5:1 minimum) */
    .section-title,
    .panel-title,
    .control-name,
    .meter-label {
        color: rgba(255, 255, 255, 0.6) !important;
    }

    .persistent-export-bar {
        z-index: 1960 !important;
    }

    /* When export bar is visible, push bottom sheet peek above it */
    .mobile-bottom-sheet.has-export-bar {
        bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* FIX 1: Hide Buy Credits button on mobile until after first master */
    #buyCreditsBtn,
    #buyCreditsBtn + div {
        display: none !important;
    }

    /* FIX 2: Make upload area more prominent on mobile */
    .upload-area {
        min-height: 100px !important;
        border: 2px dashed rgba(212, 169, 78, 0.4) !important;
        background: rgba(212, 169, 78, 0.05) !important;
    }

    .upload-area .upload-text,
    .upload-area div[style*="Click or drag"] {
        font-size: 0.85rem !important;
        color: rgba(212, 169, 78, 0.8) !important;
    }

    /* FIX 3: Hide MASTER button from command bar on mobile before mastering */
    #aiMasterBtnFloating.pre-master-mobile {
        display: none !important;
    }

    /* FIX 6: Simplify command bar on mobile — stack elements */
    .ai-command-bar {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 6px !important;
        padding: 8px 10px !important;
    }

    /* Status pill and track type compact on mobile */
    .ai-status-pill {
        order: 10;
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* ============================================================================
   SMALL PHONE BREAKPOINT (< 480px) - Extra compact
   ============================================================================ */
@media screen and (max-width: 479px) {

    .mobile-hamburger {
        top: 8px;
        left: 8px;
        width: 40px;
        height: 40px;
    }

    .left-sidebar {
        padding: 8px 12px !important;
        padding-top: 56px !important;
    }

    .center-main {
        padding: 8px !important;
    }

    /* Genre grid: 3 columns on small phones */
    #genreSection .selector-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px !important;
    }

    #genreSection .selector-btn {
        padding: 6px 2px !important;
        min-height: 44px !important;
    }

    #genreSection .selector-btn div {
        font-size: 0.6rem !important;
    }

    /* Platform: stack vertically on tiny screens */
    #platformSection .selector-grid {
        grid-template-columns: 1fr !important;
    }

    /* Spectrum: even more compact */
    .spectrum-panel canvas#spectrumCanvas {
        height: 120px !important;
    }

    .spectrum-panel canvas#spectrumOverlayCanvas {
        height: 120px !important;
    }

    /* Bottom sheet peek: smaller */
    .bottom-sheet-lufs-value {
        font-size: 1.3rem;
    }

    /* Menu drawer: narrower */
    .mobile-menu-drawer {
        width: 260px;
    }

    /* Toast notifications */
    .luvlang-toast {
        font-size: 12px;
        padding: 10px 14px;
    }

    /* Dynamics collapsible: compact */
    .dynamics-section {
        padding: 10px !important;
    }

    /* Transport controls: horizontal scroll on small screens */
    .transport-extended {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
    }

    /* Tour format grid: 2 columns on tiny screens */
    #tourFormatZone div[style*="repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

}

/* Scroll affordance: fade gradient on right edge of scrollable containers */
@media screen and (max-width: 767px) {
    .eq-faders,
    .transport-extended {
        position: relative;
        -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 85%, transparent 100%);
        mask-image: linear-gradient(90deg, #000 0%, #000 85%, transparent 100%);
    }

    /* Remove mask when scrolled to end (JS adds this class) */
    .eq-faders.scroll-end,
    .transport-extended.scroll-end {
        -webkit-mask-image: none;
        mask-image: none;
    }
}

@media screen and (max-width: 374px) {
    .complete-stats {
        gap: 8px !important;
    }
    .stat-box {
        min-width: 80px !important;
        padding: 10px 12px !important;
    }
}

/* ============================================================================
   TOUCH DEVICE DETECTION - Enhanced controls for touch
   ============================================================================ */
@media (pointer: coarse) {
    /* Ensure all clickable elements have adequate touch targets */
    .selector-btn,
    .action-btn,
    .transport-btn,
    .export-bar-btn,
    .mobile-nav-btn,
    .mode-btn,
    .tier-option,
    .mobile-menu-item {
        min-height: 44px;
    }

    /* Larger range slider thumbs */
    input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }

    input[type="range"]::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }

    /* Prevent accidental double-tap zoom */
    * {
        touch-action: manipulation;
    }

    /* --- Fix z-index: export bar between nav and AI command bar --- */
    .persistent-export-bar {
        z-index: 1960 !important;
        bottom: 64px !important;
    }

    /* --- Fix complete-stats overflow (3 stat boxes > 375px) --- */
    .complete-stats {
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    .stat-box {
        min-width: 100px !important;
        padding: 12px 16px !important;
    }

    /* --- Disable CSS ::after tooltips on mobile (use JS tooltips instead) --- */
    .feature-card::after {
        display: none !important;
    }

    /* --- Widen EQ fader tracks for thumb-friendly drag --- */
    .eq-fader-track {
        width: 44px !important;
    }

    /* --- Transport buttons: horizontal scroll instead of multi-row wrap --- */
    .transport-extended {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px !important;
    }
    .transport-extended::-webkit-scrollbar {
        display: none;
    }
    .transport-btn {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }

    /* --- Footer: reduce padding, stack links vertically --- */
    footer {
        padding: 20px 16px !important;
    }

    /* --- Mobile nav icons --- */
    .mobile-nav-btn {
        flex-direction: column !important;
        gap: 2px !important;
        font-size: 0.7rem !important;
    }

    /* --- Menu drawer items: better tap targets --- */
    .mobile-menu-item {
        padding: 14px 20px !important;
        font-size: 0.9rem !important;
    }

    /* --- Tour language modal: reduce padding, fit 375px --- */
    #tourLanguageModal > div {
        padding: 24px 20px !important;
        max-width: 95vw !important;
        border-radius: 16px !important;
    }
    #tourLanguageModal .lang-btn {
        padding: 12px 10px !important;
        min-height: 44px !important;
    }
    #tourLanguageModal button[id="_csp_button_8"] {
        min-height: 44px !important;
        padding: 12px 20px !important;
    }

    /* --- Tour format zone: fix 4-column grid → 2-column on mobile --- */
    #tourFormatZone {
        padding: 20px 16px !important;
        width: 95vw !important;
    }
    #tourFormatZone .format-tour-btn,
    #tourFormatZone .bitdepth-tour-btn {
        min-height: 44px !important;
    }

    /* --- Mastering console overlay: fix tiny text --- */
    #preMasteringGenreSelect {
        padding: 8px !important;
    }
    #preMasteringGenreSelect .console-platform-btn div:last-child {
        font-size: 0.55rem !important;
    }
    #consolePlatformGrid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
}

/* ============================================================================
   LANDSCAPE MOBILE - Adjust for horizontal orientation
   ============================================================================ */
@media screen and (max-width: 767px) and (orientation: landscape) {
    .mobile-bottom-sheet.collapsed {
        transform: translateY(calc(100% - 60px));
    }

    .app-container {
        padding-bottom: 120px !important;
    }

    .center-main {
        padding-top: 12px !important;
    }

    .left-sidebar {
        padding-top: 50px !important;
    }

    /* Horizontal: show viz panels side by side */
    .center-main {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .viz-panel {
        flex: 1;
        min-width: 48%;
    }
}

/* ============================================================================
   12. MOBILE PARITY — Tabbed Bottom Sheet, Touch Features, Full Experience
   ============================================================================ */

/* --------------------------------------------------------------------------
   12.1 BOTTOM SHEET TAB BAR (1A)
   -------------------------------------------------------------------------- */
.bottom-sheet-tabs {
    display: none;
}

@media screen and (max-width: 767px) {
    .bottom-sheet-tabs {
        display: flex;
        gap: 0;
        padding: 0 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        background: rgba(0, 0, 0, 0.2);
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .bottom-sheet-tabs::-webkit-scrollbar {
        display: none;
    }

    .bs-tab {
        flex: 1;
        min-width: 0;
        padding: 10px 6px;
        background: none;
        border: none;
        border-bottom: 2px solid transparent;
        color: rgba(255, 255, 255, 0.65);
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 1px;
        text-transform: uppercase;
        cursor: pointer;
        transition: all 0.2s ease;
        white-space: nowrap;
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
    }

    .bs-tab.active {
        color: #d4a94e;
        border-bottom-color: #d4a94e;
    }

    .bs-tab:active {
        background: rgba(212, 169, 78, 0.1);
    }

    /* Tab panels */
    .bs-tab-panel {
        display: none;
        padding: 8px 0;
    }

    .bs-tab-panel.active {
        display: block;
    }

    /* Make relocated elements display properly in tabs */
    .bs-tab-panel > #liveLufsIndicator {
        position: relative !important;
        top: auto !important;
    }

    .bs-tab-panel > .meters-container,
    .bs-tab-panel > #legendaryMetersPanel,
    .bs-tab-panel > #proMetersPanel,
    .bs-tab-panel > .advanced-features-section,
    .bs-tab-panel > .master-section {
        margin-bottom: 12px;
    }

    /* Show pro meters by default in studio tab */
    .bs-tab-panel > #proMetersPanel {
        display: block !important;
    }

    /* Stereo field mini-view in analysis tab */
    .bs-stereo-mini {
        background: linear-gradient(145deg, rgba(8, 8, 18, 0.95), rgba(15, 15, 30, 0.9));
        border: 1px solid rgba(212, 169, 78, 0.2);
        border-radius: 12px;
        padding: 12px;
        margin-top: 12px;
        text-align: center;
    }
}

/* --------------------------------------------------------------------------
   12.2 COMPLIANCE MINI-INDICATOR ON PEEK BAR (1E)
   -------------------------------------------------------------------------- */
.bottom-sheet-compliance-dot {
    display: none;
}

@media screen and (max-width: 767px) {
    .bottom-sheet-compliance-dot {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 3px 8px;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .compliance-dot-light {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #4CAF50;
        box-shadow: 0 0 6px rgba(76, 175, 80, 0.8);
        flex-shrink: 0;
    }

    .compliance-dot-label {
        font-size: 0.5rem;
        font-weight: 700;
        letter-spacing: 0.5px;
        color: #4CAF50;
    }
}

/* --------------------------------------------------------------------------
   12.3 STEREO FIELD ANALYZER — MOBILE LAYOUT (1B)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    /* Shrink goniometer and hide redundant right dB scale */
    #goniometerCanvas {
        width: 100px !important;
        height: 100px !important;
    }

    /* Hide the right dB scale labels that waste space on mobile */
    .meters-panel-viz .db-scale-right,
    .meters-panel-viz > div > div:last-child[style*="writing-mode"] {
        display: none !important;
    }

    /* L/R meters compact */
    .meters-panel-viz canvas[id*="lMeter"],
    .meters-panel-viz canvas[id*="rMeter"],
    .meters-panel-viz canvas[id*="leftMeter"],
    .meters-panel-viz canvas[id*="rightMeter"] {
        width: 40px !important;
        height: 120px !important;
    }
}

/* --------------------------------------------------------------------------
   12.4 PROCESSING CHAIN — 3-COLUMN GRID + TOUCH TOOLTIPS (1C)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    /* Processing chain grid: 3 columns on mobile */
    .processing-chain-grid,
    #analysisPanel .chain-grid,
    #analysisPanel > div > div[style*="grid-template-columns: repeat(4"] {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }

    .feature-card,
    .chain-module {
        font-size: 0.55rem !important;
        padding: 8px 6px !important;
    }

    /* Touch tooltip popover */
    .mobile-tile-tooltip {
        position: fixed;
        z-index: 9000;
        background: linear-gradient(145deg, rgba(20, 20, 35, 0.98), rgba(10, 10, 20, 0.98));
        border: 1px solid rgba(212, 169, 78, 0.3);
        border-radius: 8px;
        padding: 8px 12px;
        color: rgba(255, 255, 255, 0.85);
        font-size: 0.7rem;
        line-height: 1.4;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
        pointer-events: none;
        transform: translateY(-100%);
        animation: tooltipFadeIn 0.15s ease-out;
    }

    @keyframes tooltipFadeIn {
        from { opacity: 0; transform: translateY(-90%); }
        to { opacity: 1; transform: translateY(-100%); }
    }
}

/* --------------------------------------------------------------------------
   12.5 LOUDNESS HISTORY — MOBILE CANVAS HEIGHT (1D)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    .bs-tab-panel #loudnessHistoryContainer canvas,
    #loudnessHistoryContainer canvas {
        height: 80px !important;
    }
}

/* --------------------------------------------------------------------------
   12.6 PLATFORM TARGET — 2-COLUMN GRID ON ALL MOBILE (1F)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    #platformSection .selector-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Ensure accordion can show all 10 options */
    .mobile-accordion-body.expanded {
        max-height: 1200px;
    }
}

/* Override the <480px rule that forced 1 column */
@media screen and (max-width: 479px) {
    #platformSection .selector-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* --------------------------------------------------------------------------
   12.7 SPECTRUM ANALYZER TOUCH TOOLTIP (2A)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    .spectrum-touch-tooltip {
        position: absolute;
        z-index: 100;
        background: rgba(10, 10, 20, 0.95);
        border: 1px solid rgba(212, 169, 78, 0.4);
        border-radius: 6px;
        padding: 6px 10px;
        color: #d4a94e;
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.65rem;
        font-weight: 600;
        pointer-events: none;
        white-space: nowrap;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    }
}

/* --------------------------------------------------------------------------
   12.8 REFERENCE TRACK — MOBILE UPLOAD BUTTON (2C)
   -------------------------------------------------------------------------- */
.ref-mobile-upload-btn {
    display: none;
}

@media screen and (max-width: 767px) {
    .ref-mobile-upload-btn {
        display: inline-block;
        padding: 12px 24px;
        margin: 10px 0 4px;
        background: linear-gradient(135deg, rgba(212, 169, 78, 0.2), rgba(158, 122, 40, 0.2));
        border: 2px solid rgba(212, 169, 78, 0.4);
        border-radius: 10px;
        color: #d4a94e;
        font-size: 0.8rem;
        font-weight: 700;
        letter-spacing: 0.5px;
        cursor: pointer;
        min-height: 48px;
        -webkit-tap-highlight-color: transparent;
        transition: all 0.2s ease;
    }

    .ref-mobile-upload-btn:active {
        background: linear-gradient(135deg, rgba(212, 169, 78, 0.35), rgba(158, 122, 40, 0.35));
        transform: scale(0.98);
    }

    /* Hide drag text on mobile */
    .ref-drop-text {
        display: none !important;
    }
}

/* --------------------------------------------------------------------------
   12.9 MODE SWITCHER — TOUCH-FRIENDLY SIZING (2D)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    /* Mode switcher removed */
}

/* --------------------------------------------------------------------------
   12.10 SCORECARD — FULL-SCREEN OVERLAY ON MOBILE (2E)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    .scorecard-container,
    .scorecard-overlay,
    #scorecardPanel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        z-index: 10000 !important;
        border-radius: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* --------------------------------------------------------------------------
   12.11 EXPORT BAR — BOTTOM SHEET STACKING FIX (2F)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    .persistent-export-bar.above-bottom-sheet {
        bottom: auto !important;
        top: 0 !important;
        border-radius: 0 !important;
        z-index: 1970 !important;
    }

    /* Ensure export bar transitions smoothly */
    .persistent-export-bar {
        transition: bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* --------------------------------------------------------------------------
   12.12 VOICE TOUR — MOBILE VIEWPORT (3A)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    .tour-tooltip,
    .voice-tour-tooltip {
        max-width: 90vw !important;
        padding: 12px 14px !important;
        font-size: 0.8rem !important;
    }
}

/* --------------------------------------------------------------------------
   12.13 AUTH MODALS — OVERFLOW PROTECTION (3B)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    #signInModal > div,
    #signUpModal > div,
    #resetPasswordModal > div {
        max-height: calc(100vh - 80px) !important;
        max-height: calc(100dvh - 80px) !important;
        overflow-y: auto !important;
        width: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
        margin: 8px !important;
    }
}

/* --------------------------------------------------------------------------
   12.14 A/B TOGGLE — PIN TO TRANSPORT BAR (3C)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    #integratedABToggle {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    /* Integrate into transport controls row */
    .transport-controls {
        display: flex !important;
        align-items: center !important;
    }
}

/* --------------------------------------------------------------------------
   12.15 TONAL BALANCE — READABLE LABELS (3D)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    #tonalBalanceBars {
        height: 55px !important;
    }

    #tonalBalanceBars .tonal-band-label,
    #tonalBalanceBars > div > div:last-child {
        font-size: 0.45rem !important;
    }

    /* Tonal balance summary in analysis tab */
    #tonalBalanceMobileSummary {
        min-height: auto !important;
    }

    #tonalBalanceMobileSummary #tonalBalanceBars {
        height: 50px !important;
    }
}
