:root {
    color-scheme: dark;
}

.story-login-body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow-x: clip;
    color: #f3f6f8;
    background: #071018;
}

.story-page {
    --story-progress: 0;
    --grade-opacity: 1;
    --frame-opacity: 1;
    --frame-offset: 0px;
    --email-opacity: 1;
    --email-offset: 0px;
    --password-opacity: 1;
    --password-offset: 0px;
    --remember-opacity: 1;
    --remember-offset: 0px;
    --submit-opacity: 1;
    --submit-offset: 0px;
    min-height: 100vh;
    min-height: 100dvh;
    background: #071018;
}

.story-track {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
}

.story-viewport {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at 50% 45%, #192934, #071018 72%);
}

.story-media,
.story-poster,
.story-poster img,
.story-video,
.story-grade,
.story-finale {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.story-media {
    z-index: -3;
    overflow: hidden;
    background: #071018;
    transform: translateZ(0);
}

.story-poster,
.story-video {
    transition: opacity .45s ease;
}

.story-poster {
    z-index: 1;
    margin: 0;
    opacity: 1;
}

.story-poster img,
.story-video {
    display: block;
    object-fit: cover;
    object-position: center;
    background: #071018;
    filter: saturate(.96) contrast(1.015);
    transform: scale(1.002);
}

.story-video {
    z-index: 2;
    opacity: 0;
}

.story-page.is-video-ready .story-video { opacity: 1; }
.story-page.is-video-ready .story-poster { opacity: 0; }

.story-grade {
    z-index: -1;
    opacity: var(--grade-opacity);
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(2, 8, 12, .23), transparent 22%, transparent 67%, rgba(2, 7, 11, .38)),
        linear-gradient(90deg, rgba(2, 8, 12, .14), transparent 20%, transparent 80%, rgba(2, 8, 12, .14));
    box-shadow: inset 0 0 120px rgba(1, 5, 8, .26);
    transition: opacity .16s linear;
}

.story-progress {
    position: absolute;
    z-index: 12;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, .08);
}

