/* ==========================================================
   ROOT VARIABLES — Responsive Version
========================================================== */
:root {
    /* === BASE COLORS === */
    --bg-black: rgb(3, 4, 17);
    --bg-dark: rgba(0, 0, 0, 0.85);
    --bg-red-dark: #990000;
    --bg-red-hover: #cc0000;
    --bg-gold: radial-gradient(circle at center, #fff8a0, #ffd700);
    --bg-win: radial-gradient(circle at center, #fff8a0, #ffd700);
    --bg-lose: rgba(0, 0, 0, 0.85);
    --bg-window: radial-gradient(circle at center, rgba(50, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.95) 80%);

    /* === TEXT COLORS === */
    --tx-black: rgb(3, 4, 17);
    --tx-white: #ffffff;
    --tx-red: #ff4444;
    --tx-blood-red: rgba(120, 6, 6, 1);
    --tx-yellow: yellow;
    --tx-dark: #222;

    /* === SHADOW COLORS === */
    --shadow-red: 0 0 2vw rgba(255, 0, 0, 0.6);
    --shadow-red-strong: 0 0 3vw rgba(255, 0, 0, 0.9);
    --shadow-yellow: 0 0 2vw #ffd700, 0 0 4vw #fff8a0;

    /* === SPACING (responsive with clamp) === */
    --pad-xs: clamp(0.25rem, 0.5vw, 0.75rem);
    --pad-sm: clamp(0.5rem, 1vw, 1.5rem);
    --pad-md: clamp(1rem, 2vw, 3rem);
    --pad-lg: clamp(2rem, 4vw, 5rem);

    --margin-sm: clamp(0.5rem, 1vw, 1.5rem);
    --margin-md: clamp(1rem, 2vw, 3rem);
    --margin-lg: clamp(3rem, 5vw, 8rem);

    /* === BORDER === */
    --border-red: 0.15vw solid #660000;
    --border-radius: clamp(5px, 1vw, 20px);

    /* === FONT === */
    --font-main: "Creepster", cursive;

    /* === BUTTON DIMENSIONS === */
    --btn-font-size: clamp(14px, 1vw, 20px);
    --btn-padding: clamp(6px, 0.8vw, 12px) clamp(12px, 1.5vw, 24px);
    --btn-radius: clamp(6px, 0.8vw, 12px);
}

/* ==========================================================
   CSS RESET
========================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

img {
    max-width: 100%;
}

li {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==========================================================
   UTILITY CLASSES
========================================================== */
.display-none,
.hidden {
    display: none;
}

.display-block {
    display: block;
}

/* ==========================================================
   MAIN LAYOUT
========================================================== */
body {
    position: relative;
    background-image: url(../img/camera_da_letto_illuminata.png);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center top;
    background-attachment: fixed;
    min-height: 100vh;
    overflow: hidden;
}

/* ==========================================================
   LANGUAGE
========================================================== */
#language-selector {
    position: absolute;
    top: clamp(-40px, -6vh, -60px);
    left: clamp(30px, 5vw, 80px);
    z-index: 9999;
}

#language-switch {
    background: black;
    color: white;
    border: 0.15vw solid white;
    font-family: "Creepster", cursive;
    font-size: clamp(0.8rem, 1vw, 1.1rem);
    padding: clamp(4px, 0.4vw, 6px) clamp(5px, 0.6vw, 8px);
    border-radius: clamp(6px, 0.8vw, 10px);
    transition: all 0.3s ease;
}

/* ==========================================================
   OBJECTS IN SCENE
========================================================== */
.white-lamp,
.yellow-lamp {
    position: absolute;
    top: -215px;
    transform: rotate(180deg);
}

.white-lamp {
    right: 30vw;
}

.yellow-lamp {
    right: 28vw;
}

.ghost-img {
    position: absolute;
    top: 0;
    left: 0;
    height: 80px;
    width: auto;
    opacity: 0;
    z-index: 99999999;
    pointer-events: none;
}

.ghost_counter {
    color: var(--tx-red);
    position: absolute;
    top: clamp(-40px, -6vh, -60px);
    right: clamp(20px, 5vw, 80px);
    font-size: clamp(1rem, 1.5vw, 1.4rem);
}

