/* ============================================
   LOADING SCREEN STYLES
   ============================================ */

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-family: 'Rajdhani', sans-serif;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-container {
    text-align: center;
    max-width: 400px;
    width: 90%;
    padding: 20px;
}

.loader-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: pulse-icon 1.5s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* Skeleton box (shimmer placeholder) */
.skeleton-box {
    width: 100%;
    height: 120px;
    background: #1a1a2e;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 51, 102, 0.2);
}

.skeleton-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.05) 40%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.05) 60%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Progress bar */
.progress-bar-wrapper {
    width: 100%;
    height: 6px;
    background: #1a1a2e;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 51, 102, 0.3);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff3366, #33ccff, #9933ff);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.loader-status {
    display: flex;
    justify-content: space-between;
    color: #88aaff;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

#loader-percentage {
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 10px #ff3366;
}

#loader-message {
    color: #aaddff;
}

/* ============================================
   EXISTING STYLES (unchanged)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&family=Rajdhani:wght@300;400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Rajdhani', sans-serif;
    overflow: hidden;
    background: #050510;
    touch-action: none;
}

/* Control Panel - Base styles for both PC and mobile */
.control-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 30px);
    background: rgba(10, 10, 25, 0.95);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    border: 1px solid rgba(255, 51, 102, 0.4);
    border-radius: 24px;
    color: #fff;
    box-shadow: 0 0 40px rgba(255, 51, 102, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    border-top: 2px solid #ff3366;
}

/* Minimized state */
.control-panel.minimized {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    overflow: hidden;
    cursor: pointer;
}

.control-panel.minimized .panel-header {
    padding: 0;
    height: 60px;
    width: 60px;
    justify-content: center;
}

.control-panel.minimized .header-title h2,
.control-panel.minimized .header-actions,
.control-panel.minimized .panel-content,
.control-panel.minimized .panel-footer {
    display: none;
}

.control-panel.minimized .neon-logo {
    font-size: 2rem;
    margin: 0;
}

.control-panel.hidden {
    display: none;
}

/* Panel Header */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: rgba(255, 51, 102, 0.15);
    border-bottom: 1px solid rgba(255, 51, 102, 0.3);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.neon-logo {
    font-size: 1.4rem;
    filter: drop-shadow(0 0 10px #ff3366);
}

.panel-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 8px #ff3366;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 6px;
}

.icon-btn.small {
    width: 28px;
    height: 28px;
    border-radius: 14px;
    background: rgba(255, 51, 102, 0.2);
    border: 1px solid #ff3366;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Panel Content */
.panel-content {
    padding: 15px;
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Control Sections */
.control-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 51, 102, 0.2);
}

.control-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: #88aaff;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.neon-dot {
    width: 6px;
    height: 6px;
    background: #ff3366;
    border-radius: 50%;
    box-shadow: 0 0 10px #ff3366;
}

/* Color Control */
.control-with-label {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.control-label {
    font-size: 0.85rem;
    color: #fff;
    min-width: 90px;
}

input[type="color"] {
    width: 70px;
    height: 40px;
    border: 2px solid #ff3366;
    border-radius: 20px;
    cursor: pointer;
    padding: 2px;
    background: rgba(0, 0, 0, 0.5);
}

/* Action Buttons */
.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid #ff3366;
    border-radius: 10px;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    min-height: 44px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 51, 102, 0.2);
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn.primary {
    background: rgba(255, 51, 102, 0.3);
    border-color: #33ccff;
}

.action-btn.explode {
    background: rgba(255, 51, 0, 0.3);
    border-color: #ff4400;
    box-shadow: 0 0 20px rgba(255, 68, 0, 0.4);
}

.action-btn.explode:hover {
    background: rgba(255, 51, 0, 0.5);
    box-shadow: 0 0 40px rgba(255, 68, 0, 0.6);
}

.btn-icon {
    font-size: 1rem;
}

