        :root {
            /* Semantic Color System */
            --color-background-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 25%, #334155 50%, #475569 75%, #64748b 100%);
            --color-surface-primary: rgba(15, 23, 42, 0.85);
            --color-surface-secondary: rgba(30, 41, 59, 0.8);
            --color-surface-tertiary: rgba(51, 65, 85, 0.75);
            --color-surface-elevated: rgba(248, 250, 252, 0.08);
            --color-surface-overlay: rgba(241, 245, 249, 0.05);
            
            /* Text Colors */
            --color-text-primary: rgba(248, 250, 252, 0.95);
            --color-text-secondary: rgba(241, 245, 249, 0.85);
            --color-text-tertiary: rgba(226, 232, 240, 0.7);
            --color-text-muted: rgba(148, 163, 184, 0.6);
            
            /* Brand Colors */
            --color-brand-primary: rgba(59, 130, 246, 0.9);
            --color-brand-secondary: rgba(37, 99, 235, 0.95);
            --color-brand-tertiary: rgba(29, 78, 216, 1);
            
            /* Status Colors */
            --color-success: rgba(34, 197, 94, 0.9);
            --color-warning: rgba(245, 158, 11, 0.9);
            --color-danger: rgba(239, 68, 68, 0.9);
            --color-danger-secondary: rgba(220, 38, 38, 0.95);
            
            /* Border Colors */
            --color-border-primary: rgba(255, 255, 255, 0.12);
            --color-border-secondary: rgba(255, 255, 255, 0.08);
            --color-border-tertiary: rgba(148, 163, 184, 0.15);
            
            /* Interactive States */
            --color-hover-surface: rgba(255, 255, 255, 0.1);
            --color-active-surface: rgba(255, 255, 255, 0.15);
            --color-focus-outline: rgba(59, 130, 246, 0.5);
            
            /* Glass Effects */
            --glass-primary: blur(24px) saturate(180%);
            --glass-secondary: blur(16px) saturate(180%);
            --glass-tertiary: blur(12px) saturate(120%);
            
            /* Shadows */
            --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
            --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
            --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.24), 0 4px 16px rgba(0, 0, 0, 0.16);
            --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15), 0 10px 10px rgba(0, 0, 0, 0.04);
            --shadow-glass: inset 0 1px 0 rgba(255, 255, 255, 0.08);
            
            /* Spacing System */
            --spacing-xs: 4px;
            --spacing-sm: 8px;
            --spacing-md: 12px;
            --spacing-lg: 16px;
            --spacing-xl: 20px;
            --spacing-2xl: 24px;
            --spacing-3xl: 32px;
            --spacing-4xl: 48px;
            --spacing-5xl: 64px;
            
            /* Border Radius */
            --radius-sm: 6px;
            --radius-md: 8px;
            --radius-lg: 12px;
            --radius-xl: 16px;
            --radius-2xl: 20px;
            
            /* Layout */
            --sidebar-width: 320px;
            --header-height: 48px;
            --toolbar-height: 76px;
            
            /* Animation */
            --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
            --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
            --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }
        
        /* Micro-animations */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        @keyframes slideIn {
            from { opacity: 0; transform: translateX(-12px); }
            to { opacity: 1; transform: translateX(0); }
        }
        
        @keyframes pulseGlow {
            0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
            50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
        }
        
        @keyframes shimmer {
            0% { transform: translateX(-100%); }
            100% { transform: translateX(100%); }
        }
        
        * {
            box-sizing: border-box;
        }
        
        /* Smooth scrolling */
        * {
            scrollbar-width: thin;
            scrollbar-color: var(--color-border-primary) transparent;
        }
        
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }
        
        ::-webkit-scrollbar-track {
            background: transparent;
        }
        
        ::-webkit-scrollbar-thumb {
            background: var(--color-border-primary);
            border-radius: var(--radius-sm);
        }
        
        ::-webkit-scrollbar-thumb:hover {
            background: var(--color-border-tertiary);
        }
        
        /* Focus states */
        button:focus-visible,
        input:focus-visible,
        select:focus-visible {
            outline: 2px solid var(--color-focus-outline);
            outline-offset: 2px;
        }
        
        /* Selection */
        ::selection {
            background: var(--color-brand-primary);
            color: white;
        }
        
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
            margin: 0;
            padding: 0;
            background: var(--color-background-primary);
            background-size: 300% 300%;
            animation: gradientShift 8s ease infinite;
            color: var(--color-text-primary);
            overflow: hidden;
            height: 100vh;
            font-weight: 400;
            letter-spacing: -0.01em;
        }
        
        @keyframes gradientShift {
            0%, 100% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
        }
        
        .app-container {
            display: flex;
            flex-direction: column;
            height: 100vh;
            background: rgba(15, 23, 42, 0.05);
            backdrop-filter: blur(2px);
            animation: fadeIn 0.8s ease-out;
        }
        
        .title-bar {
            background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.8) 50%, rgba(51, 65, 85, 0.7) 100%);
            backdrop-filter: blur(20px) saturate(180%);
            border: 1px solid rgba(148, 163, 184, 0.1);
            border-bottom: 1px solid rgba(148, 163, 184, 0.15);
            padding: var(--spacing-md) var(--spacing-lg);
            height: var(--header-height);
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 
                var(--shadow-sm),
                0 8px 30px rgba(0, 0, 0, 0.12),
                var(--shadow-glass);
            position: relative;
            z-index: 1000;
        }
        
        .title-bar h1 {
            margin: 0;
            font-size: 15px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 10px;
            color: var(--color-text-primary);
            letter-spacing: -0.02em;
        }
        
        
        .main-content {
            flex: 1;
            display: flex;
            position: relative;
            overflow: hidden;
        }
        
        .layers-sidebar {
            width: var(--sidebar-width);
            background: linear-gradient(135deg, 
                var(--color-surface-primary) 0%, 
                var(--color-surface-secondary) 50%,
                var(--color-surface-tertiary) 100%);
            backdrop-filter: var(--glass-primary);
            border-right: 1px solid var(--color-border-tertiary);
            box-shadow: 
                inset -1px 0 0 var(--color-border-secondary),
                var(--shadow-md);
            display: flex;
            flex-direction: column;
            transition: all var(--transition-slow);
            position: relative;
            z-index: 10;
        }
        
        .layers-sidebar.hidden {
            transform: translateX(calc(-1 * var(--sidebar-width))) scale(0.95);
            box-shadow: none;
        }
        
        .editor-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: linear-gradient(135deg, 
                var(--color-surface-elevated) 0%, 
                var(--color-surface-overlay) 50%,
                rgba(226, 232, 240, 0.01) 100%);
            backdrop-filter: var(--glass-tertiary);
            margin: var(--spacing-md);
            border-radius: var(--radius-xl);
            border: 1px solid var(--color-border-secondary);
            box-shadow: 
                var(--shadow-md),
                var(--shadow-glass);
            overflow: hidden;
        }
        
        .tileset-sidebar {
            width: 320px;
            background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
            backdrop-filter: blur(20px);
            border-left: 1px solid rgba(148, 163, 184, 0.2);
            display: flex;
            flex-direction: column;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            z-index: 10;
        }
        
        .tileset-sidebar.expanded {
            width: 480px;
        }
        
        .tileset-sidebar.hidden {
            transform: translateX(var(--sidebar-width, 320px));
        }
        
        .tileset-sidebar.expanded.hidden {
            transform: translateX(480px);
        }
        
        .toolbar {
            background: linear-gradient(135deg, 
                rgba(248, 250, 252, 0.08) 0%, 
                rgba(241, 245, 249, 0.05) 50%, 
                rgba(226, 232, 240, 0.03) 100%);
            backdrop-filter: blur(24px) saturate(200%);
            border: 1px solid rgba(248, 250, 252, 0.08);
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            border-bottom: 1px solid rgba(148, 163, 184, 0.12);
            padding: var(--spacing-md) var(--spacing-lg);
            display: flex;
            align-items: flex-start;
            gap: var(--spacing-md);
            flex-wrap: wrap;
            min-height: var(--toolbar-height);
            position: relative;
            z-index: 100;
            box-shadow: 
                var(--shadow-sm),
                0 4px 12px rgba(0, 0, 0, 0.08),
                var(--shadow-glass);
        }
        
        /* Remove tool-section styles to use simpler grouping */
        
        .tool-group {
            display: flex;
            background: linear-gradient(135deg, 
                rgba(255, 255, 255, 0.1) 0%, 
                rgba(255, 255, 255, 0.06) 100%);
            backdrop-filter: blur(10px);
            border-radius: var(--radius-md);
            padding: var(--spacing-xs);
            gap: var(--spacing-xs);
            border: 1px solid var(--color-border-primary);
            box-shadow: 
                var(--shadow-sm),
                var(--shadow-glass);
        }
        
        .action-group {
            display: flex;
            gap: var(--spacing-xs);
        }
        
        .tool-btn {
            background: transparent;
            color: var(--color-text-secondary);
            border: none;
            padding: var(--spacing-sm) var(--spacing-md);
            border-radius: var(--radius-md);
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            letter-spacing: -0.01em;
            transition: all var(--transition-normal);
            display: flex;
            align-items: center;
            gap: var(--spacing-xs);
            min-width: 64px;
            justify-content: center;
            height: 36px;
            position: relative;
            overflow: hidden;
        }
        
        .tool-btn::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
            transform: translate(-50%, -50%);
            transition: all var(--transition-fast);
            border-radius: 50%;
            pointer-events: none;
        }
        
        .tool-btn::before {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
            opacity: 0;
            transition: opacity 0.25s ease;
        }
        
        .tool-btn:hover {
            background: var(--color-hover-surface);
            color: var(--color-text-primary);
            transform: translateY(-2px) scale(1.02);
            box-shadow: var(--shadow-md);
        }
        
        .tool-btn:hover::after {
            width: 100%;
            height: 100%;
        }
        
        .tool-btn:active {
            transform: translateY(0) scale(0.98);
            transition: all var(--transition-fast);
        }
        
        .tool-btn:hover::before {
            opacity: 1;
        }
        
        .tool-btn.active {
            background: linear-gradient(135deg, 
                var(--color-brand-primary) 0%, 
                var(--color-brand-secondary) 50%,
                var(--color-brand-tertiary) 100%);
            color: var(--color-text-primary);
            box-shadow: 
                0 4px 20px rgba(59, 130, 246, 0.35),
                0 2px 8px rgba(59, 130, 246, 0.2),
                var(--shadow-glass);
            transform: translateY(-2px) scale(1.02);
            animation: pulseGlow 2s infinite;
        }
        
        .action-btn {
            background: linear-gradient(135deg, 
                var(--color-surface-elevated) 0%, 
                var(--color-surface-overlay) 50%,
                rgba(226, 232, 240, 0.06) 100%);
            backdrop-filter: var(--glass-tertiary);
            color: var(--color-text-secondary);
            border: 1px solid var(--color-border-primary);
            padding: var(--spacing-sm) var(--spacing-md);
            border-radius: var(--radius-md);
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            letter-spacing: -0.01em;
            transition: all var(--transition-normal);
            height: 36px;
            display: flex;
            align-items: center;
            gap: var(--spacing-sm);
            justify-content: center;
            position: relative;
            overflow: hidden;
            box-shadow: 
                var(--shadow-sm),
                var(--shadow-glass);
        }
        
        .action-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
            transition: left var(--transition-slow);
        }
        
        .action-btn::before {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
            opacity: 0;
            transition: opacity 0.25s ease;
        }
        
        .action-btn:hover {
            background: linear-gradient(135deg, 
                rgba(248, 250, 252, 0.18) 0%, 
                rgba(241, 245, 249, 0.12) 50%,
                rgba(226, 232, 240, 0.08) 100%);
            transform: translateY(-2px) scale(1.02);
            box-shadow: 
                var(--shadow-lg),
                var(--shadow-glass);
            border-color: var(--color-border-primary);
            color: var(--color-text-primary);
        }
        
        .action-btn:hover::before {
            left: 100%;
        }
        
        .action-btn:active {
            transform: translateY(0) scale(0.98);
            transition: all var(--transition-fast);
        }
        
        .action-btn:hover::before {
            opacity: 1;
        }
        
        .action-btn.danger {
            background: linear-gradient(135deg, 
                rgba(239, 68, 68, 0.9) 0%, 
                rgba(220, 38, 38, 0.95) 50%,
                rgba(185, 28, 28, 1) 100%);
            border-color: rgba(239, 68, 68, 0.3);
            box-shadow: 
                0 2px 8px rgba(239, 68, 68, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
        }
        
        .action-btn.danger:hover {
            background: linear-gradient(135deg, 
                rgba(248, 113, 113, 0.95) 0%, 
                rgba(239, 68, 68, 1) 50%,
                rgba(220, 38, 38, 1) 100%);
            box-shadow: 
                0 6px 20px rgba(239, 68, 68, 0.4),
                0 2px 8px rgba(239, 68, 68, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
        }
        
        .canvas-area {
            flex: 1;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            position: relative;
            overflow: auto;
            z-index: 1;
            min-height: 0;
        }
        
        #levelCanvas {
            border-radius: 8px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            border: 2px solid rgba(255, 255, 255, 0.1);
            background: #1a1a1a;
        }
        
        
        .window-content.minimized {
            display: none;
        }
        
        .snap-indicator {
            position: fixed;
            background: rgba(59, 130, 246, 0.3);
            border: 2px dashed #3b82f6;
            border-radius: 8px;
            pointer-events: none;
            z-index: 999;
            transition: all 0.2s ease;
        }
        
        .window-header {
            background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
            padding: 8px 12px;
            cursor: move;
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-radius: 12px 12px 0 0;
            border-bottom: 1px solid rgba(148, 163, 184, 0.2);
        }
        
        .window-title {
            font-size: 14px;
            font-weight: 600;
            color: #fff;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        
        .window-content {
            padding: 15px;
            height: calc(100% - 45px);
            overflow: auto;
        }
        
        .tileset-viewport {
            width: 100%;
            height: 100%;
            overflow: auto;
            background: #1a1a1a;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        #tilesetCanvas {
            display: block;
            cursor: crosshair;
        }
        
        .tileset-controls {
            position: absolute;
            top: 50px;
            right: 15px;
            display: flex;
            gap: 4px;
            z-index: 10;
        }
        
        .zoom-btn {
            background: rgba(0, 0, 0, 0.8);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            padding: 4px 8px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: all 0.2s ease;
            backdrop-filter: blur(10px);
            z-index: 1000;
            position: relative;
        }
        
        .zoom-btn:hover {
            background: rgba(0, 0, 0, 0.9);
            transform: translateY(-1px);
        }
        
        .status-bar {
            background: rgba(0, 0, 0, 0.3);
            padding: 8px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 13px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
        }
        
        .status-left {
            display: flex;
            align-items: center;
            gap: 20px;
        }
        
        .status-right {
            display: flex;
            align-items: center;
            gap: 15px;
        }
        
        .checkbox-container {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .checkbox-container input[type="checkbox"] {
            transform: scale(1.2);
            accent-color: #667eea;
        }
        
        .slider-container {
            margin-bottom: 12px;
        }
        
        .slider-container label {
            display: block;
            font-size: 12px;
            color: rgba(255, 255, 255, 0.9);
            margin-bottom: 4px;
        }
        
        .slider-container input[type="range"] {
            width: 100%;
            height: 4px;
            background: rgba(255, 255, 255, 0.2);
            outline: none;
            border-radius: 2px;
        }
        
        .slider-container input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 14px;
            height: 14px;
            background: #3b82f6;
            cursor: pointer;
            border-radius: 50%;
        }
        
        .info-display {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 12px;
            color: rgba(255, 255, 255, 0.7);
            margin-left: auto;
        }
        
        .info-display .separator {
            opacity: 0.5;
        }
        
        .separator {
            width: 1px;
            height: 24px;
            background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.3), transparent);
            margin: 0 8px;
            border-radius: 1px;
            align-self: center;
        }

        .reset-view-btn {
            background: rgba(59, 130, 246, 0.8);
            border: 1px solid rgba(59, 130, 246, 0.6);
            color: white;
            padding: 4px 8px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 11px;
            font-weight: 500;
            transition: all 0.2s ease;
        }

        .reset-view-btn:hover {
            background: rgba(59, 130, 246, 1);
            border-color: rgba(59, 130, 246, 0.8);
            transform: translateY(-1px);
        }
        
        .danger-separator {
            background: linear-gradient(to bottom, transparent, rgba(239, 68, 68, 0.5), transparent);
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0%, 100% { opacity: 0.5; }
            50% { opacity: 1; }
        }
        
        .danger-group {
            animation: warningGlow 3s ease-in-out infinite;
        }
        
        @keyframes warningGlow {
            0%, 100% { filter: drop-shadow(0 0 0px rgba(239, 68, 68, 0)); }
            50% { filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.3)); }
        }
        
        .tileset-controls {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            gap: 8px;
        }
        
        .control-group {
            display: flex;
            gap: 4px;
            align-items: center;
        }
        
        .tileset-global-controls {
            display: flex;
            gap: 8px;
            margin-bottom: 10px;
            padding: 8px;
            background: rgba(0, 0, 0, 0.2);
            border-radius: 6px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .search-input {
            flex: 1;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: #fff;
            padding: 6px 10px;
            border-radius: 6px;
            font-size: 12px;
        }
        
        .search-input:focus {
            outline: none;
            border-color: #3b82f6;
            background: rgba(255, 255, 255, 0.15);
        }
        
        .action-btn.small {
            padding: 4px 8px;
            font-size: 12px;
        }
        
        .clear-hand {
            background: linear-gradient(135deg, rgba(251, 146, 60, 0.2), rgba(245, 101, 101, 0.2)) !important;
            border: 1px solid rgba(251, 146, 60, 0.4) !important;
            position: relative;
            overflow: hidden;
        }
        
        .clear-hand::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s;
        }
        
        .clear-hand:hover::before {
            left: 100%;
        }
        
        .danger {
            background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2)) !important;
            border: 1px solid rgba(239, 68, 68, 0.4) !important;
            color: rgba(255, 255, 255, 0.9) !important;
        }
        
        .danger:hover {
            background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(220, 38, 38, 0.3)) !important;
            box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
            transform: translateY(-1px);
        }
        
        .file-load {
            cursor: pointer;
        }
        
        .file-load input {
            display: none;
        }
        
        
        /* Responsive grouping */
        @media (max-width: 1200px) {
            .tool-group {
                flex-wrap: wrap;
            }
            
            .action-group {
                flex-wrap: wrap;
                max-width: 200px;
            }
            
            .toolbar {
                gap: 8px;
            }
        }
        
        .layers-toolbar {
            display: flex;
            gap: 4px;
            margin-bottom: 10px;
            padding-bottom: 8px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .layers-list {
            flex: 1;
            overflow-y: auto;
            max-height: 500px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 6px;
            background: rgba(0, 0, 0, 0.2);
        }
        
        .layer-item {
            display: flex;
            align-items: center;
            padding: 8px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            cursor: pointer;
            transition: background 0.2s ease;
        }
        
        .layer-item:hover {
            background: rgba(255, 255, 255, 0.05);
        }
        
        .layer-item.active {
            background: rgba(59, 130, 246, 0.3);
            border-left: 3px solid #3b82f6;
        }
        
        .layer-visibility {
            width: 16px;
            height: 16px;
            margin-right: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
        }
        
        .layer-lock {
            width: 16px;
            height: 16px;
            margin-right: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            opacity: 0.7;
        }
        
        .layer-lock:hover {
            opacity: 1;
        }
        
        .layer-settings {
            width: 16px;
            height: 16px;
            margin-left: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            opacity: 0.7;
            position: relative;
        }
        
        .layer-settings:hover {
            opacity: 1;
        }
        
        .layer-menu {
            position: fixed;
            background: rgba(30, 41, 59, 0.95);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 6px;
            padding: 4px 0;
            min-width: 140px;
            z-index: 1000;
            backdrop-filter: blur(10px);
            display: none;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }
        
        .layer-menu.show {
            display: block;
        }
        
        .layer-menu-item {
            padding: 6px 12px;
            font-size: 12px;
            color: rgba(255, 255, 255, 0.9);
            cursor: pointer;
            transition: background 0.2s ease;
        }
        
        .layer-menu-item:hover {
            background: rgba(255, 255, 255, 0.1);
        }
        
        .layer-menu-item.danger {
            color: #ef4444;
        }
        
        .layer-menu-item.danger:hover {
            background: rgba(239, 68, 68, 0.1);
        }
        
        .menu-bar {
            background: rgba(0, 0, 0, 0.3);
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            padding: 0;
            display: flex;
            align-items: center;
            height: 32px;
            backdrop-filter: blur(10px);
        }
        
        .title-menu-bar {
            display: flex;
            align-items: center;
            margin-left: 24px;
        }
        
        .title-menu-item {
            position: relative;
            padding: 6px 12px;
            color: rgba(255, 255, 255, 0.8);
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: all 0.2s ease;
            user-select: none;
            border-radius: 4px;
        }
        
        .title-menu-item:hover {
            background: rgba(255, 255, 255, 0.1);
            color: rgba(255, 255, 255, 1);
        }
        
        .title-menu-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            background: linear-gradient(135deg, 
                var(--color-surface-secondary) 0%, 
                var(--color-surface-tertiary) 50%,
                rgba(71, 85, 105, 0.75) 100%);
            backdrop-filter: var(--glass-secondary);
            border: 1px solid var(--color-border-primary);
            border-radius: var(--radius-lg);
            padding: var(--spacing-sm) 0;
            min-width: 160px;
            z-index: 1000;
            display: none;
            box-shadow: 
                var(--shadow-lg),
                var(--shadow-glass);
            opacity: 0;
            transition: all var(--transition-normal);
            transform: translateY(-8px) scale(0.95);
        }
        
        .title-menu-dropdown.show {
            display: block;
            opacity: 1;
            transform: translateY(0) scale(1);
            animation: fadeIn var(--transition-normal) var(--bounce);
        }
        
        .title-menu-dropdown-item {
            position: relative;
            padding: var(--spacing-sm) var(--spacing-lg);
            font-size: 13px;
            color: var(--color-text-secondary);
            cursor: pointer;
            transition: all var(--transition-fast);
            border-radius: var(--radius-sm);
            margin: 0 var(--spacing-xs);
        }
        
        .title-menu-dropdown-item:hover {
            background: var(--color-hover-surface);
            color: var(--color-text-primary);
            transform: translateX(4px);
        }
        
        .title-submenu {
            position: absolute;
            top: 0;
            left: 100%;
            margin-left: 2px;
            background: rgba(30, 41, 59, 0.95);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 6px;
            padding: 4px 0;
            min-width: 120px;
            z-index: 1001;
            backdrop-filter: blur(10px);
            display: none;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }
        
        .title-menu-dropdown-item:hover .title-submenu {
            display: block;
        }
        
        .title-submenu-item {
            padding: 6px 12px;
            font-size: 12px;
            color: rgba(255, 255, 255, 0.9);
            cursor: pointer;
            transition: background-color 0.2s ease;
        }
        
        .title-submenu-item:hover {
            background: rgba(255, 255, 255, 0.1);
        }
        
        /* Title File Menu Container in title bar */
        .title-file-menu-container {
            display: flex;
            align-items: center;
            position: absolute;
            left: 320px; /* Align with right edge of layers sidebar when shown */
            top: 50%;
            transform: translateY(-50%);
            transition: left 0.3s ease;
            z-index: 1000; /* Ensure it stays on top */
        }
        
        
        .title-file-menu-separator {
            width: 1px;
            height: 16px;
            background: rgba(255, 255, 255, 0.3);
            margin-right: 12px;
        }
        
        .title-file-menu-item {
            position: relative;
            padding: 4px 12px;
            color: rgba(255, 255, 255, 0.8);
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: all 0.2s ease;
            user-select: none;
            border-radius: 4px;
        }
        
        .title-file-menu-item:hover {
            background: rgba(255, 255, 255, 0.1);
            color: rgba(255, 255, 255, 1);
        }
        
        .version-display {
            padding: 4px 12px;
            font-size: 10px;
            font-weight: 400;
            color: rgba(255, 255, 255, 0.4);
            user-select: none;
            opacity: 0.7;
            transition: opacity 0.2s ease;
        }
        
        .version-display:hover {
            opacity: 1;
        }
        
        .title-file-menu-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            background: linear-gradient(135deg, 
                var(--color-surface-secondary) 0%, 
                var(--color-surface-tertiary) 50%,
                rgba(71, 85, 105, 0.75) 100%);
            backdrop-filter: var(--glass-secondary);
            border: 1px solid var(--color-border-primary);
            border-radius: var(--radius-lg);
            padding: var(--spacing-sm) 0;
            min-width: 160px;
            z-index: 2000;
            display: none;
            box-shadow: 
                var(--shadow-lg),
                var(--shadow-glass);
            opacity: 0;
            transition: all var(--transition-normal);
            transform: translateY(-8px) scale(0.95);
            margin-top: var(--spacing-sm);
        }
        
        .title-file-menu-dropdown.show {
            display: block;
            opacity: 1;
            transform: translateY(0) scale(1);
            animation: fadeIn var(--transition-normal) var(--bounce);
        }
        
        .title-file-menu-dropdown-item {
            position: relative;
            padding: 8px 16px;
            font-size: 13px;
            color: rgba(255, 255, 255, 0.9);
            cursor: pointer;
            transition: background-color 0.2s ease;
        }
        
        .title-file-menu-dropdown-item:hover {
            background: rgba(255, 255, 255, 0.1);
        }
        
        .title-file-submenu {
            position: absolute;
            top: 0;
            left: 100%;
            margin-left: 2px;
            background: rgba(30, 41, 59, 0.95);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 6px;
            padding: 4px 0;
            min-width: 120px;
            z-index: 2001;
            backdrop-filter: blur(10px);
            display: none;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }
        
        .title-file-menu-dropdown-item:hover .title-file-submenu {
            display: block;
        }
        
        .title-file-submenu-item {
            padding: 6px 12px;
            font-size: 12px;
            color: rgba(255, 255, 255, 0.9);
            cursor: pointer;
            transition: background-color 0.2s ease;
        }
        
        .title-file-submenu-item:hover {
            background: rgba(255, 255, 255, 0.1);
        }
        
        /* Tileset Management Styles */
        .tileset-container {
            margin-bottom: var(--spacing-md);
            border: 1px solid var(--color-border-secondary);
            border-radius: var(--radius-md);
            background: linear-gradient(135deg, 
                var(--color-surface-elevated) 0%, 
                var(--color-surface-overlay) 100%);
            backdrop-filter: var(--glass-tertiary);
            transition: all var(--transition-normal);
            box-shadow: var(--shadow-sm);
        }
        
        .tileset-container.active {
            border-color: var(--color-focus-outline);
            box-shadow: 
                0 0 0 1px var(--color-brand-primary),
                var(--shadow-md);
            transform: scale(1.01);
        }
        
        .tileset-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: var(--spacing-sm) var(--spacing-md);
            border-bottom: 1px solid var(--color-border-secondary);
            cursor: pointer;
            transition: all var(--transition-fast);
        }
        
        .tileset-header:hover {
            background: var(--color-hover-surface);
        }
        
        .tileset-header-controls {
            display: flex;
            align-items: center;
            gap: var(--spacing-sm);
        }
        
        .tileset-zoom-controls {
            display: flex;
            gap: var(--spacing-xs);
            align-items: center;
        }
        
        .tileset-name {
            font-size: 12px;
            font-weight: 500;
            color: var(--color-text-secondary);
        }
        
        .tileset-header-buttons {
            display: flex;
            gap: var(--spacing-xs);
        }
        
        .tileset-btn {
            background: var(--color-hover-surface);
            border: none;
            color: var(--color-text-tertiary);
            width: 22px;
            height: 22px;
            border-radius: var(--radius-sm);
            cursor: pointer;
            font-size: 11px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all var(--transition-fast);
        }
        
        .tileset-btn:hover {
            background: var(--color-active-surface);
            color: var(--color-text-primary);
            transform: scale(1.1);
        }
        
        .tileset-content {
            padding: 8px;
            height: 300px;
            overflow: auto;
            background: rgba(0, 0, 0, 0.1);
            position: relative;
            resize: vertical;
            min-height: 100px;
            max-height: 800px;
        }
        
        .tileset-canvas {
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            cursor: pointer;
            display: block;
            image-rendering: pixelated;
        }
        
        .expand-btn {
            background: var(--color-brand-primary) !important;
            color: white !important;
            font-weight: 600 !important;
            min-width: 80px !important;
            font-size: 11px !important;
        }
        
        .expand-btn:hover {
            background: var(--color-brand-secondary) !important;
            transform: scale(1.05) !important;
        }
        
        .recent-tiles-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
            gap: var(--spacing-sm);
            padding: var(--spacing-sm) 0;
        }
        
        .recent-tile {
            width: 48px;
            height: 48px;
            border: 2px solid var(--color-border-secondary);
            border-radius: var(--radius-sm);
            overflow: hidden;
            cursor: pointer;
            transition: all var(--transition-normal);
            position: relative;
        }
        
        .recent-tile:hover {
            border-color: var(--color-focus-outline);
            transform: scale(1.08) rotate(2deg);
            box-shadow: var(--shadow-md);
            z-index: 10;
        }
        
        .recent-tile canvas {
            width: 100%;
            height: 100%;
            display: block;
        }
        
        .menu-item {
            position: relative;
            padding: 8px 16px;
            color: rgba(255, 255, 255, 0.9);
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            transition: all 0.2s ease;
            user-select: none;
        }
        
        .menu-item:hover {
            background: rgba(255, 255, 255, 0.1);
        }
        
        .menu-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            background: linear-gradient(135deg, 
                rgba(30, 41, 59, 0.85) 0%, 
                rgba(51, 65, 85, 0.8) 50%,
                rgba(71, 85, 105, 0.75) 100%);
            backdrop-filter: blur(16px) saturate(180%);
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: 12px;
            padding: 8px 0;
            min-width: 160px;
            z-index: 1000;
            display: none;
            box-shadow: 
                0 8px 32px rgba(0, 0, 0, 0.24),
                0 4px 16px rgba(0, 0, 0, 0.16),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
        }
        
        .menu-dropdown.show {
            display: block;
        }
        
        .menu-dropdown-item {
            padding: 8px 16px;
            font-size: 13px;
            color: rgba(255, 255, 255, 0.9);
            cursor: pointer;
            transition: background 0.2s ease;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .menu-dropdown-item:hover {
            background: rgba(255, 255, 255, 0.1);
        }
        
        .submenu {
            position: absolute;
            left: 100%;
            top: 0;
            background: rgba(30, 41, 59, 0.95);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 6px;
            padding: 4px 0;
            min-width: 120px;
            backdrop-filter: blur(10px);
            display: none;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }
        
        .menu-dropdown-item:hover .submenu {
            display: block;
        }
        
        .submenu-item {
            padding: 8px 16px;
            font-size: 13px;
            color: rgba(255, 255, 255, 0.9);
            cursor: pointer;
            transition: background 0.2s ease;
        }
        
        .submenu-item:hover {
            background: rgba(255, 255, 255, 0.1);
        }
        
        .layer-name {
            flex: 1;
            font-size: 12px;
            color: #fff;
        }
        
        .layer-name input {
            background: transparent;
            border: none;
            color: #fff;
            font-size: 12px;
            width: 100%;
        }
        
        .layer-name input:focus {
            outline: 1px solid #3b82f6;
            background: rgba(59, 130, 246, 0.1);
        }
        
        .layer-opacity {
            margin-top: 10px;
            padding-top: 8px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .layer-opacity label {
            font-size: 12px;
            color: rgba(255, 255, 255, 0.8);
            margin-bottom: 4px;
            display: block;
        }
        
        .layer-opacity input[type="range"] {
            width: 100%;
            height: 4px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 2px;
            outline: none;
        }
        
        .layer-opacity input[type="range"]::-webkit-slider-thumb {
            appearance: none;
            width: 16px;
            height: 16px;
            background: #3b82f6;
            border-radius: 50%;
            cursor: pointer;
        }
        
        .sidebar-header {
            background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
            padding: 12px 15px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px solid rgba(148, 163, 184, 0.2);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
        }
        
        .sidebar-title {
            font-size: 14px;
            font-weight: 600;
            color: #fff;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .sidebar-controls {
            display: flex;
            gap: 4px;
        }
        
        .sidebar-control {
            background: rgba(255, 255, 255, 0.1);
            border: none;
            color: rgba(255, 255, 255, 0.8);
            padding: 6px 8px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
            transition: all 0.2s ease;
        }
        
        .sidebar-control:hover {
            background: rgba(255, 255, 255, 0.2);
            color: #fff;
        }
        
        .sidebar-content {
            flex: 1;
            padding: 15px;
            overflow-y: auto;
        }
        
        
        .selected-tiles-info {
            position: absolute;
            bottom: 15px;
            left: 15px;
            background: rgba(0, 0, 0, 0.8);
            padding: 8px 12px;
            border-radius: 8px;
            font-size: 12px;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        
        .selection-overlay {
            position: absolute;
            border: 2px dashed #3b82f6;
            background: rgba(59, 130, 246, 0.2);
            pointer-events: none;
            z-index: 5;
        }
        
        .file-input {
            display: none;
        }
        
        .file-label {
            background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
            color: #fff;
            padding: 6px 12px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            height: 36px;
            justify-content: center;
        }
        
        .file-label:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
        }
        
        .shortcut-hint {
            font-size: 10px;
            color: rgba(255, 255, 255, 0.6);
            margin-left: 4px;
        }
        
        /* Animations */
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        
        /* Scrollbar styling */
        ::-webkit-scrollbar {
            width: 8px;
        }
        
        ::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
        }
        
        ::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.3);
            border-radius: 4px;
        }
        
        ::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.5);
        }
        
        /* No Tileset Popup */
        .popup-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            backdrop-filter: blur(4px);
        }
        
        .popup-content {
            background: var(--color-surface-elevated);
            border-radius: var(--radius-lg);
            padding: var(--spacing-xl);
            max-width: 400px;
            width: 90%;
            text-align: center;
            border: 1px solid var(--color-border-primary);
            box-shadow: var(--shadow-lg);
            position: relative;
            animation: popupFadeIn 0.3s ease-out;
        }
        
        .popup-close {
            position: absolute;
            top: var(--spacing-sm);
            right: var(--spacing-sm);
            background: none;
            border: none;
            font-size: 20px;
            color: var(--color-text-secondary);
            cursor: pointer;
            padding: var(--spacing-xs);
            border-radius: var(--radius-sm);
            transition: all var(--transition-normal);
        }
        
        .popup-close:hover {
            background: var(--color-surface-overlay);
            color: var(--color-text-primary);
        }
        
        .popup-icon {
            font-size: 48px;
            margin-bottom: var(--spacing-md);
        }
        
        .popup-content h3 {
            color: var(--color-text-primary);
            margin-bottom: var(--spacing-md);
            font-size: 20px;
            font-weight: 600;
        }
        
        .popup-content p {
            color: var(--color-text-secondary);
            margin-bottom: var(--spacing-lg);
            line-height: 1.5;
        }
        
        .popup-button {
            padding: var(--spacing-sm) var(--spacing-lg);
            border-radius: var(--radius-md);
            border: none;
            font-weight: 600;
            cursor: pointer;
            margin: 0 var(--spacing-xs);
            transition: all var(--transition-normal);
            font-size: 14px;
        }
        
        .popup-button.primary {
            background: var(--color-brand-primary);
            color: white;
        }
        
        .popup-button.primary:hover {
            background: var(--color-brand-secondary);
            transform: translateY(-1px);
        }
        
        .popup-button.secondary {
            background: var(--color-surface-overlay);
            color: var(--color-text-secondary);
            border: 1px solid var(--color-border-secondary);
        }
        
        .popup-button.secondary:hover {
            background: var(--color-surface-hover);
            color: var(--color-text-primary);
        }
        
        @keyframes popupFadeIn {
            from {
                opacity: 0;
                transform: scale(0.9) translateY(-20px);
            }
            to {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
        }
        
        /* Shape Tool Dropdown */
        .shape-dropdown {
            position: relative;
            display: inline-block;
        }
        
        .dropdown-btn {
            display: flex !important;
            align-items: center !important;
            gap: var(--spacing-xs) !important;
        }
        
        .dropdown-arrow {
            margin-left: auto;
            transition: transform var(--transition-normal);
        }
        
        .dropdown-btn.active .dropdown-arrow {
            transform: rotate(180deg);
        }
        
        .shape-dropdown-menu {
            position: fixed;
            background: var(--color-surface-primary);
            backdrop-filter: blur(8px);
            border: 1px solid var(--color-border-primary);
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-lg);
            z-index: 10001;
            min-width: 150px;
            opacity: 0;
            visibility: hidden;
            transform: translateY(-8px);
            transition: all var(--transition-normal);
            pointer-events: none;
        }
        
        .shape-dropdown-menu.show {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
            pointer-events: auto;
        }
        
        .dropdown-item {
            display: flex;
            align-items: center;
            gap: var(--spacing-sm);
            padding: var(--spacing-sm) var(--spacing-md);
            cursor: pointer;
            transition: background var(--transition-normal);
            font-size: 13px;
            color: var(--color-text-primary);
        }
        
        .dropdown-item:hover {
            background: var(--color-surface-hover);
        }
        
        .dropdown-item:first-child {
            border-top-left-radius: var(--radius-md);
            border-top-right-radius: var(--radius-md);
        }
        
        .dropdown-item:last-child {
            border-bottom-left-radius: var(--radius-md);
            border-bottom-right-radius: var(--radius-md);
        }
        
        .dropdown-item .shortcut-hint {
            margin-left: auto;
            font-size: 10px;
            color: var(--color-text-tertiary);
            background: var(--color-surface-overlay);
            padding: 2px 6px;
            border-radius: var(--radius-sm);
        }
        
        
        /* Ensure buttons have relative positioning for tooltip positioning */
        .tool-btn,
        .action-btn {
            position: relative;
        }
        
        /* Guided Tutorial Styles */
        .guided-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 15000;
            pointer-events: none;
        }
        
        .tutorial-backdrop {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: transparent;
        }
        
        .tutorial-tooltip {
            position: fixed !important;
            background: rgba(30, 41, 59, 0.95);
            border-radius: var(--radius-lg);
            padding: var(--spacing-lg);
            max-width: 320px;
            border: 1px solid var(--color-border-primary);
            box-shadow: var(--shadow-lg);
            pointer-events: auto;
            animation: tooltipFadeIn 0.3s ease-out;
            z-index: 999999 !important;
        }
        
        .tutorial-close {
            position: absolute;
            top: var(--spacing-sm);
            right: var(--spacing-sm);
            background: none;
            border: none;
            font-size: 18px;
            color: var(--color-text-secondary);
            cursor: pointer;
            padding: var(--spacing-xs);
            border-radius: var(--radius-sm);
            transition: all var(--transition-normal);
        }
        
        .tutorial-close:hover {
            background: var(--color-surface-overlay);
            color: var(--color-text-primary);
        }
        
        .tutorial-content h3 {
            color: var(--color-text-primary);
            margin-bottom: var(--spacing-sm);
            font-size: 18px;
            font-weight: 600;
        }
        
        .tutorial-content p {
            color: var(--color-text-secondary);
            margin-bottom: var(--spacing-md);
            line-height: 1.5;
            font-size: 14px;
        }
        
        .tutorial-progress {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin: var(--spacing-md) 0;
            padding-top: var(--spacing-sm);
            border-top: 1px solid var(--color-border-secondary);
        }
        
        .tutorial-dots {
            display: flex;
            gap: var(--spacing-xs);
        }
        
        .dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--color-surface-overlay);
            transition: background var(--transition-normal);
        }
        
        .dot.active {
            background: var(--color-brand-primary);
        }
        
        .tutorial-counter {
            font-size: 12px;
            color: var(--color-text-tertiary);
        }
        
        .tutorial-buttons {
            display: flex;
            gap: var(--spacing-sm);
            justify-content: space-between;
            margin-top: var(--spacing-md);
        }
        
        .tutorial-btn {
            padding: var(--spacing-sm) var(--spacing-md);
            border-radius: var(--radius-md);
            border: none;
            font-weight: 600;
            cursor: pointer;
            transition: all var(--transition-normal);
            font-size: 13px;
        }
        
        .tutorial-btn.primary {
            background: var(--color-brand-primary);
            color: white;
        }
        
        .tutorial-btn.primary:hover {
            background: var(--color-brand-secondary);
            transform: translateY(-1px);
        }
        
        .tutorial-btn.secondary {
            background: var(--color-surface-overlay);
            color: var(--color-text-secondary);
            border: 1px solid var(--color-border-secondary);
        }
        
        .tutorial-btn.secondary:hover {
            background: var(--color-surface-hover);
            color: var(--color-text-primary);
        }
        
        .tutorial-arrow {
            position: absolute;
            width: 0;
            height: 0;
            border-style: solid;
            z-index: 15003;
        }
        
        .tutorial-arrow.top {
            border-left: 8px solid transparent;
            border-right: 8px solid transparent;
            border-bottom: 8px solid rgba(30, 41, 59, 0.95);
            top: -8px;
            left: 50%;
            transform: translateX(-50%);
        }
        
        .tutorial-arrow.bottom {
            border-left: 8px solid transparent;
            border-right: 8px solid transparent;
            border-top: 8px solid rgba(30, 41, 59, 0.95);
            bottom: -8px;
            left: 50%;
            transform: translateX(-50%);
        }
        
        .tutorial-arrow.left {
            border-top: 8px solid transparent;
            border-bottom: 8px solid transparent;
            border-right: 8px solid rgba(30, 41, 59, 0.95);
            left: -8px;
            top: 50%;
            transform: translateY(-50%);
        }
        
        .tutorial-arrow.right {
            border-top: 8px solid transparent;
            border-bottom: 8px solid transparent;
            border-left: 8px solid rgba(30, 41, 59, 0.95);
            right: -8px;
            top: 50%;
            transform: translateY(-50%);
        }
        
        .tutorial-highlight {
            position: fixed;
            background: transparent;
            border: 3px solid var(--color-brand-primary);
            border-radius: var(--radius-md);
            z-index: 15001;
            pointer-events: none;
            animation: highlightPulse 2s infinite;
            box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
        }
        
        @keyframes tooltipFadeIn {
            from {
                opacity: 0;
                transform: scale(0.9);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }
        
        @keyframes highlightPulse {
            0%, 100% { 
                box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
            }
            50% { 
                box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.1);
            }
        }

