/* ==========================================================================
   ASOCIA & MEMOTEST • ESTILO LIMPIO FULLSCREEN PARA SALITA DE 4 AÑOS
   Máxima claridad, sin textos innecesarios, tarjetas gigantes y adaptadas a 100vh
   ========================================================================== */

:root {
    --primary-sky: #38BDF8;
    --primary-blue: #0284C7;
    --accent-amber: #F59E0B;
    --accent-emerald: #10B981;
    --accent-rose: #FB7185;
    --accent-purple: #818CF8;
    
    --bg-dark: #070B19;
    --card-bg: rgba(30, 41, 59, 0.88);
    --border-glow: rgba(56, 189, 248, 0.4);
    
    --font-kids: 'Fredoka', cursive, system-ui, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

html, body.fullscreen-kids-app {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at 50% 20%, #1E1B4B 0%, #0F172A 65%, #050811 100%);
    color: #FFFFFF;
    font-family: var(--font-kids);
    touch-action: manipulation;
}

/* ==========================================================================
   1. CANVAS DE CONFETI
   ========================================================================== */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100;
}

/* ==========================================================================
   2. BARRA SUPERIOR FLOTANTE
   ========================================================================== */
.floating-kids-bar {
    position: absolute;
    top: 10px;
    left: 14px;
    right: 14px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 50;
    pointer-events: none;
}

.btn-corner-nav {
    pointer-events: auto;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #F8FAFC;
    text-decoration: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: all 0.2s;
}

.btn-corner-nav:hover {
    background: #4F46E5;
    border-color: #818CF8;
    transform: scale(1.1);
}

.mode-tabs-pill {
    pointer-events: auto;
    display: flex;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 99px;
    padding: 4px;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.tab-pill {
    background: transparent;
    border: none;
    color: #CBD5E1;
    font-family: var(--font-kids);
    font-size: 1rem;
    font-weight: 800;
    padding: 6px 18px;
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-pill.active {
    background: var(--primary-sky);
    color: #0F172A;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
}

.corner-actions {
    pointer-events: auto;
    display: flex;
    gap: 8px;
}

.btn-corner-tool {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: all 0.2s;
}

.btn-corner-tool:hover {
    background: var(--primary-sky);
    color: #0F172A;
    transform: scale(1.1);
}

/* ==========================================================================
   3. ESCENARIO FULLSCREEN DEL JUEGO
   ========================================================================== */
.kids-stage {
    width: 100vw;
    height: 100vh;
    padding: 70px 20px 20px 20px;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.kids-stage.active-stage {
    display: flex;
}

/* ==========================================================================
   4. ACTIVIDAD 1: ASOCIACIÓN LIMPIA & GIGANTE
   ========================================================================== */
/* Barra de 20 estrellas simple */
.stars-progress-bar {
    display: flex;
    justify-content: center;
    gap: 6px;
    width: 100%;
    max-width: 750px;
}

.star-node {
    flex: 1;
    height: 12px;
    background: rgba(51, 65, 85, 0.6);
    border-radius: 99px;
    transition: all 0.3s ease;
}

.star-node.active {
    background: #38BDF8;
    box-shadow: 0 0 10px #38BDF8;
}

.star-node.completed {
    background: #F59E0B;
    box-shadow: 0 0 8px #F59E0B;
}

/* Bocadillo de Voz de Teclita */
.teclita-voice-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(56, 189, 248, 0.5);
    border-radius: 99px;
    padding: 8px 24px 8px 12px;
    max-width: 820px;
    width: 100%;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    cursor: pointer;
}

.avatar-speaker-wrapper {
    position: relative;
    flex-shrink: 0;
}

.teclita-face {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: 3px solid #38BDF8;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.5);
    display: block;
}

.speaker-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #F59E0B;
    color: #0F172A;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.voice-bubble {
    flex: 1;
}

.voice-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: #FFFFFF;
    line-height: 1.25;
}

@media (max-width: 600px) {
    .voice-text {
        font-size: 1.15rem;
    }
}

/* Arena de Asociación Gigante */
.association-arena {
    flex: 1;
    width: 100%;
    max-width: 1050px;
    display: grid;
    grid-template-columns: 280px auto 1fr;
    align-items: center;
    gap: 20px;
    margin: auto 0;
}

@media (max-width: 800px) {
    .association-arena {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 12px;
    }
}

