/* =========================================================================
   MSN Play — game screen (play.html). Shares tokens/reset/.icon-btn/.signin
   from styles.css. Measured @1900: top bar 72 · game 1494x816 · sidebar 334 ·
   outer padding 24 · gaps 24.
   ========================================================================= */

/* ------------------------------------------------------------- top bar */
.play-top {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: var(--bg);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px 0 8px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.back-btn:hover {
  /* background: var(--hover); */
}

.back-btn svg {
  width: 22px;
  height: 22px;
}

.game-meta {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 46%;
}

.game-meta .gtitle {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.esrb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.esrb .badge {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 26px;
  background: #1b1b1b;
  color: #fff;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.esrb .rating {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .4px;
  color: var(--muted);
}

.meta-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
}

.publisher {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  text-decoration: none;
}

.publisher:hover {
  text-decoration: underline;
}

.play-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vote {
  display: inline-flex;
  align-items: stretch;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  overflow: hidden;
}

.vote button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.vote button:hover {
  background: var(--hover);
}

.vote .vsep {
  width: 1px;
  background: var(--line);
}

.vote svg {
  width: 16px;
  height: 16px;
}

/* download / share / fullscreen grouped into one rounded pill (like the sample) */
.play-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
}

.play-tools .icon-btn {
  width: 32px;
  height: 32px;
}

.play-tools .icon-btn svg {
  width: 18px;
  height: 18px;
}

/* active (voted / favorited) states — filled + coloured */
.vote .up.on,
.vote .down.on {
  color: var(--accent);
}

.vote .up.on svg,
.vote .down.on svg {
  fill: currentColor;
}

#fav-btn.on {
  color: #e0245e;
}

#fav-btn.on svg {
  fill: currentColor;
}

/* ---------------------------------------------------------- share modal */
.share-modal[hidden] {
  display: none;
}

.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, .5);
  animation: share-fade .15s ease;
}

.share-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2001;
  width: 420px;
  max-width: calc(100vw - 32px);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  padding: 16px 20px 22px;
  animation: share-rise .16s ease;
}

.share-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  margin-bottom: 14px;
}

.share-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.share-close {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.share-close:hover {
  background: var(--hover);
}

.share-close svg {
  width: 18px;
  height: 18px;
}

.share-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--hover);
}

.share-thumb {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
}

.share-lead {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.share-desc {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}

.share-targets {
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  gap: 8px;
}

.share-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 72px;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
}

.sh-ico {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--card);
  color: var(--text);
}

.sh-ico svg {
  width: 22px;
  height: 22px;
}

.share-item:hover .sh-ico {
  filter: brightness(.95);
}

.sh-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

