@font-face {
    font-family: "Who Asks Satan";
    src: url("../assets/fonts/Who Asks Satan.ttf");
}

@font-face {
    font-family: "HorroroidBold";
    src: url("../assets/fonts/horroroidbold.ttf") format("truetype");
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100%;
    height: 100vh;
    background-color: #050505;
}

.home {
    width: 100%;
    height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;

    background-image: url("../assets/images/school.png");
    background-size: 100% 100%;
    background-position: center;
}

.home-content {
    position: relative;
    text-align: center;
    animation: titleAppear 2s ease;
    transform: translateY(50px);
}

.home-content h1 {
    color: #173e19;
    font-size: 80px;
    font-family: "Who Asks Satan";
    letter-spacing: 8px;

    text-align: center;
    width: 100%;

    transform: translateX(15px);

    text-shadow: 0 0 15px rgb(250, 250, 250);
}

.home-content p {
    color: #fcf8f8;
    font-size: 20px;
    margin-top: 20px;
    letter-spacing: 3px;

    text-shadow:
        2px 2px 2px #070707,
        -2px -2px 2px #7b7979,
        2px -2px 2px #070707,
        -2px 2px 2px #551010,
        0 0 8px rgba(0, 0, 0, 0.9);

    padding: 8px 18px;

    background-color: rgba(0, 0, 0, 0.30);

    display: block;
}

.home-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;

    margin-top: 25px;
}

.home-content button {
    width: 160px;

    padding: 11px 25px;

    background-color: #3b1111;
    color: #d8d8d0;

    border: 1px solid #d8d8d0;

    font-size: 15px;
    letter-spacing: 3px;

    cursor: pointer;

    transition: 0.3s ease;
}

.home-content button:hover {
    background-color: #6e1010;
    border-color: #6e1010;
    color: white;

    transform: scale(1.05);
}

/* =========================
   HOME SETTINGS BUTTON
========================= */

.home-content .settings-button {
    display: block;

    margin: 15px auto 0;

    padding: 10px 28px;

    background-color: rgba(59, 17, 17, 0.75);

    color: #d8d8d0;

    border: 1px solid #d8d8d0;

    font-size: 14px;

    letter-spacing: 3px;

    cursor: pointer;

    transition: 0.3s ease;
}

.home-content .settings-button:hover {
    background-color: #6e1010;

    border-color: #6e1010;

    color: white;

    transform: scale(1.05);
}

.overlay {
    position: absolute;

    width: 100%;
    height: 100%;

    background-color: rgba(0, 0, 0, 0.25);
}

@keyframes titleAppear {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }

}

