/* --- CORE VISUALS & VARIABLES --- */
:root {
    --primary: #00f3ff;   /* Ciano Neon */
    --secondary: #004455; /* Teal Escuro */
    --danger: #ff2a2a;    /* Vermelho Alerta */
    --gold: #ffd700;      /* Dourado Meta */
    --dark: #020a12;      /* Fundo Profundo */
}

/* Configuração Base */
body {
    margin: 0;
    overflow: hidden;
    background-color: var(--dark);
    font-family: 'Rajdhani', sans-serif;
    color: white;
    user-select: none;
    -webkit-user-select: none; /* Safari */
    touch-action: none; /* Crucial para jogos mobile */
    cursor: default;
}

/* Efeito CRT (Scanline) - Camada de ruído visual */
body::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    z-index: 9999;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none; /* Permite clicar através do efeito */
}

/* Classes Utilitárias */
.hidden { display: none !important; opacity: 0; pointer-events: none; }
.fade-in { animation: fadeIn 0.5s forwards; }

@keyframes fadeIn { 
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); } 
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); } 
}

/* --- UI COMPONENTS (Botões Sci-Fi) --- */
.btn {
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 15px 40px;
    font-size: 1.5rem;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    margin: 10px;
    /* Recorte futurista nos cantos */
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.btn:hover {
    background: var(--primary);
    color: var(--dark);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
    transform: translateY(-2px);
}

.btn:active { transform: scale(0.95); }

.btn-icon { 
    padding: 15px; 
    border-radius: 50%; 
    width: 60px; 
    height: 60px; 
    clip-path: none; /* Botões redondos não usam clip-path */
}

/* --- SCREENS (Start & Menu) --- */
#start-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 100;
    background: rgba(2, 10, 18, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

h1.main-title {
    font-size: clamp(3rem, 10vw, 6rem); /* Responsivo: min 3rem, ideal 10vw, max 6rem */
    margin: 0;
    color: transparent;
    -webkit-text-stroke: 2px var(--primary);
    text-shadow: 0 0 30px var(--primary);
    letter-spacing: 10px;
    animation: pulseTitle 3s infinite;
}

@keyframes pulseTitle {
    0%, 100% { text-shadow: 0 0 20px var(--primary); opacity: 0.8; }
    50% { text-shadow: 0 0 50px var(--primary); opacity: 1; }
}

.subtitle { 
    color: #88aaff; 
    font-size: 1.2rem; 
    margin-bottom: 40px; 
    letter-spacing: 4px; 
    text-transform: uppercase; 
    text-align: center;
}

#stats-bar {
    display: flex; gap: 30px; margin-bottom: 30px;
    background: rgba(0,0,0,0.5); padding: 10px 30px; border-radius: 50px; border: 1px solid #333;
}
.stat-item { color: var(--gold); font-weight: bold; font-size: 1.2rem; }

/* --- HUD (Interface de Jogo) --- */
#ui-layer {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 50;
}

.hud-top {
    position: absolute; top: 20px; left: 20px;
    display: flex; flex-direction: column; gap: 8px;
}

.hud-text { font-size: 1.2rem; font-weight: bold; text-shadow: 2px 2px 0px black; letter-spacing: 1px; }

#energy-container {
    width: 250px; height: 16px;
    background: #111; border: 1px solid var(--secondary);
    transform: skewX(-20deg); overflow: hidden; position: relative;
}
#energy-fill {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    transition: width 0.1s linear;
}
#energy-label {
    position: absolute; top: 0; left: 5px; font-size: 10px; 
    line-height: 16px; color: black; font-weight: 800; transform: skewX(20deg);
}

/* --- ALERT SYSTEM --- */
#idle-alert-container {
    position: fixed; top: 20%; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center;
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
#idle-text {
    color: var(--danger); font-size: clamp(1.2rem, 4vw, 1.8rem); font-weight: 900;
    text-shadow: 0 0 15px red; letter-spacing: 2px; text-align: center;
    animation: blinkFast 0.5s infinite;
}
@keyframes blinkFast { 0%,100%{opacity:1;} 50%{opacity:0.5;} }

#idle-bar-bg { width: 300px; height: 8px; background: #300; border: 1px solid #f00; margin-top: 5px; }
#idle-bar-fill { height: 100%; width: 0%; background: #f00; transition: width 0.1s linear; }

/* --- TUTORIAL OVERLAY (Desktop Keys) --- */
#tutorial-keys {
    position: fixed; bottom: 20%; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    z-index: 45; opacity: 0; transition: opacity 1s; pointer-events: none;
}
.key-row { display: flex; gap: 10px; }
.key-cap {
    width: 50px; height: 50px; border: 2px solid var(--primary);
    color: var(--primary); font-size: 1.5rem; font-weight: bold;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}
.space-key { width: 200px; height: 40px; font-size: 1rem; }

/* --- MODALS (Centralizados e Fixos) --- */
.modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(2, 10, 18, 0.95); padding: 40px; 
    border: 1px solid var(--primary);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    width: 85%; max-width: 500px; z-index: 2000;
    display: none; text-align: center;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

.modal h2 { color: var(--primary); margin-top: 0; text-transform: uppercase; letter-spacing: 3px; }
.modal h3 { color: var(--gold); margin: 15px 0 5px 0; font-size: 1.2rem; border-bottom: 1px solid #333; display: inline-block; }
.modal p { color: #ccc; line-height: 1.5; font-size: 1rem; margin: 8px 0; }
.close-x { position: absolute; top: 15px; right: 20px; font-size: 2rem; color: var(--danger); cursor: pointer; }

/* --- MOBILE CONTROLS --- */
#mobile-controls {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 100%;
    z-index: 60; pointer-events: none; display: none;
}
#joystick-zone {
    position: absolute; bottom: 40px; left: 40px; width: 150px; height: 150px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%; border: 1px dashed rgba(255,255,255,0.2);
    pointer-events: auto; /* Permite toque */
}
#stick {
    position: absolute; top: 50%; left: 50%; width: 50px; height: 50px;
    background: rgba(0, 243, 255, 0.5); border-radius: 50%;
    transform: translate(-50%, -50%); box-shadow: 0 0 15px var(--primary);
}
#sonar-btn {
    position: absolute; bottom: 40px; right: 40px;
    width: 90px; height: 90px; border-radius: 50%;
    background: rgba(0, 243, 255, 0.1); border: 2px solid var(--primary);
    color: white; font-weight: bold; pointer-events: auto; /* Permite toque */
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
}
#sonar-btn:active { background: var(--primary); color: black; transform: scale(0.95); }

/* --- LEVEL OVERLAY (Texto Gigante) --- */
#level-overlay {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: clamp(5rem, 15vw, 10rem); color: rgba(255,255,255,0.1); font-weight: 900;
    pointer-events: none; opacity: 0; transition: opacity 0.5s; z-index: 40;
}

/* --- FORM ELEMENTS --- */
input[type=range] { width: 100%; accent-color: var(--primary); margin: 10px 0; }
label { display: block; text-align: left; color: var(--primary); margin-top: 15px; }