@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

:root {
    --red: #ff2244;
    --cyan: #00ffff;
    --dark: #050508;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(5, 5, 8, 0.8);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--cyan), var(--red));
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--red), var(--cyan));
    box-shadow: 0 0 15px rgba(255, 34, 68, 0.7);
}

::-webkit-scrollbar-corner {
    background: var(--dark);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--cyan) rgba(5, 5, 8, 0.8);
}

html {
    font-size: 16px;
}

body { 
    overflow: hidden; 
    background: var(--dark); 
    font-family: 'Orbitron', monospace;
}

canvas { 
    display: block; 
    cursor: url('assets/invisible.png'), auto;
}

body.playing {
    cursor: url('assets/invisible.png'), auto;
}

/* --- MENÚ PRINCIPAL --- */
#mainMenu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #050508 0%, #0a0a15 50%, #050508 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 5vh 5vw;
}

#mainMenu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,34,68,0.03) 2px, rgba(255,34,68,0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,255,255,0.02) 2px, rgba(0,255,255,0.02) 4px);
    pointer-events: none;
}

.menu-title {
    font-size: clamp(2rem, 8vw, 4.5rem);
    font-weight: 900;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: clamp(5px, 2vw, 15px);
    text-shadow: 
        0 0 10px var(--red),
        0 0 30px var(--red),
        0 0 60px #ff0033,
        0 0 100px #ff0033,
        4px 4px 0 var(--cyan);
    animation: glitch 3s infinite;
    position: relative;
    z-index: 1;
    text-align: center;
}

.menu-subtitle {
    font-size: clamp(0.6rem, 2vw, 1rem);
    color: var(--cyan);
    letter-spacing: clamp(3px, 1vw, 8px);
    margin-top: 1vh;
    text-shadow: 0 0 10px var(--cyan);
    opacity: 0.8;
    text-align: center;
    padding: 0 10px;
}

@keyframes glitch {
    0%, 90%, 100% { transform: translate(0); }
    92% { transform: translate(-3px, 1px); }
    94% { transform: translate(3px, -1px); }
    96% { transform: translate(-2px, -1px); }
    98% { transform: translate(2px, 1px); }
}

.menu-buttons {
    margin-top: clamp(30px, 6vh, 60px);
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 2vh, 20px);
    z-index: 1;
}

.menu-btn {
    padding: clamp(14px, 2.5vh, 20px) clamp(35px, 6vw, 70px);
    font-family: 'Orbitron', monospace;
    font-size: clamp(0.8rem, 2vw, 1.1rem);
    font-weight: 700;
    letter-spacing: clamp(2px, 0.5vw, 4px);
    text-transform: uppercase;
    border: 2px solid var(--red);
    background: transparent;
    color: var(--red);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,34,68,0.3), transparent);
    transition: left 0.5s ease;
}

.menu-btn:hover {
    background: var(--red);
    color: var(--dark);
    box-shadow: 0 0 30px rgba(255,34,68,0.5);
    transform: scale(1.05);
}

.menu-btn:hover::before {
    left: 100%;
}

.menu-btn.secondary {
    border-color: var(--cyan);
    color: var(--cyan);
}

.menu-btn.secondary:hover {
    background: var(--cyan);
    color: var(--dark);
    box-shadow: 0 0 30px rgba(0,255,255,0.5);
}


/* --- PANTALLA DE TUTORIAL --- */
#tutorialScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5,5,8,0.98);
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    z-index: 100;
    padding: clamp(15px, 3vh, 30px) clamp(10px, 3vw, 20px);
    overflow-y: auto;
}

.tutorial-container {
    max-width: min(700px, 95vw);
    width: 100%;
    text-align: center;
    margin-top: clamp(10px, 2vh, 20px);
}

.tutorial-title {
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: 900;
    color: var(--cyan);
    letter-spacing: clamp(3px, 1vw, 8px);
    margin-bottom: clamp(15px, 3vh, 25px);
    text-shadow: 0 0 20px var(--cyan);
}

