/* ==========================================================================
   ESTILOS PREMIUM PARA JUEGO EDUCATIVO PREESCOLAR
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Nunito:wght@700;800;900&display=swap');

:root {
    --bg-gradiente: linear-gradient(135deg, #FFF9E6 0%, #E8F8F5 50%, #F5EEF8 100%);
    --color-primario: #FF6B6B;
    --color-secundario: #4ECDC4;
    --color-amarillo: #FFE66D;
    --color-morado: #A55EEA;
    --color-azul: #48DBFB;
    --color-verde: #26DE81;
    --color-naranja: #FA8231;
    
    --texto-oscuro: #2D3748;
    --texto-blanco: #FFFFFF;
    
    --sombra-suave: 0 10px 25px rgba(0, 0, 0, 0.06);
    --sombra-juguetona: 0 12px 0px rgba(0, 0, 0, 0.08);
    --sombra-card-hover: 0 18px 30px rgba(78, 205, 196, 0.25);
    
    --radio-grande: 28px;
    --radio-pill: 999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    background: var(--bg-gradiente);
    min-height: 100vh;
    color: var(--texto-oscuro);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ==========================================================================
   BARRA SUPERIOR (HEADER)
   ========================================================================== */
.header-principal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border-bottom: 3px solid #F1F2F6;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-preescolar {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.logo-icono {
    font-size: 2.2rem;
    animation: rebotarSuave 2s infinite ease-in-out;
}

.logo-texto {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(45deg, #FF6B6B, #FA8231);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

/* Perfil activo en la cabecera */
.header-perfil-activo {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #FFFFFF;
    padding: 6px 16px 6px 8px;
    border-radius: var(--radio-pill);
    box-shadow: var(--sombra-suave);
    border: 2px solid #E1E8ED;
}

.header-avatar-circulo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid var(--color-secundario);
    overflow: hidden;
    background: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-avatar-circulo svg {
    width: 100%;
    height: 100%;
}

.header-estrellas-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #F39C12;
}

.icono-estrella-anim {
    animation: estrellaGiro 3s infinite ease-in-out;
}

/* Botones de acción redondos */
.btn-icono-redondo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: #FFFFFF;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
}

.btn-icono-redondo:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.btn-icono-redondo:active {
    transform: scale(0.92);
}

.btn-parental {
    border: 2px dashed #CBD5E0;
    background: #F8FAFC;
}

.musica-reproduciendo {
    background: #E8F8F5;
    border: 2px solid #4ECDC4;
    animation: balanceoMusical 1.2s infinite ease-in-out;
}

@keyframes balanceoMusical {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-10deg) scale(1.08); }
    75% { transform: rotate(10deg) scale(1.08); }
}

/* ==========================================================================
   GESTIÓN DE PANTALLAS
   ========================================================================== */
.pantalla {
    display: none;
    flex: 1;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.pantalla.activa {
    display: flex;
    flex-direction: column;
    animation: aparecerSuave 0.4s ease-out forwards;
}

/* ==========================================================================
   PANTALLA 1: SELECCIÓN DE AVATAR (BIENVENIDA)
   ========================================================================== */
.bienvenida-banner {
    text-align: center;
    margin-bottom: 28px;
}

.bienvenida-titulo {
    font-size: 2.4rem;
    font-weight: 800;
    color: #2C3E50;
    margin-bottom: 8px;
}

.bienvenida-subtitulo {
    font-size: 1.3rem;
    color: #7F8C8D;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Cuadrícula de Avatares */
.galeria-avatares {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    padding: 10px;
}

.tarjeta-avatar {
    background: #FFFFFF;
    border-radius: var(--radio-grande);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border: 4px solid transparent;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s, border-color 0.3s;
}

.tarjeta-avatar:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: var(--color-avatar, var(--color-secundario));
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.1);
}

.tarjeta-avatar:active {
    transform: scale(0.96);
}

