/** * JUEPLO v39.0 - Hoja de Estilos Maestra
 * TODO EN UNO: Base, Header, Juego, Perfil, Estadísticas y Clasificación
 * NOVEDAD: Scrollbar invisible (Estilo App)
 */

:root {
    --primary: #2d5a27;
    --primary-dark: #1e3d1a;
    --accent: #d9534f;
    --accent-dark: #a94442;
    --orange: #e67e22;
    --gold: #f1c40f;
    --gold-dark: #c7a008;
    --bg: #f9f8f2;
    --white: #ffffff;
    --text-main: #333333;
    --shadow-soft: 0 10px 30px rgba(0,0,0,0.05);
}

/* --- 1. RESET, BASES Y SCROLL INVISIBLE --- */
* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
    margin: 0; 
    padding: 0; 
    /* Ocultar barra de scroll en Firefox */
    scrollbar-width: none; 
    /* Ocultar barra de scroll en IE y Edge antiguo */
    -ms-overflow-style: none; 
}

/* Ocultar barra de scroll en Chrome, Safari y Opera */
*::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
}

html, body { 
    height: 100%; 
    width: 100%; 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg); 
    color: var(--text-main);
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
}

/* --- 2. HEADER (NAVBAR) --- */
.navbar { 
    background: var(--white); 
    padding: 0 1.2rem; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    height: 75px; 
    display: flex; 
    align-items: center; 
}

.nav-content { 
    max-width: 1100px; 
    margin: 0 auto; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    width: 100%; 
}

.logo-text { 
    font-family: 'Crimson Pro', serif; 
    font-weight: 900; 
    font-size: 1.7rem; 
    color: var(--primary); 
    letter-spacing: -0.5px; 
}

/* Botones Píldora del Header */
.nav-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
    padding: 0 15px;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s;
    user-select: none;
}

.nav-pill:active { 
    transform: translateY(2px); 
    box-shadow: none !important; 
}

