:root {
  --bg: #08090e;
  --bg2: #10131b;
  --card: #12151f;
  --card-hover: #181c29;
  --text: #eceef4;
  --muted: #8b93a5;
  --accent: #7c5cff;
  --accent2: #38d6b4;
  --red: #ff4b4b;
  --border: #212736;
  --tag: #1b2130;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1000px 500px at 85% -5%, rgba(124,92,255,.18), transparent 55%),
    radial-gradient(800px 420px at 5% 0%, rgba(255,75,75,.10), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(56,214,180,.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

::selection { background: var(--accent); color: #fff; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3145; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3a4260; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 26px;
  padding: 13px 26px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  background: rgba(8,9,14,.82);
  backdrop-filter: blur(12px);
}
.logo { font-weight: 800; font-size: 1.18rem; text-decoration: none; color: var(--text); letter-spacing: .4px; white-space: nowrap; }
.logo .red { color: var(--red); }
.logo .space-dom { color: var(--accent); font-weight: 600; }

.menu { display: flex; gap: 4px; margin-left: 8px; flex: 1; flex-wrap: wrap; }
.menu a {
  color: var(--muted); text-decoration: none;
  font-size: .84rem; font-weight: 600;
  padding: 7px 13px; border-radius: 9px;
  transition: all .15s;
}
.menu a:hover { color: var(--text); background: var(--tag); }
.menu a.active { color: #fff; background: linear-gradient(90deg, rgba(124,92,255,.25), rgba(255,75,75,.2)); border: 1px solid rgba(124,92,255,.35); }

.lang-toggle {
  background: var(--tag); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 6px 12px; cursor: pointer; font-weight: 700; font-size: .78rem;
  transition: border-color .15s;
}
.lang-toggle:hover { border-color: var(--accent); }

main, section { width: 100%; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: 64px 18px 26px;
  max-width: 900px; margin: 0 auto;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: -60px 0 0 0; z-index: -1;
  background:
    radial-gradient(520px 200px at 30% 20%, rgba(124,92,255,.22), transparent 70%),
    radial-gradient(480px 220px at 70% 30%, rgba(255,75,75,.14), transparent 70%),
    radial-gradient(600px 260px at 50% 80%, rgba(56,214,180,.08), transparent 70%);
  filter: blur(10px);
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translateY(-10px) scale(1); }
  to   { transform: translateY(14px) scale(1.06); }
}

.hero h1 {
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  font-weight: 900; line-height: 1.12;
  letter-spacing: -.5px;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(92deg, var(--red) 10%, var(--accent) 65%, var(--accent2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero > p { color: var(--muted); margin: 16px auto 0; font-size: 1rem; line-height: 1.55; max-width: 620px; }

.stats {
  display: flex; gap: 44px; justify-content: center;
  margin: 30px 0 8px; flex-wrap: wrap;
}
.stat { text-align: center; }
.stat b {
  display: block; font-size: 1.5rem; font-weight: 900;
  background: linear-gradient(90deg, var(--red), var(--accent));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.stat span { color: var(--muted); font-size: .78rem; }

.search-wrap { max-width: 580px; margin: 26px auto 0; }
#search {
  width: 100%; padding: 14px 20px;
  background: rgba(16,19,27,.9); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  font-size: 1rem; outline: none;
  box-shadow: 0 0 0 0 rgba(124,92,255,0);
  transition: border-color .2s, box-shadow .2s;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(124,92,255,.15); }
#search::placeholder { color: #5b637a; }

/* ---------- sections ---------- */
section.featured, section.catalog { padding: 10px 26px 26px; max-width: 1240px; margin: 0 auto; }

.section-title {
  font-size: 1.25rem; font-weight: 900;
  margin: 26px 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after {
  content: ""; flex: 1; max-width: 90px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--red), var(--accent), transparent);
}

/* ---------- featured strip ---------- */
.feat-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}
.feat {
  min-width: 138px;
  scroll-snap-align: start;
  position: relative; display: block;
  border-radius: 14px; overflow: hidden;
  aspect-ratio: 3 / 4.1;
  background: var(--card);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.feat:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(124,92,255,.55);
  box-shadow: 0 12px 34px -10px rgba(124,92,255,.4);
  z-index: 2;
}
.feat img, .feat .thumb { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }

.feat-info {
  position: absolute; inset: auto 0 0 0;
  padding: 34px 10px 10px;
  background: linear-gradient(180deg, transparent, rgba(5,6,10,.94) 55%);
  display: flex; flex-direction: column; gap: 4px;
}
.feat .rank {
  font-size: .7rem; font-weight: 900; color: #ffd66b;
}
.feat .feat-name {
  color: #fff; font-weight: 700; font-size: .8rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.feat .feat-go {
  color: var(--accent2); font-size: .72rem; font-weight: 700;
  opacity: 0; transform: translateY(4px); transition: all .18s;
}
.feat:hover .feat-go { opacity: 1; transform: none; }

/* ---------- catalog ---------- */
.head-row { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.head-row .section-title { margin-right: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--tag); color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; font-size: .8rem; font-weight: 600;
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: linear-gradient(90deg, var(--accent), #9a6bff); color: #fff; border-color: transparent; box-shadow: 0 4px 18px -4px rgba(124,92,255,.5); }

.count { color: var(--muted); font-size: .8rem; margin: 10px 0 12px; }

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

.card {
  background: linear-gradient(180deg, var(--card), #0f1220);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0 0 14px;
  display: flex; flex-direction: column; gap: 10px;
  overflow: hidden;
  position: relative;
  transition: transform .15s, border-color .15s, background .15s, box-shadow .15s;
  animation: rise .4s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(124,92,255,.5);
  background: var(--card-hover);
  box-shadow: 0 14px 40px -14px rgba(124,92,255,.45);
}

.thumb {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover; object-position: top;
  display: block;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.thumb.fallback { display: grid; place-items: center; }
.thumb.fallback span {
  font-size: 2.4rem; font-weight: 900; color: rgba(255,255,255,.85);
  text-shadow: 0 2px 12px rgba(0,0,0,.4); letter-spacing: 2px;
}

.card h3 { font-size: .95rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; padding: 0 16px; margin-top: -2px; }
.card .desc { color: var(--muted); font-size: .82rem; line-height: 1.5; flex: 1; padding: 0 16px; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px; }

.tag {
  background: var(--tag); color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 7px; padding: 3px 8px;
  font-size: .66rem; font-weight: 700; letter-spacing: .2px;
}
.tag.ready     { color: #3ee6a0; }
.tag.multi     { color: #6ea8ff; }
.tag.free      { color: #ffb84d; }
.tag.needfiles { color: #ff7a7a; }
.tag.console   { color: #d6b2ff; }

.card .actions { display: flex; gap: 8px; padding: 0 16px; }
.btn {
  flex: 1; text-align: center; text-decoration: none;
  padding: 9px 10px; border-radius: 10px; font-weight: 700; font-size: .82rem;
  transition: filter .15s, transform .15s;
}
.btn.play { background: linear-gradient(90deg, var(--accent), #9a6bff); color: #fff; box-shadow: 0 6px 18px -6px rgba(124,92,255,.6); }
.btn.play:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn.gh {
  flex: 0; aspect-ratio: 1; display: grid; place-items: center;
  background: var(--tag); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px;
}
.btn.gh:hover { border-color: var(--accent); }
.btn.gh svg { width: 16px; height: 16px; fill: currentColor; }

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

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 30px;
  padding: 34px 26px 22px;
  color: var(--muted); font-size: .82rem; line-height: 1.6;
}
.foot-grid {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr;
  gap: 30px;
}
.foot-brand p { margin-top: 12px; }
.foot-col h4 { color: var(--text); font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.foot-col a {
  display: block; color: var(--muted); text-decoration: none; padding: 3px 0;
  transition: color .15s;
}
.foot-col a:hover { color: var(--accent2); }
.footer .muted { margin: 26px auto 4px; max-width: 900px; text-align: center; color: #5b637a; }
.footer .copy { text-align: center; color: #464d61; margin-top: 4px; }

@media (max-width: 900px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .menu { display: none; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .feat-row { grid-template-columns: repeat(auto-fill, 120px); }
  .stats { gap: 24px; }
  .hero { padding-top: 42px; }
  .head-row { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 430px) {
  .grid { grid-template-columns: 1fr; }
}
