         /* ---------- ESTILOS BASE Y UTILITIES ---------- */
         *,
         *::before,
         *::after {
         box-sizing: border-box;
         }
         html, body {
         margin: 0;
         padding: 0;
         width: 100%;
         min-height: 100dvh;
         overflow: hidden;
         font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
         background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
         display: flex;
         align-items: center;
         justify-content: center;
         }
         .app-container {
         width: 100%;
         height: 100%;
         background: white;
         display: flex;
         flex-direction: column;
         overflow: hidden;
         box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
         }
         .app-header {
         background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
         color: white;
         padding: 10px;
         text-align: center;
         flex-shrink: 0;
         }
         .app-header h1 {
         font-size: 1.3rem;
         font-weight: bold;
         margin: 0;
         }
         .app-header p {
         margin: 2px 0 0 0;
         font-size: 0.65rem;
         }
         .main-content {
         flex: 1;
         padding: 8px;
         padding-bottom: 0;
         overflow: hidden;
         display: flex;
         flex-direction: column;
         }
         /* Pantallas (screens) */
         .screen {
         display: none;
         flex: 1;
         overflow: hidden;
         flex-direction: column;
         }
         .screen.active {
         display: flex;
         animation: fadeIn 0.2s;
         }
         @keyframes fadeIn {
         from { opacity: 0; }
         to { opacity: 1; }
         }
         .scrollable-content {
         flex: 1;
         overflow-y: auto;
         overflow-x: hidden;
         padding-right: 4px;
         }
         .scrollable-content::-webkit-scrollbar {
         width: 3px;
         }
         .scrollable-content::-webkit-scrollbar-track {
         background: #f1f1f1;
         border-radius: 10px;
         }
         .scrollable-content::-webkit-scrollbar-thumb {
         background: #667eea;
         border-radius: 10px;
         }
         /* Botones y formularios */
         .btn {
         padding: 8px 12px;
         border: none;
         border-radius: 25px;
         font-weight: bold;
         font-size: 0.8rem;
         cursor: pointer;
         transition: all 0.2s;
         width: 100%;
         margin-bottom: 6px;
         }
         .btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
         .btn-secondary { background: #6c757d; color: white; }
         .btn-success { background: #28a745; color: white; }
         .btn-danger { background: #dc3545; color: white; }
         .btn-info { background: #17a2b8; color: white; }
         .btn:active { transform: scale(0.98); }
         .form-group { margin-bottom: 8px; }
         .form-group label { display: block; margin-bottom: 3px; font-weight: bold; color: #333; font-size: 0.75rem; }
         .form-control { width: 100%; padding: 6px 8px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 0.8rem; }
         .form-control:focus { outline: none; border-color: #667eea; }
         /* Tarjetas de dificultad */
         .difficulty-grid { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
         .difficulty-card { background: white; border: 2px solid #e0e0e0; border-radius: 10px; padding: 6px; text-align: center; cursor: pointer; transition: all 0.2s; }
         .difficulty-card.selected { border-color: #667eea; background: #f0f0ff; transform: scale(1.01); }
         .difficulty-card h3 { font-size: 0.9rem; margin: 0; }
         .difficulty-card p { font-size: 0.65rem; margin: 2px 0 0 0; color: #666; }
         /* Componentes de juego */
         .game-stats { display: flex; justify-content: space-between; margin-bottom: 6px; }
         .badge { padding: 3px 8px; border-radius: 12px; font-size: 0.65rem; background: #667eea; color: white; }
         .timer-container { background: #f8f9fa; border-radius: 20px; padding: 4px 8px; margin: 6px 0; display: flex; align-items: center; gap: 6px; }
         .timer-bar { flex: 1; height: 4px; background: #e0e0e0; border-radius: 10px; overflow: hidden; }
         .timer-progress { height: 100%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); transition: width 1s linear; }
         .timer-text { font-weight: bold; font-size: 0.9rem; min-width: 30px; text-align: center; }
         .question-card { background: #f8f9fa; border-radius: 10px; padding: 8px; margin: 6px 0; }
         .question-card h5 { font-size: 0.7rem; margin-bottom: 4px; color: #667eea; }
         .question-card p { font-size: 0.8rem; margin: 0; line-height: 1.3; }
         .option-btn { display: block; width: 100%; padding: 7px; margin-bottom: 5px; background: white; border: 2px solid #e0e0e0; border-radius: 8px; text-align: left; font-size: 0.75rem; cursor: pointer; transition: all 0.2s; }
         .option-btn:active { transform: scale(0.98); }
         .option-btn.correct { background: #d4edda; border-color: #28a745; color: #155724; }
         .option-btn.incorrect { background: #f8d7da; border-color: #dc3545; color: #721c24; }
         /* Ranking */
         .ranking-header { text-align: center; margin-bottom: 6px; }
         .ranking-header h3 { font-size: 1rem; margin: 0; }
         .difficulty-buttons { display: flex; gap: 5px; margin-bottom: 6px; }
         .difficulty-buttons button { flex: 1; padding: 5px; font-size: 0.7rem; margin: 0; }
         .ranking-list-container { flex: 1; overflow-y: auto; margin-bottom: 6px; }
         .ranking-item { background: white; border-radius: 8px; padding: 5px; margin-bottom: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); position: relative; }
         .ranking-content { display: flex; flex-direction: column; gap: 5px; }
         .position-badge { position: absolute; top: 3px; right: 5px; }
         .position-badge .medal { font-size: 1rem; }
         .position-badge .position-number { width: 22px; height: 22px; background: #6c757d; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: bold; color: white; }
         .main-info { display: flex; align-items: center; gap: 6px; }
         .avatar-circle { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; font-weight: bold; flex-shrink: 0; }
         .player-info { flex: 1; }
         .player-name { font-size: 0.8rem; font-weight: bold; color: #333; }
         .location-badge { background: #f0f0f0; padding: 1px 4px; border-radius: 10px; font-size: 0.55rem; color: #666; display: inline-block; }
         .stats-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
         .stat-card { padding: 2px; border-radius: 6px; text-align: center; }
         .stat-card .stat-value { font-size: 0.7rem; font-weight: bold; margin: 0; }
         .stat-card .stat-label { font-size: 0.5rem; color: #666; margin: 0; }
         .stat-card.success { background: rgba(40, 167, 69, 0.1); }
         .stat-card.success .stat-value { color: #28a745; }
         .stat-card.danger { background: rgba(220, 53, 69, 0.1); }
         .stat-card.danger .stat-value { color: #dc3545; }
         .stat-card.primary { background: rgba(0, 123, 255, 0.1); }
         .stat-card.primary .stat-value { color: #007bff; }
         .stat-card.info { background: rgba(23, 162, 184, 0.1); }
         .stat-card.info .stat-value { color: #17a2b8; }
         .pagination-container { display: flex; justify-content: center; gap: 5px; margin: 5px 0; }
         .page-btn { min-width: 26px; height: 26px; border-radius: 50%; border: none; background: #f0f0f0; font-weight: bold; cursor: pointer; font-size: 0.65rem; }
         .page-btn.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
         /* Alertas */
         .alert { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999; padding: 10px 16px; border-radius: 8px; color: white; text-align: center; animation: fadeIn 0.2s; box-shadow: 0 5px 20px rgba(0,0,0,0.3); min-width: 200px; max-width: 85%; font-weight: bold; font-size: 0.85rem; }
         .alert-success { background: #28a745; }
         .alert-error { background: #dc3545; }
         .alert-warning { background: #ffc107; color: #333; }
         .alert-info { background: #17a2b8; color: white; }
         .avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.1rem; margin: 0 auto 4px; }
         .text-center { text-align: center; }
         .mb-1 { margin-bottom: 4px; }
         .mb-2 { margin-bottom: 6px; }
         .mb-3 { margin-bottom: 12px; }
         .mt-1 { margin-top: 4px; }
         .mt-2 { margin-top: 6px; }
         .mt-3 { margin-top: 12px; }
         /* Safe bottom */
         .safe-bottom { margin-top: auto; background: white; }
         @media (max-width: 768px) { .safe-bottom { padding-bottom: max(15px, env(safe-area-inset-bottom)); } }
         @media (min-width: 769px) { .safe-bottom { padding-bottom: 15px; padding-top: 10px; border-top: 1px solid #eee; } }
         /* ========== MODALES CON ESTILO UNIFICADO ========== */
         .modal-content { border-radius: 20px; overflow: hidden; max-height: 90vh; border: none; }
         .modal-body { padding: 1.2rem; max-height: calc(90vh - 120px); overflow-y: auto; }
         .modal-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border-bottom: none; padding: 12px 20px; }
         .modal-header .btn-close { filter: brightness(0) invert(1); opacity: 0.8; }
         .modal-header .btn-close:hover { opacity: 1; }
         .modal-title { font-weight: bold; font-size: 1.2rem; }
         /* Tarjetas internas del modal */
         .modal-body .page-header { text-align: center; margin-bottom: 15px; }
         .modal-body .page-header-icon { font-size: 2.5rem; }
         .modal-body .page-header h2 { color: #667eea; margin: 5px 0; font-size: 1.2rem; }
         .modal-body .page-header p { color: #666; font-size: 0.75rem; }
         .modal-body .info-card, .modal-body .legal-card {
         border-radius: 12px;
         padding: 12px;
         margin-bottom: 12px;
         }
         .modal-body .info-card h4, .modal-body .legal-card h4 {
         margin-bottom: 6px;
         font-size: 0.9rem;
         font-weight: 600;
         }
         .modal-body .info-card p, .modal-body .legal-card p, .modal-body .legal-card li {
         font-size: 0.8rem;
         line-height: 1.4;
         margin-bottom: 4px;
         }
         .modal-body .card-blue { background: #f0f0ff; }
         .modal-body .card-green { background: #e8f5e9; }
         .modal-body .card-orange { background: #fff3e0; }
         .modal-body .card-purple { background: linear-gradient(135deg,#667eea20,#764ba220); text-align: center; }
         .modal-body .legal-card {
         background: white;
         border-left: 4px solid #667eea;
         box-shadow: 0 1px 3px rgba(0,0,0,0.05);
         }
         .modal-body .legal-footer {
         background: #f0f0ff;
         border-radius: 8px;
         padding: 10px;
         text-align: center;
         margin-top: 12px;
         font-size: 0.75rem;
         }
         .modal-body ul { margin-bottom: 0; padding-left: 20px; }
         @media (min-width: 769px) { .modal-dialog { max-width: 700px; } }
         /* Ocultar las antiguas pantallas de texto */
         #instructionsScreen, #privacyScreen, #termsScreen { display: none !important; }
      
  	  .logo{
    display:flex;
    align-items:center;
    gap:10px;
}

.logo img{
    width:48px;
    height:48px;
    border-radius:12px;
}
.quiz-title{
    display: flex;
    align-items: center;
    justify-content: center; /* centra horizontalmente */
    gap: 10px;
    text-align: center;
    width: 100%;
}

.quiz-title img{
    width: 48px;
    height: 48px;
}

/* ===================================
   RANKING MODAL
   =================================== */

#rankingModal .modal-content{
    border-radius:20px;
    border:none;
    overflow:hidden;
}

#rankingModal .modal-header{
    background:linear-gradient(135deg,#667eea,#764ba2);
    color:white;
}

#rankingModal .btn-close{
    filter:invert(1);
}

#rankingListModal{
    max-height:60vh;
    overflow-y:auto;
    padding-right:5px;
}

#rankingListModal .ranking-item{
    background:white;
    border-radius:12px;
    padding:12px;
    margin-bottom:10px;
    border:1px solid #e9ecef;
    box-shadow:0 2px 8px rgba(0,0,0,.08);
}

#rankingListModal .ranking-content{
    display:flex;
    align-items:center;
    gap:15px;
}

#rankingListModal .position-badge{
    min-width:50px;
    text-align:center;
}

#rankingListModal .medal{
    font-size:1.8rem;
}

#rankingListModal .position-number{
    width:40px;
    height:40px;
    border-radius:50%;
    background:#6c757d;
    color:white;
    display:flex;
    align-items:center;
    justify-content:center;
    margin:auto;
    font-weight:bold;
}

#rankingListModal .main-info{
    flex:1;
    display:flex;
    align-items:center;
    gap:10px;
}

#rankingListModal .avatar-circle{
    width:50px;
    height:50px;
    border-radius:50%;
    background:linear-gradient(135deg,#667eea,#764ba2);
    color:white;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:bold;
    font-size:1.2rem;
}

#rankingListModal .player-name{
    font-weight:bold;
    font-size:1rem;
}

#rankingListModal .location-badge{
    background:#f1f3f5;
    padding:3px 8px;
    border-radius:20px;
    font-size:.75rem;
}

#rankingListModal .stats-container{
    display:flex;
    gap:8px;
}

#rankingListModal .stat-card{
    min-width:80px;
    text-align:center;
    border-radius:10px;
    padding:8px;
}

#rankingListModal .stat-value{
    font-size:1rem;
    font-weight:bold;
}

#rankingListModal .stat-label{
    font-size:.7rem;
}

@media(max-width:768px){

    #rankingModal .modal-dialog{
        margin:.5rem;
    }

    #rankingListModal .ranking-content{
        flex-direction:column;
        align-items:flex-start;
    }

    #rankingListModal .stats-container{
        width:100%;
        display:grid;
        grid-template-columns:repeat(2,1fr);
    }

    #rankingListModal .stat-card{
        min-width:auto;
    }

    #rankingListModal .position-badge{
        align-self:center;
    }
}