:root {
    --primary-color: #ff6b6b;
    --secondary-color: #ff9e9e;
    --bg-color: #ffe3e3;
    --text-color: #59405c;
    --font-pixel: 'Press Start 2P', cursive;
    --font-body: 'Varela Round', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    font-family: var(--font-body);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16/9;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    background: #87CEEB;
    /* Fallback sky color */
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto;
    /* Center it */
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 227, 227, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
    transition: opacity 0.5s;
}

.hidden {
    display: none !important;
}

h1 {
    font-family: var(--font-pixel);
    color: var(--primary-color);
    font-size: 24px;
    margin-bottom: 20px;
    line-height: 1.5;
    text-shadow: 2px 2px 0px white;
}

p {
    color: var(--text-color);
    font-size: 18px;
    margin-bottom: 30px;
    max-width: 80%;
}

.controls-hint {
    font-size: 14px;
    opacity: 0.7;
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    font-family: var(--font-pixel);
    font-size: 14px;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 4px 0 #d45050;
    transition: transform 0.1s;
}

button:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Modal */
#message-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    max-width: 80%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 4px solid var(--primary-color);
}

#modal-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 10px;
    margin: 0 auto 15px auto;
    object-fit: cover;
    display: none;
    /* Hidden by default until src is set */
}

#modal-img[src] {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.heart-animation {
    font-size: 60px;
    animation: pulse 1s infinite;
    margin: 20px;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    position: absolute;
    bottom: 120px;
    left: 0;
    width: 100%;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    pointer-events: none;
    /* Let touches pass through container */
}

#mobile-controls button {
    pointer-events: auto;
    width: 60px;
    /* Slightly smaller to fit screens */
    height: 60px;
    border-radius: 50%;
    font-size: 24px;
    opacity: 0.6;
    /* Less intrusive */
    padding: 0;
    background: rgba(255, 107, 107, 0.8);
    /* Red tint */
    color: white;
    border: 2px solid white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    touch-action: manipulation;
    /* Improvements touch response */
}

.d-pad {
    display: flex;
    gap: 20px;
    /* More space between buttons */
}

@media (max-width: 768px) {
    #mobile-controls {
        display: flex;
    }

    #game-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    h1 {
        font-size: 18px;
    }
}