/* ============================================
   RESET BÁSICO
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    background: transparent;
}

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */
.kiosk-container {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow: hidden;
}

/* ============================================
   FONDO CON TOQUE INFANTIL
   ============================================ */
.roman-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(135deg, #8b4513 0%, #d2691e 100%),
        url('../images/patron-medieval-infantil.png');
    background-size: cover, 200px 200px;
    background-blend-mode: overlay;
    opacity: 0.9;
    z-index: -1;
}

/* Patrón de estrellas y castillos sutil */
.roman-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255,215,0,0.1) 2%, transparent 4%),
        radial-gradient(circle at 80% 20%, rgba(255,215,0,0.1) 2%, transparent 4%),
        radial-gradient(circle at 40% 40%, rgba(210,105,30,0.1) 3%, transparent 5%);
    background-size: 400px 400px;
    animation: floatBackground 20s linear infinite;
}

@keyframes floatBackground {
    0% { background-position: 0 0; }
    100% { background-position: 400px 400px; }
}

/* ============================================
   CABECERA INFANTIL
   ============================================ */
.roman-header {
    flex: 0 0 auto;
    text-align: center;
    padding: 20px 20px 15px;
    background: rgba(255, 248, 220, 0.9);
    border-bottom: 5px solid #ffd700;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3);
    position: relative;
    z-index: 2;
}

.roman-header::before {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 30px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 30'%3E%3Cpath d='M0,0 Q100,30 200,0' fill='%23ffd700'/%3E%3C/svg%3E") no-repeat center;
}

.main-title {
    font-size: 2.8rem;
    color: #8b4513;
    margin: 0;
    line-height: 1;
    text-align: center;
    font-weight: 800;
    text-shadow: 2px 2px 0 #ffd700;
    letter-spacing: 1px;
}

.title-highlight {
    color: #d2691e;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    padding: 0 15px;
    border-radius: 20px;
    display: inline-block;
    transform: rotate(-2deg);
    box-shadow: 3px 3px 0 #8b4513;
}

.subtitle {
    font-size: 1.3rem;
    color: #a0522d;
    margin-top: 10px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 1px;
}

.header-decoration {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
}

.header-decoration i {
    font-size: 1.8rem;
    color: #ffd700;
    text-shadow: 2px 2px 0 #8b4513;
    animation: bounce 2s infinite;
}

.header-decoration i:nth-child(2) {
    animation-delay: 0.3s;
}

.header-decoration i:nth-child(3) {
    animation-delay: 0.6s;
}

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

/* ============================================
   CONTENEDOR DEL MENÚ
   ============================================ */
.games-menu {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

/* ============================================
   GRID DE JUEGOS - 3×2 en desktop
   ============================================ */
.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    padding: 10px;
}

/* ============================================
   TARJETAS DE JUEGO INFANTILES
   ============================================ */
.game-card {
    background: linear-gradient(145deg, #fff8dc, #ffe4b5);
    border: none;
    border-radius: 25px;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 280px;
    border: 6px solid #ffd700;
    box-shadow: 
        0 10px 25px rgba(139, 69, 19, 0.4),
        inset 0 0 30px rgba(255, 215, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
    overflow: hidden;
    position: relative;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 15px 35px rgba(139, 69, 19, 0.6),
        inset 0 0 40px rgba(255, 215, 0, 0.3);
}

.game-card:active {
    transform: translateY(-4px) scale(0.98);
    transition: all 0.1s ease;
}

/* Imagen del juego */
/* ============================================
   TARJETAS DE JUEGO INFANTILES
   ============================================ */
.card-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
    border-bottom: 4px solid #ffd700;
    position: relative;
    display: flex;           /* ← AÑADIDO */
    align-items: center;     /* ← AÑADIDO */
    justify-content: center; /* ← AÑADIDO */
    background: linear-gradient(135deg, #f5deb3, #ffe4b5); /* Fondo por si acaso */
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 5px; /* ← Pequeño margen interno */
}

.game-card:hover .card-image img {
    transform: scale(1.1);
}



/* Contenido de la tarjeta */
.card-content {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, #fff8dc, #f5deb3);
}

.card-icon {
    font-size: 2rem;
    color: #d2691e;
    margin-bottom: 8px;
    text-shadow: 1px 1px 0 #ffd700;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 5px;
    color: #8b4513;
    text-align: center;
    line-height: 1.2;
}

.card-description {
    font-size: 0.95rem;
    color: #a0522d;
    text-align: center;
    line-height: 1.3;
    font-weight: 600;
}

/* Efecto de brillo */
.game-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.7s ease;
}

.game-card:hover::after {
    left: 100%;
}

/* ============================================
   FOOTER INFANTIL
   ============================================ */
.roman-footer {
    flex: 0 0 auto;
    background: rgba(139, 69, 19, 0.9);
    padding: 15px;
    border-top: 5px solid #ffd700;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: #fff8dc;
    font-size: 1.1rem;
    font-weight: 700;
}

.footer-content i {
    font-size: 1.5rem;
    color: #ffd700;
    animation: pulse 1.5s infinite;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */

/* Pantallas grandes (40-55") */
@media (min-width: 1920px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 1fr);
        max-width: 1400px;
        gap: 25px;
    }
    
    .game-card {
        height: 320px;
    }
    
    .card-image {
        height: 180px;
    }
    
    .card-title {
        font-size: 1.5rem;
    }
    
    .card-description {
        font-size: 1.1rem;
    }
    
    .main-title {
        font-size: 3.5rem;
    }
}

