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

        body {
            min-height: 100vh;
            background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: white;
            overflow-x: hidden;
        }

        .bg-animation {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 0;
            overflow: hidden;
        }

        .bg-orb {
            position: absolute;
            border-radius: 50%;
            filter: blur(80px);
            animation: pulse 4s ease-in-out infinite;
        }

        .bg-orb-1 {
            width: 50%;
            height: 50%;
            top: -25%;
            left: -25%;
            background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
        }

        .bg-orb-2 {
            width: 50%;
            height: 50%;
            bottom: -25%;
            right: -25%;
            background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, transparent 70%);
            animation-delay: 2s;
        }

        @keyframes pulse {
            0%, 100% { opacity: 0.5; transform: scale(1); }
            50% { opacity: 1; transform: scale(1.1); }
        }

        .container {
            position: relative;
            z-index: 1;
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        .header {
            text-align: center;
            margin-bottom: 20px;
        }

        .header h1 {
            font-size: 3rem;
            background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 5px;
        }

        .header p {
            color: #94a3b8;
            font-size: 1.1rem;
        }

        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .btn-primary {
            background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
            color: white;
        }

        .btn-primary:hover {
            background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
        }

        .btn-secondary {
            background: rgba(51, 65, 85, 0.8);
            color: #cbd5e1;
            border: 1px solid #475569;
        }

        .btn-secondary:hover {
            background: rgba(71, 85, 105, 0.8);
        }

        .btn-purple {
            background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
            color: white;
        }

        .btn-purple:hover {
            background: linear-gradient(135deg, #9333ea 0%, #6d28d9 100%);
        }

        .btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .gallery-toggle {
            display: flex;
            justify-content: center;
            margin-bottom: 15px;
        }

        .gallery {
            background: rgba(30, 41, 59, 0.8);
            border: 1px solid #475569;
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 15px;
            backdrop-filter: blur(10px);
        }

        .gallery.hidden {
            display: none;
        }

        .category-filters {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 8px;
            margin-bottom: 15px;
        }

        .category-btn {
            padding: 6px 14px;
            border-radius: 20px;
            font-size: 13px;
            border: 1px solid #475569;
            background: rgba(51, 65, 85, 0.6);
            color: #cbd5e1;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .category-btn:hover {
            background: rgba(71, 85, 105, 0.8);
        }

        .category-btn.active {
            background: #a855f7;
            border-color: #a855f7;
            color: white;
        }

        .image-grid {
            display: grid;
            grid-template-columns: repeat(10, 1fr);
            gap: 6px;
            margin-bottom: 15px;
        }

        @media (max-width: 768px) {
            .image-grid {
                grid-template-columns: repeat(5, 1fr);
            }
            .header h1 {
                font-size: 2rem;
            }
        }

        .image-item {
            aspect-ratio: 1;
            border-radius: 6px;
            overflow: hidden;
            cursor: pointer;
            border: 2px solid transparent;
            transition: all 0.2s ease;
            position: relative;
        }

        .image-item:hover {
            transform: scale(1.05);
            border-color: #a855f7;
        }

        .image-item.selected {
            border-color: #a855f7;
            box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
        }

        .image-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .image-item .number {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(0, 0, 0, 0.6);
            color: white;
            font-size: 10px;
            text-align: center;
            padding: 1px 0;
        }

        .pagination {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 15px;
        }

        .pagination span {
            color: #94a3b8;
            font-size: 14px;
        }

        .image-nav {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 15px;
            margin-bottom: 15px;
        }

        .image-info {
            background: rgba(30, 41, 59, 0.8);
            border: 1px solid #475569;
            border-radius: 8px;
            padding: 8px 16px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .image-info .category-badge {
            background: rgba(71, 85, 105, 0.8);
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 12px;
            color: #94a3b8;
        }

        .stats {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 15px;
        }

        .stat-card {
            background: rgba(30, 41, 59, 0.8);
            border: 1px solid #475569;
            border-radius: 8px;
            padding: 8px 16px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .stat-card .icon {
            font-size: 18px;
        }

        .stat-card .value {
            font-size: 18px;
            font-weight: 600;
            font-family: monospace;
        }

        .difficulty {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-bottom: 15px;
        }

        .difficulty-btn {
            padding: 8px 16px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 600;
            border: 1px solid #475569;
            background: rgba(51, 65, 85, 0.6);
            color: #cbd5e1;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .difficulty-btn:hover {
            background: rgba(71, 85, 105, 0.8);
        }

        .difficulty-btn.active {
            color: white;
        }

        .difficulty-btn.easy.active {
            background: #22c55e;
            border-color: #22c55e;
        }

        .difficulty-btn.medium.active {
            background: #eab308;
            border-color: #eab308;
        }

        .difficulty-btn.hard.active {
            background: #ef4444;
            border-color: #ef4444;
        }

        .controls {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 20px;
        }

        .game-area {
            display: flex;
            justify-content: center;
            align-items: flex-start;
            gap: 20px;
            flex-wrap: wrap;
        }

        .canvas-container {
            position: relative;
        }

        .canvas-glow {
            position: absolute;
            inset: -10px;
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(168, 85, 247, 0.2), rgba(236, 72, 153, 0.2));
            border-radius: 16px;
            filter: blur(15px);
            z-index: -1;
        }

        #puzzleCanvas {
            border-radius: 12px;
            border: 2px solid #475569;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
            cursor: grab;
            max-width: 100%;
            height: auto;
        }

        #puzzleCanvas:active {
            cursor: grabbing;
        }

        .particle {
            position: absolute;
            border-radius: 50%;
            pointer-events: none;
        }

        .preview-panel {
            width: 220px;
        }

        .preview-panel.hidden {
            display: none;
        }

        .preview-card {
            background: rgba(30, 41, 59, 0.8);
            border: 1px solid #475569;
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 15px;
            backdrop-filter: blur(10px);
        }

        .preview-card h3 {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 10px;
            font-size: 16px;
        }

        #previewCanvas {
            width: 100%;
            border-radius: 8px;
            border: 1px solid #475569;
        }

        .instructions ul {
            list-style: none;
            font-size: 13px;
            color: #94a3b8;
        }

        .instructions li {
            margin-bottom: 8px;
            display: flex;
            align-items: flex-start;
            gap: 8px;
        }

        .instructions li .num {
            color: #22c55e;
            font-weight: 600;
        }

        .status {
            display: flex;
            justify-content: center;
            margin-top: 15px;
        }

        .status-badge {
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 14px;
            font-weight: 500;
        }

        .status-badge.ready {
            background: #475569;
        }

        .status-badge.playing {
            background: #3b82f6;
            animation: blink 1s infinite;
        }

        .status-badge.complete {
            background: #22c55e;
        }

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

        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .modal-overlay.show {
            opacity: 1;
            visibility: visible;
        }

        .modal {
            background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
            border: 1px solid #475569;
            border-radius: 16px;
            padding: 30px;
            max-width: 400px;
            text-align: center;
            transform: scale(0.9);
            transition: transform 0.3s ease;
        }

        .modal-overlay.show .modal {
            transform: scale(1);
        }

        .modal h2 {
            font-size: 28px;
            background: linear-gradient(90deg, #fbbf24, #f97316, #ef4444);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 10px;
        }

        .modal p {
            color: #94a3b8;
            margin-bottom: 20px;
        }

        .trophy {
            font-size: 60px;
            margin-bottom: 20px;
            display: inline-block;
            animation: bounce 1s infinite;
        }

        @keyframes bounce {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }

        .modal-stats {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 20px;
        }

        .modal-stat {
            background: rgba(30, 41, 59, 0.8);
            border-radius: 8px;
            padding: 15px;
        }

        .modal-stat .label {
            color: #94a3b8;
            font-size: 12px;
            margin-bottom: 5px;
        }

        .modal-stat .value {
            font-size: 24px;
            font-weight: 700;
            font-family: monospace;
        }

        .modal-buttons {
            display: flex;
            justify-content: center;
            gap: 10px;
        }

        .loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-size: 18px;
            animation: pulse 1s infinite;
        }

        .progress-container {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .progress-bar {
            width: 80px;
            height: 6px;
            background: #1e293b;
            border-radius: 3px;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #eab308, #22c55e);
            transition: width 0.3s ease;
        }