.avatar-marco {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border-width: 4px;
    border-style: solid;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.avatar-marco svg {
    width: 100%;
    height: 100%;
    transition: transform 0.3s;
}

.tarjeta-avatar:hover .avatar-marco svg {
    transform: scale(1.08) rotate(3deg);
}

.avatar-estrellas-badge {
    background: #FFF9E6;
    border: 2px solid #F7B731;
    border-radius: var(--radio-pill);
    padding: 4px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #D35400;
}

/* ==========================================================================
   PANTALLA 2: ZONA DE JUEGOS
   ========================================================================== */
.tabs-selector-juegos {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.btn-tab-juego {
    background: #FFFFFF;
    border: 3px solid #E2E8F0;
    border-radius: var(--radio-pill);
    padding: 12px 24px;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: inherit;
    color: #4A5568;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-tab-juego:hover {
    transform: translateY(-3px);
    border-color: var(--color-secundario);
}

.btn-tab-juego.activo {
    background: var(--color-secundario);
    border-color: #38B2AC;
    color: #FFFFFF;
    box-shadow: 0 8px 20px rgba(78, 205, 196, 0.35);
    transform: scale(1.05);
}

.tab-icono {
    font-size: 1.5rem;
}

/* Contenedor del Juego */
.zona-juego-contenedor {
    background: #FFFFFF;
    border-radius: var(--radio-grande);
    padding: 32px 24px;
    box-shadow: var(--sombra-suave);
    border: 3px solid #EDF2F7;
    min-height: 480px;
    display: flex;
    flex-direction: column;
}

.juego-header-instruccion {
    background: #F0FFF4;
    border: 2px dashed #68D391;
    border-radius: var(--radio-pill);
    padding: 12px 24px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0 auto 28px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #22543D;
    animation: pulsarSuave 2.5s infinite ease-in-out;
}

/* Áreas de Juego: Objetos y Destinos */
.area-objetos {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    min-height: 110px;
    align-items: center;
}

.ficha-objeto {
    width: 100px;
    height: 100px;
    background: #FFFFFF;
    border: 4px solid #E2E8F0;
    border-radius: 24px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.ficha-objeto:active {
    cursor: grabbing;
}

.ficha-objeto:hover {
    transform: scale(1.1) rotate(-4deg);
    border-color: #48DBFB;
    box-shadow: 0 12px 24px rgba(72, 219, 251, 0.3);
}

.ficha-objeto.seleccionada {
    border-color: #FF6B6B;
    background: #FFF5F5;
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.25);
    animation: saltito 0.6s infinite alternate ease-in-out;
}

.emoji-grande {
    font-size: 3.4rem;
}

.area-destinos {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Cajas de Colores (Vagones) */
.caja-destino {
    flex: 1;
    min-width: 180px;
    max-width: 240px;
    background: #F8FAFC;
    border: 4px dashed var(--color-caja, #CBD5E0);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.25s, background-color 0.25s, border-color 0.25s;
}

.caja-destino:hover, .caja-destino.hover-drop {
    background-color: #EDF2F7;
    transform: translateY(-6px) scale(1.03);
    border-style: solid;
}

.caja-vagon-cabecera {
    width: 100%;
    padding: 12px 8px;
    color: #FFFFFF;
    font-size: 1.3rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.caja-ranura {
    padding: 24px 10px;
    font-size: 1.8rem;
    opacity: 0.6;
}

/* Hábitats */
.habitat-card {
    padding: 20px 14px;
    text-align: center;
}

.habitat-icono {
    font-size: 3.5rem;
    margin-bottom: 8px;
}

.habitat-titulo {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.habitat-ranura {
    background: rgba(0, 0, 0, 0.04);
    padding: 6px 14px;
    border-radius: var(--radio-pill);
    font-size: 1rem;
    font-weight: 700;
    color: #718096;
}

/* ==========================================================================
   JUEGO 3: MEMORAMA
   ========================================================================== */
.tablero-memorama {
    display: grid;
    grid-template-columns: repeat(3, 140px);
    gap: 20px;
    justify-content: center;
    margin: 20px auto;
    perspective: 1000px;
}

.carta-memorama {
    width: 140px;
    height: 140px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.carta-memorama.volteada, .carta-memorama.emparejada {
    transform: rotateY(180deg);
}

.carta-reverso, .carta-frente {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.carta-reverso {
    background: linear-gradient(135deg, #4ECDC4, #48DBFB);
    color: #FFFFFF;
    font-size: 3rem;
    font-weight: 800;
    border: 4px solid #FFFFFF;
}

.carta-frente {
    background: #FFFFFF;
    border: 4px solid #FFE66D;
    transform: rotateY(180deg);
}

.carta-emoji {
    font-size: 4rem;
}

.carta-memorama.emparejada .carta-frente {
    border-color: #26DE81;
    background: #F0FFF4;
    animation: brilloVictoria 1s infinite alternate;
}

/* ==========================================================================
   MODALES (Control Parental & Celebración)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.oculto {
    display: none;
}

.modal-caja {
    background: #FFFFFF;
    border-radius: var(--radio-grande);
    padding: 36px 30px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    border: 4px solid #EDF2F7;
    animation: zoomModal 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-icono-cabecera {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.modal-titulo {
    font-size: 1.8rem;
    color: #2D3748;
    margin-bottom: 8px;
}

.modal-subtitulo {
    font-size: 1.1rem;
    color: #718096;
    margin-bottom: 24px;
}

/* Reto Parental */
.parental-reto-box {
    background: #F7FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

.parental-pregunta {
    font-size: 1.4rem;
    font-weight: 800;
    color: #2B6CB0;
    margin-bottom: 12px;
}

.parental-input {
    width: 120px;
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    padding: 8px;
    border-radius: 12px;
    border: 3px solid #CBD5E0;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.parental-input:focus {
    border-color: #3182CE;
}

.parental-error {
    color: #E53E3E;
    font-weight: 700;
    margin-top: 8px;
    font-size: 0.95rem;
}

.parental-error.oculto {
    display: none;
}

.modal-acciones {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-accion {
    padding: 14px 20px;
    border-radius: var(--radio-pill);
    font-size: 1.15rem;
    font-weight: 800;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-accion:active {
    transform: scale(0.96);
}

.btn-rojo {
    background: #E53E3E;
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.btn-naranja {
    background: #DD6B20;
    color: #FFFFFF;
}

.btn-verde {
    background: #38A169;
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(56, 161, 105, 0.35);
}

.btn-gris {
    background: #EDF2F7;
    color: #4A5568;
}

/* Modal Victoria Estrellas */
.estrellas-ganadas-box {
    display: flex;
    justify-content: center;
    gap: 12px;
    font-size: 3.5rem;
    margin: 16px 0 24px;
}

.estrella-flotante {
    display: inline-block;
    animation: rebotarSuave 1.2s infinite ease-in-out;
}

/* ==========================================================================
   ANIMACIONES MICRO-INTERACTIVAS
   ========================================================================== */
@keyframes rebotarSuave {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes saltito {
    0% { transform: translateY(0) scale(1.15); }
    100% { transform: translateY(-10px) scale(1.15); }
}

@keyframes estrellaGiro {
    0% { transform: rotate(0deg); }
    20% { transform: rotate(20deg) scale(1.2); }
    40% { transform: rotate(-20deg) scale(1.2); }
    60% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

@keyframes pulsarSuave {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes zoomModal {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

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

.acierto-zoom {
    animation: encajarAcierto 0.35s ease-out forwards;
}

@keyframes encajarAcierto {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.25); opacity: 0.9; }
    100% { transform: scale(0); opacity: 0; }
}

.caja-celebrar {
    animation: cajaBrinco 0.5s ease-in-out;
}

@keyframes cajaBrinco {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.sacudida-suave {
    animation: shake 0.4s ease-in-out;
}

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

@keyframes brilloVictoria {
    from { box-shadow: 0 0 10px #26DE81; }
    to { box-shadow: 0 0 25px #26DE81; }
}

/* ==========================================================================
   ESTILOS DE NUEVOS JUEGOS PREESCOLARES
   ========================================================================== */

/* 1. Figuras Geométricas */
.silueta-figura {
    padding: 16px 10px;
    text-align: center;
}

.silueta-icono-hueco {
    font-size: 3.5rem;
    margin-bottom: 8px;
    opacity: 0.85;
    transition: transform 0.2s;
}

.silueta-nombre {
    font-size: 1.25rem;
    font-weight: 800;
}

/* 2. Conteo de Frutas (1 al 5) */
.canasta-conteo-contenedor {
    background: #FFF9E6;
    border: 4px dashed #F7B731;
    border-radius: var(--radio-grande);
    padding: 28px 20px;
    max-width: 600px;
    margin: 0 auto 32px;
}

.canasta-frutas {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    min-height: 90px;
}

.fruta-para-contar {
    background: #FFFFFF;
    border: 3px solid #EDF2F7;
    border-radius: 50%;
    width: 85px;
    height: 85px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s;
}

.fruta-para-contar:hover {
    transform: scale(1.12);
}

.fruta-para-contar.contada {
    border-color: #26DE81;
    background: #F0FFF4;
    transform: scale(1.05);
}

.fruta-emoji {
    font-size: 3rem;
}

.fruta-badge-numero {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #FF6B6B;
    color: #FFFFFF;
    font-size: 1.2rem;
    font-weight: 900;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    border: 2px solid #FFFFFF;
    empty-cells: hide;
}

.fruta-badge-numero:empty {
    display: none;
}

.selector-numeros-conteo {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn-numero-conteo {
    background: #FFFFFF;
    border: 4px solid #48DBFB;
    color: #0984E3;
    font-size: 2.8rem;
    font-weight: 900;
    font-family: inherit;
    width: 90px;
    height: 90px;
    border-radius: 24px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(72, 219, 251, 0.3);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s;
}

.btn-numero-conteo:hover {
    transform: scale(1.15) translateY(-4px);
    background: #EBF8FF;
}

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

.acierto-numero {
    background: #26DE81 !important;
    color: #FFFFFF !important;
    border-color: #20BF6B !important;
}

/* 3. Grande y Pequeño (Tamaños) */
.tablero-tamanos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin: 20px auto 40px;
    flex-wrap: wrap;
}

.tarjeta-tamano {
    background: #FFFFFF;
    border: 4px solid #CBD5E0;
    border-radius: 32px;
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.tarjeta-tamano:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: #FA8231;
    box-shadow: 0 18px 36px rgba(250, 130, 49, 0.25);
}

.emoji-tamano-grande {
    font-size: 6.5rem;
}

.emoji-tamano-pequeno {
    font-size: 2.5rem;
}

/* 4. Granja Musical de Animales */
.tablero-granja-sonora {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin: 20px auto 40px;
    flex-wrap: wrap;
}

.tarjeta-animal-sonoro {
    background: #FFFFFF;
    border: 4px solid #E2E8F0;
    border-radius: 28px;
    width: 170px;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.25s;
}

.tarjeta-animal-sonoro:hover {
    transform: translateY(-8px) scale(1.08);
    border-color: #A55EEA;
    box-shadow: 0 16px 32px rgba(165, 94, 234, 0.25);
}

.animal-sonoro-icono {
    font-size: 4.8rem;
}

.animal-sonoro-bocina {
    font-size: 1.4rem;
    opacity: 0.7;
    background: #F4ECF7;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .header-principal {
        padding: 12px 16px;
    }
    .logo-texto {
        font-size: 1.2rem;
    }
    .bienvenida-titulo {
        font-size: 1.8rem;
    }
    .galeria-avatares {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .tablero-memorama {
        grid-template-columns: repeat(3, 95px);
        gap: 12px;
    }
    .carta-memorama {
        width: 95px;
        height: 95px;
    }
    .carta-emoji {
        font-size: 2.6rem;
    }
    .caja-destino {
        min-width: 140px;
    }
}

/* ==========================================================================
   JUEGO 8: LA GARRA DE FIGURAS GEOMÉTRICAS (ARCADE CLAW MACHINE)
   ========================================================================== */

.maquina-garra-arcade {
    max-width: 900px;
    margin: 10px auto 30px;
    background: linear-gradient(165deg, #1E293B 0%, #0F172A 100%);
    border-radius: 36px;
    padding: 18px 22px 24px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.15);
    border: 5px solid #38BDF8;
    position: relative;
    user-select: none;
}

/* Marquesina Luminosa Arcade */
.marquesina-arcade {
    background: linear-gradient(90deg, #F43F5E 0%, #FB7185 50%, #F43F5E 100%);
    border-radius: 20px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 6px 16px rgba(244, 63, 94, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.4);
    margin-bottom: 16px;
    border: 3px solid #FFE4E6;
}

.marquesina-titulo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #FFFFFF;
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
}

.marquesina-icono {
    font-size: 1.8rem;
    animation: rebotarSuave 1.5s infinite ease-in-out;
}

.marquesina-luz {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FDE047;
    box-shadow: 0 0 14px #FDE047, 0 0 24px #FACC15;
    animation: parpadeoLuzArcade 0.8s infinite alternate ease-in-out;
}

@keyframes parpadeoLuzArcade {
    0% { opacity: 0.4; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1.15); }
}

/* Cabina de Cristal */
.cabina-cristal {
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.12) 0%, rgba(56, 189, 248, 0.05) 50%, rgba(15, 23, 42, 0.6) 100%),
                radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
    border-radius: 26px;
    border: 3px solid rgba(56, 189, 248, 0.4);
    box-shadow: inset 0 0 30px rgba(14, 165, 233, 0.15), 0 10px 25px rgba(0, 0, 0, 0.3);
    min-height: 440px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px 16px 16px;
}

/* Brillo reflejo en el vidrio */
.cabina-cristal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.04) 40%, transparent 60%);
    pointer-events: none;
    z-index: 25;
}

/* Riel Superior y Mecanismo */
.riel-garra {
    position: relative;
    width: 100%;
    height: 28px;
    z-index: 20;
    margin-top: 6px;
}

.riel-barra {
    position: absolute;
    top: 8px;
    left: 10px;
    right: 10px;
    height: 12px;
    background: linear-gradient(180deg, #E2E8F0 0%, #94A3B8 50%, #475569 100%);
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px #FFFFFF;
}

.riel-barra::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 4px;
    height: 2px;
    background: rgba(255, 255, 255, 0.8);
}

/* Carro deslizante de la garra */
.carro-garra {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: left 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 30;
    pointer-events: none;
}

.carro-ruedas {
    width: 68px;
    height: 14px;
    background: #334155;
    border-radius: 7px;
    border: 2px solid #64748B;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
}

.carro-ruedas::before, .carro-ruedas::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #CBD5E1;
    border-radius: 50%;
    border: 1px solid #475569;
}

.carro-cuerpo {
    width: 52px;
    height: 26px;
    background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%);
    border-radius: 8px;
    border: 2px solid #FCD34D;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.luz-carro {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #EF4444;
    box-shadow: 0 0 8px #EF4444;
    animation: parpadeoLuzArcade 0.6s infinite alternate;
}

/* Cable de acero de la garra */
.cable-garra {
    width: 5px;
    height: 35px; /* Dinámico por JS: se alarga hasta 180px - 210px */
    background: repeating-linear-gradient(
        180deg,
        #CBD5E1,
        #CBD5E1 4px,
        #475569 4px,
        #475569 8px
    );
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
    transition: height 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mecanismo articulado de la garra */
.mecanismo-garra {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: top center;
    transition: transform 0.2s ease-out;
}

.svg-garra {
    display: block;
    overflow: visible;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
}

.brazo-garra {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brazo-izq {
    transform-origin: 52px 40px;
}

.brazo-der {
    transform-origin: 68px 40px;
}

/* Estados de apertura/cierre de la Garra */
.garra-abierta .brazo-izq {
    transform: rotate(-24deg);
}
.garra-abierta .brazo-der {
    transform: rotate(24deg);
}

.garra-cerrada .brazo-izq {
    transform: rotate(10deg);
}
.garra-cerrada .brazo-der {
    transform: rotate(-10deg);
}

/* Figura sostenida por la garra */
.garra-figura-sostenida {
    position: absolute;
    top: 50px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 35;
    animation: mecerFiguraSostenida 2s infinite ease-in-out;
}

.garra-figura-sostenida:empty {
    display: none;
}

.garra-figura-sostenida .icono-figura-svg {
    width: 58px;
    height: 58px;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.5));
}

@keyframes mecerFiguraSostenida {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(3px) rotate(2deg); }
}

/* Sombra de la garra en el suelo */
.sombra-garra {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 16px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 75%);
    border-radius: 50%;
    transition: left 0.35s cubic-bezier(0.25, 1, 0.5, 1), transform 0.65s ease;
    pointer-events: none;
    z-index: 5;
}

/* Zona Superior de Siluetas (Bases de Encaje) */
.zona-siluetas-garra {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 15px;
    position: relative;
    z-index: 10;
}

.silueta-garra-card {
    background: rgba(30, 41, 59, 0.85);
    border: 3px dashed var(--color-silueta, #94A3B8);
    border-radius: 22px;
    padding: 14px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s, background-color 0.25s;
    backdrop-filter: blur(8px);
}

.silueta-garra-card:hover {
    transform: translateY(-4px) scale(1.04);
    background: rgba(30, 41, 59, 0.95);
}

.silueta-garra-card.silueta-apuntada {
    border-style: solid;
    border-color: #38BDF8;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.6), inset 0 0 15px rgba(56, 189, 248, 0.2);
    transform: scale(1.06);
    background: rgba(15, 23, 42, 0.95);
}

.silueta-garra-card.silueta-completada {
    border-style: solid;
    border-color: #22C55E !important;
    background: rgba(34, 197, 94, 0.18) !important;
    box-shadow: 0 0 22px rgba(34, 197, 94, 0.45);
}

.silueta-ranura-icono {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-silueta, #94A3B8);
    opacity: 0.85;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
}

.silueta-ranura-icono svg {
    width: 58px;
    height: 58px;
}

.silueta-completada .silueta-ranura-icono {
    opacity: 1;
    transform: scale(1.12);
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
}

.silueta-nombre-label {
    color: #F8FAFC;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.silueta-check-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #22C55E;
    color: #FFFFFF;
    font-size: 1.1rem;
    font-weight: 900;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #FFFFFF;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.silueta-completada .silueta-check-badge {
    display: flex;
    animation: rebotarSuave 0.6s ease-out;
}

/* Zona Inferior: El Pozo de Juguetes / Figuras */
.zona-pozo-garra {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    border-top: 3px solid rgba(56, 189, 248, 0.4);
    border-radius: 18px;
    padding: 10px 14px 12px;
    box-shadow: inset 0 6px 14px rgba(0, 0, 0, 0.3);
    margin-top: 24px;
    position: relative;
    z-index: 10;
}

.bandeja-piso-rotulo {
    text-align: center;
    margin-bottom: 8px;
}

.bandeja-piso-rotulo span {
    background: rgba(56, 189, 248, 0.2);
    color: #38BDF8;
    padding: 3px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.plataforma-figuras {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.slot-figura-pozo {
    height: 80px;
    background: rgba(15, 23, 42, 0.6);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.figura-pozo-item {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s;
    background: #FFFFFF;
    position: relative;
}

.figura-pozo-item:hover {
    transform: translateY(-6px) scale(1.1);
    box-shadow: 0 12px 24px rgba(255, 255, 255, 0.25);
}

.figura-pozo-item.figura-apuntada {
    transform: translateY(-8px) scale(1.15);
    box-shadow: 0 0 20px #38BDF8;
    animation: rebotarSuave 0.8s infinite alternate;
}

.figura-pozo-item .icono-figura-svg {
    width: 52px;
    height: 52px;
}

/* Panel de Botones Arcade */
.panel-control-arcade {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: 18px;
    padding: 12px 16px 0;
}

.btn-arcade {
    background: #334155;
    border: none;
    cursor: pointer;
    font-family: inherit;
    border-radius: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 900;
    transition: transform 0.1s, box-shadow 0.1s;
    outline: none;
}

.btn-arcade:active {
    transform: translateY(5px);
}

.btn-direccion {
    background: linear-gradient(180deg, #38BDF8 0%, #0284C7 100%);
    color: #FFFFFF;
    width: 95px;
    height: 72px;
    box-shadow: 0 8px 0 #0369A1, 0 14px 20px rgba(0, 0, 0, 0.35);
    border: 3px solid #BAE6FD;
}

.btn-direccion:active {
    box-shadow: 0 2px 0 #0369A1, 0 6px 10px rgba(0, 0, 0, 0.2);
}

.arcade-icono {
    font-size: 2.2rem;
}

.arcade-texto {
    font-size: 1.15rem;
    letter-spacing: 0.5px;
}

.btn-accion-principal {
    background: linear-gradient(180deg, #EF4444 0%, #B91C1C 100%);
    color: #FFFFFF;
    min-width: 220px;
    height: 80px;
    padding: 0 24px;
    border-radius: 999px;
    box-shadow: 0 9px 0 #991B1B, 0 16px 26px rgba(239, 68, 68, 0.4);
    border: 4px solid #FECACA;
}

.btn-accion-principal:active {
    box-shadow: 0 3px 0 #991B1B, 0 8px 12px rgba(239, 68, 68, 0.3);
}

.btn-accion-principal.estado-soltar {
    background: linear-gradient(180deg, #22C55E 0%, #15803D 100%);
    box-shadow: 0 9px 0 #166534, 0 16px 26px rgba(34, 197, 94, 0.4);
    border-color: #BBF7D0;
}

.btn-accion-principal.estado-soltar:active {
    box-shadow: 0 3px 0 #166534, 0 8px 12px rgba(34, 197, 94, 0.3);
}

.arcade-icono-grande {
    font-size: 2.5rem;
}

.arcade-texto-grande {
    font-size: 1.55rem;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.anim-pulso-arcade {
    animation: pulsoBotonArcade 1.6s infinite ease-in-out;
}

@keyframes pulsoBotonArcade {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

/* Animación de encaje y caída */
.anim-caida-suave {
    animation: caidaFigura 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes caidaFigura {
    0% { transform: translateY(-40px) scale(0.9); opacity: 0.6; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Responsive para Garra Arcade */
@media (max-width: 768px) {
    .maquina-garra-arcade {
        padding: 12px 14px 18px;
        border-radius: 26px;
    }
    .marquesina-titulo {
        font-size: 1.25rem;
    }
    .cabina-cristal {
        min-height: 380px;
        padding: 8px 10px 12px;
    }
    .zona-siluetas-garra, .plataforma-figuras {
        gap: 8px;
    }
    .silueta-garra-card {
        padding: 8px 4px;
        border-radius: 16px;
    }
    .silueta-ranura-icono, .silueta-ranura-icono svg {
        width: 44px;
        height: 44px;
    }
    .silueta-nombre-label {
        font-size: 0.85rem;
    }
    .figura-pozo-item {
        width: 54px;
        height: 54px;
    }
    .figura-pozo-item .icono-figura-svg {
        width: 40px;
        height: 40px;
    }
    .panel-control-arcade {
        gap: 10px;
    }
    .btn-direccion {
        width: 70px;
        height: 60px;
    }
    .btn-accion-principal {
        min-width: 160px;
        height: 66px;
        padding: 0 16px;
    }
    .arcade-texto-grande {
        font-size: 1.15rem;
    }
    .arcade-icono-grande {
        font-size: 2rem;
    }
}