@keyframes share-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes share-rise {
  from {
    opacity: 0;
    transform: translate(-50%, -46%);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* ---- Lock the game page to the viewport: the body never scrolls, only
   .play-side does. Scoped with :has(.play-main) so other pages are untouched. ---- */
html:has(.play-main) {
  height: 100%;
}

body:has(.play-main) {
  height: 100vh;
  overflow: hidden;
}

/* ------------------------------------------------------------- main */
.play-main {
  /* reserved slot for the 728x90 ad under the game (90px creative + label) */
  --ad-h: 110px;
  display: flex;
  gap: 24px;
  padding: 0 24px 12px;
  align-items: stretch;
  height: calc(100vh - 72px);
  overflow: hidden;
}

.game-area {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  position: relative;
  height: 100%;
  overflow: hidden;
  /* iframe fills the top, the ad (when enabled) sits underneath it */
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-area iframe {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border: 0;
  display: block;
}

.game-area .loading {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  color: #cfcfcf;
  font-size: 14px;
}

.game-menu {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: rgba(20, 20, 20, .4);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.game-menu:hover {
  background: rgba(20, 20, 20, .6);
}

.game-menu svg {
  width: 22px;
  height: 22px;
}

/* ------------------------------------------------------------- sidebar */
/* the ONLY scrollable region on the game page */
.play-side {
  flex: 0 0 334px;
  width: 334px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

/* keep cards at their natural height so content overflows (and scrolls)
   instead of being squeezed to fit the column */
.play-side>* {
  flex: 0 0 auto;
}

.ad-card {
  position: relative;
  /* border: 1px solid var(--line); */
  /* border-radius: 14px; */
  overflow: hidden;
  /* height: 250px; */
  /* background: linear-gradient(135deg, #ecebe8, #dddbd6); */
  display: grid;
  place-items: center;
}

.ad-card .ad-ph {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
}

.ad-card .ad-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, .7);
  padding: 2px 7px;
  border-radius: 4px;
}

.pcard {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.signin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 16px;
}

.signin-row a {
  color: var(--accent);
  font-weight: 600;
}

.stats-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--text);
}

.stats-grid {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stats-left {
  font-size: 13px;
  color: var(--muted);
}

.stats-left .lbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stats-left .score {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin: 2px 0 10px;
}

.stats-left .rank {
  color: var(--text);
  font-size: 13px;
}

.stats-left .viewtop {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 10px;
  cursor: pointer;
}

.stats-left .viewtop svg {
  width: 14px;
  height: 14px;
}

.stats-right {
  text-align: center;
  width: 118px;
  flex: 0 0 auto;
}

.stats-right img {
  width: 86px;
  height: 86px;
  margin: 0 auto;
  display: block;
}

.stats-right .tier {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

.stats-right .tiernote {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.3;
}

.linkico {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

/* accordion (Leaderboard / How to play) */
.pacc {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 16px;
}

.pacc>summary {
  list-style: none;
  display: flex;
  align-items: center;
  height: 58px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.pacc>summary::-webkit-details-marker {
  display: none;
}

.pacc>summary .chev {
  margin-left: auto;
  transition: transform .2s ease;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.pacc>summary .chev svg {
  width: 20px;
  height: 20px;
}

.pacc[open]>summary .chev {
  transform: rotate(180deg);
}

.pacc-body {
  padding: 2px 0 16px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
}

/* breadcrumb at the top of "About this game": Home › Category › Game */
.bread {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.bread a {
  color: var(--muted);
}

.bread a:hover {
  color: var(--text);
  text-decoration: underline;
}

.bread .bread-sep {
  opacity: .6;
}

.bread .bread-cur {
  color: var(--text);
  font-weight: 600;
}

/* category / tag chips (links) */
.lb-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.lb-tab {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.lb-tab:hover {
  background: var(--hover);
  color: var(--text);
}

.lb-tab.active {
  background: var(--active);
  color: var(--text);
}

.lb-empty {
  color: var(--muted);
  text-align: center;
  padding: 10px 0;
}

.htp-list {
  margin: 0;
  padding-left: 18px;
}

.htp-list li {
  margin-bottom: 6px;
}

/* People Also Played */
.pap {
  margin-top: 2px;
}

.pap h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 6px 0 12px;
}

.pap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pap-card {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  cursor: pointer;
  display: block;
}

.pap-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}

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

.pap-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 8px 7px;
  color: var(--ovl);
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, 0));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* bottom content row (placeholder sponsored) */
.play-bottom {
  padding: 2px 24px 28px;
}

.content-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.content-card {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--bg-elev);
}

.content-card .cc-img {
  flex: 0 0 104px;
  height: 66px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ecebe8, #dddbd6);
}

.content-card .cc-text {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.content-card .cc-ad {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  font-weight: 400;
}

/* floating feedback */
.feedback-float {
  position: fixed;
  right: 16px;
  bottom: 14px;
  z-index: 50;
}


.ad-container {
  /* fixed, bounded slot: never grows into the game, and an oversized creative
     is clipped here instead of pushing the game taller / off the screen */
  flex: 0 0 var(--ad-h);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.displayAdContainer {
  position: relative;
}

.ads-title {
  text-align: center;
  color: #ccc;
  font-size: 12px;
  margin: 0;
  padding: 0;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.ads-margin {
  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;
  margin: auto;
}

/* ------------------------------------------------------------- responsive */
@media (max-width:1366px) {
  .ad-container {
    display: none;
  }
}


@media (max-width: 1200px) {

  /* narrow screens scroll the whole page normally (game on top, info below) */
  body:has(.play-main) {
    height: auto;
    overflow: visible;
  }

  .play-main {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .game-area {
    width: 100%;
    height: 62vh;
  }

  .play-side {
    flex: none;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .pap-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .game-meta {
    position: static;
    transform: none;
    max-width: none;
    margin: 0 auto;
  }

  .ad-card {
    display: none;
  }

}

@media (max-width: 620px) {
  .play-top {
    height: 58px;
    padding: 0 12px;
    gap: 6px;
  }

  .game-meta {
    display: none;
  }

  .play-main {
    padding: 0 12px 16px;
  }

  .play-bottom {
    padding: 2px 12px 24px;
  }

  .vote button span {
    display: none;
  }

  .back-btn span {
    display: none;
  }
}


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

/* phone in landscape: let the game dominate the screen (page scrolls for info) */
@media (max-width: 1200px) and (orientation: landscape) and (max-height: 500px) {
  .play-top {
    height: 56px;
  }

  .game-area {
    height: 86vh;
  }
}

/* very small phones: keep the share sheet + action bar from overflowing */
@media (max-width: 420px) {
  .share-dialog {
    padding: 14px 14px 18px;
  }

  .share-targets {
    gap: 4px;
  }

  .share-item {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
  }

  .sh-label {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .play-actions {
    gap: 6px;
  }
}


/* -------------------------------------------------- mobile (CSS) fullscreen
   Touch devices — and iOS, which has no element Fullscreen API — use this
   "fill the viewport" fullscreen instead of the native one. The game area
   covers everything (incl. the top bar) and a floating Exit button is the
   only way back out. Toggled by body.game-fs from play.js. */
body.game-fs {
  overflow: hidden;
}

body.game-fs .game-area {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  /* new viewport unit: full height even with the mobile URL bar showing */
  margin: 0;
  gap: 0;
  background: #000;
}

body.game-fs .game-area iframe {
  height: 100%;
}

body.game-fs .ad-container {
  display: none;
}

/* floating Exit / back button — lives inside .game-area, shown only in fullscreen */
.fs-exit {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px 0 11px;
  border: 0;
  border-radius: 999px;
  background: rgba(18, 18, 18, .55);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-tap-highlight-color: transparent;
}

.fs-exit:hover {
  background: rgba(18, 18, 18, .72);
}

.fs-exit svg {
  width: 20px;
  height: 20px;
}

.fs-exit[hidden] {
  display: none;
}