/* Estilos de los Juegos y Tableros Interactivos */

/* Barra de Encabezado de cada juego */
.game-header {
    height: 78px;
    background: #FFFFFF;
    border-bottom: 3px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.game-instruction {
    font-size: 22px;
    font-weight: 600;
    color: #1E293B;
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-counter {
    background: #FFF9C4;
    border: 3px solid #FBC02D;
    color: #E65100;
    padding: 8px 22px;
    border-radius: 35px;
    font-size: 22px;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}

.stage-pills {
    display: flex;
    gap: 10px;
}

.pill-btn {
    border: 3px solid #CBD5E0;
    background: #F8FAFC;
    padding: 8px 20px;
    border-radius: 25px;
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.pill-btn.active {
    background: #FFD54F;
    border-color: #FFA000;
    color: #3E2723;
    transform: scale(1.06);
    box-shadow: 0 3px 8px rgba(255, 160, 0, 0.3);
}

/* Canvas Wrappers */
.canvas-wrapper {
    width: 100%;
    height: calc(100% - 78px);
    position: relative;
    overflow: hidden;
}

.canvas-wrapper canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.night-sky-bg {
    background: radial-gradient(circle at center bottom, #1A237E 0%, #0D1B2A 70%, #050B14 100%);
}

.garden-grass-bg {
    background: radial-gradient(circle at 50% 60%, #C8E6C9 0%, #A5D6A7 50%, #81C784 100%);
}

.chalkboard-bg {
    background: radial-gradient(circle at center, #263238 0%, #1A202C 100%);
}

/* 1° Preescolar - Limpia la Ventana */
.cleaner-wrapper {
    width: 100%;
    height: calc(100% - 78px);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ECEFF1;
}

.cleaner-underlay {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.animal-name-badge {
    margin-top: 15px;
    background: #FFFFFF;
    padding: 8px 24px;
    border-radius: 25px;
    font-size: 24px;
    font-weight: 700;
    color: #E65100;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.cleaner-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

.animal-bounce {
    animation: bounceHappy 0.6s ease infinite alternate;
}

@keyframes bounceHappy {
    from { transform: scale(1) translateY(0); }
    to { transform: scale(1.1) translateY(-20px); }
}

/* 2° Preescolar - Toca al Animalito (Clicker) */
.clicker-field {
    width: 100%;
    height: calc(100% - 78px);
    background: linear-gradient(180deg, #B2EBF2 0%, #C8E6C9 60%, #81C784 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mole-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 40px;
    max-width: 800px;
    width: 100%;
}

.mole-hole {
    height: 150px;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}

.mole-mound {
    position: absolute;
    bottom: 0;
    width: 150px;
    height: 50px;
    background: #6D4C41;
    border-radius: 50% 50% 10px 10px;
    border: 4px solid #4E342E;
    z-index: 3;
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.3);
}

.mole-character {
    position: absolute;
    bottom: -120px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: bottom 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}

.mole-character.mole-up {
    bottom: 25px;
}

.mole-character.mole-hit {
    transform: scale(1.2) rotate(15deg);
    transition: transform 0.2s;
}

.mole-emoji {
    font-size: 72px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.floating-feedback {
    position: fixed;
    font-size: 40px;
    pointer-events: none;
    z-index: 9999;
    animation: floatUpFade 1s forwards ease-out;
}

@keyframes floatUpFade {
    0% { transform: translateY(0) scale(0.6); opacity: 1; }
    100% { transform: translateY(-80px) scale(1.3); opacity: 0; }
}

/* 2° Preescolar - Colorea con un Toque */
.coloring-workspace {
    width: 100%;
    height: calc(100% - 78px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: #FFFDE7;
}

.palette-bar {
    display: flex;
    gap: 15px;
    background: #FFFFFF;
    padding: 10px 20px;
    border-radius: 40px;
    box-shadow: var(--card-shadow);
    z-index: 10;
}

.color-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid #FFFFFF;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
}

.color-label {
    display: none;
}

.color-btn.selected {
    transform: scale(1.25);
    border-color: #2D3748;
}

.canvas-art-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.coloring-svg {
    max-height: 70vh;
    max-width: 90vw;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.08));
}

.color-target {
    cursor: pointer;
    transition: fill 0.25s ease, stroke 0.25s ease;
}

.color-target:hover {
    filter: brightness(0.92);
}

.pulse-paint {
    animation: pulseGlow 0.4s ease;
}

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

/* 3° Preescolar - Clasificación y Encaje */
.dragdrop-workspace {
    width: 100%;
    height: calc(100% - 78px);
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 20px 40px;
    background: #F0F4F8;
}

.slots-container {
    display: flex;
    gap: 25px;
    justify-content: center;
    width: 100%;
}

.target-slot {
    width: 140px;
    height: 140px;
    border: 4px dashed #CBD5E0;
    border-radius: var(--border-radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.target-slot.slot-filled {
    border-style: solid;
    border-width: 4px;
    animation: snapPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.slot-icon {
    font-size: 30px;
}

.slot-name {
    font-size: 16px;
    font-weight: 700;
    color: #4A5568;
}

.drag-items-container {
    display: flex;
    gap: 35px;
    justify-content: center;
    align-items: center;
    min-height: 130px;
}

.draggable-piece {
    width: 110px;
    height: 110px;
    background: #FFFFFF;
    border-radius: var(--border-radius-xl);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 3px solid #E2E8F0;
}

.draggable-piece:hover {
    transform: scale(1.08);
}

.draggable-piece.is-dragging {
    cursor: grabbing;
    transform: scale(1.2);
    box-shadow: 0 15px 30px rgba(0,0,0,0.25);
}

.draggable-piece.locked-in {
    cursor: default;
    box-shadow: none;
    border-color: transparent;
    background: transparent;
}

.piece-emoji {
    font-size: 58px;
    pointer-events: none;
}

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

/* 3° Preescolar - Mini Rompecabezas */
.puzzle-workspace {
    width: 100%;
    height: calc(100% - 78px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 50px;
    background: #FFF8E1;
    padding: 20px;
}

.puzzle-board {
    width: 320px;
    height: 320px;
    background: #8D6E63;
    border: 12px solid #5D4037;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 6px;
    padding: 6px;
    transition: transform 0.5s ease;
}

.puzzle-board.board-complete {
    animation: bounceHappy 0.6s ease infinite alternate;
    border-color: #FFA000;
}

.puzzle-slot {
    background: #D7CCC8;
    border-radius: 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-hint {
    font-size: 32px;
    font-weight: 700;
    color: rgba(93, 64, 55, 0.35);
}

.puzzle-tray {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background: #FFFFFF;
    padding: 20px;
    border-radius: 24px;
    box-shadow: var(--card-shadow);
}

.puzzle-tile {
    width: 130px;
    height: 130px;
    background: #FFFFFF;
    border: 3px solid #E0E0E0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.15s;
}

.puzzle-tile:hover {
    transform: scale(1.05);
}

.puzzle-tile.is-dragging {
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow: 0 12px 25px rgba(0,0,0,0.2);
}

.puzzle-tile.tile-locked {
    cursor: default;
    box-shadow: none;
    border: none;
}

.tile-icon {
    font-size: 46px;
    pointer-events: none;
}

/* Botón gigante para jugar de nuevo */
.btn-huge {
    padding: 10px 25px;
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    background: #4CAF50;
    color: #FFFFFF;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    margin-left: 20px;
}

.btn-pulse {
    animation: btnPulse 1.5s infinite;
}

@keyframes btnPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* Fondos adicionales */
.aquarium-bg {
    background: radial-gradient(circle at center top, #4DD0E1 0%, #0097A7 60%, #006064 100%);
}

.sky-clouds-bg {
    background: linear-gradient(180deg, #81D4FA 0%, #E1F5FE 85%, #B2EBF2 100%);
}

/* Xilófono de Animales */
.xylophone-workspace {
    width: 100%;
    height: calc(100% - 78px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #FFFDE7 0%, #FFF9C4 100%);
    padding: 20px;
}

.xylophone-frame {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #5D4037;
    padding: 25px 30px;
    border-radius: 28px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.25);
    border: 6px solid #3E2723;
}

.xylo-bar {
    width: 80px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 12px 6px;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0,0,0,0.18);
    transition: transform 0.12s, filter 0.12s;
    user-select: none;
}

.xylo-bar[data-index="0"] { height: 340px; }
.xylo-bar[data-index="1"] { height: 320px; }
.xylo-bar[data-index="2"] { height: 300px; }
.xylo-bar[data-index="3"] { height: 280px; }
.xylo-bar[data-index="4"] { height: 260px; }
.xylo-bar[data-index="5"] { height: 240px; }
.xylo-bar[data-index="6"] { height: 220px; }

.xylo-bar:hover {
    transform: translateY(-6px);
    filter: brightness(1.1);
}

.xylo-bar.bar-hit {
    transform: scale(0.94) translateY(6px);
}

.xylo-bar.bar-highlight {
    animation: barPulse 1s infinite alternate;
    outline: 4px solid #FFFFFF;
}

@keyframes barPulse {
    from { box-shadow: 0 0 10px #FFFFFF; }
    to { box-shadow: 0 0 25px #FFD54F; }
}

.xylo-screw {
    width: 12px;
    height: 12px;
    background: #ECEFF1;
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

.xylo-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.xylo-animal {
    font-size: 38px;
    pointer-events: none;
}

.xylo-note {
    font-size: 20px;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    pointer-events: none;
}

/* Viste al Osito */
.dressup-workspace {
    width: 100%;
    height: calc(100% - 78px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    background: #E8F5E9;
    padding: 20px;
}

.bear-display {
    position: relative;
    width: 300px;
    height: 400px;
}

.bear-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.15));
}

.bear-slot {
    position: absolute;
    border: 3px dashed #81C784;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.bear-slot#slot-hat { top: 0px; left: 95px; width: 110px; height: 75px; }
.bear-slot#slot-glasses { top: 95px; left: 105px; width: 90px; height: 45px; }
.bear-slot#slot-shirt { top: 195px; left: 85px; width: 130px; height: 110px; }
.bear-slot#slot-shoes { top: 330px; left: 75px; width: 150px; height: 55px; }

.slot-dashed-outline {
    font-size: 26px;
    opacity: 0.4;
}

.bear-slot.slot-filled {
    border-style: solid;
    border-color: transparent;
    background: transparent;
}

.closet-rack {
    background: #FFFFFF;
    border-radius: 28px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 280px;
}

.closet-title {
    font-size: 20px;
    color: #2E7D32;
    text-align: center;
}

.closet-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.closet-item {
    background: #F1F8E9;
    border: 2px solid #C8E6C9;
    border-radius: 16px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: grab;
    transition: transform 0.15s, box-shadow 0.15s;
}

.closet-item:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.closet-item.is-dragging {
    cursor: grabbing;
    transform: scale(1.2);
    box-shadow: 0 12px 24px rgba(0,0,0,0.25);
}

.closet-item.item-placed {
    cursor: default;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.closet-icon {
    font-size: 34px;
    pointer-events: none;
}

.closet-name {
    font-size: 15px;
    font-weight: 600;
    color: #37474F;
    pointer-events: none;
}

.closet-item.item-placed .closet-name {
    display: none;
}

.closet-item.item-placed .closet-icon {
    font-size: 50px;
}

/* ==========================================================
   ADAPTACIONES DE MINIJUEGOS PARA PANTALLAS PEQUEÑAS
   (720p, 768p, netbooks de 10 a 14 pulgadas)
   ========================================================== */
@media (max-height: 820px) or (max-width: 1200px) {
    .game-header {
        height: 64px;
        padding: 0 16px;
    }
    .game-instruction {
        font-size: 18px;
        gap: 8px;
    }
    .game-counter {
        font-size: 18px;
        padding: 6px 16px;
    }
    .pill-btn {
        padding: 6px 16px;
        font-size: 16px;
    }
    .canvas-wrapper,
    .cleaner-wrapper,
    .clicker-field,
    .coloring-workspace,
    .dragdrop-workspace,
    .puzzle-workspace,
    .xylophone-workspace,
    .dressup-workspace {
        height: calc(100% - 64px) !important;
    }

    /* Xilófono en pantallas bajas */
    .xylo-bar {
        width: 65px;
        border-radius: 12px;
    }
    .xylo-bar[data-index="0"] { height: 260px; }
    .xylo-bar[data-index="1"] { height: 245px; }
    .xylo-bar[data-index="2"] { height: 230px; }
    .xylo-bar[data-index="3"] { height: 215px; }
    .xylo-bar[data-index="4"] { height: 200px; }
    .xylo-bar[data-index="5"] { height: 185px; }
    .xylo-bar[data-index="6"] { height: 170px; }
    .xylo-animal { font-size: 30px; }
    .xylo-note { font-size: 16px; }

    /* Viste al Osito en pantallas bajas */
    .dressup-workspace {
        gap: 30px;
        padding: 10px;
    }
    .bear-display {
        transform: scale(0.85);
        transform-origin: center center;
    }
    .closet-rack {
        width: 240px;
        padding: 16px;
        gap: 10px;
    }

    /* Rompecabezas en pantallas bajas */
    .puzzle-workspace {
        gap: 30px;
        padding: 10px;
    }
    .puzzle-board {
        width: 260px;
        height: 260px;
    }
    .puzzle-tray {
        gap: 12px;
        padding: 12px;
    }
    .puzzle-tile {
        width: 105px;
        height: 105px;
    }
    .tile-icon {
        font-size: 38px;
    }

    /* Clasificación y Encaje */
    .dragdrop-workspace {
        padding: 12px 20px;
    }
    .target-slot {
        width: 115px;
        height: 115px;
    }
    .draggable-piece {
        width: 95px;
        height: 95px;
    }
    .piece-emoji {
        font-size: 48px;
    }

    /* Coloreo */
    .coloring-svg {
        max-height: 58vh;
    }
    .color-btn {
        width: 48px;
        height: 48px;
    }
}
