/* ===============================
   ESTILOS GENERALES
   =============================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial Black', Arial, sans-serif;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 25%, #CD853F 50%, #DEB887 75%, #F4A460 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===============================
   FONDO PREHISTÓRICO
   =============================== */

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(139, 69, 19, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(160, 82, 45, 0.3) 0%, transparent 50%),
        linear-gradient(180deg, #228B22 0%, #8FBC8F 30%, #F4A460 100%);
    z-index: -1;
}

/* ===============================
   CONTENEDOR PRINCIPAL
   =============================== */

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.game-header {
    text-align: center;
    color: #2F4F4F;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

.game-title {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #8B4513;
}

/* ===============================
   INFORMACIÓN DEL JUEGO
   =============================== */

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(139, 69, 19, 0.8);
    padding: 15px;
    border-radius: 15px;
    color: white;
    font-weight: bold;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
}

/* ===============================
   GRID DEL JUEGO 6x6
   =============================== */

.game-grid {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 3px;
    background: rgba(34, 139, 34, 0.3);
    padding: 15px;
    border-radius: 15px;
    border: 4px solid #8B4513;
    margin-bottom: 20px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.grid-cell {
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #DEB887, #F4A460);
    border: 2px solid #8B4513;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.grid-cell:hover {
    background: linear-gradient(45deg, #F4A460, #FFD700);
    transform: scale(1.05);
}

.grid-cell.occupied {
    cursor: not-allowed;
}

/* ===============================
   PANEL DE SELECCIÓN DE CAVERNÍCOLAS
   =============================== */

.caveman-panel {
    display: flex;
    justify-content: center;
    gap: 20px;
    background: rgba(139, 69, 19, 0.8);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.caveman-card {
    background: linear-gradient(45deg, #CD853F, #DEB887);
    border: 3px solid #8B4513;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.caveman-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.caveman-card.selected {
    border-color: #FFD700;
    background: linear-gradient(45deg, #FFD700, #FFF8DC);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.caveman-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.caveman-image {
    width: 60px;
    height: 60px;
    background: #8B4513;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.caveman-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: #2F4F4F;
}

.caveman-stats {
    font-size: 12px;
    color: #654321;
}

/* ===============================
   ENTIDADES EN EL GRID
   =============================== */

.caveman {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 10px;
    color: white;
    position: relative;
}

.dinosaur {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 10px;
    color: white;
    position: absolute;
    z-index: 10;
}

/* Colores específicos para cada tipo de cavernícola */
.lanzapiedras { 
    background: linear-gradient(45deg, #8B4513, #A0522D); 
}

.fuerte { 
    background: linear-gradient(45deg, #696969, #808080); 
}

.chaman { 
    background: linear-gradient(45deg, #4B0082, #8A2BE2); 
}

/* Colores específicos para cada tipo de dinosaurio */
.trex { 
    background: linear-gradient(45deg, #DC143C, #B22222); 
}

.triceratops { 
    background: linear-gradient(45deg, #228B22, #32CD32); 
}

.velociraptor { 
    background: linear-gradient(45deg, #FF4500, #FF6347); 
}

/* ===============================
   BARRA DE VIDA
   =============================== */

.health-bar {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #32CD32, #228B22);
    transition: width 0.3s ease;
}

/* ===============================
   PROYECTILES
   =============================== */

.projectile {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #8B4513;
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

/* ===============================
   CONTROLES DEL JUEGO
   =============================== */

.game-controls {
    text-align: center;
    margin-top: 20px;
}

.game-button {
    background: linear-gradient(45deg, #228B22, #32CD32);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    margin: 0 10px;
    transition: all 0.3s ease;
}

.game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.game-button:disabled {
    background: #888;
    cursor: not-allowed;
    transform: none;
}

/* ===============================
   MODAL DE NIVEL
   =============================== */

.level-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(45deg, #CD853F, #DEB887);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 4px solid #8B4513;
    max-width: 400px;
}

.modal-title {
    font-size: 2em;
    color: #8B4513;
    margin-bottom: 20px;
}

.modal-text {
    font-size: 1.2em;
    color: #2F4F4F;
    margin-bottom: 30px;
}

.hidden {
    display: none;
}

/* ===============================
   EFECTOS DE DAÑO
   =============================== */

.damage-text {
    position: absolute;
    color: #DC143C;
    font-weight: bold;
    font-size: 16px;
    z-index: 100;
    animation: damageFloat 1s ease-out forwards;
}

@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

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

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .game-title {
        font-size: 1.8em;
    }
    
    .game-info {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .info-item {
        font-size: 1em;
    }
    
    .caveman-panel {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .caveman-card {
        min-width: 120px;
    }
    
    .grid-cell {
        width: 60px;
        height: 60px;
    }
    
    .caveman, .dinosaur {
        width: 50px;
        height: 50px;
    }
    
    .game-button {
        padding: 12px 20px;
        font-size: 14px;
        margin: 5px;
    }
}



/* ===============================
   PROYECTILES DE HUESO EN GRID
   =============================== */

.bone-projectile {
    font-size: 18px;
    z-index: 15;
    animation: boneSpinFloat 0.8s ease-in-out infinite;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

@keyframes boneSpinFloat {
    0% {
        transform: rotate(0deg) scale(0.9);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(0.9);
    }
}

/* ===============================
   EFECTOS DE IMPACTO EN GRID
   =============================== */

.impact-effect {
    font-size: 24px;
    z-index: 20;
    animation: impactExplosion 0.5s ease-out forwards;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

@keyframes impactExplosion {
    0% {
        opacity: 1;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
    100% {
        opacity: 0;
        transform: scale(2);
    }
}

/* ===============================
   PROYECTILES (LEGACY)
   =============================== */