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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

.preview-area {
    flex: 1;
    position: relative;
    background: radial-gradient(circle at center, #2a2a2a 0%, #1a1a1a 100%);
    transition: background 0.3s ease;
}

.preview-area.light-theme {
    background: #f5f5f5 !important;
}

#cigar-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.view-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.view-controls-row-1 {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Hide controls handle on desktop */
.controls-handle {
    display: none;
}

.btn-secondary {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: #4a4a4a;
    border-color: #5a5a5a;
}

#toggle-theme {
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#toggle-theme svg {
    width: 20px;
    height: 20px;
}

.rotation-controls {
    display: flex;
    gap: 8px;
    background-color: #2a2a2a;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid #3a3a3a;
}

.rotation-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #2a2a2a;
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px solid #3a3a3a;
    min-width: 250px;
}

.rotation-slider-container label {
    font-size: 14px;
    color: #b0b0b0;
    margin: 0;
}

.rotation-slider-container input[type="range"] {
    flex: 1;
    margin: 0;
}

.rotation-value {
    font-size: 14px;
    color: #e0e0e0;
    min-width: 40px;
    text-align: right;
}

.btn-rotate {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-rotate:hover {
    background-color: #4a4a4a;
    border-color: #5a5a5a;
}

.btn-rotate:active {
    background-color: #5a5a5a;
    transform: scale(0.95);
}

.btn-rotate.active {
    background-color: #6a5acd;
    border-color: #6a5acd;
}

.btn-rotate svg {
    width: 20px;
    height: 20px;
}

.control-panel {
    width: 400px;
    background-color: #242424;
    padding: 30px;
    overflow-y: auto;
    border-left: 1px solid #3a3a3a;
}

/* Floating Logo Styles */
.floating-logo {
    position: fixed; /* Changed from absolute to fixed */
    top: 24px;
    left: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 15px;
}

.floating-logo .logo {
    max-width: 100px;
    width: 100%;
    height: auto;
}

.floating-logo .subtitle {
    font-size: 10px;
    color: #e0e0e0;
    margin: 0;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
}

/* Light theme styles for logo and text */
.floating-logo.light-theme .subtitle {
    color: #1a1a1a;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
    color: #f0f0f0;
}


.control-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #3a3a3a;
}

.control-section:last-child {
    border-bottom: none;
}

h3 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #f0f0f0;
    text-transform: uppercase;
}

.control-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    color: #b0b0b0;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    background: #3a3a3a;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #6a5acd;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

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

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #6a5acd;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.number-input {
    width: 70px;
    padding: 6px 10px;
    background-color: #3a3a3a;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 14px;
    text-align: center;
}

.number-input:focus {
    outline: none;
    border-color: #6a5acd;
}

.conversion-display {
    margin-top: 5px;
    font-size: 12px;
    color: #808080;
}

/* Compact Dimensions Layout */
.dimensions-compact {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.dimension-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dimension-input-group label {
    font-size: 13px;
    color: #b0b0b0;
    margin: 0;
    white-space: nowrap;
    min-width: fit-content;
}

.dimension-input {
    flex: 1;
    width: 100%;
    padding: 8px 12px;
    background-color: #3a3a3a;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s;
}

.dimension-input:hover {
    background-color: #4a4a4a;
    border-color: #5a5a5a;
}

.dimension-input:focus {
    outline: none;
    border-color: #6a5acd;
    background-color: #4a4a4a;
}

.shared-slider-container {
    margin-top: 10px;
    padding: 10px;
    background-color: #2a2a2a;
    border-radius: 6px;
    border: 1px solid #3a3a3a;
    transition: all 0.3s ease;
    opacity: 0;
}

.shared-slider-container input[type="range"] {
    width: 100%;
    margin: 0;
}

.dimension-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background-color: #2a2a2a;
    border-radius: 4px;
    font-size: 12px;
    color: #999;
}

