        /* ============================================
           DARK THEME - Sith / Dark Side
           ============================================ */

        @keyframes starfield {
            0% { transform: translateY(0); }
            100% { transform: translateY(-100%); }
        }
        @keyframes pulseGlow {
            0%, 100% { opacity: 0.6; }
            50% { opacity: 1; }
        }
        @keyframes sithPulse {
            0%, 100% { opacity: 0.3; }
            50% { opacity: 0.6; }
        }
        @keyframes redScan {
            0% { transform: translateX(-100%); }
            100% { transform: translateX(100%); }
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }
        @keyframes shimmer {
            0% { background-position: -200% 0; }
            100% { background-position: 200% 0; }
        }
        @keyframes emberFloat {
            0% { transform: translateY(0) scale(1); opacity: 0.6; }
            50% { transform: translateY(-20px) scale(1.2); opacity: 0.3; }
            100% { transform: translateY(-40px) scale(0.8); opacity: 0; }
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }
        html { scroll-behavior: smooth; }
        body {
            background: #06070b;
            color: #c9cdd5;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
            font-size: 14px;
            line-height: 1.6;
            position: relative;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
        }

        /* Global Scrollbars */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
        ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }
        * { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }

        /* Selection highlight */
        ::selection { background: rgba(239,68,68,0.25); color: #fff; }
        ::-moz-selection { background: rgba(239,68,68,0.25); color: #fff; }

        /* Animated starfield + red nebula */
        body::before {
            content: '';
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: -1;
            background:
                radial-gradient(ellipse at 20% 50%, rgba(180,30,30,0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 30%, rgba(120,20,20,0.04) 0%, transparent 40%),
                radial-gradient(1.2px 1.2px at 20% 30%, rgba(255,180,180,0.1) 50%, transparent 100%),
                radial-gradient(0.8px 0.8px at 40% 70%, rgba(255,255,255,0.06) 50%, transparent 100%),
                radial-gradient(1.2px 1.2px at 60% 20%, rgba(255,200,200,0.07) 50%, transparent 100%),
                radial-gradient(0.8px 0.8px at 80% 50%, rgba(255,255,255,0.08) 50%, transparent 100%),
                radial-gradient(0.8px 0.8px at 10% 80%, rgba(255,255,255,0.05) 50%, transparent 100%),
                radial-gradient(1.2px 1.2px at 70% 90%, rgba(255,150,150,0.06) 50%, transparent 100%),
                radial-gradient(0.8px 0.8px at 30% 50%, rgba(255,255,255,0.06) 50%, transparent 100%),
                radial-gradient(0.8px 0.8px at 90% 10%, rgba(255,255,255,0.05) 50%, transparent 100%);
            background-size: 100% 100%, 100% 100%, 300px 300px, 300px 300px, 300px 300px, 300px 300px, 300px 300px, 300px 300px, 300px 300px, 300px 300px;
            animation: starfield 180s linear infinite;
        }

        /* Dark vignette — Sith temple feel */
        body::after {
            content: '';
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: -1;
            background: radial-gradient(ellipse at center, transparent 30%, rgba(5,5,7,0.85) 100%);
            pointer-events: none;
        }

        /* ---- HEADER / NAVIGATION ---- */
        .header {
            background: rgba(8,8,14,0.82);
            backdrop-filter: blur(24px) saturate(1.5);
            -webkit-backdrop-filter: blur(24px) saturate(1.5);
            border-bottom: 1px solid rgba(200,30,30,0.1);
            padding: 0 28px;
            display: flex;
            align-items: center;
            gap: 24px;
            position: sticky;
            top: 0;
            z-index: 100;
            height: 54px;
            box-shadow: 0 4px 40px rgba(0,0,0,0.5), inset 0 -1px 0 rgba(255,255,255,0.02);
        }
        .header::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 1px;
            background: linear-gradient(90deg, transparent 10%, rgba(220,40,40,0.3) 35%, rgba(255,60,60,0.5) 50%, rgba(220,40,40,0.3) 65%, transparent 90%);
        }
        .header-title {
            font-family: 'Orbitron', 'Inter', sans-serif;
            font-size: 16px;
            font-weight: 800;
            color: #f0f0f0;
            letter-spacing: 3px;
            text-transform: uppercase;
            white-space: nowrap;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .header-title .cantina { color: #ff4040; text-shadow: 0 0 24px rgba(255,50,50,0.45), 0 0 48px rgba(255,30,30,0.15); }
        .header-title .cards { color: #6b7080; font-weight: 700; letter-spacing: 4px; }
        .header-tabs { display: flex; gap: 1px; flex: 1; }
        .tab-btn {
            background: none;
            border: none;
            color: #50556a;
            cursor: pointer;
            padding: 18px 16px;
            border-bottom: 2px solid transparent;
            transition: color 0.2s ease;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 1.2px;
            text-transform: uppercase;
            position: relative;
        }
        .tab-btn.active {
            color: #f0f0f2;
        }
        .tab-btn:hover { color: #a0a6b4; }
        .tab-btn.active::after {
            content: '';
            position: absolute;
            bottom: -1px;
            left: 15%;
            right: 15%;
            height: 2px;
            background: #ef4444;
            box-shadow: 0 0 10px rgba(239,68,68,0.5), 0 0 20px rgba(239,68,68,0.15);
            border-radius: 1px;
        }
        .header-controls { display: flex; gap: 8px; align-items: center; }
        .lang-toggle {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.07);
            color: #6b7486;
            padding: 5px 12px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.15s ease;
            font-weight: 600;
            font-size: 11px;
            letter-spacing: 0.5px;
        }
        .lang-toggle:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); color: #c9cdd5; }

        /* ---- CONTAINERS ---- */
        .container { display: none; height: calc(100vh - 54px); overflow: visible; }
        .container.active { display: flex; flex-direction: column; animation: fadeIn 0.2s ease-out; }
        #deckbuilderContainer.active { overflow: hidden; }

        /* ---- FORM ELEMENTS ---- */
        input[type="text"], input[type="number"], select {
            background: rgba(12,13,22,0.85);
            border: 1px solid rgba(255,255,255,0.07);
            color: #d1d5db;
            padding: 9px 14px;
            border-radius: 8px;
            font-size: 13px;
            font-family: inherit;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
            height: 38px;
            box-sizing: border-box;
        }
        input[type="text"]:focus, input[type="number"]:focus, select:focus {
            outline: none;
            border-color: rgba(239,68,68,0.45);
            box-shadow: 0 0 0 3px rgba(239,68,68,0.08);
            background: rgba(14,15,24,0.95);
        }
        input::placeholder { color: #3d4255; }
        button {
            background: linear-gradient(135deg, #dc2626, #b91c1c);
            border: none;
            color: white;
            padding: 9px 18px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 600;
            font-family: inherit;
            transition: all 0.2s ease;
            letter-spacing: 0.5px;
            text-transform: uppercase;
        }
        button:hover { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 4px 20px rgba(239,68,68,0.2); transform: translateY(-1px); }
        button:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(239,68,68,0.15); }
        button.secondary { background: rgba(255,255,255,0.03); color: #8892a4; border: 1px solid rgba(255,255,255,0.07); text-transform: none; letter-spacing: 0; }
        button.secondary:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); color: #d1d5db; box-shadow: none; transform: none; }
        button.danger { background: linear-gradient(135deg, #dc2626, #991b1b); }
        button.danger:hover { background: linear-gradient(135deg, #ef4444, #b91c1c); }

        .progress-bar { width: 100%; height: 2px; background: rgba(255,255,255,0.03); overflow: hidden; }
        .progress-fill { height: 100%; background: linear-gradient(90deg, #ef4444, #f97316, #ef4444); background-size: 200% 100%; width: 0%; transition: width 0.4s ease; box-shadow: 0 0 8px rgba(239,68,68,0.3); animation: shimmer 2s linear infinite; }

        .content { flex: 1; overflow-y: auto; padding: 16px; }

        /* ---- FILTER BAR ---- */
        .filter-bar { padding: 12px 16px; background: rgba(10,11,18,0.65); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); border-bottom: 1px solid rgba(255,255,255,0.04); position: relative; z-index: 50; overflow: visible; }
        .filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
        .filter-row select, .filter-row button.secondary { height: 38px; box-sizing: border-box; font-size: 14px; }
        .filter-row:last-child { margin-bottom: 0; }

        /* Aspect filter buttons */
        .aspect-filters { display: flex; gap: 6px; align-items: center; }
        .aspect-btn { width: 36px; height: 36px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; transition: all 0.3s; opacity: 0.4; display: flex; align-items: center; justify-content: center; padding: 3px; }
        .aspect-btn.active { opacity: 1; border-color: rgba(255,255,255,0.7); box-shadow: 0 0 12px rgba(255,255,255,0.3), 0 0 4px rgba(239,68,68,0.3); transform: scale(1.1); }
        .aspect-btn:hover { opacity: 0.8; transform: scale(1.05); }
        .aspect-btn svg { width: 100%; height: 100%; }

        /* Arena toggle buttons */
        .arena-toggles { display: flex; gap: 0; border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,0.06); }
        .arena-btn { background: rgba(14,15,24,0.6); color: #50556a; border: none; padding: 6px 14px; cursor: pointer; font-size: 11px; font-weight: 600; transition: all 0.15s ease; text-transform: uppercase; letter-spacing: 0.6px; }
        .arena-btn.active { background: #ef4444; color: white; box-shadow: 0 2px 10px rgba(239,68,68,0.2); }
        .arena-btn:hover:not(.active) { background: rgba(255,255,255,0.04); color: #a0a6b4; }

        /* ---- CUSTOM FILTER DROPDOWNS (my-swu style) ---- */
        .custom-dropdown {
            position: relative;
            display: inline-block;
            min-width: 140px;
        }
        .custom-dropdown-trigger {
            background: rgba(12,13,22,0.85);
            border: 1px solid rgba(255,255,255,0.07);
            color: #c9cdd5;
            padding: 9px 32px 9px 14px;
            border-radius: 8px;
            font-size: 13px;
            font-family: inherit;
            cursor: pointer;
            transition: border-color 0.15s ease, box-shadow 0.15s ease;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            display: flex;
            align-items: center;
            gap: 6px;
            position: relative;
            user-select: none;
            height: 38px;
            box-sizing: border-box;
        }
        .custom-dropdown-trigger::after {
            content: '';
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            border: 4px solid transparent;
            border-top: 5px solid #7c8496;
            transition: transform 0.2s ease;
        }
        .custom-dropdown.open .custom-dropdown-trigger::after {
            transform: translateY(-50%) rotate(180deg);
        }
        .custom-dropdown-trigger:hover { border-color: rgba(255,255,255,0.18); background: rgba(18,19,28,0.95); }
        .custom-dropdown.open .custom-dropdown-trigger { border-color: rgba(239,68,68,0.5); box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }
        .custom-dropdown-trigger .dd-icon { flex-shrink: 0; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
        .custom-dropdown-trigger .dd-code { color: #d4a017; font-weight: 700; font-size: 11px; letter-spacing: 0.5px; flex-shrink: 0; }
        .custom-dropdown-trigger .dd-label { overflow: hidden; text-overflow: ellipsis; }

        .custom-dropdown-panel {
            display: none;
            position: absolute;
            top: calc(100% + 4px);
            left: 0;
            min-width: 100%;
            width: max-content;
            max-width: 340px;
            max-height: 380px;
            overflow-y: auto;
            background: rgba(12,13,22,0.96);
            backdrop-filter: blur(24px) saturate(1.3);
            -webkit-backdrop-filter: blur(24px) saturate(1.3);
            border: 1px solid rgba(255,255,255,0.07);
            border-radius: 12px;
            padding: 6px;
            z-index: 300;
            box-shadow: 0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.02);
            animation: fadeIn 0.1s ease-out;
        }
        .custom-dropdown.open .custom-dropdown-panel { display: block; }
        .custom-dropdown-search {
            width: calc(100% - 12px);
            margin: 4px 6px 6px;
            padding: 8px 12px;
            background: rgba(255,255,255,0.04);
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 8px;
            color: #d1d5db;
            font-size: 13px;
            outline: none;
        }
        .custom-dropdown-search:focus { border-color: rgba(239,68,68,0.4); }
        .custom-dropdown-search::placeholder { color: #555a6b; }

        .custom-dropdown-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 9px 12px;
            border-radius: 8px;
            cursor: pointer;
            color: #c9cdd5;
            font-size: 13px;
            font-weight: 500;
            transition: background 0.12s ease;
            white-space: nowrap;
        }
        .custom-dropdown-item:hover { background: rgba(255,255,255,0.06); }
        .custom-dropdown-item.selected { background: rgba(239,68,68,0.08); color: #f0f0f0; }
        .custom-dropdown-item.selected::after {
            content: '\2713';
            margin-left: auto;
            color: #ef4444;
            font-weight: bold;
            font-size: 14px;
        }
        .custom-dropdown-item .dd-code {
            color: #d4a017;
            font-weight: 700;
            font-size: 12px;
            letter-spacing: 0.5px;
            min-width: 32px;
        }
        .custom-dropdown-item .dd-icon {
            flex-shrink: 0;
            width: 22px;
            height: 22px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .custom-dropdown-item .dd-icon svg { width: 20px; height: 20px; }

        /* Rarity icon colors */
        .rarity-icon-common { color: #8b7e6a; }
        .rarity-icon-uncommon { color: #4caf50; }
        .rarity-icon-rare { color: #e8a735; }
        .rarity-icon-legendary { color: #e8a735; }
        .rarity-icon-special { color: #5b8dd9; }

        /* Light theme overrides for custom dropdowns */
        body.light-theme .custom-dropdown-trigger { background: #f4f6f9; border-color: #c0c8d8; color: #2c3448; }
        body.light-theme .custom-dropdown-trigger:hover { border-color: #8a9ab8; background: #fff; }
        body.light-theme .custom-dropdown.open .custom-dropdown-trigger { border-color: rgba(61,90,138,0.5); box-shadow: 0 0 0 3px rgba(61,90,138,0.1); }
        body.light-theme .custom-dropdown-trigger::after { border-top-color: #8a9ab8; }
        body.light-theme .custom-dropdown-trigger .dd-code { color: #a07c18; }
        body.light-theme .custom-dropdown-panel { background: rgba(248,250,252,0.98); border-color: #c0c8d8; box-shadow: 0 16px 48px rgba(0,0,0,0.15); }
        body.light-theme .custom-dropdown-search { background: rgba(0,0,0,0.03); border-color: #c0c8d8; color: #2c3448; }
        body.light-theme .custom-dropdown-search::placeholder { color: #8a9ab8; }
        body.light-theme .custom-dropdown-item { color: #2c3448; }
        body.light-theme .custom-dropdown-item:hover { background: rgba(0,0,0,0.04); }
        body.light-theme .custom-dropdown-item.selected { background: rgba(61,90,138,0.08); color: #1a1e2e; }
        body.light-theme .custom-dropdown-item.selected::after { color: #3d5a8a; }
        body.light-theme .custom-dropdown-item .dd-code { color: #a07c18; }

        /* Custom dropdown scrollbar */
        .custom-dropdown-panel::-webkit-scrollbar { width: 6px; }
        .custom-dropdown-panel::-webkit-scrollbar-track { background: transparent; }
        .custom-dropdown-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
        body.light-theme .custom-dropdown-panel::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }

        /* ---- CARD GRID ---- */
        .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
        .card-tile {
            background: rgba(14,15,24,0.7);
            border: 1px solid rgba(255,255,255,0.05);
            border-radius: 10px;
            overflow: hidden;
            cursor: pointer;
            transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
            position: relative;
        }
        .card-tile:hover {
            border-color: rgba(255,200,50,0.5);
            box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,200,50,0.3), 0 0 30px rgba(255,180,40,0.08);
            transform: translateY(-6px) scale(1.015);
        }
        .card-tile.in-collection {
            border-color: rgba(16,185,129,0.2);
        }
        .card-tile.in-collection::after {
            content: "\2713";
            position: absolute;
            top: 6px;
            right: 6px;
            background: linear-gradient(135deg, #10b981, #059669);
            color: white;
            width: 20px;
            height: 20px;
            border-radius: 5px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 11px;
            box-shadow: 0 2px 8px rgba(16,185,129,0.3);
            z-index: 2;
        }
        .card-image { width: 100%; aspect-ratio: 63/88; object-fit: contain; background: #08090d; border-radius: 9px 9px 0 0; }
        .card-info { padding: 10px 11px; font-size: 12px; }
        .card-name { font-weight: 600; color: #e5e7eb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
        .card-rarity { color: #6b7486; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; margin-top: 1px; }
        .card-set { color: #454d5f; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .card-qty-badge {
            position: absolute;
            top: 6px;
            left: 6px;
            background: linear-gradient(135deg, #ef4444, #dc2626);
            color: white;
            min-width: 24px;
            height: 24px;
            border-radius: 7px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 11px;
            padding: 0 6px;
            box-shadow: 0 2px 10px rgba(239,68,68,0.35);
        }

        .rarity-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
        .rarity-common { background: #555a6b; }
        .rarity-uncommon { background: #10b981; }
        .rarity-rare { background: #3b82f6; }
        .rarity-legendary { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.4); }
        .rarity-special { background: #a855f7; box-shadow: 0 0 6px rgba(168,85,247,0.4); }

        .pagination { display: flex; justify-content: center; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
        .page-btn { padding: 6px 10px; min-width: 34px; text-transform: none; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); background: rgba(14,15,24,0.5); color: #6b7486; font-size: 12px; transition: all 0.15s ease; }
        .page-btn:hover { border-color: rgba(239,68,68,0.25); color: #d1d5db; background: rgba(239,68,68,0.06); box-shadow: none; transform: none; }
        .page-btn.active { background: #ef4444; color: white; border-color: transparent; box-shadow: 0 2px 12px rgba(239,68,68,0.25); font-weight: 600; }

        /* ---- SORT / VIEW TOOLBAR ---- */
        .browse-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 8px 0;
            margin-bottom: 8px;
        }
        .browse-toolbar-left { display: flex; align-items: center; gap: 8px; }
        .browse-toolbar-right { display: flex; align-items: center; gap: 6px; }
        .browse-result-count { font-size: 13px; color: #7c8496; font-weight: 500; }
        .toolbar-btn {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.06);
            color: #8892a4;
            padding: 7px 12px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.15s ease;
            text-transform: none;
            letter-spacing: 0;
            position: relative;
        }
        .toolbar-btn:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); color: #d1d5db; box-shadow: none; transform: none; }
        .toolbar-btn svg { width: 15px; height: 15px; fill: currentColor; }
        .toolbar-btn.active { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.2); color: #ef4444; }

        /* Sort/View Dropdown Popups */
        .toolbar-popup {
            display: none;
            position: absolute;
            top: calc(100% + 6px);
            right: 0;
            background: rgba(12,13,22,0.95);
            backdrop-filter: blur(24px) saturate(1.3);
            -webkit-backdrop-filter: blur(24px) saturate(1.3);
            border: 1px solid rgba(255,255,255,0.07);
            border-radius: 12px;
            padding: 8px;
            min-width: 220px;
            z-index: 200;
            box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.02);
            animation: fadeIn 0.12s ease-out;
        }
        .toolbar-popup.open { display: block; }
        .toolbar-popup-title {
            font-size: 11px;
            font-weight: 700;
            color: #5c6370;
            letter-spacing: 0.8px;
            text-transform: uppercase;
            padding: 6px 10px 4px;
        }
        .toolbar-popup-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 10px;
            border-radius: 8px;
            cursor: pointer;
            color: #c9cdd5;
            font-size: 13px;
            transition: all 0.15s ease;
            border: none;
            background: none;
            width: 100%;
            text-align: left;
            font-weight: 500;
        }
        .toolbar-popup-item:hover { background: rgba(255,255,255,0.06); color: #f0f0f0; transform: none; box-shadow: none; }
        .toolbar-popup-item.active { color: #ef4444; background: rgba(239,68,68,0.08); }
        .toolbar-popup-item svg { width: 16px; height: 16px; opacity: 0.6; fill: currentColor; }
        .toolbar-popup-item.active svg { opacity: 1; }
        .toolbar-popup-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 0; }

        /* View Mode Section inside popup */
        .view-mode-group { display: flex; gap: 4px; padding: 4px 10px 8px; }
        .view-mode-btn {
            flex: 1;
            padding: 8px 6px;
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.08);
            background: rgba(255,255,255,0.02);
            color: #7c8496;
            cursor: pointer;
            font-size: 11px;
            font-weight: 600;
            text-align: center;
            transition: all 0.2s ease;
            text-transform: none;
        }
        .view-mode-btn:hover { background: rgba(255,255,255,0.06); color: #c9cdd5; transform: none; box-shadow: none; }
        .view-mode-btn.active { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: #ef4444; }

        /* Grid density button styles */
        .grid-density-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 10px !important; }
        .grid-density-btn svg { flex-shrink: 0; }
        .grid-density-btn span { font-size: 10px; font-weight: 700; }

        /* Grid density overrides */
        .card-grid.density-5 { grid-template-columns: repeat(5, 1fr); }
        .card-grid.density-6 { grid-template-columns: repeat(6, 1fr); }
        .card-grid.density-7 { grid-template-columns: repeat(7, 1fr); }

        /* Compact card view (list-like) */
        .card-grid.compact-view { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
        .card-grid.compact-view .card-tile { border-radius: 6px; }
        .card-grid.compact-view .card-info { display: none; }

        /* List view */
        .card-grid.list-view { display: flex; flex-direction: column; gap: 4px; }
        .card-grid.list-view .card-tile {
            display: flex;
            flex-direction: row;
            align-items: center;
            border-radius: 8px;
            padding: 6px 12px;
            gap: 12px;
        }
        .card-grid.list-view .card-tile .card-image { width: 44px; height: 62px; aspect-ratio: auto; border-radius: 4px; flex-shrink: 0; }
        .card-grid.list-view .card-tile .card-info { display: flex; flex-direction: row; align-items: center; gap: 16px; padding: 0; flex: 1; }
        .card-grid.list-view .card-tile .card-name { white-space: nowrap; min-width: 180px; }
        .card-grid.list-view .card-tile .card-rarity { min-width: 100px; }
        .card-grid.list-view .card-tile .card-set { min-width: 140px; }

        /* Table view */
        .card-table { width: 100%; border-collapse: separate; border-spacing: 0; }
        .card-table th {
            background: rgba(16,17,26,0.8);
            color: #7c8496;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            padding: 10px 14px;
            text-align: left;
            border-bottom: 1px solid rgba(255,255,255,0.06);
            position: sticky;
            top: 0;
            z-index: 5;
            cursor: pointer;
        }
        .card-table th:hover { color: #c9cdd5; }
        .card-table td {
            padding: 8px 14px;
            font-size: 13px;
            color: #c9cdd5;
            border-bottom: 1px solid rgba(255,255,255,0.03);
        }
        .card-table tr { cursor: pointer; transition: background 0.15s ease; }
        .card-table tr:hover { background: rgba(255,255,255,0.03); }
        .card-table .table-card-img { width: 32px; height: 44px; border-radius: 3px; object-fit: cover; vertical-align: middle; }

        /* Login/Register header buttons */
        .header-auth-buttons { display: flex; gap: 8px; align-items: center; }
        .auth-header-btn {
            padding: 7px 16px;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.25s ease;
            text-transform: none;
            letter-spacing: 0.3px;
            white-space: nowrap;
        }
        .auth-header-btn.login-btn {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.1);
            color: #a0a6b4;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .auth-header-btn.login-btn:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.18); color: #e5e7eb; box-shadow: none; transform: none; }
        .auth-header-btn.login-btn svg { width: 13px; height: 13px; fill: currentColor; }
        .auth-header-btn.register-btn {
            background: #ef4444;
            border: none;
            color: #fff;
            font-weight: 700;
        }
        .auth-header-btn.register-btn:hover { background: #f85454; box-shadow: 0 4px 16px rgba(239,68,68,0.25); transform: translateY(-1px); }

        /* Light theme overrides for toolbar/sort/view */
        body.light-theme .toolbar-btn { background: rgba(0,0,0,0.03); border-color: #c0c8d8; color: #5a6580; }
        body.light-theme .toolbar-btn:hover { background: rgba(0,0,0,0.06); color: #2c3448; }
        body.light-theme .toolbar-btn.active { background: rgba(61,90,138,0.1); border-color: rgba(61,90,138,0.3); color: #3d5a8a; }
        body.light-theme .toolbar-popup { background: rgba(244,246,249,0.98); border-color: #c0c8d8; box-shadow: 0 12px 40px rgba(0,0,0,0.15); }
        body.light-theme .toolbar-popup-title { color: #8a9ab8; }
        body.light-theme .toolbar-popup-item { color: #2c3448; }
        body.light-theme .toolbar-popup-item:hover { background: rgba(0,0,0,0.04); }
        body.light-theme .toolbar-popup-item.active { color: #3d5a8a; background: rgba(61,90,138,0.08); }
        body.light-theme .toolbar-popup-divider { background: rgba(0,0,0,0.06); }
        body.light-theme .view-mode-btn { border-color: #c0c8d8; color: #5a6580; background: rgba(255,255,255,0.5); }
        body.light-theme .view-mode-btn.active { background: rgba(61,90,138,0.12); border-color: rgba(61,90,138,0.3); color: #3d5a8a; }
        body.light-theme .card-table th { background: rgba(244,246,249,0.95); color: #5a6580; border-bottom-color: #c0c8d8; }
        body.light-theme .card-table td { color: #2c3448; border-bottom-color: rgba(0,0,0,0.04); }
        body.light-theme .card-table tr:hover { background: rgba(0,0,0,0.02); }
        body.light-theme .auth-header-btn.login-btn { border-color: rgba(255,255,255,0.25); color: #c0d0e8; }
        body.light-theme .auth-header-btn.login-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
        body.light-theme .auth-header-btn.register-btn { background: linear-gradient(135deg, #d4a017, #b8860b); color: #1a1200; }
        body.light-theme .browse-result-count { color: #5a6580; }

        /* ---- SET OVERVIEW ---- */
        .set-overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
        .set-card {
            background: rgba(14,15,24,0.5);
            border: 1px solid rgba(255,255,255,0.05);
            border-radius: 12px;
            overflow: hidden;
            cursor: pointer;
            transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
            padding: 18px;
            text-align: center;
        }
        .set-card:hover { border-color: rgba(239,68,68,0.25); box-shadow: 0 12px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(239,68,68,0.08); transform: translateY(-3px); }
        .set-name { font-size: 14px; font-weight: 700; color: #e5e7eb; margin-bottom: 8px; letter-spacing: 0.2px; }
        .set-progress { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
        .set-progress-bar { flex: 1; height: 3px; background: rgba(255,255,255,0.04); border-radius: 2px; overflow: hidden; }
        .set-progress-fill { height: 100%; background: linear-gradient(90deg, #ef4444, #f97316); border-radius: 2px; }
        .set-progress-text { font-size: 11px; color: #6b7486; min-width: 60px; text-align: right; }
        .set-count { color: #ef4444; font-weight: 700; font-size: 14px; }
        .set-mini-cards { display: flex; gap: 3px; justify-content: center; margin-top: 10px; flex-wrap: wrap; max-height: 50px; overflow: hidden; }
        .set-mini-card { width: 16px; height: 22px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.06); }
        .set-mini-card.owned { border-color: #10b981; opacity: 1; box-shadow: 0 0 3px rgba(16,185,129,0.3); }
        .set-mini-card.not-owned { opacity: 0.15; }

        /* ---- MODAL ---- */
        .modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.65); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); }
        .modal.active { display: flex; animation: fadeIn 0.2s ease-out; }
        .modal-content {
            background: rgba(14,15,24,0.94);
            backdrop-filter: blur(24px);
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 16px;
            padding: 28px;
            max-width: 700px;
            width: 90%;
            max-height: 85vh;
            overflow-y: auto;
            position: relative;
            box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.03);
            animation: fadeIn 0.25s ease-out;
        }
        .modal-close { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); color: #555a6b; cursor: pointer; font-size: 18px; padding: 0; width: 28px; height: 28px; text-transform: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
        .modal-close:hover { color: #ef4444; background: rgba(239,68,68,0.06); border-color: rgba(239,68,68,0.15); box-shadow: none; transform: none; }

        /* Variant picker modal */
        .variant-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
        .variant-picker-image { width: 100%; aspect-ratio: 63/88; object-fit: contain; background: #08090d; border-radius: 4px; }
        .variant-picker-right { display: flex; flex-direction: column; gap: 12px; }
        .variant-picker-title { font-size: 18px; font-weight: 700; color: #e5e7eb; }
        .variant-picker-subtitle { font-size: 14px; color: #8892a4; }
        .variant-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
        .variant-item { background: rgba(16,17,26,0.4); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 10px 14px; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; justify-content: space-between; align-items: center; }
        .variant-item:hover { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.05); }
        .variant-item.selected { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.06); }
        .variant-item-name { font-weight: 500; color: #e5e7eb; }
        .variant-item-set { font-size: 12px; color: #8892a4; }
        .variant-item-badge { background: #10b981; color: white; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: bold; }

        /* Card detail info */
        .card-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
        .card-detail-image { grid-column: 1; width: 100%; aspect-ratio: 63/88; object-fit: contain; background: #08090d; border-radius: 4px; }
        .card-detail-info { grid-column: 2; display: flex; flex-direction: column; gap: 12px; }
        .detail-row { display: flex; flex-direction: column; gap: 4px; }
        .detail-label { color: #555a6b; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
        .detail-value { color: #d1d5db; font-weight: 500; }

        /* ---- DECK LAYOUT ---- */
        .deck-layout { display: flex; height: 100%; gap: 0; }
        .deck-sidebar { width: 250px; background: rgba(10,11,18,0.6); border-right: 1px solid rgba(255,255,255,0.04); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
        .deck-list { flex: 1; overflow-y: auto; border-top: 1px solid rgba(255,255,255,0.04); padding-top: 12px; }
        .deck-item { background: rgba(14,15,24,0.4); border: 1px solid rgba(255,255,255,0.05); padding: 10px; border-radius: 10px; margin-bottom: 6px; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
        .deck-item:hover { border-color: rgba(239,68,68,0.2); background: rgba(239,68,68,0.03); }
        .deck-item.active { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.05); box-shadow: 0 2px 12px rgba(239,68,68,0.08); }
        .deck-item-name { font-weight: 600; color: #e5e7eb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
        .deck-item-count { color: #6b7486; font-size: 11px; margin-top: 2px; }
        .deck-item-actions { display: flex; gap: 4px; margin-top: 6px; }
        .deck-item-actions button { flex: 1; padding: 4px 8px; font-size: 10px; }
        .deck-main { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; background: rgba(6,7,11,0.3); }
        .deck-header { display: flex; gap: 12px; align-items: center; }
        .deck-name-input { flex: 1; font-size: 15px; font-weight: 700; padding: 8px 14px; }
        .deck-notes { width: 100%; min-height: 60px; padding: 10px 14px; background: rgba(14,15,24,0.4); border: 1px solid rgba(255,255,255,0.06); color: #d1d5db; border-radius: 10px; font-family: inherit; font-size: 13px; resize: vertical; transition: border-color 0.2s; }
        .deck-notes:focus { outline: none; border-color: rgba(239,68,68,0.35); box-shadow: 0 0 0 3px rgba(239,68,68,0.06); }
        .deck-slot { border: 2px dashed rgba(255,255,255,0.06); border-radius: 12px; padding: 14px; text-align: center; cursor: pointer; transition: border-color 0.2s ease, background 0.2s ease; min-height: 180px; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; }
        .deck-slot:hover { border-color: rgba(239,68,68,0.25); background: rgba(239,68,68,0.02); }
        .deck-slot.filled { border-style: solid; border-color: rgba(16,185,129,0.2); background: rgba(16,185,129,0.02); }
        .deck-slot-image { width: 90px; aspect-ratio: 63/88; object-fit: contain; background: #08090d; border-radius: 4px; }
        .deck-slot-label { font-weight: 700; color: #454d5f; font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; }
        .deck-slot-name { color: #e5e7eb; font-weight: 500; font-size: 13px; }
        .deck-group-header { font-weight: 700; color: #ef4444; border-bottom: 1px solid rgba(255,255,255,0.04); padding: 8px 0; margin-bottom: 8px; text-transform: uppercase; font-size: 11px; letter-spacing: 1.2px; }
        .deck-card-row { display: flex; align-items: center; padding: 7px 10px; background: rgba(14,15,24,0.35); border-radius: 8px; margin-bottom: 3px; gap: 8px; cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease; border-left: 2px solid transparent; }
        .deck-card-row:hover { background: rgba(24,26,38,0.6); border-left-color: #ef4444; }
        .deck-card-qty { min-width: 28px; font-weight: 700; color: #ef4444; font-size: 13px; }
        .deck-card-name { flex: 1; color: #c9cdd5; font-size: 13px; }
        .deck-card-cost { color: #f59e0b; font-weight: 700; min-width: 20px; font-size: 13px; }
        .deck-search-results { position: absolute; top: 100%; left: 0; right: 0; background: rgba(16,17,26,0.95); border: 1px solid rgba(255,255,255,0.08); border-top: none; max-height: 200px; overflow-y: auto; z-index: 10; display: none; backdrop-filter: blur(12px); border-radius: 0 0 8px 8px; }
        .deck-search-results.active { display: block; }
        .deck-search-result-item { padding: 8px 12px; color: #d1d5db; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.03); }
        .deck-search-result-item:hover { background: rgba(239,68,68,0.06); }
        .deck-stats { background: rgba(14,15,24,0.35); border: 1px solid rgba(255,255,255,0.04); padding: 14px; border-radius: 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

        /* ---- SWUDB COMMUNITY DECKS ---- */
        .swudb-section { padding: 16px; }
        .swudb-cat-tabs { display: flex; gap: 0; border-bottom: 1px solid rgba(255,255,255,0.04); margin-bottom: 16px; }
        .swudb-cat-btn { background: none; border: none; color: #50556a; cursor: pointer; padding: 10px 18px; font-size: 11px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s; text-transform: uppercase; letter-spacing: 0.8px; }
        .swudb-cat-btn.active { color: #ef4444; border-bottom-color: #ef4444; }
        .swudb-cat-btn:hover { color: #a0a6b4; }
        .swudb-deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
        .swudb-deck-card { background: rgba(14,15,24,0.5); border: 1px solid rgba(255,255,255,0.05); border-radius: 10px; overflow: hidden; cursor: pointer; transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; display: flex; align-items: stretch; }
        .swudb-deck-card:hover { border-color: rgba(239,68,68,0.25); box-shadow: 0 10px 36px rgba(0,0,0,0.3); transform: translateY(-2px); }
        .swudb-deck-images { display: flex; gap: 0; flex-shrink: 0; width: 120px; position: relative; background: rgba(8,9,13,0.5); }
        .swudb-deck-images img { width: 60px; height: 84px; object-fit: cover; }
        .swudb-deck-images .swudb-base-img { position: absolute; bottom: 0; right: 0; width: 50px; height: 35px; object-fit: cover; border-radius: 4px 0 0 0; border-top: 1px solid rgba(255,255,255,0.04); border-left: 1px solid rgba(255,255,255,0.04); }
        .swudb-deck-info { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
        .swudb-deck-name { font-weight: 700; color: #e5e7eb; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .swudb-deck-author { color: #8892a4; font-size: 12px; }
        .swudb-deck-meta { display: flex; gap: 12px; margin-top: auto; padding-top: 6px; }
        .swudb-deck-meta span { font-size: 12px; color: #555a6b; display: flex; align-items: center; gap: 4px; }
        .swudb-deck-meta .likes { color: #ef4444; }
        .swudb-deck-meta .comments { color: #6b8aff; }
        .swudb-deck-format { font-size: 11px; color: white; background: linear-gradient(135deg, #ef4444, #dc2626); padding: 2px 8px; border-radius: 6px; font-weight: 600; align-self: flex-start; letter-spacing: 0.3px; }
        .swudb-loading { text-align: center; color: #555a6b; padding: 40px; }
        .swudb-section-title { font-size: 13px; font-weight: 700; color: #ef4444; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 1.2px; }
        .my-decks-toggle { background: rgba(16,17,26,0.4); border: 1px solid rgba(255,255,255,0.06); color: #d1d5db; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 24px; text-transform: none; }
        .my-decks-toggle:hover { background: rgba(26,28,40,0.6); border-color: rgba(239,68,68,0.2); }
        .my-decks-toggle .arrow { transition: transform 0.2s; }
        .my-decks-toggle.open .arrow { transform: rotate(90deg); }
        .my-decks-section { display: none; margin-top: 12px; }
        .my-decks-section.open { display: block; }

        /* SWUDB Deck Detail View */
        .swudb-detail { display: none; }
        .swudb-detail.active { display: block; animation: fadeIn 0.3s ease-out; }
        .swudb-detail-header { display: flex; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
        .swudb-detail-leaders { display: flex; gap: 16px; flex-shrink: 0; }
        .swudb-detail-leader-card { text-align: center; }
        .swudb-detail-leader-card img { width: 160px; aspect-ratio: 63/88; object-fit: contain; border-radius: 6px; background: #08090d; transition: all 0.3s; }
        .swudb-detail-leader-card img:hover { box-shadow: 0 0 20px rgba(239,68,68,0.2); transform: scale(1.02); }
        .swudb-detail-leader-card .label { font-size: 11px; color: #555a6b; margin-top: 6px; text-transform: uppercase; letter-spacing: 1px; }
        .swudb-detail-leader-card .name { font-weight: 700; color: #e5e7eb; font-size: 14px; }
        .swudb-detail-leader-card .subtitle { font-size: 12px; color: #555a6b; }
        .swudb-detail-info { flex: 1; min-width: 250px; }
        .swudb-detail-title { font-size: 22px; font-weight: 700; color: #e5e7eb; margin-bottom: 6px; }
        .swudb-detail-author { color: #8892a4; font-size: 14px; margin-bottom: 12px; }
        .swudb-detail-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
        .swudb-detail-badge { font-size: 12px; padding: 3px 10px; border-radius: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
        .swudb-detail-badge.format { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
        .swudb-detail-badge.likes { background: rgba(239,68,68,0.1); color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }
        .swudb-detail-desc { color: #8892a4; font-size: 13px; line-height: 1.6; margin-top: 12px; background: rgba(14,15,21,0.5); padding: 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.06); }
        .swudb-detail-link { display: inline-block; margin-top: 12px; color: #6b8aff; font-size: 13px; text-decoration: none; }
        .swudb-detail-link:hover { text-decoration: underline; color: #8ba3ff; }
        .swudb-cardlist { margin-top: 16px; }
        .swudb-cardlist-group { margin-bottom: 20px; }
        .swudb-cardlist-group-header { font-weight: 700; color: #ef4444; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,0.04); padding-bottom: 6px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; }
        .swudb-cardlist-row { display: flex; align-items: center; padding: 6px 10px; background: rgba(16,17,26,0.4); border-radius: 6px; margin-bottom: 3px; gap: 10px; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer; border-left: 2px solid transparent; }
        .swudb-cardlist-row:hover { background: rgba(26,28,40,0.6); border-left-color: #ef4444; }
        .swudb-cardlist-qty { min-width: 32px; font-weight: bold; color: #ef4444; font-size: 14px; }
        .swudb-cardlist-name { flex: 1; color: #d1d5db; font-size: 13px; }
        .swudb-cardlist-set { color: #555a6b; font-size: 11px; min-width: 40px; text-align: center; }
        .swudb-cardlist-cost { color: #f59e0b; font-weight: bold; font-size: 14px; min-width: 24px; text-align: center; }
        .swudb-cardlist-price { color: #10b981; font-size: 12px; min-width: 60px; text-align: right; font-weight: 600; }
        .swudb-cardlist-total { text-align: right; color: #8892a4; font-size: 13px; margin-top: 12px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.04); }
        .swudb-back-btn { background: none; border: 1px solid rgba(255,255,255,0.08); color: #8892a4; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; margin-bottom: 16px; text-transform: none; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
        .swudb-back-btn:hover { background: rgba(255,255,255,0.04); color: #d1d5db; border-color: rgba(239,68,68,0.2); box-shadow: none; transform: none; }

        /* Collection stats boxes */
        .collection-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
        .collection-stat-box { background: rgba(16,17,26,0.5); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; backdrop-filter: blur(4px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
        .collection-stat-box:hover { border-color: rgba(239,68,68,0.15); box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
        .collection-stat-box::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, #ef4444, transparent 70%); opacity: 0.7; }
        .collection-stat-label { color: #555a6b; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
        .collection-stat-value { color: #ef4444; font-weight: bold; font-size: 18px; }

        /* Cost filter buttons */
        .cost-filter-buttons { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
        .cost-btn { width: 32px; height: 32px; padding: 0; border-radius: 8px; border: 1px solid rgba(255,255,255,0.06); background: rgba(16,17,26,0.5); color: #555a6b; cursor: pointer; font-weight: 600; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-size: 12px; text-transform: none; }
        .cost-btn:hover { border-color: rgba(239,68,68,0.3); color: #ef4444; background: rgba(239,68,68,0.08); box-shadow: none; transform: none; }
        .cost-btn.active { border-color: #ef4444; background: linear-gradient(135deg, #ef4444, #dc2626); color: white; box-shadow: 0 2px 12px rgba(239,68,68,0.3); }

        /* +/- buttons on collection cards */
        .card-tile-qty-controls { position: absolute; bottom: 0; left: 0; right: 0; height: 28px; background: linear-gradient(to top, rgba(0,0,0,0.9), transparent); display: none; align-items: center; justify-content: center; gap: 6px; padding-bottom: 2px; }
        .card-tile:hover .card-tile-qty-controls { display: flex; }
        .qty-btn { width: 24px; height: 24px; padding: 0; border: none; background: linear-gradient(135deg, #ef4444, #dc2626); color: white; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 14px; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); text-transform: none; }
        .qty-btn:hover { background: linear-gradient(135deg, #f87171, #ef4444); transform: scale(1.1); box-shadow: 0 2px 10px rgba(239,68,68,0.4); }

        /* SWUDB highlight toggle and stats */
        .swudb-stats-bar { display: flex; gap: 24px; align-items: center; padding: 12px 16px; margin-bottom: 16px; background: rgba(16,17,26,0.4); border: 1px solid rgba(255,255,255,0.04); border-radius: 10px; flex-wrap: wrap; }
        .swudb-stat-item { display: flex; flex-direction: column; gap: 2px; }
        .swudb-stat-label { color: #555a6b; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
        .swudb-stat-value { color: #ef4444; font-weight: bold; font-size: 14px; }
        .swudb-highlight-toggle { display: flex; align-items: center; gap: 8px; margin-left: auto; }
        .toggle-switch { width: 44px; height: 24px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative; }
        .toggle-switch.active { background: linear-gradient(135deg, #ef4444, #dc2626); border-color: transparent; box-shadow: 0 2px 10px rgba(239,68,68,0.3); }
        .toggle-switch::after { content: ''; position: absolute; width: 20px; height: 20px; background: white; border-radius: 50%; top: 2px; left: 2px; transition: all 0.3s; }
        .toggle-switch.active::after { left: 22px; }

        /* ---- DECKBUILDER SPLIT-SCREEN ---- */
        .deckbuilder-split { display: flex; gap: 0; height: calc(100vh - 52px - 48px); min-height: 500px; border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; overflow: hidden; }
        .deckbuilder-browser { flex: 0 0 55%; border-right: 1px solid rgba(255,255,255,0.04); display: flex; flex-direction: column; overflow: hidden; background: rgba(8,9,13,0.6); }
        .deckbuilder-panel { flex: 0 0 45%; display: flex; flex-direction: column; overflow: hidden; background: rgba(14,15,21,0.6); }
        .deckbuilder-browser-search { padding: 12px; background: rgba(14,15,21,0.5); border-bottom: 1px solid rgba(255,255,255,0.04); }
        .deckbuilder-browser-search input { width: 100%; }
        .deckbuilder-filter-bar { padding: 12px; background: rgba(14,15,21,0.5); border-bottom: 1px solid rgba(255,255,255,0.04); display: flex; flex-direction: column; gap: 8px; }
        .deckbuilder-filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
        .deckbuilder-card-grid { flex: 1; overflow-y: auto; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; align-content: start; }
        .deckbuilder-card-tile { display: flex; flex-direction: column; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
        .deckbuilder-card-tile:hover { transform: scale(1.04) translateY(-2px); }
        .deckbuilder-card-image-wrap { position: relative; border-radius: 8px; overflow: hidden; border: 2px solid rgba(255,255,255,0.06); cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
        .deckbuilder-card-tile:hover .deckbuilder-card-image-wrap { border-color: rgba(239,68,68,0.4); box-shadow: 0 4px 20px rgba(239,68,68,0.15), 0 0 1px rgba(239,68,68,0.3); }
        .deckbuilder-card-tile.in-deck .deckbuilder-card-image-wrap { border-color: rgba(16,185,129,0.4); box-shadow: 0 0 10px rgba(16,185,129,0.15); }
        .deckbuilder-card-tile.at-max .deckbuilder-card-image-wrap { border-color: rgba(255,255,255,0.03); opacity: 0.4; }
        .deckbuilder-card-image { width: 100%; aspect-ratio: 63/88; object-fit: contain; display: block; background: #08090d; }
        .deckbuilder-card-counter { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 0; }
        .deckbuilder-card-counter-btn { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.08); background: rgba(16,17,26,0.5); color: #555a6b; cursor: pointer; font-size: 16px; font-weight: bold; display: flex; align-items: center; justify-content: center; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); padding: 0; line-height: 1; text-transform: none; }
        .deckbuilder-card-counter-btn:hover { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; border-color: transparent; box-shadow: 0 2px 10px rgba(239,68,68,0.3); transform: scale(1.1); }
        .deckbuilder-card-counter-text { color: #8892a4; font-weight: 600; font-size: 13px; min-width: 30px; text-align: center; }
        .deckbuilder-card-counter-text.has-cards { color: #10b981; }
        .deckbuilder-card-tile.at-max .deckbuilder-card-counter-text { color: #3a3c48; }
        .deckbuilder-panel-header { padding: 16px; background: rgba(14,15,21,0.5); border-bottom: 1px solid rgba(255,255,255,0.04); display: flex; flex-direction: column; gap: 12px; }
        .deckbuilder-panel-sticky { display: flex; gap: 12px; align-items: center; }
        .deckbuilder-name-input { flex: 1; font-size: 16px; font-weight: bold; }
        .deckbuilder-format-select { }
        .deck-qty-controls { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; }
        .deck-qty-btn { width: 20px; height: 20px; border-radius: 5px; border: 1px solid rgba(255,255,255,0.1); background: transparent; color: #d1d5db; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); flex-shrink: 0; line-height: 1; font-weight: 700; }
        .deck-qty-btn:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.1); }
        .deck-qty-minus:hover { border-color: #ef4444; color: #ef4444; }
        .deck-qty-plus:hover { border-color: #10b981; color: #10b981; background: rgba(16,185,129,0.1); }
        .deckbuilder-panel-content { flex: 1; overflow-y: auto; padding: 16px; }
        .deckbuilder-deck-slot { border: 1px dashed rgba(255,255,255,0.08); border-radius: 10px; padding: 8px 10px; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: row; gap: 10px; align-items: center; margin-bottom: 6px; min-height: 0; }
        .deckbuilder-deck-slot:hover { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.03); }
        .deckbuilder-deck-slot.filled { border-style: solid; border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.03); }
        .deckbuilder-slot-image { width: 36px; aspect-ratio: 63/88; object-fit: contain; background: #08090d; border-radius: 2px; flex-shrink: 0; }
        .deckbuilder-slot-label { font-weight: 700; color: #555a6b; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
        .deckbuilder-slot-name { color: #e5e7eb; font-weight: 500; font-size: 13px; }
        .deckbuilder-slot-info { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
        .deckbuilder-cardlist { margin-top: 12px; }
        .deckbuilder-group-header { font-weight: 700; color: #ef4444; border-bottom: 1px solid rgba(255,255,255,0.04); padding: 8px 0; margin-bottom: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
        .deckbuilder-card-row { display: flex; align-items: center; padding: 6px 8px; background: rgba(16,17,26,0.4); border-radius: 6px; margin-bottom: 4px; gap: 8px; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); border-left: 2px solid transparent; }
        .deckbuilder-card-row:hover { background: rgba(26,28,40,0.6); border-left-color: #ef4444; }
        .deckbuilder-card-qty-num { min-width: 30px; font-weight: bold; color: #ef4444; cursor: pointer; }
        .deckbuilder-card-qty-num:hover { color: #f87171; }
        .deckbuilder-card-row-name { flex: 1; color: #d1d5db; font-size: 13px; }
        .deckbuilder-card-row-cost { color: #f59e0b; font-weight: bold; min-width: 20px; text-align: center; }
        .deckbuilder-stats { background: rgba(16,17,26,0.4); border: 1px solid rgba(255,255,255,0.06); padding: 12px; border-radius: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 12px; margin-top: 12px; }
        .deckbuilder-stat-label { color: #555a6b; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
        .deckbuilder-stat-value { color: #ef4444; font-weight: bold; font-size: 14px; }
        .deckbuilder-delete-btn { background: linear-gradient(135deg, #dc2626, #991b1b); padding: 8px 16px; margin-top: 12px; border-radius: 8px; }
        .deckbuilder-delete-btn:hover { background: linear-gradient(135deg, #ef4444, #b91c1c); }

        @media (max-width: 768px) {
            .deckbuilder-split { flex-direction: column; height: auto; min-height: auto; }
            .deckbuilder-browser { flex: 0 0 auto; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.04); max-height: 400px; }
            .deckbuilder-panel { flex: 0 0 auto; min-height: 300px; }
        }

        .stat-box { display: flex; flex-direction: column; gap: 4px; }
        .stat-label { color: #555a6b; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
        .stat-value { color: #ef4444; font-weight: bold; font-size: 16px; }

        /* Stats charts */
        .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
        .chart-box { background: rgba(14,15,24,0.5); border: 1px solid rgba(255,255,255,0.04); border-radius: 12px; padding: 18px; position: relative; overflow: hidden; }
        .chart-box::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, #ef4444, transparent 60%); opacity: 0.5; }
        .chart-title { font-weight: 700; margin-bottom: 14px; color: #e5e7eb; font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; }
        .bar-chart { display: flex; flex-direction: column; gap: 7px; }
        .bar-row { display: flex; gap: 8px; align-items: center; }
        .bar-label { width: 80px; font-size: 11px; color: #6b7486; text-align: right; }
        .bar { flex: 1; height: 18px; background: linear-gradient(90deg, #ef4444, #f97316); border-radius: 4px; position: relative; }
        .bar-value { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-size: 10px; color: white; font-weight: 700; }

        /* Settings */
        .settings-section { background: rgba(14,15,24,0.5); border: 1px solid rgba(255,255,255,0.04); border-radius: 12px; padding: 18px; margin-bottom: 14px; }
        .settings-title { font-weight: 700; margin-bottom: 12px; color: #e5e7eb; text-transform: uppercase; letter-spacing: 0.8px; font-size: 12px; }
        .settings-content { display: flex; flex-direction: column; gap: 8px; }
        .info-text { color: #555a6b; font-size: 12px; }
        .danger-zone { border-color: rgba(239,68,68,0.2); background: rgba(239,68,68,0.04); }

        /* Multi-select mode */
        .select-bar { display: flex; gap: 8px; align-items: center; padding: 8px 16px; background: rgba(14,15,21,0.6); border-bottom: 1px solid rgba(255,255,255,0.04); }
        .select-bar.hidden { display: none; }
        .select-count { color: #ef4444; font-weight: bold; font-size: 14px; }
        .card-tile .select-check { display: none; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; background: rgba(16,17,26,0.7); border: 2px solid rgba(255,255,255,0.15); border-radius: 6px; z-index: 5; align-items: center; justify-content: center; font-size: 14px; color: #10b981; cursor: pointer; backdrop-filter: blur(4px); }
        .card-tile.select-mode .select-check { display: flex; }
        .card-tile.selected { border-color: #ef4444 !important; box-shadow: 0 0 12px rgba(239,68,68,0.3) !important; }
        .card-tile.selected .select-check { background: #ef4444; border-color: #ef4444; color: white; }

        /* Grayscale for unowned in set view */
        .card-tile.grayscale .card-image { filter: grayscale(100%) brightness(0.4); }

        /* Back button */
        .back-btn { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); color: #8892a4; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; text-transform: none; transition: all 0.12s ease; }
        .back-btn:hover { background: rgba(255,255,255,0.05); color: #d1d5db; border-color: rgba(255,255,255,0.1); box-shadow: none; transform: none; }

        /* Import/Export Dropdown */
        .ie-dropdown { position: relative; display: inline-block; }
        .ie-dropdown-btn { background: rgba(14,15,24,0.5); border: 1px solid rgba(255,255,255,0.06); color: #c9cdd5; padding: 5px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; transition: all 0.15s ease; white-space: nowrap; }
        .ie-dropdown-btn:hover { border-color: rgba(239,68,68,0.2); color: #fff; background: rgba(239,68,68,0.05); }
        .ie-dropdown-btn svg { width: 14px; height: 14px; fill: currentColor; }
        .ie-dropdown-menu { display: none; position: absolute; top: calc(100% + 4px); right: 0; background: rgba(12,13,22,0.95); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; min-width: 220px; z-index: 300; box-shadow: 0 12px 40px rgba(0,0,0,0.5); overflow: hidden; backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3); }
        .ie-dropdown-menu.open { display: block; }
        .ie-dropdown-sep { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 0; }
        .ie-dropdown-label { padding: 6px 14px 2px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: #555a6b; font-weight: 700; }
        .ie-dropdown-item { display: flex; align-items: center; gap: 8px; padding: 8px 14px; color: #d1d5db; font-size: 13px; cursor: pointer; transition: all 0.15s; border: none; background: none; width: 100%; text-align: left; font-family: inherit; border-radius: 4px; margin: 0 4px; width: calc(100% - 8px); }
        .ie-dropdown-item:hover { background: rgba(239,68,68,0.08); color: #fff; }
        .ie-dropdown-item svg { width: 14px; height: 14px; fill: currentColor; opacity: 0.6; flex-shrink: 0; }
        .ie-dropdown-item.import-item { color: #10b981; }
        .ie-dropdown-item.import-item:hover { background: rgba(16,185,129,0.08); color: #34d399; }
        .ie-dropdown-file { display: none; }

        /* Spotlight Decks Dropdown */
        .sl-dropdown { position: relative; display: inline-block; }
        .sl-dropdown-btn { background: rgba(14,15,24,0.5); border: 1px solid rgba(255,255,255,0.06); color: #c9cdd5; padding: 5px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; transition: all 0.15s ease; white-space: nowrap; }
        .sl-dropdown-btn:hover { border-color: rgba(239,68,68,0.2); color: #fff; background: rgba(239,68,68,0.05); }
        .sl-dropdown-btn svg { width: 14px; height: 14px; fill: currentColor; }
        .sl-dropdown-menu { display: none; position: absolute; top: calc(100% + 4px); right: 0; background: rgba(16,17,26,0.95); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; min-width: 260px; z-index: 300; box-shadow: 0 8px 32px rgba(0,0,0,0.5); overflow: hidden; max-height: 400px; overflow-y: auto; backdrop-filter: blur(16px); }
        .sl-dropdown-menu.open { display: block; }
        .sl-dropdown-label { padding: 6px 14px 2px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: #555a6b; font-weight: 700; }
        .sl-dropdown-sep { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 0; }
        .sl-dropdown-item { display: flex; align-items: center; gap: 8px; padding: 8px 14px; color: #d1d5db; font-size: 13px; cursor: pointer; transition: all 0.15s; border: none; background: none; width: 100%; text-align: left; font-family: inherit; }
        .sl-dropdown-item:hover { background: rgba(239,68,68,0.08); color: #fff; }
        .sl-dropdown-item svg { width: 14px; height: 14px; fill: currentColor; opacity: 0.6; flex-shrink: 0; }
        .sl-dropdown-item .sl-set { font-size: 10px; color: #555a6b; margin-left: auto; font-weight: 600; }

        /* ---- CUSTOM SCROLLBAR ---- */
        ::-webkit-scrollbar { width: 5px; height: 5px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
        ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

        /* ---- SELECTION HIGHLIGHT ---- */
        ::selection { background: rgba(239,68,68,0.3); color: #fff; }

        /* ---- MOBILE: HAMBURGER MENU ---- */
        .mobile-menu-btn { display: none; background: none; border: none; color: #d1d5db; font-size: 22px; padding: 4px 8px; cursor: pointer; line-height: 1; text-transform: none; letter-spacing: 0; }
        .mobile-menu-btn:hover { background: none; box-shadow: none; transform: none; color: #ef4444; }

        @media (max-width: 768px) {
            /* Header: compact single row */
            .header { padding: 0 10px; gap: 8px; height: 46px; flex-wrap: nowrap; }
            .header-title { font-size: 14px; letter-spacing: 1px; }
            .header-title span { display: none; }
            .header-tabs { display: none; position: fixed; top: 46px; left: 0; right: 0; background: rgba(14,15,22,0.95); border-bottom: 1px solid rgba(255,255,255,0.06); flex-direction: column; gap: 0; z-index: 999; box-shadow: 0 8px 32px rgba(0,0,0,0.6); backdrop-filter: blur(20px); }
            .header-tabs.mobile-open { display: flex; }
            .header-tabs .tab-btn { padding: 14px 20px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 14px; }
            .header-tabs .tab-btn:last-child { border-bottom: none; }
            .header-tabs .tab-btn.active::after { display: none; }
            .header-tabs .tab-btn.active { background: rgba(239,68,68,0.08); }
            .mobile-menu-btn { display: block; order: -1; }
            .header-stats { font-size: 10px !important; gap: 8px !important; }
            .header-controls { gap: 6px; }
            .header-controls .lang-toggle { padding: 4px 8px; font-size: 11px; }
            .header-controls .theme-toggle { width: 28px; height: 28px; font-size: 14px; padding: 0; }

            /* Container height adjusts for smaller header */
            .container { height: calc(100vh - 46px); }

            /* Filters: grid layout on mobile */
            .filter-bar { padding: 8px 10px; }
            .filter-row { gap: 6px; flex-wrap: wrap; }
            .filter-row select, .filter-row button.secondary { font-size: 12px; padding: 6px 8px; height: 32px; }
            .filter-row .custom-dropdown-trigger { font-size: 12px; padding: 6px 24px 6px 8px; height: 32px; }
            .content { padding: 10px; }
            /* Browse + Collection filter: 2-col grid with full-width search */
            #browseFilterBar .filter-row:first-child,
            #collectionContainer .filter-bar .filter-row:first-child {
                display: grid;
                grid-template-columns: 1fr 1fr;
                gap: 6px;
            }
            #browseFilterBar .filter-row:first-child input[type="text"],
            #collectionContainer .filter-bar .filter-row:first-child input[type="text"] {
                grid-column: 1 / -1;
                min-width: 0 !important;
                font-size: 14px;
                padding: 8px 10px;
            }
            #browseFilterBar .filter-row:first-child .secondary,
            #collectionContainer .filter-bar .filter-row:first-child .secondary {
                grid-column: 1 / -1;
                font-size: 11px;
                padding: 6px 10px;
            }
            /* Hide per-page on small screens */
            #browsePerPage { display: none; }
            /* Override grid density on mobile - fall back to auto-fill */
            .card-grid.density-5, .card-grid.density-6, .card-grid.density-7 {
                grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            }
            /* Hide auth header buttons on mobile */
            .header-auth-buttons { display: none !important; }

            /* Cost buttons: smaller on mobile */
            .cost-filter-buttons { justify-content: flex-start; flex-wrap: wrap; }
            .cost-btn { min-width: 28px; padding: 4px 6px; font-size: 11px; }

            /* Aspect buttons: smaller */
            .aspect-btn { width: 28px; height: 28px; }
            .arena-btn { padding: 4px 8px; font-size: 11px; }
            .filter-divider { display: none; }
            .filter-row > span { font-size: 11px !important; }

            /* Card grid: 3 columns on small phones, 2 on very small */
            .card-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
            .card-tile { font-size: 11px; }
            .card-name { font-size: 11px; }
            .card-subtitle { font-size: 10px; }
            .card-meta { font-size: 10px; }

            /* Modal: full-screen on mobile */
            .modal-content { width: 96%; max-width: none; max-height: 90vh; padding: 16px; border-radius: 12px; }
            .card-detail, .variant-picker { grid-template-columns: 1fr; }
            .card-detail-info, .variant-picker-right { grid-column: 1; }

            /* Auth overlay: tighter */
            .auth-modal { width: 92%; padding: 20px; }

            /* Collection stats */
            .collection-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
            .collection-stat-value { font-size: 16px; }

            /* Decks */
            .deck-layout { flex-direction: column; }
            .deck-sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.04); max-height: 150px; }
            .deck-stats { grid-template-columns: repeat(2, 1fr); }

            /* Set overview */
            .set-overview-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

            /* SWUDB decks */
            .swudb-deck-grid { grid-template-columns: 1fr; }
            .swudb-cat-btn { padding: 8px 10px; font-size: 11px; }
            .swudb-stats-bar { flex-direction: column; gap: 12px; align-items: flex-start; }
            .swudb-highlight-toggle { margin-left: 0; }
            .swudb-detail-images { flex-direction: column; align-items: center; }
            .swudb-detail-info { min-width: auto; }

            /* Import/Export & Spotlight dropdowns */
            .ie-dropdown-btn, .sl-dropdown-btn { padding: 4px 8px; font-size: 11px; }
            .ie-dropdown-menu { min-width: 180px; right: 0; left: auto; }
            .sl-dropdown-menu { min-width: 200px; right: 0; left: auto; }

            /* Deckbuilder */
            .deckbuilder-split { flex-direction: column; height: auto; min-height: auto; }
            .deckbuilder-browser { flex: 0 0 auto; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.04); max-height: 50vh; }
            .deckbuilder-panel { flex: 0 0 auto; min-height: 300px; }

            /* Stats charts */
            .stats-grid { grid-template-columns: 1fr; }
            .bar-label { width: 60px; font-size: 11px; }

            /* Pagination */
            .page-btn { padding: 6px 8px; min-width: 30px; font-size: 12px; }

            /* Select bar (multi-select) */
            .select-bar { padding: 6px 10px; flex-wrap: wrap; }
        }

        /* Extra small phones */
        @media (max-width: 380px) {
            .card-grid { grid-template-columns: repeat(2, 1fr); }
            .header-stats { display: none !important; }
            .collection-stats { grid-template-columns: 1fr; }
        }
        /* Filter divider */
        .filter-divider { background: rgba(255,255,255,0.06); }
        body.light-theme .filter-divider { background: #c0c8d8; }

        /* Slot banner */
        .deckbuilder-slot-banner { padding: 8px 12px; background: rgba(16,17,26,0.4); border-bottom: 1px solid rgba(255,255,255,0.04); align-items: center; gap: 8px; display: flex; }
        body.light-theme .deckbuilder-slot-banner { background: #f0f3f7; border-bottom-color: #c0c8d8; }

        /* ====== AUTH LOADING ANIMATION ====== */
        .auth-loading::after {
            content: '';
            position: absolute;
            top: 50%;
            right: 10px;
            width: 16px;
            height: 16px;
            border: 2px solid rgba(239,68,68,0.3);
            border-top-color: #ef4444;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            transform: translateY(-50%);
        }
        @keyframes spin {
            to { transform: translateY(-50%) rotate(360deg); }
        }

        /* ====== SKELETON LOADING ====== */
        @keyframes shimmer {
            0% { background-position: -400px 0; }
            100% { background-position: 400px 0; }
        }
        .skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding: 16px 0; }
        .skeleton-card { background: rgba(14,15,24,0.5); border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,0.03); }
        .skeleton-card .skeleton-img { width: 100%; aspect-ratio: 63/88; background: linear-gradient(90deg, rgba(20,22,34,0.6) 25%, rgba(30,33,48,0.6) 50%, rgba(20,22,34,0.6) 75%); background-size: 800px 100%; animation: shimmer 1.8s infinite ease-in-out; }
        .skeleton-card .skeleton-text { padding: 10px 11px; }
        .skeleton-card .skeleton-line { height: 10px; border-radius: 5px; background: linear-gradient(90deg, rgba(20,22,34,0.6) 25%, rgba(30,33,48,0.6) 50%, rgba(20,22,34,0.6) 75%); background-size: 800px 100%; animation: shimmer 1.8s infinite ease-in-out; margin-bottom: 6px; }
        .skeleton-card .skeleton-line:last-child { width: 55%; margin-bottom: 0; }

        /* ====== TOAST NOTIFICATIONS ====== */
        .toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 99999; display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none; }
        .toast { pointer-events: auto; padding: 12px 18px; border-radius: 12px; font-size: 13px; font-weight: 500; color: #e5e7eb; box-shadow: 0 12px 40px rgba(0,0,0,0.5); transform: translateX(120%); opacity: 0; transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1); max-width: 360px; border-left: 3px solid; display: flex; align-items: center; gap: 10px; backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); background: rgba(14,15,24,0.88); }
        .toast.show { transform: translateX(0); opacity: 1; }
        .toast.toast-success { border-color: #10b981; }
        .toast.toast-error { border-color: #ef4444; }
        .toast.toast-warning { border-color: #f59e0b; }
        .toast.toast-info { border-color: #3b82f6; }
        .toast-icon { font-size: 16px; flex-shrink: 0; }

        /* ====== SMOOTH TRANSITIONS ====== */
        .card-grid .card-tile { animation: fadeIn 0.2s ease both; }
        .card-grid .card-tile:nth-child(n+5) { animation-delay: 0.05s; }
        .card-grid .card-tile:nth-child(n+9) { animation-delay: 0.1s; }
        .card-grid .card-tile:nth-child(n+13) { animation-delay: 0.15s; }
        .card-tile:hover { transform: translateY(-4px); }
        @keyframes countUp { from { transform: scale(1.3); color: #ef4444; } to { transform: scale(1); } }
        .header-stat-pop { animation: countUp 0.3s ease; }

        /* ====== SEARCH FIELD IMPROVEMENTS ====== */
        .search-wrapper { position: relative; flex: 1; min-width: 0; }
        .search-wrapper input { width: 100%; padding-right: 34px; }
        .search-clear-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #454d5f; font-size: 14px; cursor: pointer; padding: 3px 6px; line-height: 1; display: none; border-radius: 4px; transition: all 0.12s; }
        .search-clear-btn:hover { color: #ef4444; background: rgba(239,68,68,0.08); transform: translateY(-50%); box-shadow: none; }
        .search-wrapper input:not(:placeholder-shown) + .search-clear-btn { display: block; }

        @media (max-width: 768px) {
            .toast-container { bottom: 12px; right: 12px; left: 12px; }
            .toast { max-width: 100%; }
            .skeleton-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
        }
