@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg:         #0f0f13;
  --bg2:        #17171d;
  --bg3:        #1e1e26;
  --bg4:        #25252f;
  --accent:     #7c3aed;
  --accent2:    #a855f7;
  --accent-dim: rgba(124,58,237,.15);
  --accent-glow:rgba(124,58,237,.35);
  --text:       #e8e8f0;
  --text-dim:   rgba(200,200,220,.55);
  --text-muted: rgba(200,200,220,.28);
  --border:     rgba(255,255,255,.07);
  --border-h:   rgba(124,58,237,.4);
  --r:          8px;
  --r-lg:       12px;
  --sidebar-w:  220px;
  --topbar-h:   56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
img { display: block; }
button { font-family: 'Inter', sans-serif; cursor: pointer; border: none; background: none; color: inherit; }

/* scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── topbar ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px 0 0;
}
.topbar-logo {
  width: var(--sidebar-w);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  height: 100%;
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1;
  box-shadow: 0 0 14px var(--accent-glow);
  flex-shrink: 0;
}
.logo-name {
  font-size: 15px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: #fff;
}
.logo-name em { color: var(--accent2); font-style: normal; }

.topbar-search {
  flex: 1; max-width: 480px; position: relative;
}
.topbar-search input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px 8px 38px;
  font-family: 'Inter', sans-serif;
  font-size: 14px; color: var(--text); outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.topbar-search-ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.topbar-search-ico svg { width: 14px; height: 14px; }

/* ── sidebar ── */
.sidebar-nav {
  position: fixed;
  top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  z-index: 200;
  padding: 12px 8px 40px;
}
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-section-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r);
  font-size: 13px; font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active {
  background: var(--accent-dim);
  color: #fff;
  border: 1px solid rgba(124,58,237,.2);
}
.nav-item-ico { font-size: 16px; line-height: 1; flex-shrink: 0; width: 20px; text-align: center; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 10px; }

/* ── main content area ── */
.content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  padding: 24px 24px 60px;
}

/* ── section ── */
.sec { margin-bottom: 36px; }
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.sec-title {
  font-size: 15px; font-weight: 700;
  color: #fff; letter-spacing: .02em;
}
.sec-more {
  font-size: 12px; font-weight: 500;
  color: var(--accent2); opacity: .8;
  transition: opacity .15s;
}
.sec-more:hover { opacity: 1; }

/* ── game grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}

/* ── game row (horizontal scroll) ── */
.row {
  display: flex; gap: 12px;
  overflow-x: auto; padding-bottom: 6px;
  scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
.row .card { flex-shrink: 0; width: 140px; }

/* ── card ── */
.card {
  border-radius: var(--r-lg); overflow: hidden;
  background: var(--bg2);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex; flex-direction: column;
  aspect-ratio: 1 / 1.15;
  position: relative;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.card:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--border-h);
  box-shadow: 0 8px 28px rgba(0,0,0,.5), 0 0 0 1px rgba(124,58,237,.2);
}
.card-img-wrap { flex: 1; overflow: hidden; background: var(--bg3); }
.card-img { width: 100%; height: 100%; object-fit: cover; transition: transform .28s; }
.card:hover .card-img { transform: scale(1.06); }
.card-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  background: var(--bg3);
}
.card-foot { padding: 8px 10px 9px; background: var(--bg2); }
.card-name {
  font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.card-cat {
  font-size: 10px; color: var(--text-muted);
  text-transform: capitalize; margin-top: 1px;
}
.card-badge {
  position: absolute; top: 6px; left: 6px;
  padding: 2px 6px; border-radius: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.badge-hot { background: #ef4444; color: #fff; }
.badge-new { background: #22c55e; color: #fff; }

/* ── featured big card ── */
.featured-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  height: 340px;
  margin-bottom: 36px;
}
.featured-main {
  grid-row: 1 / 3;
  border-radius: var(--r-lg); overflow: hidden;
  background: var(--bg3);
  cursor: pointer; position: relative;
  transition: transform .18s, box-shadow .18s;
}
.featured-main:hover { transform: scale(1.01); box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.featured-main img { width: 100%; height: 100%; object-fit: cover; }
.featured-main-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(15,15,19,.95) 0%, transparent 50%);
}
.featured-main-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px;
}
.featured-main-title {
  font-size: 20px; font-weight: 700; color: #fff;
  margin-bottom: 6px;
}
.featured-main-play {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff;
  padding: 7px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  transition: background .15s, box-shadow .15s;
}
.featured-main-play:hover { background: var(--accent2); box-shadow: 0 0 16px var(--accent-glow); }

.featured-small {
  border-radius: var(--r); overflow: hidden;
  background: var(--bg3); cursor: pointer; position: relative;
  transition: transform .18s;
}
.featured-small:hover { transform: scale(1.03); }
.featured-small img { width: 100%; height: 100%; object-fit: cover; }
.featured-small-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(15,15,19,.8) 0%, transparent 60%);
}
.featured-small-name {
  position: absolute; bottom: 8px; left: 10px; right: 10px;
  font-size: 12px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── ad slots ── */
.ad-slot {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.ad-leaderboard { width: 100%; min-height: 90px; margin-bottom: 24px; }
.ad-banner { width: 100%; min-height: 60px; margin: 0 0 24px; }

/* ── no results ── */
.no-results {
  grid-column: 1/-1; text-align: center; padding: 60px 0;
  color: var(--text-muted);
}
.no-results-ico { font-size: 44px; margin-bottom: 10px; }

/* ── search views ── */
#searchView { display: none; }
#searchView.on { display: block; }
#browseView.off { display: none; }

/* ── footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 16px 24px; margin-left: var(--sidebar-w);
  text-align: center; color: var(--text-muted);
  font-size: 11px; letter-spacing: .05em;
}
.footer b { color: var(--accent2); font-weight: 600; }

/* ── toast ── */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: var(--accent); color: #fff;
  padding: 10px 20px; border-radius: var(--r);
  font-size: 13px; font-weight: 600;
  opacity: 0; transition: all .22s; z-index: 9999;
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 8px 28px var(--accent-glow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── animations ── */
@keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.fu { animation: fadeUp .3s ease both; }

/* ── responsive ── */
@media(max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar-nav { display: none; }
  .topbar-logo { width: auto; border-right: none; }
  .content { padding: 16px 14px 50px; }
  .featured-grid { grid-template-columns: 1fr 1fr; grid-template-rows: auto; height: auto; }
  .featured-main { grid-row: auto; aspect-ratio: 16/9; }
}
@media(max-width: 600px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .featured-grid { grid-template-columns: 1fr 1fr; }
}
