* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #8FBC8F; /* Dark sea green grass */
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    touch-action: none; /* Prevents mobile scrolling and zooming */
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none; /* Let clicks pass through to the canvas */
    z-index: 10;
}

.stats {
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    font-weight: 800;
    color: #2c3e50;
    border: 3px solid #fff;
    pointer-events: auto;
}

#score-display {
    font-size: 1.8rem;
    color: #cc0000;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.1);
}

#highscore-display {
    font-size: 1rem;
    color: #666;
    margin-top: 5px;
    font-weight: 600;
}

#lives-display {
    display: flex;
    gap: 8px;
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    border: 3px solid #fff;
    pointer-events: auto;
}

.heart {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s ease;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}

.heart.lost {
    filter: grayscale(100%) opacity(0.3);
    transform: scale(0.7);
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#blanket {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 20px;
    background-color: #fff;
    /* Classic red and white checkered pattern */
    background-image: 
        linear-gradient(90deg, rgba(200, 0, 0, 0.5) 50%, transparent 50%),
        linear-gradient(rgba(200, 0, 0, 0.5) 50%, transparent 50%);
    background-size: 50px 50px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    border: 5px solid #fff;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#food {
    font-size: 6rem;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.3));
    z-index: 2;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    text-align: center;
    padding: 20px;
    transition: opacity 0.3s ease;
}

#game-over-screen.hidden {
    display: none;
    opacity: 0;
}

#game-over-screen h1 {
    font-size: 4rem;
    color: #ff4444;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 4px 10px rgba(255, 68, 68, 0.4);
}

#game-over-screen p {
    font-size: 1.4rem;
    margin-bottom: 30px;
    color: #eee;
}

.final-score-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px 40px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 40px;
}

#final-score {
    font-size: 2.5rem !important;
    font-weight: 900;
    color: #ffd700;
    margin: 0 !important;
    text-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
}

.blink {
    animation: blinker 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    font-weight: bold;
    font-size: 1.5rem !important;
    cursor: pointer;
    background: #4CAF50;
    padding: 15px 30px;
    border-radius: 30px;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes blinker {
    50% { opacity: 0.7; transform: scale(0.95); }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    #blanket {
        width: 240px;
        height: 240px;
        background-size: 40px 40px;
    }
    #food {
        font-size: 4.5rem;
    }
    .stats {
        padding: 8px 15px;
    }
    #score-display {
        font-size: 1.4rem;
    }
    #lives-display {
        font-size: 1.5rem;
        padding: 8px 12px;
    }
    #game-over-screen h1 {
        font-size: 2.8rem;
    }
}
