/* Independent host preserves the approved service container geometry. */
#merchant, #refine, #kafra { position: relative; }
/* G8L-227: every service panel contains its overlay, so errors stay inside the game window. */
[data-service-state] { position: relative; }
.service-entry-back { justify-self: center; margin-top: 8px; position: relative; z-index: 1; }
.service-entry-back[hidden], .service-entry-retry[hidden] { display: none; }
.service-entry-host { position: relative; height: clamp(460px, 60vh, 720px); overflow: hidden; background: #050805; border: 1px solid transparent; }
.service-entry-transition { position: absolute; inset: 0; z-index: 4; background: #000; color: #fff; display: grid; place-content: center; text-align: center; }
.service-entry-transition[hidden], .service-entry-film[hidden], .service-entry-cinematic[hidden] { display: none; }
/* G8L-228: error/closed content sits at the top of the in-frame overlay so retry is on the first screen. */
[data-service-state="ERROR"] > .service-entry-transition, [data-service-state="CLOSED"] > .service-entry-transition { align-content: start; padding-top: 24px; }
/* A2 transfer composition, ported outside themed panels and frozen service hosts. */
.service-entry-cinematic { position: fixed; z-index: 1250; inset: 0; display: grid; place-items: center; background: #000; touch-action: none; overscroll-behavior: none; }
body.service-entry-film-active { overflow: hidden; overscroll-behavior: none; }
.service-entry-film { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.service-entry-status, .service-entry-retry { z-index: 1; position: relative; }
.service-entry-retry { justify-self: center; }
@media (max-width: 520px) {
  .service-entry-host { height: 520px; }
  .service-entry-host[data-service-kind="MERCHANT"] { height: 768px; }
  .service-entry-host[data-service-kind="KAFRA"] { height: 660px; }
  #merchant, #refine, #kafra { padding-bottom: 84px; }
  .service-entry-transition { bottom: 84px; }
}
/* G8L-211 UI-3 phone 精煉: the page is exactly one screen, so nothing is cut and the page itself does not scroll.
   #game ends at the top edge of the bottom keys (their 64px hit area plus the bar's own bottom padding, mobile-nav.css);
   the host fills what is left under the top bar; inside the forge window only the 可精煉裝備 rows scroll, so the list
   reaches the menu instead of stopping inside a fixed 520px host. On a screen too short for two rows the list keeps
   a floor and the window scrolls, as it did before. Scoped to the 精煉 host: no other service page is touched. */
@media (max-width: 520px) {
  body.nav-float #game:has(> #refine.active) { height: 100dvh; padding-bottom: calc(var(--bottom-bar-h) + var(--bottom-edge) - 2px) !important; }
  #refine.active > .service-entry-host[data-service-kind="REFINE"] { height: auto; border-bottom-width: 0; }
  .service-entry-host[data-service-kind="REFINE"] .refine-scene .town-service-window.forge-window { height: calc(100% - 8px); max-height: none; }
  .service-entry-host[data-service-kind="REFINE"] .forge-refine { display: flex; flex-direction: column; }
  .service-entry-host[data-service-kind="REFINE"] .forge-list:not(.collapsed) { flex: 1 1 0; min-height: 132px; }
  .service-entry-host[data-service-kind="REFINE"] .forge-list-rows { max-height: none; }
}
