/* Вечериночная (игра.вечеринка.рф) — тёмная тема, крупные карточки, TV-режим */

:root {
    --bg: #0d0d12;
    --bg-elevated: #17171f;
    --card: #1d1d27;
    --card-hover: #2a2a3a;
    --accent: #ff4d6d;
    --accent-2: #6d5dfc;
    --text: #f2f2f5;
    --text-dim: #a4a4b3;
    --radius: 14px;
    --focus-ring: 0 0 0 4px var(--accent), 0 0 24px rgba(255, 77, 109, .6);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* ---------- Шапка ---------- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: linear-gradient(180deg, rgba(13,13,18,.95), rgba(13,13,18,0));
    position: sticky;
    top: 0;
    z-index: 50;
}
.logo { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--text-dim); font-size: 15px; padding: 8px 4px; }
.nav-links a:hover, .nav-links a:focus { color: var(--text); }
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 15px;
}
.btn:hover, .btn:focus { background: #ff3358; }
.btn.secondary { background: var(--card); color: var(--text); }
.btn.secondary:hover, .btn.secondary:focus { background: var(--card-hover); }

/* ---------- Баннер ---------- */
.hero {
    position: relative;
    height: 46vh;
    min-height: 320px;
    border-radius: var(--radius);
    margin: 12px 24px 32px;
    overflow: hidden;
    background: linear-gradient(120deg, var(--accent-2), var(--accent));
    display: flex;
    align-items: flex-end;
    padding: 32px;
}
.hero h1 { font-size: 40px; margin: 0 0 8px; max-width: 640px; }
.hero p { font-size: 17px; color: rgba(255,255,255,.85); max-width: 560px; }

/* ---------- Подборки / карусели ---------- */
.collection { margin: 0 0 40px; }
.collection h2 { padding: 0 24px; font-size: 22px; margin-bottom: 14px; }
.carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 24px 12px;
    scroll-behavior: smooth;
}
.carousel::-webkit-scrollbar { height: 6px; }
.carousel::-webkit-scrollbar-thumb { background: var(--card-hover); border-radius: 4px; }

/* ---------- Карточка игры ---------- */
.game-card {
    flex: 0 0 240px;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
    cursor: pointer;
}
.game-card:hover, .game-card:focus, .game-card.focused {
    transform: translateY(-6px) scale(1.03);
    box-shadow: var(--focus-ring);
    outline: none;
}
.game-card .cover {
    width: 100%;
    aspect-ratio: 3/4;
    background: var(--bg-elevated) center/cover no-repeat;
    position: relative;
}
/* Пока у игры нет загруженной обложки — показываем градиент с названием
   вместо пустого тёмного прямоугольника (выглядит как задуманное, а не сломанное). */
