/* Nintendo Style Reset & Font */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #222; /* Dark outside the game */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Press Start 2P', cursive; /* Retro font */
    overflow: hidden;
    touch-action: none; /* Prevents scroll/zoom pan capture on iOS */
    -webkit-tap-highlight-color: transparent; /* Removes default tap highlight */
    cursor: pointer; /* Forces iOS to register touches globally */
}

#game-container {
    position: relative;
    width: 400px;
    height: 600px;
    background-color: #5C94FC; /* Mario 'Sky Blue' */
    border: 4px solid #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

canvas {
    display: block;
    image-rendering: pixelated; /* Keeps pixel art sharp if scaled */
}

/* UI Overlay */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
}

.screen {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 90%;
    background: rgba(0, 0, 0, 0.85); /* Slightly transparent dark box */
    border: 4px solid #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.screen.active {
    display: flex;
    pointer-events: auto; /* Catch clicks if needed here, but usually caught on canvas */
}

/* Start Screen specific */
#screen-start h1 {
    color: #FFCE00; /* Yellow */
    text-shadow: 3px 3px 0 #D32F2F; /* Red shadow */
    font-size: 28px;
    margin-bottom: 20px;
    line-height: 1.5;
}

#screen-start p {
    font-size: 10px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.instructions {
    font-size: 8px;
    color: #ccc;
    line-height: 1.4;
}

/* Game Over specific */
#screen-gameover h2 {
    color: #D32F2F;
    text-shadow: 2px 2px 0 #fff;
    font-size: 24px;
    margin-bottom: 15px;
}

#screen-gameover p {
    font-size: 10px;
    margin-bottom: 15px;
}

/* Win specific */
#screen-win {
    background: rgba(0, 150, 50, 0.9);
    border-color: #FFCE00;
}

#screen-win h2 {
    color: #FFCE00;
    text-shadow: 2px 2px 0 #D32F2F;
    font-size: 20px;
    margin-bottom: 20px;
    line-height: 1.4;
}

#screen-win p {
    font-size: 10px;
    margin-bottom: 15px;
    line-height: 1.4;
}

/* Win Grapes Animation */
@keyframes danceGrapes {
    0% { transform: translateY(0) rotate(0deg) scale(1); }
    33% { transform: translateY(-20px) rotate(15deg) scale(1.1); }
    66% { transform: translateY(10px) rotate(-15deg) scale(0.9); }
    100% { transform: translateY(0) rotate(0deg) scale(1); }
}

#grapes-dance-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.dancing-grape {
    position: absolute;
    font-size: 40px;
    animation: danceGrapes 1.5s infinite ease-in-out;
    opacity: 0;
    transition: opacity 0.5s;
}

/* HUD */
#hud {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 14px;
    color: white;
    text-shadow: 2px 2px 0 black;
    pointer-events: none;
    display: none;
}