/* Tarjeta Objetivo Gigante */
.target-huge-card {
    background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
    border: 4px solid #38BDF8;
    border-radius: 28px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 220px;
    max-height: 320px;
    box-shadow: 0 15px 40px rgba(56, 189, 248, 0.25);
    animation: gentleBob 3s ease-in-out infinite;
}

.target-huge-icon {
    font-size: 6.5rem;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}

.target-huge-label {
    font-size: 1.6rem;
    font-weight: 900;
    color: #F8FAFC;
    margin-top: 8px;
}

.magic-arrow-sign {
    color: #F59E0B;
    font-size: 2.4rem;
    text-align: center;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5));
}

@media (max-width: 800px) {
    .magic-arrow-sign {
        display: none;
    }
}

/* 3 Opciones Gigantes */
.choices-huge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    height: 100%;
    max-height: 320px;
}

@media (max-width: 800px) {
    .choices-huge-grid {
        grid-template-columns: repeat(3, 1fr);
        max-height: 180px;
    }
}

@media (max-width: 500px) {
    .choices-huge-grid {
        grid-template-columns: 1fr;
        max-height: none;
    }
}

.choice-huge-card {
    background: rgba(30, 41, 59, 0.9);
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.choice-huge-card:hover {
    background: rgba(51, 65, 85, 0.95);
    border-color: #FFFFFF;
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 18px 40px rgba(0,0,0,0.6);
}

.choice-huge-card:active {
    transform: scale(0.94);
}

.choice-huge-icon {
    font-size: 5rem;
    filter: drop-shadow(0 8px 15px rgba(0,0,0,0.4));
    transition: transform 0.2s;
}

.choice-huge-card:hover .choice-huge-icon {
    transform: scale(1.1);
}

.choice-huge-label {
    font-size: 1.35rem;
    font-weight: 800;
    color: #FFFFFF;
    margin-top: 6px;
}

@media (max-width: 800px) {
    .choice-huge-icon {
        font-size: 3.5rem;
    }
    .choice-huge-label {
        font-size: 1.05rem;
    }
}

/* Estados de Acierto y Error */
.choice-huge-card.correct {
    background: linear-gradient(135deg, #059669 0%, #10B981 100%) !important;
    border-color: #34D399 !important;
    box-shadow: 0 0 35px rgba(16, 185, 129, 0.9) !important;
    animation: victoryBounce 0.5s ease;
}

.choice-huge-card.wrong {
    background: linear-gradient(135deg, #991B1B 0%, #EF4444 100%) !important;
    border-color: #F87171 !important;
    animation: gentleWiggle 0.4s ease;
}

.kids-feedback-banner {
    display: none;
    align-items: center;
    gap: 10px;
    background: rgba(16, 185, 129, 0.95);
    padding: 8px 24px;
    border-radius: 99px;
    font-size: 1.25rem;
    font-weight: 900;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
    animation: slideUp 0.3s ease;
}

.kids-feedback-banner.active {
    display: flex;
}

.kids-feedback-banner.wrong {
    background: rgba(245, 158, 11, 0.95);
}

/* ==========================================================================
   5. ACTIVIDAD 2: MEMOTEST LIMPIO (2x2 a 6x6)
   ========================================================================== */
.memo-levels-bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

.memo-pill {
    background: rgba(30, 41, 59, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #E2E8F0;
    font-family: var(--font-kids);
    font-size: 1rem;
    font-weight: 800;
    padding: 6px 16px;
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.2s;
}

.memo-pill.active {
    background: #F59E0B;
    border-color: #FDE047;
    color: #0F172A;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
    transform: scale(1.08);
}

.memo-mini-stats {
    background: #0284C7;
    color: #FFFFFF;
    font-size: 1.1rem;
    font-weight: 900;
    padding: 6px 14px;
    border-radius: 99px;
}

/* Arena Memotest */
.memotest-arena {
    flex: 1;
    width: 100%;
    max-width: 820px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto 0;
}

.memotest-grid {
    display: grid;
    gap: 10px;
    width: 100%;
    max-height: calc(100vh - 200px);
    aspect-ratio: 1;
    perspective: 1000px;
    margin: 0 auto;
}

.memotest-grid.grid-2x2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 320px;
}
.memotest-grid.grid-2x4 {
    grid-template-columns: repeat(4, 1fr);
    aspect-ratio: 2 / 1;
    max-width: 580px;
}
.memotest-grid.grid-4x4 {
    grid-template-columns: repeat(4, 1fr);
    max-width: 520px;
}
.memotest-grid.grid-4x5 {
    grid-template-columns: repeat(5, 1fr);
    aspect-ratio: 5 / 4;
    max-width: 620px;
}
.memotest-grid.grid-6x6 {
    grid-template-columns: repeat(6, 1fr);
    max-width: 560px;
    gap: 6px;
}

/* Cartas 3D Flip */
.memo-card {
    aspect-ratio: 1;
    background: transparent;
    cursor: pointer;
}

.memo-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    border-radius: 18px;
}

.memo-card.flipped .memo-card-inner,
.memo-card.matched .memo-card-inner {
    transform: rotateY(180deg);
}

.memo-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    border: 3.5px solid rgba(255, 255, 255, 0.25);
}

.memo-card-back {
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #0369A1 100%);
    border-color: #38BDF8;
    color: #FDE047;
    font-size: 2.4rem;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(253, 224, 71, 0.8);
}

.memo-card-front {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    border-color: #F59E0B;
    transform: rotateY(180deg);
    font-size: 3.4rem;
}

.memo-card.matched .memo-card-front {
    background: linear-gradient(135deg, #065F46 0%, #047857 100%);
    border-color: #34D399;
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.8);
    animation: victoryBounce 0.4s ease;
}

/* Ajustes tamaño 6x6 */
.memotest-grid.grid-6x6 .memo-card-face {
    border-radius: 10px;
    border-width: 2px;
}
.memotest-grid.grid-6x6 .memo-card-front {
    font-size: 1.8rem;
}
.memotest-grid.grid-6x6 .memo-card-back {
    font-size: 1.4rem;
}

/* ==========================================================================
   6. MODALES DE DIPLOMA Y VICTORIA
   ========================================================================== */
.diploma-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 17, 0.95);
    backdrop-filter: blur(14px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
}

