:root {
  color-scheme: light dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Montserrat', sans-serif;
  background: radial-gradient(circle at top, rgba(22, 35, 71, 0.95), rgba(3, 6, 18, 0.98));
  color: var(--surface-contrast);
}

body[data-theme="light"] {
  background: linear-gradient(180deg, #f2f4fa 0%, #e7ebf5 100%);
  color: #0b1224;
}

.games-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  border-bottom: 1px solid var(--surface-border);
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.games-header__intro h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.games-header__intro p {
  margin: 0;
  max-width: 600px;
  font-size: 1rem;
  opacity: 0.9;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.back-link:hover,
.back-link:focus-visible {
  text-decoration: underline;
}

.games-layout {
  padding: clamp(1.5rem, 4vw, 3rem);
}

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

.game-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--surface-border);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-card h2 {
  margin: 0;
  font-size: 1.3rem;
}

.game-card p {
  margin: 0;
  color: inherit;
  opacity: 0.85;
}

.game-embed {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  min-height: 520px;
  background: rgba(0, 0, 0, 0.4);
}

.game-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  min-height: 520px;
  opacity: 1;
  transition: opacity 0.2s ease;
}

@media (min-width: 768px) {
  .game-embed {
    min-height: 600px;
  }

  .game-embed iframe {
    min-height: 600px;
  }
}

.embed-loading,
.embed-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 1.5rem;
  background: rgba(6, 10, 24, 0.78);
  color: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.game-card.is-loading .embed-loading {
  opacity: 1;
  pointer-events: auto;
}

.game-card.has-error iframe {
  opacity: 0;
}

.game-card.has-error .embed-error {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--theme-color);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.embed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.embed-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: linear-gradient(135deg, rgba(142, 91, 255, 0.3), rgba(255, 127, 197, 0.25));
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.embed-button:hover,
.embed-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.embed-button.secondary {
  background: transparent;
}

.embed-button.studio {
  background: linear-gradient(135deg, rgba(142, 91, 255, 0.95), rgba(255, 127, 197, 0.85));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.embed-note {
  font-size: 0.95rem;
  opacity: 0.9;
}
