:root {
  --bg: #07111f;
  --bg-soft: rgba(14, 27, 48, 0.75);
  --panel: rgba(12, 22, 39, 0.84);
  --panel-strong: rgba(16, 29, 49, 0.96);
  --line: rgba(255, 255, 255, 0.1);
  --text: #eff6ff;
  --muted: #a7bdd8;
  --accent: #ff8a3d;
  --accent-2: #39d0ff;
  --accent-3: #9eff6f;
  --danger: #ff6c8a;
  --shadow: 0 28px 70px rgba(2, 8, 18, 0.48);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(57, 208, 255, 0.14), transparent 32%),
    radial-gradient(circle at 85% 15%, rgba(255, 138, 61, 0.16), transparent 28%),
    linear-gradient(140deg, #040812 0%, #081222 30%, #07111f 100%);
  overflow-x: hidden;
}

button,
input,
a {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 32px clamp(18px, 4vw, 48px) 48px;
}

.background-glow,
.background-grid {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.background-glow {
  filter: blur(70px);
  opacity: 0.7;
}

.glow-a {
  background: radial-gradient(circle at 20% 20%, rgba(57, 208, 255, 0.22), transparent 26%);
}

.glow-b {
  background: radial-gradient(circle at 85% 30%, rgba(255, 138, 61, 0.18), transparent 22%);
}

.background-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.34), transparent 80%);
}

.hero,
.content,
.player-shell {
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 28px;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.search-card,
.stat-card,
.section-head,
.status-banner,
.game-card,
.player-shell,
.meta-panel,
.player-cover,
.quiz-card {
  backdrop-filter: blur(18px);
}

.hero-copy,
.search-card,
.section-head,
.status-banner,
.game-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: var(--radius-xl);
  padding: clamp(28px, 5vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 360px;
  animation: rise-in 0.8s ease both;
}

.eyebrow,
.section-kicker,
.quiz-kicker {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  color: var(--accent-2);
}

.hero-copy h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.7rem, 6vw, 5.6rem);
  line-height: 0.95;
}

.hero-copy h1 span {
  display: inline-block;
  margin-right: 8px;
  transform: rotate(-10deg);
}

.hero-text {
  max-width: 38rem;
  margin: 18px 0 0;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--muted);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}

.stat-card strong {
  font-size: 1.12rem;
}

.hero-panel {
  display: flex;
}

.search-card {
  width: 100%;
  border-radius: var(--radius-xl);
  padding: 24px;
  animation: rise-in 1s ease both;
}

.search-label,
.toolbar-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.search-input-wrap:focus-within {
  border-color: rgba(57, 208, 255, 0.55);
  box-shadow: 0 0 0 5px rgba(57, 208, 255, 0.12);
}

.search-icon {
  font-size: 1.2rem;
  color: var(--accent-2);
}

#search-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

#search-input::placeholder {
  color: rgba(239, 246, 255, 0.45);
}

.toolbar {
  display: grid;
  gap: 24px;
  margin-top: 22px;
}

.filter-group {
  display: grid;
  gap: 14px;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.chip:hover,
.chip:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(57, 208, 255, 0.45);
  outline: none;
}

.chip.active {
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.24), rgba(57, 208, 255, 0.2));
  border-color: rgba(255, 255, 255, 0.26);
}

.toolbar-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 16px;
  padding: 0 18px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.1);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #ffb23d);
  color: #101522;
  font-weight: 700;
  box-shadow: 0 16px 28px rgba(255, 138, 61, 0.28);
}

.ghost-button:hover,
.ghost-button:focus-visible,
.primary-button:hover,
.primary-button:focus-visible,
.game-card-button:hover,
.game-card-button:focus-visible,
.modal-close:hover,
.modal-close:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.content {
  margin-top: 34px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}

.section-head h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.5rem, 3.6vw, 2.2rem);
}

.section-description {
  margin: 0;
  max-width: 26rem;
  color: var(--muted);
  line-height: 1.6;
}

.status-banner {
  margin-top: 18px;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  color: var(--muted);
}

.status-banner.error {
  border-color: rgba(255, 108, 138, 0.38);
  color: #ffd7df;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.game-card {
  border-radius: 26px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(26px);
  animation: card-in 0.55s ease forwards;
}

