.gtp-related-games {
  box-sizing: border-box;
  width: min(100%, 1200px);
  margin: 0 auto 28px;
  padding: 0 20px;
  font: 500 15px/1.7 sans-serif;
}
.gtp-related-games h2 { font: 700 24px/1.3 sans-serif; }
.gtp-related-games nav { display: block; }
.gtp-related-games ul { padding-left: 20px; }
.gtp-related-games a { color: inherit; text-decoration: underline; }
/* Contain fixed game layers without changing their viewport-sized playfield. */
body.gtp-scroll-game {
  display: block;
  height: auto;
  overflow: auto;
  touch-action: pan-y !important;
}
.gtp-game-viewport {
  position: relative;
  contain: layout paint;
  height: 100vh;
  height: 100dvh;
  overflow: clip;
}
.gtp-game-viewport--embedded { display: flex; flex-direction: column; }
.gtp-game-viewport #world { touch-action: none; }
/* Navigation and instructions precede gameplay, outside fixed game layers. */
body:has(> .gtp-game-intro) > header {
  position: relative;
  inset: auto;
  display: flex;
}
body > #top { margin-inline: 4.5%; }
.gtp-game-intro {
  box-sizing: border-box;
  width: min(100%, 1200px);
  margin: 16px auto 0;
  padding: 0 20px;
  font: 500 15px/1.7 sans-serif;
  text-align: left;
}
.gtp-game-intro h1 {
  margin: 0 0 8px;
  font: 700 clamp(28px, 5vw, 44px)/1.2 sans-serif;
  letter-spacing: normal;
  text-transform: none;
}
.gtp-game-intro h2 { display: inline; font: 700 15px/1.5 sans-serif; }
.gtp-game-intro p { max-width: none; margin: 8px 0; font: inherit; color: inherit; }

/* The evolution strip must shrink inside the tablet game menu. */
body:has(> .gtp-game-intro) .evolution-strip { min-width: 0; }
/* Keep School Run's fixed pause dialog inside its game window. */
.gtp-game-intro ~ main#game { contain: layout paint; overflow: clip; }

.gtp-jump-to-game {
  display: inline-block; margin: 6px 0; padding: 8px 14px;
  color: inherit; border: 1px solid #8888; border-radius: 6px;
  font-weight: 700; text-decoration: none;
}
.gtp-jump-to-game:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
@media (max-width: 600px) {
  .gtp-game-intro { padding-inline: 16px; font-size: 14px; line-height: 1.5; }
  .gtp-game-intro h1 { font-size: 28px; }
}

