        :root {
            --color-bg-primary: #0b0f19;
            --color-bg-secondary: #131b2e;
            --color-bg-tertiary: #1e293b;
            --color-accent: #6366f1;
            --color-accent-hover: #4f46e5;
            --color-success: #10b981;
            --color-warning: #f59e0b;
            --color-danger: #ef4444;
            --color-text-primary: #f8fafc;
            --color-text-secondary: #94a3b8;
            --color-border: #334155;
            --color-glass-bg: rgba(19, 27, 46, 0.7);
            --color-glass-border: rgba(255, 255, 255, 0.08);
            --font-primary: 'Inter', sans-serif;
            --font-heading: 'Outfit', sans-serif;
            --sidebar-width: 440px;
            --topbar-height: 70px;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            user-select: none;
            -webkit-user-drag: none;
        }

        body {
            font-family: var(--font-primary);
            background-color: var(--color-bg-primary);
            color: var(--color-text-primary);
            overflow: hidden;
            height: 100vh;
            display: flex;
            flex-direction: column;
        }

        /* Loading Overlay */
        .global-loader {
            position: fixed;
            inset: 0;
            background: var(--color-bg-primary);
            z-index: 9999;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            transition: opacity 0.5s ease;
        }

        .spinner {
            width: 50px;
            height: 50px;
            border: 4px solid var(--color-border);
            border-top: 4px solid var(--color-accent);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 20px;
        }

        .loader-text {
            font-family: var(--font-heading);
            font-size: 1.1rem;
            color: var(--color-text-primary);
            font-weight: 500;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Top bar Header */
        header {
            height: var(--topbar-height);
            background: var(--color-glass-bg);
            backdrop-filter: blur(12px);
            border-bottom: 1px solid var(--color-glass-border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 24px;
            z-index: 100;
        }

        .logo-section {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .logo-section h1 {
            font-family: var(--font-heading);
            font-size: 1.25rem;
            font-weight: 700;
            letter-spacing: -0.5px;
            background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .logo-badge {
            background: rgba(99, 102, 241, 0.15);
            color: var(--color-accent);
            border: 1px solid rgba(99, 102, 241, 0.3);
            font-size: 0.75rem;
            font-weight: 600;
            padding: 2px 8px;
            border-radius: 9999px;
            text-transform: uppercase;
        }

        .header-actions {
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-family: var(--font-heading);
            font-weight: 600;
            font-size: 0.9rem;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            border: 1px solid transparent;
            text-decoration: none;
        }

        .btn-secondary {
            background: rgba(255, 255, 255, 0.05);
            color: var(--color-text-primary);
            border-color: var(--color-border);
        }

        .btn-secondary:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: #475569;
        }

        .btn-primary {
            background: var(--color-accent);
            color: #ffffff;
            box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
        }

        .btn-primary:hover {
            background: var(--color-accent-hover);
            transform: translateY(-1px);
        }

        .btn-danger {
            background: rgba(239, 68, 68, 0.1);
            color: var(--color-danger);
            border-color: rgba(239, 68, 68, 0.3);
        }

        .btn-danger:hover {
            background: rgba(239, 68, 68, 0.2);
        }

        /* Workspace Main Layout */
        .studio-container {
            display: flex;
            flex: 1;
            overflow: hidden;
            position: relative;
        }

        /* Interactive Canvas Arena */
        .workspace-viewport {
            flex: 1;
            background-color: #080b13;
            background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
            background-size: 24px 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            position: relative;
            padding: 32px 24px;
        }

        @media (min-width: 1280px) {
            .workspace-viewport {
                padding: 28px 32px;
            }

            .frame-wrapper-3d {
                max-width: min(78vw, 920px);
                max-height: min(82vh, 780px);
            }
        }

        @media (min-width: 1600px) {
            .workspace-viewport {
                padding: 24px 40px;
            }

            .frame-wrapper-3d {
                max-width: min(80vw, 1040px);
            }
        }

        /* Room Wall Visualizer Mockups */
        .room-backdrop {
            position: absolute;
            inset: 0;
            background-size: cover;
            background-position: center;
            transition: background-image 0.5s ease-in-out, opacity 0.5s ease;
            opacity: 0;
            z-index: 1;
        }

        .room-backdrop.active {
            opacity: 0.65;
        }

        /* Interactive Bounding Frame Wrap */
        .frame-wrapper-3d {
            position: relative;
            z-index: 5;
            transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
            overflow: visible;
        }

        /* 2.5D Matte Border & Lip */
        .frame-bevel-border {
            position: relative;
            padding: 0px;
            transition: all 0.3s ease;
            box-sizing: border-box;
            background: transparent;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: visible;
        }

        /* Frame molding thickness (50% of previous 24px) */
        :root {
            --frame-border-width: 12px;
        }

        /* Frame molding texture (photo frame material only) */
        .frame-texture-ring {
            position: absolute;
            top: calc(-1 * var(--frame-border-width));
            left: calc(-1 * var(--frame-border-width));
            right: calc(-1 * var(--frame-border-width));
            bottom: calc(-1 * var(--frame-border-width));
            width: auto;
            height: auto;
            pointer-events: none;
            z-index: 25;
            box-sizing: border-box;
            opacity: 0;
            transition: opacity 0.25s ease;
        }

        .frame-texture-ring.visible {
            opacity: 1;
        }

        .frame-bevel-border.border-wood {
            box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
        }

        .frame-bevel-border.border-acrylic {
            box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15), inset 0 0 20px rgba(255, 255, 255, 0.08);
        }

        .frame-bevel-border.border-canvas {
            box-shadow: inset 8px 0 12px rgba(0, 0, 0, 0.35), inset -8px 0 12px rgba(0, 0, 0, 0.35);
        }

        .frame-bevel-border.border-rolled {
            border: 2px solid #cbd5e1;
        }

        .print-size-section {
            margin-top: 16px;
            padding-top: 14px;
            border-top: 1px solid var(--color-border);
        }

        .custom-size-row {
            display: grid;
            grid-template-columns: 1fr auto 1fr auto;
            gap: 8px;
            align-items: center;
            margin-top: 8px;
        }

        .custom-size-x {
            color: var(--color-text-muted);
            font-size: 0.85rem;
            text-align: center;
        }

        .btn-secondary-sm {
            padding: 8px 10px;
            font-size: 0.75rem;
            border-radius: 6px;
            border: 1px solid var(--color-border);
            background: rgba(255, 255, 255, 0.06);
            color: var(--color-text);
            cursor: pointer;
            white-space: nowrap;
        }

        .btn-secondary-sm:hover {
            border-color: var(--color-accent);
            color: var(--color-accent);
        }

        /* Ambient Occlusion Drop Shadow */
        .ambient-shadow {
            filter: drop-shadow(0 15px 30px rgba(0,0,0,0.6));
        }

        /* Glass Specular Glare (for Acrylic) */
        .specular-glare {
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 10;
            opacity: 0;
            background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.03) 40%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.05) 100%);
            transition: opacity 0.3s ease;
        }

        .specular-glare.active {
            opacity: 1;
        }

        /* Acrylic Corner Stud Mounts */
        .acrylic-stud {
            position: absolute;
            width: 14px;
            height: 14px;
            background: radial-gradient(circle at 35% 35%, #e2e8f0 0%, #94a3b8 50%, #475569 100%);
            border-radius: 50%;
            box-shadow: inset 0 1px 1px rgba(255,255,255,0.8), 0 2px 4px rgba(0,0,0,0.6);
            z-index: 11;
            display: none;
        }

        .stud-tl { top: 12px; left: 12px; }
        .stud-tr { top: 12px; right: 12px; }
        .stud-bl { bottom: 12px; left: 12px; }
        .stud-br { bottom: 12px; right: 12px; }

        /* The Live Fabric.js interactive wrapper */
        .fabric-canvas-container {
            position: relative;
            background: #ffffff;
            box-shadow: inset 0 0 10px rgba(0,0,0,0.15);
            overflow: hidden;
        }

        /* Canvas Wrap Bevel Simulation */
        .canvas-wrap-bevel {
            position: absolute;
            inset: 0;
            border: 1px solid rgba(0,0,0,0.08);
            box-shadow: inset 0 8px 12px rgba(255,255,255,0.15), inset 0 -8px 12px rgba(0,0,0,0.25);
            pointer-events: none;
            z-index: 8;
            display: none;
        }

        /* Right Hand Studio Command Sidebar */
        .studio-sidebar {
            width: var(--sidebar-width);
            background: var(--color-bg-secondary);
            border-left: 1px solid var(--color-border);
            display: flex;
            flex-direction: column;
            z-index: 20;
            overflow-y: auto;
            position: relative;
        }

        /* Customizer Sidebar Panels & Tabs */
        .sidebar-tabs {
            display: flex;
            border-bottom: 1px solid var(--color-border);
            background: rgba(15, 23, 42, 0.4);
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .tab-btn {
            flex: 1;
            padding: 14px 0;
            background: transparent;
            border: none;
            color: var(--color-text-secondary);
            font-family: var(--font-heading);
            font-weight: 600;
            font-size: 0.8rem;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            transition: all 0.2s ease;
            border-bottom: 2px solid transparent;
        }

        .tab-btn .material-icons-outlined {
            font-size: 1.25rem;
        }

        .tab-btn:hover {
            color: var(--color-text-primary);
        }

        .tab-btn.active {
            color: var(--color-accent);
            border-bottom-color: var(--color-accent);
            background: rgba(99, 102, 241, 0.04);
        }

        .sidebar-panel {
            padding: 24px;
            display: none;
        }

        .sidebar-panel.active {
            display: block;
        }

        .panel-title {
            font-family: var(--font-heading);
            font-size: 1.15rem;
            font-weight: 700;
            margin-bottom: 8px;
            color: var(--color-text-primary);
        }

        .panel-description {
            font-size: 0.85rem;
            color: var(--color-text-secondary);
            margin-bottom: 20px;
            line-height: 1.4;
        }

        /* Option Grid Cards */
        .option-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            margin-bottom: 20px;
        }

        .option-card {
            background: var(--color-bg-tertiary);
            border: 2px solid var(--color-border);
            border-radius: 10px;
            padding: 12px;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            text-align: center;
        }

        .option-card:hover {
            border-color: #475569;
            transform: translateY(-1px);
        }

        .option-card.active {
            border-color: var(--color-accent);
            background: rgba(99, 102, 241, 0.08);
        }

        .option-card-icon {
            font-size: 1.75rem;
            color: var(--color-text-secondary);
        }

        .option-card.active .option-card-icon {
            color: var(--color-accent);
        }

        .option-card-title {
            font-family: var(--font-heading);
            font-weight: 600;
            font-size: 0.85rem;
            color: var(--color-text-primary);
        }

        .option-card-thumb {
            width: 100%;
            max-width: 72px;
            height: 48px;
            object-fit: cover;
            border-radius: 6px;
            border: 1px solid var(--color-border);
        }

        /* Standard Dropdowns / Select Blocks */
        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            display: block;
            font-family: var(--font-heading);
            font-size: 0.85rem;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--color-text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .form-select, .form-input {
            width: 100%;
            background: var(--color-bg-tertiary);
            border: 1px solid var(--color-border);
            color: var(--color-text-primary);
            padding: 12px;
            border-radius: 8px;
            font-family: var(--font-primary);
            font-size: 0.95rem;
            outline: none;
            transition: border-color 0.2s ease;
        }

        .form-select:focus, .form-input:focus {
            border-color: var(--color-accent);
        }

        /* Upload Container */
        .upload-zone {
            border: 2px dashed var(--color-border);
            border-radius: 12px;
            padding: 30px 20px;
            text-align: center;
            cursor: pointer;
            transition: all 0.25s ease;
            background: rgba(30, 41, 59, 0.3);
            margin-bottom: 20px;
        }

        .upload-zone:hover,
        .upload-zone.drag-over {
            border-color: var(--color-accent);
            background: rgba(99, 102, 241, 0.05);
        }

        .upload-icon {
            font-size: 2.5rem;
            color: var(--color-text-secondary);
            margin-bottom: 12px;
        }

        .upload-headline {
            font-family: var(--font-heading);
            font-size: 0.95rem;
            font-weight: 600;
            margin-bottom: 4px;
        }

        .upload-sub {
            font-size: 0.75rem;
            color: var(--color-text-secondary);
        }

        /* Upload Multi List */
        .upload-multi-list {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
            margin-bottom: 20px;
        }

        .upload-thumb {
            width: 100%;
            aspect-ratio: 1;
            border-radius: 6px;
            border: 1px solid var(--color-border);
            background-size: cover;
            background-position: center;
            position: relative;
            cursor: pointer;
        }

        .upload-thumb-delete {
            position: absolute;
            top: -4px;
            right: -4px;
            width: 18px;
            height: 18px;
            background: var(--color-danger);
            color: #fff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
            font-weight: 900;
            cursor: pointer;
        }

        /* Real-Time Quality Analyzer Widget */
        .quality-widget {
            background: rgba(15, 23, 42, 0.5);
            border: 1px solid var(--color-border);
            border-radius: 10px;
            padding: 16px;
            margin-bottom: 20px;
            display: none;
        }

        .quality-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 10px;
        }

        .quality-badge {
            font-size: 0.75rem;
            font-weight: 700;
            padding: 3px 8px;
            border-radius: 4px;
            text-transform: uppercase;
        }

        .badge-excellent { background: rgba(16, 185, 129, 0.15); color: var(--color-success); border: 1px solid rgba(16, 185, 129, 0.3); }
        .badge-good { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); border: 1px solid rgba(245, 158, 11, 0.3); }
        .badge-poor { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); border: 1px solid rgba(239, 68, 68, 0.3); }

        .quality-metric {
            font-size: 0.8rem;
            color: var(--color-text-secondary);
            margin-bottom: 6px;
        }

        .quality-metric strong {
            color: var(--color-text-primary);
        }

        .quality-advice {
            font-size: 0.8rem;
            line-height: 1.4;
            color: var(--color-text-secondary);
            border-top: 1px solid var(--color-border);
            padding-top: 10px;
            margin-top: 10px;
        }

        /* AI tools & layouts */
        .ai-tools-group {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 20px;
        }

        .ai-btn {
            background: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(168,85,247,0.15) 100%);
            border: 1px solid rgba(168,85,247,0.3);
            color: #d8b4fe;
            padding: 12px;
            border-radius: 8px;
            font-family: var(--font-heading);
            font-weight: 600;
            font-size: 0.85rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            transition: all 0.25s ease;
        }

        .ai-btn:hover:not(:disabled) {
            background: linear-gradient(135deg, rgba(99,102,241,0.25) 0%, rgba(168,85,247,0.25) 100%);
            border-color: rgba(168,85,247,0.5);
            transform: translateY(-1px);
        }

        .ai-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .auto-collage-section {
            background: rgba(30, 41, 59, 0.2);
            border: 1px solid var(--color-border);
            border-radius: 8px;
            padding: 12px;
            margin-top: 10px;
            display: none;
        }

        /* Layers List UI */
        .layer-list-container {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-bottom: 20px;
        }

        .layer-row {
            background: var(--color-bg-tertiary);
            border: 1px solid var(--color-border);
            border-radius: 6px;
            padding: 8px 12px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .layer-row-info {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.85rem;
            font-weight: 500;
        }

        .layer-row-actions {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .layer-action-btn {
            background: transparent;
            border: none;
            color: var(--color-text-secondary);
            cursor: pointer;
            font-size: 1.1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.15s ease;
        }

        .layer-action-btn:hover {
            color: var(--color-text-primary);
        }

        .layer-action-btn.active {
            color: var(--color-accent);
        }

        .layer-slider-container {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            margin-top: 6px;
            border-top: 1px solid rgba(255,255,255,0.05);
            padding-top: 6px;
        }

        .layer-slider-label {
            font-size: 0.75rem;
            color: var(--color-text-secondary);
            min-width: 50px;
        }

        .layer-opacity-slider {
            flex: 1;
            height: 4px;
            background: var(--color-border);
            border-radius: 2px;
            outline: none;
            -webkit-appearance: none;
        }

        .layer-opacity-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--color-accent);
            cursor: pointer;
        }

        /* Typography Presets and effects */
        .color-presets-row {
            display: flex;
            gap: 8px;
            margin-top: 8px;
        }

        .color-preset-circle {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            border: 1px solid rgba(255,255,255,0.2);
            cursor: pointer;
            transition: transform 0.15s ease;
        }

        .color-preset-circle:hover {
            transform: scale(1.1);
        }

        .gold-foil-preset {
            background: linear-gradient(135deg, #BF953F 0%, #FCF6BA 25%, #B38728 50%, #FBF5B7 75%, #AA771C 100%);
            border: 1px solid rgba(255,255,255,0.3);
            border-radius: 8px;
            padding: 12px;
            text-align: center;
            font-family: var(--font-heading);
            font-weight: 700;
            font-size: 0.85rem;
            color: #5c4033;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 4px 10px rgba(176, 137, 40, 0.2);
        }

        .gold-foil-preset:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 14px rgba(176, 137, 40, 0.3);
        }

        /* Dynamic Curvature Arc controller */
        .curvature-panel {
            background: rgba(30, 41, 59, 0.2);
            border: 1px solid var(--color-border);
            border-radius: 8px;
            padding: 12px;
            margin-top: 10px;
        }

        /* Sticky Footer Bar with Pricing and checkout triggers */
        .studio-footer {
            padding: 20px 24px;
            background: rgba(15, 23, 42, 0.8);
            border-top: 1px solid var(--color-border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: auto;
            position: sticky;
            bottom: 0;
        }

        .price-display {
            display: flex;
            flex-direction: column;
        }

        .price-label {
            font-size: 0.75rem;
            color: var(--color-text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 2px;
        }

        .price-value-row {
            display: flex;
            align-items: flex-end;
            flex-wrap: wrap;
            gap: 12px;
        }

        .price-block {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .price-meta {
            font-size: 0.65rem;
            color: var(--color-text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .price-checkout-note {
            margin: 8px 0 0;
            font-size: 0.7rem;
            line-height: 1.35;
            color: var(--color-text-secondary);
        }

        .price-current {
            font-family: var(--font-heading);
            font-size: 1.6rem;
            font-weight: 800;
            color: var(--color-text-primary);
        }

        .price-original {
            font-size: 1rem;
            color: var(--color-text-secondary);
            text-decoration: line-through;
        }

        .price-saving {
            font-size: 0.75rem;
            font-weight: 700;
            background: rgba(16, 185, 129, 0.15);
            color: var(--color-success);
            padding: 2px 6px;
            border-radius: 4px;
        }

        /* Size benchmark widget */
        .benchmark-overlay {
            position: absolute;
            bottom: 24px;
            left: 24px;
            background: var(--color-glass-bg);
            backdrop-filter: blur(8px);
            border: 1px solid var(--color-glass-border);
            padding: 8px 14px;
            border-radius: 8px;
            font-size: 0.75rem;
            color: var(--color-text-primary);
            z-index: 10;
            display: flex;
            align-items: center;
            gap: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        }

        .benchmark-sofa {
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: min(720px, 90vw);
            height: 200px;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.5s ease;
            z-index: 2;
        }

        .benchmark-sofa::before {
            content: '';
            position: absolute;
            left: 50%;
            bottom: 18px;
            transform: translateX(-50%);
            width: 78%;
            height: 72px;
            border-radius: 28px 28px 12px 12px;
            background: linear-gradient(180deg, rgba(71, 85, 105, 0.55) 0%, rgba(30, 41, 59, 0.85) 100%);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
        }

        .benchmark-sofa::after {
            content: '';
            position: absolute;
            left: 50%;
            bottom: 0;
            transform: translateX(-50%);
            width: 88%;
            height: 28px;
            border-radius: 6px;
            background: rgba(15, 23, 42, 0.75);
        }

        .benchmark-sofa.active {
            opacity: 0.95;
        }

        /* Toast notifications */
        .toast {
            position: fixed;
            bottom: 30px;
            right: 30px;
            background: var(--color-bg-secondary);
            border-left: 4px solid var(--color-accent);
            padding: 16px 24px;
            border-radius: 8px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.5);
            z-index: 1000;
            display: flex;
            align-items: center;
            gap: 12px;
            transform: translateY(100px);
            opacity: 0;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        .toast.show {
            transform: translateY(0);
            opacity: 1;
        }

        .toast-icon {
            font-size: 1.25rem;
            color: var(--color-accent);
        }

        .toast-text {
            font-size: 0.85rem;
            font-weight: 500;
        }

        /* Mobile specific layouts */
        @media (max-width: 1024px) {
            body {
                overflow-y: auto;
                height: auto;
            }

            header {
                padding: 0 16px;
            }

            .studio-container {
                flex-direction: column;
                height: auto;
            }

            .workspace-viewport {
                height: 50vh;
                padding: 20px;
            }

            .studio-sidebar {
                width: 100%;
                border-left: none;
                border-top: 1px solid var(--color-border);
                overflow-y: visible;
            }

            .sidebar-tabs {
                position: relative;
            }

            .studio-footer {
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                z-index: 150;
            }

            .sidebar-panel {
                padding-bottom: 120px;
            }

            .benchmark-overlay {
                display: none;
            }
        }

/* =================================================================
   DYNAMIC THEME: DECOR STUDIO vs PLAYFUL BIRTHDAY THEME
   ================================================================= */

/* Decor Studio Mode (Default Premium Dark Vibe) */
body.decor-studio-theme {
    background-color: #0b0f19;
    color: #f1f5f9;
}

body.decor-studio-theme .studio-sidebar {
    background: rgba(15, 23, 42, 0.7);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

body.decor-studio-theme .option-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

body.decor-studio-theme .option-card.active {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.15);
}

/* Birthday Mode (Playful, Colorful, Lighter Vibe) */
body.birthday-theme {
    background: linear-gradient(135deg, #fff5f5 0%, #fff0f6 50%, #f0f4ff 100%);
    background-color: #fff8f8;
    color: #2d3748;
}

body.birthday-theme header {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(244, 114, 182, 0.2);
    box-shadow: 0 4px 20px rgba(244, 114, 182, 0.08);
}

body.birthday-theme .logo-badge {
    background: linear-gradient(135deg, #f472b6 0%, #3b82f6 100%);
    color: #ffffff;
}

body.birthday-theme .workspace-viewport {
    background: radial-gradient(circle, rgba(255,245,245,1) 0%, rgba(254,243,199,0.3) 100%);
}

body.birthday-theme .studio-sidebar {
    background: rgba(255, 255, 255, 0.9);
    border-left: 1px solid rgba(244, 114, 182, 0.2);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.03);
    color: #374151;
}

body.birthday-theme .sidebar-panel {
    color: #4b5563;
}

body.birthday-theme .panel-title {
    color: #ec4899; /* Playful Pink */
    font-family: 'Outfit', 'Poppins', sans-serif;
    font-weight: 700;
}

body.birthday-theme .form-label {
    color: #4f46e5;
}

body.birthday-theme .option-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    color: #4b5563;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.birthday-theme .option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(244, 114, 182, 0.15);
    border-color: #f472b6;
}

body.birthday-theme .option-card.active {
    border-color: #ec4899;
    background: rgba(236, 72, 153, 0.05);
    color: #ec4899;
}

body.birthday-theme .option-card.active .option-card-icon {
    color: #ec4899;
}

body.birthday-theme .btn-primary {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    border: none;
    border-radius: 9999px;
    box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
}

body.birthday-theme .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
}

body.birthday-theme .btn-secondary {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    color: #4b5563;
}

body.birthday-theme .btn-secondary:hover {
    background: #fdf2f8;
    border-color: #f472b6;
    color: #ec4899;
}

body.birthday-theme .upload-zone {
    border: 2px dashed #f472b6;
    background: rgba(253, 242, 248, 0.5);
    border-radius: 20px;
}

body.birthday-theme .upload-zone:hover {
    background: rgba(253, 242, 248, 0.8);
    border-color: #ec4899;
}

body.birthday-theme .upload-icon {
    color: #ec4899;
}

body.birthday-theme .form-select, body.birthday-theme .form-input {
    border-radius: 12px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
}

body.birthday-theme .form-select:focus, body.birthday-theme .form-input:focus {
    border-color: #ec4899;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
}

body.birthday-theme .studio-footer {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(244, 114, 182, 0.15);
}

body.birthday-theme .price-saving {
    background: rgba(236, 72, 153, 0.1);
    color: #ec4899;
    border-radius: 9999px;
}

body.birthday-theme .quality-widget {
    background: rgba(243, 244, 246, 0.6);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

body.birthday-theme .sidebar-tabs {
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
}

body.birthday-theme .tab-btn {
    border-radius: 12px;
    margin: 4px;
    color: #6b7280;
}

body.birthday-theme .tab-btn.active {
    background: rgba(236, 72, 153, 0.08);
    color: #ec4899;
}

/* Mug designer — 8.5×3.5 wrap, mobile-first tools */
body.mug-editor-mode {
    --mug-ink: #0f172a;
    --mug-gold: #b8860b;
    --mug-gold-bright: #d4af37;
    --mug-studio: #efeae3;
    --mug-header-h: 56px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f6f4f0;
    color: var(--mug-ink);
    overflow: auto;
    height: auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Hide frame-studio chrome that fights the mug editor */
body.mug-editor-mode .studio-sidebar,
body.mug-editor-mode #material-panel,
body.mug-editor-mode #frame-panel,
body.mug-editor-mode #room-panel,
body.mug-editor-mode .theme-selector,
body.mug-editor-mode #btn-checkout,
body.mug-editor-mode .right-panel,
body.mug-editor-mode .config-sidebar,
body.mug-editor-mode #right-sidebar,
body.mug-editor-mode .size-catalog,
body.mug-editor-mode #upload-size-selector,
body.mug-editor-mode .print-size-grid,
body.mug-editor-mode .room-backdrop,
body.mug-editor-mode .benchmark-sofa,
body.mug-editor-mode .acrylic-stud,
body.mug-editor-mode .frame-texture-ring,
body.mug-editor-mode .specular-glare {
    display: none !important;
}

/* Compact light header */
body.mug-editor-mode header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--mug-header-h);
    min-height: var(--mug-header-h);
    background: #fff;
    color: var(--mug-ink);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    backdrop-filter: none;
    padding: 0 12px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
body.mug-editor-mode .logo-section {
    gap: 8px;
    min-width: 0;
}
body.mug-editor-mode .logo-section h1 {
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: var(--mug-ink);
    color: var(--mug-ink);
    white-space: nowrap;
}
body.mug-editor-mode .mug-editor-back {
    color: #475569;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    margin-right: 4px;
    padding: 8px 4px;
    line-height: 1.2;
    white-space: nowrap;
}
body.mug-editor-mode .mug-editor-back:hover {
    color: var(--mug-ink);
}
body.mug-editor-mode .header-actions {
    gap: 8px;
}
body.mug-editor-mode #mug-undo,
body.mug-editor-mode #mug-redo {
    min-height: 44px;
    min-width: 44px;
    padding: 0 14px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mug-ink);
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    box-shadow: none;
}

/* Stage: wide short 8.5×3.5 wrap, not a tall poster */
body.mug-editor-mode .studio-container {
    flex-direction: column;
    flex: 0 0 auto;
    height: auto;
    overflow: visible;
}
body.mug-editor-mode .workspace-viewport {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    max-height: 38vh;
    background: var(--mug-studio);
    background-image: none;
    padding: 16px 14px 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
body.mug-editor-mode .frame-wrapper-3d,
body.mug-editor-mode .frame-bevel-border {
    width: min(94vw, calc(38vh * 8.5 / 3.5));
    max-width: 100%;
    max-height: calc(38vh - 28px);
    aspect-ratio: 8.5 / 3.5;
    height: auto;
    box-shadow: none;
    filter: none;
}
body.mug-editor-mode .ambient-shadow {
    filter: drop-shadow(0 10px 24px rgba(15, 23, 42, 0.12));
}
body.mug-editor-mode #canvas-bounds,
body.mug-editor-mode .fabric-canvas-container,
body.mug-editor-mode .canvas-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 8.5 / 3.5;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06), 0 12px 28px rgba(15, 23, 42, 0.1);
    overflow: hidden;
}
body.mug-editor-mode .benchmark-overlay {
    display: flex;
    align-items: center;
    gap: 6px;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.92);
    color: var(--mug-ink);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
}
body.mug-editor-mode .benchmark-overlay .material-icons-outlined {
    color: var(--mug-gold) !important;
}

/* Tool bar: sticky under header, horizontal scroll, 48px targets */
body.mug-editor-mode .mug-editor-dock {
    display: flex;
    flex-direction: column;
    width: 100%;
}
body.mug-editor-mode .mug-tool-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    position: sticky;
    top: var(--mug-header-h);
    z-index: 30;
}
body.mug-editor-mode .mug-tool-bar::-webkit-scrollbar {
    display: none;
}
body.mug-editor-mode .mug-tool-bar button,
body.mug-editor-mode .mug-sheet button,
body.mug-editor-mode .mug-upload-btn,
body.mug-editor-mode .mug-link {
    flex: 0 0 auto;
    min-height: 48px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    padding: 0 14px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--mug-ink);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
