/* Shared fullscreen Game Player (Prompt #61) */

.lanternGamePlayerOverlay {
  position: fixed;
  inset: 0;
  z-index: 10100;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  max-height: 100svh;
  overflow: hidden;
  background: #070b12;
  display: flex;
  flex-direction: column;
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
  box-sizing: border-box;
}

.lanternGamePlayerOverlay[hidden] {
  display: none !important;
}

.lanternGamePlayer {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  color: #eaf0ff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.lanternGamePlayerTopbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 27, 51, 0.95);
}

.lanternGamePlayerTitleWrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1 1 auto;
}

.lanternGamePlayerTitleArt {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.25);
}

.lanternGamePlayerTitle {
  margin: 0;
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 900;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lanternGamePlayerExit {
  flex: 0 0 auto;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #eaf0ff;
  font-weight: 800;
  font-size: clamp(18px, 3.5vw, 22px);
  cursor: pointer;
  font-family: inherit;
  min-height: 44px;
}

.lanternGamePlayerExit:focus-visible {
  outline: 2px solid #5aa7ff;
  outline-offset: 2px;
}

/* Prompt #149 — selected-game pregame hero (canonical catalog artwork) */
.lanternGamePlayerPregame {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 1.25rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lanternGamePlayerPregame::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.lanternGamePlayerPregame[hidden] {
  display: none !important;
}

.lanternGamePlayerHero {
  width: 100%;
  flex: 0 0 auto;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.28));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.lanternGamePlayerHeroImg {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(52vh, 420px);
  object-fit: contain;
  object-position: center;
  background: rgba(0, 0, 0, 0.2);
}

.lanternGamePlayerPregameTitle {
  margin: 0;
  text-align: center;
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 1000;
  line-height: 1.15;
  letter-spacing: 0.2px;
}

.lanternGamePlayerPregameDesc {
  margin: 0;
  text-align: center;
  max-width: 36rem;
  font-size: clamp(18px, 3.4vw, 22px);
  line-height: 1.35;
  color: rgba(234, 240, 255, 0.82);
  font-weight: 600;
}

.lanternGamePlayerPregameDesc[hidden] {
  display: none !important;
}

.lanternGamePlayerPregameCost {
  margin: 0;
  text-align: center;
  max-width: 36rem;
  font-size: clamp(18px, 3.2vw, 22px);
  line-height: 1.35;
  color: rgba(234, 240, 255, 0.88);
  font-weight: 700;
}

.lanternGamePlayerPregameCost[hidden] {
  display: none !important;
}

.lanternGamePlayerNuggetIcon {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: -3px;
  margin: 0 0.15em;
}

.lanternGamePlayerPregameStatus {
  margin: 0;
  text-align: center;
  max-width: 36rem;
  font-size: clamp(18px, 3.4vw, 22px);
  line-height: 1.35;
  font-weight: 800;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 196, 86, 0.45);
  background: rgba(120, 70, 10, 0.45);
  color: #ffe7b0;
}

.lanternGamePlayerPregameStatus[hidden] {
  display: none !important;
}

.lanternGamePlayerPregameStatus.is-error {
  border-color: rgba(255, 120, 120, 0.5);
  background: rgba(110, 24, 24, 0.5);
  color: #ffd0d0;
}