/* Tileset Import Dialog */
.popup-content.large {
    max-width: 600px;
    width: 90vw;
}

.tileset-preview-container {
    position: relative;
    margin: 20px 0;
    border: 2px solid #404040;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    max-height: 300px;
    overflow: auto;
}

.tileset-preview {
    display: block;
    max-width: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.tileset-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.tile-size-selection {
    margin: 20px 0;
}

.preset-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.size-preset {
    background: #404040;
    color: #ffffff;
    border: 2px solid #606060;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 60px;
}

.size-preset:hover {
    background: #4a4a4a;
    border-color: #707070;
}

.size-preset.active {
    background: #0078d4;
    border-color: #106ebe;
    color: #ffffff;
}

.custom-size {
    text-align: center;
    margin-bottom: 16px;
}

.custom-size label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #cccccc;
}

.custom-size input[type="number"] {
    width: 60px;
    padding: 4px 8px;
    background: #333333;
    color: #ffffff;
    border: 1px solid #606060;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.custom-size input[type="number"]:focus {
    outline: 2px solid #0078d4;
    outline-offset: 2px;
    border-color: #0078d4;
}

.size-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #333333;
    border-radius: 6px;
    font-size: 13px;
    color: #cccccc;
}

.tileset-name {
    margin: 20px 0;
}