.dimension-info .separator {
    color: #666;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.preset-btn {
    padding: 10px 12px;
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-btn:hover {
    background-color: #4a4a4a;
    border-color: #5a5a5a;
}

.preset-btn.active {
    background-color: #6a5acd;
    border-color: #6a5acd;
    color: white;
}

.wrapper-select {
    width: 100%;
    padding: 10px 12px;
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.wrapper-select:hover {
    background-color: #4a4a4a;
    border-color: #5a5a5a;
}

.wrapper-select:focus {
    outline: none;
    border-color: #6a5acd;
}

.info-section {
    margin-top: 30px;
}

.info-display {
    background-color: #2a2a2a;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #3a3a3a;
}

.info-display p {
    margin: 5px 0;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
}

.info-display span {
    font-weight: 600;
    color: #f0f0f0;
}

/* Band Upload Styles */
.band-options {
    margin-bottom: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #e0e0e0;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-label span {
    user-select: none;
}

.loading-status {
    margin-top: 10px;
    padding: 8px 12px;
    background-color: rgba(74, 144, 226, 0.1);
    border: 1px solid #4a90e2;
    border-radius: 4px;
    font-size: 13px;
    color: #4a90e2;
}

.loading-status.error {
    background-color: rgba(226, 74, 74, 0.1);
    border-color: #e24a4a;
    color: #e24a4a;
}

.loading-status.downloading {
    padding-bottom: 20px;
}

.progress-bar {
    margin-top: 10px;
    height: 6px;
    background-color: #3a3a3a;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6a5acd 0%, #7a6add 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.band-upload-area {
    margin-bottom: 20px;
}

.drop-zone {
    border: 2px dashed #4a4a4a;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background-color: #2a2a2a;
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.drop-zone:hover {
    border-color: #6a5acd;
    background-color: #3a3a3a;
}

.drop-zone.drag-over {
    border-color: #6a5acd;
    background-color: #3a3a3a;
    transform: scale(1.02);
}

.drop-zone svg {
    color: #6a5acd;
}

.drop-zone p {
    margin: 0;
    color: #b0b0b0;
}

.drop-zone small {
    color: #808080;
    font-size: 12px;
}

.link-btn {
    background: none;
    border: none;
    color: #6a5acd;
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
    padding: 0;
}

.link-btn:hover {
    color: #7a6add;
}

.band-preview {
    position: relative;
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 10px;
}

.band-preview img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
}

.btn-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #4a4a4a;
    color: #e0e0e0;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove:hover {
    background-color: #d32f2f;
    transform: scale(1.1);
}

.band-controls {
    display: none;
}

.value-display {
    min-width: 40px;
    text-align: right;
    font-size: 14px;
    color: #b0b0b0;
}

.toggle-group {
    display: flex;
    gap: 0;
    background-color: #2a2a2a;
    border-radius: 4px;
    border: 1px solid #3a3a3a;
    overflow: hidden;
}

.toggle-btn {
    flex: 1;
    padding: 8px 16px;
    background-color: transparent;
    color: #b0b0b0;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.toggle-btn:first-child {
    border-right: 1px solid #3a3a3a;
}

.toggle-btn:hover {
    background-color: #3a3a3a;
}

.toggle-btn.active {
    background-color: #6a5acd;
    color: white;
}

/* Band Fit Info */
.band-fit-info {
    margin-top: 20px;
    padding: 15px;
    background-color: #2a2a2a;
    border-radius: 6px;
    border: 1px solid #3a3a3a;
    font-size: 13px;
}

.band-fit-info p {
    margin: 8px 0;
    color: #b0b0b0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.band-fit-info strong {
    color: #e0e0e0;
    font-weight: 600;
}

/* Section Header with Sort Button */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    margin: 0;
}

.btn-sort {
    padding: 6px 12px;
    background-color: #3a3a3a;
    color: #b0b0b0;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-sort:hover {
    background-color: #4a4a4a;
    border-color: #5a5a5a;
    color: #e0e0e0;
}

.btn-sort.active {
    background-color: #6a5acd;
    border-color: #7a6add;
    color: white;
}

.btn-sort.active:hover {
    background-color: #7a6add;
}

/* Band Card Accordion Styles */
.bands-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bands-container.sort-mode {
    padding: 10px;
    background-color: #252525;
    border: 2px dashed #6a5acd;
    border-radius: 8px;
}

.band-card {
    background-color: #2a2a2a;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
    overflow: hidden;
    transition: all 0.3s ease;
}

.band-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    cursor: grabbing;
}

.band-card.drag-over {
    border-color: #6a5acd;
    background-color: #353535;
}

.band-card-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background-color: #2d2d2d;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.band-card-header:hover {
    background-color: #333333;
}

.drag-handle {
    font-size: 20px;
    color: #666;
    cursor: default;
    margin-right: 12px;
    padding: 0 5px;
    opacity: 0.3;
    transition: opacity 0.2s, color 0.2s;
}

.sort-mode .drag-handle {
    cursor: grab;
    opacity: 1;
}

.sort-mode .drag-handle:hover {
    color: #999;
}

