body {
  margin: 0;
  background: #181818;
  color: white;
  font-family: 'Montserrat', Arial, sans-serif;
  text-align: center;
}

header {
  padding: 40px 20px;
}

h1 {
  margin: 0;
  font-size: 60px;
}

.subtitle {
  margin-top: 10px;
  font-size: 24px;
}

.subtitle a {
  color: #4da3ff;
}

/* DISCORD */
.discord {
  margin-top: 10px;
}

.discord a {
  color: white;
  background: #5865F2;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

/* JOIN BUTTON */
.join-btn {
  position: fixed;
  top: 15px;
  right: 15px;
  background: black;
  color: white;
  border: 2px solid white;
  padding: 10px 16px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  z-index: 9999;
}

/* GRID */
.games {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 20px;
  max-width: 1200px;
  margin: auto;
}

.game-card {
  background: #222;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.game-card:hover {
  transform: scale(1.05);
}

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

.game-title {
  padding: 10px;
  font-size: 18px;
}

.game-card.empty {
  opacity: 0.5;
  cursor: default;
}

/* ========================= */
/*         POPUP FIX         */
/* ========================= */

.popup {
  position: fixed;
  inset: 0;
  display: none;
  background: black;
  z-index: 999999;
}

/* ensures proper stacking context */
.popup-content {
  position: relative;
  width: 100%;
  height: 100%;
  background: black;
  z-index: 1000000;
  overflow: hidden;
}

/* GAME IFRAME */
iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  z-index: 1;
  transform: translateZ(0);
}

/* ========================= */
/*     CONTROL BUTTONS       */
/* ========================= */

.close-btn,
.fullscreen-btn {
  position: absolute;
  top: 10px;
  font-size: 28px;
  padding: 10px;
  z-index: 1000001; /* ALWAYS ABOVE GAME */
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  pointer-events: auto;
}

.close-btn {
  right: 15px;
}

.fullscreen-btn {
  right: 65px;
}
