:root {
  --bg: #12142b; --bg2: #1b1e3d; --card: #222652; --line: #2f3468;
  --text: #f2f3ff; --muted: #a3a8d6; --accent: #ffb020; --accent2: #7c5cff; --radius: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* Шапка */
.top { position: sticky; top: 0; z-index: 20; background: rgba(18, 20, 43, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1280px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 22px; white-space: nowrap; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #ff5e7a 55%, var(--accent2)); display: grid; place-items: center; font-size: 18px; }
.search { flex: 1; max-width: 520px; margin-left: auto; position: relative; }
.search input { width: 100%; border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 12px; padding: 10px 14px 10px 38px; font-size: 15px; outline: none; font-family: inherit; }
.search input:focus { border-color: var(--accent2); }
.search::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .7; }

.rnd { white-space: nowrap; background: linear-gradient(135deg, #7c5cff, #b05ad8); border: 0; }
@media (max-width: 700px) { .rnd span { display: none; } }

/* Категории */
.cats { max-width: 1280px; margin: 0 auto; padding: 12px 16px 4px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted); transition: .15s; }
.chip:hover, .chip.on { color: var(--text); border-color: var(--accent2); background: #2a2560; }

main { max-width: 1280px; margin: 0 auto; padding: 8px 16px 40px; }
h1.page { font-size: 26px; margin: 14px 0 4px; }
.lead { color: var(--muted); margin: 0 0 8px; }
.sec { margin-top: 22px; }
.sec h2 { font-size: 20px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.sec[hidden] { display: none; }

/* Карточки игр */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; transition: transform .15s, box-shadow .15s; position: relative; }
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.card .th { aspect-ratio: 4 / 3; background: var(--bg2); overflow: hidden; }
.card .th img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.card:hover .th img { transform: scale(1.06); }
.card .nm { padding: 8px 10px 2px; font-weight: 700; font-size: 15px; line-height: 1.25; min-height: calc(2 * 1.25em + 10px);
            display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .ct { padding: 0 10px 10px; font-size: 12px; color: var(--muted); }
.badge { position: absolute; top: 8px; left: 8px; background: var(--accent); color: #3a2200; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; }
.empty { color: var(--muted); padding: 20px 0; }

/* Реклама */
.ad { background: repeating-linear-gradient(45deg, #1b1e3d, #1b1e3d 10px, #1e2244 10px, #1e2244 20px); border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 12px; min-height: 90px; margin: 18px 0; overflow: hidden; }
.ad-side { min-height: 600px; margin: 0; }

/* Страница игры */
.game-layout { display: grid; grid-template-columns: 1fr 300px; gap: 18px; margin-top: 14px; }
.game-layout.solo { grid-template-columns: 1fr; }
.player { background: #000; border-radius: var(--radius); overflow: hidden; position: relative; aspect-ratio: 16 / 10; }
.player.portrait { aspect-ratio: auto; height: min(78vh, 760px); }
.player.tall { aspect-ratio: auto; height: max(min(82vh, 780px), 560px); }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.bar h1 { font-size: 22px; margin: 0; flex: 1; min-width: 200px; }
.btn { border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 12px; padding: 9px 14px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn:hover { border-color: var(--accent2); }
.btn.fav-on { color: var(--accent); border-color: var(--accent); }
.info { background: var(--bg2); border-radius: var(--radius); padding: 16px 18px; margin-top: 14px; }
.info h2 { font-size: 17px; margin: 0 0 6px; }
.info p { margin: 0 0 12px; color: #d4d7f5; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag.kb { color: var(--accent); background: rgba(255, 176, 32, .12); }
.tag { font-size: 12px; background: var(--card); border-radius: 8px; padding: 3px 9px; color: var(--muted); }

/* Межуровневая реклама */
.interstitial { position: fixed; inset: 0; z-index: 100; background: rgba(5, 6, 18, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; }
.interstitial .box { width: min(600px, 100%); aspect-ratio: 16 / 9; display: grid; place-items: center; border-radius: 14px; background: var(--bg2); border: 1px dashed var(--line); color: var(--muted); }

.kbnote { background: rgba(255, 176, 32, .14); border: 1px solid rgba(255, 176, 32, .5); color: #ffd58a; border-radius: 12px; padding: 10px 14px; margin-top: 12px; font-size: 14px; }
.kbnote a { text-decoration: underline; }
.kbnote[hidden] { display: none; }
.crumbs { font-size: 13px; color: var(--muted); margin-top: 12px; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer .in { max-width: 1280px; margin: 0 auto; padding: 18px 16px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .ad-side { min-height: 100px; }
  .player, .player.portrait { aspect-ratio: auto; height: calc(100vh - 150px); margin: 0 -16px; border-radius: 0; }
}
@media (max-width: 560px) {
  .logo span.txt { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  h1.page { font-size: 22px; }
}