.mechanic-box {
    background: rgba(255,34,68,0.1);
    border: 1px solid rgba(255,34,68,0.3);
    border-radius: 10px;
    padding: clamp(15px, 2vh, 20px) clamp(15px, 3vw, 25px);
    margin-bottom: clamp(15px, 2vh, 20px);
    text-align: left;
}

.mechanic-title {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: var(--red);
    margin-bottom: clamp(8px, 1.5vh, 12px);
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 12px);
}

.mechanic-icon {
    width: clamp(30px, 5vw, 40px);
    height: clamp(30px, 5vw, 40px);
    min-width: clamp(30px, 5vw, 40px);
    background: var(--red);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(14px, 2.5vw, 20px);
    box-shadow: 0 0 15px rgba(255,34,68,0.5);
}

.mechanic-desc {
    color: #aaa;
    font-size: clamp(0.7rem, 1.8vw, 0.85rem);
    line-height: 1.7;
    letter-spacing: 0.5px;
}

.mechanic-desc strong {
    color: var(--cyan);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(10px, 2vw, 15px);
    margin-top: clamp(15px, 2vh, 20px);
}

.control-item {
    background: rgba(0,255,255,0.05);
    border: 1px solid rgba(0,255,255,0.2);
    border-radius: 8px;
    padding: clamp(10px, 1.5vh, 15px);
    text-align: center;
}

.control-key {
    display: inline-block;
    background: var(--cyan);
    color: var(--dark);
    padding: clamp(5px, 1vh, 8px) clamp(10px, 2vw, 16px);
    border-radius: 5px;
    font-weight: 700;
    font-size: clamp(0.65rem, 1.8vw, 0.9rem);
    margin-bottom: clamp(5px, 1vh, 8px);
    box-shadow: 0 3px 0 #008888;
}

.control-action {
    color: #888;
    font-size: clamp(0.55rem, 1.4vw, 0.7rem);
    letter-spacing: 2px;
}

.tutorial-buttons {
    display: flex;
    justify-content: center;
    gap: clamp(10px, 2vw, 20px);
    margin-top: clamp(20px, 3vh, 25px);
    flex-wrap: wrap;
}

/* --- HUD DEL JUEGO --- */
#gameHUD {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
    z-index: 10;
}

#ui {
    position: absolute; 
    top: clamp(15px, 3vh, 25px); 
    left: 50%;
    transform: translateX(-50%);
    color: var(--red); 
    font-weight: 900; 
    font-size: clamp(1rem, 3vw, 1.75rem); 
    letter-spacing: clamp(5px, 1.5vw, 10px);
    text-shadow: 
        0 0 10px var(--red),
        0 0 20px var(--red);
    opacity: 0.8;
    white-space: nowrap;
}

#score {
    position: absolute;
    top: clamp(20px, 3vh, 30px);
    right: clamp(20px, 3vw, 40px);
    color: var(--cyan);
    font-size: clamp(0.7rem, 2vw, 1.25rem);
    letter-spacing: 3px;
    text-shadow: 0 0 10px var(--cyan);
    text-align: right;
}

#level {
    position: absolute;
    top: clamp(20px, 3vh, 30px);
    left: clamp(20px, 3vw, 40px);
    color: var(--red);
    font-size: clamp(0.7rem, 2vw, 1.25rem);
    letter-spacing: 3px;
    text-shadow: 0 0 10px var(--red);
    text-align: left;
}

#levelValue {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 900;
}

#scoreValue {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 900;
}

#ammoDisplay {
    position: absolute;
    top: clamp(80px, 10vh, 100px);
    right: clamp(20px, 3vw, 40px);
    color: #ff8800;
    font-size: clamp(0.6rem, 1.5vw, 1rem);
    letter-spacing: 2px;
    text-shadow: 0 0 10px #ff8800;
    text-align: right;
}

#ammoValue {
    font-size: clamp(1.2rem, 3vw, 1.75rem);
    font-weight: 900;
}

#reloadIndicator {
    font-size: clamp(0.5rem, 1.2vw, 0.75rem);
    color: #ff4444;
    text-shadow: 0 0 10px #ff4444;
    opacity: 0;
    animation: none;
}

