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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  min-height: 100vh;
}

.header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-bottom: 1px solid #2a2a4a;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, #00d4ff, #7b2ff7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.search-box {
  flex: 1;
  max-width: 400px;
}
.search-box input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #3a3a5a;
  border-radius: 8px;
  background: #1a1a30;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.search-box input:focus { border-color: #7b2ff7; }
.search-box input::placeholder { color: #666; }
.stats {
  color: #888;
  font-size: 14px;
  white-space: nowrap;
}
.stats span { color: #7b2ff7; font-weight: 600; }

.tag-filter {
  max-width: 1400px;
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-filter .tag-btn {
  padding: 6px 14px;
  border: 1px solid #3a3a5a;
  border-radius: 20px;
  background: transparent;
  color: #aaa;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}
.tag-filter .tag-btn:hover { border-color: #7b2ff7; color: #fff; }
.tag-filter .tag-btn.active {
  background: #7b2ff7;
  border-color: #7b2ff7;
  color: #fff;
}

.game-grid {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}
.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: #666;
  font-size: 16px;
}

.game-card {
  background: linear-gradient(135deg, #1a1a2e, #1e1e36);
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  position: relative;
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: #7b2ff7;
  box-shadow: 0 8px 32px rgba(123, 47, 247, .15);
}
.game-card .thumb {
  width: 100%;
  aspect-ratio: 16/10;
  background: #16162a;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.game-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.game-card .thumb .no-image {
  color: #444;
  font-size: 48px;
}
.game-card .info {
  padding: 14px;
}
.game-card .name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.game-card .desc {
  font-size: 12px;
  color: #888;
  line-height: 1.5;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card .tag {
  padding: 2px 8px;
  background: rgba(123, 47, 247, .2);
  border-radius: 4px;
  font-size: 11px;
  color: #a78bfa;
}

.embed-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.9);
  z-index: 200;
  flex-direction: column;
}
.embed-overlay.active { display: flex; }
.embed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #1a1a2e;
  border-bottom: 1px solid #2a2a4a;
}
.embed-header .gname { font-size: 18px; font-weight: 600; color: #fff; }
.embed-header .actions { display: flex; gap: 8px; }
.embed-header button {
  padding: 6px 14px;
  border: 1px solid #3a3a5a;
  border-radius: 6px;
  background: transparent;
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}
.embed-header button:hover { border-color: #7b2ff7; color: #fff; }
.embed-header .btn-close:hover { border-color: #ff4444; color: #ff4444; }
.embed-frame {
  flex: 1;
  border: none;
  width: 100%;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: #666;
}

@media (max-width: 768px) {
  .header-inner { flex-direction: column; gap: 12px; }
  .search-box { max-width: 100%; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}