.pill-gold { background: var(--gold); color: #333; box-shadow: 0 4px 0 var(--gold-dark); min-width: 70px; }
.pill-green { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
.pill-user { background: #555; color: #fff; box-shadow: 0 4px 0 #222; }
.pill-admin { background: var(--accent); color: #fff; box-shadow: 0 4px 0 var(--accent-dark); }

/* Avatar circular centrado */
.avatar-circle {
    background: #fff;
    color: var(--primary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 900;
    line-height: 1;
}

/* --- 3. ESTRUCTURA PRINCIPAL --- */
.main-wrapper { 
    flex: 1; 
    overflow-y: auto; 
    padding: 1.5rem 1rem; 
    width: 100%; 
    max-width: 600px; 
    margin: 0 auto; 
    -webkit-overflow-scrolling: touch; 
}

.view-section { 
    display: none; 
    width: 100%; 
    flex-direction: column; 
    align-items: center; 
}

.view-section.active { 
    display: flex !important; 
}

.card { 
    background: var(--white); 
    width: 100%; 
    padding: 2rem; 
    border-radius: 35px; 
    box-shadow: var(--shadow-soft); 
    margin-bottom: 1.5rem; 
    text-align: center; 
    animation: fadeIn 0.4s ease-out;
}

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

/* --- 4. BOTONERA --- */
.btn-main { 
    background: var(--primary); 
    color: var(--white); 
    border: none; 
    padding: 1.1rem; 
    border-radius: 50px; 
    font-weight: 800; 
    width: 100%; 
    max-width: 320px; 
    margin: 10px auto; 
    cursor: pointer; 
    box-shadow: 0 5px 0 var(--primary-dark); 
    font-size: 1rem; 
    text-transform: uppercase; 
    display: block; 
    text-decoration: none; 
    text-align: center; 
}

.btn-main:active { 
    transform: translateY(3px); 
    box-shadow: 0 2px 0 var(--primary-dark); 
}

.btn-secondary { 
    background: #f0f0f0; 
    border: 2px solid #ddd; 
    color: #666; 
    padding: 0.9rem; 
    border-radius: 50px; 
    font-weight: 700; 
    width: 100%; 
    max-width: 300px; 
    margin: 10px auto; 
    cursor: pointer; 
    text-align: center;
}

.btn-danger { 
    background: var(--accent); 
    color: var(--white); 
    border: none; 
    padding: 0.8rem 1.5rem; 
    border-radius: 50px; 
    font-weight: 700; 
    box-shadow: 0 4px 0 var(--accent-dark); 
    cursor: pointer; 
    text-transform: uppercase; 
    font-size: 0.8rem; 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    margin: 15px auto 0;
}

/* --- 5. JUEGO --- */
.timer-container { 
    width: 100%; 
    height: 10px; 
    background: #eee; 
    border-radius: 10px; 
    margin-bottom: 20px; 
    overflow: hidden; 
}

.timer-fill { 
    height: 100%; 
    background-color: var(--primary); 
    width: 100%; 
}

#options-grid { 
    width: 100%; 
    max-width: 420px; 
    margin: 20px auto; 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
}

.opt-btn { 
    display: block; 
    width: 100%; 
    background: var(--white); 
    border: 2px solid #eee; 
    border-radius: 20px; 
    padding: 1.2rem 1.6rem; 
    text-align: left; 
    font-weight: 700; 
    font-size: 1rem; 
    color: var(--text-main); 
    cursor: pointer; 
    transition: 0.2s; 
}

.opt-btn.selected { 
    background-color: var(--primary) !important; 
    border-color: var(--primary) !important; 
    color: var(--white) !important; 
}

/* --- 6. CLASIFICACIÓN (RANKING) --- */
.rj-tabs-row { 
    display: flex; 
    justify-content: center; 
    gap: 8px; 
    width: 100%; 
    max-width: 450px; 
    margin: 0 auto; 
}

.rj-tab { 
    flex: 1; 
    padding: 10px; 
    border-radius: 20px; 
    border: none; 
    background: #eee; 
    font-weight: 800; 
    font-size: 0.75rem; 
    cursor: pointer; 
    color: #888; 
    transition: 0.2s; 
}

.rj-tab.active { 
    background: var(--primary); 
    color: #fff; 
    box-shadow: 0 3px 0 var(--primary-dark); 
}

.ranking-table-wrapper { 
    width: 100%; 
    margin-top: 20px; 
}

.ranking-table { 
    width: 100%; 
    border-collapse: collapse; 
    text-align: left; 
}

.ranking-table tr { 
    border-bottom: 1px solid #f5f5f5; 
}

.rj-rank { 
    padding: 12px 8px; 
    width: 45px; 
    font-weight: 900; 
    color: #ccc; 
    font-size: 1.1rem; 
}

.rj-name { 
    padding: 12px 8px; 
    font-weight: 700; 
    color: #1a1a1a; 
    font-size: 1rem; 
}

.rj-points { 
    padding: 12px 8px; 
    text-align: right; 
    font-weight: 900; 
    color: var(--primary); 
    font-size: 1.1rem; 
}

/* --- 7. ESTADÍSTICAS --- */
.stats-progress-container { 
    width: 100%; 
    background: #eee; 
    border-radius: 20px; 
    height: 15px; 
    margin: 15px 0; 
    overflow: hidden; 
}

.stats-progress-bar { 
    height: 100%; 
    background: linear-gradient(90deg, var(--primary), var(--orange)); 
    border-radius: 20px; 
    transition: width 1s ease-in-out; 
}

.stats-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
    margin: 20px 0; 
}

.stats-box { 
    background: #f9f8f2; 
    padding: 20px; 
    border-radius: 25px; 
    border: 1px solid #eee; 
    text-align: center; 
}

/* --- 8. PERFIL Y ESCUDOS --- */
.shield-container { 
    width: 110px; 
    height: 110px; 
    margin: 0 auto; 
    background: var(--white); 
    border-radius: 25px; 
    padding: 12px; 
    box-shadow: 0 12px 30px rgba(0,0,0,0.1); 
    border: 1px solid #eee; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
}

.shield-img { 
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain; 
}

/* --- 9. MODALES Y OTROS --- */
.modal-overlay { 
    position: fixed; 
    inset: 0; 
    width: 100vw; 
    height: 100vh; 
    background: rgba(0,0,0,0.92); 
    display: none; 
    place-items: center; 
    z-index: 99999; 
    backdrop-filter: blur(8px); 
    padding: 1rem; 
}

.modal-card { 
    background: var(--white); 
    border-radius: 32px; 
    width: 95%; 
    max-width: 460px; 
    padding: 2.2rem; 
    text-align: center; 
    box-shadow: 0 25px 60px rgba(0,0,0,0.4); 
}

.form-control { 
    width: 100%; 
    max-width: 350px; 
    margin: 0 auto 1.2rem; 
    padding: 1.1rem 1.6rem; 
    border-radius: 20px; 
    border: 2px solid #eee; 
    background-color: #f9f9f9; 
    font-size: 1rem; 
    display: block; 
    outline: none; 
}

.expl-box { 
    background: #fff9e6; 
    border-left: 5px solid var(--gold); 
    padding: 1.2rem; 
    border-radius: 12px; 
    text-align: left; 
    margin: 15px 0; 
    font-size: 0.95rem; 
}

/* --- 10. AUTOCOMPLETADO (RURAL-SUGGEST) --- */
.rural-suggest-wrapper { 
    position: relative; 
    width: 100%; 
    max-width: 350px; 
    margin: 0 auto; 
}

.rural-suggest-list { 
    position: absolute; 
    top: 100%; 
    left: 0; 
    right: 0; 
    background: var(--white); 
    border: 1px solid #ddd; 
    border-radius: 15px; 
    z-index: 9999; 
    max-height: 200px; 
    overflow-y: auto; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.1); 
    display: none; 
    margin-top: -10px; 
}

.rural-suggest-item { 
    padding: 12px 18px; 
    cursor: pointer; 
    text-align: left; 
    font-size: 0.9rem; 
    border-bottom: 1px solid #f0f0f0; 
    color: var(--text-main);
}

.rural-suggest-item:hover { 
    background-color: #f8f8f8; 
    color: var(--primary); 
    font-weight: 700; 
}

/* --- 11. CORTINA DE CARGA (TRANSICIÓN BLANCA) --- */
#game-loader-overlay {
    position: fixed;
    top: 75px;  /* Respetamos la altura del header (75px) */
    left: 0;
    width: 100%; 
    height: calc(100% - 75px); /* Restamos el header de la altura total */
    background: #ffffff; /* FONDO BLANCO PURO */
    z-index: 900; /* Debajo del Header (1000) pero encima del juego */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    /* Por defecto oculto pero listo */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
}

#game-loader-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(45, 90, 39, 0.1);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loader-text {
    font-family: 'Crimson Pro', serif;
    color: var(--primary);
    font-size: 1.3rem;
    font-weight: 700;
    animation: pulseText 1.5s infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulseText { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Clase para ocultar el juego mientras carga detrás */
.hidden-on-start {
    opacity: 0 !important;
    transition: opacity 0.5s ease-in-out;
}