:root {
    --bg-color: #bae6fd;
    --panel-bg: rgba(255, 255, 255, 0.8);
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --secondary: #e2e8f0;
    --secondary-hover: #cbd5e1;
    --accent: #10b981;
    --danger: #ef4444;
    --text: #1e293b;
    --text-muted: #475569;
    --glow: 0 0 15px rgba(255, 255, 255, 0.8);
    --glass-border: 1px solid rgba(255, 255, 255, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

body {
    background-color: #000;
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
}

#app-container {
    width: 100%;
    max-width: 480px; /* Portrait constraint */
    height: 100%;
    max-height: 900px;
    background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 100%);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Start Menu */
#start-menu {
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
}

.game-title {
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 3rem;
    line-height: 1.1;
    color: var(--text);
    text-shadow: 0 4px 20px rgba(255,255,255,0.8);
}

.game-title span {
    color: var(--primary);
    text-shadow: var(--glow);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 70%;
}

/* Buttons */
button {
    border: none;
    outline: none;
    cursor: pointer;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.25rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}

button:active {
    transform: scale(0.95);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    border: 1px solid rgba(255,255,255,0.2);
}

.secondary-btn {
    background: var(--panel-bg);
    color: var(--text);
    padding: 1rem 2rem;
    border: var(--glass-border);
    backdrop-filter: blur(10px);
}

/* Game Screen */
#game-header {
    display: flex;
    justify-content: space-between;
    padding: max(1rem, env(safe-area-inset-top)) 1rem 1rem 1rem;
    background: linear-gradient(to bottom, rgba(2,6,23,0.9), transparent);
    z-index: 10;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.stat {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--panel-bg);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border: var(--glass-border);
    backdrop-filter: blur(5px);
}

.stat span {
    color: var(--text);
}

#game-canvas {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: block;
}

.quit-btn {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 0.2rem 1rem;
    font-size: 0.9rem;
    border-radius: 8px;
    font-weight: 700;
}
.quit-btn:active {
    background: var(--danger);
    color: white;
}

/* Bottom Controls */
#controls-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border-top: var(--glass-border);
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom)) 1rem;
    width: 100%;
    z-index: 10;
}

.control-btn {
    background: rgba(255,255,255,0.05);
    border: var(--glass-border);
    color: var(--text);
}

.nav-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.1), 0 4px 10px rgba(0,0,0,0.5);
}

.nav-btn svg {
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
}

.fire-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at top left, #3b82f6, #1d4ed8);
    font-size: 2.5rem;
    font-weight: 900;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6), inset 0 4px 10px rgba(255,255,255,0.3);
    border: 2px solid rgba(255,255,255,0.4);
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* Modals */
.overlay {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.hidden {
    display: none !important;
}

.modal {
    background: var(--panel-bg);
    border: var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    width: 85%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transform: scale(0.9);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    to { transform: scale(1); }
}

.modal h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.danger-text { color: var(--danger); text-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }
.success-text { color: var(--accent); text-shadow: 0 0 10px rgba(16, 185, 129, 0.5); }

.final-stats {
    font-size: 1.2rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 12px;
}

.final-stats span {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.5rem;
}