.story {
    min-height: 100vh;

    background-image: url("../assets/images/classroom.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    position: relative;
    color: #d8d8d0;
}

.story::before {
    content: "";

    position: absolute;
    inset: 0;

    background-color: rgba(0, 0, 0, 0.18);
}

.story-time {
    color: #aaa9a0;
    font-size: 13px;
    letter-spacing: 3px;
    margin-bottom: 12px;
}

.story-text {
    color: #e0e0d8;
    font-size: 19px;
    line-height: 1.7;

    max-width: 800px;

    margin: 0 auto 20px;

    letter-spacing: 0.5px;
}

.next-button {
    display: block;
    margin-left: auto;

    padding: 8px 22px;

    background-color: transparent;

    color: #d8d8d0;

    border: 1px solid #666;

    cursor: pointer;

    font-size: 13px;
    letter-spacing: 2px;

    transition: 0.3s ease;
}

.next-button:hover {
    background-color: #6e1010;
    border-color: #6e1010;

    color: white;

    transform: scale(1.05);
}

.story-content {
    position: absolute;

    bottom: 40px;
    left: 50%;

    transform: translateX(-50%);

    width: 80%;
    max-width: 900px;

    padding: 25px 30px;

    background-color: rgba(51, 51, 51, 0.7);

    border: 1px solid rgba(180, 180, 180, 0.25);

    box-sizing: border-box;

    z-index: 1;
}

.gate {
    width: 100%;
    min-height: 100vh;

    background-image: url("../assets/images/gate.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    position: relative;
}

.character-layer {
    position: absolute;

    inset: 0;

    display: flex;
    justify-content: center;
    align-items: flex-end;

    pointer-events: none;

    z-index: 1;
}

.character-sprite {
    position: absolute;

    bottom: 0;

    max-height: 80vh;
    max-width: 40vw;

    object-fit: contain;

    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}

.character-left {
    left: 12%;
}

.character-right {
    right: 12%;
}

.dialog-box {
    position: absolute;

    left: 50%;
    bottom: 100px;

    transform: translateX(-50%);

    width: 80%;
    max-width: 900px;

    height: 150px;

    padding: 25px 30px;

    background-color: rgba(51, 51, 51, 0.7);

    border: 1px solid rgba(180, 180, 180, 0.25);

    box-sizing: border-box;

    color: #d8d8d0;

    z-index: 2;
}

.speaker-name {
    font-size: 14px;

    font-weight: bold;

    letter-spacing: 2px;

    margin-bottom: 8px;
}

.dialog-text {
    font-size: 19px;

    line-height: 1.7;

    letter-spacing: 0.5px;

    max-width: 800px;
}

.dialog-box .next-button {
    position: absolute;

    right: 30px;
    bottom: 20px;

    padding: 8px 22px;

    background-color: transparent;

    color: #d8d8d0;

    border: 1px solid #666;

    cursor: pointer;

    font-size: 13px;

    letter-spacing: 2px;

    transition: 0.3s ease;
}

.character-left {
    left: 10%;
}

.character-right {
    right: 10%;
}

.scene-transition {
    position: fixed;

    inset: 0;

    background-color: #000;

    opacity: 0;

    pointer-events: none;

    z-index: 9999;

    transition: opacity 0.8s ease;
}

.scene-transition.fade-out {
    opacity: 1;
}

/* =========================
   PAGE TRANSITION
========================= */

.page-transition {
    position: fixed;

    inset: 0;

    background: #000;

    opacity: 0;

    pointer-events: none;

    z-index: 99999;

    transition:
        opacity 1s ease;
}

.page-transition.active {
    opacity: 1;

    pointer-events: all;
}

/* =========================
   LEVEL PAGE FADE IN
========================= */

.level-page {
    min-height: 100vh;

    opacity: 0;

    animation: levelPageAppear 1.2s ease forwards;

    background-image: url("../assets/images/bglevel.png");

    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;

    font-family: "HorroroidBold", sans-serif;
}

@keyframes levelPageAppear {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }

}

.character-enter {
    animation: characterEnter 0.35s ease;
}

@keyframes characterEnter {

    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}

/* =========================
   HORROR EFFECT
========================= */

.horror-overlay {
    position: absolute;
    inset: 0;

    background: rgba(0, 0, 0, 0);

    z-index: 5;

    pointer-events: none;
}


/* =========================
   STATIC / GLITCH EFFECT
========================= */

.static-effect {
    position: absolute;
    inset: 0;

    background:
        repeating-linear-gradient(
            0deg,
            rgba(255,255,255,0.03) 0px,
            rgba(255,255,255,0.03) 1px,
            transparent 1px,
            transparent 4px
        );

    opacity: 0;

    z-index: 6;

    pointer-events: none;
}


/* =========================
   HORROR FLASH
========================= */

.horror-flash {
    animation: horrorFlash 0.12s ease;
}

@keyframes horrorFlash {

    0% {
        opacity: 0;
    }

    50% {
        opacity: 0.35;
    }

    100% {
        opacity: 0;
    }

}


/* =========================
   SCREEN SHAKE
========================= */

.screen-shake {
    animation: screenShake 0.5s linear;
}

@keyframes screenShake {

    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    10% {
        transform: translate(-12px, -9px) rotate(-0.6deg);
    }

    20% {
        transform: translate(10px, 13px) rotate(0.7deg);
    }

    30% {
        transform: translate(-15px, 6px) rotate(-0.8deg);
    }

    40% {
        transform: translate(13px, -14px) rotate(0.9deg);
    }

    50% {
        transform: translate(-8px, 11px) rotate(-0.7deg);
    }

    60% {
        transform: translate(15px, -6px) rotate(0.8deg);
    }

    70% {
        transform: translate(-13px, -12px) rotate(-0.9deg);
    }

    80% {
        transform: translate(9px, 14px) rotate(0.6deg);
    }

    90% {
        transform: translate(-7px, -8px) rotate(-0.5deg);
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
    }

}

/* =========================
   STATIC ACTIVE
========================= */

.static-active {
    opacity: 1;
    animation: staticFlicker 0.15s infinite;
}

@keyframes staticFlicker {

    0% {
        opacity: 0.15;
    }

    50% {
        opacity: 0.45;
    }

    100% {
        opacity: 0.1;
    }

}


/* =========================
   DARK SCREEN
========================= */

.dark-scene {
    animation: darkScene 1s ease;
}

@keyframes darkScene {

    0% {
        background-color: rgba(0,0,0,0);
    }

    50% {
        background-color: rgba(0,0,0,0.85);
    }

    100% {
        background-color: rgba(0,0,0,0);
    }

}


/* =========================
   LEVEL PAGE
========================= */

.level-page {
    min-height: 100vh;

    background-image: url("../assets/images/bglevel.png");

    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;

    font-family: "HorroroidBold", sans-serif;
}

.level-page h1 {
    text-align: center;
    font-size: 90px;
    margin: 0;
    padding-top: 80px;
    color: #fafafa;
    letter-spacing: 5px;
}

.level-card {
    width: 280px;
    margin: 50px auto 0;
    padding: 25px;
    text-align: center;

    background: rgba(45, 25, 15, 0.85);
    border: 2px solid #d8c0a0;
    border-radius: 8px;

    box-sizing: border-box;
}

.level-card p {
    margin: 0 0 10px;
    font-size: 20px;
    color: #d8c0a0;
}

.level-card h2 {
    margin: 0 0 25px;
    font-size: 32px;
    color: #fafafa;
}

.level-card button {
    padding: 10px 30px;

    font-family: "HorroroidBold", sans-serif;
    font-size: 18px;

    color: #fafafa;
    background: #5b1e16;

    border: 1px solid #d8c0a0;
    border-radius: 5px;

    cursor: pointer;
}

.level-container {
    width: 90%;
    max-width: 1000px;
    margin: 50px auto 180px;

    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.level-card button.locked {
    background: #2b211c;
    color: #8f8175;
    border-color: #6b5b4d;
    cursor: not-allowed;
    opacity: 0.7;
}

.level-card:last-child {
    grid-column: 2;
}


/* =========================
   CLASSROOM GAMEPLAY
========================= */

.game-hud {
    position: absolute;

    top: 25px;
    left: 30px;
    right: 30px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    z-index: 10;

    font-family: "HorroroidBold", sans-serif;
    font-size: 17px;
    letter-spacing: 2px;

    color: #e0e0d8;

    text-shadow:
        2px 2px 4px #000;
}

.game-hud div {
    padding: 10px 16px;

    background-color: rgba(0, 0, 0, 0.55);

    border: 1px solid rgba(216, 192, 160, 0.45);
}

.trash-area {
    position: absolute;

    inset: 0;

    z-index: 3;

    pointer-events: none;
}


/* =========================
   HIDDEN TRASH
========================= */

.hidden-trash {
    position: absolute;

    width: 28px;

    height: auto;

    cursor: pointer;

    pointer-events: auto;

    user-select: none;

    z-index: 10;

    opacity: 0.58;

    filter:
        brightness(0.28)
        saturate(0.7)
        contrast(0.9)
        drop-shadow(0 0 3px rgba(0, 0, 0, 0.9));

    transition:
        transform 0.2s ease,
        filter 0.2s ease,
        opacity 0.2s ease;
}

.hidden-trash:hover {
    opacity: 0.85;

    filter:
        brightness(0.5)
        saturate(0.8)
        contrast(1)
        drop-shadow(0 0 4px rgba(0, 0, 0, 1));

    transform: scale(1.08);
}

.trash-item {
    position: absolute;

    width: 50px;

    left: 30%;
    bottom: 20%;

    cursor: pointer;
}


/* =========================
   LEVEL COMPLETE
========================= */

.level-complete {
    position: fixed;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    display: none;

    justify-content: center;
    align-items: center;

    background: rgba(0, 0, 0, 0.65);

    z-index: 100;
}

.level-complete-box {
    width: 430px;

    padding: 45px 35px;

    text-align: center;

    background: rgba(35, 18, 12, 0.95);

    border: 2px solid #d6c3a5;

    border-radius: 10px;

    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.8);
}

.level-complete-box h2 {
    margin: 0 0 20px;

    font-family: "HorroroidBold", sans-serif;

    font-size: 42px;

    color: #fafafa;

    letter-spacing: 2px;
}

.level-complete-box p {
    margin-bottom: 30px;

    font-family: "HorroroidBold", sans-serif;

    font-size: 18px;

    color: #d6c3a5;
}

.final-score {
    display: flex;

    justify-content: center;

    gap: 40px;

    margin-bottom: 30px;

    font-family: "HorroroidBold", sans-serif;

    color: #fafafa;

    font-size: 18px;
}

.final-score span {
    display: flex;

    flex-direction: column;

    gap: 8px;
}

.final-score strong {
    font-size: 28px;

    color: #d6c3a5;
}

#continueButton {
    width: 180px;

    padding: 12px 20px;

    font-family: "HorroroidBold", sans-serif;

    font-size: 18px;

    color: #fafafa;

    background: #54231b;

    border: 1px solid #d6c3a5;

    border-radius: 6px;

    cursor: pointer;

    transition: 0.2s ease;
}

