:root {
    --bg: #0f172a;
    --accent: #fbbf24;
    --danger: #ff4444;
}

body { 
    margin: 0; 
    overflow: hidden; 
    font-family: 'Comic Neue', sans-serif;
    background: var(--bg); 
    color: white; 
    -webkit-user-select: none;
    user-select: none;
}

#game-canvas { 
    position: absolute; 
    inset: 0; 
    z-index: 1; 
    background: var(--bg); 
}

/* --- UI DURANTE EL JUEGO --- */
#counter { 
    position: absolute; 
    top: 8%; 
    width: 100%; 
    text-align: center;
    font-size: 5rem; 
    font-weight: 900; 
    color: var(--accent); 
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.3); 
    z-index: 10;
    pointer-events: none;
    transition: transform 0.1s ease;
}

#lives-display {
    position: absolute; 
    top: 20%; 
    width: 100%; 
    text-align: center;
    font-size: 1.5rem; 
    z-index: 10; 
    pointer-events: none;
}

/* --- PERSONAJE --- */
#player-img { 
    position: absolute; 
    bottom: 10px; 
    width: 180px; 
    height: 180px; 
    pointer-events: none; 
    z-index: 5; 
    display: none;
}

.mirrored { 
    transform: scaleX(-1); 
}

/* --- OVERLAYS --- */
.overlay {
    position: fixed; 
    inset: 0; 
    background: rgba(15, 23, 42, 1);
    display: flex; 
    flex-direction: column; 
    align-items: center;
    justify-content: center; 
    z-index: 200;
}

h1 { 
    font-size: 3.5rem; 
    color: var(--accent); 
    margin: 0; 
}

.main-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    -webkit-tap-highlight-color: transparent;
}

.main-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
}

.main-btn:active {
    transform: scale(0.9);
}

.sec-btn {
   background: rgba(255, 255, 255, 0.1);
   border: 1px solid rgba(255, 255, 255, 0.2);
   position: fixed;
   left: 20px;
   top: 30px;
   bottom: 20px;
   width: 56px;
   height: 56px;
   border-radius: 50%;
   color: white;
   transition: all 0.3s ease;
   box-shadow: 0 4px 10px rgba(0,0,0,0.3);
   cursor: pointer;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 24px;
   -webkit-tap-highlight-color: transparent;
}

.sec-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
}

.sec-btn:active {
    transform: scale(0.9);
}

/* Botón de Pausa en el juego */
#pause-trigger {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    font-size: 20px;
    cursor: pointer;
    z-index: 150;
    display: none; /* Se activa en JS */
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

#pause-trigger:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
}

#pause-trigger:active {
    transform: scale(0.9);
}

/* Menú de Pausa */
#pause-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 300;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#victory-screen {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.9); /* Azul muy oscuro */
    backdrop-filter: blur(10px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 400;
}

#menu-record {
    font-family: 'Comic Neue', sans-serif;
    font-weight: bold;
    color: #fbbf24; /* Un color amarillo/dorado para resaltar el récord */
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
    margin: 10px 0;
    font-size: 1.2rem;
    text-transform: uppercase;
}

.custom-select-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-btn-main {
    width: 50px;
    height: 50px;
    background: #334155;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border: 2px solid #475569;
    border-radius: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    -webkit-tap-highlight-color: transparent;
}

.lang-btn-main:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
}

.lang-btn-main:active {
    transform: scale(0.9);
}

.lang-dropdown {
    display: none; /* Oculto por defecto */
    position: absolute;
    top: 55px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 12px;
    overflow: hidden;
    min-width: 140px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    -webkit-tap-highlight-color: transparent;
}

.lang-dropdown.show {
    display: block; /* Se muestra al hacer clic */
}

.lang-option {
    padding: 12px 15px;
    color: white;
    cursor: pointer;
    font-family: sans-serif;
    transition: background 0.2s;
    border-bottom: 1px solid #334155;
    transition: all 0.3s ease;
}

.lang-option:last-child { border-bottom: none; }

.lang-option:hover {
    background: rgba(255, 68, 68, 0.2);
}

.lang-option:active {
    transform: scale(0.9);
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    -webkit-tap-highlight-color: transparent;
}

.back-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
}

.back-btn:active {
    transform: scale(0.9);
}