/* ============ GAMES AREA ============
   Builds on ../styles.css (tokens, glass, nav, footer, dark mode);
   only the game-specific pieces live here. */

/* ---- hub: the game big (in-game render + glass), then trailer and this week's board ---- */
.games-main { padding-top: clamp(84px, 9vw, 104px); }
.game-band {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: clamp(560px, 74vh, 760px);
  display: grid;
  align-items: end;
  border-radius: var(--radius-xl);
  color: #fff;
  background: #160a2e;
  --band-shade:   /* night purple, like the Halloween court in the picture */
    linear-gradient(90deg, rgba(16, 6, 36, 0.85) 0%, rgba(16, 6, 36, 0.38) 45%, rgba(16, 6, 36, 0) 70%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0) 42%);
}
.game-band-media {
  position: absolute; inset: 0;
  background: url("tennis/app/band-1200.webp") 74% center / cover;   /* cropped on narrow screens: keep the player (right) */
  background-image: image-set(url("tennis/app/band-1200.webp") 1x, url("tennis/app/band-2400.webp") 2x);
  transform: scale(1.02);
  transition: transform 1.6s var(--ease);
}
.game-band:hover .game-band-media { transform: scale(1.05); }
.game-band::after { content: ''; position: absolute; inset: 0; background: var(--band-shade); z-index: 0; }
.game-band .lg-mirror > .game-band-media::after { content: ''; position: absolute; inset: 0; background: var(--band-shade); }
.game-band-body { position: relative; z-index: 2; padding: clamp(28px, 5vw, 64px); max-width: 640px; }
.game-band-body .eyebrow { color: #8fd6ff; margin-bottom: 12px; text-shadow: 0 1px 10px rgba(4, 18, 54, 0.7), 0 0 2px rgba(4, 18, 54, 0.5); }   /* readable over the bright sky */
.game-band-body .headline { font-size: clamp(42px, 6vw, 76px); }
.game-band-body p { margin-top: 16px; max-width: 500px; font-size: 19px; line-height: 1.42; color: rgba(255, 255, 255, 0.82); }
.game-band-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.game-band-actions .glass-btn { min-height: 50px; padding: 0 26px; font-size: 16px; }
.game-band-stats { display: flex; gap: 30px; margin-top: 32px; padding-top: 22px; border-top: 0.5px solid rgba(255, 255, 255, 0.22); }
.game-band-stats div { font-size: 13px; color: rgba(255, 255, 255, 0.65); }
.game-band-stats strong { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: #fff; font-variant-numeric: tabular-nums; }
.game-app {
  position: absolute; z-index: 2;
  right: clamp(18px, 3.5vw, 44px); top: clamp(18px, 3.5vw, 44px);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px 10px 10px;
  border-radius: 22px;
  color: #fff;
  --lg-tint: rgba(8, 20, 50, 0.26);
}
.game-app img { width: 52px; height: 52px; border-radius: 13px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); }
.game-app strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.game-app small { font-size: 13px; color: rgba(255, 255, 255, 0.72); }
.game-band-actions .glass-dark { --lg-tint: rgba(8, 20, 50, 0.26); }

.game-extras { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-top: 16px; }
.trailer-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #000;
  aspect-ratio: 16 / 9;
}
.trailer-card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.trailer-play {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  color: #fff;
  background: linear-gradient(0deg, rgba(0,0,0,0.45), rgba(0,0,0,0.05) 60%);
}
.trailer-play[hidden] { display: none; }
.trailer-play span { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; padding-left: 4px; transition: scale 0.4s var(--ease-spring); }
.trailer-play:hover span { scale: 1.07; }
.trailer-play em { font-style: normal; font-size: 15px; font-weight: 600; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.board-card {
  display: flex; flex-direction: column;
  padding: clamp(22px, 3vw, 32px);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
}
.board-head { display: flex; justify-content: space-between; align-items: baseline; }
.board-week { font-size: 13px; color: var(--text-faint); }
.board-card h2 { margin: 6px 0 16px; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.board-list { flex: 1; border-radius: 16px; background: var(--bg-0); padding: 4px 0; align-self: stretch; }
.board-list li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 11px 16px; font-size: 15px; }
.board-list li + li { border-top: 0.5px solid var(--line); }
.board-list .rank { font-weight: 700; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.board-list li:first-child .rank { color: #c99400; }
.board-list .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .pts { font-weight: 600; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.board-list .is-empty { display: block; color: var(--text-dim); font-size: 14px; }
.board-cta { margin-top: 16px; align-self: flex-start; }

/* ---- play page ---- */
.play-section {
  padding-top: clamp(100px, 11vw, 128px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.play-head { text-align: center; }
.play-back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 500; color: var(--accent); }
.play-back:hover { text-decoration: underline; text-underline-offset: 3px; }
.play-head h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; margin: 10px 0 6px; }
.play-head p { color: var(--text-dim); font-size: 17px; }

/* the game frame: as wide as possible while the whole game still fits on screen */
.play-section { --ar: 0.5625; }
.game-stage,
.play-bar { width: min(100%, max(280px, calc((100svh - 250px) * var(--ar)))); }
.game-stage {
  position: relative;
  aspect-ratio: var(--ar);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #0b0b0d;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 30px 70px -20px rgba(0,0,0,0.35);
}
.game-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.game-stage:fullscreen,
.game-stage.is-max { border-radius: 0; width: 100%; height: 100%; aspect-ratio: auto; background: #000; }
/* fallback fullscreen: the stage covers the whole window */
.game-stage.is-max { position: fixed; inset: 0 0 auto; z-index: 200; height: var(--stage-h, 100dvh); }
html.stage-max, html.stage-max body { overflow: hidden; }
html.stage-max .glass-nav { display: none; }
html.stage-max .play-section { z-index: 300; }
.stage-close {
  display: none;
  position: absolute; bottom: calc(12px + env(safe-area-inset-bottom)); right: 12px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 15px; font-weight: 700; color: #fff;
  background: rgba(30, 30, 32, 0.45);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 6px 18px rgba(0,0,0,0.3);
}
.game-stage.is-max .stage-close, .game-stage:fullscreen .stage-close { display: block; }
.stage-launch {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px;
  padding: 0 20px 14%;
  border: 0; color: #fff; text-align: center;
  background: #0a2a6e 68% center / cover no-repeat;
  cursor: pointer;
}
.stage-launch[hidden] { display: none; }
.stage-launch::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(0deg, rgba(4, 18, 54, 0.92) 0%, rgba(4, 18, 54, 0.4) 48%, rgba(4, 18, 54, 0) 75%);
}
.stage-launch > * { position: relative; }
.stage-launch-play {
  display: grid; place-items: center;
  width: 84px; height: 84px; margin-bottom: 10px; border-radius: 50%;
  background: #fff; color: #0a2a6e;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s var(--ease-spring);
}
.stage-launch-play svg { width: 34px; height: 34px; margin-left: 4px; fill: currentColor; }
.stage-launch:active .stage-launch-play { transform: scale(0.94); }
.stage-launch strong { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.stage-launch small { font-size: 14px; color: rgba(255, 255, 255, 0.72); }
.game-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  font-size: 14px; font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  background: radial-gradient(80% 60% at 50% 40%, #1b2b4a, #0b0b0d);
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
.game-loading.is-hidden { opacity: 0; visibility: hidden; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.18);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.play-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 8px 8px 20px;
  border-radius: 999px;
  background: var(--bg-1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.play-best { font-size: 14px; color: var(--text-dim); }
.play-best strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.play-bar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.play-bar-actions .glass-btn { background: var(--bg-0); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.play-bar-actions .glass-btn::before { display: none; }
.play-bar-actions .glass-btn:hover { background: var(--bg-2); }

@media (max-width: 860px) {
  .game-extras { grid-template-columns: 1fr; }
  .game-app { display: none; }
}
@media (max-width: 760px) {
  .trailer-card { aspect-ratio: 9 / 16; max-height: 82svh; margin-inline: auto; width: 100%; }
}
@media (max-width: 640px) {
  .game-band { border-radius: var(--radius-lg); min-height: 600px; --band-shade: linear-gradient(0deg, rgba(4,18,54,0.94) 0%, rgba(4,18,54,0.55) 52%, rgba(4,18,54,0.05) 82%); }
  .game-band-media { background-position: 70% center; }
  .game-band-actions .glass-btn { flex: 1 1 auto; }
  .game-band-stats { gap: 18px; }
}
@media (max-width: 480px) {
  .play-section { padding-left: 0; padding-right: 0; gap: 14px; }
  .play-bar { border-radius: 22px; padding: 10px 10px 10px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}