#reloadIndicator.active {
    opacity: 1;
    animation: blink 0.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#timeIndicator {
    position: absolute;
    bottom: clamp(20px, 4vh, 40px);
    left: 50%;
    transform: translateX(-50%);
    padding: clamp(8px, 1.5vh, 12px) clamp(15px, 3vw, 30px);
    background: rgba(255,34,68,0.2);
    border: 1px solid rgba(255,34,68,0.5);
    border-radius: 30px;
    color: var(--red);
    font-size: clamp(0.6rem, 1.5vw, 0.9rem);
    letter-spacing: clamp(2px, 0.5vw, 4px);
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

#timeIndicator.active {
    opacity: 1;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255,34,68,0.3); }
    50% { box-shadow: 0 0 40px rgba(255,34,68,0.6); }
}

/* Bordes decorativos */
.hud-corner {
    position: absolute;
    width: clamp(40px, 8vw, 80px);
    height: clamp(40px, 8vw, 80px);
    border: 2px solid rgba(0,255,255,0.3);
}

.hud-corner.tl { top: clamp(10px, 2vh, 20px); left: clamp(10px, 2vw, 20px); border-right: none; border-bottom: none; }
.hud-corner.tr { top: clamp(10px, 2vh, 20px); right: clamp(10px, 2vw, 20px); border-left: none; border-bottom: none; }
.hud-corner.bl { bottom: clamp(10px, 2vh, 20px); left: clamp(10px, 2vw, 20px); border-right: none; border-top: none; }
.hud-corner.br { bottom: clamp(10px, 2vh, 20px); right: clamp(10px, 2vw, 20px); border-left: none; border-top: none; }


/* --- GAME OVER --- */
#gameOverScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5,5,8,0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 5vh 5vw;
}

.gameover-title {
    font-size: clamp(2rem, 10vw, 5rem);
    font-weight: 900;
    color: var(--red);
    letter-spacing: clamp(5px, 2vw, 15px);
    text-shadow: 
        0 0 20px var(--red),
        0 0 40px var(--red),
        0 0 80px #ff0033;
    animation: glitch 0.5s infinite;
    text-align: center;
}

.gameover-stats {
    margin-top: clamp(20px, 4vh, 40px);
    text-align: center;
}

.stat-label {
    color: #666;
    font-size: clamp(0.7rem, 1.8vw, 0.9rem);
    letter-spacing: clamp(2px, 0.5vw, 4px);
}

.stat-value {
    color: var(--cyan);
    font-size: clamp(2.5rem, 8vw, 3.75rem);
    font-weight: 900;
    text-shadow: 0 0 20px var(--cyan);
}

.stat-value.coins-earned {
    color: #ffd700;
    font-size: clamp(1.5rem, 5vw, 2rem);
    text-shadow: 0 0 20px #ffd700;
}

.gameover-buttons {
    display: flex;
    gap: clamp(10px, 2vw, 20px);
    margin-top: clamp(30px, 5vh, 50px);
    flex-wrap: wrap;
    justify-content: center;
}

/* --- MONEDAS EN MENÚ --- */
.menu-coins {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: #ffd700;
    margin-top: 20px;
    text-shadow: 0 0 10px #ffd700;
    z-index: 1;
}

/* --- TIENDA --- */
#shopScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #050508 0%, #0a0a15 50%, #050508 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 100;
    padding: clamp(20px, 4vh, 40px) clamp(15px, 3vw, 30px);
    overflow-y: auto;
}

.shop-title {
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: 900;
    color: var(--cyan);
    letter-spacing: clamp(3px, 1vw, 8px);
    margin-bottom: 10px;
    text-shadow: 0 0 20px var(--cyan);
}

.shop-coins {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: #ffd700;
    margin-bottom: 20px;
    text-shadow: 0 0 15px #ffd700;
}

.crosshairs-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 650px;
    margin-bottom: 30px;
}

.crosshair-item {
    background: rgba(0,255,255,0.05);
    border: 2px solid rgba(0,255,255,0.2);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.crosshair-item:hover {
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgba(0,255,255,0.3);
    transform: scale(1.05);
}

.crosshair-item.owned {
    border-color: #00ff00;
    background: rgba(0,255,0,0.1);
}

.crosshair-item.selected {
    border-color: #ffd700;
    background: rgba(255,215,0,0.15);
    box-shadow: 0 0 25px rgba(255,215,0,0.4);
}

.crosshair-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 10px;
}

