:root {
  --bg: #0f1115;
  --bg-elevated: #171a21;
  --border: #262b36;
  --text: #e8eaed;
  --text-dim: #9aa1ac;
  --accent: #6c5ce7;
  --accent-2: #00d1b2;
  --radius: 14px;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }

.btn-gradient,
.btn-details,
.btn-download,
.btn-load-more,
.download-list a {
  background: linear-gradient(90deg, #3654e0, #8b3ce8, #e0399e, #8b3ce8, #3654e0);
  background-size: 300% 100%;
  background-position: 0% 0%;
  border-radius: 999px;
  border: none;
  color: white;
  transition: background-position 0.6s ease;
}
.btn-gradient:hover,
.btn-details:hover,
.btn-download:hover,
.btn-load-more:hover,
.download-list a:hover {
  background-position: 100% 0%;
}

::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-button {
  background-color: #000;
  display: none;
}

::-webkit-scrollbar-track {
  background: #000000;
}

::-webkit-scrollbar-thumb {
  background: rgb(64, 23, 93);
  background: linear-gradient(0deg, rgba(64, 23, 93, 1) 46%, rgba(145, 0, 67, 1) 100%);
  border-radius: 20px;
}

::-webkit-scrollbar-corner {
  background-color: #999;
}

html {
  overflow-x: hidden;
}

html, body {
  margin: 0;
  width: 100%;
}

body {
  font-family: "Segoe UI", Roboto, -apple-system, sans-serif;
  color: var(--text);
  background-color: #14151c;
  background-image: url("img/bg.jpg");
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

a { color: inherit; }

.layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  position: fixed;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 260px 200px at 0% 0%, rgba(255, 107, 203, 0.22), transparent 60%),
    radial-gradient(ellipse 220px 200px at 100% 100%, rgba(162, 89, 255, 0.18), transparent 60%),
    linear-gradient(180deg, #191627 0%, #14151f 55%, #121219 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 22px 16px;
  gap: 20px;
  z-index: 5;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  padding: 0 4px;
}

.sidebar-logo-img {
  max-width: 100%;
  height: 34px;
  width: auto;
  object-fit: contain;
}

.mobile-genre-trigger { display: none; }

.genre-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.genre-panel-head { display: none; }

.genre-sticky { flex-shrink: 0; }
.genre-sticky .genre-chip { width: 100%; margin-bottom: 5px; }

.sidebar-genres {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  padding-right: 4px;
}
.sidebar-genres::-webkit-scrollbar { width: 8px; }

.genre-divider {
  flex-shrink: 0;
  height: 1px;
  margin: 0 6px;
  background: var(--border);
}

.genre-chip {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.genre-chip .genre-icon { width: 18px; height: 18px; flex-shrink: 0; }
.genre-chip:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.genre-chip-new:not(.active) { color: #ff9f43; }
.genre-chip-new:not(.active):hover { color: #ffb066; }
.genre-chip-all:not(.active) { color: var(--accent-2); }
.genre-chip-all:not(.active):hover { color: #33e0c4; }
.genre-chip.active {
  background: rgba(108, 92, 231, 0.15);
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.sidebar-telegram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 12px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #3654e0, #8b3ce8, #e0399e, #8b3ce8, #3654e0);
  background-size: 300% 100%;
  background-position: 0% 0%;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-position 0.6s ease;
}
.sidebar-telegram:hover { background-position: 100% 0%; }
.tg-icon { width: 18px; height: 18px; flex-shrink: 0; }

.genre-chip-all.genre-chip-reset {
  color: #ff5c5c;
  border-left-color: #ff5c5c;
  background: rgba(255, 92, 92, 0.12);
}
.genre-chip-all.genre-chip-reset:hover { background: rgba(255, 92, 92, 0.2); color: #ff7a7a; }

.toggle-all-genres-btn {
  flex-shrink: 0;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.toggle-all-genres-btn:hover { border-color: var(--accent); color: var(--text); }
.toggle-all-genres-btn.hidden {
  display: block;
  visibility: hidden;
  pointer-events: none;
}

.main-area {
  flex: 1;
  min-width: 0;
  margin-left: calc(var(--sidebar-width) + 32px);
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  padding: 104px 28px 0;
}

.site-header {
  position: fixed;
  top: 16px;
  left: calc(var(--sidebar-width) + 32px);
  right: 0;
  z-index: 10;
  background: rgba(23, 26, 33, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 22px 0 0 22px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  padding: 16px 28px;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-wrap { flex: 1; }

#search {
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
}
#search:focus { outline: 2px solid var(--accent); }

.updated {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.btn-install-guide {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-install-guide svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-install-guide:hover { border-color: var(--accent); color: var(--accent-2); }

.install-modal {
  max-width: 700px;
}

.install-callout {
  background: rgba(224, 57, 158, 0.12);
  border: 1px solid rgba(224, 57, 158, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 14px;
}
.install-callout a { color: #ff8fd6; font-weight: 600; }

.install-method {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.install-method-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.install-video-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}
.install-video-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.install-steps {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
}
.install-steps li { margin-bottom: 6px; }

.install-desc {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 12px 0;
}

.install-desc code,
.install-steps code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.install-desc a,
.install-steps a {
  color: #b3a4ff;
  text-decoration: underline;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 10px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.sort-wrap select {
  margin-left: 6px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  padding-bottom: 40px;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, border-color 0.15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }

.card-media {
  position: relative;
}

.card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(135deg, #23263a, #171a21);
  display: block;
}

.badge-new {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(90deg, #3654e0, #8b3ce8, #e0399e, #8b3ce8, #3654e0);
  background-size: 300% 100%;
  background-position: 0% 0%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: #23263a;
  color: var(--text-dim);
}
.badge.multiplayer { background: rgba(0, 209, 178, 0.15); color: var(--accent-2); }
.badge.lang { background: rgba(108, 92, 231, 0.15); color: #b3a4ff; }

.card-footer {
  margin-top: auto;
  padding-top: 6px;
}

.btn-download {
  display: block;
  text-align: center;
  padding: 9px 12px;
  color: white;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 0;
}
.hidden { display: none; }

.pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-bottom: 50px;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
}

.btn-load-more {
  padding: 11px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.page-numbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.page-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.page-jump input {
  width: 56px;
  text-align: center;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.85rem;
}

.page-jump button {
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.page-jump button:hover { background: #5847d6; }

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.page-btn:disabled { opacity: 0.35; cursor: default; }

.page-ellipsis {
  color: var(--text-dim);
  padding: 0 4px;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 20px 28px 40px;
}

.footer-disclaimer {
  margin-top: 6px;
  font-size: 0.75rem;
  opacity: 0.85;
}

.footer-disclaimer-link {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
}
.footer-disclaimer-link:hover { color: var(--text); }

@media (max-width: 860px) {
  .layout { flex-direction: column; }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 16px;
    gap: 12px;
    /* На узком экране декоративные пятна из десктопной версии заливают всю панель — убираем их */
    background: linear-gradient(180deg, #191627 0%, #14151f 55%, #121219 100%);
  }

  .mobile-genre-trigger {
    order: 3;
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
  }
  .mobile-genre-trigger svg { width: 18px; height: 18px; flex-shrink: 0; }
  .mobile-genre-trigger.has-active { border-color: var(--accent); color: var(--accent-2); }

  .genre-panel {
    position: fixed;
    inset: 0;
    z-index: 200;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    background: #14151c;
    padding: 24px 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
  }
  .genre-panel.open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }

  .genre-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
  }
  .genre-panel-title { font-size: 1.05rem; font-weight: 700; }
  .genre-panel-close { position: static; }

  .genre-sticky {
    position: sticky;
    top: 0;
    background: #14151c;
    padding-bottom: 12px;
    z-index: 1;
  }

  .sidebar-genres {
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
    gap: 5px;
  }

  .genre-chip { padding: 11px 10px; }

  .sidebar-logo { flex: 0 1 auto; min-width: 0; overflow: hidden; }
  .sidebar-logo-img { height: 26px; }
  .sidebar-telegram {
    order: 2;
    flex: 0 1 auto;
    min-width: 0;
    margin-left: auto;
    padding: 9px 12px;
    font-size: 0.72rem;
    gap: 6px;
    white-space: nowrap;
  }
  .tg-icon { width: 15px; height: 15px; }

  .main-area { margin-left: 0; }

  .site-header {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    z-index: 1;
    border-radius: 16px;
    border-right: 1px solid var(--border);
    margin: 10px 16px 0;
    backdrop-filter: none;
  }

  .content { padding-top: 0; }

  .content, .site-header { padding-left: 16px; padding-right: 16px; }

  .header-row { flex-wrap: wrap; }
  .search-wrap { flex: 1 1 100%; order: 1; }
  .btn-install-guide { order: 2; flex-shrink: 0; }
  .updated {
    order: 3;
    margin-left: auto;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(0.62rem, 2.8vw, 0.75rem);
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .toolbar-controls {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 10px;
  }

  .sort-wrap { width: 100%; display: flex; align-items: center; justify-content: space-between; }
  .sort-wrap select { margin-left: 0; }
}

.btn-details {
  display: block;
  width: 100%;
  text-align: center;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }

.modal {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  padding: 20px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  background: #23263a;
  color: var(--text);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.modal-close:hover { background: var(--accent); }

.modal-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  background: #171a21;
  margin-bottom: 14px;
}

.modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.share-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.share-btn:hover { border-color: var(--accent); color: var(--text); }

.share-fallback {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: -4px 0 10px;
}

.share-fallback input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.8rem;
}

.share-fallback span {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.modal-desc {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-line;
  margin: 12px 0;
}

.modal-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 16px 0 8px;
}

.download-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.download-item.span-center {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc(50% - 4px);
}

.download-note {
  margin: 6px 2px 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-dim);
  text-align: center;
}

.download-list a {
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px 12px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.modal-hero {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #171a21;
  margin-bottom: 14px;
}

.modal-hero-video {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}

.modal-hero-controls {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 8px;
}

.hero-btn {
  background: rgba(15, 17, 21, 0.75);
  backdrop-filter: blur(4px);
  color: white;
  border: none;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
}
.hero-btn:hover { background: var(--accent); }

.hero-btn-yt {
  width: auto;
  padding: 0 14px;
  font-size: 0.8rem;
  font-weight: 600;
}

.modal-telegram-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.modal-telegram-link:hover { color: var(--text); }

.scroll-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 50;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, #3654e0, #8b3ce8, #e0399e, #8b3ce8, #3654e0);
  background-size: 300% 100%;
  background-position: 0% 0%;
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  transition: background-position 0.6s ease, transform 0.15s ease, opacity 0.25s ease, visibility 0.25s ease;
  opacity: 1;
}
.scroll-top svg { width: 20px; height: 20px; }
.scroll-top:hover { background-position: 100% 0%; transform: translateY(-3px); }
.scroll-top.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

@media (max-width: 860px) {
  .scroll-top { right: 16px; bottom: 16px; }
}