.story-progress span {
    width: 100%;
    height: 100%;
    display: block;
    background: linear-gradient(90deg, #62b9dc, #7860c9 58%, #7cba4e);
    box-shadow: 0 0 14px rgba(90, 177, 218, .55);
    transform: scaleX(var(--story-progress));
    transform-origin: left;
    will-change: transform;
}

.story-loading {
    position: absolute;
    z-index: 20;
    top: clamp(22px, 4vh, 40px);
    right: clamp(22px, 4vw, 52px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(206, 224, 235, .16);
    border-radius: 999px;
    background: rgba(4, 11, 16, .5);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.story-loading > span:first-child {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6bc5e9;
    box-shadow: 0 0 0 4px rgba(107, 197, 233, .12);
    animation: loader-pulse 1.2s ease-in-out infinite;
}

.story-enhanced .story-page[data-story-mode="video"] .story-loading {
    opacity: 1;
    visibility: visible;
}

.story-enhanced .story-page.is-video-ready .story-loading,
.story-page[data-story-mode="static"] .story-loading,
.story-page[data-story-mode="fallback"] .story-loading {
    display: none;
    opacity: 0;
    visibility: hidden;
}

.story-intro {
    position: absolute;
    z-index: 5;
    top: clamp(28px, 7vh, 74px);
    left: clamp(25px, 6vw, 96px);
    max-width: min(850px, calc(100vw - 50px));
    opacity: 0;
    transform: translateY(0);
    transition: opacity .15s linear, transform .15s linear;
    pointer-events: none;
}

.story-intro strong {
    display: block;
    max-width: 18ch;
    color: #fff;
    text-wrap: balance;
    text-shadow: 0 3px 28px rgba(0, 0, 0, .68);
    font-size: clamp(2rem, 4vw, 4.05rem);
    font-weight: 680;
    letter-spacing: -.052em;
    line-height: 1.01;
}

.story-intro-brand {
    color: #f0d18c;
}

.story-scroll-cue {
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: clamp(24px, 4vh, 42px);
    display: grid;
    justify-items: center;
    color: rgba(236, 243, 247, .72);
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity .18s linear, transform .18s linear;
    pointer-events: none;
}

.story-scroll-cue > span {
    position: relative;
    width: 24px;
    height: 38px;
    border: 1px solid rgba(235, 243, 248, .48);
    border-radius: 999px;
}

.story-scroll-cue i {
    position: absolute;
    top: 7px;
    left: 50%;
    width: 3px;
    height: 7px;
    border-radius: 999px;
    background: #fff;
    transform: translateX(-50%);
    animation: scroll-cue 1.8s ease-in-out infinite;
}

.story-finale {
    z-index: 9;
    transform: translateZ(0);
    pointer-events: auto;
}

.story-login-modal {
    position: absolute;
    top: 71%;
    left: 50%;
    width: min(34vw, 510px);
    color: #302920;
    opacity: var(--frame-opacity);
    transform: translate(-50%, calc(-50% + var(--frame-offset)));
}

.story-page.is-login-ready .story-finale {
    pointer-events: auto;
}

.auth-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.story-login-modal form {
    display: grid;
    gap: 11px;
}

.auth-step {
    will-change: opacity, transform;
}

.auth-step-email {
    opacity: var(--email-opacity);
    transform: translateY(var(--email-offset));
}

.auth-step-password {
    opacity: var(--password-opacity);
    transform: translateY(var(--password-offset));
}

.auth-step-remember {
    opacity: var(--remember-opacity);
    transform: translateY(var(--remember-offset));
}

.auth-step-submit {
    opacity: var(--submit-opacity);
    transform: translateY(var(--submit-offset));
}

.auth-field {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.auth-field label {
    color: #574a3c;
    font-family: Georgia, "Times New Roman", serif;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .065em;
    text-transform: uppercase;
}

.auth-field input {
    min-height: 43px;
    border: 1px solid rgba(84, 70, 54, .6);
    border-radius: 4px;
    padding: 9px 11px;
    color: #241f19;
    caret-color: #7c5524;
    background: rgba(246, 240, 222, .84);
    box-shadow:
        inset 0 1px 3px rgba(66, 53, 38, .11),
        0 1px rgba(255, 255, 255, .52);
}

.auth-field input:hover { border-color: rgba(84, 62, 36, .82); }

.auth-field input:focus {
    border-color: #8e6228;
    outline: none;
    background: rgba(253, 249, 237, .94);
    box-shadow:
        0 0 0 3px rgba(135, 91, 35, .16),
        inset 0 1px 3px rgba(66, 53, 38, .09);
}

.auth-validation:empty { display: none; }

.auth-validation {
    margin: 0;
    padding: 7px 9px;
    border: 1px solid rgba(128, 48, 39, .34);
    border-radius: 4px;
    color: #7d251f;
    background: rgba(255, 239, 225, .78);
    font-size: .7rem;
}

.auth-validation ul { margin: 0; padding-left: 17px; }
.story-login-modal .validation-message { color: #842f27; }

.auth-remember {
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #584c3f;
    font-family: Georgia, "Times New Roman", serif;
    font-size: .69rem;
    font-weight: 700;
    cursor: pointer;
}

.auth-remember input {
    width: 15px;
    min-height: 15px;
    margin: 0;
    accent-color: #5b4933;
}

.auth-submit {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1px;
    padding: 8px 9px 8px 15px;
    border: 1px solid #8c744f;
    border-radius: 4px;
    color: #f5ead3;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .055), transparent),
        #28231d;
    box-shadow:
        0 7px 16px rgba(67, 52, 34, .22),
        inset 0 1px rgba(255, 255, 255, .08);
    font-family: Georgia, "Times New Roman", serif;
    font-size: .77rem;
    font-weight: 700;
    letter-spacing: .035em;
    cursor: pointer;
    transition: transform .17s ease, filter .17s ease, box-shadow .17s ease;
}

.auth-submit span:last-child {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(224, 199, 150, .3);
    border-radius: 3px;
    background: rgba(211, 184, 130, .1);
}

.auth-submit:hover {
    filter: brightness(1.08);
    box-shadow:
        0 9px 20px rgba(67, 52, 34, .28),
        inset 0 1px rgba(255, 255, 255, .1);
    transform: translateY(-1px);
}

.auth-submit:active { transform: translateY(0); }

.auth-register {
    min-height: 39px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(103, 84, 61, .42);
    border-radius: 4px;
    color: #4f4336;
    background: rgba(247, 241, 225, .46);
    font-family: Georgia, "Times New Roman", serif;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .045em;
    text-decoration: none;
    transition: border-color .17s ease, background .17s ease, color .17s ease, transform .17s ease;
}

.auth-register:hover {
    border-color: rgba(103, 76, 43, .72);
    color: #2d261f;
    background: rgba(253, 248, 235, .72);
    transform: translateY(-1px);
}

.auth-register:focus-visible {
    outline: 3px solid rgba(135, 91, 35, .22);
    outline-offset: 2px;
}

.story-enhanced .story-track {
    height: 520vh;
    height: 520svh;
}

.story-enhanced .story-viewport {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
}

.story-enhanced .story-finale {
    pointer-events: none;
}

.story-enhanced .story-page[data-story-mode="video"] .story-intro {
    opacity: var(--intro-opacity, 1);
    transform: translateY(var(--intro-offset, 0));
}

.story-enhanced .story-page[data-story-mode="video"] .story-scroll-cue {
    opacity: var(--cue-opacity, 1);
    transform: translate(-50%, var(--cue-offset, 0));
}

.story-page[data-story-mode="static"],
.story-page[data-story-mode="fallback"] {
    --story-progress: 1;
    --grade-opacity: 0;
    --frame-opacity: 1;
    --frame-offset: 0px;
    --email-opacity: 1;
    --email-offset: 0px;
    --password-opacity: 1;
    --password-offset: 0px;
    --remember-opacity: 1;
    --remember-offset: 0px;
    --submit-opacity: 1;
    --submit-offset: 0px;
}

.story-page[data-story-mode="static"] .story-track,
.story-page[data-story-mode="fallback"] .story-track {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
}

.story-page[data-story-mode="static"] .story-viewport,
.story-page[data-story-mode="fallback"] .story-viewport {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
}

.story-page[data-story-mode="static"] .story-intro,
.story-page[data-story-mode="static"] .story-scroll-cue,
.story-page[data-story-mode="fallback"] .story-intro,
.story-page[data-story-mode="fallback"] .story-scroll-cue {
    display: none;
}

.story-page[data-story-mode="static"] .story-finale,
.story-page[data-story-mode="fallback"] .story-finale {
    pointer-events: auto;
}

.story-page.poster-unavailable .story-poster { display: none; }

@keyframes loader-pulse {
    0%, 100% { opacity: .55; transform: scale(.82); }
    50% { opacity: 1; transform: scale(1); }
}

@keyframes scroll-cue {
    0% { opacity: 0; transform: translate(-50%, 0); }
    24% { opacity: 1; }
    68% { opacity: .25; transform: translate(-50%, 13px); }
    100% { opacity: 0; transform: translate(-50%, 13px); }
}

@media (max-width: 900px) and (orientation: portrait) {
    .story-poster img,
    .story-video {
        object-position: center;
    }

    .story-intro {
        top: clamp(26px, 6vh, 58px);
        left: 22px;
        right: 22px;
        max-width: calc(100vw - 44px);
    }

    .story-intro strong {
        max-width: 15ch;
        font-size: clamp(1.9rem, 8.7vw, 3rem);
        line-height: 1.03;
    }

    .story-loading {
        top: 18px;
        right: 17px;
    }

    .story-finale {
        background: none;
    }

    .story-login-modal {
        top: 70%;
        width: min(calc(100% - 32px), 410px);
        padding: 18px;
        border: 1px solid rgba(229, 204, 148, .52);
        border-radius: 17px;
        color: #f4ead2;
        background:
            linear-gradient(145deg, rgba(24, 23, 20, .94), rgba(7, 9, 10, .975));
        box-shadow:
            0 22px 58px rgba(0, 0, 0, .48),
            inset 0 1px rgba(255, 245, 216, .08);
    }

    .story-login-modal::before {
        content: "";
        position: absolute;
        top: 0;
        left: 18px;
        right: 18px;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(242, 216, 155, .76), transparent);
        pointer-events: none;
    }

    .story-login-modal form {
        gap: 13px;
    }

    .auth-field label,
    .auth-remember {
        color: #e4d4ad;
        font-family: inherit;
        font-size: .72rem;
        font-weight: 700;
        letter-spacing: .035em;
        text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
    }

    .auth-field input {
        border-color: rgba(221, 194, 132, .56);
        color: #fbf6e9;
        caret-color: #edcd86;
        background: rgba(4, 6, 7, .82);
        box-shadow:
            inset 0 1px 4px rgba(0, 0, 0, .52),
            0 1px rgba(255, 241, 204, .08);
    }

    .auth-field input:hover { border-color: rgba(236, 209, 147, .78); }

    .auth-field input:focus {
        border-color: #e3bd68;
        background: rgba(5, 6, 6, .76);
        box-shadow:
            0 0 0 3px rgba(218, 178, 88, .17),
            inset 0 1px 4px rgba(0, 0, 0, .48);
    }

    .auth-remember input { accent-color: #d0ab5e; }

    .auth-submit {
        min-height: 46px;
        border-color: #e0c27d;
        color: #1e1912;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, .24), transparent),
            linear-gradient(105deg, #e5cf96, #b78e45);
        box-shadow:
            0 8px 20px rgba(0, 0, 0, .31),
            inset 0 1px rgba(255, 255, 255, .48);
    }

    .auth-submit span:last-child {
        border-color: rgba(55, 42, 22, .26);
        color: #f1dfb4;
        background: rgba(37, 29, 18, .62);
    }

    .auth-register {
        min-height: 43px;
        border-color: rgba(221, 194, 132, .42);
        color: #eadbb8;
        background: rgba(9, 11, 11, .58);
    }

    .auth-register:hover {
        border-color: rgba(236, 209, 147, .72);
        color: #fff7e4;
        background: rgba(20, 20, 17, .78);
    }

    .auth-validation {
        color: #ffd4c8;
        background: rgba(91, 20, 16, .72);
        border-color: rgba(255, 167, 146, .45);
    }

    .story-login-modal .validation-message { color: #ffd0c4; }
}

@media (max-height: 720px) and (orientation: landscape) {
    .story-login-modal {
        top: 72%;
        width: min(36vw, 450px);
    }

    .story-login-modal form { gap: 8px; }
    .auth-field input { min-height: 38px; padding-block: 7px; }
    .auth-submit { min-height: 39px; padding-block: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .story-poster,
    .story-video,
    .story-loading,
    .story-intro,
    .story-scroll-cue,
    .auth-step,
    .auth-submit {
        transition: none;
        animation: none;
    }
}