.crosshair-price {
    font-size: 0.8rem;
    color: #ffd700;
}

.crosshair-status {
    font-size: 0.7rem;
    color: #00ff00;
    letter-spacing: 1px;
}

/* --- MONEDAS EN HUD --- */
#coins {
    position: absolute;
    top: clamp(70px, 10vh, 90px);
    left: clamp(20px, 3vw, 40px);
    color: #ffd700;
    font-size: clamp(0.6rem, 1.5vw, 0.9rem);
    letter-spacing: 2px;
    text-shadow: 0 0 10px #ffd700;
    text-align: left;
}

#coinsValue {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    font-weight: 900;
}

.menu-btn.shop {
    border-color: #ffd700;
    color: #ffd700;
}

.menu-btn.shop:hover {
    background: #ffd700;
    color: var(--dark);
    box-shadow: 0 0 30px rgba(255,215,0,0.5);
}

/* --- TIENDA MEJORADA --- */
.owned-count {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.crate-btn {
    font-size: clamp(0.9rem, 2vw, 1.1rem) !important;
    padding: clamp(14px, 2.5vh, 20px) clamp(30px, 6vw, 60px) !important;
    border-color: #ffd700 !important;
    color: #ffd700 !important;
    margin-bottom: 30px;
    animation: crateGlow 2s infinite;
    min-height: 55px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.crate-btn:hover {
    background: #ffd700 !important;
    color: var(--dark) !important;
}

@keyframes crateGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(255,215,0,0.3); }
    50% { box-shadow: 0 0 40px rgba(255,215,0,0.6), 0 0 60px rgba(255,215,0,0.3); }
}

.my-crosshairs {
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
}

.my-crosshairs h3 {
    color: var(--cyan);
    font-size: 0.9rem;
    letter-spacing: 3px;
    margin-bottom: 15px;
}

/* --- RULETA --- */
#crateScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.roulette-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    height: 120px;
    overflow: hidden;
    border: 3px solid var(--cyan);
    border-radius: 10px;
    background: rgba(0,0,0,0.8);
}

.roulette-marker {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: #ffd700;
    z-index: 10;
    box-shadow: 0 0 20px #ffd700;
}

.roulette-marker::before,
.roulette-marker::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
}

.roulette-marker::before {
    top: -5px;
    border-top-color: #ffd700;
}

.roulette-marker::after {
    bottom: -5px;
    border-bottom-color: #ffd700;
}

.roulette-strip {
    display: flex;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: left 4s cubic-bezier(0.15, 0.85, 0.3, 1);
}

.roulette-item {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-right: 2px solid rgba(0,255,255,0.3);
}

.roulette-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

#crateResult {
    margin-top: 30px;
    font-size: 1.5rem;
    color: #ffd700;
    text-shadow: 0 0 20px #ffd700;
    opacity: 0;
    transition: opacity 0.5s;
}

#crateResult.show {
    opacity: 1;
}

/* Ruleta Naves */
#shipCrateScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#shipCrateResult {
    margin-top: 30px;
    font-size: 1.5rem;
    color: #ffd700;
    text-shadow: 0 0 20px #ffd700;
    opacity: 0;
    transition: opacity 0.5s;
}

#shipCrateResult.show {
    opacity: 1;
}

/* Ruleta de Colores */
#colorCrateScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.color-roulette-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    height: 120px;
    overflow: hidden;
    border: 3px solid var(--cyan);
    border-radius: 10px;
    background: rgba(0,0,0,0.8);
}

.color-roulette-marker {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: #ffd700;
    z-index: 10;
    box-shadow: 0 0 20px #ffd700;
}

.color-roulette-marker::before,
.color-roulette-marker::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
}

.color-roulette-marker::before {
    top: -5px;
    border-top-color: #ffd700;
}

.color-roulette-marker::after {
    bottom: -5px;
    border-bottom-color: #ffd700;
}

.color-roulette-strip {
    display: flex;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: left 4s cubic-bezier(0.15, 0.85, 0.3, 1);
}

