:root {
    --bg: #fff;
    --bg2: #fff;
    --card: #fff;
    --border: #ccc;
    --text: #555;
    --muted: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --green: #3fb950;
    --sidebar-w: 260px;
    --radius: 12px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg2);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 40;
    display: flex;
    flex-direction: column;
}

.sidebar-header {    padding: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header img.logo {
    height: 80px;
    width: 197px;
}

.sidebar-header .site-name {
    font-weight: 700;
    font-size: 1.1rem;
    display: none;
}

.sidebar-header .site-name span {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.8rem;
  display: block;
}

.cat-list {
  list-style: none;
  padding: 10px 0 24px;
  flex: 1;
}

.cat-list li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text);
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.cat-list li a:hover,
.cat-list li a.active {
  background: rgba(88, 166, 255, 0.08);
  border-left-color: var(--accent);
  color: var(--accent);
}

.cat-list li a img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

.cat-list .all-link {
  font-weight: 600;
  margin-bottom: 4px;
}

/* Main */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #fff;
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.menu-toggle {
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.search-wrap {
  flex: 1;
  min-width: 180px;
  max-width: 420px;
}

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

.page-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.content {
  padding: 20px;
  flex: 1;
}

/* Games grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: #484f58;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}

.game-cover {
    aspect-ratio: 16 / 10;
    background: #fff;
    overflow: hidden;
}
.game-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    padding: 13px;
    border-radius: 23px;
}
.game-cover .placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: var(--muted);
    background: #fff;
}

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

.game-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-desc {
  font-size: 0.8rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.tag, .cat {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 4px;
}
.cat {
  background: rgba(63, 185, 80, 0.12);
  color: var(--green);
}
.tag {
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent);
}

.play-btn {
  display: block;
  margin-top: 8px;
  text-align: center;
  background: var(--accent);
  color: #fff !important;
  padding: 8px 0;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.15s;
}
.play-btn:hover { background: var(--accent-hover); }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px 16px;
  color: var(--muted);
}
.empty h2 { color: var(--text); margin-bottom: 6px; }

footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 35;
}

/* Mobile */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,0.4);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .menu-toggle {
    display: flex;
  }
  .page-title {
    display: none;
  }
  .content {
    padding: 14px;
  }
  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
  .game-title {
    font-size: 0.88rem;
  }
  .game-desc {
    display: none;
  }
}

@media (max-width: 420px) {
  .games-grid {
    grid-template-columns: 1fr 1fr;
  }
}