body.mug-editor-mode .mug-tool-bar button.is-active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

/* Sheets: comfortable type, 16px inputs (no iOS zoom), full-width labels */
body.mug-editor-mode .mug-sheet {
    padding: 16px 16px 20px;
    background: #fff;
    font-size: 1rem;
    line-height: 1.45;
}
body.mug-editor-mode .mug-sheet[hidden] {
    display: none !important;
}
body.mug-editor-mode .mug-row,
body.mug-editor-mode .mug-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}
body.mug-editor-mode .mug-hint,
body.mug-editor-mode .mug-quality {
    color: #475569;
    font-size: 0.95rem;
    margin: 10px 0;
}
body.mug-editor-mode .mug-quality.is-low { color: #b45309; }
body.mug-editor-mode .mug-quality.is-excellent { color: #15803d; }
body.mug-editor-mode .mug-sheet label {
    display: block;
    width: 100%;
    margin: 12px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mug-ink);
}
body.mug-editor-mode .mug-sheet label.mug-upload-btn {
    display: flex;
    width: 100%;
    min-height: 52px;
    margin: 0 0 8px;
    background: #111827;
    color: #fff;
    border-color: #111827;
    font-size: 1.05rem;
    font-weight: 700;
}
body.mug-editor-mode #mug-phrases {
    max-height: 220px;
    overflow: auto;
}
body.mug-editor-mode .mug-sheet input[type="text"],
body.mug-editor-mode .mug-sheet input[type="number"],
body.mug-editor-mode .mug-sheet input[type="email"],
body.mug-editor-mode .mug-sheet input[type="search"],
body.mug-editor-mode .mug-sheet input[type="tel"],
body.mug-editor-mode .mug-sheet input:not([type]),
body.mug-editor-mode .mug-sheet select,
body.mug-editor-mode .mug-sheet textarea {
    display: block;
    width: 100%;
    min-height: 48px;
    margin-top: 6px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 16px; /* iOS: avoid input zoom */
    color: var(--mug-ink);
    background: #fff;
    box-sizing: border-box;
}
body.mug-editor-mode .mug-sheet input[type="range"] {
    width: 100%;
    margin-top: 10px;
    min-height: 44px;
}
body.mug-editor-mode .mug-sheet input[type="color"] {
    width: 100%;
    min-height: 48px;
    margin-top: 6px;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    background: #fff;
}
body.mug-editor-mode .mug-layers {
    list-style: none;
    margin: 0;
    padding: 0;
}
body.mug-editor-mode .mug-layers li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    font-size: 0.95rem;
}
body.mug-editor-mode .mug-layers li span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.mug-editor-mode .mug-layer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}
body.mug-editor-mode .mug-layers .mug-layer-btn {
    min-height: 36px;
    padding: 0 8px;
    font-size: 0.8rem;
}
body.mug-editor-mode #mug-mini-preview {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    background: #f6f4f0;
}
body.mug-editor-mode .mug-element-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    max-height: 320px;
    overflow: auto;
    margin: 8px 0 12px;
}
body.mug-editor-mode .mug-sheet .mug-element-card {
    width: 100%;
    min-height: 76px;
    flex-direction: column;
    gap: 4px;
    padding: 6px 4px;
    font-size: 0.72rem;
    line-height: 1.15;
    white-space: normal;
}
body.mug-editor-mode .mug-element-card img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    pointer-events: none;
}
body.mug-editor-mode #mug-element-cats button.is-active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