#continueButton:hover {
    background: #733126;

    transform: scale(1.05);
}


/* =========================
   EPISODE BACKGROUNDS
========================= */

.story {
    position: relative;
    width: 100%;
    min-height: 100vh;

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    overflow: hidden;
}


/* EP 01 */

.story.classroom {
    background-image:
        url("../assets/images/classroom.png");
}


/* EP 02 */

.story.canteen {
    background-image:
        url("../assets/images/canteen.png");
}


/* EP 03 */

.story.bathroom {
    background-image:
        url("../assets/images/bathroom.png");
}


/* EP 04 */

.story.lab {
    background-image:
        url("../assets/images/lab.png");
}


/* EP 05 */

.story.library {
    background-image:
        url("../assets/images/library.png");
}


/* EP 06 */

.story.teachers {
    background-image:
        url("../assets/images/teachers.png");
}


/* EP 07 */

.story.storage {
    background-image:
        url("../assets/images/storage.png");
}


/* EP 08 */

.story.art {
    background-image:
        url("../assets/images/art.png");
}


/* EP 09 */

.story.music {
    background-image:
        url("../assets/images/music.png");
}


/* EP 10 */

.story.yard {
    background-image:
        url("../assets/images/yard.png");
}


/* =========================
   SETTINGS
========================= */

.settings-overlay {
    position: fixed;

    inset: 0;

    display: none;

    justify-content: center;
    align-items: center;

    background-color: rgba(0, 0, 0, 0.75);

    z-index: 999;
}

.settings-box {
    width: 400px;

    max-width: 90%;

    padding: 40px 35px;

    text-align: center;

    background-color: rgba(35, 18, 12, 0.96);

    border: 2px solid #d6c3a5;

    box-shadow:
        0 0 25px rgba(0, 0, 0, 0.9);
}

.settings-box h2 {
    margin-bottom: 35px;

    font-family: "HorroroidBold", sans-serif;

    font-size: 36px;

    color: #fafafa;

    letter-spacing: 3px;
}

.setting-item {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 20px;

    padding: 15px;

    background-color: rgba(0, 0, 0, 0.35);

    border: 1px solid rgba(216, 192, 160, 0.35);

    font-family: "HorroroidBold", sans-serif;

    color: #d8d8d0;

    letter-spacing: 1px;
}

.setting-item button {
    min-width: 65px;

    padding: 7px 12px;

    background-color: #3b1111;

    color: #d8d8d0;

    border: 1px solid #d6c3a5;

    cursor: pointer;

    font-family: "HorroroidBold", sans-serif;

    transition: 0.2s ease;
}

.setting-item button:hover {
    background-color: #6e1010;

    color: white;
}

.close-settings {
    margin-top: 15px;

    padding: 10px 30px;

    background-color: #3b1111;

    color: #d8d8d0;

    border: 1px solid #d6c3a5;

    cursor: pointer;

    font-family: "HorroroidBold", sans-serif;

    letter-spacing: 2px;

    transition: 0.2s ease;
}

.close-settings:hover {
    background-color: #6e1010;

    color: white;

    transform: scale(1.05);
}


/* =========================
   HOW TO PLAY
========================= */

.howtoplay-overlay {
    position: fixed;

    inset: 0;

    display: none;

    justify-content: center;
    align-items: center;

    background-color: rgba(0, 0, 0, 0.78);

    z-index: 999;
}

.howtoplay-box {
    width: 500px;

    max-width: 90%;

    padding: 40px 35px;

    text-align: center;

    background-color: rgba(35, 18, 12, 0.96);

    border: 2px solid #d6c3a5;

    box-shadow:
        0 0 25px rgba(0, 0, 0, 0.9);
}

.howtoplay-box h2 {
    margin-bottom: 30px;

    font-family: "HorroroidBold", sans-serif;

    font-size: 36px;

    color: #fafafa;

    letter-spacing: 3px;
}

.howtoplay-content {
    text-align: left;

    font-family: "HorroroidBold", sans-serif;

    color: #d8d8d0;

    font-size: 16px;

    line-height: 1.8;

    letter-spacing: 0.5px;
}

.howtoplay-content p {
    margin-bottom: 15px;
}

.howtoplay-content strong {
    color: #d6c3a5;
}

.close-howtoplay {
    margin-top: 20px;

    padding: 10px 30px;

    background-color: #3b1111;

    color: #d8d8d0;

    border: 1px solid #d6c3a5;

    cursor: pointer;

    font-family: "HorroroidBold", sans-serif;

    letter-spacing: 2px;

    transition: 0.2s ease;
}

.close-howtoplay:hover {
    background-color: #6e1010;

    color: white;

    transform: scale(1.05);
}


/* =========================
   CREDITS
========================= */

.credits-page {
    position: relative;

    width: 100%;
    height: 100vh;

    overflow: hidden;

    background-image:
        url("../assets/images/school.png");

    background-size: cover;
    background-position: center;

    background-color: #050505;

    color: #d8d8d0;

    font-family: "HorroroidBold", sans-serif;
}

.credits-overlay {
    position: absolute;

    inset: 0;

    background:
        linear-gradient(
            rgba(0, 0, 0, 0.75),
            rgba(0, 0, 0, 0.9)
        );

    z-index: 1;
}


/* =========================
   SCROLL AREA
========================= */

.credits-scroll {
    position: absolute;

    inset: 0;

    overflow: hidden;

    z-index: 2;
}

.credits-content {
    position: absolute;

    width: 100%;

    top: 100%;

    left: 0;

    text-align: center;

    animation:
        creditsRoll 45s linear forwards;
}


/* =========================
   TITLE
========================= */

.credits-content h1 {
    font-family: "Who Asks Satan";

    font-size: 70px;

    letter-spacing: 7px;

    color: #173e19;

    text-shadow:
        0 0 12px rgba(255, 255, 255, 0.8);

    margin-bottom: 15px;
}

.credits-subtitle {
    font-size: 15px;

    letter-spacing: 4px;

    color: #d8d8d0;

    margin-bottom: 100px;
}


/* =========================
   SECTIONS
========================= */

.credits-content h2 {
    font-family: Arial, sans-serif;

    font-size: 19px;

    letter-spacing: 4px;

    color: #d6c3a5;

    margin-bottom: 15px;
}

.credits-content h3 {
    font-family: Arial, sans-serif;

    font-size: 18px;

    letter-spacing: 3px;

    color: #fafafa;

    margin-bottom: 15px;
}

