/* ==========================================================================
   Honestín - Estilos Modulares para la Suite de Juegos
   ========================================================================== */

body {
    font-family: 'Nunito', sans-serif;
}

.font-display {
    font-family: 'Baloo 2', cursive;
}

/* --- Animaciones Generales --- */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

@keyframes pop-in {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.pop-in {
    animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bounce-in {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.bounce-in {
    animation: bounce-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-20px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti-p,
.confetti-piece {
    position: fixed;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    animation: confetti-fall 3s ease forwards;
    pointer-events: none;
    z-index: 9999;
}

/* --- Card Hover --- */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* --- Quiz de Valores --- */
.opt-btn {
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.opt-btn:not(:disabled):hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.opt-btn:disabled {
    cursor: default;
}

.progress-anim {
    transition: width 0.5s ease;
}

/* --- Crucigrama --- */
.cross-table {
    border-collapse: collapse;
}

.cross-cell {
    width: 44px;
    height: 44px;
    position: relative;
}

.cross-cell input {
    width: 100%;
    height: 100%;
    text-align: center;
    text-transform: uppercase;
    font-size: 1.1rem;
    font-weight: 800;
    border: 2px solid #c084fc;
    background: #fdf4ff;
    outline: none;
    color: #581c87;
    transition: background 0.2s, border-color 0.2s;
    caret-color: #a855f7;
}

.cross-cell input:focus {
    background: #ede9fe;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.4);
}

.cross-cell.correct input {
    background: #dcfce7 !important;
    border-color: #16a34a !important;
    color: #15803d !important;
}

.cross-cell.wrong input {
    background: #fee2e2 !important;
    border-color: #dc2626 !important;
    color: #b91c1c !important;
}

.cross-cell.black {
    background: #1e1b4b;
    border: 2px solid #1e1b4b;
    cursor: default;
}

.cross-cell.black input {
    display: none;
}

.cell-number {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 0.5rem;
    font-weight: 800;
    color: #7c3aed;
    line-height: 1;
    pointer-events: none;
}

.clue-highlight {
    background: #fde68a !important;
    border-color: #f59e0b !important;
}

/* --- Encuentra las Diferencias --- */
.diff-marker {
    position: absolute;
    border: 4px solid #FF6B6B;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
    animation: ping-slow 1s infinite;
}

@keyframes ping-slow {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0;
    }
}

.found-marker {
    position: absolute;
    border: 4px solid #34D399;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    transform: translate(-50%, -50%);
    background: rgba(52, 211, 153, 0.3);
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.5);
    z-index: 30;
}

.diff-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.hotspot {
    position: absolute;
    cursor: pointer;
    z-index: 20;
}

/* Hotspots y Diferencias predefinidas */
.diff-target-1 { top: 60%; left: 5%; width: 8%; height: 15%; }
.diff-target-2 { top: 35%; left: 36%; width: 8%; height: 12%; }
.diff-target-3 { top: 40%; left: 21%; width: 8%; height: 15%; }
.diff-target-4 { top: 40%; left: 62%; width: 6%; height: 12%; }
.diff-target-5 { top: 65%; left: 78%; width: 8%; height: 15%; }

/* --- Memorama --- */
.card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.card-back {
    transform: rotateY(180deg);
}

.feedback-icon {
    animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* --- Ordena la Historia --- */
.draggable {
    cursor: grab;
}

.draggable:active {
    cursor: grabbing;
}

.ghost {
    opacity: 0.4;
}

/* --- Sopa de Letras --- */
.cell {
    user-select: none;
    touch-action: none;
}

.cell.selected {
    background-color: #A78BFA;
    color: white;
    border-radius: 4px;
    text-decoration: underline;
}

.cell.found {
    background-color: #34D399;
    color: white;
    border-radius: 4px;
    text-decoration: underline;
}

/* --- Accesibilidad: Reducción de movimiento en juegos --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .float-animation,
    .bounce-in,
    .pop-in,
    .confetti-p,
    .confetti-piece,
    .diff-marker {
        animation: none !important;
    }
    .card-hover:hover {
        transform: none !important;
    }
}
