:root {
    --bg-main: #071427;
    --bg-glow: rgba(120, 180, 255, 0.24);
    --panel: rgba(255, 255, 255, 0.08);
    --panel-border: rgba(255, 255, 255, 0.18);
    --text-main: #f5f7ff;
    --text-muted: rgba(245, 247, 255, 0.72);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: "Trebuchet MS", "Verdana", sans-serif;
    background:
        radial-gradient(circle at 20% 20%, var(--bg-glow), transparent 28%),
        radial-gradient(circle at 80% 30%, rgba(140, 185, 255, 0.12), transparent 24%),
        radial-gradient(circle at 50% 80%, rgba(110, 230, 255, 0.1), transparent 26%),
        linear-gradient(180deg, #102647 0%, #071427 58%, #04101f 100%),
        var(--bg-main);
    color: var(--text-main);
}

body::before {
    content: "";
    position: fixed;
    inset: -6%;
    background-image:
        radial-gradient(circle at 15% 25%, rgba(255, 255, 255, 1) 0 1.8px, rgba(255, 255, 255, 0.4) 1.9px 7px, transparent 12px),
        radial-gradient(circle at 75% 40%, rgba(255, 255, 255, 0.96) 0 1.7px, rgba(255, 255, 255, 0.34) 1.8px 6.2px, transparent 10.4px),
        radial-gradient(circle at 55% 70%, rgba(255, 255, 255, 0.92) 0 1.4px, rgba(255, 255, 255, 0.28) 1.5px 4.8px, transparent 8px),
        radial-gradient(circle at 35% 85%, rgba(255, 255, 255, 0.96) 0 1.8px, rgba(255, 255, 255, 0.34) 1.9px 6.8px, transparent 11.2px),
        radial-gradient(circle at 88% 15%, rgba(255, 255, 255, 1) 0 1.5px, rgba(255, 255, 255, 0.4) 1.6px 5.2px, transparent 8.8px),
        radial-gradient(circle at 62% 18%, rgba(255, 255, 255, 0.96) 0 1.7px, rgba(255, 255, 255, 0.32) 1.8px 5.9px, transparent 10px),
        radial-gradient(circle at 22% 72%, rgba(255, 255, 255, 0.95) 0 1.4px, rgba(255, 255, 255, 0.3) 1.5px 4.8px, transparent 8px),
        radial-gradient(circle at 42% 12%, rgba(255, 255, 255, 0.92) 0 1.2px, rgba(255, 255, 255, 0.26) 1.3px 4.3px, transparent 7.2px),
        radial-gradient(circle at 91% 62%, rgba(255, 255, 255, 0.97) 0 1.7px, rgba(255, 255, 255, 0.34) 1.8px 6.4px, transparent 10.8px),
        radial-gradient(circle at 9% 56%, rgba(255, 255, 255, 0.9) 0 1.2px, rgba(255, 255, 255, 0.24) 1.3px 4.6px, transparent 7.6px),
        radial-gradient(circle at 47% 88%, rgba(255, 255, 255, 0.96) 0 1.6px, rgba(255, 255, 255, 0.31) 1.7px 5.4px, transparent 9.2px),
        radial-gradient(circle at 68% 74%, rgba(255, 255, 255, 0.93) 0 1.3px, rgba(255, 255, 255, 0.27) 1.4px 4.8px, transparent 8px),
        radial-gradient(circle at 30% 48%, rgba(255, 255, 255, 0.88) 0 1.1px, rgba(255, 255, 255, 0.22) 1.2px 4.1px, transparent 6.8px),
        radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.95) 0 1.5px, rgba(255, 255, 255, 0.28) 1.6px 5.4px, transparent 8.8px),
        radial-gradient(circle at 58% 34%, rgba(255, 255, 255, 0.97) 0 1.6px, rgba(255, 255, 255, 0.34) 1.7px 5.8px, transparent 9.6px),
        radial-gradient(circle at 82% 82%, rgba(255, 255, 255, 0.92) 0 1.2px, rgba(255, 255, 255, 0.26) 1.3px 4.6px, transparent 7.6px),
        radial-gradient(circle at 12% 90%, rgba(255, 255, 255, 0.9) 0 1.3px, rgba(255, 255, 255, 0.24) 1.4px 5px, transparent 8.4px);
    opacity: 0.98;
    pointer-events: none;
    animation: star-drift 10s ease-in-out infinite alternate;
}

.app {
    position: relative;
    width: 100%;
    height: 100%;
}

.start-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 18% 20%, rgba(255, 213, 94, 0.18), transparent 24%),
        radial-gradient(circle at 82% 18%, rgba(114, 221, 247, 0.16), transparent 22%),
        radial-gradient(circle at 50% 82%, rgba(167, 139, 250, 0.16), transparent 28%),
        rgba(4, 10, 23, 0.34);
    z-index: 20;
    transition: opacity 220ms ease, visibility 220ms ease;
}

.start-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.start-panel {
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background:
        linear-gradient(180deg, rgba(15, 33, 63, 0.92) 0%, rgba(11, 26, 50, 0.94) 100%);
    color: var(--text-main);
    padding: 34px 30px 28px;
    width: min(520px, 100%);
    border-radius: 34px;
    backdrop-filter: blur(18px);
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    user-select: none;
}

.start-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 16%, rgba(255, 255, 255, 0.2), transparent 16%),
        radial-gradient(circle at 84% 22%, rgba(255, 255, 255, 0.12), transparent 20%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 42%);
    pointer-events: none;
}

.start-orbit {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    filter: blur(0.2px);
    opacity: 0.9;
    pointer-events: none;
}

.start-orbit-left {
    top: -28px;
    left: -18px;
    background:
        radial-gradient(circle at 35% 35%, rgba(255, 244, 183, 0.95) 0 16px, rgba(255, 172, 75, 0.94) 17px 42px, rgba(255, 113, 113, 0.45) 43px 68px, transparent 69px);
}