.credits-content p {
    font-family: Arial, sans-serif;

    font-size: 16px;

    line-height: 2;

    letter-spacing: 1px;

    color: #e0e0d8;
}

.credits-section {
    margin-top: 70px;
}


/* =========================
   SPACE
========================= */

.credits-space {
    height: 20px;
}


/* =========================
   ENDING
========================= */

.credits-ending {
    margin-top: 120px;

    padding-bottom: 180px;
}

.credits-ending p {
    font-size: 25px;

    letter-spacing: 5px;

    color: #fafafa;

    margin-bottom: 25px;
}

.credits-ending span {
    font-family: "Who Asks Satan";

    font-size: 20px;

    letter-spacing: 3px;

    color: #aaa9a0;
}


/* =========================
   BACK BUTTON
========================= */

.credits-back-button {
    position: absolute;

    bottom: 30px;
    left: 50%;

    transform: translateX(-50%);

    z-index: 10;

    width: 190px;

    padding: 12px 20px;

    background: rgba(59, 17, 17, 0.9);

    color: #d8d8d0;

    border: 1px solid #d6c3a5;

    font-family: "HorroroidBold", sans-serif;

    font-size: 15px;

    letter-spacing: 2px;

    cursor: pointer;

    transition: 0.25s ease;
}

.credits-back-button:hover {
    background: #6e1010;

    border-color: #6e1010;

    color: white;

    transform:
        translateX(-50%)
        scale(1.05);
}


/* =========================
   CREDITS ANIMATION
========================= */

@keyframes creditsRoll {

    from {
        top: 100%;
    }

    to {
        top: -330%;
    }

}


/* =========================
   HOW TO PLAY PAGE
========================= */

.howtoplay-page {
    position: relative;

    width: 100%;
    min-height: 100vh;

    background-image:
        url("../assets/images/school.png");

    background-size: cover;
    background-position: center;

    background-attachment: fixed;

    color: #d8d8d0;

    font-family: Arial, sans-serif;

    padding: 60px 20px;
}

.howtoplay-overlay {
    position: fixed;

    inset: 0;

    background-color: rgba(0, 0, 0, 0.78);

    z-index: 0;

    pointer-events: none;
}

.howtoplay-box {
    position: relative;

    z-index: 1;

    width: 800px;

    max-width: 95%;

    margin: 0 auto;

    padding: 50px 60px;

    background-color: rgba(35, 18, 12, 0.94);

    border: 2px solid #d6c3a5;

    box-shadow:
        0 0 25px rgba(0, 0, 0, 0.9);
}

.howtoplay-box h1 {
    text-align: center;

    font-family: "Who Asks Satan";

    font-size: 55px;

    letter-spacing: 6px;

    color: #173e19;

    text-shadow:
        0 0 12px rgba(255, 255, 255, 0.75);

    margin-bottom: 50px;
}


/* =========================
   HOW TO PLAY SECTIONS
========================= */

.howtoplay-section {
    margin-bottom: 35px;

    padding-bottom: 25px;

    border-bottom:
        1px solid rgba(216, 192, 160, 0.25);
}

.howtoplay-section h2 {
    margin-bottom: 12px;

    font-family: Arial, sans-serif;

    font-size: 19px;

    letter-spacing: 3px;

    color: #d6c3a5;
}

.howtoplay-section p {
    margin: 7px 0;

    font-family: Arial, sans-serif;

    font-size: 16px;

    line-height: 1.7;

    letter-spacing: 0.4px;

    color: #e0e0d8;
}


/* =========================
   TIP
========================= */

.howtoplay-tip {
    margin-top: 45px;

    margin-bottom: 40px;

    text-align: center;
}

.howtoplay-tip p {
    font-family: Arial, sans-serif;

    font-size: 17px;

    line-height: 2;

    letter-spacing: 3px;

    color: #d6c3a5;
}


/* =========================
   BACK BUTTON
========================= */

.howtoplay-back-button {
    display: block;

    width: 190px;

    margin: 0 auto;

    padding: 12px 20px;

    background-color: rgba(59, 17, 17, 0.9);

    color: #d8d8d0;

    border: 1px solid #d6c3a5;

    font-family: Arial, sans-serif;

    font-size: 15px;

    letter-spacing: 2px;

    cursor: pointer;

    transition: 0.25s ease;
}

.howtoplay-back-button:hover {
    background-color: #6e1010;

    border-color: #6e1010;

    color: white;

    transform: scale(1.05);
}


/* =========================
   EXIT
========================= */

.exit-overlay {
    position: fixed;

    inset: 0;

    display: none;

    justify-content: center;
    align-items: center;

    background-color: rgba(0, 0, 0, 0.78);

    z-index: 1000;
}

.exit-box {
    width: 400px;

    max-width: 90%;

    padding: 40px 35px;

    text-align: center;

    background-color: rgba(35, 18, 12, 0.97);

    border: 2px solid #d6c3a5;

    box-shadow:
        0 0 25px rgba(0, 0, 0, 0.9);
}

.exit-box h2 {
    margin-bottom: 20px;

    font-family: "HorroroidBold", sans-serif;

    font-size: 32px;

    letter-spacing: 3px;

    color: #fafafa;
}

.exit-box p {
    margin-bottom: 30px;

    font-family: Arial, sans-serif;

    font-size: 16px;

    color: #d8d8d0;
}

.exit-buttons {
    display: flex;

    justify-content: center;

    gap: 15px;
}

.exit-buttons button {
    width: 100px;

    padding: 10px 15px;

    background-color: #3b1111;

    color: #d8d8d0;

    border: 1px solid #d6c3a5;

    font-family: Arial, sans-serif;

    font-size: 14px;

    letter-spacing: 2px;

    cursor: pointer;

    transition: 0.2s ease;
}

.exit-buttons button:hover {
    background-color: #6e1010;

    color: white;

    transform: scale(1.05);
}

/* =========================
   JUMPSCARE EPISODE 01
========================= */

.jumpscare-overlay {
    position: fixed;

    inset: 0;

    display: none;

    justify-content: center;
    align-items: center;

    background: #000;

    z-index: 99999;

    overflow: hidden;
}

.jumpscare-overlay img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}

/* =========================
   EPISODE 10 — FINAL SCENE
========================= */

.story.yard {
    position: relative;
    width: 100%;
    min-height: 100vh;

    background-image:
        url("../assets/images/yard.png");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    overflow: hidden;
}


/* =========================
   MONSTER
========================= */

.final-monster {
    position: absolute;

    width: auto;
    height: 80vh;

    max-width: none;

    bottom: 0;
    right: -30%;

    z-index: 10;

    opacity: 1;

    transition:
        right 5s ease-in-out,
        opacity 1s ease,
        filter 0.4s ease;
}

