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

        :root {
            --bg-primary: #000000;
            --bg-secondary: #111111;
            --bg-card: #1a1a1a;
            --text-primary: #ffffff;
            --text-secondary: #aaaaaa;
            --accent: #FFD700;
            --accent-dark: #B8860B;
            --border: #333333;
            --success: #32CD32;
        }

        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        ::-webkit-scrollbar-track {
            background: var(--bg-primary); 
        }
        ::-webkit-scrollbar-thumb {
            background: #333; 
            border-radius: 4px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--accent); 
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            background-color: var(--bg-primary);
            color: var(--text-primary);
            line-height: 1.5;
            overflow-x: hidden;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 16px;
        }

        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: var(--bg-primary);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            transition: opacity 0.3s ease;
        }

        .loading-overlay.hidden {
            opacity: 0;
            pointer-events: none;
            visibility: hidden; 
        }

        .loading-spinner {
            width: 60px;
            height: 60px;
            border: 4px solid var(--border);
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 20px;
        }

        .loading-text {
            font-size: 1.2rem;
            color: var(--text-secondary);
            text-align: center;
        }

        .loading-details {
            margin-top: 10px;
            font-size: 0.9rem;
            color: var(--text-secondary);
            text-align: center;
        }

        .bottom-scroll-top {
            background-color: var(--accent);
            color: #000;
            border: none;
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin: 20px auto;
            width: fit-content;
        }

        .bottom-scroll-top:hover {
            background-color: var(--accent-dark);
            transform: translateY(-2px);
        }

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

        header {
            background-color: var(--bg-secondary);
            padding: 12px 0;
            position: sticky;
            top: 0;
            z-index: 100;
            border-bottom: 1px solid var(--border);
        }

        .header-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .app-title {
            display: flex;
            align-items: center;
            gap: 4px;
            font-size: 1.4rem;
            font-weight: 700;
            letter-spacing: 0.5px;
            user-select: none;
        }

        .app-title .star {
            color: var(--accent);
            font-size: 1.6rem;
        }

        .hamburger-menu {
            background: none;
            border: none;
            color: var(--text-primary);
            font-size: 1.8rem;
            cursor: pointer;
            padding: 8px;
            margin-right: -8px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .sidebar-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            z-index: 1000;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .sidebar {
            position: fixed;
            top: 0;
            right: -300px;
            width: 280px;
            height: 100%;
            background-color: var(--bg-secondary);
            border-left: 1px solid var(--border);
            transition: right 0.3s ease;
            z-index: 1001;
            overflow-y: auto;
        }

        .sidebar.active {
            right: 0;
        }

        .sidebar-header {
            padding: 20px;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .sidebar-close {
            background: none;
            border: none;
            color: var(--text-primary);
            font-size: 1.5rem;
            cursor: pointer;
            padding: 4px;
        }

        .sidebar-menu {
            padding: 20px 0;
        }

        .sidebar-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 16px 20px;
            color: var(--text-primary);
            text-decoration: none;
            border-bottom: 1px solid var(--border);
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .sidebar-item:hover {
            background-color: rgba(255, 215, 0, 0.1);
        }

        .sidebar-item svg {
            width: 20px;
            height: 20px;
        }

        body:fullscreen {
            background-color: var(--bg-primary);
        }

        body:fullscreen .container {
            max-width: none;
        }

        body:fullscreen header {
            position: static;
        }

        .upload-section {
            background-color: var(--bg-secondary);
            border-radius: 12px;
            padding: 20px;
            margin: 20px 0;
            border: 2px dashed var(--border);
            transition: all 0.3s;
            text-align: center;
            cursor: pointer;
        }

        .upload-section.dragover {
            border-color: var(--accent);
            background-color: rgba(255, 215, 0, 0.05);
        }

        .upload-button {
            background-color: var(--accent);
            color: #000;
            border: none;
            padding: 12px 24px;
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin-top: 12px;
        }

        .upload-button:hover {
            background-color: var(--accent-dark);
        }

        .upload-button svg {
            width: 20px;
            height: 20px;
        }

        .upload-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            justify-content: center;
            margin-top: 12px;
        }

        #fileInput {
            display: none;
        }

        #folderInput {
            display: none;
        }

        #zipInput {
            display: none;
        }

        .upload-info {
            margin-top: 12px;
            font-size: 0.875rem;
            color: var(--text-secondary);
        }

        .stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 12px;
            margin-bottom: 20px;
        }

        .stat-card {
            background-color: var(--bg-secondary);
            padding: 16px;
            border-radius: 10px;
            border-left: 4px solid var(--accent);
        }

        .stat-value {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--accent);
        }

        .stat-label {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-top: 4px;
        }

        #mediaContainer {
            position: relative;
            min-height: 200px;
        }

        .media-grid {
            column-count: 1;
            column-gap: 20px;
            margin-bottom: 32px;
        }
        
        #virtualMediaGrid {
            position: relative;
            width: 100%;
        }

        @media (min-width: 640px) {
            .media-grid { column-count: 2; }
        }
        @media (min-width: 1024px) {
            .media-grid { column-count: 3; }
        }
        @media (min-width: 1400px) {
            .media-grid { column-count: 4; }
        }

        .media-card {
            background-color: var(--bg-card);
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
            transition: transform 0.3s, box-shadow 0.3s;
            border: 1px solid var(--border);
            width: 100%;
            margin-bottom: 20px;
            break-inside: avoid;
            display: inline-block;
            
            opacity: 0;
            transform: translateY(20px);
            animation: fadeInUp 0.4s ease forwards;
        }

        @keyframes fadeInUp {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .media-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 30px rgba(255, 215, 0, 0.1);
            border-color: var(--accent);
        }

        .card-header {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
        }

        .card-title {
            font-size: 0.9rem;
            font-weight: 500;
            line-height: 1.4;
            word-break: break-word;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .media-preview {
            position: relative;
            width: 100%;
            min-height: 150px; 
            max-height: 80vh;
            background-color: var(--bg-primary);
        }

        .media-preview img,
        .media-preview video {
            width: 100%;
            height: auto;
            display: block;
            object-fit: contain;
            background-color: var(--bg-primary);
        }

        .video-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.9);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            cursor: default;
            pointer-events: all;
        }

        .video-overlay video {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            width: auto;
            height: auto;
        }

        .video-overlay.hidden {
            display: none;
        }

        .video-controls {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            padding: 15px;
            background: linear-gradient(transparent, rgba(0,0,0,0.9));
            z-index: 1001;
            pointer-events: all;
        }
        
        .video-close-btn {
            position: absolute;
            top: 10px;
            right: 10px;
            background: rgba(0, 0, 0, 0.8);
            border: none;
            color: white;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 1002;
            font-size: 1.2rem;
            pointer-events: all;
        }

        .video-timeline {
            width: 100%;
            height: 4px;
            background-color: rgba(255, 255, 255, 0.3);
            border-radius: 2px;
            cursor: pointer;
            margin-bottom: 8px;
            position: relative;
        }

        .video-progress {
            height: 100%;
            background-color: var(--accent);
            border-radius: 2px;
            width: 0%;
        }

        .video-controls-bottom {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .video-time {
            color: white;
            font-size: 0.8rem;
        }

        .video-fullscreen-btn {
            background: none;
            border: none;
            color: white;
            cursor: pointer;
            font-size: 1.2rem;
            padding: 5px;
        }

        .image-controls {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            padding: 15px;
            background: linear-gradient(transparent, rgba(0,0,0,0.8));
            z-index: 6;
            display: flex;
            justify-content: flex-end;
        }
        
        .image-close-btn {
            position: absolute;
            top: 10px;
            right: 10px;
            background: rgba(0, 0, 0, 0.6);
            border: none;
            color: white;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 7;
            font-size: 1.2rem;
        }

        .image-fullscreen-btn {
            background: none;
            border: none;
            color: white;
            cursor: pointer;
            font-size: 1.2rem;
            padding: 5px;
        }

        .carousel-container {
            position: relative;
            width: 100%;
            aspect-ratio: 4/3;
            overflow: hidden;
            background-color: #000;
            touch-action: pan-y pinch-zoom;
        }

        .carousel-slides {
            display: flex;
            height: 100%;
            transition: transform 0.3s ease;
            will-change: transform;
        }

        .carousel-slide {
            flex: 0 0 100%;
            height: 100%;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .carousel-slide img,
        .carousel-slide video {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .carousel-nav {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background-color: rgba(0, 0, 0, 0.6);
            border: none;
            color: var(--accent);
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 10;
            transition: all 0.2s;
            font-size: 1.2rem;
            font-weight: bold;
            opacity: 0;
        }

        .carousel-container:hover .carousel-nav {
            opacity: 1;
        }

        .carousel-nav:hover {
            background-color: var(--accent);
            color: #000;
        }

        .carousel-nav.prev { left: 8px; }
        .carousel-nav.next { right: 8px; }

        .carousel-dots {
            position: absolute;
            bottom: 12px;
            left: 0;
            right: 0;
            display: flex;
            justify-content: center;
            gap: 6px;
            z-index: 10;
            pointer-events: none;
        }

        .carousel-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.3);
            border: none;
            padding: 0;
            transition: all 0.2s;
            pointer-events: auto;
            cursor: pointer;
        }

        .carousel-dot.active {
            background-color: var(--accent);
            transform: scale(1.2);
        }

        .swipe-indicator {
            position: absolute;
            bottom: 12px;
            right: 12px;
            display: flex;
            align-items: center;
            gap: 4px;
            z-index: 10;
            pointer-events: none;
            background-color: rgba(0, 0, 0, 0.6);
            padding: 6px 10px;
            border-radius: 20px;
            font-size: 0.7rem;
        }

        .swipe-indicator-icon {
            display: flex;
            align-items: center;
            gap: 2px;
        }

        .swipe-indicator-icon span {
            display: inline-block;
            width: 4px;
            height: 4px;
            background-color: var(--accent);
            border-radius: 50%;
            animation: pulse 1.5s infinite;
        }

        .swipe-indicator-icon span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .swipe-indicator-icon span:nth-child(3) {
            animation-delay: 0.4s;
        }

        @keyframes pulse {
            0%, 100% { opacity: 0.4; transform: scale(0.8); }
            50% { opacity: 1; transform: scale(1.2); }
        }

        footer {
            text-align: center;
            padding: 20px 0;
            color: var(--text-secondary);
            font-size: 0.875rem;
            border-top: 1px solid var(--border);
            margin-top: 32px;
        }

        .empty-state {
            text-align: center;
            padding: 60px 24px;
            color: var(--text-secondary);
        }

        .empty-state svg {
            width: 80px;
            height: 80px;
            margin-bottom: 20px;
            color: var(--accent);
            opacity: 0.5;
        }

        .empty-state h3 {
            font-size: 1.5rem;
            margin-bottom: 8px;
            color: var(--text-primary);
        }

        .file-counter {
            background-color: var(--accent);
            color: #000;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
            margin-left: 12px;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }

        @media (min-width: 769px) {
            .header-content { padding: 0 8px; }
            .app-title { font-size: 1.8rem; }
            .app-title .star { font-size: 2rem; }
            .hamburger-menu { display: none; }
            
            .action-buttons {
                display: flex;
                gap: 12px;
                align-items: center;
            }
            
            .clear-button {
                background-color: transparent;
                color: var(--text-secondary);
                border: 1px solid var(--border);
                padding: 8px 20px;
                border-radius: 8px;
                font-size: 0.9rem;
                cursor: pointer;
                transition: all 0.2s;
            }
            
            .clear-button:hover {
                color: #ff4444;
                border-color: #ff4444;
            }
            
            .upload-section {
                padding: 24px;
                margin: 24px 0;
            }
            
            .stats {
                display: flex;
                gap: 24px;
            }
            
            .stat-card { padding: 20px; }
            .stat-value { font-size: 1.8rem; }
        }

        .mobile-action-buttons {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        @media screen and (orientation: portrait) {
            .media-grid {
                column-count: 1;
            }
            
            .carousel-container {
                aspect-ratio: 3/4;
            }
        }
        
        @media screen and (orientation: landscape) {
            .media-grid {
                column-count: 2;
            }
            
            .carousel-container {
                aspect-ratio: 16/9;
            }
        }
        
        @media (max-width: 768px) {
            .action-buttons { display: none; }
            .mobile-action-buttons { display: flex; }
            
            .upload-button,
            .clear-button,
            .hamburger-menu {
                min-height: 44px;
                min-width: 44px;
            }
            
            .carousel-nav {
                width: 44px;
                height: 44px;
                font-size: 1.5rem;
            }
            
            .media-card {
                margin-bottom: 16px;
            }
            
            .upload-section {
                padding: 16px;
                margin: 16px 0;
            }
        }
        
        @media (max-width: 768px) and (orientation: landscape) {
            .media-grid {
                column-count: 2;
            }
            
            .header-content {
                padding: 8px 4px;
            }
        }

        .progress-bar {
            width: 200px;
            height: 4px;
            background-color: var(--border);
            border-radius: 2px;
            margin-top: 15px;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background-color: var(--accent);
            width: 0%;
            transition: width 0.3s ease;
        }