/* Kingdoms Grid Page */
.kingdoms-grid-page {
    background-color: #000;
    height: 100vh;
    width: 100vw;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.kingdoms-grid {
    display: flex;
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    background-color: #000;
}

.grid-square {
    position: relative;
    flex: 1;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 2px solid #000;
}

.grid-square:last-child {
    border-right: none;
}

.kingdom-link {
    position: absolute;
    inset: 0;
    display: block;
    text-decoration: none;
    color: inherit;
}

.kingdom-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: all 0.8s ease;
    transform: scale(1.05);
    filter: brightness(0.5) contrast(1.1);
}

.kingdom-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        rgba(0,0,0,0.7) 0%,
        rgba(0,0,0,0.4) 50%,
        rgba(0,0,0,0.7) 100%
    );
    transition: all 0.5s ease;
}

.kingdom-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    text-align: center;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.5s ease 0.1s;
    z-index: 2;
}

.kingdom-name {
    color: var(--color-yellow);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    /* Убрал uppercase */
    text-shadow: 2px 2px 10px rgba(0,0,0,0.8);
    letter-spacing: 1px;
    /* Фиксируем ширину текста чтобы не ломался */
    min-width: 300px;
    white-space: nowrap;
}

.kingdom-description {
    color: var(--color-white);
    font-size: 1.4rem;
    line-height: 1.5;
    margin-bottom: 2rem;
    max-width: 500px;
    text-shadow: 1px 1px 5px rgba(0,0,0,0.7);
    opacity: 0.9;
    /* Фиксируем описание чтобы не ломалось */
    min-width: 400px;
    text-align: center;
}

.kingdom-difficulty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    /* Фиксируем блок сложности */
    min-width: 200px;
}

.difficulty-label {
    color: var(--color-white);
    font-size: 1rem;
    opacity: 0.8;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
    white-space: nowrap;
}

.difficulty-value {
    font-size: 1.3rem;
    font-weight: 600;
    text-shadow: 1px 1px 5px rgba(0,0,0,0.7);
    white-space: nowrap;
}

/* Цвета сложности */
.difficulty-value.easy {
    color: var(--color-green);
}

.difficulty-value.medium {
    color: var(--color-yellow);
}

.difficulty-value.hard {
    color: #ff6b6b;
}

/* Hover Effects - раздвигание до 66% ширины */
.grid-square:hover {
    flex: 4 !important;
}

.grid-square:hover .kingdom-bg {
    transform: scale(1);
    filter: brightness(0.9) contrast(1.1);
    animation: gentleMove 20s ease-in-out infinite;
}

.grid-square:hover .kingdom-overlay {
    background: rgba(0, 0, 0, 0.3);
}

.grid-square:hover .kingdom-content {
    opacity: 1;
    transform: translateX(0);
}

/* Анимация лёгкого движения фона */
@keyframes gentleMove {
    0%, 100% {
        transform: scale(1) translateX(0px) translateY(0px);
    }
    25% {
        transform: scale(1.1) translateX(2px) translateY(-1px);
    }
    50% {
        transform: scale(1) translateX(-1px) translateY(1px);
    }
    75% {
        transform: scale(1.05) translateX(1px) translateY(-0.5px);
    }
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .kingdoms-grid {
        flex-direction: column;
    }
    
    .grid-square {
        border-right: none;
        border-bottom: 2px solid #000;
    }
    
    .grid-square:last-child {
        border-bottom: none;
    }
    
    .kingdom-name {
        font-size: 2rem;
        min-width: auto; /* На мобилках убираем фиксированную ширину */
        white-space: normal; /* Разрешаем переносы */
        text-align: center;
    }
    
    .kingdom-description {
        font-size: 1.1rem;
        max-width: 300px;
        min-width: auto; /* На мобилках убираем фиксированную ширину */
        white-space: normal; /* Разрешаем переносы */
    }
    
    .kingdom-difficulty {
        min-width: auto; /* На мобилках убираем фиксированную ширину */
    }
    
    .grid-square:hover {
        flex: 1.5 !important;
    }
    
    .kingdom-content {
        transform: translateY(30px);
    }
    
    .grid-square:hover .kingdom-content {
        transform: translateY(0);
    }
}

/* Убираем скролл у body и html */
html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
}