:root {
  color-scheme: light dark;
  --primary-color: #667eea;
  --primary-dark: #5a6fd8;
  --secondary-color: #764ba2;
  --text-color: #333;
  --text-light: #666;
  --background: #fff;
  --card-bg: #f8f9fa;
  --border-color: #e1e5e9;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.15);
  --success-color: #10b981;
  --free-color: #22c55e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #f0f0f0;
    --text-light: #a0a0a0;
    --background: #1a1a1a;
    --card-bg: #2d2d2d;
    --border-color: #404040;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.4);
  }
}

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  background: var(--background);
  color: var(--text-color);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.banner {
  text-align: center;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 3rem 2rem;
  border-radius: 16px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.banner h1 {
  font-size: 3rem;
  margin: 0 0 1rem 0;
  font-weight: 700;
}

.banner-subtitle {
  font-size: 1.2rem;
  margin: 0;
  opacity: 0.9;
  font-weight: 300;
}

.search-container {
  margin-bottom: 2rem;
}

.search-box {
  display: flex;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

#query-search {
  flex: 1;
  padding: 1rem 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  font-size: 1.1rem;
  background: var(--card-bg);
  color: var(--text-color);
  transition: all 0.3s ease;
}

#query-search:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#search-btn {
  padding: 1rem 2rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

#search-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.game-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.game-link {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
}

.game-card-content {
  padding: 1.5rem;
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.game-info {
  flex: 1;
}

.game-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  line-height: 1.4;
  color: var(--text-color);
}

.game-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.game-price {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-color);
}

.game-price.free {
  color: var(--free-color);
}

.game-origin {
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.best-deal-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--success-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: pulse 2s infinite;
}

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

.loading {
  text-align: center;
  padding: 3rem;
}

.spinner {
  border: 4px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.hidden {
  display: none;
}

.no-results, .error-message {
  text-align: center;
  padding: 3rem;
  grid-column: 1 / -1;
  background: var(--card-bg);
  border-radius: 12px;
  border: 2px dashed var(--border-color);
}

@media (max-width: 768px) {
  main { padding: 1rem; }
  .banner { padding: 2rem 1rem; }
  .banner h1 { font-size: 2rem; }
  .banner-subtitle { font-size: 1rem; }
  .search-box { flex-direction: column; }
  .games-grid { grid-template-columns: 1fr; gap: 1rem; }
  .game-details { flex-direction: column; align-items: flex-start; }
}

/* Footer */
.site-footer {
  max-width: 1200px;
  margin: 2rem auto 0 auto;
  padding: 1rem;
  text-align: center;
  color: var(--text-light);
}
.site-footer a {
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .banner h1 { font-size: 1.75rem; }
  .game-card-content { padding: 1rem; }
  .game-title { font-size: 1.1rem; }
  .game-price { font-size: 1.2rem; }
}

code {
  background: rgba(127,127,127,0.15);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.eneba-manual-card {
  border: 2px dashed #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.eneba-manual-card:hover {
  border-color: #667eea;
  transform: translateY(-2px);
}

.eneba-warning {
  font-size: 0.9rem;
  color: var(--text-light);
  margin: 0.5rem 0 0 0;
  line-height: 1.4;
}

.manual-search-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #f59e0b;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.best-deal-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--success-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: pulse 2s infinite;
}

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

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.lang-toggle {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.lang-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.5rem 0.75rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.9rem;
}

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