.color-roulette-item {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-right: 2px solid rgba(255,255,255,0.2);
}

.color-roulette-item .color-preview {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    box-shadow: 0 0 15px currentColor;
}

#colorCrateResult {
    margin-top: 30px;
    font-size: 1.5rem;
    color: #ffd700;
    text-shadow: 0 0 20px #ffd700;
    opacity: 0;
    transition: opacity 0.5s;
}

#colorCrateResult.show {
    opacity: 1;
}

.crosshair-item.locked {
    opacity: 0.3;
    pointer-events: none;
}

.crosshair-item.locked img {
    filter: brightness(0.3);
}

/* --- TABS DE TIENDA --- */
.shop-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.shop-tab {
    padding: 12px 25px;
    font-family: 'Orbitron', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    border: 2px solid #444;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-tab:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.shop-tab.active {
    border-color: var(--cyan);
    background: var(--cyan);
    color: var(--dark);
}

.shop-tab-content {
    width: 100%;
    max-width: 700px;
    max-height: 50vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

#skinsTab, #colorsTab {
    max-height: 50vh;
    overflow-y: auto;
}

#skinsTab, #colorsTab {
    padding: 10px 0;
}

/* --- SKINS --- */
.skins-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 650px;
    margin: 0 auto 30px auto;
}

.skin-item {
    background: rgba(0,255,255,0.05);
    border: 2px solid rgba(0,255,255,0.2);
    border-radius: 10px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1;
    min-height: 100px;
}

.skin-item:hover {
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgba(0,255,255,0.3);
    transform: scale(1.05);
}

.skin-item.selected {
    box-shadow: 0 0 25px;
    transform: scale(1.05);
}

.skin-preview {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
    position: relative;
}

.skin-preview svg {
    width: 100%;
    height: 100%;
}

.skin-name {
    font-size: 0.7rem;
    letter-spacing: 1px;
    margin-bottom: 5px;
    text-align: center;
    word-break: break-word;
}

.skin-status {
    font-size: 0.6rem;
    color: #00ff00;
    letter-spacing: 1px;
}

.skins-section-title {
    grid-column: 1 / -1;
    color: #888;
    font-size: 0.8rem;
    letter-spacing: 3px;
    padding: 15px 0 5px 0;
    border-bottom: 1px solid #333;
    margin-bottom: 5px;
}

/* --- CURSOR PERSONALIZADO --- */
#customCursor {
    position: fixed;
    width: clamp(20px, 3vw, 30px);
    height: clamp(20px, 3vw, 30px);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

#customCursor.visible {
    opacity: 1;
}

#customCursor::before,
#customCursor::after {
    content: '';
    position: absolute;
    background: var(--red);
}

#customCursor::before {
    width: 2px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

#customCursor::after {
    width: 100%;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
}

#customCursor .cursor-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--red);
    border-radius: 50%;
    animation: cursorPulse 1s infinite;
}

@keyframes cursorPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.5; }
}

/* --- EFECTOS DE PANTALLA --- */
.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--red);
    pointer-events: none;
    opacity: 0;
    z-index: 50;
}

.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.6) 100%);
    pointer-events: none;
    z-index: 5;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.1) 2px,
        rgba(0,0,0,0.1) 4px
    );
    pointer-events: none;
    z-index: 6;
}

/* --- MEDIA QUERIES PARA MÓVILES --- */
@media (max-width: 600px) {
    .controls-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .mechanic-desc br {
        display: none;
    }
    
    .menu-btn {
        width: 100%;
        text-align: center;
    }
    
    .tutorial-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .tutorial-buttons .menu-btn {
        width: 100%;
    }
}

@media (max-height: 500px) {
    #tutorialScreen {
        justify-content: flex-start;
        padding-top: 10px;
    }
    
    .tutorial-title {
        margin-bottom: 10px;
    }
    
    .mechanic-box {
        padding: 10px 15px;
        margin-bottom: 10px;
    }
}

/* Pantallas muy grandes */
@media (min-width: 1800px) {
    html {
        font-size: 18px;
    }
}

@media (min-width: 2400px) {
    html {
        font-size: 20px;
    }
}


