/* =========================================
   CAPITALISTIC PIXEL WAR - STYLE.CSS (FINAL)
   ========================================= */

/* --- 1. VARIÁVEIS E CORES GLOBAIS --- */
:root {
    --bg-color: #050505;
    --panel-bg: rgba(10, 10, 10, 0.95);
    
    --text-main: #e0e0e0;
    --text-dim: #888888;
    
    /* Cores de Estado */
    --money-green: #00ff41;  /* Sucesso / Dinheiro */
    --hostile-red: #ff003c;  /* Perigo / Takeover */
    --border-color: #333;
    
    /* Efeitos */
    --shadow-green: 0 0 20px rgba(0, 255, 65, 0.2);
    --shadow-red: 0 0 30px rgba(255, 0, 60, 0.3);
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-color);
    /* Efeito de Grelha de Fundo */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    
    color: var(--text-main);
    font-family: 'Space Mono', monospace;
    margin: 0;
    padding-bottom: 120px; /* Espaço extra para o menu fixo não tapar conteúdo */
    overflow-x: hidden;
}

/* --- 2. CABEÇALHO --- */
header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--panel-bg);
    backdrop-filter: blur(5px);
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    margin: 0;
    letter-spacing: 2px;
}

h1 .money { color: var(--money-green); text-shadow: 0 0 10px rgba(0,255,65,0.4); }

.ticker {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 5px;
}
.ticker span { color: var(--money-green); animation: blink 2s infinite; }


/* --- 3. CANVAS (MOLDURA CENTRAL) --- */
.main-container {
    display: flex;
    justify-content: center;
    padding: 30px;
    overflow: auto; /* Permite scroll se o ecrã for pequeno */
}

canvas {
    background: #111;
    border: 1px solid #333;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    cursor: crosshair;
    image-rendering: pixelated; /* Mantém os pixeis nítidos */
}


/* --- 4. LEADERBOARD (Canto Superior Direito) --- */
#leaderboard {
    position: fixed;
    /* Aumentei para 130px para garantir que fica bem separado do topo */
    top: 130px; 
    right: 20px;
    width: 260px;
    
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--money-green);
    
    padding: 15px;
    
    /* Z-index 40 garante que fica acima do mapa, mas abaixo dos Modais (que são 200) */
    z-index: 40; 
    
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    border-radius: 4px;
}

#leaderboard h3 {
    margin: 0 0 10px 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: var(--money-green);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    text-transform: uppercase;
}

#leaderboardList {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8rem;
    max-height: 300px;
    overflow-y: auto;
}

#leaderboardList li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}


/* --- 5. UI FLUTUANTE (FIXA NO FUNDO - ESTILO TRANSLÚCIDO) --- */
.floating-ui {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    
    /* Fundo Vidro (Glassmorphism) */
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(10px);
    
    border: 1px solid var(--money-green);
    padding: 15px 30px;
    border-radius: 4px;
    
    display: none; /* Controlado pelo JS */
    
    /* Layout Horizontal (Lado a Lado) */
    flex-direction: row; 
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    
    z-index: 100;
    box-shadow: var(--shadow-green);
    min-width: 400px;
}

/* Estilo Hostil (Vermelho) */
.hostile-ui {
    border-color: var(--hostile-red);
    box-shadow: var(--shadow-red);
}

#infoText {
    font-size: 0.85rem;
    line-height: 1.5;
    text-transform: uppercase;
    text-align: left;
    color: #ccc;
    flex-grow: 1;
}

/* Botão da UI Principal */
#openModalBtn {
    background: var(--money-green);
    color: black;
    border: none;
    padding: 12px 20px;
    font-weight: bold;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    cursor: pointer;
    text-transform: uppercase;
    white-space: nowrap;
    transition: all 0.2s;
    min-width: 140px;
}

#openModalBtn:hover { transform: scale(1.05); box-shadow: 0 0 15px var(--money-green); }

/* Botão Hostil */
.hostile-btn {
    background: var(--hostile-red) !important;
    color: white !important;
    animation: pulse-red 1.5s infinite;
}
.hostile-btn:hover { box-shadow: 0 0 20px var(--hostile-red) !important; }


/* --- 6. TOOLTIP (HOVER INFO) --- */
#tooltip {
    display: none;
    position: fixed;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #666;
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none; /* CRÍTICO: Rato ignora a caixa */
    z-index: 1000;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8);
    line-height: 1.4;
}


/* --- 7. MODAIS (COMPRA E REGRAS) --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 200; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.85); 
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #0a0a0a;
    margin: 5% auto; 
    padding: 30px; 
    border: 1px solid var(--money-green);
    width: 90%; 
    max-width: 450px;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
    position: relative;
    max-height: 90vh; /* Para não sair do ecrã em portáteis pequenos */
    overflow-y: auto; /* Scroll se necessário */
}

/* Scrollbar Customizada para o Modal de Regras */
.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-track { background: #111; }
.modal-content::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

#modalTitle {
    font-family: 'Orbitron', sans-serif;
    margin-top: 0;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

#modalPriceDisplay {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: right;
    margin: 10px 0;
    padding-bottom: 10px;
    border-bottom: 1px dashed #333;
}

.close, .close-rules {
    color: #666;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close:hover, .close-rules:hover { color: white; }

/* Estilos de Formulário */
label {
    display: block;
    margin-top: 15px;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

input[type="text"], input[type="url"] {
    width: 100%;
    padding: 12px;
    margin-top: 5px;
    background: #151515;
    border: 1px solid #333;
    color: white;
    font-family: 'Space Mono', monospace;
    outline: none;
}
input:focus { border-color: var(--money-green); }

/* Caixa de Termos e Risco */
.terms-box {
    margin-top: 20px;
    background: rgba(255, 0, 60, 0.05);
    border-left: 3px solid var(--hostile-red);
    padding: 10px;
}

/* Botão de Pagar e Botão de Regras */
#payBtn, #closeRulesBtn {
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    background: var(--money-green);
    border: none;
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
    text-transform: uppercase;
    transition: opacity 0.3s;
}

/* Botão desativado (Segurança) */
#payBtn:disabled {
    background: #333 !important;
    color: #666 !important;
    cursor: not-allowed;
    opacity: 0.6;
}


/* --- 8. ANIMAÇÕES E UTILITÁRIOS --- */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 60, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 0, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 60, 0); }
}

/* Scrollbar da Página */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--money-green); }