.gtp-embed-launch { position: absolute; inset: 0; display: grid; place-content: center; background: #101c29; z-index: 2; }
.gtp-embed-launch[hidden] { display: none; }
.gtp-embed-exit { position: relative; z-index: 2; }
.gtp-game-viewport--embedded > main { position: relative; display: flex; flex-direction: column; }
.gtp-game-viewport--embedded > main > iframe { flex: 1; min-height: 0; height: 0; }
/* Preserve the hosted game's usable layout in short phone viewports. */
@media (max-height: 480px) {
  .gtp-game-viewport--embedded > main > iframe {
    position: absolute; top: 32px; left: 0; flex: none;
    width: calc(100% / var(--gtp-frame-scale, 1)); height: 600px;
    transform: scale(var(--gtp-frame-scale, 1)); transform-origin: top left;
  }
}


/* A dedicated viewport, independent of landing-page and advertising layout. */
html:has(body.gtp-gameplay), body.gtp-gameplay {
  width: 100%; height: 100%; margin: 0; overflow: hidden !important;
  overscroll-behavior: none;
}
body.gtp-gameplay { display: block; touch-action: none !important; }
body.gtp-gameplay > :not(.gtp-active-field):not(.gtp-game-layer):not(.gtp-session-controls) {
  display: none !important;
}
body.gtp-gameplay > .gtp-active-field {
  position: fixed !important; inset: 48px 0 0 !important;
  width: 100%; max-width: none; height: calc(100dvh - 48px) !important;
  min-height: 0 !important; margin: 0 !important; overflow: hidden;
}
body.gtp-gameplay > main#app.gtp-active-field {
  position: relative !important; inset: auto !important; height: auto !important;
  min-height: 0; margin: calc(48px / var(--gtp-game-scale, 1)) auto 0 !important; padding: 8px 12px;
  box-sizing: border-box;
}
.gtp-session-controls { display: none; }
body.gtp-gameplay > .gtp-session-controls {
  position: fixed; inset: 0 0 auto; height: 48px; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px max(12px, env(safe-area-inset-right)) 4px max(12px, env(safe-area-inset-left));
  background: #101c29; color: #eff5fa; box-sizing: border-box;
}
.gtp-session-controls button {
  min-height: 36px; padding: 6px 12px; border: 1px solid #52687a;
  border-radius: 6px; color: inherit; background: #1c3041; font: 600 13px sans-serif; cursor: pointer;
}
body.gtp-gameplay .gtp-active-field > #footer,
body.gtp-gameplay #app > .heading > div,
body.gtp-gameplay #app .board-caption,
body.gtp-gameplay #app .hint:not(.daily-tag),
body.gtp-gameplay #app .desktop-label { display: none !important; }
body.gtp-gameplay .gtp-embed-toolbar { display: none !important; }
body.gtp-gameplay .gtp-game-viewport--embedded > main > iframe {
  position: static; width: 100%; height: 0; flex: 1; transform: none;
}
body.gtp-gameplay #app > .heading,
body.gtp-gameplay #app .quest-panel > :is(h1,h2.gtp-game-heading),
body.gtp-gameplay #app .quest-panel > .legend,
body.gtp-gameplay .gtp-embed-launch > .gtp-embed-cover { display: none !important; }
body.gtp-gameplay .gtp-active-field .hudtop { top: max(12px, env(safe-area-inset-top)); }
/* Keep the suspended engine's viewport nonzero without reloading its iframe. */
.gtp-game-viewport--embedded > main > iframe.gtp-frame-suspended {
  display: block !important; position: absolute !important; inset: 0 !important;
  width: 100% !important; height: max(600px, 100dvh) !important;
  visibility: hidden; pointer-events: none; transform: none !important;
}
/* Landscape phones put the word grid beside the keyboard and clues. */
@media (max-height: 500px) and (min-width: 600px) {
  body.gtp-gameplay #app .game-top { padding: 0 0 4px; }
  body.gtp-gameplay #app .play-layout { display: block; max-width: none; padding-top: 6px; }
  body.gtp-gameplay #app .quest-panel:empty { display: none; }
  body.gtp-gameplay #app .board-panel {
    display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 6px 20px; max-width: 820px; align-items: center;
  }
  body.gtp-gameplay #app .board-panel > * { grid-column: 2; margin-block: 0; }
  body.gtp-gameplay #app .board-panel > .board {
    grid-column: 1; grid-row: 1 / span 6; width: 100%; max-width: 270px; margin: auto;
  }
  body.gtp-gameplay #app .board-panel > .keyboard { width: 100%; margin-inline: 0; }
  body.gtp-gameplay #app .definition-clue { padding: 8px 12px; }
  body.gtp-gameplay #app .hint-toolbar { padding: 6px 10px; }
  body.gtp-gameplay #app .tile { font-size: 20px; }
}
@media (max-height: 480px) {
  body.gtp-gameplay .gtp-game-viewport--embedded > main > iframe:not(.gtp-frame-suspended) {
    position: absolute; inset: 0 auto auto 0; flex: none;
    width: calc(100% / var(--gtp-frame-scale, 1)); height: 600px;
    transform: scale(var(--gtp-frame-scale, 1)); transform-origin: top left;
  }
}
