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

:root {
  --primary: #6c5ce7;
  --primary-dark: #5a4bd1;
  --secondary: #00cec9;
  --bg-dark: #0a0a0f;
  --bg-card: #15151f;
  --bg-card-hover: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --border: #2a2a3a;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #e17055;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden {
  display: none !important;
}

/* Header */
.header {
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  gap: 20px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  font-size: 28px;
}

.logo-text {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-bar {
  display: flex;
  flex: 1;
  max-width: 400px;
  min-width: 200px;
}

.search-bar input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input:focus {
  border-color: var(--primary);
}

.search-bar input::placeholder {
  color: var(--text-secondary);
}

.search-btn {
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}

.search-btn:hover {
  background: var(--primary-dark);
}

.nav {
  display: flex;
  gap: 15px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--text-primary);
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 80px 0;
  text-align: center;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 15px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero p {
  font-size: 20px;
  opacity: 0.9;
  margin-bottom: 30px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-close {
  background: var(--danger);
  color: white;
  padding: 8px 16px;
}

.btn-close:hover {
  opacity: 0.9;
}

/* Games Section */
.games-section {
  padding: 60px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-header h2 {
  font-size: 28px;
  font-weight: 700;
}

.game-count {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Sort */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 25px;
  color: var(--text-secondary);
  font-size: 14px;
}

.sort-bar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

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

.game-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.3s;
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.game-card-cover {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card-cover .placeholder {
  font-size: 48px;
  opacity: 0.3;
}

.game-card-info {
  padding: 15px;
}

.game-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.genre-badge {
  background: var(--primary);
  color: white;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.rating {
  color: var(--warning);
  font-weight: 600;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 60px 0;
  color: var(--text-secondary);
  font-size: 18px;
}

/* About Section */
.about-section {
  padding: 60px 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.about-section h2 {
  font-size: 28px;
  margin-bottom: 20px;
  text-align: center;
}

.about-section > .container > p {
  text-align: center;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 40px;
}

.about-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.feature {
  text-align: center;
  padding: 30px;
  background: var(--bg-dark);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.feature-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 15px;
}

.feature h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.feature p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Footer */
.footer {
  padding: 30px 0;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
}

.footer-note {
  font-size: 12px;
  margin-top: 5px;
}

/* Game Detail Page */
.game-detail {
  padding: 40px 0;
}

.loading {
  text-align: center;
  padding: 60px;
  font-size: 18px;
  color: var(--text-secondary);
}

.game-not-found {
  text-align: center;
  padding: 60px;
}

.game-not-found h2 {
  margin-bottom: 20px;
}

.game-header {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  margin-bottom: 50px;
}

.game-cover {
  width: 100%;
  height: 350px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.game-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-info h1 {
  font-size: 36px;
  margin-bottom: 20px;
}

.game-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  font-size: 16px;
  font-weight: 600;
}

.game-description {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 25px;
}

.game-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

/* Emulator */
.emulator-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 25px;
  margin-bottom: 40px;
}

.emulator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.emulator-header h2 {
  font-size: 22px;
}

.emulator-header-actions {
  display: flex;
  gap: 10px;
}

.emulator-iframe-container {
  position: relative;
  width: 100%;
  min-height: 500px;
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.emulator-iframe {
  width: 100%;
  height: 500px;
  border: none;
  display: block;
}

.emulator-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 18px;
  background: var(--bg-dark);
}

.emulator-info {
  margin-top: 15px;
  padding: 15px;
  background: var(--bg-dark);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.emulator-info p {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 5px 0;
}

.emulator-info strong {
  color: var(--text-primary);
}

/* Screenshots */
.screenshots-section {
  margin-top: 40px;
}

.screenshots-section h2 {
  font-size: 22px;
  margin-bottom: 20px;
}

.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.screenshot-item {
  height: 150px;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.screenshot-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 16px;
  }

  .header-content {
    flex-direction: column;
    gap: 15px;
  }

  .search-bar {
    max-width: 100%;
    width: 100%;
  }

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

  .game-card-cover {
    height: 140px;
  }

  .game-header {
    grid-template-columns: 1fr;
    gap: 25px;
  }

  .game-cover {
    height: 250px;
    max-width: 280px;
    margin: 0 auto;
  }

  .game-info h1 {
    font-size: 28px;
  }

  .game-meta {
    grid-template-columns: repeat(2, 1fr);
  }

  .game-actions {
    flex-direction: column;
  }

  .game-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .emulator-iframe {
    height: 400px;
  }

  .emulator-iframe-container {
    min-height: 400px;
  }
}

@media (max-width: 480px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .game-card-info {
    padding: 10px;
  }

  .game-card-title {
    font-size: 14px;
  }

  .filters {
    gap: 6px;
  }

  .filter-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}
