html,
body {
    margin: 0;
    padding: 0;
    background-color: #0E3485;
    background-image:
        url("../img/Blue_Print_Pattern.png"),
        linear-gradient(to bottom, #2660DE 0%, #0E3485 100%);
    background-repeat: repeat, no-repeat;
    background-size: 512px 512px, cover;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

[hidden] {
    display: none !important;
}

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

#welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

#welcome-logo {
    width: 120px;
    height: auto;
    margin-bottom: 16px;
}

#welcome-text-title {
    color: #263238;
    font-family: 'Open Sans', sans-serif;
    font-weight: 800;
    font-size: 25px;
    margin: 0;
    text-align: center;
}

#welcome-text {
    color: #263238;
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    font-size: 18px;
    margin: 0;
    text-align: justify;
    max-width: 300px;
    padding: 12px;
}

#scan-button {
    background-color: #fff;
    color: #263238;
    border: none;
    border-radius: 999px;
    padding: 18px 40px;
    font-size: 18px;
    font-weight: 800;
    /* font-style: italic; */
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#scan-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#scan-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#scanner-panel {
    position: relative;
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: center;
}

#reader-wrapper {
    transform: translateY(calc(-50vh - 50% - 24px));
    transform: translateY(calc(-50dvh - 50% - 24px));
    transition: transform 600ms cubic-bezier(0.22, 0.78, 0.24, 1);
    will-change: transform;
    z-index: 1;
}

#scanner-panel.is-open #reader-wrapper {
    transform: translateY(0);
}

#scanner-panel.is-direct-preview #reader-wrapper {
    visibility: hidden;
    transform: translateY(0);
    transition: none;
}

#scanner-panel.is-model-open #reader-wrapper {
    transform: translateY(0) rotate(-2deg);
}

#model-card-slot {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 4;
}

#model-card {
    position: relative;
    width: min(82vw, 458px);
    width: min(82vw, calc(72.028svh - 126.77px), 458px);
    aspect-ratio: 618 / 858;
    touch-action: none;
    user-select: none;
    cursor: grab;
    pointer-events: none;
    isolation: isolate;
    transform: translateY(calc(-50vh - 50% - 24px)) rotate(2deg);
    transform: translateY(calc(-50dvh - 50% - 24px)) rotate(2deg);
    transition: transform 600ms cubic-bezier(0.22, 0.78, 0.24, 1);
    will-change: transform;
}

#scanner-panel.is-model-open #model-card {
    pointer-events: auto;
    transform: translate3d(0, 0, 0) rotate(2deg);
}

#model-card.is-dragging {
    cursor: grabbing;
    transition: none;
}

#model-card.is-dismissing {
    pointer-events: none;
    transition: transform 340ms cubic-bezier(0.4, 0, 1, 1);
}

#model-preview-window {
    position: absolute;
    inset:
        calc(2.45% - 3px)
        calc(4.37% - 3px)
        calc(4.2% - 3px)
        calc(4.85% - 3px);
    overflow: hidden;
    border-radius: 18px 18px 15px 15px;
    background: #1594f6;
    z-index: 1;
}

#model-preview {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#model-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    background: #1594f6;
}

#model-card-frame {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    z-index: 2;
    filter: drop-shadow(0 8px 6px rgba(5, 20, 55, 0.3));
}

#remix-button {
    position: absolute;
    bottom: 6.2%;
    left: 50%;
    z-index: 3;
    min-width: 104px;
    padding: 15px 38px;
    border-radius: 999px;
    color: #404348;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.28);
    font-family: 'Open Sans', sans-serif;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 160ms ease, transform 150ms ease, box-shadow 150ms ease;
}

#model-card.is-ready #remix-button {
    opacity: 1;
    pointer-events: auto;
}

#remix-button:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.32);
    transform: translateX(-50%) translateY(-1px);
}

#remix-button:active {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.24);
    transform: translateX(-50%) translateY(1px);
}

#scanner-controls {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(82vw, 458px);
    transform: translateX(-50%);
    transition: opacity 160ms ease;
    z-index: 6;
}

#scanner-panel.is-model-open #scanner-controls {
    opacity: 0;
    pointer-events: none;
}

#status {
    width: 100%;
    min-height: 22px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 180ms ease 360ms, transform 180ms ease 360ms;
}

#cancel-button {
    margin-top: 10px;
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 999px;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-6px);
    transition:
        opacity 180ms ease 420ms,
        transform 180ms ease 420ms,
        background-color 150ms ease;
}

#cancel-button:hover {
    background: rgba(255, 255, 255, 0.12);
}

#cancel-button:disabled {
    cursor: default;
}

#scanner-panel.is-open #status,
#scanner-panel.is-open #cancel-button {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 480px) {
    body {
        padding-right: 16px;
        padding-left: 16px;
    }

    #model-card {
        width: min(88vw, calc(72.028svh - 121.01px), 458px);
    }

    #scanner-controls {
        width: min(88vw, 458px);
    }

    #status {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #reader-wrapper,
    #model-card,
    #scanner-controls,
    #status,
    #cancel-button {
        transition-duration: 0.01ms;
        transition-delay: 0ms;
    }
}
