body { 
    font-family: 'Nunito', 'Noto Sans JP', sans-serif; 
    background-color: #fdf8f5;
    background-image: radial-gradient(rgba(209, 81, 60, 0.15) 1.5px, transparent 1.5px);
    background-size: 25px 25px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden; 
}

.bg-jinjo { background-color: #d1513c; }
.text-jinjo { color: #d1513c; }

.pb-safe { padding-bottom: env(safe-area-inset-bottom, 20px); }
.pt-safe { padding-top: env(safe-area-inset-top, 0px); }

.jinjo-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(245, 171, 178, 0.5);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* ========================================================================= */
/* FIX DEFINITIVO: MATEMÁTICAS RESPONSIVAS PARA EVITAR EL DESFASE DE CLICS   */
/* ========================================================================= */
#game-container {
    position: relative;
    width: 100%;
    
    /* En vez de max-height que rompe la proporción, le decimos que la anchura 
       no supere los 800px NI TAMPOCO el equivalente a su altura ideal (4/3)  */
    max-width: min(800px, calc(55vh * 4 / 3));
    aspect-ratio: 4/3;
    
    margin: 0 auto;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border: 2px solid #1e293b;
    background-color: #86efac; 
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated; 
    /* ¡Se eliminó object-fit: contain; porque la caja ya es perfectamente 4:3! */
}

.d-pad-btn, .action-btn {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(0,0,0,0.1);
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    touch-action: manipulation;
}
.d-pad-btn:active, .action-btn:active {
    background: rgba(209, 81, 60, 0.8);
    color: white;
    transform: scale(0.95);
}

/* ========================================================================= */
/* MODAL ULTRA-COMPACTO PARA MÓVILES (Fuerza bruta sobre Tailwind)           */
/* ========================================================================= */
@media (max-width: 768px), (max-height: 600px) {
    #modal-header { padding: 0.4rem !important; }
    #modal-title { font-size: 1rem !important; }
    #modal-content .p-5 { padding: 0.75rem !important; }
    
    #modal-content .mb-4 { margin-bottom: 0.5rem !important; padding: 0.5rem !important; }
    #npc-avatar { font-size: 1.5rem !important; }
    #npc-dialogue { font-size: 0.8rem !important; }
    
    #q-text { font-size: 0.95rem !important; margin-bottom: 0.5rem !important; line-height: 1.2 !important; }
    
    #options-container { gap: 0.25rem !important; display: flex !important; flex-direction: column !important; }
    #options-container > * { margin-top: 0 !important; }
    
    #options-container button { 
        padding: 0.4rem 0.5rem !important; 
        font-size: 0.8rem !important; 
        border-radius: 0.5rem !important; 
    }
    
    #feedback-box { margin-top: 0.5rem !important; padding: 0.5rem !important; }
    #feedback-msg { font-size: 1rem !important; margin-bottom: 0 !important; }
    #feedback-expl { font-size: 0.7rem !important; margin-bottom: 0.25rem !important; line-height: 1.1 !important; }
    #feedback-box button { padding: 0.4rem !important; font-size: 0.85rem !important; }
}

.cat-idioma { background-color: #3b82f6; }
.cat-cultura { background-color: #10b981; }
.cat-choques { background-color: #f59e0b; }
