:root {
    --gold: #d8b56d;
    --gold-soft: #f0d9a4;
    --font-serif: Georgia, 'Times New Roman', serif;
    --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mx: 0;
    --my: 0;
}

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

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: #050505;
    color: #fff;
    font-family: var(--font-sans);
    overflow: hidden;
}

.intro {
    position: fixed;
    inset: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    isolation: isolate;
}

.bg-layers {
    position: absolute;
    inset: 0;
}

.bg-layer {
    position: absolute;
    inset: -6%;
    opacity: 0;
    transition: opacity 2.6s ease, transform 1.1s ease-out;
    transform: translate3d(calc(var(--mx) * 16px * var(--depth, 1)), calc(var(--my) * 11px * var(--depth, 1)), 0);
    will-change: opacity, transform;
}

.bg-layer.is-active {
    opacity: 1;
}

.bg-inner {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    animation: travel 26s ease-in-out infinite alternate;
}

.bg-layer.is-reverse .bg-inner {
    animation-name: travel-reverse;
}

@keyframes travel {
    from {
        transform: scale(1.06) translate3d(-1.2%, 0.8%, 0);
    }
    to {
        transform: scale(1.18) translate3d(1.4%, -1%, 0);
    }
}

@keyframes travel-reverse {
    from {
        transform: scale(1.16) translate3d(1.2%, -0.9%, 0);
    }
    to {
        transform: scale(1.05) translate3d(-1.3%, 1%, 0);
    }
}

.light-leak {
    position: absolute;
    inset: -20%;
    pointer-events: none;
    background: linear-gradient(105deg, transparent 30%, rgba(255, 214, 140, 0.16) 48%, rgba(255, 236, 190, 0.05) 55%, transparent 70%);
    mix-blend-mode: screen;
    animation: leak 14s ease-in-out infinite;
}

@keyframes leak {
    0%,
    100% {
        transform: translateX(-12%) rotate(-2deg);
        opacity: 0.5;
    }
    50% {
        transform: translateX(12%) rotate(2deg);
        opacity: 0.9;
    }
}

.bokeh {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.bokeh span {
    position: absolute;
    bottom: -6%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255, 236, 190, 0.85), rgba(255, 200, 110, 0.14) 60%, transparent 72%);
    filter: blur(2px);
    opacity: 0;
    animation: floatUp linear infinite;
}

.bokeh span:nth-child(1) {
    left: 12%;
    --s: 2.4;
    animation-duration: 18s;
    animation-delay: 1s;
}

.bokeh span:nth-child(2) {
    left: 28%;
    --s: 1.2;
    animation-duration: 24s;
    animation-delay: 6s;
}

.bokeh span:nth-child(3) {
    left: 47%;
    --s: 3.1;
    animation-duration: 21s;
    animation-delay: 3s;
}

.bokeh span:nth-child(4) {
    left: 63%;
    --s: 1.6;
    animation-duration: 27s;
    animation-delay: 9s;
}

.bokeh span:nth-child(5) {
    left: 78%;
    --s: 2.2;
    animation-duration: 19s;
    animation-delay: 5s;
}

.bokeh span:nth-child(6) {
    left: 90%;
    --s: 1;
    animation-duration: 25s;
    animation-delay: 12s;
}

@keyframes floatUp {
    0% {
        transform: translate3d(0, 0, 0) scale(var(--s, 1));
        opacity: 0;
    }
    12% {
        opacity: 0.55;
    }
    80% {
        opacity: 0.3;
    }
    100% {
        transform: translate3d(40px, -116vh, 0) scale(var(--s, 1));
        opacity: 0;
    }
}

.letterbox {
    position: absolute;
    left: 0;
    right: 0;
    height: 50vh;
    background: #000;
    z-index: 6;
    pointer-events: none;
    transition: transform 1.9s cubic-bezier(0.45, 0, 0.2, 1);
}

.letterbox--top {
    top: 0;
    border-bottom: 1px solid rgba(216, 181, 109, 0.5);
}

.letterbox--bottom {
    bottom: 0;
    border-top: 1px solid rgba(216, 181, 109, 0.5);
}

.intro.is-open .letterbox--top {
    transform: translateY(calc(-100% + 5vh));
}

.intro.is-open .letterbox--bottom {
    transform: translateY(calc(100% - 5vh));
}

.open-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    padding: 0;
    background: none;
    border: none;
    color: var(--gold);
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: opacity 0.8s ease, transform 0.9s ease;
}