.tileset-name label {
    display: block;
    font-size: 14px;
    color: #cccccc;
    margin-bottom: 6px;
}

.tileset-name input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    background: #333333;
    color: #ffffff;
    border: 1px solid #606060;
    border-radius: 4px;
    font-size: 14px;
}

.tileset-name input[type="text"]:focus {
    outline: 2px solid #0078d4;
    outline-offset: 2px;
    border-color: #0078d4;
}

.popup-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.popup-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
}

.popup-button.primary {
    background: #0078d4;
    color: #ffffff;
}

.popup-button.primary:hover {
    background: #106ebe;
}

.popup-button.secondary {
    background: #404040;
    color: #ffffff;
    border: 1px solid #606060;
}

.popup-button.secondary:hover {
    background: #4a4a4a;
}
        

/* Contact Button - Subtle shine effect */
.contact-button {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 4px;
    padding: 0 8px !important;
    margin: 0 4px;
    transition: all 0.2s;
}

.contact-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transform: rotate(45deg);
    animation: shine 4s ease-in-out infinite;
}

@keyframes shine {
    0%, 100% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

.contact-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.contact-button span {
    position: relative;
    z-index: 1;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Contact Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 35px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8),
                0 0 0 1px rgba(59, 130, 246, 0.1);
    position: relative;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    color: #3b82f6;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 22px;
    font-size: 32px;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: #f3f4f6;
    transform: rotate(90deg);
}

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

.form-label {
    display: block;
    color: #cbd5e1;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 14px;
    background: #1e293b;
    border: 1.5px solid #334155;
    border-radius: 6px;
    color: #f3f4f6;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background: #0f172a;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #475569;
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 25px;
}

.btn-cancel,
.btn-submit {
    padding: 11px 22px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.btn-cancel {
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
}

.btn-cancel:hover {
    background: #475569;
    transform: translateY(-1px);
}

.btn-submit {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-submit:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.btn-submit:active,
.btn-cancel:active {
    transform: translateY(0);
}

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

.form-status {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    display: none;
    font-size: 14px;
    font-weight: 500;
}