/* Mensaje de monedas insuficientes */
.not-enough-coins-msg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 34, 68, 0.9);
    color: #fff;
    padding: 20px 40px;
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 3px;
    border: 2px solid #ff2244;
    box-shadow: 0 0 30px rgba(255, 34, 68, 0.5);
    z-index: 300;
    animation: shakeError 0.5s ease;
}

.not-enough-coins-msg.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

@keyframes shakeError {
    0%, 100% { transform: translate(-50%, -50%); }
    20% { transform: translate(-52%, -50%); }
    40% { transform: translate(-48%, -50%); }
    60% { transform: translate(-51%, -50%); }
    80% { transform: translate(-49%, -50%); }
}


/* ========================================
   CONTROLES MÓVILES
   ======================================== */

#mobileControls {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

#mobileControls.active {
    display: block;
}

/* Joystick - REEMPLAZADO POR D-PAD */
#joystickContainer {
    display: none;
}

/* Controles de Movimiento (izquierda) - Arriba/Abajo */
#movementControls {
    position: fixed;
    bottom: 30px;
    left: 20px;
    width: 70px;
    height: 160px;
    pointer-events: none;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

/* Controles de Rotacion (derecha, arriba del disparo) */
#rotationControls {
    position: fixed;
    bottom: 170px;
    right: 15px;
    width: 160px;
    height: 70px;
    pointer-events: none;
    z-index: 1000;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.control-btn {
    width: 65px;
    height: 65px;
    background: rgba(0, 255, 255, 0.4);
    border: 3px solid rgba(0, 255, 255, 0.9);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    pointer-events: auto;
    touch-action: none;
    transition: all 0.1s ease;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.control-btn:active, .control-btn.pressed {
    background: rgba(0, 255, 255, 0.6);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.8);
    transform: scale(0.92);
}

/* Botones de movimiento - color rojo cuando presionados */
.move-btn.pressed {
    background: rgba(255, 34, 68, 0.5);
    border-color: #ff2244;
    box-shadow: 0 0 25px rgba(255, 34, 68, 0.7);
    color: #ff2244;
    text-shadow: 0 0 10px #ff2244;
}

/* Botones de rotacion - color amarillo cuando presionados */
.rotate-btn.pressed {
    background: rgba(255, 200, 0, 0.5);
    border-color: #ffc800;
    box-shadow: 0 0 25px rgba(255, 200, 0, 0.7);
    color: #ffc800;
    text-shadow: 0 0 10px #ffc800;
}

/* Boton de disparo */
#fireButton {
    position: fixed;
    bottom: 50px;
    right: 30px;
    width: 100px;
    height: 100px;
    background: rgba(255, 34, 68, 0.3);
    border: 3px solid rgba(255, 34, 68, 0.8);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    touch-action: none;
    box-shadow: 0 0 25px rgba(255, 34, 68, 0.5);
    transition: all 0.15s ease;
    z-index: 1000;
}

#fireButton span {
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--red);
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--red);
}

#fireButton:active, #fireButton.pressed {
    background: rgba(255, 34, 68, 0.4);
    border-color: var(--red);
    box-shadow: 0 0 40px rgba(255, 34, 68, 0.6);
    transform: scale(0.95);
}

#fireButton.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Indicador de tiempo móvil */
#mobileTimeIndicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 25px;
    background: rgba(255, 34, 68, 0.2);
    border: 1px solid rgba(255, 34, 68, 0.5);
    border-radius: 30px;
    color: var(--red);
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    letter-spacing: 3px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#mobileTimeIndicator.active {
    opacity: 1;
    animation: pulse 1s infinite;
}

