:root {
  --void: #040817;
  --navy: #0a1533;
  --panel: rgba(10, 22, 56, 0.78);
  --volt: #3fa9ff;
  --ice: #cfeaff;
  --gold: #ffc233;
  --moon: #9aa7bf;
  --text: #e8f3ff;

  /* game glow colors (names match the admin color picker) */
  --tomato: #ff6a3d;
  --sun: #ffc233;
  --mint: #3ddc97;
  --grape: #a774ff;
  --sky: #3fa9ff;

  --display: "Russo One", "Arial Black", sans-serif;
  --body: "Exo 2", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  color: var(--text);
  font-family: var(--body);
  font-size: 1.1rem;
  line-height: 1.5;
  min-height: 100vh;
  background-color: var(--void);
  /* starfield */
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,.8) 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 10%, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 85% 60%, rgba(207,234,255,.8) 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 45%, rgba(255,255,255,.5) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 10% 70%, rgba(207,234,255,.7) 50%, transparent 51%),
    radial-gradient(ellipse at 50% 0%, rgba(63,169,255,.12), transparent 60%);
  background-size: 340px 340px, 260px 260px, 420px 420px, 300px 300px, 220px 220px, 380px 380px, 100% 100%;
  background-attachment: fixed;
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

/* ---------- Hero ---------- */

.hero { position: relative; }

.hero-art {
  position: relative;
  aspect-ratio: 2170 / 725;
  max-height: 80vh;
  width: 100%;
  overflow: hidden;
}

.hero-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 45%;
}

.hero-art::after {
  /* fade the moon surface into the page */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--void) 0%, rgba(4, 8, 23, 0.5) 14%, transparent 34%);
}

.hero-copy {
  position: relative;
  max-width: 1180px;
  margin: -64px auto 0;
  padding: 0 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
  flex-wrap: wrap;
}

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.2rem, 9vw, 6.4rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: var(--ice);
  text-shadow:
    0 0 18px rgba(63, 169, 255, 0.85),
    0 0 48px rgba(63, 169, 255, 0.45);
}

.hero h1 span { color: var(--gold); text-shadow: 0 0 18px rgba(255, 194, 51, 0.7); }

.hero-side { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding-bottom: 6px; }

.hero p {
  margin: 0;
  max-width: 26ch;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 600;
  color: var(--text);
}

.btn-launch {
  display: inline-block;
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: var(--void);
  background: var(--gold);
  padding: 14px 28px;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 0 24px rgba(255, 194, 51, 0.45);
}

.btn-launch:hover { background: #ffd469; }

/* ---------- Game select ---------- */

.select {
  max-width: 1180px;
  margin: 0 auto;
  padding: 64px 28px 80px;
}

.select-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(63, 169, 255, 0.35);
  padding-bottom: 14px;
  margin-bottom: 32px;
}

.select-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  color: var(--ice);
}

.select-head span { color: var(--moon); font-weight: 600; }

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

/* Game card */
.game {
  --c: var(--sky);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 250px;
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 0 28px color-mix(in srgb, var(--c) 22%, transparent);
  backdrop-filter: blur(6px);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.game::before {
  /* gold corner bracket */
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-top: 3px solid var(--gold);
  border-right: 3px solid var(--gold);
  border-radius: 0 6px 0 0;
  opacity: 0.85;
}

a.game:hover {
  transform: translateY(-6px);
  border-color: var(--c);
  box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 0 44px color-mix(in srgb, var(--c) 45%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .game { transition: none; }
  a.game:hover { transform: none; }
}

.game--tomato { --c: var(--tomato); }
.game--sun { --c: var(--sun); }
.game--mint { --c: var(--mint); }
.game--grape { --c: var(--grape); }
.game--sky { --c: var(--sky); }

.badge {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  line-height: 1;
  background:
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 55%, transparent), transparent 70%),
    #07112b;
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%);
}

.game h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.1;
  color: var(--ice);
}

.game p {
  margin: 0;
  color: #b9c6dc;
  font-size: 1rem;
  line-height: 1.45;
}

.play {
  margin-top: auto;
  align-self: flex-start;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: var(--void);
  background: var(--gold);
  padding: 9px 22px;
  border-radius: 8px;
}

/* Next game slot */
.game--soon {
  border: 1px dashed rgba(63, 169, 255, 0.55);
  background: rgba(10, 22, 56, 0.4);
  box-shadow: none;
  justify-content: center;
  text-align: center;
}
.game--soon::before { display: none; }
.game--soon h3 { font-size: 1.3rem; }
.game--soon p { color: var(--moon); }

.loading-bar {
  height: 6px;
  margin: 8px auto 0;
  width: 70%;
  border-radius: 99px;
  background: rgba(63, 169, 255, 0.18);
  overflow: hidden;
}
.loading-bar i {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 99px;
  background: var(--volt);
  box-shadow: 0 0 12px var(--volt);
  animation: load 2.4s ease-in-out infinite;
}
@keyframes load {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}
@media (prefers-reduced-motion: reduce) {
  .loading-bar i { animation: none; width: 60%; }
}

.foot {
  border-top: 1px solid rgba(63, 169, 255, 0.25);
  color: var(--moon);
  text-align: center;
  padding: 26px;
  font-size: 0.95rem;
}

/* ---------- Player ---------- */

.player-body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--void);
}

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--navy);
  border-bottom: 1px solid var(--volt);
  box-shadow: 0 0 18px rgba(63, 169, 255, 0.35);
}

.bar .back,
.bar button {
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--void);
  background: var(--gold);
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  text-decoration: none;
  cursor: pointer;
}

.bar h1 {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  color: var(--ice);
  text-shadow: 0 0 12px rgba(63, 169, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage { flex: 1; display: flex; }
.stage iframe { flex: 1; width: 100%; border: 0; background: #000; }

.missing { margin: auto; max-width: 36ch; text-align: center; padding: 24px; }
.missing h2 { font-family: var(--display); font-weight: 400; font-size: 2rem; color: var(--ice); }

@media (max-width: 640px) {
  .hero-art { aspect-ratio: auto; height: 58vh; min-height: 340px; }
  .hero-art img { object-position: 60% 50%; }
  .hero-copy { margin-top: -48px; padding: 0 18px; }
  .hero-side { gap: 16px; }
  .select { padding: 28px 18px 64px; }
  .select-head { flex-direction: column; gap: 4px; }
  .games { grid-template-columns: 1fr; }
  .bar { gap: 10px; padding: 8px 10px; }
}