.final-monster.monster-enter {
    right: 50%;

    transform:
        translateX(50%);
}


/* =========================
   MONSTER HIT
========================= */

.final-monster.monster-hit {
    animation:
        monsterHit 0.35s ease;
}

@keyframes monsterHit {

    0% {
        transform:
            translateX(50%)
            translate(0, 0);
    }

    25% {
        transform:
            translateX(50%)
            translate(-12px, 5px);
    }

    50% {
        transform:
            translateX(50%)
            translate(12px, -5px);
    }

    75% {
        transform:
            translateX(50%)
            translate(-8px, 3px);
    }

    100% {
        transform:
            translateX(50%)
            translate(0, 0);
    }
}


/* =========================
   MONSTER DEFEATED
========================= */

.final-monster.monster-defeated {
    opacity: 0;

    filter:
        brightness(2)
        contrast(1.5)
        blur(5px);

    transform:
        translateX(50%)
        scale(1.15);
}


/* =========================
   SIDE DARKNESS
========================= */

.final-darkness {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    z-index: 20;

    pointer-events: none;

    opacity: 0;

    background:
        linear-gradient(
            to right,

            rgba(0, 0, 0, 0.88) 0%,
            rgba(0, 0, 0, 0.60) 18%,
            rgba(0, 0, 0, 0.20) 32%,

            rgba(0, 0, 0, 0) 45%,
            rgba(0, 0, 0, 0) 55%,

            rgba(0, 0, 0, 0.20) 68%,
            rgba(0, 0, 0, 0.60) 82%,
            rgba(0, 0, 0, 0.88) 100%
        );

    transition:
        opacity 1.5s ease;
}

.final-darkness.dark-active {
    opacity: 0.9;
}


/* =========================
   FLASH
========================= */

.final-flash {
    position: absolute;

    inset: 0;

    background: white;

    opacity: 0;

    z-index: 50;

    pointer-events: none;
}

.final-flash.flash-active {
    animation:
        finalFlash 0.25s ease;
}

@keyframes finalFlash {

    0% {
        opacity: 0;
    }

    40% {
        opacity: 0.45;
    }

    100% {
        opacity: 0;
    }
}


/* =========================
   CHARACTER
========================= */

.final-character-layer {
    position: absolute;

    inset: 0;

    z-index: 15;

    pointer-events: none;

    opacity: 0;

    transition:
        opacity 0.5s ease;
}

.final-character-layer.character-active {
    opacity: 1;
}

.final-character {
    position: absolute;

    bottom: 0;
    left: 10%;

    height: 72vh;
    width: auto;

    object-fit: contain;
}


/* =========================
   FINAL DIALOG — SAMAKAN DENGAN GATE
========================= */

#finalDialog {
    position: absolute !important;

    left: 50% !important;
    bottom: 100px !important;

    transform: translateX(-50%) !important;

    width: 80% !important;
    max-width: 900px !important;

    height: 150px !important;

    padding: 25px 30px !important;

    background-color: rgba(51, 51, 51, 0.7) !important;

    border: 1px solid rgba(180, 180, 180, 0.25) !important;

    box-sizing: border-box !important;

    color: #d8d8d0 !important;

    z-index: 60 !important;

    display: none;

    opacity: 0;

    transition: opacity 0.4s ease !important;
}


/* DIALOG MUNCUL */

#finalDialog.dialog-active {
    display: block !important;

    opacity: 1 !important;
}


/* =========================
   FINAL SPEAKER
   SAMAKAN DENGAN GATE
========================= */

#finalSpeaker {
    display: block !important;

    margin-bottom: 8px !important;

    font-family: Georgia, "Times New Roman", serif !important;

    font-size: 13px !important;

    font-weight: bold !important;

    letter-spacing: 2px !important;

    color: #d8d8d0 !important;
}


/* =========================
   FINAL TEXT
   SAMAKAN DENGAN GATE
========================= */

#finalDialogText {
    display: block !important;

    max-width: 500px !important;

    margin: 0 !important;

    font-family: Georgia, "Times New Roman", serif !important;

    font-size: 18px !important;

    line-height: 1.5 !important;

    letter-spacing: 0 !important;

    color: #e0e0d8 !important;
}


/* =========================
   FINAL NEXT BUTTON
========================= */

#finalNextButton {
    position: absolute !important;

    right: 30px !important;
    bottom: 20px !important;

    padding: 8px 22px !important;

    background-color: transparent !important;

    color: #d8d8d0 !important;

    border: 1px solid #666 !important;

    cursor: pointer !important;

    font-family: Arial, sans-serif !important;

    font-size: 13px !important;

    letter-spacing: 2px !important;

    transition: 0.3s ease !important;
}


#finalNextButton:hover {
    background-color: #6e1010 !important;

    border-color: #6e1010 !important;

    color: white !important;

    transform: scale(1.05) !important;
}

/* =========================
   PURIFY BUTTON
========================= */

.purify-button {
    position: absolute;

    left: 50%;
    bottom: 15%;

    transform:
        translateX(-50%);

    z-index: 70;

    width: 210px;

    padding: 14px 25px;

    background:
        rgba(59, 17, 17, 0.95);

    color: #fafafa;

    border:
        2px solid #d6c3a5;

    font-family:
        "HorroroidBold",
        sans-serif;

    font-size: 20px;

    letter-spacing: 4px;

    cursor: pointer;

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.8s ease,
        transform 0.2s ease;
}

.purify-button.purify-active {
    opacity: 1;

    pointer-events: auto;
}

.purify-button:hover {
    background:
        #6e1010;

    transform:
        translateX(-50%)
        scale(1.08);
}

.purify-button:active {
    transform:
        translateX(-50%)
        scale(0.95);
}


/* =========================
   PURIFY COUNTER
========================= */

.purify-counter {
    position: absolute;

    left: 50%;
    bottom: 10%;

    transform:
        translateX(-50%);

    z-index: 70;

    font-family:
        "HorroroidBold",
        sans-serif;

    font-size: 16px;

    letter-spacing: 3px;

    color: #d6c3a5;

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.8s ease;
}

.purify-counter.counter-active {
    opacity: 1;
}


/* =========================
   GREEN MONSTER ATTACK
========================= */

.monster-attack-overlay {
    position: fixed;

    inset: 0;

    z-index: 9990;

    pointer-events: none;

    opacity: 0;

    background:
        radial-gradient(
            ellipse at center,
            rgba(60, 255, 80, 0) 20%,
            rgba(30, 180, 45, 0.15) 55%,
            rgba(20, 120, 30, 0.65) 100%
        );

    transition:
        opacity 0.15s ease;
}

.monster-attack-overlay.attack-active {
    opacity: 1;

    animation:
        greenAttack 0.65s ease;
}

