/* REGLAS GLOBALES & FUENTES */
html, body {
    margin: 0; padding: 0; height: 100%; width: 100%; overflow: hidden;
    background: #000;
    font-family: 'Share Tech Mono', Consolas, monospace;
    touch-action: none; user-select: none; -webkit-user-select: none; color: #eee;
}

h1, h2, h3, .label, .version, .menu-title {
    font-family: 'Orbitron', sans-serif; text-transform: uppercase;
}

.hidden { display: none !important; }
.hidden-fade { opacity: 0; pointer-events: none; }

/* ANIMACIONES HUD */
@keyframes flash-damage {
    0% { color: #fff; text-shadow: 0 0 5px #fff; }
    50% { color: #ff0033; text-shadow: 0 0 20px #ff0033, 0 0 10px #ff0000; transform: scale(1.2); }
    100% { color: #fff; transform: scale(1); }
}
@keyframes flash-heal {
    0% { color: #fff; text-shadow: 0 0 5px #fff; }
    50% { color: #00ff66; text-shadow: 0 0 20px #00ff66, 0 0 10px #00ff00; transform: scale(1.2); }
    100% { color: #fff; transform: scale(1); }
}
.anim-damage { animation: flash-damage 0.3s ease-out; }
.anim-heal { animation: flash-heal 0.3s ease-out; }

/* START SCREEN */
#start-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #000; background-size: cover; background-position: center;
    z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: background-image 0.5s ease-in;
}
.center-container {
    display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%;
}
#start-btn {
    width: 45vmin; max-width: 500px; min-width: 250px; cursor: pointer;
    transition: opacity 1s ease-in, transform 0.2s, filter 0.2s;
    filter: drop-shadow(0 0 30px rgba(0, 242, 255, 0.4)); margin-bottom: 40px;
}
#start-btn.loaded { opacity: 1; pointer-events: auto; }
#start-btn:active { transform: scale(0.95); }

#loading-container {
    width: 50vmin; max-width: 400px; height: 12px;
    background: transparent; border: 2px solid #004455; border-radius: 6px;
    overflow: hidden; box-shadow: 0 0 10px rgba(0, 242, 255, 0.2); padding: 2px;
}
#loading-bar {
    width: 0%; height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, #00f2ff, #0055ff);
    box-shadow: 0 0 15px #00f2ff; transition: width 0.2s linear;
}
.start-header-controls { position: absolute; top: 15px; right: 15px; display: flex; gap: 10px; z-index: 101; }
.header-icon-box {
    color: #00f2ff; font-size: 14px; cursor: pointer;
    border: 1px solid rgba(0, 242, 255, 0.3); width: 40px; height: 35px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; background: rgba(0, 20, 30, 0.6); transition: all 0.2s; font-weight: bold;
}
.header-icon-box:hover { background: rgba(0, 242, 255, 0.2); border-color: #00f2ff; box-shadow: 0 0 10px rgba(0, 242, 255, 0.3); }

/* HUD */
#game-ui { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
.top-bar { position: absolute; top: 5px; left: 10px; display: flex; gap: 20px; }
.stat-box { display: flex; flex-direction: column; }
.label { color: #00f2ff; font-size: 10px; letter-spacing: 1px; font-weight: 700; text-shadow: 1px 1px 0 #000; }
.value { font-size: 24px; font-weight: 400; line-height: 1; color: #fff; text-shadow: 0 0 5px rgba(0, 242, 255, 0.5); display: inline-block; }

#fps-display {
    position: absolute; top: 55px; right: 15px;
    font-size: 12px; color: #ffff00; font-weight: bold; text-shadow: 1px 1px 0 #000;
}

#minimap {
    position: absolute; top: 5px; right: calc(25% - 20px);
    border-radius: 50%; border: 2px solid rgba(0, 242, 255, 0.6);
    background: rgba(0, 10, 20, 0.6); box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
}
#menu-btn { 
    position: absolute; top: 15px; right: 15px; pointer-events: auto; cursor: pointer; 
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.8)); transition: transform 0.2s;
}
#menu-btn:hover { transform: scale(1.1); }

