
/* =========================================================
   GLOBAL
========================================================= */

html,
body {
    margin: 0;
    padding: 0;

    width: 100%;
    height: 100%;
    height: 100dvh;

    overflow: hidden;

    overscroll-behavior: none;
}

* {
    box-sizing: border-box;
}

#app-shell {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100%;
    height: 100dvh;

    z-index: 99999;

    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 1;

    transition:
        opacity 600ms ease,
        transform 600ms ease;

    overflow: hidden;
}

#app-shell.shell-fade-out {
    opacity: 0;
    transform: scale(1.03);
    pointer-events: none;
}

#app-shell.logo-visible {
    opacity: 1;
    transform: scale(1);
}

#advanced-loader,
#standard-loader {
    display: none;
}

/* =========================================================
   ADVANCED LOADER
========================================================= */

.loader-background,
.advanced-loader {
    position: absolute;
    inset: 0;
}

/*
   The animation is width-driven.

   Original composition:
   440 x 915

   Canvas width = viewport width
   Canvas height = width * (915 / 440)

   The bottom of the animation is always aligned
   with the bottom of the viewport.
*/

.entry-logo-wrapper {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100%;
    height: 100dvh;

    overflow: hidden;

    display: block;

    pointer-events: none;
}

/* =========================================================
   ADVANCED LOTTIE CANVASES
========================================================= */

/* =========================================================
   MAIN ANIMATION — COVER VIEWPORT
========================================================= */

#lottie-loader-main {
    position: fixed;

    left: 50%;
    bottom: 0;

    width: max(100vw, calc(100dvh * 440 / 915));
    height: max(100vw * 915 / 440, 100dvh);

    max-width: none;
    max-height: none;

    transform: translateX(-50%) translateZ(0);

    transform-origin: bottom center;

    display: block;

    will-change: transform, opacity;

    transition: opacity 300ms ease;

    opacity: 0;

    pointer-events: none;
}


/* =========================================================
   SECOND ANIMATION — LOGO
   FIT WIDTH WITH SIDE PADDING
========================================================= */

#lottie-loader-logo {
    position: fixed;

    left: 50%;
    top: 50%;

    /*
       Always stay within the viewport width,
       leaving padding on both sides.
    */
    width: min(90vw, 700px);
    height: auto;

    aspect-ratio: 440 / 915;

    max-width: none;
    max-height: none;

    transform: translate(-50%, -50%) translateZ(0);

    transform-origin: center center;

    display: block;

    will-change: transform, opacity;

    transition: opacity 300ms ease;

    opacity: 0;

    pointer-events: none;
}

/* Main animation */
#lottie-loader-main {
    z-index: 1;
}

/* Logo animation overlays the main animation */
#lottie-loader-logo {
    z-index: 2;
    padding: 0;
}

/* =========================================================
   STARTUP PANEL
========================================================= */

#startup-panel {

    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    z-index: 20;

    background: white;

    border-radius: 24px 24px 0 0;

    padding: 24px;

    padding-bottom: max(24px, env(safe-area-inset-bottom));

    transform: translateY(100%);

    transition: transform 500ms ease;

    box-shadow:
        0 -10px 30px rgba(0, 0, 0, 0.08);
}

#startup-panel.visible {
    transform: translateY(0);
}

.startup-content {
    display: flex;
    flex-direction: column;

    font-family: Arial, sans-serif;

    gap: 16px;
}

.startup-title {
    margin: 0;

    font-size: 20px;
    font-weight: 600;

    color: #222;
}

#city-select,
#language-select {

    width: 100%;
    height: 48px;

    border-radius: 12px;

    border: 1px solid #ddd;

    padding: 0 12px;

    font-size: 16px;

    background: white;

    outline: none;
}

#startup-continue {

    margin-top: 8px;

    height: 52px;

    border: none;

    border-radius: 14px;

    background: black;

    color: white;

    font-size: 16px;
    font-weight: 600;

    cursor: pointer;

    transition:
        opacity 200ms ease,
        transform 200ms ease;
}

#startup-continue:active {
    transform: scale(0.98);
}

/* =========================================================
   STANDARD LOADER
========================================================= */

.standard-loader {
    position: absolute;
    inset: 0;
}

.standard-entry-logo-wrapper {

    position: fixed;
    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
    height: 100dvh;

    z-index: 2;
}

#standard-lottie-loader {

    position: relative;

    width: 260px;
    height: 260px;

    z-index: 3;
}

.standard-loader-center-logo {

    position: absolute;

    width: 162px;
    height: 162px;

    object-fit: contain;

    border-radius: 50%;

    z-index: 4;

    pointer-events: none;
}

.standard-loader-background {

    position: fixed;
    inset: 0;

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    z-index: 1;
}

/* =========================================================
   BACKGROUND DEFAULTS
========================================================= */

#app-shell,
#advanced-loader,
#standard-loader,
.loader-background,
.standard-loader-background {
    background: transparent;
}

/* =========================================================
   SMALL SCREENS
========================================================= */

@media (max-width: 600px) {

    #startup-panel {
        padding: 20px;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .startup-title {
        font-size: 18px;
    }
}

/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    #app-shell,
    #startup-panel,
    #lottie-loader-main,
    #lottie-loader-logo {
        transition-duration: 0.01ms;
    }
}