/* ==========================================================
   ALERT WINDOWS (INTRO / WIN / LOSE)
========================================================== */
.window-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-window);
    color: var(--tx-red);
    padding: var(--pad-lg);
    border: var(--border-red);
    border-radius: var(--border-radius);
    max-width: 80vw;
    text-align: center;
    font-size: 2vh;
    z-index: 999999;
    box-shadow: var(--shadow-red);
}

/* ==========================================================
   START BUTTON
========================================================== */
#start-btn {
    margin-top: var(--margin-md);
    padding: var(--btn-padding);
    font-size: var(--btn-font-size);
    background: var(--bg-red-dark);
    color: var(--tx-white);
    border: none;
    border-radius: var(--btn-radius);
    cursor: pointer;
    box-shadow: var(--shadow-red);
    transition: all 0.3s ease;
}

#start-btn:hover {
    background: var(--bg-red-hover);
    box-shadow: var(--shadow-red-strong);
    transform: scale(1.05);
}

/* ==========================================================
   GAME ALERTS (WIN / LOSE)
========================================================== */
.game-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--bg-dark);
    padding: var(--pad-lg);
    border-radius: var(--border-radius);
    text-align: center;
    font-size: 2vh;
    z-index: 999999;
    display: none;
    box-shadow: var(--shadow-red);
    color: var(--tx-white);
}

.game-alert.win {
    background: var(--bg-win);
    color: var(--tx-dark);
    box-shadow: var(--shadow-yellow);
}

.game-alert.lose {
    background: var(--bg-lose);
    color: var(--tx-red);
    box-shadow: var(--shadow-red);
}

.game-alert button {
    margin-top: 15px;
    padding: var(--btn-padding);
    font-size: var(--btn-font-size);
    border: none;
    border-radius: var(--btn-radius);
    cursor: pointer;
    background: var(--bg-red-dark);
    color: var(--tx-white);
    box-shadow: var(--shadow-red);
    transition: all 0.3s ease;
}

.game-alert button:hover {
    background: var(--bg-red-hover);
    box-shadow: var(--shadow-red-strong);
    transform: scale(1.05);
}

#ghosts-needed-message {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.5rem;
    color: gold;
    font-weight: bold;
    font-size: clamp(0.9rem, 1.5vw, 1.3rem);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

#ghosts-needed-message.visible {
    opacity: 1;
}

#ghosts-needed-message.hidden {
    opacity: 0;
}

/* ==========================================================
   DIFFICULTY SELECTION
========================================================== */
#difficulty-selection {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
}

#difficulty-selection button {
    padding: var(--btn-padding);
    font-size: var(--btn-font-size);
    background: var(--bg-red-dark);
    color: var(--tx-white);
    border: none;
    border-radius: var(--btn-radius);
    cursor: pointer;
    box-shadow: var(--shadow-red);
    transition: all 0.3s ease;
}

#difficulty-selection button:hover {
    background: var(--bg-red-hover);
    box-shadow: var(--shadow-red-strong);
    transform: scale(1.05);
}

#difficulty-selection button.selected {
    background: #ffd700;
    color: var(--tx-dark);
    box-shadow: var(--shadow-yellow);
    transform: scale(1.1);
}

#difficulty-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffd966;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 2rem);
    text-shadow: 0 0 6px #d4af37, 0 0 12px #ffec8b;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 9999;
    pointer-events: none;
}

#difficulty-message.visible {
    opacity: 1;
}

#difficulty-message.hidden {
    opacity: 0;
}

/* ==========================================================
   SWITCH (Lamp button)
========================================================== */
.switch {
    position: absolute;
    right: 93vw;
    top: 265px;
    display: inline-block;
    width: 66px;
    height: 100px;
    background: var(--bg-black);
    border-radius: 12px;
    cursor: pointer;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 80%;
    background-color: #b91c1c;
    border-radius: 10px;
    transition: 0.3s;
}

/* ==========================================================
   LIGHT OVERLAY EFFECT
========================================================== */
#light-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 1);
    opacity: 1;
    transition: opacity 1.5s ease;
    z-index: 1;
    pointer-events: none;
}

body.lamp-on #light-overlay {
    opacity: 0;
}

.white-lamp,
.yellow-lamp,
.switch,
.ghost_counter {
    z-index: 10;
}

/* ==========================================================
   SHOP BUTTON & WINDOW
========================================================== */
.shop-toggle {
    position: fixed;
    top: clamp(60px, 10vh, 100px);
    right: clamp(40px, 5vw, 80px);
    z-index: 9999;
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
}

