/* --- APPLE DESIGN SYSTEM & VARIABLES --- */
        :root {
            --bg-base: #000000;
            --bg-nav: rgba(0, 0, 0, 0.65);
            --bg-elevated: rgba(28, 28, 30, 0.6);
            --bg-modal: rgba(30, 30, 32, 0.75);
            
            --text-primary: #f5f5f7;
            --text-secondary: #86868b;
            
            --border-subtle: rgba(255, 255, 255, 0.08);
            --border-hover: rgba(255, 255, 255, 0.2);
            --border-focus: rgba(255, 255, 255, 0.4);
            
            --accent: #0A84FF;
            --accent-hover: #0070E0;
            
            --spring-easing: cubic-bezier(0.34, 1.56, 0.64, 1);
            --smooth-easing: cubic-bezier(0.16, 1, 0.3, 1);
        }

        * { box-sizing: border-box; margin: 0; padding: 0; }
        
        body { 
            background: var(--bg-base); 
            color: var(--text-primary); 
            font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
            -webkit-font-smoothing: antialiased;
            overflow-x: hidden;
            min-height: 100vh;
        }

        /* --- NAVIGATION --- */
        nav {
            position: sticky;
            top: 0;
            width: 100%;
            height: 64px;
            background: var(--bg-nav);
            backdrop-filter: blur(24px) saturate(180%);
            -webkit-backdrop-filter: blur(24px) saturate(180%);
            border-bottom: 1px solid var(--border-subtle);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 40px;
            z-index: 100;
        }

        .logo { 
            font-size: 19px; 
            font-weight: 600; 
            letter-spacing: -0.4px; 
            background: linear-gradient(180deg, #fff, #a1a1a6);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        display: flex; align-items: center;
}
        
        .add-btn {
            background: var(--text-primary);
            color: var(--bg-base);
            border: none;
            padding: 8px 18px;
            border-radius: 20px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: transform 0.2s var(--spring-easing), opacity 0.2s, filter 0.2s;
        }
        
        .add-btn:hover { filter: brightness(0.9); }
        .add-btn:active { transform: scale(0.94); }

        /* --- MAIN GALLERY --- */
        main { padding: 60px 40px; max-width: 1400px; margin: 0 auto; min-height: 100vh; }
        
        .header-title { margin-bottom: 48px; }
        .header-title h1 { 
            font-size: 48px; 
            font-weight: 700; 
            letter-spacing: -1.2px; 
            margin-bottom: 12px;
        }
        .header-title p { 
            color: var(--text-secondary); 
            font-size: 18px; 
            font-weight: 400; 
            letter-spacing: -0.2px;
        }

        .gallery {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
            gap: 32px;
        }

        /* --- COMPONENT CARDS (Premium Micro-Interactions) --- */
        @keyframes fadeInUp {
            0% { opacity: 0; transform: translateY(40px) scale(0.96); }
            100% { opacity: 1; transform: translateY(0) scale(1); }
        }

        .card {
            background: #1c1c1e; /* Solid background for much better performance */
            border: 1px solid var(--border-subtle);
            border-radius: 24px;
            overflow: hidden;
            position: relative;
            transition: transform 0.3s var(--smooth-easing), border-color 0.3s var(--smooth-easing), box-shadow 0.3s var(--smooth-easing); /* Animation setup for staggered load */
            opacity: 0;
            animation: fadeInUp 0.6s var(--spring-easing) forwards;
        }

        .card:hover {
            transform: translateY(-4px);
            border-color: var(--border-hover);
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
        }

        .preview-frame {
            width: 100%;
            height: 280px;
            border: none;
            background: #000;
            border-bottom: 1px solid var(--border-subtle);
            pointer-events: none; /* Isolates iframe so hover interactions on card work flawlessly */
}


    100% { opacity: 1; }
}

        .card-info {
            padding: 20px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .card-info h2 { 
            font-size: 16px; 
            font-weight: 600; 
            letter-spacing: -0.3px; 
        }
        
        /* Mac-Style Copy Button */
        .icon-btn {
            background: rgba(255, 255, 255, 0.08);
            border: none;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background 0.2s, transform 0.2s var(--spring-easing);
            color: var(--text-primary);
        }
        .icon-btn:hover { background: rgba(255, 255, 255, 0.18); transform: scale(1.1); }
        .icon-btn:active { transform: scale(0.9); }
        .icon-btn svg { width: 16px; height: 16px; fill: currentColor; }

        /* --- GLOBAL DRAG & DROP OVERLAY --- */
        #dragOverlay {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(10, 132, 255, 0.15);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            z-index: 9999;
            display: flex;
            justify-content: center;
            align-items: center;
            opacity: 0; visibility: hidden; pointer-events: none;
            transition: opacity 0.3s var(--smooth-easing), visibility 0.3s var(--smooth-easing);
            border: 4px dashed var(--accent);
            box-sizing: border-box;
        }
        #dragOverlay.active { opacity: 1; visibility: visible; pointer-events: auto; }
        
        .drag-message {
            background: var(--bg-modal);
            padding: 24px 48px;
            border-radius: 24px;
            font-size: 24px;
            font-weight: 700;
            color: var(--text-primary);
            box-shadow: 0 20px 40px rgba(0,0,0,0.5);
            pointer-events: none;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        /* --- MODAL (APPLE SHEET STYLE WITH SPRING) --- */
        .modal-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0, 0, 0, 0.5); /* Dimming background */
            display: flex; justify-content: center; align-items: center;
            opacity: 0; visibility: hidden; pointer-events: none; z-index: 1000;
            transition: opacity 0.4s var(--smooth-easing), visibility 0.4s var(--smooth-easing);
        }

        .modal-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }

        .modal-content {
            background: var(--bg-modal);
            backdrop-filter: blur(24px) saturate(180%); will-change: transform;
            -webkit-backdrop-filter: blur(24px) saturate(180%); will-change: transform;
            border: 1px solid var(--border-subtle);
            width: 100%; max-width: 680px;
            border-radius: 28px;
            padding: 36px;
            /* Apple Spring Animation */
            transform: translateY(80px) scale(0.95);
            transition: transform 0.6s var(--spring-easing), opacity 0.4s ease;
            box-shadow: 0 40px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
        }

        .modal-overlay.active .modal-content { transform: translateY(0) scale(1); }

        .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
        .modal-header h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.5px; }
        
        .close-btn { 
            background: rgba(255, 255, 255, 0.08); 
            border: none; 
            color: var(--text-secondary); 
            cursor: pointer; 
            width: 32px; height: 32px; 
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            transition: background 0.2s, color 0.2s;
        }
        .close-btn:hover { background: rgba(255, 255, 255, 0.15); color: var(--text-primary); }

        .input-group { margin-bottom: 20px; }
        .input-group label { 
            display: block; font-size: 13px; font-weight: 600; 
            color: var(--text-secondary); margin-bottom: 8px; 
            text-transform: uppercase; letter-spacing: 0.5px; 
        }
        
        .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

        input, textarea {
            width: 100%; 
            background: rgba(0, 0, 0, 0.3); 
            color: var(--text-primary);
            border: 1px solid var(--border-subtle); 
            padding: 16px;
            border-radius: 14px; 
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
            font-size: 14px; outline: none; 
            transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
        }
        
        input:focus, textarea:focus { 
            border-color: var(--border-focus); 
            background: rgba(0, 0, 0, 0.5);
            box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.15);
        }
        
        textarea { height: 140px; resize: none; line-height: 1.4; }
        
        /* Ultra-Smart Input Field */
        #smartPaste {
            height: 100px;
            border: 1px dashed var(--border-focus);
            background: rgba(10, 132, 255, 0.05);
        }
        #smartPaste:focus {
            border: 1px solid var(--accent);
            background: rgba(10, 132, 255, 0.1);
        }

        .submit-btn {
            width: 100%; background: var(--accent); color: white; border: none;
            padding: 16px; border-radius: 14px; font-size: 16px; font-weight: 600;
            cursor: pointer; transition: transform 0.2s var(--spring-easing), opacity 0.2s, filter 0.2s;
            margin-top: 12px;
        }
        .submit-btn:hover { filter: brightness(1.1); }
        .submit-btn:active { transform: scale(0.96); }

        .loader { color: var(--text-secondary); font-size: 15px; text-align: center; padding: 60px; grid-column: 1 / -1; }
    
