@font-face {
    font-family: "Laila-Bold";
    src: url("src/fonts/Laila/Laila-Bold.ttf");
}

@font-face {
    font-family: "Laila-SemiBold";
    src: url("src/fonts/Laila/Laila-SemiBold.ttf");
}

@font-face {
    font-family: "Laila";
    src: url("src/fonts/Laila/Laila-Medium.ttf");
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    touch-action: none;
}

body {
    font-family: Laila, sans-serif;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: #87ceeb;
}

#viewport {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    touch-action: none;
}

#BG {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(143vh * (4096 / 1714));
    height: 143vh;
    transform-origin: 0 0;
    touch-action: none;
    will-change: transform;
}

#BG_img,
#BG_img_old {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

#BG_img_old {
    opacity: 0;
    z-index: 0;
    transition: opacity 0.8s ease;
}

#BG_img_old.fading {
    opacity: 1;
}

#snow_canvas {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    z-index: 1;
}

#unicorn {
    position: absolute;
    top: 18%;
    left: 3%;
    width: 5%;
    height: auto;
    z-index: 10;
    filter: drop-shadow(0rem 0rem 0.25rem rgb(50, 50, 50));
    transform: scaleX(-1);
    pointer-events: none;
    will-change: left, top, transform;
}

#unicorn img {
    width: 100%;
    height: auto;
    display: none;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

#unicorn img.frame-active {
    display: inline-block;
}

#title {
    position: absolute;
    top: 2%;
    line-height: 0em;
    margin-inline: 1em;
    filter: drop-shadow(0 0 0.25rem rgb(255, 217, 0));
}

h1 {
    font-family: Laila-Bold;
    font-style: normal;
    font-size: clamp(14pt, 5vh, 36pt);
}

#open_instructions {
    position: fixed;
    top: 2%;
    right: 2%;
    height: 15%;
    min-height: 40px;
    background: none;
    border: none;
    border-radius: 50%;
    padding: 0;
    z-index: 100;
    cursor: pointer;
}

#Guide_Button {
    height: 100%;
    transition: transform 0.2s ease;
    user-select: none;
    filter: drop-shadow(0 0 0.5rem rgba(255, 217, 0, 0.8));
}

#open_instructions:active #Guide_Button {
    transform: rotate(25deg);
}

#instructions {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.4);
}

#instructions > div {
    position: relative;
    width: 90vw;
    max-width: 500px;
    max-height: 70vh;
    background-color: rgba(240, 248, 255, 0.95);
    border-radius: 20px;
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
}

#instructions h2 {
    font-family: Laila-Bold;
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    margin: 0 0 1rem 0;
    color: #333;
}

#instructions p {
    font-family: Laila;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    margin: 0.8rem 0;
    color: #555;
    line-height: 1.5;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 201;
}

.close-button img {
    width: 100%;
    height: 100%;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 0 0.5rem rgba(255, 217, 0, 0.8));
}

.close-button:active img {
    transform: rotate(25deg);
}

#slider {
    -webkit-appearance: none;
    appearance: none;
    position: fixed;
    bottom: 8vh;
    left: 10vw;
    width: 80vw;
    height: 44px;
    min-height: 44px;
    border-radius: 25px;
    opacity: 0.85;
    outline: none;
    z-index: 50;
    background-image: linear-gradient(to right,
        white,
        white 24%,
        black 24%,
        black 24.5%,
        white 24.5%,
        white 50%,
        black 50%,
        black 50.5%,
        white 50.5%,
        white 75%,
        black 75%,
        black 75.5%,
        white 75.5%,
        white 100%);
    cursor: pointer;
}

#slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 60px;
    min-width: 44px;
    min-height: 44px;
    background-image: url(src/images/Slider_Knob.png);
    background-size: cover;
    filter: drop-shadow(0 0 0.5rem rgba(255, 217, 0, 0.8));
    border-radius: 50%;
    border: none;
    outline: none;
    cursor: pointer;
    transform: rotateZ(var(--thumb-rotate, 0deg));
}

#slider::-moz-range-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 60px;
    background-image: url(src/images/Slider_Knob.png);
    background-size: cover;
    filter: drop-shadow(0 0 0.5rem rgba(255, 217, 0, 0.8));
    border-radius: 50%;
    border: none;
    outline: none;
    cursor: pointer;
    transform: rotateZ(var(--thumb-rotate, 0deg));
}

.dot-container {
    display: inline-block;
    position: absolute;
    height: 4%;
    width: auto;
    pointer-events: none;
}

.dot {
    width: auto;
    height: 100%;
    fill: blanchedalmond;
    filter: drop-shadow(0 0 0.25rem rgb(255, 217, 0));
    animation-name: spin;
    animation-duration: 2500ms;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
    animation-direction: alternate;
}

.dot .cls-1 {
    animation-name: blinking;
    animation-duration: 1250ms;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
    animation-direction: alternate;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes blinking {
    0% { fill: black; stroke: black; }
    100% { fill: blanchedalmond; stroke: blanchedalmond; }
}

#art1 {
    top: 30%;
    left: 32%;
}

#art2 {
    top: 50%;
    left: 5%;
}

#art3 {
    top: 80%;
    left: 44%;
}

#art4 {
    top: 37%;
    left: 54%;
}

.preview {
    display: inline-block;
    visibility: hidden;
    position: absolute;
    padding: 0;
    border-radius: 1em;
    background-color: black;
    min-width: min-content;
    max-width: 55vw;
    max-height: 30%;
    min-height: min-content;
    font-size: 1em;
    pointer-events: auto;
    z-index: 15;
    transition: transform 0.15s ease;
}

#art1Preview {
    top: 30%;
    left: 34%;
}

#art2Preview {
    top: 50%;
    left: 7%;
}

#art3Preview {
    top: 80%;
    left: 46%;
}

#art4Preview {
    top: 37%;
    left: 56%;
}

.artlink {
    display: block;
    color: white;
    background-color: black;
    font-family: Laila;
    font-size: clamp(10pt, 2vh, 18pt);
    text-decoration: underline;
    padding: 0.8em 1em;
    min-height: min-content;
    line-height: 1.4;
    border-radius: 1em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: center;
    box-sizing: border-box;
    width: 100%;
}

.preview:active {
    transform: scale(0.92);
}

.desktop-only {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .desktop-only {
        display: block;
    }

    .mobile-only {
        display: none;
    }
}

@media (min-width: 768px) {
    #slider {
        width: 70vw;
        left: 15vw;
        bottom: 10vh;
    }

    #instructions > div {
        width: 70vw;
        max-width: 600px;
    }
}

@media (min-width: 1024px) {
    #slider {
        width: 60vw;
        left: 20vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    #Guide_Button,
    .close-button img {
        transition: none;
    }
}

@media (max-height: 600px) {
    #slider {
        bottom: 5vh;
        height: 36px;
        min-height: 36px;
    }

    #slider::-webkit-slider-thumb,
    #slider::-moz-range-thumb {
        width: 50px;
        height: 50px;
    }

    #instructions > div {
        max-height: 80vh;
        padding: 1rem;
    }
}
