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

:root {
    --bg-primary: #0a0a0f;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --gradient-1: #0a0a1a;
    --gradient-2: #1a0a2e;
    --gradient-3: #0a1a2e;
    --gradient-4: #0a0a1a;
    --toggle-bg: #2a2a3a;
    --blob-1: rgba(88, 101, 242, 0.15);
    --blob-2: rgba(235, 69, 158, 0.12);
    --blob-3: rgba(88, 101, 242, 0.1);
    --blob-4: rgba(245, 166, 35, 0.08);
    --grain-opacity: 0.04;
}

[data-theme="light"] {
    --bg-primary: #f0f0f5;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --gradient-1: #e8e0f0;
    --gradient-2: #d0e0f0;
    --gradient-3: #e0f0e8;
    --gradient-4: #f0e8e0;
    --toggle-bg: #c0c0d0;
    --blob-1: rgba(88, 101, 242, 0.12);
    --blob-2: rgba(235, 69, 158, 0.1);
    --blob-3: rgba(88, 101, 242, 0.08);
    --blob-4: rgba(245, 166, 35, 0.06);
    --grain-opacity: 0.03;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

.bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        135deg,
        var(--gradient-1),
        var(--gradient-2),
        var(--gradient-3),
        var(--gradient-4)
    );
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    transition: background 0.5s ease;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}

/* Плавающие блобы */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
    will-change: transform;
}

.blob--1 {
    width: 500px;
    height: 500px;
    background: var(--blob-1);
    top: -10%;
    left: -10%;
    animation: blobFloat1 25s ease-in-out infinite;
}

.blob--2 {
    width: 400px;
    height: 400px;
    background: var(--blob-2);
    bottom: -10%;
    right: -10%;
    animation: blobFloat2 20s ease-in-out infinite;
}

.blob--3 {
    width: 350px;
    height: 350px;
    background: var(--blob-3);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: blobFloat3 30s ease-in-out infinite;
}

.blob--4 {
    width: 300px;
    height: 300px;
    background: var(--blob-4);
    top: 20%;
    right: 20%;
    animation: blobFloat4 22s ease-in-out infinite;
}

@keyframes blobFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30vw, 20vh) scale(1.1); }
    50% { transform: translate(50vw, 50vh) scale(0.9); }
    75% { transform: translate(20vw, 70vh) scale(1.05); }
}

@keyframes blobFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-30vw, -20vh) scale(1.15); }
    50% { transform: translate(-50vw, -40vh) scale(0.85); }
    75% { transform: translate(-20vw, -60vh) scale(1.1); }
}

@keyframes blobFloat3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    33% { transform: translate(-30%, -70%) scale(1.2); }
    66% { transform: translate(-70%, -30%) scale(0.8); }
}

@keyframes blobFloat4 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-20vw, 30vh) scale(1.1); }
    50% { transform: translate(-40vw, 10vh) scale(0.9); }
    75% { transform: translate(-10vw, -20vh) scale(1.05); }
}

/* Текстура шума */
.grain {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

.content {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
}

.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--toggle-bg);
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease;
    z-index: 10;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle:active {
    transform: scale(0.95);
}

@media (max-width: 480px) {
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .blob--1 { width: 300px; height: 300px; }
    .blob--2 { width: 250px; height: 250px; }
    .blob--3 { width: 200px; height: 200px; }
    .blob--4 { width: 180px; height: 180px; }
}
