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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0a0a1a;
  color: #e0e0e0;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #0f0f2e, #1a0a2e);
  padding: 20px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #00f0ff33;
  box-shadow: 0 0 30px #00f0ff11;
  flex-wrap: wrap;
  gap: 15px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 32px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.logo h1 {
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(90deg, #00f0ff, #ff00ff, #00ff88);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.search-area {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#searchInput {
  padding: 10px 16px;
  border: 2px solid #00f0ff44;
  border-radius: 25px;
  background: #0f0f2e;
  color: #fff;
  font-size: 14px;
  width: 220px;
  outline: none;
  transition: border-color 0.3s;
}

#searchInput:focus {
  border-color: #00f0ff;
  box-shadow: 0 0 15px #00f0ff33;
}

#categoryFilter {
  padding: 10px 16px;
  border: 2px solid #ff00ff44;
  border-radius: 25px;
  background: #0f0f2e;
  color: #fff;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.3s;
}

#categoryFilter:focus {
  border-color: #ff00ff;
  box-shadow: 0 0 15px #ff00ff33;
}

#categoryFilter option {
  background: #1a1a2e;
}

.stats-bar {
  padding: 12px 40px;
  background: #0d0d24;
  border-bottom: 1px solid #ffffff0a;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #888;
  flex-wrap: wrap;
  gap: 8px;
}

.stats-bar span {
  color: #00f0ff;
  font-weight: bold;
}

main {
  padding: 30px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

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

.game-card {
  background: linear-gradient(145deg, #1a1a2e, #12122a);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #ffffff0a;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  position: relative;
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 240, 255, 0.15);
  border-color: #00f0ff44;
}

.game-thumb {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  position: relative;
  overflow: hidden;
}

.game-thumb::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(transparent, #1a1a2e);
}

.game-thumb.neon-cyan {
  background: linear-gradient(135deg, #00f0ff22, #00f0ff05);
}
.game-thumb.neon-magenta {
  background: linear-gradient(135deg, #ff00ff22, #ff00ff05);
}
.game-thumb.neon-green {
  background: linear-gradient(135deg, #00ff8822, #00ff8805);
}
.game-thumb.neon-yellow {
  background: linear-gradient(135deg, #ffdd0022, #ffdd0005);
}
.game-thumb.neon-red {
  background: linear-gradient(135deg, #ff444422, #ff444405);
}

.game-info {
  padding: 18px 20px 20px;
}

.game-info h3 {
  font-size: 18px;
  margin-bottom: 6px;
  color: #fff;
}

.game-info .category {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #00f0ff;
  margin-bottom: 8px;
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  background: #00f0ff11;
  border: 1px solid #00f0ff33;
}

.game-info p {
  font-size: 13px;
  color: #999;
  line-height: 1.4;
}

.play-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 24px;
  background: linear-gradient(90deg, #00f0ff, #00aaff);
  color: #0a0a1a;
  font-weight: bold;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}

.play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px #00f0ff66;
}

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

.no-games span {
  font-size: 48px;
  display: block;
  margin-bottom: 15px;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 95%;
  height: 95%;
  max-width: 1200px;
  background: #0a0a1a;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #00f0ff33;
  box-shadow: 0 0 60px #00f0ff22;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #0f0f2e;
  border-bottom: 1px solid #ffffff0a;
}

.modal-header h2 {
  font-size: 18px;
  color: #fff;
}

.modal-header .close-btn {
  background: none;
  border: none;
  color: #ff4444;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.modal-header .close-btn:hover {
  background: #ff444422;
}

.modal-body {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-body iframe {
  width: 100%;
  flex: 1;
  border: none;
  min-height: 0;
}

.modal-body {
  flex: 1;
  position: relative;
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}
.share-btn:hover {
  background: #00f0ff22;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #0f0f2e;
  border-top: 1px solid #ffffff0a;
  gap: 12px;
  flex-wrap: wrap;
}

.score-save {
  display: flex;
  gap: 8px;
  align-items: center;
}

.score-save input {
  width: 130px;
  padding: 7px 12px;
  background: #0d0d24;
  border: 1px solid #ffffff0a;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.score-save input:focus {
  border-color: #00f0ff44;
}

.score-save button {
  padding: 7px 16px;
  background: #00ff88;
  color: #0a0a1a;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.score-save button:hover {
  box-shadow: 0 0 15px #00ff8866;
}

.high-score-display {
  color: #ffdd00;
  font-size: 14px;
  font-weight: bold;
}

.game-record {
  font-size: 12px;
  color: #ffdd00;
  margin-top: 4px;
  min-height: 16px;
}

footer {
  text-align: center;
  padding: 20px;
  color: #444;
  font-size: 13px;
  border-top: 1px solid #ffffff0a;
  margin-top: 30px;
}

footer a {
  color: #00f0ff;
  text-decoration: none;
  cursor: pointer;
}
footer a:hover {
  text-shadow: 0 0 10px #00f0ff;
}
footer code {
  color: #ff00ff;
  background: #ff00ff11;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.ad-container {
  max-width: 728px;
  margin: 20px auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90px;
}

@media (max-width: 768px) {
  header {
    padding: 15px 20px;
    justify-content: center;
    text-align: center;
  }
  .search-area {
    width: 100%;
    justify-content: center;
  }
  #searchInput {
    width: 100%;
  }
  main {
    padding: 20px;
  }
  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 15px;
  }
  .modal-content {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
}
