body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #001f3f; /* Deep ocean blue */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none; /* Prevent browser scrolling on touch */
}

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

canvas {
    background: linear-gradient(to bottom, #4facfe 0%, #00f2fe 100%); /* Underwater gradient */
    display: block;
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#ui-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas when playing */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

#startScreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 100px;
}

#title {
    color: white;
    font-size: clamp(2rem, 8vw, 4rem);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin: 0;
}

#instructions {
    color: white;
    font-size: clamp(1.2rem, 5vw, 2rem);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    margin-top: 20px;
}

.blink {
    animation: blink 1.5s infinite;
}

#scoreDisplay {
    position: absolute;
    top: 30px;
    color: white;
    font-size: clamp(3rem, 10vw, 5rem);
    font-weight: bold;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.6);
    margin: 0;
}

#gameOverScreen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 31, 63, 0.9);
    padding: 30px 40px;
    border-radius: 15px;
    text-align: center;
    color: white;
    pointer-events: auto; /* Re-enable clicks for game over screen */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 2px solid #00f2fe;
    backdrop-filter: blur(5px);
}

#gameOverScreen h2 {
    font-size: clamp(2rem, 8vw, 3rem);
    margin-top: 0;
    margin-bottom: 20px;
    color: #ff4757;
}

#gameOverScreen p {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    margin: 10px 0;
}

button {
    background: #00f2fe;
    color: #001f3f;
    border: none;
    padding: 15px 30px;
    font-size: clamp(1.2rem, 5vw, 1.5rem);
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.1s, background 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:active {
    transform: scale(0.95);
    background: #4facfe;
}

.hidden {
    display: none !important;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