@keyframes greenAttack {

    0% {
        opacity: 0;
        transform: scale(1);
    }

    15% {
        opacity: 0.95;
        transform: scale(1.04);
    }

    30% {
        opacity: 0.65;
        transform: scale(1);
    }

    45% {
        opacity: 0.9;
        transform: scale(1.03);
    }

    70% {
        opacity: 0.45;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1);
    }
}


/* =========================
   GREEN LIQUID SPLASH
========================= */

.green-liquid {
    position: fixed;
    inset: 0;

    z-index: 9991;
    pointer-events: none;

    opacity: 0;

    background:
        radial-gradient(
            ellipse at 15% 100%,
            rgba(70, 220, 70, 0.95) 0%,
            rgba(40, 180, 50, 0.8) 12%,
            transparent 35%
        ),

        radial-gradient(
            ellipse at 85% 100%,
            rgba(70, 220, 70, 0.95) 0%,
            rgba(40, 180, 50, 0.75) 12%,
            transparent 35%
        ),

        radial-gradient(
            ellipse at 50% 110%,
            rgba(80, 240, 80, 1) 0%,
            rgba(40, 180, 50, 0.75) 15%,
            transparent 40%
        );

    filter: blur(2px);
}

.green-liquid.liquid-active {

    opacity: 1;

    animation:
        liquidSplash 0.8s ease-out forwards;
}

@keyframes liquidSplash {

    0% {
        opacity: 0;

        transform:
            scale(0.7)
            translateY(120px);
    }

    20% {
        opacity: 1;

        transform:
            scale(1.15)
            translateY(20px);
    }

    45% {
        opacity: 0.95;

        transform:
            scale(1.05)
            translateY(-10px);
    }

    70% {
        opacity: 0.7;

        transform:
            scale(1.15)
            translateY(-35px);
    }

    100% {
        opacity: 0;

        transform:
            scale(1.3)
            translateY(-90px);
    }
}


/* =========================
   GREEN SLIME SPLASH
========================= */

.green-splash {
    position: fixed;

    inset: 0;

    z-index: 9992;

    pointer-events: none;

    opacity: 0;

    background:

        radial-gradient(
            circle at 12% 92%,
            rgba(80, 255, 80, 1) 0%,
            rgba(40, 190, 50, 0.8) 8%,
            transparent 18%
        ),

        radial-gradient(
            circle at 88% 90%,
            rgba(80, 255, 80, 1) 0%,
            rgba(40, 190, 50, 0.8) 8%,
            transparent 18%
        ),

        radial-gradient(
            circle at 50% 100%,
            rgba(100, 255, 100, 1) 0%,
            rgba(40, 200, 50, 0.8) 10%,
            transparent 22%
        ),

        radial-gradient(
            circle at 30% 75%,
            rgba(60, 230, 70, 0.7) 0%,
            transparent 10%
        ),

        radial-gradient(
            circle at 70% 72%,
            rgba(60, 230, 70, 0.7) 0%,
            transparent 10%
        );

    filter: blur(2px);
}

.green-splash.splash-active {

    opacity: 1;

    animation:
        slimeSplash 0.65s ease-out forwards;
}

@keyframes slimeSplash {

    0% {
        opacity: 0;

        transform:
            scale(0.6)
            translateY(100px);
    }

    20% {
        opacity: 1;

        transform:
            scale(1.2)
            translateY(10px);
    }

    45% {
        opacity: 0.95;

        transform:
            scale(1.05)
            translateY(-20px);
    }

    70% {
        opacity: 0.75;

        transform:
            scale(1.25)
            translateY(-50px);
    }

    100% {
        opacity: 0;

        transform:
            scale(1.5)
            translateY(-110px);
    }
}

/* =========================
   FINAL SCREEN SHAKE
========================= */

.final-attack-shake {
    animation:
        finalAttackShake 0.55s ease;
}

@keyframes finalAttackShake {

    0% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-10px, 7px);
    }

    20% {
        transform: translate(12px, -8px);
    }

    30% {
        transform: translate(-14px, -5px);
    }

    40% {
        transform: translate(11px, 9px);
    }

    50% {
        transform: translate(-8px, -10px);
    }

    60% {
        transform: translate(10px, 5px);
    }

    70% {
        transform: translate(-7px, -6px);
    }

    80% {
        transform: translate(5px, 7px);
    }

    90% {
        transform: translate(-3px, -3px);
    }

    100% {
        transform: translate(0, 0);
    }
}


/* =========================
   PURIFY HIT EFFECT
========================= */

.purify-hit {
    animation:
        purifyHit 0.25s ease;
}

@keyframes purifyHit {

    0% {
        filter: brightness(1);
    }

    40% {
        filter:
            brightness(2)
            contrast(1.3);
    }

    100% {
        filter: brightness(1);
    }
}


/* =========================
   ENDING SCREEN
========================= */

.ending-screen {
    position: fixed;

    inset: 0;

    display: flex;

    flex-direction: column;

    justify-content: center;

    align-items: center;

    text-align: center;

    background: #000;

    z-index: 10000;

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 2s ease;
}

.ending-screen.ending-active {
    opacity: 1;

    pointer-events: auto;
}

.ending-screen h1 {
    margin:
        0 20px 25px;

    font-family:
        "HorroroidBold",
        sans-serif;

    font-size: 38px;

    letter-spacing: 5px;

    color: #fafafa;
}

.ending-screen p {
    margin:
        0 0 45px;

    font-family:
        "HorroroidBold",
        sans-serif;

    font-size: 21px;

    letter-spacing: 6px;

    color: #aaa9a0;
}

/* =========================
   GREEN SLIME ATTACK
========================= */

.green-attack {
    position: fixed;

    inset: 0;

    z-index: 9991;

    pointer-events: none;

    opacity: 0;

    overflow: hidden;

    background:

        radial-gradient(
            ellipse at 10% 100%,
            rgba(50, 220, 60, 0.95) 0%,
            rgba(30, 160, 40, 0.75) 15%,
            transparent 38%
        ),

        radial-gradient(
            ellipse at 90% 100%,
            rgba(60, 230, 70, 0.95) 0%,
            rgba(30, 160, 40, 0.75) 15%,
            transparent 38%
        ),

        radial-gradient(
            ellipse at 50% 110%,
            rgba(90, 255, 90, 1) 0%,
            rgba(40, 190, 50, 0.8) 18%,
            transparent 45%
        );
}

.green-attack.green-attack-active {

    opacity: 1;

    animation:
        slimeBurst 0.8s ease-out forwards;
}

