:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #07121d;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-width: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 18%, rgba(39, 169, 227, 0.2), transparent 34%),
        radial-gradient(circle at 83% 80%, rgba(79, 203, 236, 0.13), transparent 38%),
        linear-gradient(145deg, #0b2333 0%, #07121d 48%, #06101a 100%);
}

.ambient,
.grain,
.glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.ambient {
    overflow: hidden;
}

.glow {
    width: 42vmax;
    height: 42vmax;
    border-radius: 50%;
    filter: blur(58px);
    opacity: 0.28;
    transform: translate3d(0, 0, 0);
}

.glow-one {
    inset: -20vmax auto auto -17vmax;
    background: #2fa6df;
    animation: drift-one 15s ease-in-out infinite alternate;
}

.glow-two {
    inset: auto -18vmax -23vmax auto;
    background: #117fbd;
    animation: drift-two 18s ease-in-out infinite alternate;
}

.grain {
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.viewport {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    place-items: center;
    padding:
        max(18px, env(safe-area-inset-top))
        max(18px, env(safe-area-inset-right))
        max(18px, env(safe-area-inset-bottom))
        max(18px, env(safe-area-inset-left));
}

.player-frame {
    position: relative;
    width: min(calc((100svh - 36px) * 9 / 16), calc(100vw - 36px));
    height: min(calc(100svh - 36px), calc((100vw - 36px) * 16 / 9));
    max-width: 620px;
    max-height: 1102px;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(199, 237, 255, 0.2);
    border-radius: clamp(20px, 3.2vh, 34px);
    background: #020507;
    box-shadow:
        0 38px 90px rgba(0, 0, 0, 0.48),
        0 12px 36px rgba(0, 0, 0, 0.34),
        0 0 0 1px rgba(255, 255, 255, 0.035) inset;
}

.player-frame::after {
    position: absolute;
    z-index: 3;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 80px rgba(47, 166, 223, 0.08) inset;
    content: "";
    pointer-events: none;
}

video {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #020507;
    opacity: 0;
    transition: opacity 420ms ease;
}

body.video-ready video {
    opacity: 1;
}

.loading-mark {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: grid;
    place-content: center;
    place-items: center;
    gap: 22px;
    background:
        radial-gradient(circle at 50% 44%, rgba(47, 166, 223, 0.16), transparent 33%),
        linear-gradient(165deg, #0d2433, #03080d 68%);
    opacity: 1;
    transition: opacity 350ms ease, visibility 350ms ease;
}

.loading-mark img {
    width: clamp(74px, 18%, 108px);
    height: auto;
    border-radius: 22%;
    filter: drop-shadow(0 10px 24px rgba(47, 166, 223, 0.24));
}

.loading-mark span {
    width: 76px;
    height: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.loading-mark span::after {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: #47b4e6;
    animation: loading 1.1s ease-in-out infinite;
    content: "";
}

body.video-ready .loading-mark {
    visibility: hidden;
    opacity: 0;
}

.play-gate {
    position: absolute;
    z-index: 4;
    top: 50%;
    left: 50%;
    width: 78px;
    height: 78px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: white;
    cursor: pointer;
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.5));
    transform: translate(-50%, -50%);
    transition: transform 160ms ease, filter 160ms ease;
}

.play-gate:hover,
.play-gate:focus-visible {
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.62));
    transform: translate(-50%, -50%) scale(1.07);
}

.play-gate:focus-visible {
    outline: 3px solid #8bdcff;
    outline-offset: 5px;
}

.play-gate svg {
    display: block;
    width: 100%;
    height: 100%;
}

.play-gate circle {
    fill: rgba(4, 18, 29, 0.72);
    stroke: rgba(255, 255, 255, 0.82);
    stroke-width: 2;
}

.play-gate path {
    fill: currentColor;
}

@keyframes loading {
    from {
        transform: translateX(-115%);
    }
    to {
        transform: translateX(245%);
    }
}

@keyframes drift-one {
    to {
        transform: translate3d(8vmax, 6vmax, 0) scale(1.08);
    }
}

@keyframes drift-two {
    to {
        transform: translate3d(-7vmax, -5vmax, 0) scale(0.94);
    }
}

@media (max-width: 600px) and (orientation: portrait) {
    body {
        background: #020507;
    }

    .ambient {
        display: none;
    }

    .viewport {
        padding: 0;
    }

    .player-frame {
        width: 100vw;
        height: 100vh;
        height: 100svh;
        max-width: none;
        max-height: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
