/* ============================================================
   1. GLOBAL SETUP & FONTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;900&display=swap');

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { 
    margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; 
    background: #020205; font-family: 'Orbitron', sans-serif; color: #fff;
    touch-action: none; 
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    -webkit-user-select: none;
    user-select: none;
}

#mobile-interface button, 
#mobile-interface div {
    touch-action: none;
}

/* ============================================================
   2. SCREEN EFFECTS
   ============================================================ */
.screen-effects { 
    position: fixed; inset: 0; pointer-events: none; z-index: 1000; 
    background: 
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.2) 50%),
        radial-gradient(circle, transparent 20%, rgba(0,0,0,0.7) 100%); 
    background-size: 100% 4px, 100% 100%; opacity: 0.8; 
}

/* ============================================================
   3. MENUS (Start & Game Over)
   ============================================================ */
#start-screen, #game-over-screen { 
    position: fixed; inset: 0; display: flex; flex-direction: column; 
    justify-content: center; align-items: center; text-align: center; 
    background: linear-gradient(135deg, #050510 0%, #150020 100%); z-index: 9999;
    padding: 20px;
}

#game-over-screen { background: rgba(10, 0, 10, 0.98); display: none; }

.glitch-title { 
    font-size: clamp(1.5rem, 6vw, 4rem); 
    color: #fff; font-weight: 900; letter-spacing: 2px; text-transform: uppercase;
    text-shadow: 2px 2px #f0f, -2px -2px #0ff;
    animation: main-glitch 2s infinite; margin-bottom: 15px;
}

@keyframes main-glitch {
    0% { transform: skew(0deg); }
    1% { transform: skew(3deg); }
    2% { transform: skew(-3deg); }
    3% { transform: skew(0deg); }
}

#btn-start, #btn-restart { 
    padding: 12px 25px; background: transparent; border: 2px solid #f0f; 
    color: #f0f; font-family: 'Orbitron'; font-weight: 900; font-size: 1rem;
    cursor: pointer; text-transform: uppercase; letter-spacing: 2px;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}

.tutorial-box {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    background: rgba(0, 255, 255, 0.05); padding: 10px;
    border: 1px solid #0ff; margin-bottom: 15px; width: 100%; max-width: 500px;
}

.tutorial-item { font-size: 0.6rem; font-weight: 900; text-align: left; }
.tutorial-item span { color: #000; background: #0ff; padding: 2px 4px; margin-right: 4px; }

/* ============================================================
   4. HUD (Landscape Optimized)
   ============================================================ */
#ui-container { position: fixed; inset: 0; z-index: 500; pointer-events: none; display: none; }

.hud-panel { 
    background: rgba(10, 0, 20, 0.6); 
    border: 1px solid #0ff; 
    backdrop-filter: blur(3px);
    padding: 8px;
}

.label { font-size: 0.5rem; color: #0ff; font-weight: 900; letter-spacing: 1px; margin-bottom: 2px; }
#score, #timer { line-height: 1; text-shadow: 0 0 8px #f0f; font-weight: 900; }
.combo-text { color: #f0f; text-shadow: 0 0 15px #f0f; font-weight: 900; }
.velocity-text { color: #0f0; font-family: monospace; font-size: 0.75rem; }

#distance { 
    position: fixed; top: 20%; left: 50%; transform: translateX(-50%); 
    font-weight: 900; letter-spacing: 2px; text-shadow: 0 0 10px #0ff; 
    font-size: 1.2rem; text-align: center;
}

/* MOBILE LANDSCAPE SPECIFIC */
@media (max-width: 900px) and (orientation: landscape) {
    .top-left { position: absolute; top: 10px; left: 10px; border-left: 4px solid #f0f; min-width: 100px; }
    .top-right { position: absolute; top: 10px; right: 10px; border-right: 4px solid #0ff; min-width: 100px; text-align: right; }
    .bottom-right { 
        position: absolute; bottom: 10px; right: 50%; transform: translateX(50%); 
        border: 1px solid #f0f; border-bottom: 4px solid #f0f; min-width: 180px; text-align: center; 
    }
    #score, #timer { font-size: 1.5rem; }
    .combo-text { font-size: 1.8rem; }
}

/* DESKTOP LARGE HUD */
@media (min-width: 901px) {
    .top-left { position: absolute; top: 30px; left: 30px; border-left: 10px solid #f0f; padding: 15px; }
    .top-right { position: absolute; top: 30px; right: 30px; border-right: 10px solid #0ff; padding: 15px; text-align: right; }
    .bottom-right { position: absolute; bottom: 30px; right: 30px; min-width: 250px; border-right: 10px solid #f0f; padding: 20px; text-align: right; }
    #score, #timer { font-size: 3rem; }
    .combo-text { font-size: 3.5rem; }
    #distance { top: 30%; font-size: 2rem; }
}

/* ============================================================
   5. MOBILE CONTROLS (FPS Layout Estabilizado)
   ============================================================ */
#mobile-interface {
    position: fixed;
    inset: 0;
    z-index: 9999; /* Garante que está acima do HUD */
    pointer-events: none; /* Deixa os toques passarem para os filhos */
}

@media (pointer: coarse) {
    #mobile-interface { display: block; }
}

/* Zonas de Toque: Definimos áreas fixas onde o dedo pode agir */
#joystick-move, #joystick-look {
    position: absolute;
    bottom: 20px;
    width: 150px;  /* Tamanho fixo para evitar bugs de cálculo */
    height: 150px;
    touch-action: none; 
    pointer-events: auto;
    -webkit-user-select: none;
    user-select: none;
    /* Debug opcional: background: rgba(255,0,0,0.1); */
}

#joystick-move { left: 30px; }
#joystick-look { right: 30px; }

#btn-jump {
    position: absolute;
    bottom: 180px; 
    right: 40px;
    width: 85px;
    height: 85px;
    
    /* Cores e Fundo Cyberpunk */
    background: radial-gradient(circle, rgba(255, 0, 255, 0.2) 0%, rgba(10, 0, 20, 0.8) 100%);
    border: 3px solid #ff00ff;
    border-radius: 50%;
    
    /* Texto e Ícone */
    color: #ff00ff;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Efeitos de Brilho (Glow) */
    box-shadow: 
        0 0 15px rgba(255, 0, 255, 0.5), 
        inset 0 0 15px rgba(255, 0, 255, 0.3);
    text-shadow: 0 0 8px #ff00ff;

    /* Interação e Funcionalidade */
    pointer-events: auto;
    z-index: 10000;
    touch-action: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    
    /* Transição Suave */
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Efeito Visual ao Clicar (Feedback) */
#btn-jump:active {
    transform: scale(0.85);
    background: rgba(255, 0, 255, 0.6);
    box-shadow: 0 0 30px #ff00ff;
    color: #fff;
}

/* Detalhe estético: Uma "mira" ou anel externo fino */
#btn-jump::after {
    content: '';
    position: absolute;
    inset: -8px;
    border: 1px solid rgba(255, 0, 255, 0.3);
    border-radius: 50%;
    pointer-events: none;
}

/* CRÍTICO: Estilos do NippleJS para forçar visibilidade e precisão */
.nipple {
    pointer-events: none !important; /* O toque deve ir para o container, não para o desenho */
}

.nipple .back {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}