@keyframes slimeBurst {

    0% {
        opacity: 0;

        transform:
            scale(0.55)
            translateY(120px);
    }

    15% {
        opacity: 1;

        transform:
            scale(1.15)
            translateY(20px);
    }

    35% {
        opacity: 0.95;

        transform:
            scale(1.05)
            translateY(-5px);
    }

    55% {
        opacity: 0.85;

        transform:
            scale(1.2)
            translateY(-30px);
    }

    75% {
        opacity: 0.6;

        transform:
            scale(1.35)
            translateY(-60px);
    }

    100% {
        opacity: 0;

        transform:
            scale(1.5)
            translateY(-120px);
    }
}

/* =========================
   MOBILE LANDSCAPE MODE
========================= */

@media (max-width: 900px) {

    body {
        overflow: hidden;
    }

    .story,
    #finalScene {
        width: 100vw;
        height: 100vh;
        min-height: 100vh;
    }

}

/* =========================================================
   FINAL MOBILE RESPONSIVE FIX
   Supports portrait + landscape phones without changing
   the desktop design.
========================================================= */

html {
    width: 100%;
    min-height: 100%;
}

body {
    min-width: 0;
    min-height: 100%;
}

/* ---------- TOUCH / MOBILE BASICS ---------- */

button,
a {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

img {
    max-width: 100%;
}

/* ---------- PHONES: PORTRAIT ---------- */

@media screen and (max-width: 900px) and (orientation: portrait) {

    html,
    body {
        width: 100%;
        min-height: 100%;
        margin: 0;
        padding: 0;
    }

    body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* HOME */

    .home {
        width: 100%;
        min-height: 100svh;
        height: 100svh;

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

        padding: 20px;
    }

    .home-content {
        width: 100%;
        max-width: 420px;
        padding: 0 12px;
        transform: translateY(0);
    }

    .home-content h1 {
        width: 100%;
        font-size: clamp(38px, 11vw, 58px);
        line-height: 1;
        letter-spacing: 3px;
        transform: none;
    }

    .home-content p {
        margin-top: 14px;
        padding: 7px 10px;
        font-size: clamp(12px, 3.5vw, 17px);
        letter-spacing: 2px;
    }

    .home-buttons {
        gap: 8px;
        margin-top: 18px;
    }

    .home-content button {
        width: min(210px, 72vw);
        min-height: 42px;
        padding: 9px 16px;
        font-size: 13px;
        letter-spacing: 2px;
    }

    /* STORY / GATE / EPISODES */

    .story,
    .gate,
    .story.yard,
    #finalScene {
        width: 100%;
        min-height: 100svh;
        height: 100svh;

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

        overflow: hidden;
    }

    .story-content {
        width: calc(100% - 24px);
        max-width: none;
        left: 12px;
        bottom: 12px;
        transform: none;

        padding: 14px 15px 16px;
    }

    .story-time {
        font-size: 11px;
        letter-spacing: 2px;
        margin-bottom: 7px;
    }

    .story-text {
        max-width: none;
        margin-bottom: 12px;

        font-size: clamp(14px, 4vw, 18px);
        line-height: 1.5;
        letter-spacing: 0.2px;
    }

    .next-button {
        padding: 7px 15px;
        font-size: 11px;
        letter-spacing: 1.5px;
    }

    /* GATE CHARACTER */

    .character-sprite {
        max-width: 58vw;
        max-height: 63svh;
        width: auto;
        height: auto;
    }

    .character-left {
        left: 3%;
    }

    .character-right {
        right: 3%;
    }

    /* GATE DIALOG */

    .dialog-box,
    #finalDialog {
        left: 12px !important;
        right: 12px !important;
        bottom: 12px !important;

        width: auto !important;
        max-width: none !important;
        height: auto !important;
        min-height: 116px !important;

        padding: 14px 15px 48px !important;

        transform: none !important;
    }

    .speaker-name,
    #finalSpeaker {
        font-size: 12px !important;
        letter-spacing: 1.5px !important;
        margin-bottom: 6px !important;
    }

    .dialog-text,
    #finalDialogText {
        max-width: calc(100% - 10px) !important;

        font-size: clamp(14px, 4vw, 18px) !important;
        line-height: 1.45 !important;
    }

    #finalNextButton,
    .dialog-box .next-button {
        right: 14px !important;
        bottom: 12px !important;

        padding: 6px 13px !important;
        font-size: 10px !important;
        letter-spacing: 1.5px !important;
    }

    /* HUD */

    .game-hud {
        top: 10px;
        left: 10px;
        right: 10px;

        gap: 6px;
        font-size: 10px;
        letter-spacing: 1px;
    }

    .game-hud div {
        padding: 6px 8px;
    }

    /* LEVEL SELECT */

    .level-page {
        width: 100%;
        min-height: 100svh;
        height: auto;

        background-size: cover;
        background-position: center top;

        padding-bottom: 35px;
    }

    .level-page h1 {
        font-size: clamp(40px, 12vw, 65px);
        line-height: 1;
        padding: 28px 15px 0;
        letter-spacing: 3px;
    }

    .level-container {
        width: calc(100% - 24px);
        margin: 25px auto 40px;

        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .level-card {
        width: 100%;
        margin: 0;
        padding: 13px 9px;
        border-width: 1px;
    }

    .level-card:last-child {
        grid-column: auto;
    }

    .level-card p {
        font-size: 12px;
    }

    .level-card h2 {
        font-size: 19px;
        margin-bottom: 13px;
    }

    .level-card button {
        width: 100%;
        padding: 8px 8px;
        font-size: 12px;
    }

    /* COMPLETE POPUP */

    .level-complete {
        padding: 15px;
    }

    .level-complete-box {
        width: min(430px, 100%);
        padding: 28px 20px;
    }

    .level-complete-box h2 {
        font-size: clamp(28px, 8vw, 42px);
    }

    .final-score {
        gap: 22px;
        font-size: 15px;
    }

    .final-score strong {
        font-size: 24px;
    }

    /* SETTINGS / EXIT / HOW TO PLAY POPUPS */

    .settings-overlay,
    .exit-overlay,
    .howtoplay-overlay {
        padding: 15px;
    }

    .settings-box,
    .exit-box,
    .howtoplay-box {
        width: 100%;
        max-width: 430px;
        max-height: 88svh;
        overflow-y: auto;
        padding: 28px 20px;
    }

    .settings-box h2,
    .howtoplay-box h2 {
        font-size: 28px;
        margin-bottom: 24px;
    }

    .setting-item {
        padding: 12px;
        margin-bottom: 12px;
    }

    /* HOW TO PLAY PAGE */

    .howtoplay-page {
        min-height: 100svh;
        padding: 28px 12px 35px;
        background-attachment: scroll;
    }

    .howtoplay-box {
        max-width: 100%;
        padding: 28px 18px;
    }

    .howtoplay-box h1 {
        font-size: clamp(38px, 11vw, 55px);
        line-height: 1;
        letter-spacing: 3px;
        margin-bottom: 32px;
    }

    .howtoplay-section {
        margin-bottom: 24px;
        padding-bottom: 18px;
    }

    .howtoplay-section h2 {
        font-size: 16px;
        letter-spacing: 2px;
    }

    .howtoplay-section p,
    .howtoplay-content {
        font-size: 14px;
        line-height: 1.65;
    }

    /* CREDITS */

    .credits-page {
        width: 100%;
        min-height: 100svh;
        height: 100svh;

        background-size: cover;
        background-position: center;
    }

    .credits-content h1 {
        font-size: clamp(42px, 12vw, 70px);
        letter-spacing: 3px;
    }

    .credits-subtitle {
        font-size: 12px;
        letter-spacing: 2px;
        margin-bottom: 60px;
    }

    .credits-content h2 {
        font-size: 16px;
        letter-spacing: 2px;
    }

    .credits-content h3 {
        font-size: 15px;
        letter-spacing: 2px;
    }

    .credits-content p {
        font-size: 13px;
        line-height: 1.7;
        padding: 0 15px;
    }

    .credits-section {
        margin-top: 45px;
    }

    .credits-ending {
        margin-top: 80px;
        padding-bottom: 130px;
    }

    .credits-ending p {
        font-size: 18px;
        letter-spacing: 3px;
    }

    .credits-back-button {
        bottom: 14px;
        width: 170px;
        padding: 10px 15px;
        font-size: 13px;
    }

    /* FINAL SCENE */

    .final-monster {
        height: 60svh;
        max-height: 60svh;
        right: -22%;
    }

    .final-character {
        height: 58svh;
        max-height: 58svh;
        left: 2%;
    }

    .purify-button {
        width: min(190px, 55vw);
        bottom: 20%;
        padding: 10px 12px;
        font-size: 14px;
        letter-spacing: 2px;
    }

    .purify-counter {
        bottom: 13%;
        font-size: 11px;
        letter-spacing: 1.5px;
    }

    .ending-screen {
        padding: 20px;
    }

    .ending-screen h1 {
        font-size: clamp(24px, 7vw, 38px);
        letter-spacing: 3px;
    }

    .ending-screen p {
        font-size: clamp(12px, 3.5vw, 21px);
        letter-spacing: 2px;
    }
}

