:root {
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.72);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.18);
    --control-size: 46px;
    --control-size-mobile: 42px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

html,
body {
    height: 100%;
}

body {
    overflow: hidden;
    color: var(--text-main);
    font-family: "JetBrains Mono", monospace;
    background: #050507;
}

.background {
    position: fixed;
    inset: 0;
    background: url("background.jpg") center / cover no-repeat;
    background-image: image-set(
        url("background.webp") type("image/webp"),
        url("background.jpg") type("image/jpeg")
    );
    z-index: -2;
    overflow: hidden;
}

.background::before,
.background::after {
    content: "";
    position: absolute;
    inset: -18%;
    pointer-events: none;
    mix-blend-mode: screen;
}

.background::before {
    background:
        radial-gradient(circle at 22% 28%, rgba(255, 244, 206, 0.14), transparent 28%),
        radial-gradient(circle at 68% 62%, rgba(170, 220, 255, 0.1), transparent 26%);
    animation: ambient-drift-a 18s ease-in-out infinite alternate;
}

.background::after {
    background:
        radial-gradient(circle at 74% 18%, rgba(255, 255, 255, 0.08), transparent 22%),
        radial-gradient(circle at 30% 78%, rgba(188, 255, 235, 0.08), transparent 24%);
    animation: ambient-drift-b 24s ease-in-out infinite alternate;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(8px);
    z-index: -1;
}

.center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.logo {
    font-family: "Instrument Serif", serif;
    font-size: clamp(56px, 8vw, 72px);
    line-height: 0.95;
}

.nav {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.nav-link {
    position: relative;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.2;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 10px;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.nav-link::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-link:hover::before {
    opacity: 1;
}

.nav-link:hover {
    color: var(--text-main);
}

.nav-link-anchor {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.divider {
    margin: 0 2px;
    color: rgba(255, 255, 255, 0.45);
}

.dropdown {
    position: fixed;
    display: none;
    z-index: 10;
}

.dropdown.active {
    display: block;
}

.glass {
    width: 260px;
    min-height: 140px;
    padding: 20px;
    border-radius: 18px;
    background: var(--glass-bg);
    backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    cursor: grab;
    touch-action: none;
    transform-origin: top center;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.glass p + p {
    margin-top: 8px;
}

.dropdown.closing {
    pointer-events: none;
}

.dropdown.closing .glass {
    opacity: 0;
    transform: scale(0.84);
    transition-duration: 0.22s;
    transition-timing-function: cubic-bezier(0.22, 0.7, 0.22, 1);
}

.icons {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.icons a {
    position: relative;
    font-size: 22px;
    color: var(--text-muted);
    padding: 10px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    text-decoration: none;
    transition: color 0.2s ease;
}

.icons a::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.icons a:hover::before {
    opacity: 1;
}

.icons a:hover {
    color: var(--text-main);
}

.controls {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.language-toggle {
    width: var(--control-size);
    height: var(--control-size);
    border-radius: 999px;
    border: none;
    color: transparent;
    backdrop-filter: blur(10px);
    display: grid;
    place-items: center;
    font-size: 0;
    cursor: pointer;
    opacity: 0.97;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.language-toggle:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.language-toggle:focus,
.language-toggle:focus-visible {
    outline: none;
}

.language-toggle.is-ru {
    background-image: url("russia.png");
}

.language-toggle.is-en {
    background-image: url("united-states.png");
}

.music-toggle {
    width: var(--control-size);
    height: var(--control-size);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(0, 0, 0, 0.36);
    color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: grid;
    place-items: center;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.9;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.music-toggle:hover {
    opacity: 1;
    transform: translateY(-1px);
    background: rgba(0, 0, 0, 0.5);
}

.music-toggle iconify-icon {
    pointer-events: none;
}

.nav-link:focus-visible,
.icons a:focus-visible,
.nav-link-anchor:focus-visible,
.music-toggle:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
}

#wires {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

@keyframes ambient-drift-a {
    from {
        transform: translate3d(-1.5%, -1%, 0) scale(1);
    }

    to {
        transform: translate3d(2%, 1.5%, 0) scale(1.06);
    }
}

@keyframes ambient-drift-b {
    from {
        transform: translate3d(1.5%, -1.5%, 0) scale(1.02);
    }

    to {
        transform: translate3d(-2%, 2%, 0) scale(1.08);
    }
}

@media (max-width: 680px) {
    .nav {
        gap: 2px;
    }

    .nav-link {
        font-size: 14px;
        padding: 4px 8px;
    }

    .divider {
        font-size: 14px;
    }

    .controls {
        right: 14px;
        bottom: 14px;
    }

    .music-toggle {
        width: var(--control-size-mobile);
        height: var(--control-size-mobile);
        font-size: 22px;
    }

    .language-toggle {
        width: var(--control-size-mobile);
        height: var(--control-size-mobile);
    }

    .glass {
        width: min(260px, calc(100vw - 24px));
    }
}

@media (max-width: 860px), (pointer: coarse) {
    .glass {
        cursor: default;
        touch-action: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }

    .glass,
    .dropdown.closing .glass {
        transition: transform 0.22s ease, opacity 0.22s ease !important;
    }
}