.game-card .cover-placeholder {
    background: linear-gradient(150deg, var(--accent-2), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
}
.cover-placeholder-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,.35);
    line-height: 1.3;
}
.game-card .badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    text-transform: uppercase;
}
.game-card .info { padding: 12px; }
.game-card .title { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.game-card .meta { font-size: 12px; color: var(--text-dim); display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Каталог сеткой ---------- */
.grid-catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 24px;
}

/* ---------- Сайдбар категорий (Netflix/Кинопоиск-стиль) ---------- */
/* Показывается на десктопе (по ширине экрана) и на TV (по body.tv-mode),
   на мобильном/планшете скрыт — там вместо него горизонтальная
   .category-chip-row (см. ниже), встроенная прямо в разметку index.php. */
.browse-shell {
    display: flex;
    align-items: flex-start;
}
.category-sidebar {
    display: none;
    flex: 0 0 232px;
    position: sticky;
    top: 66px; /* высота липкой шапки (.site-header) — иначе сайдбар при скролле уезжает под неё */
    max-height: calc(100vh - 66px);
    overflow-y: auto;
    align-self: flex-start;
    padding: 20px 12px 40px 24px;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sidebar-link {
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 15px;
}
.sidebar-link:hover, .sidebar-link:focus {
    background: var(--card);
    color: var(--text);
    outline: none;
}
.sidebar-link.active {
    background: var(--card);
    color: var(--text);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent);
}
.browse-content {
    flex: 1 1 auto;
    min-width: 0; /* иначе карусели с overflow-x могут распирать флекс-контейнер */
}

/* Мобильная/планшетная замена сайдбара — та же навигация по категориям,
   но горизонтальной прокручиваемой строкой чипов над контентом. */
.category-chip-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 24px 20px;
}
.category-chip-row::-webkit-scrollbar { height: 0; }
.category-chip-row .btn.active-chip { background: var(--accent); color: #fff; }

@media (min-width: 960px) {
    .category-sidebar { display: block; }
    .category-chip-row { display: none; }
}
body.tv-mode .category-sidebar { display: block; padding: 40px 16px 40px 40px; }
body.tv-mode .category-chip-row { display: none; }
body.tv-mode .sidebar-link { font-size: 18px; padding: 14px 18px; }
body.tv-mode .sidebar-link:focus { box-shadow: var(--focus-ring); outline: none; background: var(--card-hover); }

/* ---------- Карточка игры (страница) ---------- */
.game-detail {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
    padding: 32px 24px;
}
.game-detail .cover-large {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: var(--radius);
    background: var(--bg-elevated) center/cover no-repeat;
}
.game-detail h1 { font-size: 32px; margin: 0 0 12px; }
.game-detail .meta-row { display: flex; gap: 18px; color: var(--text-dim); margin-bottom: 18px; flex-wrap: wrap; }
.game-detail .desc { line-height: 1.6; color: var(--text-dim); margin-bottom: 24px; max-width: 640px; }
.price-tag { font-size: 22px; font-weight: 700; margin-bottom: 16px; }

.stars { display: inline-flex; gap: 4px; font-size: 22px; cursor: pointer; }
.stars .star { color: #4a4a58; }
.stars .star.filled { color: #ffce54; }

/* ---------- Формы ---------- */
.auth-form {
    max-width: 400px;
    margin: 60px auto;
    background: var(--card);
    padding: 32px;
    border-radius: var(--radius);
}
.auth-form h1 { font-size: 24px; margin-top: 0; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--text-dim); }
.field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #33333f;
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 15px;
}
.field input:focus { outline: none; box-shadow: var(--focus-ring); }
.error-box { background: rgba(255,77,109,.15); border: 1px solid var(--accent); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.success-box { background: rgba(90,200,140,.15); border: 1px solid #5ac88c; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.muted-link { display: block; margin-top: 14px; font-size: 14px; color: var(--text-dim); text-align: center; }

/* ---------- Игровой экран ---------- */
.game-frame-wrap { position: fixed; inset: 0; background: #000; z-index: 999; }
.game-frame-wrap iframe { width: 100%; height: 100%; border: none; }
.game-frame-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}
.game-frame-toolbar button {
    background: rgba(0,0,0,.6);
    color: #fff;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
}
.game-frame-toolbar button:focus { box-shadow: var(--focus-ring); outline: none; }

/* ---------- Попап ---------- */
.popup-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.7);
    display: flex; align-items: center; justify-content: center; z-index: 900;
}
.popup-box {
    background: var(--card); border-radius: var(--radius); max-width: 420px; width: 92%;
    padding: 24px; text-align: center;
}
.popup-box img { border-radius: 10px; margin-bottom: 16px; width: 100%; }
.popup-box h3 { margin-top: 0; font-size: 20px; }
.popup-box p { color: var(--text-dim); }
.popup-close { margin-top: 12px; background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; }

/* ---------- Профиль ---------- */
.profile-section { padding: 24px; max-width: 900px; margin: 0 auto; }
.profile-card { background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
table.simple { width: 100%; border-collapse: collapse; }
table.simple th, table.simple td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #2a2a36; font-size: 14px; }

/* ---------- Smart TV режим ---------- */
body.tv-mode { font-size: 20px; }
body.tv-mode .game-card { flex-basis: 300px; }
body.tv-mode .game-card .title { font-size: 18px; }
body.tv-mode .nav-links a { font-size: 18px; padding: 12px; }
body.tv-mode .btn { padding: 14px 28px; font-size: 18px; }
body.tv-mode .container { padding: 0 40px; }
body.tv-mode a:focus, body.tv-mode button:focus, body.tv-mode input:focus {
    box-shadow: var(--focus-ring);
    outline: none;
}
body.tv-mode .game-card:hover:not(.focused) { transform: none; box-shadow: none; }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
    .game-detail { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .hero { height: 34vh; padding: 20px; }
    .hero h1 { font-size: 26px; }
    .game-card { flex-basis: 160px; }
}