/* --- WIZARD LOADER --- */
.page-loader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-base); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; transition: opacity 0.5s ease, visibility 0.5s;
}
.page-loader.hidden { opacity: 0; visibility: hidden; }
.scene { display: flex; transform: scale(0.7); }
.wizard { position: relative; width: 190px; height: 240px; }
.wizard-body { position: absolute; bottom: 0; left: 68px; height: 100px; width: 60px; background: #3f64ce; }
.wizard-body::after { content: ''; position: absolute; bottom: 0; left: 20px; height: 100px; width: 60px; background: #3f64ce; transform: skewX(14deg); }
.right-arm { position: absolute; bottom: 74px; left: 110px; height: 44px; width: 90px; background: #3f64ce; border-radius: 22px; transform-origin: 16px 22px; transform: rotate(70deg); animation: right_arm 10s ease-in-out infinite; }
.right-arm .right-hand { position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 50%; background: #f1c5b4; transform-origin: center center; transform: rotate(-40deg); animation: right_hand 10s ease-in-out infinite; }
.right-arm .right-hand::after { content: ''; position: absolute; right: 0px; top: -8px; width: 15px; height: 30px; border-radius: 10px; background: #f1c5b4; transform: translateY(16px); animation: right_finger 10s ease-in-out infinite; }
.left-arm { position: absolute; bottom: 74px; left: 26px; height: 44px; width: 70px; background: #3f64ce; border-bottom-left-radius: 8px; transform-origin: 60px 26px; transform: rotate(-70deg); animation: left_arm 10s ease-in-out infinite; }
.left-arm .left-hand { position: absolute; left: -18px; top: 0; width: 18px; height: 30px; border-top-left-radius: 35px; border-bottom-left-radius: 35px; background: #f1c5b4; }
.left-arm .left-hand::after { content: ''; position: absolute; right: 0; top: 0; width: 30px; height: 15px; border-radius: 20px; background: #f1c5b4; transform-origin: right bottom; transform: scaleX(0); animation: left_finger 10s ease-in-out infinite; }
.head { position: absolute; top: 0; left: 14px; width: 160px; height: 210px; transform-origin: center center; transform: rotate(-3deg); animation: head 10s ease-in-out infinite; }
.head .beard { position: absolute; bottom: 0; left: 38px; height: 106px; width: 80px; border-bottom-right-radius: 55%; background: var(--bg-base); }
.head .beard::after { content: ''; position: absolute; top: 16px; left: -10px; width: 40px; height: 20px; border-radius: 20px; background: var(--bg-base); }
.head .face { position: absolute; bottom: 76px; left: 38px; height: 30px; width: 60px; background: #f1c5b4; }
.head .face::before { content: ''; position: absolute; top: 0px; left: 40px; width: 20px; height: 40px; border-bottom-right-radius: 20px; border-bottom-left-radius: 20px; background: #f1c5b4; }
.head .face::after { content: ''; position: absolute; top: 16px; left: -10px; width: 50px; height: 20px; border-radius: 20px; border-bottom-right-radius: 0px; background: var(--bg-base); }
.head .face .adds { position: absolute; top: 0px; left: -10px; width: 40px; height: 20px; border-radius: 20px; background: #f1c5b4; }
.head .face .adds::after { content: ''; position: absolute; top: 5px; left: 80px; width: 15px; height: 20px; border-bottom-right-radius: 20px; border-top-right-radius: 20px; background: #f1c5b4; }
.head .hat { position: absolute; bottom: 106px; left: 0; width: 160px; height: 20px; border-radius: 20px; background: #3f64ce; }
.head .hat::before { content: ''; position: absolute; top: -70px; left: 50%; transform: translatex(-50%); width: 0; height: 0; border-style: solid; border-width: 0 34px 70px 50px; border-color: transparent transparent #3f64ce transparent; }
.head .hat::after { content: ''; position: absolute; top: 0; left: 0; width: 160px; height: 20px; background: #3f64ce; border-radius: 20px; }
.head .hat .hat-of-the-hat { position: absolute; bottom: 78px; left: 79px; width: 0; height: 0; border-style: solid; border-width: 0 25px 25px 19px; border-color: transparent transparent #3f64ce transparent; }
.head .hat .hat-of-the-hat::after { content: ''; position: absolute; top: 6px; left: -4px; width: 35px; height: 10px; border-radius: 10px; border-bottom-left-radius: 0px; background: #3f64ce; transform: rotate(40deg); }
.head .hat .four-point-star { position: absolute; width: 12px; height: 12px; }
.head .hat .four-point-star::after, .head .hat .four-point-star::before { content: ''; position: absolute; background: var(--bg-base); display: block; left: 0; width: 141.4213%; top: 0; bottom: 0; border-radius: 10%; transform: rotate(66.66deg) skewX(45deg); }
.head .hat .four-point-star::after { transform: rotate(156.66deg) skew(45deg); }
.head .hat .four-point-star.--first { bottom: 28px; left: 46px; }
.head .hat .four-point-star.--second { bottom: 40px; left: 80px; }
.head .hat .four-point-star.--third { bottom: 15px; left: 108px; }
@keyframes right_arm { 0% { transform: rotate(70deg); } 10% { transform: rotate(8deg); } 15% { transform: rotate(20deg); } 20% { transform: rotate(10deg); } 25% { transform: rotate(26deg); } 30% { transform: rotate(10deg); } 35% { transform: rotate(28deg); } 40% { transform: rotate(9deg); } 45% { transform: rotate(28deg); } 50% { transform: rotate(8deg); } 58% { transform: rotate(74deg); } 62% { transform: rotate(70deg); } }
@keyframes left_arm { 0% { transform: rotate(-70deg); } 10% { transform: rotate(6deg); } 15% { transform: rotate(-18deg); } 20% { transform: rotate(5deg); } 25% { transform: rotate(-18deg); } 30% { transform: rotate(5deg); } 35% { transform: rotate(-17deg); } 40% { transform: rotate(5deg); } 45% { transform: rotate(-18deg); } 50% { transform: rotate(6deg); } 58% { transform: rotate(-74deg); } 62% { transform: rotate(-70deg); } }
@keyframes right_hand { 0% { transform: rotate(-40deg); } 10% { transform: rotate(-20deg); } 15% { transform: rotate(-5deg); } 20% { transform: rotate(-60deg); } 25% { transform: rotate(-0deg); } 30% { transform: rotate(-60deg); } 35% { transform: rotate(-0deg); } 40% { transform: rotate(-40deg); } 45% { transform: rotate(-60deg); } 50% { transform: rotate(10deg); } 60% { transform: rotate(-40deg); } }
@keyframes right_finger { 0% { transform: translateY(16px); } 10% { transform: none; } 50% { transform: none; } 60% { transform: translateY(16px); } }
@keyframes left_finger { 0% { transform: scaleX(0); } 10% { transform: scaleX(1) rotate(6deg); } 15% { transform: scaleX(1) rotate(0deg); } 20% { transform: scaleX(1) rotate(8deg); } 25% { transform: scaleX(1) rotate(0deg); } 30% { transform: scaleX(1) rotate(7deg); } 35% { transform: scaleX(1) rotate(0deg); } 40% { transform: scaleX(1) rotate(5deg); } 45% { transform: scaleX(1) rotate(0deg); } 50% { transform: scaleX(1) rotate(6deg); } 58% { transform: scaleX(0); } }
@keyframes head { 0% { transform: rotate(-3deg); } 10% { transform: translatex(10px) rotate(7deg); } 50% { transform: translatex(0px) rotate(0deg); } 56% { transform: rotate(-3deg); } }
.objects { position: relative; width: 200px; height: 240px; }
.square { position: absolute; bottom: -60px; left: -5px; width: 120px; height: 120px; border-radius: 50%; transform: rotate(-360deg); animation: path_square 10s ease-in-out infinite; }
.square::after { content: ''; position: absolute; top: 10px; left: 0; width: 50px; height: 50px; background: #9ab3f5; }
.circle { position: absolute; bottom: 10px; left: 0; width: 100px; height: 100px; border-radius: 50%; transform: rotate(-360deg); animation: path_circle 10s ease-in-out infinite; }
.circle::after { content: ''; position: absolute; bottom: -10px; left: 25px; width: 50px; height: 50px; border-radius: 50%; background: #c56183; }
.triangle { position: absolute; bottom: -62px; left: -10px; width: 110px; height: 110px; border-radius: 50%; transform: rotate(-360deg); animation: path_triangle 10s ease-in-out infinite; }
.triangle::after { content: ''; position: absolute; top: 0; right: -10px; width: 0; height: 0; border-style: solid; border-width: 0 28px 48px 28px; border-color: transparent transparent #89beb3 transparent; }
@keyframes path_circle { 0% { transform: translateY(0); } 10% { transform: translateY(-100px) rotate(-5deg); } 55% { transform: translateY(-100px) rotate(-360deg); } 58% { transform: translateY(-100px) rotate(-360deg); } 63% { transform: rotate(-360deg); } }
@keyframes path_square { 0% { transform: translateY(0); } 10% { transform: translateY(-155px) translatex(-15px) rotate(10deg); } 55% { transform: translateY(-155px) translatex(-15px) rotate(-350deg); } 57% { transform: translateY(-155px) translatex(-15px) rotate(-350deg); } 63% { transform: rotate(-360deg); } }
@keyframes path_triangle { 0% { transform: translateY(0); } 10% { transform: translateY(-172px) translatex(10px) rotate(-10deg); } 55% { transform: translateY(-172px) translatex(10px) rotate(-365deg); } 58% { transform: translateY(-172px) translatex(10px) rotate(-365deg); } 63% { transform: rotate(-360deg); } }
.wizard-progress { position: relative; margin-top: 60px; width: 300px; height: 8px; background: rgba(255,255,255,0.1); border-radius: 8px; overflow: hidden; }
.wizard-progress::after { content: ''; position: absolute; top: 0; left: 0; width: 0; height: 100%; background: #3f64ce; animation: progress 10s linear infinite; }
@keyframes progress { from { width: 0; } to { width: 100%; } }

/* --- CONTEXT MENU --- */
.context-menu {
    position: absolute;
    z-index: 10000;
    width: 220px;
    background: rgba(30, 30, 32, 0.75);
    backdrop-filter: blur(24px) saturate(180%); will-change: transform;
    -webkit-backdrop-filter: blur(24px) saturate(180%); will-change: transform;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 16px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transform-origin: top left;
    transition: opacity 0.15s ease, transform 0.15s var(--spring-easing), visibility 0.15s;
}

.context-menu.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.context-menu-item {
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.1s;
}

.context-menu-item:hover {
    background: var(--accent);
    color: white;
}

.context-menu-item.danger {
    color: #ff453a;
}
.context-menu-item.danger:hover {
    background: #ff453a;
    color: white;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 0;
}

.icon-btn.copied {
    color: #32d74b !important;
}
.icon-btn.copied svg { fill: none !important; stroke: currentColor; 
    animation: checkmarkBounce 0.4s var(--spring-easing) forwards;
}
@keyframes checkmarkBounce {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* --- SEARCH BAR --- */
.main-search-container {
    position: absolute; left: 50%; transform: translateX(-50%);
    display: flex; justify-content: center; margin-top: 0; z-index: 10;
}
.main-search {
    position: relative; display: flex; align-items: center;
    background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px; padding: 0 16px; width: 260px; height: 40px;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.main-search:focus-within {
    width: 420px; background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 16px 40px rgba(0,0,0,0.4), 0 0 0 4px rgba(10, 132, 255, 0.2);
    transform: translateY(0);
}
.main-search svg {
    width: 20px; height: 20px; color: var(--text-sub);
    transition: color 0.4s, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); flex-shrink: 0;
}
.main-search:focus-within svg { color: #0a84ff; transform: scale(1.1) rotate(5deg); }
.main-search input {
    background: transparent; border: none; outline: none; color: white;
    font-size: 15px; font-family: inherit; width: 100%; margin-left: 12px;
    opacity: 0.7; transition: opacity 0.3s; box-shadow: none !important;
}
.main-search input:focus {
    box-shadow: none !important; background: transparent !important;
}
.main-search:focus-within input { opacity: 1; }
.main-search input::placeholder { color: rgba(255,255,255,0.3); }

/* Ensure card animations trigger smoothly */
@keyframes scaleInSearch {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}







.card.card-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    transform: scale(0.95) !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    border: none !important;
}
