* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background: #050609;
    color: white;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

#game {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: #050609;
}

#world {
    width: 900px;
    height: 650px;
    position: absolute;
    left: 50%;
    top: 53%;
    transform: translate(-50%, -50%);
    background: #11141a;
    overflow: hidden;
    border: 3px solid #262a32;
}

/* ROOMS */

.room {
    position: absolute;
    border: 3px solid #30343c;
    background: #171a20;
}

.living {
    width: 430px;
    height: 330px;
    left: 0;
    top: 0;
}

.kitchen {
    width: 470px;
    height: 330px;
    right: 0;
    top: 0;
}

.bedroom {
    width: 430px;
    height: 320px;
    left: 0;
    bottom: 0;
}

.basement {
    width: 470px;
    height: 320px;
    right: 0;
    bottom: 0;
    background: #090a0d;
}

.roomName {
    position: absolute;
    top: 12px;
    left: 15px;
    color: #666c78;
    font-size: 12px;
    letter-spacing: 2px;
}

/* Furniture */

.sofa {
    position: absolute;
    width: 180px;
    height: 75px;
    left: 110px;
    top: 150px;
    border-radius: 15px;
    background: #3a2630;
}

.table {
    position: absolute;
    width: 100px;
    height: 60px;
    left: 30px;
    bottom: 35px;
    background: #39291f;
}

.counter {
    position: absolute;
    width: 330px;
    height: 65px;
    right: 30px;
    bottom: 45px;
    background: #30343a;
}

.bed {
    position: absolute;
    width: 230px;
    height: 110px;
    left: 100px;
    top: 120px;
    background: #424c5e;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 55px;
}

.darkBox {
    position: absolute;
    width: 180px;
    height: 140px;
    left: 140px;
    top: 100px;
    background: #020204;
}

/* Doors */

.door {
    position: absolute;
    background: #654631;
    border: 2px solid #9b6944;
    z-index: 4;
}

.doorKitchen {
    width: 18px;
    height: 80px;
    left: 421px;
    top: 125px;
}

.doorBedroom {
    width: 80px;
    height: 18px;
    left: 175px;
    top: 321px;
}

.doorBasement {
    width: 80px;
    height: 18px;
    right: 175px;
    top: 321px;
}

/* Items */

.item {
    position: absolute;
    cursor: pointer;
    z-index: 8;
    filter: drop-shadow(0 0 8px rgba(255,255,255,.3));
}

.bottle {
    font-size: 38px;
    right: 100px;
    bottom: 115px;
}

.key {
    font-size: 35px;
    left: 210px;
    top: 160px;
}

.hiddenItem {
    display: none;
}

/* PLAYER */

#player {
    position: absolute;
    width: 42px;
    height: 55px;
    z-index: 20;
    transform: translate(-50%, -50%);
}

.playerHead {
    font-size: 30px;
    text-align: center;
}

.playerBody {
    width: 25px;
    height: 25px;
    margin: -3px auto;
    background: #476b8e;
    border-radius: 8px;
}

/* BABY */

#baby {
    position: absolute;
    width: 60px;
    height: 65px;
    z-index: 19;
    transform: translate(-50%, -50%);
    transition: left .45s ease, top .45s ease;
}

.babyFace {
    font-size: 43px;
    text-align: center;
}

.babyShadow {
    width: 45px;
    height: 10px;
    background: #000;
    border-radius: 50%;
    margin: -3px auto;
    opacity: .7;
}

/* HUD */

#hud {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    z-index: 100;
}

.hudBox {
    min-width: 145px;
    padding: 10px 14px;
    background: rgba(0,0,0,.72);
    border: 1px solid #343944;
    border-radius: 8px;
}

.hudBox span {
    display: block;
    color: #777d89;
    font-size: 10px;
    margin-bottom: 5px;
}

.hudBox strong {
    font-size: 14px;
}

.bar {
    width: 150px;
    height: 8px;
    background: #292c31;
    border-radius: 10px;
    overflow: hidden;
}

#sanityBar {
    width: 100%;
    height: 100%;
    background: #a7465c;
    transition: width .3s;
}

/* MESSAGE */

#message {
    position: absolute;
    bottom: 145px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 22px;
    background: rgba(0,0,0,.8);
    border-radius: 8px;
    opacity: 0;
    transition: .3s;
    z-index: 150;
}

#message.show {
    opacity: 1;
}

/* INTERACTION */

#interaction {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 10px;
}

#interactText {
    background: rgba(0,0,0,.7);
    padding: 13px;
    border-radius: 8px;
    font-size: 13px;
}

button {
    border: none;
    background: #252a33;
    color: white;
    padding: 13px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    background: #3b424e;
}

#flashBtn.active {
    background: #d4b85b;
    color: #111;
}

/* DARKNESS */

#darkness {
    position: absolute;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    background: rgba(0,0,0,.76);
    opacity: .7;
    transition: .2s;
    mix-blend-mode: multiply;
}

#darkness.off {
    opacity: .2;
}

/* OVERLAYS */

.overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, #171a20, #030405);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    text-align: center;
}

.hidden {
    display: none !important;
}

.panel {
    max-width: 480px;
    padding: 40px;
    background: rgba(10,11,14,.92);
    border: 1px solid #3b3e47;
    border-radius: 15px;
    box-shadow: 0 0 60px rgba(0,0,0,.8);
}

.panel h1 {
    font-size: 42px;
    letter-spacing: 4px;
    margin-bottom: 20px;
}

.panel p {
    color: #b5b8c0;
    margin: 10px;
}

.panel .small {
    font-size: 13px;
}

.panel button {
    margin-top: 25px;
    background: #8b3d4d;
    padding: 15px 30px;
}

.scareBaby {
    font-size: 190px;
    animation: scare .15s infinite alternate;
}

#scareScreen h1 {
    font-size: 38px;
    letter-spacing: 8px;
}

@keyframes scare {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.08);
    }
}

/* MOBILE */

#mobileControls {
    display: none;
}

@media(max-width:700px) {

    #world {
        width: 96vw;
        height: 68vh;
    }

    #hud {
        top: 8px;
        left: 8px;
        right: 8px;
    }

    .hudBox {
        min-width: 0;
        padding: 7px;
    }

    .hudBox:nth-child(2) {
        display: none;
    }

    .bar {
        width: 80px;
    }

    #interaction {
        bottom: 105px;
    }

    #interactText {
        display: none;
    }

    #mobileControls {
        display: block;
        position: fixed;
        bottom: 15px;
        left: 20px;
        z-index: 500;
        text-align: center;
    }

    #mobileControls button {
        width: 52px;
        height: 45px;
        margin: 3px;
        padding: 0;
    }

    .panel {
        width: 90%;
        padding: 25px;
    }

    .panel h1 {
        font-size: 28px;
    }
}