:root {
    --bg: #0e0f1a;
    --bg-soft: #151827;
    --surface: #1b1f33;
    --surface-2: #232842;
    --line: #2c3253;
    --text: #eef1ff;
    --muted: #98a0c4;
    --accent: #7c5cff;
    --accent-2: #ff7a59;
    --accent-3: #35d6a4;
    --radius: 14px;
    --radius-sm: 10px;
    --wrap: 1320px;
    --header-h: 116px;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

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

h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }

.visually-hidden,
.skip-link:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link:focus {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--accent);
    border-radius: var(--radius-sm);
}

/* ---------- Header ---------- */

.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(14, 15, 26, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.header__bar {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: block;
    flex-shrink: 0;
    line-height: 0;
}

.logo__img {
    width: auto;
    height: 52px;
}

.search {
    position: relative;
    margin-left: auto;
    flex: 0 1 250px;
    width: 250px;
    max-width: 250px;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 4px 2px 12px;
    transition: border-color .15s;
}

.search:focus-within { border-color: var(--accent); }

.search__input {
    flex: 1;
    border: 0;
    background: none;
    color: var(--text);
    padding: 6px 0;
    outline: none;
    min-width: 0;
    font-size: 14px;
}

.search__input::placeholder { color: var(--muted); }

.search__btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

.search__suggest {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: min(360px, calc(100vw - 24px));
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
    z-index: 60;
}

.search__suggest[hidden] { display: none; }

.search__hit {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border-radius: 10px;
    color: var(--text);
}

.search__hit:hover,
.search__hit.is-active { background: var(--surface-2); }

.search__hit img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.search__hit-title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
}

.search__hit-meta {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.search__empty,
.search__more {
    display: block;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--muted);
}

.search__more { color: var(--accent-3); font-weight: 600; }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

.nav {
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
}

.nav__list {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 8px 16px;
    list-style: none;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav__list::-webkit-scrollbar { display: none; }

.nav__link {
    display: inline-block;
    white-space: nowrap;
    padding: 7px 13px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    transition: background .15s, color .15s;
}

.nav__link:hover { background: var(--surface-2); color: var(--text); }
.nav__link--all { color: var(--accent-3); }

/* ---------- Layout ---------- */

.main {
    flex: 1;
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 24px 16px 56px;
}

.section { margin: 0 0 36px; }

.section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section__title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.section__more {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.section__more:hover { color: var(--accent); }

.hero { margin-bottom: 28px; }

.hero__title {
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 800;
    letter-spacing: -.5px;
}

.hero__intro {
    margin: 10px 0 0;
    color: var(--muted);
}

.page-home .prose,
.home-seo {
    max-width: none;
}

.page-head { margin-bottom: 22px; }
.page-head--center { text-align: center; }

.page-head__title {
    font-size: clamp(24px, 3.4vw, 34px);
    font-weight: 800;
    letter-spacing: -.4px;
}

.page-head__meta { margin: 0; color: var(--muted); font-size: 15px; }
.page-head__intro { margin-top: 14px; }

.error-code {
    margin: 0;
    font-size: 72px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.text-center { text-align: center; }

.empty-state {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

/* ---------- Cards ---------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
    gap: 14px;
}

.card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .16s ease, border-color .16s ease;
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.card__media {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    background: var(--surface-2);
    overflow: hidden;
    /* внутренний радиус = радиус карточки минус 1px рамки, снизу без скругления */
    border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

.card__media img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    /* превью из фида часто с маской как у иконки — обрезаем её, оставляем только радиус карточки сверху */
    transform: scale(1.22);
    border-radius: 0;
    transition: filter .16s ease;
}

.card__play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(8, 10, 22, .38);
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease;
}

.card__play-btn {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 10px 24px rgba(124, 92, 255, .4);
    transform: scale(.86);
    transition: transform .16s ease;
}

.card__play-icon { display: block; margin-left: 2px; }

.card:hover .card__play,
.card:focus-visible .card__play { opacity: 1; }

.card:hover .card__play-btn,
.card:focus-visible .card__play-btn { transform: scale(1); }

.card:hover .card__media img,
.card:focus-visible .card__media img { filter: brightness(.72); }

.card__body { display: block; padding: 9px 11px 11px; }

.card__title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card__meta {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    transition: border-color .15s, color .15s;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip--tag { background: transparent; }

.chip__count {
    font-style: normal;
    font-size: 12px;
    color: var(--muted);
}

.cat-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}

.cat-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: transform .16s, border-color .16s;
}

.cat-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.cat-card__icon { font-size: 26px; }
.cat-card__title { font-weight: 700; }
.cat-card__count { color: var(--muted); font-size: 13px; }

/* ---------- Pagination ---------- */

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 28px 0 0;
}

