body {
    margin: 0;
    padding: 0;
    background-color: #333;
    /* Oscuro on desktop */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    touch-action: none;
    /* Prevent browser scrolling on drag */
}

#game-container {
    position: relative;
    width: 100%;
    max-width: calc(100dvh * (9 / 16));
    aspect-ratio: 9 / 16;
    overflow: hidden;
    background-color: #608650;
    /* Brand green */
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    /* Good looking depth on desktop */
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 20;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 248, 234, 0.95);
    /* Cream transparent */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    z-index: 30;
}

.hidden {
    display: none !important;
}

.overlay h1 {
    color: #608650;
    /* Brand green */
    font-size: 40px;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.overlay p {
    color: #333;
    font-size: 20px;
    margin-bottom: 20px;
    max-width: 600px;
}

button {
    padding: 15px 40px;
    font-size: 24px;
    background-color: #c9bc48;
    /* Accent color */
    color: #333;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s, background-color 0.2s;
    pointer-events: auto;
}

button:hover {
    background-color: #b0a43d;
    /* Darker accent */
    transform: scale(1.05);
}

button:active {
    transform: scale(0.95);
}

/* Flash animation for catching an egg */
@keyframes flashFx {
    0% {
        background-color: rgba(255, 255, 255, 0.6);
    }

    100% {
        background-color: transparent;
    }
}

#flash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-color: transparent;
    z-index: 10;
}

.flash-active {
    animation: flashFx 0.3s ease-out;
}

/* Flash animation for hitting a bomb */
@keyframes flashRedFx {
    0% {
        background-color: rgba(255, 107, 107, 0.6);
    }

    100% {
        background-color: transparent;
    }
}

.flash-red-active {
    animation: flashRedFx 0.3s ease-out;
}

@keyframes shakeFx {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

.shake-active {
    animation: shakeFx 0.5s;
}

input[type="password"] {
    padding: 15px;
    font-size: 24px;
    border: 3px solid #608650;
    border-radius: 10px;
    text-align: center;
    width: 80%;
    max-width: 300px;
    margin: 10px 0;
    font-family: inherit;
}

button.gigante {
    font-size: 32px;
    padding: 20px 40px;
    background-color: #608650;
    color: #fff;
    margin-top: 20px;
    animation: pulse 1.5s infinite;
}

button.gigante:hover {
    background-color: #4a683e;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

#win-message p {
    font-size: 22px;
    font-weight: bold;
    color: #4a683e;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Responsive UI text scaling */
@media (max-width: 600px) {
    .overlay h1 {
        font-size: 32px;
    }

    .overlay p {
        font-size: 16px;
    }

    button {
        padding: 10px 20px;
        font-size: 18px;
    }

    button.gigante {
        font-size: 24px;
        padding: 15px 30px;
    }

    #ui-layer {
        font-size: 18px;
    }

    input[type="password"] {
        font-size: 18px;
        padding: 10px;
    }
}