/* Estilos Generales - Mundo Motricidad Preescolar */
:root {
    --primary-sky: #48CAE4;
    --primary-sun: #FFD166;
    --primary-coral: #FF6B6B;
    --primary-mint: #06D6A0;
    --primary-purple: #9D4EDD;
    --bg-gradient: linear-gradient(135deg, #E0F7FA 0%, #FFFDE7 50%, #F3E5F5 100%);
    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    --border-radius-xl: 24px;
    --border-radius-lg: 18px;
    --border-radius-md: 12px;
}

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

body {
    font-family: 'Segoe UI', 'Comic Sans MS', 'Fredoka', 'Nunito', 'Arial', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    overflow: hidden;
    color: #2D3748;
    cursor: none; /* Reemplazado por el cursor infantil */
}

/* Permitir cursor default si se desactiva */
body.default-cursor {
    cursor: auto;
}

/* Barra superior / Cabecera (Amplia y visible para niños) */
.app-header {
    height: 88px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    border-bottom: 4px solid rgba(255, 209, 102, 0.8);
    position: relative;
    z-index: 100;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-badge {
    font-size: 42px;
    animation: float 3s ease-in-out infinite;
}

.brand-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(45deg, #FF6B6B, #9D4EDD, #00B4D8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

/* Pestañas de Grados de Preescolar */
.grade-tabs {
    display: flex;
    gap: 12px;
    background: #E2E8F0;
    padding: 6px;
    border-radius: 40px;
}

.grade-tab-btn {
    border: none;
    background: transparent;
    padding: 10px 22px;
    font-family: inherit;
    font-size: 18px;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.grade-tab-btn:hover {
    background: rgba(255, 255, 255, 0.7);
}

.grade-tab-btn.active {
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: scale(1.05);
}

.grade-tab-btn[data-grade="1"].active {
    border-bottom: 4px solid #06D6A0;
}
.grade-tab-btn[data-grade="2"].active {
    border-bottom: 4px solid #FFD166;
}
.grade-tab-btn[data-grade="3"].active {
    border-bottom: 4px solid #FF6B6B;
}

/* Controles de Utilidad (Voz, Sonido, Pantalla Completa, Skins) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Botón Grande Especial de la Casita (Inicio) */
.btn-home-special {
    width: auto !important;
    height: 56px !important;
    padding: 6px 22px !important;
    border-radius: 30px !important;
    background: linear-gradient(135deg, #FFF176 0%, #FFD54F 100%) !important;
    border: 3px solid #FF8F00 !important;
    color: #3E2723 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    font-weight: 700 !important;
    font-size: 20px !important;
    box-shadow: 0 4px 12px rgba(255, 143, 0, 0.3) !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-home-special .home-icon {
    font-size: 34px !important;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.15));
}

.btn-home-special:hover {
    transform: scale(1.08) !important;
    background: linear-gradient(135deg, #FFEE58 0%, #FFCA28 100%) !important;
    box-shadow: 0 6px 16px rgba(255, 143, 0, 0.45) !important;
}

/* Botones de acción grandes (54px) con iconos de 28px */
.action-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 3px solid #CBD5E1;
    background: #FFFFFF;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 3px 6px rgba(0,0,0,0.08);
}

.action-btn:hover {
    transform: scale(1.12);
    background: #FFF9C4;
    border-color: #FFD54F;
    box-shadow: 0 5px 12px rgba(0,0,0,0.12);
}

/* Selector de Skin de Cursor (Iconos agrandados a 44px) */
.cursor-skin-picker {
    display: flex;
    background: #E2E8F0;
    padding: 6px;
    border-radius: 28px;
    gap: 6px;
}

.cursor-skin-opt {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.cursor-skin-opt.active {
    background: #FFFFFF;
    box-shadow: 0 3px 8px rgba(0,0,0,0.18);
    transform: scale(1.15);
}

/* Contenedor Principal del Escenario */
#game-stage {
    height: calc(100vh - 88px);
    width: 100vw;
    position: relative;
    overflow: hidden;
}

/* Lobby de Juegos (Pantalla Principal de Opciones) */
.lobby-screen {
    max-width: 1180px;
    margin: 20px auto 0 auto;
    padding: 0 20px 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.4s ease;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
}

/* Banner Hero con Mascota Amigable */
.lobby-hero-banner {
    background: #FFFFFF;
    border: 4px solid #FCD34D;
    border-radius: 28px;
    padding: 20px 28px;
    display: flex;
    align-items: center;
    gap: 25px;
    box-shadow: 0 8px 24px rgba(251, 191, 36, 0.18);
    position: relative;
    overflow: hidden;
}

.hero-mascot-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 95px;
}

.hero-mascot-emoji {
    font-size: 72px;
    animation: mascotBounce 2.5s infinite ease-in-out;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

@keyframes mascotBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    30% { transform: translateY(-10px) rotate(-6deg); }
    60% { transform: translateY(-4px) rotate(6deg); }
}

.hero-mascot-stars {
    font-size: 16px;
    margin-top: 2px;
}

.hero-text-box {
    flex: 1;
}

.hero-title {
    font-size: 28px;
    font-weight: 800;
    color: #1E293B;
    margin-bottom: 6px;
}

.hero-subtitle {
    font-size: 18px;
    color: #475569;
    margin-bottom: 14px;
    font-weight: 600;
}

.hero-grade-pills {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-grade-pill {
    border: 3px solid #CBD5E1;
    background: #F8FAFC;
    padding: 8px 20px;
    border-radius: 25px;
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-grade-pill:hover {
    transform: scale(1.05);
    background: #FFFFFF;
}

.hero-grade-pill.active {
    background: #FFD54F;
    border-color: #FFA000;
    color: #3E2723;
    box-shadow: 0 4px 12px rgba(255, 160, 0, 0.35);
    transform: scale(1.06);
}

/* Cuadrícula de Tarjetas de Juegos Dulces y Llamativas */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 22px;
}

.game-card {
    border-radius: 28px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border-width: 4px;
    border-style: solid;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.game-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.15);
}

.card-deco-stars {
    position: absolute;
    top: 14px;
    right: 18px;
    font-size: 22px;
    opacity: 0.8;
}

.game-card-icon-bubble {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    margin-bottom: 14px;
    border: 4px solid rgba(255,255,255,0.9);
}

.game-card-icon {
    font-size: 60px;
    animation: gentleWiggle 4s ease-in-out infinite;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.game-card-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

.game-card-title {
    font-size: 23px;
    font-weight: 800;
    margin-bottom: 6px;
    color: #1E293B;
}

.game-card-desc {
    font-size: 15px;
    line-height: 1.4;
    color: #475569;
    margin-bottom: 18px;
    min-height: 42px;
}

.game-card-play-btn {
    width: 100%;
    padding: 13px 20px;
    border-radius: 20px;
    border: none;
    font-family: inherit;
    font-size: 19px;
    font-weight: 800;
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 5px 14px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

.game-card:hover .game-card-play-btn {
    transform: scale(1.04);
}

/* Paletas Temáticas Específicas por Tarjeta (Super Bonitas y Llamativas) */
/* 1. Rosa / Fresa */
.card-theme-pink {
    background: linear-gradient(145deg, #FFF0F5 0%, #FFE4E6 100%);
    border-color: #FB7185;
}
.card-theme-pink .game-card-badge { background: #FFE4E6; color: #E11D48; }
.card-theme-pink .game-card-play-btn {
    background: linear-gradient(135deg, #F43F5E 0%, #FB7185 100%);
    box-shadow: 0 6px 16px rgba(244, 63, 94, 0.4);
}

/* 2. Turquesa / Océano */
.card-theme-cyan {
    background: linear-gradient(145deg, #F0FDFA 0%, #CCFBF1 100%);
    border-color: #2DD4BF;
}
.card-theme-cyan .game-card-badge { background: #CCFBF1; color: #0F766E; }
.card-theme-cyan .game-card-play-btn {
    background: linear-gradient(135deg, #0D9488 0%, #14B8A6 100%);
    box-shadow: 0 6px 16px rgba(13, 148, 136, 0.4);
}

/* 3. Morado / Mágico */
.card-theme-purple {
    background: linear-gradient(145deg, #FAF5FF 0%, #F3E8FF 100%);
    border-color: #C084FC;
}
.card-theme-purple .game-card-badge { background: #F3E8FF; color: #7E22CE; }
.card-theme-purple .game-card-play-btn {
    background: linear-gradient(135deg, #9333EA 0%, #A855F7 100%);
    box-shadow: 0 6px 16px rgba(147, 51, 234, 0.4);
}

/* 4. Esmeralda / Naturaleza */
.card-theme-emerald {
    background: linear-gradient(145deg, #F0FDF4 0%, #DCFCE7 100%);
    border-color: #4ADE80;
}
.card-theme-emerald .game-card-badge { background: #DCFCE7; color: #15803D; }
.card-theme-emerald .game-card-play-btn {
    background: linear-gradient(135deg, #16A34A 0%, #22C55E 100%);
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.4);
}

/* 5. Ámbar / Soleado */
.card-theme-amber {
    background: linear-gradient(145deg, #FFFBEB 0%, #FEF3C7 100%);
    border-color: #FBBF24;
}
.card-theme-amber .game-card-badge { background: #FEF3C7; color: #B45309; }
.card-theme-amber .game-card-play-btn {
    background: linear-gradient(135deg, #D97706 0%, #F59E0B 100%);
    box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
}

/* 6. Naranja / Alegre */
.card-theme-orange {
    background: linear-gradient(145deg, #FFF7ED 0%, #FFEDD5 100%);
    border-color: #FB923C;
}
.card-theme-orange .game-card-badge { background: #FFEDD5; color: #C2410C; }
.card-theme-orange .game-card-play-btn {
    background: linear-gradient(135deg, #EA580C 0%, #FB923C 100%);
    box-shadow: 0 6px 16px rgba(234, 88, 12, 0.4);
}

/* 7. Azul / Cielo */
.card-theme-blue {
    background: linear-gradient(145deg, #EFF6FF 0%, #DBEAFE 100%);
    border-color: #60A5FA;
}
.card-theme-blue .game-card-badge { background: #DBEAFE; color: #1D4ED8; }
.card-theme-blue .game-card-play-btn {
    background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* Cursor Infantil Animado */
.kids-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 50px;
    height: 50px;
    margin-left: -15px;
    margin-top: -15px;
    pointer-events: none;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.04s linear;
}

.cursor-icon {
    font-size: 38px;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.25));
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cursor-press .cursor-icon {
    transform: scale(0.75) rotate(-15deg);
}

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

@keyframes gentleWiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-4deg); }
    75% { transform: rotate(4deg); }
}

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

/* ==========================================================
   MODO TURBO / PC DE BAJOS RECURSOS (Ultra-Lightweight Mode)
   Elimina filtros pesados, desenfoques y sombras complejas
   para lograr 60 FPS estables en netbooks y PCs antiguas
   ========================================================== */
body.low-spec-mode {
    --card-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

body.low-spec-mode * {
    text-shadow: none !important;
    filter: none !important;
}

body.low-spec-mode .game-card {
    box-shadow: 0 2px 5px rgba(0,0,0,0.08) !important;
    transform: none !important;
    transition: none !important;
}

body.low-spec-mode .game-card:hover {
    transform: translateY(-2px) !important;
    border-color: #00B4D8 !important;
}

body.low-spec-mode .action-btn:hover {
    transform: none !important;
}

body.low-spec-mode .logo-badge,
body.low-spec-mode .game-card-icon {
    animation: none !important;
}

/* Botón indicador de Modo Turbo */
.action-btn.turbo-active {
    background: #FFD54F !important;
    border-color: #FFA000 !important;
    box-shadow: 0 0 8px #FFD54F !important;
}

/* ==========================================================
   ADAPTACIÓN PARA PANTALLAS CHICAS Y NETBOOKS (720p / 768p / 1024px)
   Ajusta proporciones automáticamente en pantalla completa
   para aprovechar la mejor resolución sin necesidad de scroll
   ========================================================== */
@media (max-height: 820px) or (max-width: 1200px) {
    .app-header {
        height: 72px;
        padding: 0 16px;
    }
    .logo-badge {
        font-size: 32px;
    }
    .brand-title {
        font-size: 22px;
    }
    .grade-tabs {
        gap: 6px;
        padding: 4px;
    }
    .grade-tab-btn {
        padding: 6px 14px;
        font-size: 15px;
    }
    .btn-home-special {
        height: 48px !important;
        padding: 4px 16px !important;
        font-size: 17px !important;
    }
    .btn-home-special .home-icon {
        font-size: 26px !important;
    }
    .action-btn {
        width: 46px;
        height: 46px;
        font-size: 22px;
    }
    .cursor-skin-picker {
        padding: 4px;
        gap: 4px;
    }
    .cursor-skin-opt {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    #game-stage {
        height: calc(100vh - 72px);
    }
    .lobby-screen {
        margin: 12px auto 0 auto;
        padding: 0 16px 20px 16px;
        gap: 16px;
        max-height: calc(100vh - 84px);
    }
    .lobby-hero-banner {
        padding: 12px 18px;
        gap: 16px;
        border-radius: 20px;
    }
    .hero-mascot-emoji {
        font-size: 54px;
    }
    .hero-title {
        font-size: 22px;
        margin-bottom: 4px;
    }
    .hero-subtitle {
        font-size: 15px;
        margin-bottom: 8px;
    }
    .hero-grade-pill {
        padding: 6px 14px;
        font-size: 14px;
    }
    .games-grid {
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
        gap: 16px;
    }
    .game-card {
        padding: 16px 12px;
        border-radius: 20px;
    }
    .game-card-icon-bubble {
        width: 76px;
        height: 76px;
        margin-bottom: 8px;
    }
    .game-card-icon {
        font-size: 46px;
    }
    .game-card-title {
        font-size: 19px;
        margin-bottom: 4px;
    }
    .game-card-desc {
        font-size: 13px;
        margin-bottom: 12px;
        min-height: 34px;
    }
    .game-card-play-btn {
        padding: 10px 14px;
        font-size: 16px;
        border-radius: 16px;
    }
}

@media (max-height: 680px) {
    .app-header {
        height: 60px;
    }
    #game-stage {
        height: calc(100vh - 60px);
    }
    .lobby-screen {
        margin: 8px auto 0 auto;
        gap: 10px;
    }
    .lobby-hero-banner {
        padding: 8px 14px;
    }
    .hero-mascot-emoji {
        font-size: 40px;
    }
    .hero-title {
        font-size: 19px;
    }
    .hero-subtitle {
        display: none; /* Ahorra espacio vertical para ver todas las tarjetas */
    }
    .game-card-desc {
        display: none;
    }
    .game-card-icon-bubble {
        width: 60px;
        height: 60px;
    }
    .game-card-icon {
        font-size: 36px;
    }
}