/* Texture Controls */
.texture-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-wrapper {
    display: flex;
    gap: 8px;
}

.upload-wrapper .action-btn {
    flex: 1;
    min-height: 40px;
    font-size: 0.75rem;
}

#texture-status {
    margin-top: 4px;
}

/* Mode Selector */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.mode-toggle-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 51, 102, 0.3);
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    min-height: 70px;
    transition: all 0.2s ease;
}

.mode-toggle-btn.active {
    border-color: #ff3366;
    background: rgba(255, 51, 102, 0.2);
}

.mode-icon {
    font-size: 1.6rem;
}

.mode-text {
    font-size: 0.75rem;
    font-weight: 600;
}

.mode-badge {
    font-size: 0.55rem;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(255, 51, 102, 0.5);
}

/* Mode Controls */
.mode-controls {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    border: 1px solid rgba(255, 51, 102, 0.2);
}

.pc-icon {
    display: inline;
}

.mobile-icon {
    display: none;
}

@media (max-width: 768px) {
    .pc-icon {
        display: none;
    }
    .mobile-icon {
        display: inline;
    }
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.info-icon {
    font-size: 1.1rem;
    min-width: 30px;
}

.info-text {
    font-size: 0.8rem;
    color: #aaddff;
}

/* Edit Toolbar */
.edit-toolbar {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.tool-btn {
    flex: 1;
    padding: 8px;
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid rgba(255, 51, 102, 0.3);
    border-radius: 8px;
    color: #fff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.tool-btn.active {
    background: rgba(255, 51, 102, 0.3);
    border-color: #33ccff;
    box-shadow: 0 0 15px rgba(51, 204, 255, 0.3);
}

/* Info message */
.info-message {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: rgba(51, 204, 255, 0.1);
    border-radius: 8px;
    font-size: 0.7rem;
    color: #88aaff;
}

/* Toggles Grid */
.toggles-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 51, 102, 0.2);
    min-height: 44px;
}

.toggle-item-text {
    font-size: 0.8rem;
    color: #fff;
}

.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 22px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #ff3366;
    border-radius: 34px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: linear-gradient(45deg, #ff3366, #ff99cc);
    border-radius: 50%;
    transition: transform 0.3s ease;
}

input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: linear-gradient(45deg, #33ccff, #9933ff);
}

/* Indicators */
.mode-indicator {
    position: fixed;
    bottom: 15px;
    left: 15px;
    padding: 8px 16px;
    background: rgba(255, 51, 102, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid #ff3366;
    border-radius: 30px;
    color: #fff;
    font-size: 0.75rem;
    z-index: 998;
}

.selection-indicator {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 25, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid #33ccff;
    border-radius: 20px;
    padding: 8px 20px;
    color: #33ccff;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 998;
    box-shadow: 0 0 30px rgba(51, 204, 255, 0.3);
    pointer-events: none;
}

.hidden-panel-indicator,
.minimized-indicator {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 999;
}

.show-panel-btn,
.restore-panel-btn {
    width: 50px;
    height: 50px;
    border-radius: 25px;
    background: rgba(255, 51, 102, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid #ff3366;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-footer {
    height: 3px;
    background: linear-gradient(90deg, #ff3366, #33ccff, #9933ff);
}

/* Mobile-specific styles */
@media (max-width: 480px) {
    .control-panel {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }

    .mode-selector {
        grid-template-columns: 1fr;
    }

    .edit-toolbar {
        flex-direction: column;
    }

    .mode-indicator {
        bottom: 10px;
        left: 10px;
        font-size: 0.7rem;
        padding: 6px 12px;
    }

    .selection-indicator {
        bottom: 60px;
        font-size: 0.7rem;
        padding: 6px 16px;
    }

    .upload-wrapper {
        flex-direction: column;
    }
}

/* Tablet styles */
@media (min-width: 481px) and (max-width: 1024px) {
    .control-panel {
        width: 340px;
    }
}