.shop-toggle:hover {
    transform: scale(1.1);
}

/* Shop buttons container */
.shop-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.shop-buttons button {
    padding: var(--btn-padding);
    font-size: var(--btn-font-size);
    border: none;
    border-radius: var(--btn-radius);
    cursor: pointer;
    background: #4caf50;
    color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.shop-buttons button:hover {
    background: #45a049;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
}

/* ==========================================================
   KO-FI DONATION BUTTON (Responsive)
========================================================== */
.donate-button {
    position: fixed;
    bottom: clamp(10px, 3vh, 25px);
    left: clamp(10px, 3vw, 25px);
    background: linear-gradient(135deg, #ff5f5f, #ff8080);
    color: white;
    padding: clamp(6px, 1vh, 12px) clamp(12px, 2vw, 20px);
    border-radius: clamp(8px, 1vw, 14px);
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    font-family: "Creepster", cursive;
    text-decoration: none;
    box-shadow: 0 0 1vw rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    z-index: 9999;
}

.donate-button:hover {
    background: linear-gradient(135deg, #ff4040, #ff7070);
    transform: scale(1.05);
    box-shadow: 0 0 1.5vw rgba(255, 0, 0, 0.6);
}

/* ==========================================================
   FLUID RESPONSIVE LAYOUT (no breakpoints needed)
========================================================== */
.container {
    position: relative;
    width: min(90vw, 1000px);
    height: clamp(50vh, 60vh, 70vh);
    margin: clamp(2rem, 8vh, 6rem) auto;
    z-index: 10;
}

/* Ghost image resizes smoothly */
.ghost-img {
    height: clamp(50px, 8vh, 110px);
}

/* Window + alert boxes adapt smoothly */
.window-alert,
.game-alert {
    padding: var(--pad-md);
    font-size: clamp(1.2vh, 1.5vw, 2vh);
}

/* Buttons scale naturally */
#start-btn,
.game-alert button {
    padding: var(--pad-sm);
    font-size: clamp(1.2vh, 1.6vw, 2vh);
    border-radius: var(--btn-radius);
}


/* ==========================================================
   LAMP AND SWITCH RESPONSIVENESS
========================================================== */

/* Desktop / large screens */
.white-lamp,
.yellow-lamp {
    position: absolute;
    top: -215px;
    transform: rotate(180deg);
}

.white-lamp {
    right: 30vw;
}

.yellow-lamp {
    right: 28vw;
}

/* Medium screens (tablets) */
@media (max-width: 1024px) {
    .white-lamp {
        width: 200px;
        top: -190px;
        right: 35vw;
    }

    .yellow-lamp {
        width: 200px;
        top: -190px;
        right: 32vw;
    }

    .switch {
        right: 88vw;
    }
}

/* Small screens (mobile landscape) */
@media (max-width: 768px) {
    .white-lamp {
        width: 180px;
        top: -170px;
        right: 40vw;
    }

    .yellow-lamp {
        width: 180px;
        top: -170px;
        right: 36vw;
    }

    .switch {
        right: 88vw;
    }
}

/* Extra small screens (mobile portrait) */
@media (max-width: 567px) {
    .white-lamp {
        width: 120px;
        top: -132px;
        right: 58vw;
    }

    .yellow-lamp {
        width: 120px;
        top: -132px;
        right: 54vw;
    }

    .switch {
        right: 44vw;
        top: 65vh;
        transform: rotate(90deg);
    }

    #language-switch {
        margin-top: 69px;
    }

    body.lamp-on .switch {
        background-color: transparent !important;
    }

    .ghost-img {
        height: 60px;
    }

    .donate-button {
        top: clamp(20px, 24vh, 63px);
        right: clamp(10px, 6vw, 24px);
        bottom: auto;
        left: auto;
    }

    .shop-toggle {
        top: clamp(60px, 12vh, 110px);
        right: clamp(24px, 0vw, 70px);
    }
}

/* ==========================================================
   FIX for very small screens (≤400px)
========================================================== */
@media (max-width: 380px) {

    .container {
        height: 65vh;
    }

    #difficulty-selection {
        flex-direction: column;
        gap: 10px;
    }

    .switch {
        right: 42vw;
        top: 70vh;
    }

}


/* ==========================================================
   👻 Lamp Away — developed by Vittorio D’Auria
========================================================== */