/* Общие стили страницы */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f7f6;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

header {
    margin-top: 50px;
    text-align: center;
}

.container {
    width: 95%;
    max-width: 1100px; /* Увеличил, так как карточки стали другими */
    padding-bottom: 50px;
}

.category {
    margin-bottom: 35px;
}

.category h2 {
    font-size: 1.4rem;
    padding-left: 10px;
    border-left: 5px solid #bdc3c7;
    margin-bottom: 20px;
}

/* Сетка */
.grid {
    display: grid;
    /* Автоматическое заполнение колонок */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

/* --- ОСНОВНАЯ ПЕРЕделка КАРТОЧЕК --- */

.card {
    position: relative; /* Для позиционирования текста и картинки */
    display: flex;
    align-items: flex-end; /* Прижимает контент к низу */
    justify-content: center;
    text-decoration: none;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    border-radius: 12px;
    overflow: hidden; /* Чтобы картинка не выходила за границы */
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    
    /* Стандартное соотношение 16:9 (монитор) */
    aspect-ratio: 16 / 9;
}

/* Класс для смартфонов (вертикальный) */
.card.mobile {
    aspect-ratio: 9 / 16;
}

/* Картинка-фон */
.card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Картинка заполняет всё пространство без искажений */
    z-index: 1;
}

/* Подпись поверх картинки снизу */
.card span {
    position: relative; /* Чтобы быть выше картинки (z-index 2) */
    z-index: 2;
    width: 100%;
    text-align: center;
    padding: 15px 5px; /* Отступы сверху и снизу внутри подписи */
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)); /* Градиент для читаемости текста */
    font-size: 1rem;
}

/* Эффекты при наведении */
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Цветовые акценты (теперь работают как тени или обводки, 
   т.к. основной визуал — это картинка) */
.card.game { border-bottom: 4px solid #764ba2; }
.card.dice { border-bottom: 4px solid #f5576c; }
.card.tool { border-bottom: 4px solid #2f62af; }
.card.image { border-bottom: 4px solid #d938f9; }
.card.video { border-bottom: 4px solid #f2f938; }
.card.audio { border-bottom: 4px solid #38f9d7; }
.card.other { border-bottom: 4px solid #00f2fe; }
.card.special { border-bottom: 4px solid #fda085; }

/* Мобильная адаптация сетки */
@media (max-width: 480px) {
    .grid {
        grid-template-columns: repeat(2, 1fr); /* 2 колонки на мобилках */
        gap: 10px;
    }
    .card, .card.mobile {
        font-size: 0.85rem;
    }
}
