/* Official XAPP container. Application content is isolated in its XAUI iframe. */
html, body, #xappHostRoot { width: 100%; min-height: 100%; margin: 0; }
html { height: auto; touch-action: pan-x pan-y; overscroll-behavior-y: auto; }

body[data-xapp-bridge-ui="1"] {
  min-height: 100vh;
  margin: 0;
  background: var(--xui-bg-shell);
  color: var(--xui-ink);
  font: var(--xui-text-md) / var(--xui-line-height) var(--xui-font);
}

body[data-xapp-bridge-ui="1"] #xappHostRoot {
  width: 100%;
  height: 100%;
  min-height: 100vh;
}

.xapp-host-shell {
  width: 100%;
  min-height: 100%;
  display: grid;
  background: var(--xui-bg-shell);
  color: var(--xui-ink);
}

.xapp-host-frame {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  border: 0;
  background: var(--xui-surface);
}

.xapp-host-shell.is-state {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.xapp-host-state {
  width: min(520px, calc(100% - 32px));
  margin: 0;
  display: grid;
  gap: var(--xui-space-3);
  place-items: center;
  padding: var(--xui-space-6) var(--xui-space-4);
  color: var(--xui-ink);
  box-shadow: none;
  text-align: center;
}

.xapp-host-wait {
  width: min(520px, calc(100% - 32px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  gap: var(--xui-space-3);
  color: var(--xui-ink);
  box-shadow: none;
}

.xapp-host-state strong,
.xapp-host-wait strong {
  font-size: var(--xui-text-lg);
  line-height: 1.25;
}

.xapp-host-state p,
.xapp-host-wait p,
.xapp-host-wait span {
  margin: 0;
  color: var(--xui-ink-muted);
}

.xapp-host-state a:not(.xui-button) {
  color: var(--xui-accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.xapp-host-actions {
  width: min(240px, 100%);
  display: grid;
  justify-items: stretch;
}

.xapp-host-state code {
  color: var(--xui-accent-strong);
  font-family: var(--xui-mono);
  font-size: var(--xui-text-sm);
  word-break: break-all;
}

.xapp-host-wait {
  place-content: center;
  justify-items: center;
  text-align: center;
}

.xapp-host-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--xui-line-mid);
  border-top-color: var(--xui-accent);
  border-radius: 50%;
  animation: xui-host-spin 0.82s linear infinite;
}

body[data-xapp-bridge-ui="1"] {
  min-height: calc(100vh + 1px);
  min-height: calc(100dvh + 1px);
  overflow-y: auto;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: auto;
}
.xapp-host-shell { min-height: 100dvh; }
.xapp-host-frame { height: 100dvh; min-height: 100dvh; }
body[data-xapp-bridge-ui="1"] .xapp-host-shell .xapp-host-wait {
  min-height: 100dvh;
  place-content: center;
  justify-items: center;
}
body[data-xapp-bridge-ui="1"] .xui-toast-stack { z-index: var(--xui-toast-z); }
@keyframes xui-host-spin { to { transform: rotate(360deg); } }