.diploma-modal-overlay.active {
    display: flex;
}

.diploma-card {
    background: #FFFFFF;
    color: #0F172A;
    width: 100%;
    max-width: 620px;
    border-radius: 28px;
    border: 8px solid #38BDF8;
    padding: 30px;
    text-align: center;
    box-shadow: 0 25px 70px rgba(0,0,0,0.8);
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.diploma-badge {
    background: #0284C7;
    color: #FFFFFF;
    font-size: 0.9rem;
    font-weight: 900;
    padding: 5px 18px;
    border-radius: 99px;
    display: inline-block;
    margin-bottom: 6px;
}

.diploma-title {
    font-size: 2rem;
    font-weight: 900;
    color: #0F172A;
}

.diploma-subtitle {
    font-size: 0.95rem;
    color: #64748B;
    margin-bottom: 14px;
}

.diploma-mascot {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    border: 3px solid #38BDF8;
    margin-bottom: 12px;
}

.diploma-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

.student-input-box {
    margin-bottom: 14px;
}

.student-name-input {
    width: 85%;
    max-width: 380px;
    padding: 10px 16px;
    font-family: var(--font-kids);
    font-size: 1.3rem;
    font-weight: 900;
    text-align: center;
    color: #0284C7;
    background: #F0F9FF;
    border: 3px dashed #38BDF8;
    border-radius: 16px;
    outline: none;
}

.diploma-desc {
    font-size: 1rem;
    color: #475569;
    margin-bottom: 20px;
}

.diploma-footer-row {
    display: flex;
    justify-content: space-between;
    border-top: 2px dashed #CBD5E1;
    padding-top: 12px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #64748B;
}

.diploma-stamp {
    color: #F59E0B;
    font-weight: 800;
}

.diploma-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.btn-diploma {
    font-family: var(--font-kids);
    font-size: 1.05rem;
    font-weight: 900;
    padding: 12px 22px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.btn-memotest {
    background: linear-gradient(135deg, #4F46E5 0%, #0284C7 100%);
    color: #FFFFFF;
}

.btn-print {
    background: #10B981;
    color: #FFFFFF;
}

.btn-restart {
    background: #F59E0B;
    color: #0F172A;
}

.btn-diploma:hover {
    transform: scale(1.05);
}

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

@keyframes victoryBounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.15) rotate(3deg); }
    70% { transform: scale(0.95) rotate(-3deg); }
    100% { transform: scale(1); }
}

@keyframes gentleWiggle {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

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

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
