/* ===== TOKENS ===== */
:root {
  --bg: #0a0b0f;
  --surface: #12141a;
  --surface2: #1a1d26;
  --border: #22263a;
  --accent: #5b7fff;
  --accent2: #a259ff;
  --green: #3dffa0;
  --text: #e8eaf0;
  --muted: #6b7080;
  --card-hover: #1e2130;
  --font-main: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 10px;
  --radius-sm: 6px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,11,15,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.logo-icon {
  font-size: 22px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent));
}
.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.logo-accent { color: var(--accent); }

.search-wrap {
  flex: 1;
  position: relative;
  max-width: 520px;
}
.search-wrap input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 14px;
  padding: 9px 40px 9px 14px;
  outline: none;
  transition: border-color .2s;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--muted); }
.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 18px;
  pointer-events: none;
}

.badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 4px 12px;
  white-space: nowrap;
}

/* ===== LAYOUT ===== */
.layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 210px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 20px 0;
  background: var(--surface);
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-section { margin-bottom: 28px; }
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--muted);
  padding: 0 18px 8px;
  font-family: var(--font-mono);
}

.filter-list {
  list-style: none;
}
.filter-list li {
  cursor: pointer;
  padding: 8px 18px;
  font-size: 13.5px;
  color: var(--muted);
  border-left: 3px solid transparent;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 7px;
}
.filter-list li:hover {
  color: var(--text);
  background: var(--surface2);
}
.filter-list li.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(91,127,255,0.08);
  font-weight: 600;
}

/* ===== CONTENT ===== */
.content {
  flex: 1;
  padding: 28px 28px 60px;
  overflow-y: auto;
  min-width: 0;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.content-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.view-toggle { display: flex; gap: 6px; }
.view-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  padding: 6px 10px;
  transition: all .15s;
}
.view-btn:hover, .view-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== GAME CARDS (GRID) ===== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.games-grid.list-view {
  grid-template-columns: 1fr;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.game-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity .2s;
}
.game-card:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(91,127,255,0.12);
}
.game-card:hover::before { opacity: 1; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.card-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.card-play-badge {
  font-size: 10px;
  font-weight: 700;
  background: rgba(61,255,160,0.12);
  color: var(--green);
  border: 1px solid rgba(61,255,160,0.3);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.card-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-footer {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}
.tag {
  font-size: 10.5px;
  font-family: var(--font-mono);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  padding: 2px 8px;
}

/* List view card adjustments */
.list-view .game-card {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
}
.list-view .card-icon { font-size: 22px; }
.list-view .card-desc { -webkit-line-clamp: 1; }
.list-view .card-body { flex: 1; min-width: 0; }
.list-view .card-top { flex-direction: column; gap: 4px; }

/* ===== NO RESULTS ===== */
.no-results {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.no-results-icon { font-size: 52px; margin-bottom: 16px; }
.no-results p { font-size: 15px; }
.hidden { display: none !important; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,6,10,0.82);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 520px;
  width: 100%;
  padding: 32px;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.modal-close:hover { color: var(--text); border-color: var(--text); }

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.modal-icon { font-size: 42px; }
.modal-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.modal-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.modal-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-actions { display: flex; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  border: none;
}
.btn-github {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-github:hover { border-color: var(--accent); color: var(--accent); }
.btn-play {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 16px rgba(91,127,255,0.35);
}
.btn-play:hover { opacity: .88; transform: translateY(-1px); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 16px; }
  .games-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 14px; gap: 10px; }
  .logo-text { font-size: 15px; }
}
@media (max-width: 480px) {
  .games-grid { grid-template-columns: 1fr; }
}