/* ---------- PHONES: LANDSCAPE ---------- */

@media screen and (max-width: 900px) and (orientation: landscape) {

    html,
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    .home,
    .story,
    .gate,
    .story.yard,
    #finalScene,
    .credits-page {
        width: 100vw;
        height: 100svh;
        min-height: 100svh;

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

    .home {
        padding: 10px;
    }

    .home-content {
        width: 100%;
        transform: translateY(0);
    }

    .home-content h1 {
        font-size: clamp(38px, 8vw, 72px);
        letter-spacing: 4px;
        transform: none;
        line-height: 0.95;
    }

    .home-content p {
        margin-top: 10px;
        padding: 5px 10px;
        font-size: clamp(11px, 2vw, 17px);
        letter-spacing: 2px;
    }

    .home-buttons {
        gap: 5px;
        margin-top: 12px;
    }

    .home-content button {
        width: min(170px, 25vw);
        min-height: 34px;
        padding: 6px 10px;
        font-size: 11px;
        letter-spacing: 2px;
    }

    .story {
        overflow: hidden;
    }

    .story-content {
        width: 88%;
        bottom: 10px;
        padding: 10px 14px;
    }

    .story-time {
        font-size: 10px;
        margin-bottom: 4px;
    }

    .story-text {
        font-size: clamp(12px, 2vw, 17px);
        line-height: 1.4;
        margin-bottom: 8px;
    }

    .next-button {
        padding: 5px 13px;
        font-size: 10px;
    }

    .character-sprite {
        max-height: 72svh;
        max-width: 30vw;
    }

    .character-left {
        left: 5%;
    }

    .character-right {
        right: 5%;
    }

    .dialog-box,
    #finalDialog {
        width: 88% !important;
        height: 112px !important;
        min-height: 0 !important;

        bottom: 10px !important;

        padding: 11px 14px 40px !important;
    }

    .speaker-name,
    #finalSpeaker {
        font-size: 10px !important;
        margin-bottom: 4px !important;
    }

    .dialog-text,
    #finalDialogText {
        max-width: 78% !important;
        font-size: clamp(12px, 2vw, 17px) !important;
        line-height: 1.35 !important;
    }

    #finalNextButton,
    .dialog-box .next-button {
        right: 14px !important;
        bottom: 10px !important;
        padding: 5px 12px !important;
        font-size: 9px !important;
    }

    .game-hud {
        top: 8px;
        left: 10px;
        right: 10px;
        font-size: 9px;
    }

    .game-hud div {
        padding: 5px 8px;
    }

    .level-page {
        min-height: 100svh;
        background-size: cover;
        background-position: center;
    }

    .level-page h1 {
        font-size: clamp(38px, 8vw, 70px);
        padding-top: 20px;
    }

    .level-container {
        width: 90%;
        margin: 18px auto 50px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 9px;
    }

    .level-card {
        width: 100%;
        padding: 10px 8px;
    }

    .level-card h2 {
        font-size: 17px;
        margin-bottom: 9px;
    }

    .level-card p {
        font-size: 11px;
    }

    .level-card button {
        width: 100%;
        padding: 6px 8px;
        font-size: 11px;
    }

    .settings-box,
    .exit-box,
    .howtoplay-box {
        max-height: 88svh;
        overflow-y: auto;
        padding: 20px 22px;
    }

    .settings-box h2,
    .howtoplay-box h2 {
        font-size: 25px;
        margin-bottom: 18px;
    }

    .final-monster {
        height: 70svh;
        max-height: 70svh;
        right: -20%;
    }

    .final-character {
        height: 66svh;
        max-height: 66svh;
        left: 4%;
    }

    .purify-button {
        width: 160px;
        bottom: 18%;
        padding: 8px 12px;
        font-size: 13px;
        letter-spacing: 2px;
    }

    .purify-counter {
        bottom: 10%;
        font-size: 10px;
    }

    .ending-screen h1 {
        font-size: clamp(22px, 5vw, 34px);
    }

    .ending-screen p {
        font-size: clamp(11px, 2.5vw, 19px);
    }
}

/* ---------- VERY SMALL PHONES ---------- */

@media screen and (max-width: 380px) and (orientation: portrait) {

    .home-content h1 {
        font-size: 35px;
    }

    .home-content button {
        width: 190px;
    }

    .dialog-box,
    #finalDialog {
        min-height: 110px !important;
        padding-bottom: 45px !important;
    }

    .level-container {
        gap: 7px;
    }

    .level-card h2 {
        font-size: 16px;
    }
}
