:root {
    --scene-width: 1825px;
    --scene-height: 6370px;
    --scene-scale: 1;
    --viewport-height: 100vh;
}

@font-face {
    font-family: "ByteBounce";
    src: url("font/bytebounce.ttf") format("truetype");
    font-display: swap;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background: #070912;
    overscroll-behavior: none;
}

body {
    min-height: 100%;
    overflow-x: hidden;
    color: #fff;
    background: #060811;
    font-family: "ByteBounce", monospace;
    overscroll-behavior: none;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

button {
    font: inherit;
}

img {
    display: block;
    max-width: 100%;
    image-rendering: pixelated;
}

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

#pixel-preloader {
    position: fixed;
    inset: 0;
    min-height: var(--viewport-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #060811;
    z-index: 3000;
    transition: opacity 0.3s ease;
}

#pixel-preloader.hidden {
    opacity: 0;
    pointer-events: none;
}

#pixel-loading-text {
    font-size: 48px;
    letter-spacing: 4px;
}

#pixel-loading-progress {
    font-size: 22px;
    color: #98a2b3;
}

#background-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(180deg, #060811 0%, #070912 45%, #0b1017 100%);
    min-height: var(--viewport-height);
}

#scene-scroll-stage {
    position: relative;
    width: 100%;
}

#quality-toggle {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 16px);
    left: calc(env(safe-area-inset-left, 0px) + 16px);
    width: 104px;
    height: 42px;
    border: 0;
    background-color: transparent;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    z-index: 2500;
    cursor: pointer;
    transition: transform 0.16s ease;
    touch-action: manipulation;
}

#quality-toggle:hover {
    transform: scale(1.04);
}

#quality-toggle:focus-visible,
#tv-lightbox-close:focus-visible,
.tv:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

#viewport-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    width: 100%;
    overflow: hidden;
    height: var(--viewport-height);
    min-height: var(--viewport-height);
}

#scene-scaler {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    will-change: transform;
}

#scene-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #060811;
    touch-action: pan-y pinch-zoom;
}

#sky {
    position: absolute;
    inset: 0;
    background-position: center top;
    background-repeat: no-repeat;
    background-size: cover;
}

#moon {
    position: absolute;
    top: 2.354788%;
    right: 10.958904%;
    width: 27.890411%;
    height: 7.613814%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    z-index: 1;
}

.layer {
    position: absolute;
    left: 50%;
    width: 100%;
    background-position: center top;
    background-repeat: no-repeat;
    background-size: 100% auto;
}

#city-far {
    top: 6.279435%;
    height: 37.503925%;
    z-index: 2;
}

#city-mid {
    top: 5.494506%;
    height: 26.138147%;
    z-index: 3;
}

#city-near {
    top: 3.924647%;
    height: 51.805338%;
    z-index: 4;
}

#clouds {
    position: absolute;
    top: 3.139717%;
    width: 100%;
    height: 8.791209%;
    z-index: 5;
    pointer-events: none;
}

.cloud {
    position: absolute;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.82;
}

.cloud1 {
    top: 3.571429%;
    left: 8.219178%;
    width: 40.60274%;
    height: 94.821429%;
}

.cloud2 {
    top: 14.285714%;
    right: 8.219178%;
    width: 38.849315%;
    height: 59.642857%;
}

#building,
#storefront,
#street,
#awning,
#manhole,
.window,
.store-layer,
.store-item-layer3,
.tv,
.tv-screen-media,
.lamp-post,
#fire-escape-element {
    background-repeat: no-repeat;
}

#building {
    position: absolute;
    left: 50%;
    bottom: 6.216641%;
    width: 97.315068%;
    height: 68.115856%;
    transform: translateX(-50%);
    background-size: 100% 100%;
    z-index: 6;
}

#windows-container,
#fire-escapes {
    position: absolute;
    left: 50%;
    bottom: 6.216641%;
    width: 97.315068%;
    height: 68.115856%;
    transform: translateX(-50%);
    pointer-events: none;
}

#windows-container {
    z-index: 7;
}

#fire-escapes {
    z-index: 8;
}

.window {
    position: absolute;
    background-size: 100% 100%;
}

.store-layer,
.store-item-layer3 {
    position: absolute;
    pointer-events: none;
    background-size: contain;
}

#store-curtain {
    z-index: 10;
}

#store-background-stuff {
    z-index: 11;
}

.store-item-layer3 {
    z-index: 12;
}