.lanternGamePlayerStartBtn {
  margin-top: 0.35rem;
  min-height: 56px;
  min-width: min(100%, 280px);
  padding: 0.7rem 1.4rem;
  border-radius: 14px;
  border: 2px solid rgba(90, 167, 255, 0.55);
  background: linear-gradient(180deg, #2a78ef, #1554b0);
  color: #fff;
  font-weight: 900;
  font-size: clamp(22px, 4vw, 26px);
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.lanternGamePlayerStartBtn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.lanternGamePlayerStartBtn:focus-visible {
  outline: 2px solid #5aa7ff;
  outline-offset: 3px;
}

.lantern-game-player--pregame .lanternGamePlayerStage[hidden] {
  display: none !important;
}

.lantern-game-player--playing .lanternGamePlayerPregame {
  display: none !important;
}

.lanternGamePlayerStage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: none;
  -ms-overflow-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  padding: 1rem;
  box-sizing: border-box;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.lanternGamePlayerStage::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.lanternGamePlayerStage[hidden] {
  display: none !important;
}

.lanternGamePlayerSurfaceHost {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

body.lantern-game-player-scroll-lock {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

body.lantern-game-player-active .lanternHelpPanel,
body.lantern-game-player-active .lanternHelpToggleWrap {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Mounted game surfaces inside player */
.lanternGamePlayerStage .lanternGamePlayerMounted {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.lanternGamePlayerStage .gameArea {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100%, 720px);
  max-width: 100%;
  min-height: min(60vh, 520px);
  margin: 0;
  flex: 1 1 auto;
}

.lanternGamePlayerStage .gameArea .tapZone {
  width: 100%;
  max-width: 100%;
  min-height: clamp(140px, 35vh, 280px);
  font-size: clamp(24px, 5vw, 32px);
}

.lanternGamePlayerStage .gameArea .big {
  font-size: clamp(28px, 6vw, 40px);
}

.lanternGamePlayerStage .memGrid {
  width: min(100%, 640px);
  max-width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: clamp(8px, 2vw, 14px);
}

.lanternGamePlayerStage .memCard {
  min-height: clamp(72px, 14vw, 96px);
  font-size: clamp(28px, 6vw, 40px);
}

.lanternGamePlayerStage .cultureGameOverlay,
.lanternGamePlayerStage .nuggetHuntOverlay {
  position: static !important;
  inset: auto !important;
  top: auto !important;
  display: flex !important;
  flex-direction: column;
  width: 100%;
  max-width: min(100%, 800px);
  min-height: 0;
  max-height: none;
  height: auto;
  margin: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
}

/* Prompt #245 — mounted culture/Avatar Match surfaces must not become a second
   vertical scroll owner or a 100dvh clip frame inside the player stage. */
.lanternGamePlayerStage .cultureGameOverlay.lanternInteractiveSurface,
.lanternGamePlayerStage .cultureGameOverlay.is-avatar-match {
  overflow: visible;
  height: auto;
  max-height: none;
}

.lanternGamePlayerStage .cultureGameOverlay.is-avatar-match .gameBody,
.lanternGamePlayerStage .cultureGameOverlay.is-avatar-match .avatarMatchShell,
.lanternGamePlayerStage .cultureGameOverlay.is-avatar-match .avatarMatchChoices {
  overflow: visible;
  height: auto;
  max-height: none;
}

.lanternGamePlayerStage .cultureGameOverlay .overlayTop {
  justify-content: flex-end;
  padding: 0 0 0.75rem;
  border-bottom: none;
}

.lanternGamePlayerStage .cultureGameOverlay .overlayTitle,
.lanternGamePlayerStage .cultureGameOverlay .overlayBackBtn {
  display: none;
}

.lanternGamePlayerStage .cultureGameOverlay .gameBody {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  overflow: visible;
}

.lanternGamePlayerStage .cultureGameOverlay .choiceBtn {
  font-size: clamp(20px, 4vw, 24px);
  padding: clamp(14px, 3vw, 18px) clamp(16px, 4vw, 24px);
}

.lanternGamePlayerStage .cultureGameOverlay .triviaQuestion {
  font-size: clamp(22px, 4.5vw, 26px);
}

.lanternGamePlayerStage .nuggetHuntOverlay .overlayBtn.exit {
  display: none;
}

.lanternGamePlayerStage .nuggetHuntOverlay .boardWrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  width: 100%;
}

.lanternGamePlayerStage .nuggetHuntOverlay .iconGrid {
  width: 100%;
  justify-content: center;
}

.lanternGamePlayerStage .nuggetHuntOverlay .iconCell {
  width: clamp(40px, 10vw, 52px);
  height: clamp(40px, 10vw, 52px);
  font-size: clamp(22px, 5vw, 30px);
}

.lanternGamePlayerStage:has(.towerGameSurface.lanternGamePlayerMounted) {
  overflow: hidden;
  overflow-x: hidden;
  padding: 0;
  max-width: none;
  align-items: stretch;
  justify-content: stretch;
}

.lanternGamePlayerStage .towerGameSurface,
.towerGameSurface {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overflow-x: hidden;
  background: #0b1220;
  border-radius: 18px;
  box-sizing: border-box;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  align-self: stretch;
  flex: 1 1 auto;
}

.lanternGamePlayerStage .towerPlayFrame,
.towerPlayFrame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  max-width: 100%;
  background: #0b1220;
  flex: 1 1 auto;
  touch-action: manipulation;
}

.towerGameResult {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(11, 18, 32, 0.94);
  padding: 24px;
  text-align: center;
  box-sizing: border-box;
  overflow-x: hidden;
}

.towerGameResult[hidden] {
  display: none !important;
}

.towerGameResultScore {
  margin: 0;
  font-size: 32px;
  font-weight: 900;
  color: #ffcc66;
  line-height: 1.2;
}

.towerGameResultMsg {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #eaf0ff;
  line-height: 1.35;
  max-width: 28rem;
}

.towerGameResult .btn {
  font-size: 26px;
  font-weight: 900;
  min-height: 52px;
  padding: 12px 24px;
}

.lanternGamePlayerStage .orbitLockArea {
  width: 100%;
  max-width: min(100%, 560px);
  min-height: 0;
  justify-content: flex-start;
  overflow-x: hidden;
  touch-action: manipulation;
}

.lanternGamePlayerStage .orbitLockCanvasWrap {
  width: min(100%, 72vw, min(52dvh, 400px));
  max-height: min(52dvh, 400px);
}

.lanternGamePlayerStage .orbitLockHint,
.lanternGamePlayerStage .orbitLockFeedback {
  font-size: clamp(22px, 4vw, 26px);
}

@media (max-width: 480px) {
  .lanternGamePlayerStage {
    padding: 0.65rem;
  }

  .lanternGamePlayerTopbar {
    padding: 0.5rem 0.65rem;
  }

  .lanternGamePlayerPregame {
    padding: 0.75rem 0.75rem 1rem;
  }

  .lanternGamePlayerHeroImg {
    max-height: min(42vh, 320px);
  }

  .lanternGamePlayerTitleArt {
    width: 30px;
    height: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lanternGamePlayerStage .nuggetHuntOverlay .iconCell:hover {
    transform: none;
  }
}
