:root {
            --primary-color: #6e48aa;
            --secondary-color: #9d50bb;
            --glass-color: rgba(255, 255, 255, 0.2);
            --text-color: #333;
            --bg-color: #f5f5f5;
            --card-bg: rgba(255, 255, 255, 0.8);
            --shadow-color: rgba(0, 0, 0, 0.1);
        }

        .dark {
            --primary-color: #9d50bb;
            --secondary-color: #6e48aa;
            --glass-color: rgba(0, 0, 0, 0.2);
            --text-color: #f0f0f0;
            --bg-color: #121212;
            --card-bg: rgba(30, 30, 30, 0.8);
            --shadow-color: rgba(0, 0, 0, 0.3);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            transition: all 0.3s ease;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg-color);
            color: var(--text-color);
            min-height: 100vh;
            background-image: radial-gradient(circle at 10% 20%, rgba(110, 72, 170, 0.1) 0%, transparent 20%), 
                              radial-gradient(circle at 90% 80%, rgba(157, 80, 187, 0.1) 0%, transparent 20%);
            overflow-x: hidden;
        }

        /* Glassmorphism effect */
        .glass {
            background: var(--glass-color);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border-radius: 16px;
            box-shadow: 0 4px 30px var(--shadow-color);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 5%;
            position: relative;
            z-index: 10;
        }

        h1 {
            font-size: 2rem;
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            text-shadow: 0 2px 4px var(--shadow-color);
            animation: glow 2s ease-in-out infinite alternate;
        }

        @keyframes glow {
            from {
                text-shadow: 0 0 5px rgba(110, 72, 170, 0.5);
            }
            to {
                text-shadow: 0 0 15px rgba(157, 80, 187, 0.8);
            }
        }

        #theme-switcher {
            background: transparent;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--text-color);
            transition: transform 0.3s;
        }

        #theme-switcher:hover {
            transform: rotate(30deg) scale(1.1);
        }

        main {
            padding: 20px 5%;
            position: relative;
            z-index: 5;
        }

        .input-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin: 20px 0;
            gap: 15px;
        }

        #prompt-input {
            width: 100%;
            max-width: 600px;
            padding: 15px 20px;
            border-radius: 50px;
            border: none;
            background: var(--card-bg);
            color: var(--text-color);
            font-size: 1rem;
            box-shadow: 0 4px 15px var(--shadow-color);
            transition: all 0.3s;
        }

        #prompt-input:focus {
            outline: none;
            box-shadow: 0 4px 20px rgba(157, 80, 187, 0.3);
            transform: scale(1.02);
        }

        #generate-btn {
            padding: 15px 30px;
            border-radius: 50px;
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
            color: white;
            border: none;
            cursor: pointer;
            font-size: 1rem;
            font-weight: bold;
            box-shadow: 0 4px 15px rgba(110, 72, 170, 0.4);
            transition: all 0.3s;
            position: relative;
            overflow: hidden;
            width: 100%;
            max-width: 600px;
        }

        #generate-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 20px rgba(110, 72, 170, 0.6);
        }

        #generate-btn:active {
            transform: translateY(1px);
        }

        #generate-btn::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            transform: translateX(-100%);
            transition: transform 0.6s;
        }

        #generate-btn:hover::after {
            transform: translateX(100%);
        }

        .options {
            display: flex;
            justify-content: center;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 20px;
            padding: 15px;
            width: 100%;
            max-width: 600px;
        }

        select {
            padding: 12px 15px;
            border-radius: 50px;
            border: none;
            background: var(--card-bg);
            color: var(--text-color);
            font-size: 0.9rem;
            box-shadow: 0 4px 10px var(--shadow-color);
            cursor: pointer;
            transition: all 0.3s;
            appearance: none;
            background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
            background-repeat: no-repeat;
            background-position: right 12px center;
            background-size: 1em;
            flex: 1;
            min-width: 120px;
        }

        select:focus {
            outline: none;
            box-shadow: 0 4px 15px rgba(157, 80, 187, 0.3);
        }

        #loading-container {
            display: none;
            margin: 40px 0;
            text-align: center;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 1000;
            background: rgba(0, 0, 0, 0.8);
            padding: 30px;
            border-radius: 20px;
            width: 90%;
            max-width: 400px;
        }

        .loading-animation {
            display: inline-block;
            position: relative;
            width: 120px;
            height: 120px;
        }

        .loading-animation div {
            position: absolute;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: var(--primary-color);
            animation: loading 1.2s linear infinite;
        }

        .loading-animation div:nth-child(1) {
            top: 12px;
            left: 12px;
            animation-delay: 0s;
        }
        .loading-animation div:nth-child(2) {
            top: 12px;
            left: 48px;
            animation-delay: -0.4s;
        }
        .loading-animation div:nth-child(3) {
            top: 12px;
            left: 84px;
            animation-delay: -0.8s;
        }
        .loading-animation div:nth-child(4) {
            top: 48px;
            left: 12px;
            animation-delay: -0.4s;
        }
        .loading-animation div:nth-child(5) {
            top: 48px;
            left: 48px;
            animation-delay: -0.8s;
        }
        .loading-animation div:nth-child(6) {
            top: 48px;
            left: 84px;
            animation-delay: -1.2s;
        }
        .loading-animation div:nth-child(7) {
            top: 84px;
            left: 12px;
            animation-delay: -0.8s;
        }
        .loading-animation div:nth-child(8) {
            top: 84px;
            left: 48px;
            animation-delay: -1.2s;
        }
        .loading-animation div:nth-child(9) {
            top: 84px;
            left: 84px;
            animation-delay: -1.6s;
        }

        @keyframes loading {
            0%, 100% {
                transform: scale(1);
                opacity: 1;
            }
            50% {
                transform: scale(0.5);
                opacity: 0.5;
            }
        }

        #loading-container p {
            color: white;
            font-size: 1.2rem;
            margin-top: 20px;
            font-weight: bold;
        }

        .gallery-section {
            margin-top: 20px;
        }

        .gallery-date {
            color: var(--text-color);
            margin: 20px 0 10px;
            font-size: 1.1rem;
            font-weight: bold;
        }

        .gallery-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            gap: 15px;
            margin-bottom: 30px;
        }

        @media (min-width: 768px) {
            .gallery-grid {
                grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
                gap: 20px;
            }
        }

        .gallery-item {
            position: relative;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 15px var(--shadow-color);
            transition: all 0.3s;
            aspect-ratio: 1/1;
            background: var(--card-bg);
        }

        .gallery-item:hover {
            transform: translateY(-5px) scale(1.02);
            box-shadow: 0 8px 20px rgba(110, 72, 170, 0.3);
        }

        .gallery-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: all 0.5s;
        }

        .gallery-item:hover img {
            transform: scale(1.05);
        }

        .gallery-item::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(to bottom, transparent 60%, rgba(0, 0, 0, 0.7));
            opacity: 0;
            transition: opacity 0.3s;
            z-index: 1;
        }

        .gallery-item:hover::before {
            opacity: 1;
        }

        .gallery-item .prompt-text {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            padding: 12px;
            color: white;
            font-size: 0.8rem;
            transform: translateY(100%);
            transition: transform 0.3s;
            z-index: 2;
            opacity: 0;
        }

        .gallery-item:hover .prompt-text {
            transform: translateY(0);
            opacity: 1;
        }

        .gallery-item .view-btn {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0.8);
            background: rgba(255, 255, 255, 0.9);
            color: var(--primary-color);
            border: none;
            padding: 6px 12px;
            border-radius: 50px;
            font-weight: bold;
            cursor: pointer;
            opacity: 0;
            transition: all 0.3s;
            z-index: 2;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
            font-size: 0.8rem;
        }

        .gallery-item:hover .view-btn {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }

        #preview-container {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            z-index: 100;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.3s;
        }

        #preview-container.show {
            opacity: 1;
        }

        #preview-content {
            position: relative;
            max-width: 90%;
            max-height: 90%;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        #preview-image {
            max-width: 100%;
            max-height: 80vh;
            border-radius: 10px;
            box-shadow: 0 0 30px rgba(157, 80, 187, 0.5);
            animation: float 6s ease-in-out infinite;
        }

        @keyframes float {
            0%, 100% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-20px);
            }
        }

        .preview-controls {
            display: flex;
            gap: 15px;
            margin-top: 20px;
        }

        .preview-btn {
            padding: 12px 25px;
            border-radius: 50px;
            border: none;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        #download-btn {
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
            color: white;
        }

        #download-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(110, 72, 170, 0.6);
        }

        #close-preview {
            background: rgba(255, 255, 255, 0.1);
            color: white;
            border: 1px solid rgba(255, 255, 255, 0.3);
        }

        #close-preview:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        /* Floating particles background */
        .particles {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            overflow: hidden;
        }

        .particle {
            position: absolute;
            background: rgba(157, 80, 187, 0.5);
            border-radius: 50%;
            animation: float-particle linear infinite;
        }

        @keyframes float-particle {
            to {
                transform: translateY(-100vh);
            }
        }

        /* Gallery controls */
        .gallery-controls {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .tab-buttons {
            display: flex;
            gap: 10px;
        }

        .tab-btn {
            padding: 8px 16px;
            border-radius: 20px;
            background: var(--card-bg);
            border: none;
            cursor: pointer;
            transition: all 0.3s;
        }

        .tab-btn.active {
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
            color: white;
        }

        /* Disabled state */
        .disabled {
            opacity: 0.6;
            pointer-events: none;
        }

        /* Hidden elements */
        .hidden {
            display: none !important;
        }

        /* Watermark - embedded in image */
        .watermarked {
            position: relative;
        }

        .watermarked::after {
            content: "creepyfy";
            position: absolute;
            bottom: 8px;
            right: 8px;
            color: rgba(255, 255, 255, 0.3);
            font-size: 10px;
            font-family: Arial, sans-serif;
            pointer-events: none;
        }

        /* Navigation buttons */
        #prev-btn, #next-btn {
            position: fixed;
            top: 50%;
            transform: translateY(-50%);
            background-color: rgba(0, 0, 0, 0.5);
            color: white;
            border: none;
            border-radius: 50%;
            width: 50px;
            height: 50px;
            font-size: 24px;
            cursor: pointer;
            z-index: 1001;
            display: none;
            opacity: 0;
            transition: opacity 0.3s;
        }

        #prev-btn {
            left: 20px;
        }

        #next-btn {
            right: 20px;
        }

        #prev-btn:hover, #next-btn:hover {
            background-color: rgba(0, 0, 0, 0.8);
            transform: translateY(-50%) scale(1.1);
        }

        #preview-container:hover #prev-btn,
        #preview-container:hover #next-btn {
            opacity: 1;
        }

        /* Spinner styles */
        #spinner {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--bg-color);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 9999;
            opacity: 1;
            transition: opacity 0.5s ease-out;
        }

        #spinner.hide {
            opacity: 0;
            pointer-events: none;
        }

        .spinner-content {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .spinner {
            width: 70px;
            height: 70px;
            border: 5px solid rgba(110, 72, 170, 0.2);
            border-radius: 50%;
            border-top-color: var(--primary-color);
            animation: spin 1s linear infinite;
            margin-bottom: 20px;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        .spinner-text {
            color: var(--text-color);
            font-size: 1.2rem;
            margin-top: 15px;
            text-align: center;
        }