html {
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

body {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    overflow-x: hidden;
    background: transparent;
    color: var(--text);
}

/* Canvas с топографическими линиями */

.contour-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 1;
}

/* Весь интерфейс располагается над анимированным фоном */
body > *:not(.contour-background) {
    position: relative;
    z-index: 1;
}

/* Дополнительная глубина фона */

:root[data-theme="dark"] body {
    background:
        radial-gradient(
            ellipse at 18% 15%,
            rgba(24, 57, 102, 0.22),
            transparent 48%
        ),
        radial-gradient(
            ellipse at 85% 85%,
            rgba(15, 45, 82, 0.2),
            transparent 48%
        );
}

:root[data-theme="light"] body {
    background:
        radial-gradient(
            ellipse at 15% 12%,
            rgba(164, 210, 255, 0.24),
            transparent 50%
        ),
        radial-gradient(
            ellipse at 85% 80%,
            rgba(188, 222, 255, 0.2),
            transparent 50%
        );
}

/* Плавная смена темы */

html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition:
        background-color 0.35s ease,
        color 0.35s ease,
        border-color 0.35s ease,
        box-shadow 0.35s ease !important;
}

::selection {
    background: var(--accent-soft);
    color: var(--text);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
/* Не перекрываем анимированный фон */
body > .app {
    background: transparent !important;
}