.open-btn__disc {
    position: relative;
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    border: 1px solid rgba(216, 181, 109, 0.65);
    background: rgba(10, 8, 5, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 0 40px rgba(216, 181, 109, 0.15), inset 0 0 24px rgba(216, 181, 109, 0.08);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.open-btn__pulse {
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 1px solid rgba(216, 181, 109, 0.4);
    animation: openPulse 2.8s ease-out infinite;
}

.open-btn__label {
    font-size: 0.62rem;
    letter-spacing: 0.42em;
    text-indent: 0.42em;
    text-transform: uppercase;
    color: rgba(240, 217, 164, 0.75);
}

.open-btn:hover .open-btn__disc,
.open-btn:focus-visible .open-btn__disc {
    transform: scale(1.06);
    box-shadow: 0 0 60px rgba(216, 181, 109, 0.35), inset 0 0 28px rgba(216, 181, 109, 0.14);
}

.open-btn:focus-visible {
    outline: none;
}

.open-btn.is-gone {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.25);
    pointer-events: none;
}

.open-btn[hidden] {
    display: none;
}

@keyframes openPulse {
    0% {
        transform: scale(0.85);
        opacity: 0.8;
    }
    70% {
        transform: scale(1.25);
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}

.stage {
    position: relative;
    z-index: 5;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(2.5rem, 7vh, 4.5rem);
    padding: 8vh 1.25rem;
    text-align: center;
}

.title {
    margin: 0;
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(2rem, 6vw, 4.6rem);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    line-height: 1.18;
    color: #f7f2e8;
    text-shadow: 0 0 28px rgba(255, 224, 160, 0.25), 0 2px 26px rgba(0, 0, 0, 0.6);
}

.intro.is-open .title {
    animation: tracking 3s ease-out 0.7s forwards;
}

@keyframes tracking {
    to {
        letter-spacing: 0.12em;
    }
}

.word {
    display: inline-block;
    white-space: nowrap;
}

.letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(26px) scale(0.96);
    filter: blur(6px);
}

.intro.is-open .letter {
    animation: letterIn 1.3s cubic-bezier(0.18, 0.72, 0.22, 1) forwards;
}

@keyframes letterIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.subtitle {
    margin: 1.4rem 0 0;
    font-size: clamp(0.8rem, 1.4vw, 0.95rem);
    text-transform: uppercase;
    letter-spacing: 0.55em;
    text-indent: 0.55em;
    color: var(--gold);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.85), 0 0 3px rgba(0, 0, 0, 0.6);
    opacity: 0;
}

.intro.is-open .subtitle {
    animation: subtitleIn 2s ease-out forwards;
}

@keyframes subtitleIn {
    to {
        opacity: 0.95;
        letter-spacing: 0.42em;
    }
}

.login-form {
    display: flex;
    justify-content: center;
    width: min(380px, 86vw);
    opacity: 0;
}

.intro.is-open .login-form {
    animation: formIn 1.4s ease-out 0.9s forwards;
}

@keyframes formIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.field {
    position: relative;
}

.field input {
    width: 100%;
    padding: 1rem 3.6rem 1rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    letter-spacing: 0.2em;
    color: #fff;
    text-align: center;
    background: rgba(8, 6, 4, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    outline: none;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
    transition: border-color 0.35s, box-shadow 0.35s, background-color 0.35s;
}

.field input::placeholder {
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.28em;
}

.field input:focus {
    background: rgba(8, 6, 4, 0.7);
    border-color: rgba(216, 181, 109, 0.85);
    box-shadow: 0 0 0 4px rgba(216, 181, 109, 0.16), 0 0 40px rgba(216, 181, 109, 0.18);
}

.enter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1rem 2.6rem;
    font-family: inherit;
    font-size: 1rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #0d0b07;
    background: linear-gradient(160deg, var(--gold-soft), var(--gold));
    border: none;
    border-radius: 999px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.enter-btn:hover,
.enter-btn:focus-visible {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(216, 181, 109, 0.5);
    outline: none;
}

.enter-btn:active {
    transform: scale(0.97);
}

.error-message {
    min-height: 1.2em;
    margin: 0.9rem 0 0;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: #ff9d94;
    opacity: 0;
    transition: opacity 0.4s;
}

.error-message.visible {
    opacity: 1;
}

.field.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-9px);
    }
    40% {
        transform: translateX(8px);
    }
    60% {
        transform: translateX(-5px);
    }
    80% {
        transform: translateX(3px);
    }
}

.mute-btn {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    z-index: 9;
    width: 2.5rem;
    height: 2.5rem;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: color 0.3s, border-color 0.3s;
}

.intro.is-open .mute-btn {
    animation: formIn 1.4s ease-out 1.6s forwards;
}

.mute-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

.mute-btn .icon-off {
    display: none;
}

.mute-btn.is-muted .icon-on {
    display: none;
}

.mute-btn.is-muted .icon-off {
    display: block;
}

.demo-badge {
    position: absolute;
    left: 1.1rem;
    right: 1.1rem;
    bottom: calc(5vh + 0.9rem);
    z-index: 9;
    margin: 0;
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    line-height: 1.8;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.6s ease 1.4s;
}

.intro.is-open .demo-badge {
    opacity: 1;
}

.demo-badge[hidden] {
    display: none;
}

.grain {
    position: absolute;
    inset: -100px;
    z-index: 7;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.06;
    mix-blend-mode: overlay;
    animation: grain 0.7s steps(3) infinite;
}

@keyframes grain {
    0% {
        transform: translate(0, 0);
    }
    33% {
        transform: translate(-18px, 12px);
    }
    66% {
        transform: translate(14px, -16px);
    }
    100% {
        transform: translate(-8px, -6px);
    }
}

.vignette {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background:
        radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.55) 78%, rgba(0, 0, 0, 0.88) 100%),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 22%, transparent 55%, rgba(0, 0, 0, 0.72));
}

.flash {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.9s ease;
}

.flash.is-on {
    opacity: 1;
    transition-duration: 0.35s;
}

.fadeout {
    position: absolute;
    inset: 0;
    z-index: 11;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s ease;
}

.fadeout.is-on {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .bg-inner,
    .light-leak,
    .bokeh span,
    .grain,
    .open-btn__pulse {
        animation: none !important;
    }
    .letterbox,
    .open-btn,
    .demo-badge {
        transition: none;
    }
    .intro.is-open .letter {
        animation: none;
        opacity: 1;
        transform: none;
        filter: none;
    }
    .intro.is-open .title {
        animation: none;
        letter-spacing: 0.12em;
    }
    .intro.is-open .subtitle {
        animation: none;
        opacity: 0.95;
        letter-spacing: 0.42em;
    }
    .intro.is-open .login-form,
    .intro.is-open .mute-btn {
        animation: none;
        opacity: 1;
    }
    .intro.is-open .demo-badge {
        opacity: 1;
    }
}
