:root {
    --bg: #0a0a0f;
    --bg2: #111118;
    --glass: rgba(17, 17, 24, .85);
    --text: #fff;
    --text2: #777;
    --accent: #6366f1;
    --accent2: #a855f7;
    --gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --border: rgba(255, 255, 255, .08);
    --radius: 20px
}

[data-theme=light] {
    --bg: #f0f4f8;
    --bg2: #fff;
    --glass: rgba(255, 255, 255, .9);
    --text: #1a1a2e;
    --text2: #64748b;
    --border: rgba(0, 0, 0, .1)
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh
}

.app {
    min-height: 100vh;
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
    position: relative
}

.bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden
}

.blob-bg {
    position: absolute;
    width: 600px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--gradient);
    filter: blur(120px);
    opacity: .3;
    border-radius: 50%;
    animation: pulse 10s ease-in-out infinite
}

@keyframes pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1)
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2)
    }
}

.glass {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    position: relative;
    z-index: 1
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 400;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent
}

.logo h1 span {
    font-weight: 700
}

#theme-btn {
    width: 44px;
    height: 44px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer
}

main {
    position: relative;
    z-index: 1
}

.preview-area {
    text-align: center
}

.blob-container {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: var(--radius);
    overflow: hidden
}

#blob-svg {
    width: 90%;
    height: 90%;
    transition: all .3s
}

.primary-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: .2s
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, .3)
}

.controls {
    display: grid;
    gap: 20px
}

.control {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.control label {
    font-size: .85rem;
    color: var(--text2)
}

.control input[type=range] {
    -webkit-appearance: none;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    cursor: pointer
}

.control input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--gradient);
    border-radius: 50%;
    cursor: pointer
}

.control span {
    font-size: .9rem;
    color: var(--accent)
}

.control input[type=color] {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: transparent
}

.color-controls {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: end
}

.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: .85rem
}

.toggle input {
    display: none
}

.slider {
    width: 44px;
    height: 24px;
    background: var(--bg);
    border-radius: 12px;
    position: relative;
    transition: .2s
}

.slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--text2);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: .2s
}

.toggle input:checked+.slider {
    background: var(--accent)
}

.toggle input:checked+.slider::after {
    left: 23px;
    background: #fff
}

.export-section h3,
.saved h3 {
    font-size: 1rem;
    margin-bottom: 16px
}

.export-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px
}

.btn {
    flex: 1;
    padding: 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: .9rem;
    cursor: pointer;
    transition: .2s;
    min-width: 120px
}

.btn:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, .1)
}

.code-preview {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
    max-height: 150px;
    font-size: .8rem
}

.code-preview code {
    color: var(--text2);
    white-space: pre-wrap;
    word-break: break-all
}

.saved-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto
}

.saved-item {
    aspect-ratio: 1;
    background: var(--bg);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    border: 2px solid transparent;
    transition: .2s;
    padding: 8px
}

.saved-item:hover {
    border-color: var(--accent)
}

.saved-item svg {
    width: 100%;
    height: 100%
}

.secondary-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text2);
    font-size: .9rem;
    cursor: pointer;
    transition: .2s
}

.secondary-btn:hover {
    border-color: var(--accent);
    color: var(--accent)
}

.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--gradient);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, .4);
    z-index: 10
}

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg2);
    border: 1px solid var(--accent);
    padding: 12px 24px;
    border-radius: 12px;
    opacity: 0;
    transition: .3s;
    z-index: 100
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0)
}

@media(max-width:500px) {
    .color-controls {
        grid-template-columns: 1fr 1fr
    }

    .color-controls .toggle {
        grid-column: span 2
    }
}