body {
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    /* On larger screens, keep aspect ratio reasonable */
    @media (min-width: 600px) {
        max-width: 500px;
        border: 2px solid #333;
        box-shadow: 0 0 30px rgba(0, 100, 255, 0.2);
    }
    background-color: #000;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: auto;
    transition: opacity 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.title {
    font-size: clamp(32px, 10vmin, 60px); /* Responsive font size */
    margin-bottom: 5vmin;
    text-shadow: 0 0 10px #00ffff, 0 0 20px #0088ff;
    color: #88ccff;
    font-weight: 800;
    text-align: center;
    line-height: 1.2;
}

.btn {
    background: linear-gradient(135deg, #0066ff, #00ccff);
    border: none;
    padding: 15px 40px;
    color: white;
    font-size: clamp(18px, 6vmin, 28px);
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 195, 255, 0.5);
    transition: transform 0.1s, box-shadow 0.1s;
    font-family: inherit;
    white-space: nowrap;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 195, 255, 0.8);
}

.btn:active {
    transform: scale(0.95);
}

.instruction {
    margin-top: 5vmin;
    font-size: clamp(14px, 4vmin, 20px);
    color: #ccc;
    text-align: center;
    line-height: 1.5;
    text-shadow: 1px 1px 2px black;
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px 15px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    font-size: clamp(16px, 5vmin, 24px);
    font-weight: bold;
    pointer-events: none;
    text-shadow: 1px 1px 2px black;
    z-index: 10;
}

#health {
    color: #ff4444;
}

#score {
    color: #44ff44;
}

#final-score {
    font-size: clamp(24px, 8vmin, 40px);
    margin-bottom: 5vmin;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