/* MENU */
#pause-menu { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 150; }

/* NUEVO v7.5: Barra Superior del Menú */
.menu-top-bar {
    position: absolute; top: 20px; left: 20px; 
    display: flex; gap: 20px; z-index: 160;
}

.pause-header-controls { position: absolute; top: 20px; right: 20px; display: flex; gap: 15px; z-index: 160; }
.pause-icon {
    font-family: 'Orbitron', sans-serif; font-weight: bold; font-size: 20px; color: #00f2ff;
    cursor: pointer; border: 1px solid #00f2ff; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.8); transition: all 0.2s; border-radius: 4px;
}
.pause-icon:hover { background: #00f2ff; color: #000; box-shadow: 0 0 15px #00f2ff; }
.close-x { font-size: 24px; border-color: #ff3333; color: #ff3333; }
.close-x:hover { background: #ff3333; color: #fff; box-shadow: 0 0 15px #ff3333; }

.menu-content {
    position: relative; width: 100%; height: 100%; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background-image: url('assets/mainmenu_background.png'); background-size: cover;
    background-position: center; background-color: #111; border: none; box-shadow: none;
}

.menu-action {
    display: block; width: 80%; max-width: 500px; padding: 20px; margin: 15px 0;
    background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(0, 242, 255, 0.3); border-left: 4px solid #00f2ff;
    color: #fff; font-family: 'Orbitron', sans-serif; font-size: 18px; cursor: pointer; 
    text-transform: uppercase; transition: all 0.2s; text-align: left; padding-left: 30px;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
}
.menu-action:hover { 
    background: rgba(0, 242, 255, 0.2); border-color: #00f2ff; border-left-color: #fff;
    transform: translateX(10px); box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
}
.version { position: absolute; bottom: 20px; width: 100%; text-align: center; font-size: 10px; color: rgba(255, 255, 255, 0.5); letter-spacing: 2px; }

/* --- WEAPONS MENU STYLES --- */
.menu-title {
    color: #fff; font-size: 24px; letter-spacing: 4px; margin-bottom: 5px;
    text-shadow: 0 0 10px #00f2ff;
}
/* Actualizado a Naranja Butano */
.menu-tp-info {
    color: #ff7700; font-family: 'Share Tech Mono', monospace; font-size: 16px; margin-bottom: 20px;
    text-shadow: 0 0 5px #ff7700;
}

#weapons-list-container {
    display: flex; flex-direction: column; gap: 20px;
    width: 90%; max-width: 600px; max-height: 60vh; overflow-y: auto; padding-right: 5px;
}
#weapons-list-container::-webkit-scrollbar { width: 6px; }
#weapons-list-container::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
#weapons-list-container::-webkit-scrollbar-thumb { background: #00f2ff; border-radius: 3px; }

.weapon-card {
    display: flex; flex-direction: column;
    background: rgba(0, 10, 20, 0.85); border: 1px solid #00f2ff;
    padding: 15px; border-radius: 4px; box-shadow: inset 0 0 20px rgba(0, 242, 255, 0.1);
    transition: all 0.3s ease;
}
.weapon-header { display: flex; align-items: center; width: 100%; }

.weapon-icon {
    width: 100px; height: 100px; margin-right: 20px; background: transparent;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.weapon-icon img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 10px rgba(0,0,0,0.8)); }

.weapon-info { 
    flex: 1; text-align: left; background: rgba(0, 0, 0, 0.4); padding: 10px; border-radius: 4px;
}
.weapon-name { color: #00f2ff; font-family: 'Orbitron', sans-serif; font-size: 18px; margin-bottom: 8px; font-weight: bold; }
.stat-row { 
    display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; 
    color: #ccc; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 2px;
}
.stat-val { color: #fff; font-family: 'Share Tech Mono', monospace; font-weight: bold; }
.stat-highlight { color: #00ff00; }

.btn-toggle-upgrades {
    margin-top: 10px; width: 100%; padding: 8px; font-size: 12px;
    background: rgba(0, 242, 255, 0.1); border: 1px solid #00f2ff; color: #00f2ff;
    cursor: pointer; text-transform: uppercase; font-family: 'Orbitron', sans-serif;
    transition: all 0.2s;
}
.btn-toggle-upgrades:hover { background: #00f2ff; color: #000; }

.upgrades-panel {
    width: 100%; margin-top: 15px; padding-top: 10px;
    border-top: 1px solid #00f2ff;
    display: none; flex-direction: column; gap: 10px;
    animation: fadeIn 0.3s ease-out;
}
.weapon-card.expanded .upgrades-panel { display: flex; }

.upgrade-row {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(0, 0, 0, 0.5); padding: 8px; border-radius: 4px;
}
.upgrade-info { text-align: left; font-size: 12px; color: #ccc; }

/* Color Naranja Butano para upgrades */
.upgrade-title { color: #ff7700; font-weight: bold; margin-bottom: 2px; display: block; }
.upgrade-val-change { color: #00ff00; font-size: 10px; }

.btn-buy-upgrade {
    background: transparent; border: 1px solid #ff7700; color: #ff7700;
    padding: 5px 10px; cursor: pointer; font-family: 'Share Tech Mono', monospace;
    font-size: 11px; min-width: 80px; transition: all 0.2s;
}
.btn-buy-upgrade:hover:not(:disabled) { background: #ff7700; color: #fff; }
.btn-buy-upgrade:disabled { border-color: #555; color: #555; cursor: not-allowed; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.back-btn { margin-top: 30px; border-left: 4px solid #ff3333; }
.back-btn:hover { border-color: #ff3333; background: rgba(255, 51, 51, 0.2); }

@media (max-height: 500px) {
    .menu-content { justify-content: center; padding-top: 20px; }
    .menu-action { padding: 10px; margin: 8px 0; font-size: 14px; width: 60%; border-left-width: 3px; }
    .version { bottom: 5px; font-size: 8px; }
    .pause-header-controls { top: 10px; right: 10px; }
    .pause-icon { width: 30px; height: 30px; font-size: 16px; }
    .weapon-card { padding: 10px; }
    .weapon-icon { width: 60px; height: 60px; } 
    .weapon-name { font-size: 14px; }
    #fps-display { top: 45px; right: 10px; }
    
    /* Ajuste de barra superior en móvil */
    .menu-top-bar { top: 10px; left: 10px; transform: scale(0.8); transform-origin: top left; }
}

/* SHELL */
#debug-shell {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: rgba(5, 5, 5, 0.98); border-top: 1px solid #00ff00; z-index: 200;
    font-family: 'Share Tech Mono', monospace; display: flex; flex-direction: column;
    transition: height 0.2s ease-out;
}
.shell-half { height: 40%; }
.shell-single { height: 80px; }
.shell-header {
    background: #002200; color: #00ff00; padding: 5px 10px; font-size: 12px;
    display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #004400; flex-shrink: 0;
}
.shell-controls span { cursor: pointer; padding: 0 10px; font-weight: bold; font-size: 14px; }
.shell-controls span:hover { color: #fff; text-shadow: 0 0 5px #fff; }
#shell-content {
    flex: 1; overflow-y: auto; padding: 10px; color: #00ff00; font-size: 13px;
    line-height: 1.4; text-shadow: 0 0 2px rgba(0, 255, 0, 0.3);
}
.shell-single #shell-content { overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
#shell-content::-webkit-scrollbar { width: 6px; }
#shell-content::-webkit-scrollbar-thumb { background: #005500; }
canvas#c { background: #000; display: block; }