/* ============================================================
   WC26 Hub — Games Arcade (.page-games)
   Hub + game-host shell styling, plus the GENERIC in-game helper
   classes the individual games (js/games/*.js) build on:
     .game-stage   — centered play area
     .game-option  — big tappable answer button
                     (+ .correct green flash / .wrong red shake)
     .game-bigflag — huge flag display
   ============================================================ */

/* ---------------- arcade marquee header ---------------- */

.page-games .pg-marquee {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px 26px;
  margin-bottom: 26px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background:
    radial-gradient(420px 170px at 10% 0%, rgba(157, 107, 255, .14), transparent 60%),
    radial-gradient(440px 190px at 90% 110%, rgba(63, 142, 252, .13), transparent 60%),
    var(--surface);
  overflow: hidden;
}
.page-games .pg-marquee::before {            /* faint CRT scanlines */
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .028) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.page-games .pg-marquee::after {             /* neon host-colors edge */
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-hosts);
  filter: drop-shadow(0 2px 8px rgba(63, 142, 252, .55));
}
.page-games .pg-marquee-icon {
  font-size: 3.4rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 20px rgba(255, 201, 77, .35));
  animation: wcg-float 3.4s ease-in-out infinite;
}
.page-games .pg-marquee .page-title { margin-bottom: 4px; }
.page-games .pg-marquee .page-lead { margin-bottom: 12px; }
.page-games .pg-grad {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-games .pg-chips { display: flex; flex-wrap: wrap; gap: 8px; position: relative; }
.page-games .pg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(10, 14, 26, .55);
  color: var(--text-dim);
}
.page-games .pg-chip-gold { border-color: rgba(255, 201, 77, .45); color: var(--gold); }

@keyframes wcg-float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-8px) rotate(4deg); }
}

/* ---------------- game cards ---------------- */

.page-games .game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  cursor: pointer;
  outline: none;
}
.page-games .game-card::after {              /* gold bar sweeps in on hover */
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.page-games .game-card:hover::after,
.page-games .game-card:focus-visible::after { transform: scaleX(1); }
.page-games .game-card:focus-visible { border-color: var(--gold); }

.page-games .game-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.page-games .game-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  font-size: 1.9rem;
  line-height: 1;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: radial-gradient(circle at 30% 25%, var(--surface-3), var(--surface-2));
  box-shadow: inset 0 0 18px rgba(255, 201, 77, .07);
  transition: transform .2s ease;
}
.page-games .game-card:hover .game-card-icon,
.page-games .game-card:focus-visible .game-card-icon { transform: scale(1.12) rotate(-6deg); }

.page-games .game-card-title { font-size: 1.12rem; font-weight: 800; letter-spacing: -.2px; }
.page-games .game-card-tag { margin: 0; min-height: 2.6em; }
.page-games .game-card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
}

/* champions section */
.page-games .pg-lbs { align-items: start; }

/* ---------------- trophy cabinet (achievements) ---------------- */

.page-games .pg-cabinet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 14px;
}
.page-games .pg-cabinet-count {
  font-weight: 800;
  font-size: .85rem;
  color: var(--gold);
  white-space: nowrap;
}
.page-games .pg-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.page-games .pg-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-faint);
  cursor: help;
  outline: none;
  transition: border-color .15s ease, transform .15s ease;
}
.page-games .pg-badge:hover,
.page-games .pg-badge:focus-visible { border-color: var(--line); transform: translateY(-1px); }
.page-games .pg-badge-icon {
  font-size: 1.15rem;
  line-height: 1;
  filter: grayscale(1) brightness(.55);   /* locked = dimmed silhouette */
  opacity: .75;
}
.page-games .pg-badge.earned {
  border-color: rgba(255, 201, 77, .55);
  background:
    linear-gradient(180deg, rgba(255, 201, 77, .16), rgba(255, 201, 77, .04)),
    var(--surface-2);
  color: var(--gold);
  box-shadow: 0 0 14px rgba(255, 201, 77, .2), inset 0 0 10px rgba(255, 201, 77, .06);
}
.page-games .pg-badge.earned:hover,
.page-games .pg-badge.earned:focus-visible { border-color: var(--gold); }
.page-games .pg-badge.earned .pg-badge-icon {
  filter: drop-shadow(0 2px 8px rgba(255, 201, 77, .45));
  opacity: 1;
}

/* Polymarket CTA banner slot at the very bottom of the hub */
.page-games .pg-ref { margin-top: 24px; }
.page-games .pg-ref:empty { display: none; }

/* ---------------- game host shell ---------------- */

.page-games .pg-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-games .pg-game-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.3px;
}

.page-games .pg-howto {
  max-height: 0;
  overflow: hidden;
  margin-bottom: 0;
  transition: max-height .28s ease, margin-bottom .28s ease;
}
.page-games .pg-howto.open { max-height: 420px; margin-bottom: 14px; }
.page-games .pg-howto-inner {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 14px 16px;
  font-size: .9rem;
  color: var(--text-dim);
}
.page-games .pg-howto-inner > :first-child { margin-top: 0; }
.page-games .pg-howto-inner > :last-child { margin-bottom: 0; }