/* Sticky CTA in document flow (not a fixed overlay over tools) */
body.mug-editor-mode .mug-cta-bar {
    position: sticky;
    bottom: 0;
    z-index: 25;
    margin-top: auto;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.06);
}
body.mug-editor-mode .mug-primary {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--mug-gold-bright), var(--mug-gold));
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(184, 134, 11, 0.28);
}
body.mug-editor-mode .mug-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #111827;
    color: #fff;
    border-color: #111827;
    cursor: pointer;
    width: 100%;
}
body.mug-editor-mode .mug-link {
    width: 100%;
}

/* Desktop: canvas on the left, tools in a right column */
@media (min-width: 1024px) {
    body.mug-editor-mode {
        --mug-header-h: 60px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 420px;
        grid-template-rows: auto minmax(0, 1fr);
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }
    body.mug-editor-mode header {
        grid-column: 1 / -1;
        padding: 0 28px;
    }
    body.mug-editor-mode .studio-container {
        grid-column: 1;
        grid-row: 2;
        min-height: 0;
        height: 100%;
        overflow: hidden;
    }
    body.mug-editor-mode .workspace-viewport {
        max-height: none;
        height: 100%;
        padding: 24px;
    }
    body.mug-editor-mode .frame-wrapper-3d,
    body.mug-editor-mode .frame-bevel-border {
        width: min(100%, calc((100dvh - 140px) * 8.5 / 3.5));
        max-height: calc(100dvh - 140px);
    }
    body.mug-editor-mode .mug-editor-dock {
        grid-column: 2;
        grid-row: 2;
        min-height: 0;
        display: flex;
        flex-direction: column;
        background: #fff;
        border-left: 1px solid rgba(15, 23, 42, 0.08);
        overflow: hidden;
    }
    body.mug-editor-mode .mug-tool-bar {
        position: static;
        width: 100%;
        max-width: none;
        margin: 0;
        border: 0;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 0;
        box-shadow: none;
        flex-wrap: wrap;
        overflow: visible;
    }
    body.mug-editor-mode .mug-sheet {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        width: 100%;
        max-width: none;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 16px 18px 20px;
    }
    body.mug-editor-mode .mug-cta-bar {
        position: static;
        width: 100%;
        max-width: none;
        margin: 0;
        border: 0;
        border-top: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 0;
        box-shadow: none;
    }
    body.mug-editor-mode .mug-sheet label.mug-upload-btn {
        width: 100%;
    }
    body.mug-editor-mode .mug-link {
        width: 100%;
    }
}
