:root {
            --primary-blue: #2563EB;
            --primary-blue-hover: #1D4ED8;
            --canva-purple: #7D2AE8;
            --canva-cyan: #00C4CC;
            --bg-body: #FFFFFF;
            --bg-card: #FFFFFF;
            --text-dark: #2D3748;
            --text-sub: #4A5568;
            --text-muted: #94A3B8;
            --border-color: #E2E8F0;
            --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.05);
            --shadow-floating: 0 12px 36px rgba(15, 23, 42, 0.1);
            --radius-pill: 9999px;
            --radius-lg: 24px;
            --radius-md: 14px;
            --font: 'Inter', system-ui, -apple-system, sans-serif;
        }

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

        body {
            font-family: var(--font);
            background-color: #F1F5F9;
            color: var(--text-dark);
            padding: 0;
            margin: 0;
            height: 100vh;
            overflow: hidden;
        }

        .app-container {
            width: 100%;
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding: 12px 32px;
            height: 100vh;
            overflow: hidden;
        }

        /* ABSOLUTELY HIDE FILE INPUTS & MOBILE ONLY ELEMENTS ON DESKTOP */
        #hidden-file-input,
        #bg-image-file-input,
        input[type="file"],
        .mobile-header-brand,
        .mobile-sub-header-strip,
        .mobile-bottom-nav,
        .mob-dl-circle-btn,
        .sheet-close-btn {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            pointer-events: none !important;
        }

        /* TOP FLOATING TOOLBAR (Hidden initially on Hero Screen, shown during editing) */
        .top-toolbar-wrapper {
            width: 100%;
            max-width: 100%;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            position: relative;
            z-index: 200;
            animation: fadeIn 0.3s ease-out;
            margin-bottom: 4px;
            flex-shrink: 0;
        }

        .top-toolbar-wrapper.hidden { display: none !important; }

        .top-toolbar {
            background: rgba(255, 255, 255, 0.96);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(226, 232, 240, 0.9);
            border-radius: var(--radius-pill);
            padding: 6px 10px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 6px;
            box-shadow: var(--shadow-floating);
            max-width: 100%;
            width: 100%;
            overflow: visible;
        }

        .tool-tabs-container {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .toolbar-actions-container {
            display: flex;
            align-items: center;
            gap: 6px;
            position: relative;
        }

        .top-toolbar::-webkit-scrollbar { display: none; }

        .tool-tab {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            border-radius: var(--radius-pill);
            border: none;
            background: transparent;
            color: var(--text-sub);
            font-family: var(--font);
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            transition: color 0.2s ease, background 0.2s ease;
            white-space: nowrap;
        }

        .tool-tab:hover {
            color: var(--text-dark);
            background: rgba(241, 245, 249, 0.7);
        }

        .tool-tab.active {
            background: #F1F5F9;
            color: var(--text-dark);
            box-shadow: inset 0 0 0 1px #CBD5E1;
        }

        .tool-icon {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .toolbar-divider {
            width: 1px;
            height: 24px;
            background: #E2E8F0;
            margin: 0 4px;
            flex-shrink: 0;
        }

        .action-icon-btn {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            border: none;
            background: transparent;
            color: var(--text-sub);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
            flex-shrink: 0;
        }

        .action-icon-btn:hover {
            background: #F1F5F9;
            color: var(--text-dark);
        }

        .action-icon-btn.active {
            background: var(--primary-blue);
            color: #FFFFFF;
        }

        /* Download Button */
        .download-btn-group {
            position: relative;
            margin-left: 6px;
            flex-shrink: 0;
        }

        .btn-download-primary {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 9px 22px;
            border-radius: var(--radius-pill);
            border: none;
            background: var(--primary-blue);
            color: #FFFFFF;
            font-family: var(--font);
            font-size: 0.92rem;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
            transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
        }

        .btn-download-primary:hover {
            background: var(--primary-blue-hover);
            box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
            transform: translateY(-1px);
        }

        .download-dropdown-menu {
            position: absolute;
            top: calc(100% + 8px);
            right: 0;
            background: #FFFFFF;
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-floating);
            padding: 8px;
            min-width: 220px;
            display: none;
            flex-direction: column;
            gap: 4px;
            z-index: 300;
        }

        .download-dropdown-menu.show { display: flex; }

        .dropdown-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 14px;
            border-radius: 8px;
            border: none;
            background: transparent;
            color: var(--text-dark);
            font-family: var(--font);
            font-size: 0.88rem;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.15s ease;
        }

        .dropdown-item:hover { background: #F1F5F9; }

        .dropdown-badge {
            font-size: 0.72rem;
            padding: 2px 6px;
            background: #E2E8F0;
            border-radius: 4px;
            color: var(--text-sub);
        }

        /* INITIAL HERO CONTAINER (SCREENSHOT 15 EXACT MATCH) */
        .initial-hero-container {
            width: 100%;
            max-width: 1080px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 50px;
            padding: 50px 10px 60px 10px;
            margin-top: 20px;
            animation: fadeIn 0.35s ease-out;
        }

        .initial-hero-container.hidden { display: none !important; }

        .hero-left-col {
            flex: 1;
            max-width: 500px;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
        }

        .hero-cutout-img-box {
            width: 240px;
            height: 240px;
            border-radius: 28px;
            overflow: hidden;
            margin-bottom: 24px;
            box-shadow: 0 15px 35px rgba(37, 99, 235, 0.12);
            background: #F1F5F9;
        }

        .hero-cutout-img-box img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .hero-main-title {
            font-size: 3.4rem;
            font-weight: 800;
            color: #2D3748;
            line-height: 1.12;
            letter-spacing: -1.4px;
            margin-bottom: 20px;
        }

        .hero-subtitle {
            font-size: 1.25rem;
            font-weight: 600;
            color: #4A5568;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .badge-free-blue {
            background: var(--primary-blue);
            color: #FFFFFF;
            font-weight: 700;
            padding: 4px 16px;
            border-radius: var(--radius-pill);
            font-size: 1.05rem;
            box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
        }

        .hero-right-col {
            flex: 1;
            max-width: 460px;
            display: flex;
            flex-direction: column;
            gap: 22px;
        }

        .hero-upload-card {
            width: 100%;
            min-height: 350px;
            background: #FFFFFF;
            border-radius: 36px;
            box-shadow: 0 25px 80px rgba(15, 23, 42, 0.07);
            border: 1px solid #F1F5F9;
            padding: 60px 40px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: box-shadow 0.25s ease, transform 0.25s ease;
        }

        .hero-upload-card:hover {
            box-shadow: 0 30px 90px rgba(15, 23, 42, 0.12);
            transform: translateY(-2px);
        }

        .btn-hero-upload {
            padding: 20px 54px;
            font-size: 1.25rem;
            font-weight: 700;
            border-radius: var(--radius-pill);
            border: none;
            background: var(--primary-blue);
            color: #FFFFFF;
            cursor: pointer;
            box-shadow: 0 10px 30px rgba(37, 99, 235, 0.38);
            transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
            margin-bottom: 24px;
        }

        .btn-hero-upload:hover {
            background: var(--primary-blue-hover);
            transform: translateY(-2px);
            box-shadow: 0 14px 35px rgba(37, 99, 235, 0.48);
        }

        .hero-card-drop-text {
            font-size: 1.15rem;
            color: #475569;
            font-weight: 600;
            margin-bottom: 4px;
        }

        .hero-card-paste-text {
            font-size: 0.9rem;
            color: #94A3B8;
            font-weight: 500;
        }

        .try-samples-container {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 0 6px;
        }

        .sample-thumbs-row {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .sample-thumb-btn {
            width: 52px;
            height: 52px;
            border-radius: 14px;
            overflow: hidden;
            border: 2px solid transparent;
            padding: 0;
            background: #E2E8F0;
            cursor: pointer;
            transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
        }

        .sample-thumb-btn:hover {
            transform: scale(1.08);
            border-color: var(--primary-blue);
            box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
        }

        .sample-thumb-btn img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        /* MAIN EDITOR DUAL-PANEL LAYOUT */
        .editor-workspace-layout {
            width: 100%;
            max-width: 620px;
            margin: 0 auto;
            display: flex;
            flex-direction: row;
            align-items: flex-start;
            justify-content: center;
            gap: 12px;
            flex: 1;
            min-height: 0;
        }

        .editor-workspace-layout.hidden { display: none !important; }

        /* WORKSPACE CARD (Left Canvas Area) */
        .workspace-card {
            flex: 0 0 auto;
            width: fit-content;
            height: fit-content;
            max-width: 100%;
            max-height: 100%;
            align-self: flex-start;
            margin: 0 auto;
            background: transparent;
            border-radius: var(--radius-lg);
            box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
            border: 3px solid transparent;
            background-image: 
                linear-gradient(white, white),
                linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
            background-origin: border-box;
            background-clip: padding-box, border-box;
            position: relative;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        /* ULTRA-LIGHT SOFT CHECKERBOARD (SCREENSHOT 14 MATCH) */
        .checkerboard-bg {
            background-color: #FFFFFF;
            background-image: 
                linear-gradient(45deg, #F1F5F9 25%, transparent 25%),
                linear-gradient(-45deg, #F1F5F9 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #F1F5F9 75%),
                linear-gradient(-45deg, transparent 75%, #F1F5F9 75%);
            background-size: 12px 12px;
            background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
        }

        .canvas-viewport {
            width: fit-content;
            height: fit-content;
            flex: 0 0 auto;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            user-select: none;
            overflow: hidden;
            border-radius: var(--radius-lg);
        }

        #main-canvas {
            max-width: 100%;
            max-height: 100%;
            width: auto;
            height: auto;
            display: block;
            cursor: default;
            object-fit: contain;
            border-radius: var(--radius-lg);
        }

        #main-canvas.brush-active { cursor: none; touch-action: none; }

        /* CANVA TOP PILL ON CANVAS (SCREENSHOT 14 MATCH) */
        .canva-top-pill {
            position: absolute;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 25;
            background: #FFFFFF;
            border: 1px solid rgba(226, 232, 240, 0.9);
            border-radius: var(--radius-pill);
            padding: 7px 18px;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.88rem;
            font-weight: 700;
            color: var(--text-dark);
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
            cursor: pointer;
            border: none;
            transition: all 0.2s ease;
        }

        .canva-top-pill:hover {
            transform: translateX(-50%) translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
        }

        /* CANVA BOTTOM DISCLAIMER OVERLAY (SCREENSHOT 14 DARK VIGNETTE MATCH) */
        .canva-overlay-disclaimer {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            z-index: 25;
            font-size: 0.76rem;
            color: rgba(255, 255, 255, 0.95);
            background: linear-gradient(to top, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.3) 60%, transparent 100%);
            padding: 26px 16px 14px 16px;
            text-align: center;
            pointer-events: auto;
        }

        .canva-overlay-disclaimer a {
            color: #FFFFFF;
            text-decoration: underline;
            font-weight: 600;
        }

        .canva-gradient-icon {
            width: 22px;
            height: 22px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--canva-cyan) 0%, var(--canva-purple) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #FFFFFF;
            font-weight: 800;
            font-size: 0.76rem;
            font-style: italic;
            flex-shrink: 0;
        }

        /* Virtual Circle Cursor for Brush */
        #brush-cursor {
            position: fixed; pointer-events: none;
            border: 2px solid rgba(37, 99, 235, 0.9);
            background: rgba(239, 68, 68, 0.25);
            border-radius: 50%; transform: translate(-50%, -50%);
            z-index: 1000; display: none;
        }

        .zoom-btn-circle {
            position: absolute; top: 16px; right: 16px;
            width: 32px; height: 32px; border-radius: 50%;
            background: rgba(15, 23, 42, 0.6); color: #FFFFFF;
            display: flex; align-items: center; justify-content: center;
            border: none; cursor: pointer; z-index: 15;
            transition: background 0.15s ease;
        }

        .zoom-btn-circle:hover { background: rgba(15, 23, 42, 0.85); }

        /* RIGHT SIDE SIDE-CARDS */
        
        /* 1. CUTOUT SIDE CARD */
        .magic-brush-side-card {
            flex: 0 0 240px;
            width: 420px;
            align-self: flex-start;
            max-height: 100%;
            overflow-y: auto;
            background: #FFFFFF;
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-color);
            box-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            animation: fadeIn 0.25s ease-out;
        }
        .magic-brush-side-card.hidden { display: none; }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-6px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .mb-header-box {
            background: #F8FAFC; border-radius: var(--radius-md); padding: 12px;
            display: flex; align-items: center; gap: 12px; border: 1px solid var(--border-color);
        }
        .mb-thumb-img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
        .mb-header-text h4 { font-size: 0.88rem; font-weight: 700; color: var(--text-dark); margin-bottom: 2px; }
        .mb-header-text p { font-size: 0.76rem; color: var(--text-sub); line-height: 1.3; }

        .erase-restore-group { display: flex; gap: 10px; transition: opacity 0.2s ease; }

        .mode-square-btn {
            flex: 1; height: 64px; border-radius: var(--radius-md);
            border: 1px solid var(--border-color); background: #FFFFFF;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            gap: 4px; cursor: pointer; font-family: var(--font);
            font-size: 0.82rem; font-weight: 600; color: var(--text-sub);
            transition: all 0.15s ease;
        }

        .mode-square-btn:hover { border-color: var(--primary-blue); color: var(--primary-blue); }
        .mode-square-btn.active {
            border: 2px solid var(--primary-blue); color: var(--primary-blue);
            background: rgba(37, 99, 235, 0.03); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
        }

        .mode-icon { font-size: 1.2rem; display: flex; align-items: center; justify-content: center; }

        .brush-size-row { display: flex; flex-direction: column; gap: 8px; transition: opacity 0.2s ease; }

        .brush-size-header {
            display: flex; align-items: center; justify-content: space-between;
            font-size: 0.82rem; font-weight: 600; color: var(--text-sub);
        }

        .brush-slider-input {
            -webkit-appearance: none; width: 100%; height: 6px;
            border-radius: 3px; background: #E2E8F0; outline: none;
        }

        .brush-slider-input::-webkit-slider-thumb {
            -webkit-appearance: none; width: 20px; height: 20px;
            border-radius: 50%; background: var(--primary-blue); cursor: pointer;
            box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
        }

        .magic-switch-row {
            display: flex; align-items: center; justify-content: space-between; padding-top: 4px;
        }

        .switch-label {
            display: flex; align-items: center; gap: 8px;
            font-size: 0.86rem; font-weight: 600; color: var(--text-dark);
        }

        .toggle-switch {
            position: relative; display: inline-block; width: 44px; height: 24px;
        }

        .toggle-switch input { opacity: 0; width: 0; height: 0; }

        .toggle-slider {
            position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
            background-color: #CBD5E1; transition: .2s; border-radius: 24px;
        }

        .toggle-slider:before {
            position: absolute; content: ""; height: 18px; width: 18px;
            left: 3px; bottom: 3px; background-color: white; transition: .2s; border-radius: 50%;
        }

        input:checked + .toggle-slider { background-color: var(--primary-blue); }
        input:checked + .toggle-slider:before { transform: translateX(20px); }

        .erase-distraction-row {
            display: flex; align-items: center; justify-content: space-between;
            padding: 10px 12px; background: #F8FAFC; border-radius: var(--radius-md);
            border: 1px dashed var(--border-color); margin-top: 4px;
        }

        .distraction-text {
            display: flex; align-items: center; gap: 8px;
            font-size: 0.8rem; font-weight: 600; color: var(--text-dark);
        }

        .canva-open-badge {
            padding: 4px 10px; border-radius: var(--radius-pill);
            background: linear-gradient(135deg, var(--canva-cyan) 0%, var(--canva-purple) 100%);
            color: #FFFFFF; font-size: 0.75rem; font-weight: 700;
            text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
            box-shadow: 0 2px 8px rgba(125, 42, 232, 0.3); cursor: pointer;
            transition: transform 0.15s ease; border: none;
        }

        .canva-open-badge:hover { transform: scale(1.05); }

        .side-disclaimer {
            font-size: 0.7rem; color: var(--text-muted); text-align: center;
            line-height: 1.4; margin-top: 4px;
        }

        .side-disclaimer a { color: var(--primary-blue); text-decoration: underline; }

        /* 2. BACKGROUND SIDE CARD */
        .background-side-card {
            flex: 0 0 260px;
            width: 260px;
            align-self: flex-start;
            max-height: 100%;
            overflow-y: auto;
            background: #FFFFFF;
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-color);
            box-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
            padding: 16px;
            padding-bottom: 80px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            animation: fadeIn 0.25s ease-out;
        }
        .background-side-card.hidden { display: none; }

        .bg-sub-tabs {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            background: transparent;
            padding: 0;
            gap: 8px;
            margin-bottom: 6px;
        }

        .bg-tab-btn {
            padding: 8px 18px;
            border-radius: 20px;
            border: none;
            background: transparent;
            color: #64748B;
            font-family: var(--font);
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s ease;
        }

        .bg-tab-btn:hover { color: var(--text-dark); }
        .bg-tab-btn.active {
            background: #F1F5F9;
            color: #0F172A;
            font-weight: 700;
            box-shadow: none;
        }

        .magic-banner-card {
            position: relative; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border-color);
        }

        .magic-banner-img { width: 100%; height: 120px; object-fit: cover; display: block; }

        .magic-match-badge {
            position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
            background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(4px);
            padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.72rem;
            font-weight: 700; color: var(--text-dark); display: flex; align-items: center; gap: 4px;
            border: 1px solid var(--border-color);
        }

        .magic-banner-close {
            position: absolute; top: 8px; right: 8px; width: 22px; height: 22px;
            border-radius: 50%; background: rgba(15, 23, 42, 0.6); color: #FFFFFF;
            border: none; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; cursor: pointer;
        }

        .magic-desc-box {
            background: #F8FAFC; border-radius: var(--radius-md); padding: 12px;
            border: 1px solid var(--border-color); font-size: 0.78rem; color: var(--text-sub); line-height: 1.45;
        }

        .magic-desc-box strong { color: var(--text-dark); }
        .magic-desc-box a { color: var(--primary-blue); font-weight: 600; text-decoration: none; }

        .photo-presets-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }

        .photo-thumb-btn {
            width: 100%; height: 72px; border-radius: 10px; border: 2px solid transparent;
            overflow: hidden; cursor: pointer; padding: 0; background: #E2E8F0; transition: all 0.15s ease;
        }

        .photo-thumb-btn:hover { transform: scale(1.05); border-color: var(--primary-blue); }
        .photo-thumb-btn.active { border-color: var(--primary-blue); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3); }
        .photo-thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }

        .color-grid-section { display: flex; flex-direction: column; gap: 12px; }
        .section-mini-title { font-size: 0.8rem; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.5px; }

        .solid-swatch-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
        .color-swatch-item { width: 100%; height: 38px; border-radius: 8px; border: 1px solid var(--border-color); cursor: pointer; transition: transform 0.15s ease; }
        .color-swatch-item:hover { transform: scale(1.1); }
        .color-swatch-item.active { border: 2px solid var(--primary-blue); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3); }

        .custom-color-picker-row {
            display: flex; align-items: center; justify-content: space-between;
            background: #F8FAFC; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 8px 12px; margin-top: 4px;
        }

        /* 3. EFFECTS SIDE CARD */
        .effects-side-card {
            flex: 0 0 260px;
            width: 260px;
            align-self: flex-start;
            max-height: 100%;
            overflow-y: auto;
            background: #FFFFFF;
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-color);
            box-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 20px;
            animation: fadeIn 0.25s ease-out;
        }
        .effects-side-card.hidden { display: none; }

        .fx-block-item { display: flex; flex-direction: column; gap: 10px; }
        .fx-header-switch { display: flex; align-items: center; justify-content: space-between; }
        .fx-title-text { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 600; color: var(--text-dark); }
        .beta-tag { font-size: 0.72rem; color: var(--text-sub); display: inline-flex; align-items: center; gap: 2px; }
        
        .fx-slider-row {
            display: flex; flex-direction: column; gap: 6px; transition: all 0.2s ease;
        }

        .fx-slider-row.disabled-state {
            opacity: 0.45;
            pointer-events: none;
        }

        .fx-slider-label { font-size: 0.78rem; color: var(--text-sub); font-weight: 500; }

        .fx-slider-input {
            -webkit-appearance: none; width: 100%; height: 6px;
            border-radius: 3px; background: #E2E8F0; outline: none;
        }

        .fx-slider-input::-webkit-slider-thumb {
            -webkit-appearance: none; width: 20px; height: 20px;
            border-radius: 50%; background: var(--primary-blue); cursor: pointer;
            box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
        }

        .fx-slider-input:disabled::-webkit-slider-thumb {
            background: #94A3B8;
            box-shadow: none;
            cursor: not-allowed;
        }

        .fx-reset-btn {
            width: 100%;
            padding: 10px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-color);
            background: #F8FAFC;
            color: var(--text-sub);
            font-family: var(--font);
            font-size: 0.82rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s ease;
        }

        .fx-reset-btn:hover {
            background: #F1F5F9;
            color: var(--text-dark);
        }

        /* Adjust Side Card */
        .adjust-side-card {
            flex: 0 0 260px;
            width: 260px;
            align-self: flex-start;
            max-height: 100%;
            overflow-y: auto;
            background: #FFFFFF;
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-color);
            box-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            animation: fadeIn 0.25s ease-out;
        }
        .adjust-side-card.hidden { display: none; }

        .adjust-section {
            display: flex; flex-direction: column; gap: 10px;
        }

        .adjust-section-title {
            display: flex; align-items: center; gap: 8px;
            font-size: 0.86rem; font-weight: 700; color: var(--text-dark);
            padding-bottom: 6px; border-bottom: 1px solid var(--border-color);
        }

        .adjust-slider-row {
            display: flex; flex-direction: column; gap: 4px;
        }

        .adjust-slider-label {
            font-size: 0.78rem; color: var(--text-sub); font-weight: 500;
        }

        .crop-ratio-row {
            display: flex; gap: 6px;
        }

        .crop-ratio-btn {
            flex: 1; padding: 8px 0; border-radius: 8px;
            border: 1px solid var(--border-color); background: #FFFFFF;
            font-family: var(--font); font-size: 0.78rem; font-weight: 600;
            color: var(--text-sub); cursor: pointer; transition: all 0.15s ease;
        }

        .crop-ratio-btn:hover { border-color: var(--primary-blue); color: var(--primary-blue); }
        .crop-ratio-btn.active {
            border: 2px solid var(--primary-blue); color: var(--primary-blue);
            background: rgba(37, 99, 235, 0.03);
        }

        .expand-color-row {
            display: flex; align-items: center; justify-content: space-between;
        }

        .expand-color-picker {
            width: 36px; height: 28px; border: 1px solid var(--border-color);
            border-radius: 6px; cursor: pointer; padding: 0;
        }

        /* Crop Overlay */
        .crop-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 50;
            cursor: crosshair;
        }

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

        .crop-box {
            position: absolute;
            border: 2px solid #FFFFFF;
            box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
            cursor: move;
        }

        .crop-handle {
            position: absolute;
            width: 12px;
            height: 12px;
            background: #FFFFFF;
            border: 2px solid var(--primary-blue);
            border-radius: 2px;
        }

        .crop-handle-nw { top: -6px; left: -6px; cursor: nw-resize; }
        .crop-handle-ne { top: -6px; right: -6px; cursor: ne-resize; }
        .crop-handle-sw { bottom: -6px; left: -6px; cursor: sw-resize; }
        .crop-handle-se { bottom: -6px; right: -6px; cursor: se-resize; }
        .crop-handle-n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
        .crop-handle-s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
        .crop-handle-w { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }
        .crop-handle-e { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }

        .crop-actions-bar {
            position: absolute;
            bottom: 12px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            align-items: center;
            gap: 6px;
            z-index: 100;
            background: rgba(15, 23, 42, 0.85);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            padding: 4px 8px;
            border-radius: var(--radius-pill);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.15);
            max-width: calc(100% - 16px);
        }

        .crop-action-btn {
            padding: 6px 14px;
            border-radius: var(--radius-pill);
            border: none;
            font-family: var(--font);
            font-size: 0.78rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.15s ease;
            white-space: nowrap;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .crop-apply-btn {
            background: var(--primary-blue);
            color: #FFFFFF;
            box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
        }

        .crop-apply-btn:hover {
            background: var(--primary-blue-hover);
        }

        .crop-cancel-btn {
            background: rgba(255, 255, 255, 0.12);
            color: #F8FAFC;
        }

        .crop-cancel-btn:hover {
            background: rgba(255, 255, 255, 0.22);
            color: #FFFFFF;
        }

        /* 5. DESIGN SIDE CARD */
        .design-side-card {
            flex: 0 0 260px;
            width: 260px;
            align-self: flex-start;
            max-height: 100%;
            overflow-y: auto;
            background: #FFFFFF;
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-color);
            box-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            animation: fadeIn 0.25s ease-out;
        }
        .design-side-card.hidden { display: none; }

        /* Text Input Group - uses same styling as adjust sliders */
        .text-input-group {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 6px;
        }

        .text-input-field {
            width: 100%;
            padding: 10px 14px;
            border: 2px solid var(--border-color);
            border-radius: var(--radius-md);
            font-size: 0.9rem;
            font-family: 'Inter', sans-serif;
            color: var(--text-dark);
            background: #FFFFFF;
            transition: all 0.2s ease;
        }

        .text-input-field:focus {
            outline: none;
            border-color: var(--primary-blue);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
        }

        .text-input-field::placeholder {
            color: #94A3B8;
        }

        /* Shape Size Number Input */
        .shape-size-input {
            width: 80px;
            padding: 6px 10px;
            border: 2px solid var(--border-color);
            border-radius: var(--radius-md);
            font-size: 0.9rem;
            font-family: 'Inter', sans-serif;
            font-weight: 600;
            color: var(--text-dark);
            background: #FFFFFF;
            text-align: center;
            transition: all 0.2s ease;
        }

        .shape-size-input:focus {
            outline: none;
            border-color: var(--primary-blue);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
        }

        /* Remove spinner arrows from number input */
        .shape-size-input::-webkit-outer-spin-button,
        .shape-size-input::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

        .shape-size-input {
            -moz-appearance: textfield;
        }

        /* Shapes Grid */
        .shapes-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 10px;
            margin-top: 8px;
            max-height: 200px;
            overflow-y: auto;
            padding: 2px;
        }
        
        .shapes-grid::-webkit-scrollbar {
            width: 6px;
        }
        
        .shapes-grid::-webkit-scrollbar-track {
            background: #F1F5F9;
            border-radius: 3px;
        }
        
        .shapes-grid::-webkit-scrollbar-thumb {
            background: #CBD5E1;
            border-radius: 3px;
        }
        
        .shapes-grid::-webkit-scrollbar-thumb:hover {
            background: #94A3B8;
        }

        .shape-item {
            aspect-ratio: 1;
            border-radius: 12px;
            overflow: hidden;
            cursor: pointer;
            border: 1px solid var(--border-color);
            transition: all 0.2s ease;
            background: #F8FAFC;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 8px;
        }

        .shape-item img {
            width: 75%;
            height: 75%;
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            transition: transform 0.2s ease;
        }

        .shape-item:hover {
            border-color: var(--primary-blue);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
            background: #FFFFFF;
        }

        /* Thumbnail History Carousel - Vertical Side Panel */
        .bottom-carousel-wrapper {
            flex: 0 0 60px;
            width: 60px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            padding: 10px 5px;
            background: #FFFFFF;
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-color);
            box-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
            align-self: flex-start;
            max-height: 100%;
            overflow-y: auto;
        }

        .bottom-carousel-wrapper.hidden { display: none !important; }

        .plus-upload-btn {
            width: 48px;
            height: 48px;
            flex-shrink: 0;
            border-radius: 10px;
            border: 2px dashed var(--border-color);
            background: #FFFFFF;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
        }

        .plus-upload-btn:hover {
            border-color: var(--primary-blue);
            background: #F8FAFC;
            transform: scale(1.05);
        }

        .plus-upload-btn svg { color: var(--text-muted); width: 16px; height: 16px; }

        .thumb-history-list {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            width: 100%;
        }

        .history-thumb-item {
            width: 48px;
            height: 48px;
            flex-shrink: 0;
            border-radius: 8px;
            overflow: hidden;
            cursor: pointer;
            border: 2px solid transparent;
            transition: all 0.2s ease;
            background: var(--bg-card);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        }

        .history-thumb-item:hover {
            transform: scale(1.08);
            box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
        }

        .history-thumb-item.active {
            border-color: var(--primary-blue);
            box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
        }

        .history-thumb-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .canva-action-row {
            display: flex; align-items: center; justify-content: space-between;
            padding: 12px 14px; background: #F8FAFC; border-radius: var(--radius-md);
            border: 1px solid var(--border-color); transition: all 0.15s ease;
        }

        .canva-action-row:hover { border-color: #CBD5E1; background: #FFFFFF; }

        .canva-row-title {
            display: flex; align-items: center; gap: 10px;
            font-size: 0.86rem; font-weight: 600; color: var(--text-dark);
        }

        /* REMOVE.BG STYLE LOADING OVERLAY */
        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(255, 255, 255, 0.85);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            gap: 20px;
        }

        .loading-overlay.active { display: flex; }

        /* Dark rounded card */
        .loading-dark-card {
            position: relative;
            width: 620px;
            height: 340px;
            background: #4B5563;
            border-radius: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        /* Floating sparkle/plus icons */
        .sparkle-icon {
            position: absolute;
            font-size: 28px;
            font-weight: 300;
            color: rgba(255, 255, 255, 0.25);
            font-family: Arial, sans-serif;
            animation: sparkleFloat 3s ease-in-out infinite;
            user-select: none;
        }

        .sparkle-1 { top: 12%; left: 8%; animation-delay: 0s; font-size: 22px; }
        .sparkle-2 { top: 25%; left: 22%; animation-delay: 0.4s; font-size: 18px; }
        .sparkle-3 { top: 8%; right: 15%; animation-delay: 0.8s; font-size: 26px; }
        .sparkle-4 { top: 30%; right: 8%; animation-delay: 1.2s; font-size: 20px; }
        .sparkle-5 { bottom: 20%; left: 10%; animation-delay: 0.3s; font-size: 24px; }
        .sparkle-6 { bottom: 30%; left: 25%; animation-delay: 0.7s; font-size: 16px; }
        .sparkle-7 { bottom: 15%; right: 20%; animation-delay: 1.0s; font-size: 22px; }
        .sparkle-8 { bottom: 25%; right: 10%; animation-delay: 0.5s; font-size: 18px; }
        .sparkle-9 { top: 50%; left: 5%; animation-delay: 1.4s; font-size: 20px; }
        .sparkle-10 { top: 45%; right: 5%; animation-delay: 0.2s; font-size: 24px; }
        .sparkle-11 { top: 15%; left: 45%; animation-delay: 0.9s; font-size: 16px; }
        .sparkle-12 { bottom: 10%; left: 45%; animation-delay: 1.1s; font-size: 20px; }

        @keyframes sparkleFloat {
            0%, 100% { opacity: 0.2; transform: scale(0.8) rotate(0deg); }
            50% { opacity: 0.5; transform: scale(1.1) rotate(180deg); }
        }

        /* Center brand */
        .loading-center-brand {
            display: flex;
            align-items: center;
            gap: 12px;
            z-index: 2;
        }

        .brand-icon {
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .brand-text {
            font-size: 28px;
            font-weight: 700;
            color: #D1D5DB;
            letter-spacing: -0.5px;
            font-family: 'Inter', sans-serif;
        }

        .brand-highlight {
            color: #6EE7B7;
        }

        /* Status text below card */
        .loading-status-text {
            font-size: 15px;
            font-weight: 600;
            color: #6B7280;
            margin: 0;
        }

        .toast-banner {
            position: fixed; bottom: 24px; right: 24px; background: #0F172A; color: #FFFFFF;
            padding: 14px 22px; border-radius: var(--radius-md); box-shadow: 0 10px 30px rgba(0,0,0,0.3);
            display: none; align-items: center; gap: 12px; z-index: 1000; font-size: 0.9rem; font-weight: 600;
            animation: fadeIn 0.2s ease-out;
        }

        .toast-banner.show { display: flex; }

        /* Bottom Carousel Thumbnail List (SCREENSHOT 14 MATCH) */
        .bottom-carousel-wrapper {
            display: none !important;
        }

        .bottom-carousel-wrapper.hidden { display: none !important; }

        .plus-upload-btn {
            width: 48px;
            height: 48px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-color);
            background: #FFFFFF;
            color: var(--text-sub);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: var(--shadow-subtle);
            transition: all 0.2s ease;
            flex-shrink: 0;
        }

        .plus-upload-btn:hover {
            border-color: var(--primary-blue);
            color: var(--primary-blue);
            transform: scale(1.05);
        }

        .thumb-history-list {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .history-thumb-item {
            position: relative;
            width: 48px;
            height: 48px;
            border-radius: var(--radius-md);
            padding: 2px;
            border: 1px solid var(--border-color);
            cursor: pointer;
            overflow: hidden;
            background: #FFFFFF;
            transition: all 0.2s ease;
        }

        .history-thumb-item.active {
            border: 2px solid var(--primary-blue);
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
        }

        .history-thumb-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 8px;
        }

        .thumb-badge-arrow {
            position: absolute;
            top: 2px;
            right: 2px;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: rgba(15, 23, 42, 0.85);
            color: #FFFFFF;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.55rem;
        }

        /* FLOATING DOWNLOAD BAR (MOBILE) */
        .floating-download-bar {
            display: none;
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            z-index: 500;
            background: rgba(255, 255, 255, 0.96);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border-top: 1px solid var(--border-color);
            padding: 12px 16px;
            padding-bottom: max(12px, env(safe-area-inset-bottom));
        }

        .floating-download-bar.show { display: block; }
        body:has(.floating-download-bar.show),
        body.has-download-bar {
            padding-bottom: 90px !important;
        }

        .floating-download-wrapper {
            position: relative;
            width: 100%;
        }

        .floating-download-btn {
            width: 100%;
            padding: 14px 24px;
            border-radius: var(--radius-pill);
            border: none;
            background: var(--primary-blue);
            color: #FFFFFF;
            font-family: var(--font);
            font-size: 1rem;
            font-weight: 700;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
            transition: all 0.2s ease;
        }

        .floating-download-btn:hover {
            background: var(--primary-blue-hover);
            transform: translateY(-1px);
        }

        .floating-download-btn:active {
            transform: translateY(0);
        }

        .floating-download-menu {
            position: absolute;
            bottom: calc(100% + 12px);
            left: 0;
            width: 100%;
            background: #FFFFFF;
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
            padding: 8px;
            display: none;
            flex-direction: column;
            gap: 4px;
            z-index: 600;
        }

        .floating-download-menu.show {
            display: flex;
            animation: slideUp 0.2s ease-out;
        }

        .hidden { display: none !important; }

        /* ========== RESPONSIVE MEDIA QUERIES ========== */

        /* Tablet and smaller desktops */
        @media (max-width: 900px) {
            body { padding: 12px 12px 40px 12px; }

            /* Hero layout stacks vertically */
            .initial-hero-container {
                flex-direction: column;
                align-items: center;
                text-align: center;
                gap: 30px;
                padding: 30px 10px 40px 10px;
            }
            .hero-left-col { align-items: center; max-width: 100%; }
            .hero-right-col { max-width: 100%; width: 100%; }
            .hero-main-title { font-size: 2.5rem; letter-spacing: -0.5px; }
            .hero-upload-card { padding: 40px 24px; min-height: 280px; }
            .hero-cutout-img-box { width: 180px; height: 180px; }

            /* Editor layout stays horizontal but side cards shrink */
            .editor-workspace-layout {
                flex-direction: row;
            }
            .magic-brush-side-card,
            .background-side-card,
            .effects-side-card,
            .adjust-side-card,
            .design-side-card {
                flex: 0 0 260px;
                width: 260px;
            }

            /* Toolbar scrollable on tablets */
            .top-toolbar { padding: 5px 8px; gap: 4px; }
            .tool-tab { padding: 7px 10px; font-size: 0.82rem; gap: 5px; }
        }

        /* Mobile phones */
        @media (max-width: 640px) {
            body { padding: 8px 8px 30px 8px; }

            /* Hero */
            .hero-main-title { font-size: 2rem; }
            .hero-subtitle { font-size: 1rem; gap: 6px; flex-wrap: wrap; justify-content: center; }
            .badge-free-blue { font-size: 0.9rem; padding: 3px 12px; }
            .hero-upload-card { padding: 28px 16px; min-height: 240px; border-radius: 24px; }
            .btn-hero-upload { padding: 14px 36px; font-size: 1.05rem; margin-bottom: 16px; }
            .hero-card-drop-text { font-size: 1rem; }
            .hero-cutout-img-box { width: 140px; height: 140px; border-radius: 20px; }

            /* Samples row wraps */
            .try-samples-container { flex-direction: column; align-items: flex-start; gap: 10px; }
            .sample-thumbs-row { gap: 8px; }
            .sample-thumb-btn { width: 44px; height: 44px; border-radius: 10px; }

        /* Mobile phones */
        @media (max-width: 640px) {
            body { padding: 8px 8px 80px 8px !important; }

            /* Hero */
            .hero-main-title { font-size: 2rem; }
            .hero-subtitle { font-size: 1rem; gap: 6px; flex-wrap: wrap; justify-content: center; }
            .badge-free-blue { font-size: 0.9rem; padding: 3px 12px; }
            .hero-upload-card { padding: 28px 16px; min-height: 240px; border-radius: 24px; }
            .btn-hero-upload { padding: 14px 36px; font-size: 1.05rem; margin-bottom: 16px; }
            .hero-card-drop-text { font-size: 1rem; }
            .hero-cutout-img-box { width: 140px; height: 140px; border-radius: 20px; }

            /* Samples row wraps */
            .try-samples-container { flex-direction: column; align-items: flex-start; gap: 10px; }
            .sample-thumbs-row { gap: 8px; }
            .sample-thumb-btn { width: 44px; height: 44px; border-radius: 10px; }

            /* Top Mobile Header (Matches Screenshot 2) */
            .top-toolbar-wrapper {
                margin-bottom: 0;
                width: 100%;
            }

            .top-toolbar {
                background: transparent;
                border: none;
                box-shadow: none;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                padding: 4px 2px;
                justify-content: center;
                width: 100%;
            }

            .tool-tabs-container,
            .download-btn-group {
                display: none !important;
            }

            .toolbar-actions-container {
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 6px;
                width: auto;
                margin: 0 auto;
            }

            .action-icon-btn { width: 34px; height: 34px; font-size: 0.9rem; flex-shrink: 0; }

            .mob-dl-circle-btn {
                display: flex !important;
                visibility: visible !important;
                opacity: 1 !important;
                pointer-events: auto !important;
                width: 36px;
                height: 36px;
                border-radius: 50%;
                background: var(--primary-blue);
                color: #FFFFFF;
                border: none;
                align-items: center;
                justify-content: center;
                box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
                flex-shrink: 0;
            }

            /* Sub-header Thumbnail Strip hidden on mobile for clean full canvas view */
            .mobile-sub-header-strip {
                display: none !important;
            }

            .mobile-add-btn {
                width: 42px;
                height: 42px;
                border-radius: 12px;
                border: 1px solid var(--border-color);
                background: #F8FAFC;
                color: var(--text-sub);
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                box-shadow: var(--shadow-subtle);
                transition: all 0.15s ease;
                flex-shrink: 0;
            }

            .mobile-thumb-item {
                position: relative;
                width: 42px;
                height: 42px;
                border-radius: 12px;
                border: 2px solid var(--primary-blue);
                background: #FFFFFF;
                box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
                flex-shrink: 0;
            }

            .mobile-thumb-img {
                width: 100%;
                height: 100%;
                object-fit: cover;
                border-radius: 9px;
            }

            .mobile-thumb-delete {
                position: absolute;
                top: -5px;
                right: -5px;
                width: 18px;
                height: 18px;
                border-radius: 50%;
                background: #0F172A;
                color: #FFFFFF;
                border: 1.5px solid #FFFFFF;
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                z-index: 10;
            }

            /* Mobile Bottom Navigation Toolbar (Matches Reference Screenshot 2) */
            .mobile-bottom-nav {
                display: none !important;
            }

            body:has(#editor-workspace-layout:not(.hidden)) .mobile-bottom-nav,
            .mobile-bottom-nav.show {
                display: flex !important;
                visibility: visible !important;
                opacity: 1 !important;
                pointer-events: auto !important;
                position: fixed;
                bottom: 0;
                left: 0;
                width: 100%;
                z-index: 500;
                background: #FFFFFF;
                border-top: 1px solid var(--border-color);
                align-items: center;
                justify-content: flex-start;
                padding: 6px 12px;
                padding-right: 32px;
                padding-bottom: max(6px, env(safe-area-inset-bottom));
                box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
                overflow-x: auto;
                overflow-y: hidden;
                scroll-behavior: smooth;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
            }
            .mobile-bottom-nav::-webkit-scrollbar {
                display: none !important;
            }

            .mobile-nav-item {
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 2px;
                border: none;
                background: transparent;
                color: var(--text-sub);
                font-family: var(--font);
                font-size: 0.70rem;
                font-weight: 600;
                cursor: pointer;
                flex: 0 0 auto;
                min-width: 60px;
                padding: 2px 4px;
                transition: all 0.15s ease;
            }

            .mobile-nav-item.active {
                color: var(--primary-blue);
            }

            .mob-nav-icon {
                display: flex;
                align-items: center;
                justify-content: center;
                width: 28px;
                height: 28px;
                border-radius: 50%;
                transition: all 0.15s ease;
                overflow: hidden;
            }

            .mob-icon-blue {
                background: var(--primary-blue);
                color: #FFFFFF;
                box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
            }

            .mob-icon-solid {
                width: 18px;
                height: 18px;
                background: var(--primary-blue);
                border-radius: 50%;
            }

            .mob-icon-bg-preview {
                width: 28px;
                height: 28px;
                border-radius: 50%;
                border: 1.5px solid var(--border-color);
                background-size: cover;
                background-position: center;
                box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
            }

            .mob-nav-scroll-arrow {
                position: fixed;
                right: 6px;
                bottom: 14px;
                width: 24px;
                height: 24px;
                border-radius: 50%;
                background: #FFFFFF;
                border: 1px solid var(--border-color);
                box-shadow: 0 2px 8px rgba(0,0,0,0.15);
                display: flex;
                align-items: center;
                justify-content: center;
                color: #475569;
                cursor: pointer;
                z-index: 510;
                transition: opacity 0.2s ease, transform 0.15s ease;
            }
            .mob-nav-scroll-arrow:hover {
                transform: scale(1.1);
                color: var(--primary-blue);
            }

        @media (max-width: 640px) {
            html, body {
                overflow: hidden !important;
                height: 100vh !important;
                width: 100vw !important;
                position: fixed !important;
                top: 0 !important;
                left: 0 !important;
                padding: 0 !important;
                margin: 0 !important;
            }

            .app-container {
                padding: 0 !important;
                margin: 0 !important;
                height: 100vh !important;
                width: 100vw !important;
                max-height: 100vh !important;
                display: flex !important;
                flex-direction: column !important;
                justify-content: space-between !important;
                overflow: hidden !important;
            }
            .editor-workspace-layout {
                flex-direction: column;
                align-items: center;
                justify-content: center !important;
                margin-top: 0 !important;
                width: 100%;
                height: calc(100vh - 48px - 56px);
                position: relative;
                overflow: hidden;
            }
            .workspace-card {
                width: fit-content !important;
                height: fit-content !important;
                max-width: 92vw;
                max-height: calc(100vh - 120px);
                margin: auto !important;
                border-radius: 18px;
                border: none !important;
                background-image: none !important;
                background: transparent !important;
                box-shadow: none !important;
                display: flex;
                align-items: center;
                justify-content: center;
                overflow: hidden;
                transition: all 0.22s ease-out;
            }
            .canvas-viewport {
                width: fit-content !important;
                height: fit-content !important;
                max-width: 100%;
                max-height: 100%;
                padding: 0 !important;
                border-radius: 18px;
                overflow: hidden;
                box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
                transition: all 0.22s ease-out;
            }
            #main-canvas {
                border-radius: 18px;
                display: block;
                max-width: 92vw;
                max-height: calc(100vh - 120px);
                object-fit: contain;
                transition: all 0.22s ease-out;
            }

            /* WHEN A TOOL DRAWER IS ACTIVE ON MOBILE: Anchor canvas rigidly to top area */
            body.has-active-drawer .editor-workspace-layout {
                position: fixed !important;
                top: 48px !important;
                left: 0 !important;
                width: 100vw !important;
                height: calc(100vh - 48px - 50vh - 54px) !important;
                display: flex !important;
                align-items: center !important;
                justify-content: center !important;
                margin: 0 !important;
                padding: 4px !important;
                z-index: 300 !important;
            }
            body.has-active-drawer .workspace-card {
                max-height: calc(100vh - 48px - 50vh - 60px) !important;
                max-width: 88vw !important;
                margin: auto !important;
            }
            body.has-active-drawer .canvas-viewport {
                max-height: calc(100vh - 48px - 50vh - 60px) !important;
                padding: 0 !important;
            }
            body.has-active-drawer #main-canvas {
                max-height: calc(100vh - 48px - 50vh - 60px) !important;
                max-width: 88vw !important;
            }

            /* Tool Side Cards as Mobile Bottom Sheets */
            .magic-brush-side-card,
            .background-side-card,
            .effects-side-card,
            .adjust-side-card,
            .design-side-card {
                position: fixed;
                bottom: 54px;
                left: 0;
                width: 100%;
                height: 50vh;
                max-height: 50vh;
                z-index: 600;
                background: rgba(255, 255, 255, 0.98);
                backdrop-filter: blur(16px);
                -webkit-backdrop-filter: blur(16px);
                border-radius: 24px 24px 0 0;
                border-top: 1px solid var(--border-color);
                box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
                padding: 14px 16px 20px 16px;
                overflow-y: auto;
                flex: unset;
                animation: slideUpSheet 0.22s ease-out;
            }

            .shapes-grid {
                grid-template-columns: repeat(4, 1fr) !important;
                gap: 8px !important;
                max-height: 180px !important;
            }
            .shape-item {
                border-radius: 10px !important;
                padding: 6px !important;
                background: #F8FAFC !important;
                border: 1px solid #E2E8F0 !important;
            }
            .shape-item img {
                width: 70% !important;
                height: 70% !important;
                object-fit: contain !important;
            }

            /* Sleek Close Button ✕ on Mobile Bottom Sheets */
            .sheet-close-btn {
                display: flex !important;
                visibility: visible !important;
                opacity: 1 !important;
                pointer-events: auto !important;
                position: absolute;
                top: 12px;
                right: 12px;
                width: 32px;
                height: 32px;
                border-radius: 50%;
                border: none;
                background: #F1F5F9;
                color: #64748B;
                font-size: 1.1rem;
                font-weight: 600;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                transition: all 0.15s ease;
                z-index: 20;
            }
            .sheet-close-btn:hover {
                background: #E2E8F0;
                color: #0F172A;
            }

            /* Hide heavy header box on mobile to save vertical space */
            .mb-header-box {
                display: none !important;
            }

            .magic-brush-side-card.hidden,
            .background-side-card.hidden,
            .effects-side-card.hidden,
            .adjust-side-card.hidden,
            .design-side-card.hidden {
                display: none !important;
            }

            /* Loading card shrinks to fit */
            .loading-dark-card {
                width: calc(100vw - 32px);
                max-width: 480px;
                height: 220px;
            }
            .brand-text { font-size: 22px; }
            .brand-icon svg { width: 30px; height: 30px; }
            .loading-status-text { font-size: 13px; }

            /* Compact floating crop bar on mobile */
            .crop-actions-bar {
                bottom: 8px;
                padding: 3px 6px;
                gap: 4px;
            }
            .crop-action-btn {
                padding: 5px 10px;
                font-size: 0.72rem;
            }
        }

        /* MOBILE DOWNLOAD OPTIONS MODAL */
        .mob-download-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            z-index: 900;
            display: flex;
            align-items: flex-end;
            justify-content: center;
        }
        .mob-download-modal.hidden {
            display: none !important;
        }

        .mob-download-backdrop {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(15, 23, 42, 0.45);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
        }

        .mob-download-content {
            position: relative;
            width: 100%;
            max-width: 480px;
            background: #FFFFFF;
            border-radius: 24px 24px 0 0;
            padding: 20px 20px 28px 20px;
            box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
            z-index: 910;
            animation: slideUpSheet 0.22s ease-out;
        }

        .mob-dl-modal-title {
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--text-dark);
            margin-bottom: 16px;
        }

        .mob-dl-options-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .mob-dl-option-btn {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 14px 16px;
            background: #F8FAFC;
            border: 1px solid var(--border-color);
            border-radius: 16px;
            cursor: pointer;
            transition: all 0.15s ease;
            text-align: left;
            width: 100%;
        }

        .mob-dl-option-btn:hover,
        .mob-dl-option-btn:active {
            background: #EFF6FF;
            border-color: var(--primary-blue);
        }

        .mob-dl-opt-name {
            font-size: 0.95rem;
            font-weight: 700;
            color: var(--text-dark);
            display: block;
        }

        .mob-dl-opt-desc {
            font-size: 0.78rem;
            color: var(--text-muted);
            display: block;
            margin-top: 2px;
        }

        /* Small phones */
        @media (max-width: 420px) {
            .hero-main-title { font-size: 1.7rem; letter-spacing: -0.3px; }
            .hero-subtitle { font-size: 0.92rem; }
            .btn-hero-upload { padding: 12px 28px; font-size: 0.95rem; }
            .photo-presets-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
            .photo-thumb-btn { height: 60px; }
            .solid-swatch-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
            .color-swatch-item { height: 32px; border-radius: 6px; }
        }