/* Some native games anchor their clear overlays to an edge. Center just the
   visible start panel inside the stage, including in a short embedded frame. */
#overlay.overlay.clear:has(> #ready-panel:not([hidden])) {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding-inline: 18px;
  padding-block: clamp(4px, 2vh, 18px);
  background-image: radial-gradient(ellipse at center, #0002, #0007);
}

#overlay.overlay.clear > #ready-panel:not([hidden]) {
  max-inline-size: 100%;
  max-block-size: 100%;
  overflow-y: auto;
}

/* Doughnut Catch uses flex centering with a desktop/RTL offset on the card. */
#overlay.overlay > #ready-panel.ready-panel:not([hidden]) {
  margin: 0;
}

@media (max-width: 520px) and (orientation: portrait) {
  #overlay.overlay.clear > #ready-panel:not([hidden]) h2 {
    overflow-wrap: anywhere;
  }

  #overlay.overlay.clear > #ready-panel:not([hidden]) .actions > button {
    min-inline-size: 0;
    max-inline-size: 100%;
    min-block-size: 44px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* The independent Da Xiao Ren runtime uses an absolutely positioned sign. */
#street #home-sign.home-sign {
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  max-inline-size: calc(100% - 24px);
  max-block-size: calc(100% - 24px);
  overflow: auto;
  overscroll-behavior: contain;
}

@media (orientation: landscape) and (max-height: 400px) {
  #street:has(#home-sign:not([hidden])) #notice {
    top: max(12px, env(safe-area-inset-top));
  }
}