.page-games .pg-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 9px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  font-weight: 700;
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
}
.page-games .pg-hud:empty { display: none; }

.page-games .pg-game-canvas { min-height: 300px; }

/* ---------------- generic in-game helpers (used by all games) ---------------- */

.page-games .game-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 26px 16px;
  min-height: 300px;
}

.page-games .game-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, border-color .15s, background .15s, box-shadow .15s;
}
.page-games .game-option:hover:not(:disabled):not(.correct):not(.wrong) {
  border-color: var(--gold);
  background: var(--surface-3);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
}
.page-games .game-option:active:not(:disabled) { transform: scale(.97); }
.page-games .game-option:disabled { cursor: default; }
.page-games .game-option:disabled:not(.correct):not(.wrong) { opacity: .55; }

.page-games .game-option.correct {
  border-color: var(--green);
  background: rgba(25, 195, 125, .18);
  animation: wcg-correct .55s ease;
}
.page-games .game-option.wrong {
  border-color: var(--red);
  background: rgba(230, 57, 70, .16);
  animation: wcg-shake .45s ease;
}
@keyframes wcg-correct {
  0%   { box-shadow: 0 0 0 0 rgba(25, 195, 125, .55); }
  100% { box-shadow: 0 0 0 16px rgba(25, 195, 125, 0); }
}
@keyframes wcg-shake {
  10%, 90%      { transform: translateX(-2px); }
  20%, 80%      { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60%      { transform: translateX(6px); }
}

.page-games .game-bigflag {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5.4rem;          /* emoji fallback size */
  line-height: 1;
  min-height: 130px;
}
.page-games .game-bigflag .flag-img {
  height: 126px;
  width: auto;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .15), 0 16px 40px rgba(0, 0, 0, .5);
}

/* ---------------- standard end screen ---------------- */

.page-games .pg-result {
  text-align: center;
  padding: 34px 20px 26px;
  animation: wcg-pop .35s ease;
}
.page-games .pg-result-icon { font-size: 2.6rem; line-height: 1; }
.page-games .pg-result-headline { font-size: 1.45rem; font-weight: 800; margin-top: 6px; }
.page-games .pg-score {
  font-size: 4.2rem;
  font-weight: 900;
  line-height: 1.1;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(255, 201, 77, .25));
}
.page-games .pg-score-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.page-games .pg-newbest { animation: wcg-pop .45s ease .25s backwards; }
.page-games .pg-details {
  color: var(--text-dim);
  font-size: .92rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
.page-games .pg-rank { margin-top: 14px; }
.page-games .pg-result-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.page-games .pg-result-lb {
  max-width: 480px;
  margin: 24px auto 0;
  text-align: left;
}
@keyframes wcg-pop {
  0%   { transform: scale(.92); opacity: 0; }
  60%  { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------------- confetti ---------------- */

.page-games .pg-confetti {
  position: fixed;
  inset: 0;
  z-index: 150;            /* above sticky header (100), below modal (200) and toasts (300) */
  pointer-events: none;
  overflow: hidden;
}
.page-games .pg-confetti i {
  position: absolute;
  top: -24px;
  display: block;
  border-radius: 2px;
  opacity: 0;
  animation-name: wcg-confetti;
  animation-timing-function: cubic-bezier(.25, .4, .6, 1);
  animation-fill-mode: forwards;
}
@keyframes wcg-confetti {
  0%   { opacity: 1; transform: translate3d(0, -24px, 0) rotate(0deg); }
  100% { opacity: .65; transform: translate3d(var(--drift, 0px), 104vh, 0) rotate(660deg); }
}

/* ---------------- responsive ---------------- */

@media (max-width: 640px) {
  .page-games .pg-marquee {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 22px 18px;
  }
  .page-games .pg-marquee-icon { font-size: 2.8rem; }
  .page-games .pg-game-title { font-size: 1.1rem; }
  .page-games .pg-hud { gap: 12px; font-size: .88rem; padding: 8px 14px; }
  .page-games .pg-score { font-size: 3.2rem; }
  .page-games .game-bigflag { font-size: 4rem; min-height: 96px; }
  .page-games .game-bigflag .flag-img { height: 92px; }
  .page-games .game-card-tag { min-height: 0; }
}

/* ---------------- reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  .page-games .pg-marquee-icon,
  .page-games .pg-result,
  .page-games .pg-newbest,
  .page-games .game-option.correct,
  .page-games .game-option.wrong,
  .page-games .pg-confetti i { animation: none !important; }
  .page-games .game-card,
  .page-games .game-card::after,
  .page-games .game-card-icon,
  .page-games .game-option,
  .page-games .pg-badge,
  .page-games .pg-howto { transition: none !important; }
}