.pagination__item {
    min-width: 42px;
    padding: 9px 14px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
}

.pagination__item:hover { border-color: var(--accent); }

.pagination__item--current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pagination__gap { padding: 9px 4px; color: var(--muted); }

/* ---------- Breadcrumbs ---------- */

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--muted);
}

.crumbs__link:hover { color: var(--accent); }
.crumbs__current { color: var(--text); font-weight: 600; }

/* ---------- Game page ---------- */

.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
}

.game-main { min-width: 0; }

.player {
    /* 9:16 на всю ширину колонки даёт башню ~1600px; ограничиваем высоту и сужаем ширину */
    --player-max-h: min(78vh, 720px);
    position: relative;
    width: min(100%, calc(var(--player-max-h) * var(--player-aspect, 16 / 9)));
    max-height: var(--player-max-h);
    aspect-ratio: var(--player-aspect, 16 / 9);
    margin-inline: auto;
    background: #000;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.player--soon {
    display: grid;
    place-items: center;
    background: var(--surface);
    color: var(--muted);
    text-align: center;
    padding: 24px;
}

.player__poster {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    gap: 12px;
    grid-auto-rows: min-content;
    align-content: center;
}

.player__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(.45) saturate(.9);
}

.player__play {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 30px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(124, 92, 255, .35);
    transition: transform .15s;
}

.player__play:hover { transform: scale(1.04); }
.player__play-icon { font-size: 14px; }

.player__hint {
    position: relative;
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, .78);
}

.player__frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.player.is-playing .player__poster { display: none; }
.player:fullscreen { aspect-ratio: auto; width: 100%; max-height: none; border-radius: 0; }

.player--portrait {
    --player-max-h: min(78vh, 720px);
}

.game-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 16px 0 24px;
}

.game-bar__title { font-size: 24px; margin: 0; }

.game-bar__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.game-bar__rating { color: var(--accent-3); font-weight: 700; }

.game-bar__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.btn:hover { border-color: var(--accent); }
.btn[disabled] { opacity: .55; cursor: default; }

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    padding: 13px 24px;
}

.game-side { display: flex; flex-direction: column; gap: 16px; }

.side__title { font-size: 17px; margin: 0; }

.side-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.side-item {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .15s;
}

.side-item:hover { border-color: var(--accent); }

.side-item img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: calc(var(--radius-sm) - 1px) 0 0 calc(var(--radius-sm) - 1px);
}

.side-item span {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 10px 12px;
}

.side-item strong {
    display: block;
    font-size: 14px;
    line-height: 1.3;
}

.side-item em {
    font-style: normal;
    font-size: 12px;
    color: var(--muted);
}

.ad { margin-bottom: 16px; }
.ad:empty { display: none; }

/* ---------- Prose ---------- */

.prose { color: #d8ddf5; max-width: 75ch; }
.prose h2 { font-size: 22px; margin: 28px 0 12px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 17px; margin: 22px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.prose th, .prose td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; }
.prose th { background: var(--surface-2); }

.prose--boxed {
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    max-width: none;
}

.static { max-width: 860px; }

/* ---------- Footer ---------- */

.footer {
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
    padding: 34px 16px 20px;
}

.footer__inner {
    max-width: var(--wrap);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.6fr repeat(2, 1fr);
    gap: 28px;
}

.logo--footer { margin-bottom: 10px; }
.logo--footer .logo__img { height: 64px; }

.footer__text { color: var(--muted); font-size: 14px; margin: 0; max-width: 42ch; }

.footer__title { font-size: 15px; margin-bottom: 10px; }

.footer__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 14px;
}

.footer__list a { color: var(--muted); }
.footer__list a:hover { color: var(--accent); }

.footer__copy {
    max-width: var(--wrap);
    margin: 26px auto 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
    .game-layout { grid-template-columns: minmax(0, 1fr); }
    .game-side { flex-direction: column; }
    .footer__inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    .nav-toggle { display: flex; }
    .nav { display: none; }
    .nav.is-open { display: block; }
    .nav__list { flex-wrap: wrap; overflow: visible; }
    .logo__img { height: 42px; }
    .search { flex: 1 1 auto; width: auto; max-width: none; }
    .player--portrait { --player-aspect: 9 / 16; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
    .main { padding: 18px 12px 44px; }
    .game-bar { flex-direction: column; align-items: flex-start; }
    .footer__inner { grid-template-columns: 1fr; gap: 20px; }
    .prose--boxed { padding: 16px; }
}
