/* Раздел «Игры» — партнёрский блок Яндекс Игр */

.page-yandex-games .games-page-inner {
  /* Чуть уже полный ряд — без горизонтального скролла при масштабе 100% */
  max-width: min(1540px, calc(100vw - 48px));
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(18px, 3.2vw, 44px) clamp(40px, 6vh, 72px);
  box-sizing: border-box;
}

/* Глобальный .hero ограничен 680px — на странице игр растягиваем заголовок */
.page-yandex-games .hero {
  max-width: min(1540px, calc(100vw - 48px));
  width: 100%;
  padding-left: clamp(18px, 3.2vw, 44px);
  padding-right: clamp(18px, 3.2vw, 44px);
  box-sizing: border-box;
}

/* Под «Игры» и «HTML5-игра · gph-v3», из админки → Игры */
.page-yandex-games .games-hero-description {
  margin: 1.1rem auto 0;
  max-width: min(52ch, 92vw);
  text-align: center;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--dim, #9a9288);
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .page-yandex-games .games-page-inner {
    padding-bottom: 48px;
  }
}

.page-yandex-games .yandex-games-lead {
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--dim);
  margin: 0 0 20px;
  max-width: 72ch;
}

.yandex-games-embed-shell {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0a0a0c;
  min-height: 200px;
  width: 100%;
  box-sizing: border-box;
  /* Вложенная сетка часто «липнет» влево — растягиваем по ширине оболочки */
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.yandex-games-embed-shell > * {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Типичный экспорт: display:grid + grid-template-columns в inline style с узкими px-колонками */
.yandex-games-embed-shell [style*="grid-template-columns"] {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, 280px), 1fr)
  ) !important;
  justify-content: center;
  gap: clamp(14px, 1.8vw, 26px) !important;
}

.yandex-games-embed-shell img,
.yandex-games-embed-shell video {
  max-width: 100%;
  height: auto;
}

.yandex-games-embed-shell iframe {
  display: block;
  width: 100%;
  min-height: min(72vh, 820px);
  border: none;
}

.yandex-games-placeholder {
  padding: 28px 22px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--dim);
}

.yandex-games-placeholder ul {
  margin: 16px 0 0;
  padding-left: 1.25rem;
}

.yandex-games-placeholder a {
  color: #aac8ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.yandex-games-placeholder a:hover {
  color: var(--white);
}

.yandex-games-placeholder code {
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Локальная HTML5-сборка (hosted_game в yandex_games.json) */
.hosted-game-section {
  width: 100%;
  max-width: 100%;
  margin-bottom: clamp(28px, 4vh, 52px);
  text-align: left;
}

.hosted-game-heading {
  font-size: 1.12rem;
  font-weight: 650;
  margin: 0 0 14px;
  color: var(--white, #f4f0e8);
  letter-spacing: 0.02em;
  text-align: left;
}

.hosted-game-description {
  margin: -6px 0 16px;
  max-width: 72ch;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--dim, #9a9288);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Одна колонка: сверху компактная панель, ниже игра на всю ширину блока */
.hosted-game-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
}

.hosted-game-toolbar {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 18px;
  margin-bottom: 0;
}

.hosted-game-fs-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--dim, #9a9288);
  max-width: none;
  flex: 1 1 12rem;
}

.hosted-game-fs-hint kbd {
  font-size: 0.85em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hosted-game-shell:fullscreen,
.hosted-game-shell:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: unset !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  background: #000 !important;
}

.hosted-game-shell:fullscreen .hosted-game-iframe,
.hosted-game-shell:-webkit-full-screen .hosted-game-iframe {
  position: static !important;
  flex: 1 1 auto;
  min-height: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.hosted-game-launch {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: min(52vh, 520px);
  padding: clamp(24px, 5vw, 48px);
  text-align: center;
  background: linear-gradient(165deg, rgba(30, 48, 42, 0.55) 0%, rgba(10, 12, 14, 0.92) 100%);
}

.hosted-game-launch-lead {
  margin: 0;
  font-size: 0.95rem;
  color: var(--dim, #9a9288);
  max-width: 28ch;
  line-height: 1.5;
}

/* Компактная кнопка только в блоке своей игры */
.hosted-game-toolbar .hosted-game-play-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 999px;
  color: #0f1412;
  background: linear-gradient(180deg, #e8d9a8 0%, #c9a227 45%, #a8841c 100%);
  box-shadow:
    0 2px 12px rgba(201, 162, 39, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  white-space: nowrap;
}

.hosted-game-toolbar .hosted-game-play-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow:
    0 4px 18px rgba(201, 162, 39, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.hosted-game-toolbar .hosted-game-play-btn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

/* Старые экраны без .hosted-game-toolbar (если остались) */
.hosted-game-play-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 999px;
  color: #0f1412;
  background: linear-gradient(180deg, #e8d9a8 0%, #c9a227 45%, #a8841c 100%);
}

.hosted-game-open-tab {
  font-size: 0.9rem;
  color: #aac8ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hosted-game-open-tab:hover {
  color: var(--white, #fff);
}

/* Превью: 16:9; ещё −10% к прошлому шагу (98% × 0.85 × 0.9) */
.hosted-game-section .hosted-game-shell.hosted-game-shell {
  display: block;
  position: relative;
  width: calc(98% * 0.85 * 0.9);
  max-width: 100%;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  min-height: 0;
  height: auto;
  overflow: hidden;
}

.hosted-game-section .hosted-game-shell .hosted-game-iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0 !important;
  border: none;
}

.hosted-game-missing {
  margin-bottom: clamp(20px, 3vh, 36px);
}

.hosted-game-footer-row {
  margin: 14px 0 0;
  text-align: left;
  font-size: 0.88rem;
}

.hosted-game-footer-sep {
  margin: 0 0.35em;
  opacity: 0.45;
}

.hosted-game-footer-note {
  color: var(--dim, #9a9288);
  font-size: 0.85em;
}
