/* ========== ESTILOS GLOBALES ========== */

.glass-card {
    background: rgba(250, 248, 243, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(122, 159, 184, 0.15);
    box-shadow: 0 8px 32px rgba(122, 159, 184, 0.08);
}

/* ========== ANIMACIONES ========== */

.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

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

.animate-bounce-slow {
    animation: bounceSlow 3s infinite ease-in-out;
}

@keyframes bounceSlow {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

.animate-blob {
    animation: blob 12s infinite;
}

.animation-delay-2000 {
    animation-delay: 2s;
}

.animation-delay-4000 {
    animation-delay: 4s;
}

@keyframes blob {
    0%, 100% {
        transform: translate(0px, 0px) scale(1);
    }
    33% {
        transform: translate(40px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-30px, 20px) scale(0.95);
    }
}

/* ========== PARTÍCULAS DE CORAZÓN ========== */

.heart-particle {
    position: absolute;
    font-size: 1.2rem;
    pointer-events: none;
    animation: floatUp linear forwards;
    opacity: 0.4;
    filter: drop-shadow(0 0 8px rgba(122, 159, 184, 0.3));
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) scale(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    80% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-15vh) scale(1) rotate(45deg);
        opacity: 0;
    }
}

/* ========== PARTÍCULAS DE CLIC ========== */

.click-particle {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    animation: explodeUp 1.2s ease-out forwards;
    font-size: 1.3rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes explodeUp {
    0% {
        transform: translate(0, 0) scale(0.3);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(1.5) rotate(var(--rot));
        opacity: 0;
    }
}

/* ========== ROMPECABEZAS ========== */

.puzzle-board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 3px;
    justify-content: center;
    background: linear-gradient(135deg, #7A9FB8 0%, #8BB1C6 100%);
    padding: 6px;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(122, 159, 184, 0.3);
}

.puzzle-piece {
    width: 100px;
    height: 100px;
    background-size: 300px 300px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.puzzle-piece:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.puzzle-piece.selected {
    transform: scale(0.85);
    box-shadow: 0 0 20px #C1556B;
    border: 3px solid #C1556B;
    z-index: 10;
}

/* ========== MODAL TEXTO ========== */

@keyframes modalTextPop {
    0% {
        transform: scale(0.3) translateY(30px);
        opacity: 0;
    }
    20% {
        transform: scale(1.15) translateY(0);
        opacity: 1;
    }
    75% {
        transform: scale(1.05) translateY(0);
        opacity: 1;
        text-shadow: 0 0 40px rgba(193, 85, 107, 0.8);
    }
    100% {
        transform: scale(1.3) translateY(-40px);
        opacity: 0;
    }
}

.animate-modal-text {
    animation: modalTextPop 2.5s ease-in-out forwards;
}

/* ========== ANIMACIÓN DE ERROR ========== */

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-6px);
    }
    40%, 80% {
        transform: translateX(6px);
    }
}

.animate-shake {
    animation: shake 0.3s ease-in-out;
}

/* ========== MINI JUEGO ESPACIAL ========== */

#space-game-container {
    touch-action: none;
    background: radial-gradient(ellipse at center, #1e293b 0%, #0f172a 100%);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5), 0 15px 40px rgba(122, 159, 184, 0.25);
    border: 2px solid rgba(122, 159, 184, 0.3);
    position: relative;
    overflow: hidden;
}

#space-game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(1.5px 1.5px at 20px 30px, #ffffff, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 80px 70px, #e2e8f0, rgba(0, 0, 0, 0)),
        radial-gradient(1px 1px at 150px 160px, #ffffff, rgba(0, 0, 0, 0));
    background-repeat: repeat;
    background-size: 350px 350px;
    opacity: 0.3;
    pointer-events: none;
}

.space-object {
    position: absolute;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    z-index: 5;
    font-size: 2.5rem;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s ease-out;
}

.space-object:active {
    cursor: grabbing;
}

.brown-star-hidden {
    position: absolute;
    cursor: pointer;
    width: 40px;
    height: 40px;
    z-index: 1;
    fill: #8B6F47;
    filter: drop-shadow(0 0 20px rgba(139, 111, 71, 0.6));
    animation: pulseStar 1.8s infinite alternate;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

@keyframes pulseStar {
    0% {
        transform: scale(0.85);
        filter: drop-shadow(0 0 12px rgba(139, 111, 71, 0.4));
    }
    100% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 30px rgba(139, 111, 71, 0.8));
    }
}

/* ========== LIENZO DE DIBUJO ========== */

#drawing-canvas {
    display: block;
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #1a1f2e 0%, #16213e 50%, #0f3460 100%);
}

canvas {
    image-rendering: crisp-edges;
}

.color-btn {
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.color-btn:active {
    transform: scale(0.95);
}

/* ========== GALERÍA DE DIBUJOS ========== */

#drawings-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.drawing-thumbnail {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(122, 159, 184, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 4px 12px rgba(122, 159, 184, 0.15);
}

.drawing-thumbnail:hover {
    transform: translateY(-4px);
    border-color: #C1556B;
    box-shadow: 0 8px 20px rgba(193, 85, 107, 0.25);
}

.drawing-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.drawing-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    background: rgba(193, 85, 107, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawing-thumbnail:hover .drawing-delete {
    opacity: 1;
}

.drawing-delete:hover {
    background: #C1556B;
    transform: scale(1.1);
}

/* ========== MEDIA QUERIES ========== */

@media (max-width: 768px) {
    .puzzle-board {
        grid-template-columns: repeat(3, 80px);
        grid-template-rows: repeat(3, 80px);
    }

    .puzzle-piece {
        width: 80px;
        height: 80px;
    }

    #drawing-canvas {
        height: 300px;
    }

    #drawings-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .puzzle-board {
        grid-template-columns: repeat(3, 60px);
        grid-template-rows: repeat(3, 60px);
    }

    .puzzle-piece {
        width: 60px;
        height: 60px;
    }

    #drawing-canvas {
        height: 250px;
    }

    #drawings-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== SCROLL SUAVE ========== */

html {
    scroll-behavior: smooth;
}

/* ========== TRANSICIONES GENERALES ========== */

* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transition-duration: 200ms;
}

button {
    transition-property: all;
    transition-duration: 300ms;
}