/* Ajustes para móviles */
@media (max-width: 768px), (pointer: coarse) {
    /* Mostrar controles moviles */
    #mobileControls.active #movementControls,
    #mobileControls.active #rotationControls,
    #mobileControls.active #fireButton {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Ocultar cursor personalizado en móviles */
    #customCursor {
        display: none !important;
    }
    
    /* Ajustar HUD para móviles */
    #ui {
        font-size: clamp(0.8rem, 4vw, 1.2rem);
        letter-spacing: 3px;
    }
    
    #score, #level, #coins, #ammoDisplay {
        font-size: clamp(0.6rem, 2vw, 0.8rem);
    }
    
    #scoreValue, #levelValue {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
    }
    
    #coinsValue, #ammoValue {
        font-size: clamp(0.9rem, 3vw, 1.2rem);
    }
    
    /* Ocultar indicador de tiempo desktop en móvil */
    #timeIndicator {
        display: none !important;
    }
    
    /* Ajustar esquinas del HUD */
    .hud-corner {
        width: 30px;
        height: 30px;
    }
    
    /* Ajustar posiciones del HUD para no interferir con controles */
    #score {
        top: 15px;
        right: 15px;
    }
    
    #level {
        top: 15px;
        left: 15px;
    }
    
    #coins {
        top: 60px;
        left: 15px;
    }
    
    #ammoDisplay {
        top: 60px;
        right: 15px;
    }
    
    /* Ajustar menú para móviles */
    .menu-title {
        font-size: clamp(1.5rem, 8vw, 3rem);
        letter-spacing: 5px;
    }
    
    .menu-subtitle {
        font-size: clamp(0.5rem, 2.5vw, 0.8rem);
        letter-spacing: 2px;
        padding: 0 20px;
    }
    
    .menu-btn {
        padding: 15px 40px;
        font-size: 0.9rem;
        min-width: 200px;
    }
    
    /* Ajustar tienda para móviles */
    .crosshairs-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .crosshair-item {
        padding: 10px;
    }
    
    .crosshair-item img {
        width: 40px;
        height: 40px;
    }
    
    /* Ajustar game over para movil */
    #gameOverScreen {
        padding: 20px 15px;
        overflow-y: auto;
        box-sizing: border-box;
    }
    
    .gameover-title {
        font-size: clamp(1.2rem, 8vw, 2rem);
        letter-spacing: 3px;
        margin-bottom: 10px;
    }
    
    .gameover-stats {
        margin-top: 15px;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .stat-value {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
    }
    
    .stat-value.coins-earned {
        font-size: clamp(1rem, 4vw, 1.5rem);
    }
    
    .gameover-buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
        width: 100%;
        max-width: 250px;
    }
    
    .gameover-buttons .menu-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 0.8rem;
    }
    
    /* Tutorial movil */
    .controls-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mechanic-desc {
        font-size: 0.7rem;
    }
}

/* Pantallas muy pequenas */
@media (max-width: 400px) {
    #movementControls {
        bottom: 20px;
        left: 15px;
        width: 55px;
        height: 130px;
    }
    
    #rotationControls {
        bottom: 130px;
        right: 10px;
        width: 130px;
        height: 55px;
    }
    
    .control-btn {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
    }
    
    #fireButton {
        width: 75px;
        height: 75px;
        bottom: 35px;
        right: 15px;
    }
    
    #fireButton span {
        font-size: 0.6rem;
    }
    
    .crosshairs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Landscape en moviles */
@media (max-height: 500px) and (orientation: landscape) {
    #movementControls {
        bottom: 10px;
        left: 10px;
        width: 50px;
        height: 110px;
    }
    
    #rotationControls {
        bottom: 90px;
        right: 10px;
        width: 110px;
        height: 50px;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    #fireButton {
        bottom: 10px;
        right: 15px;
        width: 65px;
        height: 65px;
    }
    
    #mobileTimeIndicator {
        top: 30%;
        font-size: 0.65rem;
    }
    
    #ui {
        top: 10px;
        font-size: 0.9rem;
    }
    
    #score, #level {
        top: 10px;
    }
    
    #coins, #ammoDisplay {
        top: 45px;
    }
}

/* Prevenir selección de texto en móviles */
@media (pointer: coarse) {
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }
    
    body {
        touch-action: manipulation;
        overscroll-behavior: none;
    }
    
    canvas {
        touch-action: none;
    }
}


/* Mostrar/ocultar controles según dispositivo */
.mobile-controls {
    display: none !important;
}

.desktop-controls {
    display: grid !important;
}

@media (pointer: coarse), (max-width: 768px) {
    .mobile-controls {
        display: grid !important;
    }
    
    .desktop-controls {
        display: none !important;
    }
}