#store-tvs {
    position: absolute;
    inset: 0;
    z-index: 13;
    pointer-events: none;
}

.tv-slot {
    position: absolute;
    z-index: 13;
    pointer-events: none;
}

.tv-screen {
    position: absolute;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.tv {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    cursor: pointer;
    background-color: transparent;
    background-size: contain;
    transition: transform 0.18s ease;
    touch-action: manipulation;
    z-index: 2;
    pointer-events: auto;
}

.tv-screen-media {
    position: absolute;
    inset: 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .tv:hover {
        transform: scale(1.03);
    }
}

#store-cash-only {
    z-index: 14;
}

#store-glass {
    z-index: 15;
}

#storefront {
    position: absolute;
    left: 50%;
    bottom: 6.216641%;
    width: 91.616438%;
    height: 17.409733%;
    transform: translateX(-50%);
    background-size: 100% 100%;
    z-index: 16;
    pointer-events: none;
}

#awning {
    position: absolute;
    left: 0;
    width: 100%;
    height: 5.82339%;
    z-index: 17;
    background-position: center top;
    background-size: 100% 100%;
    transform-origin: center bottom;
}

#street {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 6.216641%;
    background-position: center top;
    background-size: 100% 100%;
    z-index: 18;
}

#manhole {
    position: absolute;
    left: 50%;
    bottom: 2.825746%;
    width: 10.958904%;
    height: 3.045526%;
    transform: translateX(-50%);
    background-size: 100% 100%;
    z-index: 19;
    pointer-events: none;
}

#lamp-posts {
    position: absolute;
    inset: 0;
    z-index: 19;
    overflow: hidden;
    pointer-events: none;
}

.lamp-post {
    position: absolute;
    background-size: 100% 100%;
}

body:not(.touch-device) .lamp-post.is-on {
    filter: drop-shadow(0 0 20px rgba(255, 209, 115, 0.22));
}

body.low-quality #city-far {
    top: 6.279435%;
}

body.low-quality #city-mid {
    top: 5.494506%;
}

body.low-quality #city-near {
    top: 3.924647%;
    height: 51.805338%;
}

body.low-quality #moon {
    top: 3.296703%;
    right: 16.438356%;
    width: 16.164384%;
    height: 4.395604%;
    background-size: 100% 100%;
}

body.low-quality .cloud1 {
    top: 3.571429%;
    width: 40.60274%;
    height: 94.821429%;
}

body.low-quality .cloud2 {
    width: 38.849315%;
    height: 59.642857%;
}

body.low-quality #store-curtain {
    transform: none;
}

body.low-quality #store-glass {
    display: none;
}

#tv-lightbox[hidden] {
    display: none;
}

#tv-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3200;
}

.tv-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 8, 17, 0.82);
    backdrop-filter: blur(4px);
}

.tv-lightbox-panel {
    position: relative;
    width: min(90vw, 560px);
    margin: max(40px, calc(env(safe-area-inset-top, 0px) + 24px)) auto 0;
    padding: 22px 18px 18px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: rgba(13, 18, 31, 0.96);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

#tv-lightbox-title {
    font-size: 22px;
    margin-bottom: 16px;
    padding-right: 42px;
}

#tv-lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
}

#tv-lightbox-image {
    width: 100%;
    height: auto;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #02040a;
    image-rendering: pixelated;
}

.parallax,
.cloud,
#awning {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
}

body.touch-device .parallax,
body.touch-device .cloud,
body.touch-device #awning,
body.touch-device #scene-scaler {
    will-change: auto;
}

body.touch-device #viewport-wrapper,
body.touch-device #scene-container {
    touch-action: pan-y pinch-zoom;
}

@media (prefers-reduced-motion: reduce) {
    .tv,
    #quality-toggle,
    #pixel-preloader,
    .tv-screen-media {
        transition: none;
    }
}

@media (max-width: 768px) {
    #pixel-loading-text {
        font-size: 32px;
        letter-spacing: 2px;
    }

    #pixel-loading-progress {
        font-size: 18px;
    }

    #quality-toggle {
        width: 92px;
        height: 38px;
    }

    .tv-lightbox-panel {
        width: min(92vw, 520px);
        margin-top: max(16px, calc(env(safe-area-inset-top, 0px) + 12px));
        padding: 18px 14px 14px;
    }

    #tv-lightbox-title {
        font-size: 18px;
    }
}