/* Tablets y pantallas medianas */
@media (max-width: 1366px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
        max-width: 900px;
        gap: 15px;
    }
    
    .game-card {
        height: 250px;
    }
    
    .card-image {
        height: 140px;
    }
    
    .main-title {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
}

/* Tablets pequeñas */
@media (max-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
        gap: 12px;
        max-width: 700px;
    }
    
    .game-card {
        height: 220px;
        border-width: 4px;
    }
    
    .card-image {
        height: 120px;
    }
    
    .card-title {
        font-size: 1.2rem;
    }
    
    .card-description {
        font-size: 0.9rem;
    }
}

/* Móviles */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(6, 1fr);
        gap: 10px;
        max-width: 400px;
    }
    
    .game-card {
        height: 200px;
        flex-direction: row;
        padding: 0;
    }
    
    .card-image {
        width: 40%;
        height: 100%;
        border-bottom: none;
        border-right: 4px solid #ffd700;
    }
    
    .card-content {
        width: 60%;
        padding: 10px;
    }
    
    .main-title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .header-decoration {
        gap: 15px;
    }
    
    .header-decoration i {
        font-size: 1.3rem;
    }
    
    .footer-content {
        font-size: 0.9rem;
        gap: 10px;
    }
}

/* Pantallas con poca altura */
@media (max-height: 700px) {
    .games-grid {
        max-height: 60vh;
        overflow-y: auto;
        padding-right: 5px;
    }
    
    .games-grid::-webkit-scrollbar {
        width: 8px;
    }
    
    .games-grid::-webkit-scrollbar-track {
        background: #f5deb3;
        border-radius: 4px;
    }
    
    .games-grid::-webkit-scrollbar-thumb {
        background: #d2691e;
        border-radius: 4px;
    }
    
    .game-card {
        height: 180px;
    }
    
    .card-image {
        height: 100px;
    }
}

/* Orientación horizontal en móviles */
@media (max-height: 500px) and (orientation: landscape) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 1fr);
        max-height: 70vh;
        gap: 8px;
    }
    
    .game-card {
        height: 160px;
        flex-direction: column;
    }
    
    .card-image {
        width: 100%;
        height: 80px;
        border-right: none;
        border-bottom: 4px solid #ffd700;
    }
    
    .card-content {
        width: 100%;
        padding: 8px;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .card-description {
        font-size: 0.8rem;
        display: block;
    }
    
    .roman-header {
        padding: 10px;
    }
    
    .main-title {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
        margin-top: 5px;
    }
}

/* Efectos de sonido visuales */
.game-card:active {
    animation: clickEffect 0.3s ease;
}

@keyframes clickEffect {
    0% { box-shadow: 0 10px 25px rgba(139, 69, 19, 0.4); }
    50% { box-shadow: 0 5px 15px rgba(139, 69, 19, 0.6); }
    100% { box-shadow: 0 10px 25px rgba(139, 69, 19, 0.4); }
}

/* Modo alto contraste para accesibilidad */
@media (prefers-contrast: high) {
    .game-card {
        border: 4px solid #000;
        box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    }
    
    .card-title {
        color: #000;
        text-shadow: none;
    }
    
    .main-title {
        color: #000;
        text-shadow: none;
    }
    
    .title-highlight {
        color: #000;
        background: #fff;
    }
}