.game-card-button {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.game-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(140deg, rgba(57, 208, 255, 0.2), rgba(255, 138, 61, 0.22));
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.game-card-button:hover .card-image,
.game-card-button:focus-visible .card-image {
  transform: scale(1.06);
}

.card-type,
.card-category,
.modal-badge,
.quiz-category {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.card-type {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(7, 17, 31, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.game-card-body {
  padding: 18px 18px 20px;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-category,
.modal-badge,
.quiz-category {
  background: rgba(57, 208, 255, 0.11);
  color: #bcefff;
  border: 1px solid rgba(57, 208, 255, 0.16);
}

.card-title {
  margin: 14px 0 10px;
  font-size: 1.28rem;
  font-family: "Space Grotesk", sans-serif;
}

.card-description,
#modal-description,
#results-summary,
#quiz-feedback {
  color: var(--muted);
  line-height: 1.6;
}

.card-description {
  min-height: 4.8em;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  color: #fff4db;
}

.card-cta {
  font-weight: 600;
}

.card-arrow {
  font-size: 1.15rem;
}

.empty-state {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  padding: 34px 24px;
  text-align: center;
  color: var(--muted);
}

.player-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  z-index: 20;
}

.player-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.player-modal.game-mode {
  padding: 0;
}

.player-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 14, 0.75);
  backdrop-filter: blur(10px);
}

.player-shell {
  position: relative;
  width: min(1520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5);
}

.player-modal.game-mode .player-shell {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  border: none;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 1.5rem;
}

.player-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 72px 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.player-modal.game-mode .player-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 72px;
  z-index: 2;
  padding: 20px 24px;
  border-bottom: none;
  background: linear-gradient(180deg, rgba(4, 8, 18, 0.92), rgba(4, 8, 18, 0.42), transparent);
  pointer-events: none;
}

.player-modal.game-mode .player-title-wrap,
.player-modal.game-mode .player-actions,
.player-modal.game-mode .player-actions a {
  pointer-events: auto;
}

.player-head h3 {
  margin: 14px 0 8px;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  font-family: "Space Grotesk", sans-serif;
}

.player-head p {
  margin: 0;
}

.player-actions {
  display: flex;
  align-items: start;
}

.player-content {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: min(76vh, 920px);
}

.player-modal.game-mode .player-content {
  grid-template-columns: 1fr;
  min-height: 100vh;
  height: 100vh;
}

.player-side {
  padding: 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.player-modal.game-mode .player-side {
  display: none;
}

.player-cover {
  overflow: hidden;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.player-cover img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.meta-panel {
  margin-top: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.meta-panel h4 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.meta-list {
  display: grid;
  gap: 12px;
}

.meta-item {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.meta-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.meta-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.player-stage {
  position: relative;
  min-height: 100%;
  background:
    linear-gradient(160deg, rgba(57, 208, 255, 0.07), transparent 36%),
    linear-gradient(190deg, rgba(255, 138, 61, 0.08), transparent 38%);
}

.hidden {
  display: none !important;
}

.stage-placeholder,
.iframe-stage,
.quiz-stage {
  width: 100%;
  height: 100%;
}

.stage-placeholder {
  display: grid;
  place-items: center;
  gap: 18px;
  text-align: center;
  color: var(--muted);
}

.loader-ring {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent-2);
  animation: spin 0.9s linear infinite;
}

.iframe-stage {
  padding: 20px;
}

.player-modal.game-mode .iframe-stage {
  padding: 0;
  height: 100vh;
}

#game-frame {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 24px;
  background: #010611;
  min-height: calc(100vh - 220px);
}

.player-modal.game-mode #game-frame {
  min-height: 100vh;
  height: 100vh;
  border-radius: 0;
}

.player-modal.game-mode .stage-placeholder {
  min-height: 100vh;
}

.quiz-stage {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  padding: 24px;
}

.quiz-header,
.quiz-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.quiz-header h4,
#quiz-question {
  margin: 8px 0 0;
  font-family: "Space Grotesk", sans-serif;
}

.quiz-score {
  min-width: 120px;
  text-align: center;
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.quiz-progress-wrap {
  display: grid;
  gap: 10px;
}

.quiz-progress-bar {
  width: 100%;
  height: 14px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.quiz-progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-3));
  transition: width 0.25s ease;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(20px, 3vw, 34px);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.quiz-category {
  width: fit-content;
  margin-bottom: 18px;
}

#quiz-question {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  line-height: 1.35;
}

.quiz-answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.answer-button {
  min-height: 74px;
  border-radius: 18px;
  padding: 14px 16px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.answer-button:hover,
.answer-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(57, 208, 255, 0.45);
  outline: none;
}

.answer-button.correct {
  border-color: rgba(158, 255, 111, 0.55);
  background: rgba(158, 255, 111, 0.15);
}

.answer-button.wrong {
  border-color: rgba(255, 108, 138, 0.55);
  background: rgba(255, 108, 138, 0.16);
}

.answer-button.locked {
  pointer-events: none;
}

.quiz-buttons {
  display: flex;
  gap: 12px;
}

body.modal-open {
  overflow: hidden;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 1180px) {
  .hero,
  .player-content {
    grid-template-columns: 1fr;
  }

  .player-side {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .player-cover img {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 780px) {
  .page-shell {
    padding: 18px 14px 28px;
  }

  .hero-stats,
  .quiz-answers {
    grid-template-columns: 1fr;
  }

  .section-head,
  .player-head,
  .quiz-header,
  .quiz-footer,
  .toolbar-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .player-head {
    padding-right: 64px;
  }

  .player-modal.game-mode .player-head {
    right: 64px;
    padding: 18px 16px;
  }

  .player-modal {
    padding: 8px;
  }

  .player-shell {
    max-height: calc(100vh - 16px);
    border-radius: 24px;
  }

  .iframe-stage,
  .quiz-stage {
    padding: 14px;
  }

  #game-frame {
    min-height: 58vh;
  }

  .card-description {
    min-height: auto;
  }
}
