:root {
    --primary-color: #00d4ff;
    /* GenHealth Teal/Blue */
    --secondary-color: #0056b3;
    --accent-color: #ff0055;
    --text-color: #ffffff;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
    --font-family: 'Inter', sans-serif;
    --arcade-font: 'Press Start 2P', cursive;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    /* Use dynamic viewport height for mobile browsers */
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    /* Slightly wider for shooter */
    height: 100%;
    max-height: 800px;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.15);
    border: 2px solid #334155;
}

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

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

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    color: var(--text-color);
    text-align: center;
    padding: 20px;
    pointer-events: auto;
    transition: opacity 0.2s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

h1 {
    font-family: var(--arcade-font);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-shadow: 4px 4px 0px #0056b3;
    line-height: 1.4;
}

h2 {
    font-family: var(--arcade-font);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    text-shadow: 2px 2px 0px #500;
}

p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    color: #cbd5e1;
    max-width: 80%;
}

.controls {
    font-weight: 600;
    color: #94a3b8;
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
}

.key {
    display: inline-block;
    background: #334155;
    padding: 2px 8px;
    border-radius: 4px;
    border-bottom: 2px solid #1e293b;
    color: #fff;
    font-family: monospace;
    margin: 0 2px;
}

button,
.cta-btn {
    padding: 16px 32px;
    font-family: var(--arcade-font);
    font-size: 0.9rem;
    /* Arcade font is large */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    margin: 10px;
    text-transform: uppercase;
}

.primary-btn {
    background: var(--primary-color);
    color: #0f172a;
    box-shadow: 0 4px 0 #0091b0;
}

.primary-btn:hover {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #0091b0;
}

.primary-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

.secondary-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 4px 0 rgba(0, 212, 255, 0.2);
}

.secondary-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0, 212, 255, 0.2);
}

#score-display {
    position: absolute;
    top: 20px;
    right: 20px;
    text-align: right;
    pointer-events: none;
    z-index: 10;
}

#score-display.hidden {
    display: none;
}

#score {
    font-family: var(--arcade-font);
    font-size: 1.5rem;
    color: var(--primary-color);
    text-shadow: 2px 2px 0 #000;
}

/* Mobile Controls */
#mobile-controls {
    position: absolute;
    bottom: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    /* Respect safe area */
    left: 0;
    width: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    /* Let clicks pass through container */
    z-index: 20;
    padding-bottom: 20px;
    /* Extra padding to lift controls up further */
}

#mobile-controls.hidden {
    display: none;
}

.d-pad {
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.control-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    cursor: pointer;
    transition: background 0.1s, transform 0.1s;
    pointer-events: auto;
}

.control-btn:active,
.control-btn.pressed {
    background: rgba(0, 212, 255, 0.3);
    transform: scale(0.95);
    border-color: var(--primary-color);
}

.shoot-btn {
    width: 70px;
    height: 70px;
    border-color: var(--accent-color);
    background: rgba(255, 0, 85, 0.1);
    font-size: 30px;
}

.shoot-btn:active,
.shoot-btn.pressed {
    background: rgba(255, 0, 85, 0.4);
    border-color: var(--accent-color);
}

@media (min-width: 769px) {
    #mobile-controls {
        display: none !important;
    }
}