:root {
    --bg-sky: #87CEEB;
    --grass-green: #4CAF50;
    --ui-yellow: #FFEB3B;
    --ui-orange: #FF9800;
    --text-dark: #2D3436;
    --font-main: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background: var(--bg-sky);
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #87CEEB 0%, #E0F7FA 70%, #4CAF50 100%);
    overflow: hidden;
}

/* Header Area */
#header {
    position: absolute;
    top: 20px;
    width: 100%;
    text-align: center;
    z-index: 100;
    pointer-events: none;
}

.animal-name {
    background: white;
    padding: 10px 40px;
    border-radius: 50px;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--ui-orange);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    display: inline-block;
    border: 4px solid var(--ui-yellow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* The Stage */
#stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.background-img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    /* Forces the background to always fill the screen and keep objects pinned to features */
    position: absolute;
    top: 0;
    left: 0;
}

/* Layers for Isometric Depth */
#object-layer {
    position: absolute;
    width: 100%;
    height: 100%;
}

#character-layer {
    position: absolute;
    width: 100%;
    height: 100%;
}

/* Hiding Objects */
.hiding-spot {
    position: absolute;
    z-index: 10;
    cursor: pointer;
    transition: transform 0.2s;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.2));
    min-width: 80px;
    /* Ensure they are never too tiny */
}

.hiding-spot img {
    width: 100%;
    height: auto;
    display: block;
}

.hiding-spot:active {
    transform: scale(0.95);
}

.hiding-spot.wobble {
    animation: wobble 0.5s ease-in-out;
}

@keyframes wobble {

    0%,
    100% {
        transform: rotate(0);
    }

    25% {
        transform: rotate(-5deg);
    }

    75% {
        transform: rotate(5deg);
    }
}

.hiding-spot.success {
    animation: success-jump 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100 !important;
}

@keyframes success-jump {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 transparent);
    }

    30% {
        transform: scale(1.3) translateY(-20px);
        filter: drop-shadow(0 20px 30px rgba(255, 235, 59, 0.6));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.2));
    }
}

/* Characters */
.actor {
    position: absolute;
    width: 80px;
    height: 80px;
    z-index: 5;
    /* Behind objects by default */
    pointer-events: none;
    transition: filter 0.3s, opacity 0.5s;
    will-change: transform;
}

.actor img,
.actor svg,
.bird-actor img,
.bird-actor svg,
.visual-wrapper,
.svg-container {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bird-actor {
    width: 60px;
    height: 60px;
    z-index: 2;
    pointer-events: none;
    will-change: transform;
}

.visual-wrapper.resting {
    animation: breathing 3s ease-in-out infinite;
}

@keyframes breathing {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.speech-bubble {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 900;
    color: var(--ui-orange);
    white-space: nowrap;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 9999 !important;
}

.actor .speech-bubble.show {
    opacity: 1;
}

.love-balloon {
    position: fixed;
    background: #FF4757;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 900;
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 10px 20px rgba(255, 71, 87, 0.4);
    animation: floating-balloon 4s ease-out forwards;
    white-space: nowrap;
}

.love-balloon::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 2px;
    height: 30px;
    background: rgba(255, 255, 255, 0.5);
    transform: translateX(-50%);
}

@keyframes floating-balloon {
    0% {
        transform: translate(0, 0) scale(0.5);
        opacity: 0;
    }

    10% {
        transform: translate(0, -20px) scale(1.1);
        opacity: 1;
    }

    100% {
        transform: translate(30px, -250px) scale(1);
        opacity: 0;
    }
}

/* Lower Holding Area */
#holding-area {
    position: absolute;
    bottom: 15%;
    width: 100%;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    z-index: 200;
    pointer-events: none;
}

/* Peek-a-boo Overlay */
#overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 9999;
    font-size: 5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 10px 0 var(--ui-orange), 0 20px 30px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#overlay.show {
    transform: translate(-50%, -50%) scale(1);
}

/* Settings Menu */
/* UI Buttons Layer */
.action-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1001;
}

.settings-btn,
.home-btn {
    width: 60px;
    height: 60px;
    background: white;
    border: 4px solid var(--ui-yellow);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.settings-btn:hover,
.home-btn:hover {
    transform: scale(1.1);
}

.settings-btn:active,
.home-btn:active {
    transform: scale(0.9);
}

.settings-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    /* Ensure it fits on short screens */
    overflow-y: auto;
    /* Allow scrolling if content is tall */
    background: white;
    padding: 30px 20px;
    border-radius: 25px;
    border: 6px solid var(--ui-yellow);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-menu.show {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.settings-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 900;
    color: #666;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}

.settings-close:hover {
    background: #e0e0e0;
    color: #333;
}

/* ... rest of the styles ... */

.bg-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bg-option {
    padding: 10px 20px;
    background: #f0f0f0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.2s;
}

.bg-option:hover {
    background: var(--ui-yellow);
}

.about-section {
    color: #444;
    line-height: 1.4;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.about-section p {
    margin: 3px 0;
}

.about-section a {
    color: var(--ui-orange);
    text-decoration: none;
    font-weight: bold;
}

.about-section a:hover {
    text-decoration: underline;
}

.bg-option.active {
    background: var(--ui-orange);
    color: white;
}

/* Mobile Perspective Fixes & Responsive Rules */
@media (max-width: 768px) {
    #game-container {
        height: 100vh;
        border: none;
        border-radius: 0;
    }

    #header {
        top: 10px;
        left: 10px;
        right: auto;
        transform: none;
        width: calc(100% - 110px);
    }

    .animal-name {
        font-size: 1.1rem;
        padding: 8px 15px;
        border-width: 3px;
    }

    .action-buttons {
        top: 10px;
        right: 10px;
        gap: 10px;
    }

    .settings-btn,
    .home-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        border-width: 3px;
    }

    #holding-area {
        bottom: 5%;
        height: 70px;
        gap: 20px;
    }

    .actor {
        width: 50px;
        height: 50px;
    }

    .hiding-spot {
        min-width: 65px;
    }

    .settings-menu {
        width: 90%;
        max-width: none;
        padding: 20px 15px;
        max-height: 85vh;
        border-width: 4px;
        overflow-y: auto;
    }
}