:root {
    --primary-bg: #fff0f3;
    --accent-color: #ff4d6d;
    --road-color: #4a4e69;
    --grass-color: #95d5b2;
    --text-color: #590d22;
    --button-bg: #ff758f;
    --button-hover: #ff4d6d;
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--primary-bg);
    font-family: var(--font-main);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100%;
    max-height: 800px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border-radius: 20px;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: var(--grass-color);
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 240, 243, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    pointer-events: all;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

button {
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 15px rgba(255, 117, 143, 0.4);
}

button:hover {
    background: var(--button-hover);
    transform: scale(1.05);
}

button:active {
    transform: scale(0.95);
}

/* Popup specific styles */
.popup-content {
    background: white;
    padding: 40px;
    border-radius: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 90%;
    width: 450px;
    border: 3px solid var(--accent-color);
    animation: popupScale 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

#win-message {
    line-height: 1.6;
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 30px;
    font-style: italic;
}

@keyframes popupScale {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.heart-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 10px;
    animation: heartBeat 1.5s infinite;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.2);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.1);
    }

    60% {
        transform: scale(1);
    }
}

#controls-hint {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    text-align: center;
    opacity: 0.6;
    pointer-events: none;
}

#controls-hint p {
    font-size: 0.9rem;
}