.band-card.dragging .drag-handle {
    cursor: grabbing;
}

.band-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
}

.band-mini-preview {
    width: 40px;
    height: 20px;
    object-fit: contain;
    background: white;
    border-radius: 3px;
    margin: 0 10px;
}

.layer-indicator {
    font-size: 16px;
    margin-right: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.layer-indicator.visible {
    opacity: 1;
}

.toggle-expand {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.toggle-expand:hover {
    color: #ccc;
}

.band-card.collapsed .toggle-expand {
    transform: rotate(-90deg);
}

.band-card-body {
    padding: 15px;
    max-height: 800px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.band-card.collapsed .band-card-body {
    max-height: 0;
    padding: 0 15px;
}

/* Keep all band titles uniform */

.add-band-btn {
    width: 100%;
    margin: 15px 0;
    padding: 12px;
    background-color: #4a4a4a;
    color: #e0e0e0;
    border: 2px dashed #6a5acd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.add-band-btn:hover {
    background-color: #5a5a5a;
    border-color: #7a6add;
    transform: translateY(-1px);
}

.add-band-btn svg {
    width: 20px;
    height: 20px;
}

/* Drag and Drop Visual Feedback */
.band-card-placeholder {
    background-color: #3a3a3a;
    border: 2px dashed #6a5acd;
    border-radius: 8px;
    height: 60px;
    margin: 5px 0;
    opacity: 0.5;
}

/* Keep all band previews uniform - no color distinction */


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

/* Show desktop-only elements on desktop */
.desktop-only {
    display: flex;
}

/* Logout Button */
.logout-btn {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.logout-btn svg {
    width: 14px;
    height: 14px;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        touch-action: pan-x pan-y; /* Allow scrolling but not zooming */
    }
    
    .app-container {
        flex-direction: column;
        position: relative;
    }
    
    /* Hide desktop controls on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile elements */
    .mobile-only {
        display: block;
    }
    
    /* Hide control panel on mobile - use carousel instead */
    .control-panel {
        display: none !important;
    }
    
    /* Full screen preview area */
    .preview-area {
        width: 100%;
        height: 100vh;
        position: relative;
        z-index: 1; /* Below logo */
    }
    
    /* Canvas should allow touch gestures on mobile always */
    #cigar-canvas {
        touch-action: none; /* Allow all touch gestures including pinch zoom */
        -webkit-user-select: none; /* Prevent selection */
        user-select: none;
    }
    
    /* Mobile Carousel Panel - Dynamic height */
    .mobile-carousel-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: rgba(42, 42, 42, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.3);
        transition: transform 0.3s ease, max-height 0.3s ease;
        z-index: 1000; /* Lower than logo's 100000 */
        touch-action: pan-y;
        max-height: auto; /* Let content determine height */
        display: flex;
        flex-direction: column;
    }
    
    /* Different heights for different slides - more compact */
    .mobile-carousel-panel[data-slide="0"] { /* Controls */
        max-height: 220px;
    }
    
    .mobile-carousel-panel[data-slide="1"] { /* Presets */
        max-height: 240px; /* Reduced from 280px */
    }
    
    .mobile-carousel-panel[data-slide="2"] { /* Dimensions */
        max-height: 200px;
    }
    
    .mobile-carousel-panel[data-slide="3"] { /* Wrapper */
        max-height: 180px;
    }
    
    .mobile-carousel-panel[data-slide="4"] { /* Bands - can be taller */
        max-height: 50vh;
    }
    
    .mobile-carousel-panel.collapsed {
        transform: translateY(calc(100% - 40px)); /* Just show handle and info bar */
    }
    
    /* Hide all content when collapsed */
    .mobile-carousel-panel.collapsed .carousel-container {
        opacity: 0;
        pointer-events: none;
    }
    
    .mobile-carousel-panel.collapsed .carousel-prev,
    .mobile-carousel-panel.collapsed .carousel-next {
        opacity: 0;
        pointer-events: none;
    }
    
    /* Carousel Handle */
    .carousel-handle {
        position: relative;
        width: 100%;
        height: 20px; /* Reduced height */
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 6px 0; /* Reduced padding */
    }
    
    .carousel-handle .handle-bar {
        width: 40px;
        height: 4px;
        background-color: #5a5a5a;
        border-radius: 2px;
    }
    
    /* Invisible navigation areas on sides */
    .carousel-prev,
    .carousel-next {
        position: absolute;
        top: auto;
        bottom: 35px; /* Just above smaller info bar */
        height: 40px; /* Compact height at bottom */
        width: 40px; /* Narrower touch target */
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.3);
        font-size: 24px;
        display: flex;
        align-items: center;
        cursor: pointer;
        transition: color 0.2s;
        touch-action: manipulation;
        z-index: 10;
        padding: 0;
    }
    
    .carousel-prev {
        left: 0;
        justify-content: center;
        padding-left: 5px;
    }
    
    .carousel-next {
        right: 0;
        justify-content: center;
        padding-right: 5px;
    }
    
    .carousel-prev:active,
    .carousel-next:active {
        color: rgba(255, 255, 255, 0.6);
    }
    
    /* Carousel Container */
    .carousel-container {
        flex: 1;
        overflow: hidden;
        position: relative;
    }
    
    .carousel-track {
        display: flex;
        transition: transform 0.3s ease;
        height: 100%;
        position: relative;
    }
    
    .carousel-slide {
        min-width: 100%;
        padding: 15px 45px 10px; /* Reduced vertical padding */
        display: flex;
        flex-direction: column;
        justify-content: flex-start; /* Start from top for natural sizing */
    }
    
    .slide-title {
        font-size: 14px;
        font-weight: 600;
        text-transform: uppercase;
        color: #f0f0f0;
        margin-bottom: 10px; /* Reduced spacing */
        text-align: center !important;
        opacity: 1;
        transition: opacity 0.3s ease;
    }
    
    /* Hide titles when collapsed */
    .mobile-carousel-panel.collapsed .slide-title {
        opacity: 0;
        pointer-events: none;
    }
    
    .slide-content {
        flex: 1;
        overflow-y: auto;
    }
    
    /* Mobile Controls Original Layout */
    .mobile-controls-original {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .controls-row-1 {
        display: flex;
        gap: 8px;
        align-items: center;
        justify-content: center;
    }
    
    .rotation-controls-mobile {
        display: flex;
        gap: 6px;
        background-color: #2a2a2a;
        padding: 4px;
        border-radius: 6px;
        border: 1px solid #3a3a3a;
    }
    
    .rotation-slider-mobile {
        display: flex;
        align-items: center;
        gap: 10px;
        background-color: rgba(58, 58, 58, 0.6);
        padding: 8px 12px;
        border-radius: 8px;
    }
    
    .rotation-slider-mobile label {
        font-size: 12px;
        color: #b0b0b0;
    }
    
    .rotation-slider-mobile input {
        flex: 1;
    }
    
    /* Style all mobile sliders to match desktop */
    .mobile-carousel-panel input[type="range"],
    .rotation-slider-mobile input[type="range"] {
        height: 6px;
        background: #3a3a3a;
        border-radius: 3px;
        outline: none;
        -webkit-appearance: none;
        appearance: none;
    }
    
    .mobile-carousel-panel input[type="range"]::-webkit-slider-thumb,
    .rotation-slider-mobile input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        background: #6a5acd;
        border-radius: 50%;
        cursor: pointer;
        transition: all 0.2s;
        border: none;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    .mobile-carousel-panel input[type="range"]::-webkit-slider-thumb:active,
    .rotation-slider-mobile input[type="range"]::-webkit-slider-thumb:active {
        background: #7a6add;
        transform: scale(1.1);
    }
    
    .mobile-carousel-panel input[type="range"]::-moz-range-thumb,
    .rotation-slider-mobile input[type="range"]::-moz-range-thumb {
        width: 20px;
        height: 20px;
        background: #6a5acd;
        border-radius: 50%;
        cursor: pointer;
        border: none;
        transition: all 0.2s;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    .mobile-carousel-panel input[type="range"]::-moz-range-thumb:active,
    .rotation-slider-mobile input[type="range"]::-moz-range-thumb:active {
        background: #7a6add;
        transform: scale(1.1);
    }
    
    /* Style the track for Firefox */
    .mobile-carousel-panel input[type="range"]::-moz-range-track,
    .rotation-slider-mobile input[type="range"]::-moz-range-track {
        height: 6px;
        background: #3a3a3a;
        border-radius: 3px;
    }
    
    /* Combined Controls Slide */
    .combined-controls {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    
    .slide-subtitle {
        font-size: 13px;
        font-weight: 600;
        text-transform: uppercase;
        color: #b0b0b0;
        margin-bottom: 10px;
        text-align: center !important;
        opacity: 1;
        transition: opacity 0.3s ease;
    }
    
    /* Hide subtitles when collapsed */
    .mobile-carousel-panel.collapsed .slide-subtitle {
        opacity: 0;
        pointer-events: none;
    }
    
    /* Preset buttons - 3 per row on mobile */
    #presets-slide .preset-buttons {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important; /* Tighter gap */
    }
    
    #presets-slide .preset-btn {
        padding: 10px 6px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* Scrollable bands slide */
    .bands-slide {
        max-height: 60vh;
    }
    
    .bands-slide .slide-content.scrollable {
        overflow-y: auto !important;
        max-height: calc(60vh - 100px) !important; /* Account for title and padding */
        padding-right: 5px !important;
    }
    
    /* Custom scrollbar for bands */
    .bands-slide .scrollable::-webkit-scrollbar {
        width: 6px;
    }
    
    .bands-slide .scrollable::-webkit-scrollbar-track {
        background: #2a2a2a;
        border-radius: 3px;
    }
    
    .bands-slide .scrollable::-webkit-scrollbar-thumb {
        background: #4a4a4a;
        border-radius: 3px;
    }
    
    .bands-slide .scrollable::-webkit-scrollbar-thumb:hover {
        background: #5a5a5a;
    }
    
    /* Carousel Info Bar */
    .carousel-info-bar {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        padding: 6px; /* Reduced padding */
        background-color: #2a2a2a;
        border-top: 1px solid #3a3a3a;
        font-size: 11px; /* Smaller text */
        color: #b0b0b0;
    }
    
    .carousel-info-bar .separator {
        color: #666;
    }
    
    /* Compact buttons */
    .btn-secondary {
        min-width: auto;
        min-height: 40px;
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
        touch-action: manipulation; /* Prevent zoom */
    }
    
    #toggle-theme {
        padding: 8px;
        min-width: 40px;
        touch-action: manipulation; /* Prevent zoom */
    }
    
    /* Adjust floating logo for mobile */
    .floating-logo {
        position: fixed !important; /* Ensure fixed positioning */
        top: 20px;
        left: 20px;
        right: auto;
        z-index: 100000 !important; /* Even higher z-index */
        display: flex !important; /* Force display */
        visibility: visible !important; /* Force visibility */
        opacity: 1 !important; /* Force opacity */
    }
    
    .floating-logo .logo {
        height: 30px;
        width: auto; /* Preserve aspect ratio */
        max-width: none; /* Remove max-width constraint */
    }
    
    .floating-logo .subtitle {
        font-size: 10px;
        display: block !important; /* Ensure subtitle shows */
    }
    
    /* Move cigar down on mobile (was up before) */
    #cigar-canvas {
        margin-top: 40px; /* Move down instead of up */
    }
    
    /* Control panel adjustments */
    .control-section {
        padding: 10px 8px; /* Further reduced padding for narrower sidebar */
    }
    
    .control-section h3 {
        font-size: 14px; /* Smaller font for narrower sidebar */
        margin-bottom: 10px;
    }
    
    /* Make preset buttons full width on mobile - one per row */
    .preset-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100% !important;
    }
    
    .preset-btn {
        width: 100% !important;
        min-width: unset !important;
        max-width: 100% !important;
        padding: 10px 8px !important;
        font-size: 13px !important;
        text-align: center !important;
        margin: 0 !important;
    }
    
    /* Keep dimension inputs horizontal on mobile carousel */
    #dimensions-slide .dimensions-compact {
        display: flex !important;
        flex-direction: row !important;
        gap: 15px !important;
        margin-bottom: 15px !important;
    }
    
    #dimensions-slide .dimension-input-group {
        flex: 1 !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }
    
    #dimensions-slide .dimension-input-group label {
        font-size: 13px !important;
        color: #b0b0b0 !important;
        margin: 0 !important;
        white-space: nowrap !important;
        min-width: fit-content !important;
    }
    
    #dimensions-slide .dimension-input {
        flex: 1 !important;
        width: 100% !important;
        padding: 8px 12px !important;
        background-color: #3a3a3a !important;
        border: 1px solid #4a4a4a !important;
        border-radius: 4px !important;
        color: #e0e0e0 !important;
        font-size: 14px !important;
        text-align: center !important;
    }
    
    #dimensions-slide .dimension-info {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 8px !important;
        background-color: #2a2a2a !important;
        border-radius: 4px !important;
        font-size: 12px !important;
        color: #999 !important;
    }
    
    #dimensions-slide .dimension-info .separator {
        color: #666 !important;
    }
    
    /* Larger inputs for touch */
    .dimension-input,
    select,
    input[type="range"],
    input[type="number"],
    input[type="text"],
    button {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        touch-action: manipulation; /* Prevent double-tap zoom */
    }
    
    /* Band cards mobile optimization */
    .band-card {
        margin: 10px 0;
    }
    
    /* Band preview image */
    .band-preview {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .band-preview img {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
    }
    
    /* Checkbox layout */
    .band-options {
        padding: 8px 0 !important;
    }
    
    .checkbox-label {
        font-size: 12px !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }
    
    .band-controls {
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 !important;
    }
    
    .band-controls input,
    .band-controls select {
        min-width: 100px;
    }
    
    /* Fix band control sliders and inputs */
    .band-controls .control-group {
        width: 100% !important;
        margin-bottom: 15px !important;
    }
    
    .band-controls .slider-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
    }
    
    .band-controls input[type="range"] {
        width: 100% !important;
        margin: 0 !important;
    }
    
    .band-controls .number-input {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .band-controls .value-display {
        text-align: right !important;
        font-size: 13px !important;
    }
    
    /* Band info box */
    .band-info {
        padding: 8px !important;
        font-size: 11px !important;
        margin: 10px 0 !important;
    }
    
    .band-info div {
        margin: 4px 0 !important;
    }
    
    /* Band fit info mobile alignment */
    .band-fit-info {
        padding: 10px !important;
        font-size: 12px !important;
    }
    
    .band-fit-info p {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin: 6px 0 !important;
        line-height: 1.4 !important;
    }
    
    .band-fit-info strong {
        text-align: right !important;
        min-width: 60px !important;
    }
    
    /* Simplify upload area on mobile - clickable box */
    .drop-zone {
        border: 1px solid #4a4a4a !important;
        background-color: #3a3a3a !important;
        padding: 20px !important;
        min-height: auto !important;
        cursor: pointer !important;
        text-align: center !important;
        border-radius: 6px !important;
        transition: all 0.2s !important;
    }
    
    .drop-zone:active {
        background-color: #4a4a4a !important;
    }
    
    .drop-zone svg {
        display: none !important;
    }
    
    .drop-zone p {
        margin: 0 !important;
        font-size: 14px !important;
        color: #6a5acd !important;
    }
    
    .drop-zone small {
        display: none !important;
    }
    
    /* Hide the separate browse button on mobile */
    .drop-zone .link-btn {
        display: none !important;
    }
    
    /* Make drop zones more touch-friendly on mobile */
    .bands-slide .drop-zone {
        background-color: rgba(58, 58, 58, 0.8);
        border: 2px dashed #666;
        padding: 20px;
        border-radius: 8px;
        text-align: center;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .bands-slide .drop-zone:active {
        background-color: rgba(74, 74, 74, 0.9);
        border-color: #888;
    }
    
    .bands-slide .drop-zone p {
        margin: 0;
        color: #e0e0e0;
        font-size: 14px;
    }
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
    .control-panel {
        width: 350px;
    }
    
    .view-controls {
        bottom: 30px;
        left: 30px;
    }
}

/* Small mobile devices */
@media (max-width: 375px) {
    /* Stack dimensions vertically on very small screens */
    #dimensions-slide .dimensions-compact {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    #dimensions-slide .dimension-input-group {
        width: 100% !important;
    }
    .view-controls {
        bottom: 10px;
        width: calc(100% - 20px);
        padding: 8px;
        gap: 5px;
    }
    
    .rotation-controls {
        gap: 4px;
        padding: 2px 4px;
    }
    
    .btn-rotate {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .btn-secondary {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    #toggle-theme {
        min-width: 36px;
    }
    
    #reset-view {
        display: none; /* Hide on very small screens to save space */
    }
    
    .control-panel {
        width: 90%;
    }
    
    /* Fix info display alignment on mobile */
    .info-display {
        padding: 10px !important;
        font-size: 12px !important;
    }
    
    .info-display p {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin: 6px 0 !important;
        line-height: 1.4 !important;
    }
    
    .info-display span {
        text-align: right !important;
    }
}

/* Wrapper slide styles for mobile */
@media (max-width: 768px) {
    .wrapper-mobile-container {
        width: 100%;
        padding: 0; /* No extra padding since parent slide has padding */
    }
    
    .wrapper-select-mobile {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        background: var(--bg-secondary);
        color: var(--text-primary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        cursor: pointer;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 36px;
    }
    
    .wrapper-select-mobile:focus {
        outline: none;
        border-color: var(--accent-color);
    }
}