.start-orbit-right {
    right: -22px;
    bottom: 98px;
    background:
        radial-gradient(circle at 40% 40%, rgba(237, 250, 255, 0.95) 0 14px, rgba(114, 221, 247, 0.88) 15px 36px, rgba(167, 139, 250, 0.44) 37px 62px, transparent 63px);
}

.start-copy {
    position: relative;
    z-index: 1;
    text-align: center;
}

.start-kicker {
    display: inline-block;
    margin-bottom: 14px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff1af;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.start-copy h1 {
    margin: 0;
    font-size: clamp(2.8rem, 8vw, 4.7rem);
    letter-spacing: 0.04em;
    line-height: 0.95;
    text-transform: none;
    text-shadow:
        0 8px 24px rgba(0, 0, 0, 0.28),
        0 0 24px rgba(114, 221, 247, 0.24);
}

.start-copy p {
    margin: 14px auto 0;
    max-width: 320px;
    color: rgba(245, 247, 255, 0.84);
    font-size: 1.02rem;
    line-height: 1.5;
}

.start-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(245, 247, 255, 0.92);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.sound-controls {
    position: relative;
    z-index: 1;
    margin-top: 26px;
    padding: 18px 18px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sound-row,
.sound-slider-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sound-row {
    justify-content: space-between;
    margin-bottom: 16px;
}

.sound-slider-wrap {
    width: 100%;
}

.sound-label {
    min-width: 68px;
    color: rgba(245, 247, 255, 0.82);
    font-size: 0.88rem;
    letter-spacing: 0.1em;
    font-weight: 700;
    text-transform: uppercase;
}

.sound-toggle {
    border: 0;
    background: linear-gradient(180deg, #7ef7d8 0%, #49d7b5 100%);
    color: #0b1b31;
    min-width: 88px;
    padding: 11px 18px;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(73, 215, 181, 0.25);
}

.sound-toggle[aria-pressed="false"] {
    background: linear-gradient(180deg, #62738f 0%, #44546b 100%);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: none;
}

#volumeControl {
    width: 100%;
    accent-color: #72ddf7;
    cursor: pointer;
}

.start-button {
    position: relative;
    z-index: 1;
    margin-top: 22px;
    border: 0;
    background:
        linear-gradient(180deg, #ffe77b 0%, #ffc94f 48%, #ffad3b 100%);
    color: #102647;
    padding: 20px 24px;
    border-radius: 22px;
    text-align: center;
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    box-shadow:
        0 16px 30px rgba(255, 173, 59, 0.28),
        inset 0 -4px 0 rgba(199, 104, 6, 0.22);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.start-button:hover,
.start-button:focus-visible {
    transform: translateY(-2px) scale(1.01);
    box-shadow:
        0 22px 36px rgba(255, 173, 59, 0.34),
        inset 0 -4px 0 rgba(199, 104, 6, 0.22);
    outline: none;
}

@media (max-width: 640px) {
    .start-overlay {
        padding: 16px;
    }

    .start-panel {
        padding: 28px 20px 22px;
        border-radius: 28px;
    }

    .sound-row,
    .sound-slider-wrap {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .sound-label {
        min-width: auto;
    }
}

.playground {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.glyph {
    position: absolute;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.28);
    user-select: none;
    animation: pop-in 180ms ease-out, fade-away 460ms ease-out 0.34s forwards;
    will-change: transform, opacity;
}

.center-glyph {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1);
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    user-select: none;
    text-shadow:
        0 0 20px rgba(255, 255, 255, 0.28),
        0 0 48px currentColor;
    will-change: transform, opacity, font-size;
    z-index: 5;
}

.center-glyph.burst {
    animation: burst-pop 240ms cubic-bezier(0.18, 0.8, 0.32, 1.2) forwards;
}

.burst-particle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.75);
    transform:
        translate(-50%, -50%)
        translate(var(--sx, 0px), var(--sy, 0px))
        translate(0, 0)
        scale(1);
    pointer-events: none;
    opacity: 1;
    will-change: transform, opacity;
    z-index: 4;
}

.burst-particle.active {
    animation: particle-burst 1000ms cubic-bezier(0.16, 0.72, 0.2, 1) forwards;
}

@keyframes pop-in {
    from {
        opacity: 0;
        transform: scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fade-away {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.7);
    }
}

@keyframes star-drift {
    0% {
        transform: translate3d(-20px, -12px, 0) scale(1);
    }
    50% {
        transform: translate3d(12px, 18px, 0) scale(1.03);
    }
    100% {
        transform: translate3d(28px, 8px, 0) scale(1.06);
    }
}

@keyframes burst-pop {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.28);
    }
    55% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.88);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.85);
    }
}

@keyframes particle-burst {
    0% {
        opacity: 1;
        transform:
            translate(-50%, -50%)
            translate(var(--sx, 0px), var(--sy, 0px))
            translate(0, 0)
            scale(1);
    }
    35% {
        opacity: 0.95;
        transform:
            translate(-50%, -50%)
            translate(var(--sx, 0px), var(--sy, 0px))
            translate(var(--mx, 0px), var(--my, 0px))
            scale(1);
    }
    75% {
        opacity: 0.82;
        transform:
            translate(-50%, -50%)
            translate(var(--sx, 0px), var(--sy, 0px))
            translate(var(--dx, 0px), var(--dy, 0px))
            scale(0.82);
    }
    100% {
        opacity: 0;
        transform:
            translate(-50%, -50%)
            translate(var(--sx, 0px), var(--sy, 0px))
            translate(var(--fx, 0px), var(--fy, 0px))
            scale(0.35);
    }
}
