/* =============================================
   GAMES PAGE
   ============================================= */

.games-layout {
  position: relative;
  height: calc(100vh - var(--header-height));
  margin-top: var(--header-height);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(60, 80, 220, 0.04) 0%, transparent 70%),
    #000;
}

/* =============================================
   GAME CARDS — single staggered column
   Left cards sit at the left edge,
   right cards pushed to the right edge.
   ============================================= */
.game-cards {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 1.5rem;
  pointer-events: none; /* cards re-enable this individually */
}

.game-card {
  width: 235px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(5, 5, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  pointer-events: all;
  transition: border-color 0.25s, box-shadow 0.25s,
              opacity 0.35s ease,
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-card:hover {
  border-color: rgba(60, 80, 220, 0.4);
  box-shadow: 0 4px 24px rgba(60, 80, 220, 0.15);
}

/* Active: card slides toward center and vanishes */
.game-card.is-active {
  opacity: 0;
  pointer-events: none;
  transform: translateX(55px); /* left card → nudges right toward panel */
}

/* Right card slides the other way */
.game-card--right.is-active {
  transform: translateX(-55px);
}

/* Right-side card: pushed to the far right */
.game-card--right {
  margin-left: auto;
}

.game-card--soon {
  cursor: default;
  opacity: 0.4;
  pointer-events: none;
}

/* Thumbnail */
.game-card-thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.game-card-thumb svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Label (number + name) */
.game-card-label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.game-card-label--right {
  text-align: right;
}

.game-card-num {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(60, 80, 220, 0.75);
}

.game-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card-soon {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgb(199, 64, 64);
  opacity: 0.8;
}

/* Arrow — points inward */
.game-card-arrow {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
}

.game-card:hover .game-card-arrow {
  color: rgba(60, 80, 220, 0.8);
}

.game-card.is-active .game-card-arrow {
  color: rgb(60, 80, 220);
}

.game-card:hover .game-card-arrow:not(.game-card-arrow--flip) {
  transform: translateX(2px);
}

.game-card:hover .game-card-arrow--flip {
  transform: translateX(-2px);
}

/* =============================================
   GAME STAGE (center area)
   ============================================= */
.game-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  padding: 1.25rem calc(235px + 3rem);
}

/* ── Empty state ── */
.game-stage-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.3s;
}

.game-stage-empty.is-hidden {
  opacity: 0;
}

.game-stage-empty-inner {
  color: rgba(255, 255, 255, 0.15);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.game-stage-empty-inner p { margin: 0; }

/* ── Game panels ── */
.game-frame {
  position: absolute;
  top: 1.25rem;
  bottom: 1.25rem;
  left:  calc(235px + 3rem);
  right: calc(235px + 3rem);

  display: flex;
  flex-direction: column;
  gap: 0.75rem;

  background: rgba(5, 5, 20, 0.75);
  border: 1px solid rgba(60, 80, 220, 0.18);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6);

  opacity: 0;
  pointer-events: none;
  /* Default: frame belongs to a left card — slides in from the left */
  transform: translateX(calc(-100% - 4rem));
  transition: opacity 0.45s cubic-bezier(0.34, 1.05, 0.64, 1),
              transform 0.45s cubic-bezier(0.34, 1.05, 0.64, 1);
}

/* Frame belonging to a right card — slides in from the right */
.game-frame--from-right {
  transform: translateX(calc(100% + 4rem));
}

.game-frame.is-active {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}

/* Panel header */
.game-frame-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.game-frame-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.game-frame-thumb svg {
  display: block;
  width: 100%;
  height: 100%;
}

.game-frame-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Back button — top-right of the panel header */
.game-close-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}

.game-close-btn:hover {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(60, 80, 220, 0.5);
  background: rgba(60, 80, 220, 0.1);
  transform: translateX(-2px);
}

.game-frame-num {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(60, 80, 220, 0.7);
}

.game-frame-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.2px;
}

/* Iframe */
.game-iframe {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  border: 1px solid rgba(60, 80, 220, 0.15);
  border-radius: 10px;
  background: #000;
}

/* Fullscreen button */
.game-fullscreen-btn {
  align-self: center;
  flex-shrink: 0;
  font-size: 0.82rem;
  padding: 8px 22px;
  letter-spacing: 0.3px;
}

/* =============================================
   MOBILE
   ============================================= */
@media (max-width: 700px) {
  .games-layout {
    height: auto;
    min-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
  }

  .game-cards {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    flex-direction: row;
    overflow-x: auto;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    pointer-events: all;
  }

  .game-card {
    width: 150px;
    flex-shrink: 0;
    padding: 10px 12px;
    gap: 8px;
  }

  .game-card--right {
    margin-left: 0;
  }

  .game-card-thumb {
    width: 46px;
    height: 46px;
  }

  .game-card-label--right {
    text-align: left;
  }

  .game-card.is-active,
  .game-card--right.is-active {
    opacity: 0.3;
    transform: none; /* no slide on mobile — cards are in a row */
    pointer-events: none;
  }

  .game-card-arrow--flip {
    display: none;
  }

  .game-stage {
    position: relative;
    inset: auto;
    flex: 1;
    padding: 0 1rem 1rem;
    display: block;
    min-height: 65vw;
  }

  .game-stage-empty {
    position: relative;
    inset: auto;
    padding: 2rem;
  }

  .game-frame {
    position: relative;
    top: auto; right: auto; bottom: auto; left: auto;
    transform: translateX(0); /* reset slide — mobile is stacked, no slide */
    opacity: 0;
    height: 65vw;
    min-height: 260px;
    padding: 0.75rem;
    gap: 0.5rem;
    transition: opacity 0.35s ease;
  }

  .game-frame--from-right {
    transform: translateX(0);
  }

  .game-frame.is-active {
    opacity: 1;
    transform: none;
  }
}
